One of my favorite small things about Racket is that is permits almost
anything to be an identifier -- allowing you to use whatever natural
names you prefer.

In addition to Unicode, identifiers can start with a number:

    (define 100-continue? "✓")

In the rare case where an identifier wouldn't be valid, you can use it
anyway inside pipe chars:

    (define |identifier with spaces| "✓")

(But it would be idiomatic to use `identifier-without-spaces`.)


You can even use identifiers that are entirely some number of spaces:

    (define | | "one space")
    (define |  | "two spaces")
    (equal? | | |  |)  ;#f

Which I suppose can be a nutritious part of a code obfuscation diet. :)


One gotcha, which I remember confusing myself with, early on:

    (define 'foo "foo")
    '1 ;"foo"
    '2 ;"foo"

Huh? That's because 'foo is reader shorthand for (quote foo). So the
above is actually:

    (define (quote foo)
      "foo")
    (quote 1)
    (quote 2)

In other words, it defines `quote` as a constant function that always
returns "foo". Definitions in a module shadow those provided by the
module's language -- in this case the `quote` provided by racket.
(Definitions provided by a `require`d module, however, can't be
shadowed -- that's a redefinition error.)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to