Arc Forumnew | comments | leaders | submitlogin
. symbol
1 point by anoni 5921 days ago | 3 comments
I tried using the symbol ., but the arc prompt gives an error:

  arc> '.
  Error: "UNKNOWN::1985: read: illegal use of \".\""
a. and .a (not to mention .. and ...) are fine, so why not .? Does this have something to do with intrasymbol ., or is it a bug?


5 points by rocketnia 5921 days ago | link

If you need to use the particular name "." and you're not worried about brevity, you can input the symbol like this:

  arc> (coerce "." 'sym)
  |.|
  arc> '|.|
  |.|
  arc> (is '|.| (coerce "." 'sym))
  t
It's the same as escaping the symbols |(|, |)|, |'|, |"|, etc. These characters have special meaning to the reader, so they're less convenient to use in symbols.

As for . specifically, it's special to the reader because of dotted lists:

  arc> (nthcdr 3 '(a b c . terminator))
  terminator
Also, as long as . is already special, MzScheme overloads it for a kind of infix-like syntax sugar, which Arc inherits:

  arc> '(a b c . <- . x y z)
  (<- a b c x y z)
A reader could probably be smart enough to interpret "'." as being equivalent to "'|.|", but this one doesn't go to that trouble. I don't blame it, either. As long as . means something special to the reader in one symbol-like place, and as long as MzScheme is going to use it for other things like infix syntax, it might as well be treated as a reserved word.

-----

1 point by anoni 5920 days ago | link

Good point. I ran into the same problem with |, but it's not a big deal if I have to use different symbols.

-----

1 point by aw 5921 days ago | link

It's a limitation of MzScheme:

  $ mzscheme
  Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
  > '.
  stdin::1: read: illegal use of "."

-----