Arc Forumnew | comments | leaders | submitlogin
3 points by CatDancer 5847 days ago | link | parent

If I understand what you want...

  (todays-event "song" sunday-song)

  (def todays-event ((o type) (o todays-thing))
     [...]
     (todays-thing))
Because "todays-thing" can be nil since it is an optional argument, you'd probably also only want to call it if it isn't nil, like this:

  (def todays-event ((o type) (o todays-thing))
     [...]
     (if todays-thing (todays-thing)))
which in turn can be make shorter with aif:

  (def todays-event ((o type) (o todays-thing))
     [...]
     (aif todays-thing (it)))
I hope this helps!


1 point by rincewind 5847 days ago | link

What about using default paramters for optional args?

  (def todays-event ((o type) (o todays-thing nilfn))
     ...

-----

1 point by thaddeus 5847 days ago | link

That's perfect - Thank you! T.

-----