12 ms·
Is Racket the Lisp where I wanted to write keywords like `foo:` or `:foo`, but they went with something like `'#:foo`, which ruined keyword syntax for me?
by salsa_catsup 1mo ago
Is Racket the Lisp where I wanted to write keywords like `foo:` or `:foo`, but they went with something like `'#:foo`, which ruined keyword syntax for me?
- tmtvl 1mo agoI don't know about Racket, but I do know Guile does that and I kind of prefer it as a way to reduce syntax (because the number sign is syntax already for most Lisps as the marker for a vector, and it's also used to bring functions into the symbol namespace in a Lisp-2) by freeing the colon.
- everforward 1mo agoDo they do something neat with the colon? I do prefer the shorter keyword syntax, at least in Clojure because of how common they are. Clojure tends to use them very heavily though, and last I looked it seemed like Racket used more lists (as a matter of community preference, not forced by the language).
- packetlost 1mo agoRacket's lineage in Scheme is probably the reason it prefers lists over pretty much every other datastructure
- tmtvl 1mo agoA colon in Guile is just a regular character. For example: (define abc:def 3) (define :ghi 4) (* abc:def :ghi) ; => 12 In Common Lisp a colon is a package separator, with an optional package which defaults to the keyword package if not given. (eq :foo keyword:foo) ; => t I don't know about Clojure or Racket because I don't know much about Clojure or Racket. I know Clojure differs in various ways where syntax is concerned to Common Lisp or Scheme (I do like the idea of using square brackets to visually indicate that a collection of atoms may not represent a function call, I hate the idea of the comma being a whitespace character) and that Racket has different languages (though I don't know what that means in practise). That said, I don't quite know what to think of your third sentence: > Clojure tends to use them very heavily though, and last I looked it seemed like Racket used more lists I suppose them refers to keywords? But Racket uses more lists compared to how much Clojure uses keywords? As lists have more uses than keywords that seems likely, though as I said: I don't know anything about Clojure or Racket apart from Racket once being called PLT Scheme.
- shawn_w 1mo agoGuile keywords use the same #:foo syntax as Racket. The reader can also accept :foo or foo: notation. https://doc.guix.gnu.org/guile/latest/en/html_node/Keyword-Read-Syntax.html https://doc.guix.gnu.org/guile/latest/en/html_node/Keyword-R...
- soegaard 1mo agoFear not, you can make `#%top` and `#:app` rewrite `foo:` to `#:foo`. FWIW choosing `#:foo` over, say, `foo:` was due to backwards compatibility. In Scheme and Racket `foo:` is a legal identifier, so there might have been programs that stopped working, if `foo:` suddenly was a keyword.