Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 5234 days ago | link | parent

It might be worth noting that ret was unnecessary in this case.

  (mac ret (var val . body)
   `(let ,var ,val ,@body ,var))
   
  (def question (url q a b c d)
    (let id (++ question-id*)
      (ret new (inst 'question
                     'id id 'url (video-url url)
                     'q q 'a a 'b b 'c c 'd d)
        (= (questions* id) new))))
could just be

  (def question (url q a b c d)
    (let id (++ question-id*)
      (= (questions* id)
         (inst 'question
               'id id 'url (video-url url)
               'q q 'a a 'b b 'c c 'd d))))
ret would certainly be useful in general, of course.


3 points by skenney26 5234 days ago | link

I like your rewrite of 'question.

I agree that 'ret would be more useful in other areas than here. In arc.arc 'best, 'summing, 'sum, 'listtab, 'copy, 'inst, 'w/table, 'memtable, and 'evtil all use this idiom of creating a local variable with 'let and then returning it.

-----