Arc Forumnew | comments | leaders | submitlogin
2 points by eds 6167 days ago | link | parent

Is (x . y . zs) a valid list? Shouldn't it be (x y . zs)? Not that it really changes anything above... I just wanted to point it out.


2 points by sjs 6166 days ago | link

If you think of the . here as Haskell's cons (:) then it makes sense. All the same, (x y . zs) can mean the exact same thing, not to mention it is shorter and familiar.

-----

2 points by almkglor 6166 days ago | link

Weird....

  arc> '(x . y . z)
  (y x z)

-----

5 points by soegaard 6164 days ago | link

Arc uses the PLT Scheme reader. The PLT Scheme reader has a non-standard (as compared to RnRS) extension, namely the double-dot notation. The double-dot notation is used to write "infix expressions".

Consider:

  (x . < . y)  is turned into  (< x y)
  (integer? boolean? . -> . void?) is turned into (-> integer? boolean? void?)
This reader extension can be turned off, but setting the appropriate parameter.

-----

1 point by sjs 6164 days ago | link

That is strange, and probably a bug. You can use up to 2 dots and the last dot is handled first, consing x and (z . nil) then consing y and (x (z . nil)). '(w x . y . z) gives (y w x z).

I can almost see how this bug appeared. Searching for the first part of a dotted expression yields (w x), and then searching for the 2nd part yields z. For some reason the expression becomes '(y . (w x z)); that I cannot explain without looking at the code.

-----