Arc Forumnew | comments | leaders | submitlogin
Arc3: mysterious (fn args ...) behaviour
7 points by conanite 5681 days ago | 3 comments
In arc2:

  arc> ( (fn args (prn args)) )
  ()
  ()
  arc>  ( (fn args (prn args)) 1 2 3 4)
  (1 2 3 4)
  (1 2 3 4)
In arc3:

  arc> ( (fn args (prn args)) )
  ()
  ()
  arc> ( (fn args (prn args)) 1 2 3 4)
  Error: "cdr: expects argument of type <pair>; given args"
I looked at ac.scm but I haven't a clue where, why or how this is happening. I assume the arc2 behaviour is the correct one?


4 points by pg 5681 days ago | link

Thanks, this was a bug. Rtm has fixed it and his fix is now in the current version (http://ycombinator.com/arc/arc3.tar).

-----

3 points by conanite 5680 days ago | link

oops ...

  arc> (coerce "foo" 'num)
  #f
I think this should be

  arc> (coerce "foo" 'num)
  Error: "Can't coerce \"foo\" num"
The fix for http://arclanguage.org/item?id=9450 in ac.scm seems to be missing the guard clause for the case where the string is not parsable as a 'num

  ((string? x)    (case type
                  ((sym)    (string->symbol x))
                  ((cons)   (ac-niltree (string->list x)))
;; -> num needs to be checked same way as 'int in the subsequent clause

                  ((num)    (apply string->number x args)) 

                  ((int)    (let ((n (apply string->number x args)))
                              (if n 
                                  (iround n)
                                  (err "Can't coerce" x type))))
                  (else     (err "Can't coerce" x type))))

-----

3 points by pg 5680 days ago | link

Yes, you're right. It's now fixed in arc3.tar.

-----