Comment by tmtvl

2 days ago

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:

      (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.