Arc Forumnew | comments | leaders | submitlogin
3 points by tokipin 6017 days ago | link | parent

i'd do it something like:

  (def person (first last age)
       (let self nil
         (= self (obj
           first first
           last last
           age age
           full (fn () (string self!first " " self!last))
           until (fn (year) (- year self!age))))))


1 point by EliAndrewC 6017 days ago | link

Wow, that's much better! I didn't think that would work, since I thought that Arc's lexical scope bound variables in inner functions to the current value of those variables. Apparently I was wrong; thanks for the tip.

-----