Arc Forumnew | comments | leaders | submitlogin
++ nil -> 1 via arithmetical plus
2 points by CatDancer 6290 days ago | 1 comment
Hmm, suppose we had a function plus which aggressively converted its arguments to numbers:

  arc> (plus 3 nil "4")
  7
then ++ could be defined in terms of plus

  arc> (= a (table))
  #hash()
  arc> (++ (a 'x))
  1


2 points by absz 6290 days ago | link

That would be interesting, but would change the current semantics. Right now:

  arc> (= s "abc") 
  "abc"
  arc> (= l nil)
  nil
  arc> (++ s "4")
  "abc4"
  arc> (++ l '(a))
  (a)
I don't know if that's a good or a bad thing, but it's worth remembering.

-----