Arc Forumnew | comments | leaders | submitlogin
Bug?
4 points by fil340 6033 days ago | 4 comments
I thought this would return an error:

(def huh? (n . n2 . n3) (prn n n2 n3))

But instead:

#<procedure: huh?>

arc> (huh? 1 2 3)

213

2



6 points by tokipin 6033 days ago | link

originally i was gonna say it might be an artifact of the autodestructuring of arguments, but:

  arc> '(1 . 2 . 3)
  (2 1 3)
which reminded of a topic here regarding mzscheme and infix notation. apparently mzscheme uses the dot for infix, so:

  (a . + . b)
is the same as:

  (+ a b)
as you can see, this works directly from arc. so your function definition is the same as:

  (def huh? (n2 n n3) (prn n n2 n3))
i'm quite proud of myself for figuring this out

-----

2 points by offby1 6032 days ago | link

As well you should be -- that's pretty subtle.

-----

2 points by utx00 6032 days ago | link

well done. someone give tokipin a cookie!

-----

1 point by fil340 6033 days ago | link

Thanks, that was driving me up the wall!

-----