Argmunging in Arc

Mar 05, 2008 23:28

By the way, here's what an argmunger looks like in Arc:
(def argmunge (munger victim) (fn args (apply victim (map args munger)))) It's used like so:
arc> ((argmunge '(1 0) cons) 'x 'y)
(y . x)
arc> ((argmunge '(2 3 1 1 0 3 2) list) 'a 'b 'c 'd 'e 'f 'g)
(c d b b a d c)That took a couple of minutes to write, and worked first time. Sw33t! Though I ( Read more... )

computers, programming, arc, beware the geek, argmungers

Leave a comment

Comments 2

michiexile March 6 2008, 09:38:47 UTC
Now you mention operads. Nice!

I've been wishing to bring up operads as a semantic tool for CS for quite some time now - it seems that things like the highly functional programming languages would benefit deeply from getting described with something like an operad of functions - in these things like flip and (argmunge . permutation) would just be the "obvious" way to thread in a symmetric structure.

Reply

pozorvlak March 6 2008, 10:18:05 UTC
Yes - I was going to tie yesterday's post into operad theory (I'm sure you can see how), but just writing the argmunger and writing up my development process (hey, I found it hard, so probably someone else would have too...) took me most of the day. I'll try and write the rest of the post later today.

Operads and/or multicategories are a pretty natural approach to semantics and APIs in general, I think.

Reply


Leave a comment

Up