Arc Forumnew | comments | leaders | submitlogin
4 points by rincewind 5786 days ago | link | parent

  (or= value2 'wahoo)


2 points by thaddeus 5786 days ago | link

That does it.... Thanks, T.

    (def the-example (value1 value2 value3 value4)
         (or= value1 'Results)
         (or= value2 'wahoo!)
         (or= value3 'ugh!)
         (or= value4 'omg!)
         (prn "Value1: " value1)
         (prn "Value2: " value2)
         (prn "Value3: " value3)
         (prn "Value4: " value4)
)

-----

3 points by absz 5785 days ago | link

You could also wrap your or= sequence in a macro:

  (mac defaults args
    `(do ,@(pair args (fn (var val) `(or= ,var ,val)))))
  
  (def the-example (value1 value2 value3 value4)
    (defaults value1 'Results
              value2 'wahoo!
              value3 'ugh!
              value4 'omg!)
    (prn "Value1: " value1)
    (prn "Value2: " value2)
    (prn "Value3: " value3)
    (prn "Value4: " value4))

-----