Probably the thing I think Racket does most right which is actionable in Guile: hashmaps.
- Immutable hashmaps included by default
- Immutable hashmaps are included in the read/write syntax, so there's no temptation to use an alist when it isn't appropriate
- No hash-ref vs hashq-ref vs hashv-ref! The hashmap knows what "type" it is. This is the source of many subtle errors in Guile, IME.
The way to do it:
- add a immutable hashmaps to Guile
- have them do the right thing with hash-set/hash-ref (they should know what type they are)
- Add hashes to the *default* read syntax in Guile.
@cwebber how does the current syntax looks like? (how can it look if it's Lisp and not Clojure?)
@charlag Also I'd consider the syntax above to be *considerably* lispier than Clojure's
@charlag so an alist looks like this, right?
;; a list of cons cells where the
;; car is the key and cdr is the value
'((foo . bar) (baz . basil))
A Racket hashmap is just like this but with #hash or #hasheq or #hasheqv prepended (depending on the equality check of equal, eq, eqv)
'#hasheq((foo . bar) (baz . basil))
So I say this is pretty lispy since in Guile vectors look like:
'#(foo bar baz)
@cwebber oh, you didn't have to, but thanks, it is clear now!
@charlag maybe it would be clearer if I showed:
'#hasheq((key1 . val1) (key2 . val2))