Arc Forumnew | comments | leaders | submitlogin
2 points by twilightsentry 5637 days ago | link | parent

How about a variant for cases like:

(def foo (bar baz) (afnwith (bar bar baz baz) ...))

Maybe something like

(def foo (bar baz) (w/afn (bar baz) ...))

?



2 points by absz 5637 days ago | link

I like this:

  (mac w/rfn (name withses . body)
    `(rfnwith ,name ,(mappend [list _ _] withses) ,@body))

  (mac w/afn (withses . body)
    `(w/rfn ,withses ,@body)
I have something like this for obj, actually, which I use for creating structure-like tables:

  (mac nobj args
    " Creates a table from the list of variables passed to it; each variable's
      name is keyed to its value.  E.g. if x = 10 and y = -10, then (nobj x y)
      results in #hash((y . -10) (x . 10)).
      See also [[obj]] [[table]] "
    `(obj ,@(mappend [list _ _] args)))

-----

2 points by conanite 5637 days ago | link

don't forget the name parameter to w/rfn in w/afn

  (mac w/afn (withses . body)
    `(w/rfn self ,withses ,@body)

-----

1 point by absz 5637 days ago | link

Whoops, you're right. My bad.

-----