Comment by salsa_catsup
2 days 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?
2 days 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?
Fear 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.
I 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.
Do 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).
A colon in Guile is just a regular character. For example:
In Common Lisp a colon is a package separator, with an optional package which defaults to the keyword package if not given.
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.
1 reply →
Racket's lineage in Scheme is probably the reason it prefers lists over pretty much every other datastructure
2 replies →