Arc Forumnew | comments | leaders | submitlogin
1 point by evanrmurphy 5472 days ago | link | parent

Just realized you can get the same effect without initializing the optional arg:

  (mac wipeop (name (o msg))
    `(defop ,name ()
      (pr ,msg)))


2 points by akkartik 5472 days ago | link

Or even just:

  (def wipeop (op) (wipe srvops*.op))
You'll have to quote the name, but that seems a minor inconvenience.

-----

4 points by evanrmurphy 5472 days ago | link

I originally wrote it with 'def but switched to 'mac precisely for that inconvenience. Could do it your way with:

  (mac wipeop (op)
    `(wipe (srvops* ',op)))
I like that these actually use 'wipe and literally wipe the op. The others are more parallel to 'wipe though in that they make the page say "nil" instead of "Unknown." Recall 'wipe sets a place to nil instead of undefining completely and making it cause

  Error: "reference to undefined identifier: _test"
OTOH, I've wished before that 'wipe actually did this, and I realize it's kind of a trivial point.

-----

1 point by akkartik 5472 days ago | link

Actually not trivial at all. I agree with you.

-----

1 point by evanrmurphy 5472 days ago | link

Could even take that arg out altogether since all it's supposed to do is wipe:

  (mac wipeop (name)
    `(defop ,name ()
      (pr nil)))
There, now it's an even babier macro. ;)

-----