
@jordi has joined the channel

Hi! I’m new to Racket and wanted to use it in a Calculus course starting september. Totally unrelated but I’m currently at a summer course (http://school.grammaticalframework.org/2017) and wanted to make Racket bindings to the thing used here (http://www.grammaticalframework.org) using ffi
. Now the question: what is the right way to connect to a cstruct
like this: typedef struct PgfApplication PgfApplication;
struct PgfApplication {
PgfCId fun;
int n_args;
PgfExpr args[];
};
where fun
is basically a string. The problem is args
which is expected to be dynamically created and to have n_args
elements. Thanks in advance!

hashim: it’s fine to ask here

Would anyone know why putting picts in code causes the code to become unaligned?


(If you remove the (code "hello")
line, it gets aligned as you would expect


(it also remains if I replace that line with a different pict, or freeze the pict altogether.

why are scribble URLs the way they are? e.g. "http://docs.racket-lang.org/disposable/#%28form._%28%28lib._disposable%2Fmain..rkt%29._with-disposable%29%29"

it’s the library path that the identifier is defined in

is there any way to control the url structure for a particular definition?

wondering if there’s a way I can define a link relation as a racket value with a URL pointing to its documentation without the relation being really, really ugly looking / percent encoded / contain redundant information

@jordi I don’t know the FFI, but this tutorial might help: http://prl.ccs.neu.edu/blog/2016/06/27/tutorial-using-racket-s-ffi/

use hyperlink
?

@ben not put a link in scribble, but use scribble docs as a link relations registry like https://www.iana.org/assignments/link-relations/link-relations.xhtml

or just somehow get a registry out of a package catalog so I don’t need to register a domain to get a unique url for a link relation

@notjack It actually does that if there are conflicts

If you look at the video manual (http://lang.video/documentation.html) which uses the package server, each package gets its own url

If that’s what you’re talking about

@leif actually, thinking about it more, I specifically do not want the package name to be part of the url so I have the freedom to move the code between packages without breaking links

this would definitely not be possible with scribble, though maybe some weird extension built on top of the catalog that did things with info files could do it

something like <http://docs.racket-lang.org/?pkg=foo&tag=bar>
?

which would search for a package currently named foo
and an identifier (or something) currently named bar
(current = since most recent build of the docs)

no, more something like <http://registry.pkgs.racket-lang.org/relations/bar>
which would redirect to the scribble docs for bar
in foo

basically I want a way to use the package system to somehow let packages define unique identifiers across all packages in a catalog, in a way that lets the definition of the identifier move between packages without breaking things

@notjack how would you deal with identifiers that need % encoding?

or, more significantly, packages that provide multiple bindings with the same name

for example, typed-racket-lib
provides a lot of different #%module-begin
bindings

specifically I’d want this registry server to look for conflicts and do something ring-like in choosing which one is the “official” one, with two packages providing the same relation ID being something you could consider a test failure

this is for ids that are “very special” in that they’re not just code ids, they’re ids for resources in some resful distributed system (like link relations)

ok what if <http://docs.racket-lang.org/search/index.html?q=bar\|docs.racket-lang.org/search/index.html?q=bar>
just used rings to rank results?

alright I see “very special”

emphasis on very

:pizza: ?

lol

I’m hungry now

:pizza: :pizza: :pizza:

@notjack @ben that’s close to what happens when you use an “indirect” link that goes through the “local-redirect” layer (but the use of rings is new as of today, when the pkg-build system started paying attention to rings);the indirect-link index is currently limited in what it covers, but you might look there for implementation ideas; anyway, unless I’m confused about what you’re suggesting, this is not only possible with Scribble, but it’s substantially already in place

@mflatt I didn’t really explain what I wanted very well or in detail. The indirect links are sort of related though, thanks for the pointer

@jaguilar has joined the channel

People are pretty quiet right now over on IRC, so I figured I’d ask here as well.

I was looking at https://github.com/racket/racket/blob/master/racket/src/racket/src/hash.c I was wondering … has anyone tried linear probing rather than double hashing in this hash table? And how sensitive is racket perf to the perf of this table?

I guess the last question would be, what’s the bar for changing behavior at this level?

(I’m refering to the traditional hash table, not the mzhamt thing

@jaguilar I expect that @mflatt has tried other hash tables, I think improving them would help many Racket programs, and the bar is convincing improvement, I would say

So we aren’t worried about people having dependencies on the exact shape of the internal hash function, for example? My thoughts were: 1. plug the hash function into SMHasher to see what we’re working with. Linear probing is known to be very sensitive to hash function quality.

If there’s any problem, try replacing the hash function with something of good quality.

After that, update the code, run some benchmarks, and see whether there is a detectable change.

I don’t think there would be any problem moving away from double hashing. The Racket-on-Chez port uses single hashing with linked lists for collisions, since that’s what Chez Scheme provides.

OK. I’ll take a look. Any particular benchmarks y’all like to run to verify changes to internals?

Aside from microbenchmarks, trying a build (maybe plotting like http://build-plot.racket-lang.org/) is often a good exercise to make sure that things don’t go surprisingly wrong, since a build relies on so many different things.

There are also some ok benchmarks in two places: https://github.com/racket/racket/tree/master/pkgs/racket-benchmarks/tests/racket/benchmarks


I have been working on testing the string hashing function using SMHasher

I am just testing the initial value, to see what our collision properties are

It looks not so good

And at least on my VM, it’s about 1/10th as fast as CityHash64 on longer strings

I wonder if there’s an appetite for taking on a purpose built hashing library like xxhash as a dependency

But it’s possible I’m doing something wrong. I’ll have to look at it more later.

Will try it, thanks :+1: