I've got a macro like that, which I call 'test. The problem with combining that and 'case is distinguishing functions and constants before the cases are eval'ed.
(def hist (seq)
(w/table h
(each n seq
(++ (h n 0)))))
I just learned about 'w/table reading your post, and I checked, and it returns the created hash. This is quite smart, I often find myself doing things like:
(let h (table)
... ; do stuff with h
h) ; return it
I'm not attached to the name, and have no objections to switching to 'socket-connect. It's only unfortunate that arc's native "open-socket" doesn't proclaim its server nature, so I figured the word "client" would help disambiguate.
> (= doomsday* 1) ; how to represent infinity? 1 will do,
> till Arc gets support.
Arc supports infinity as well as anything that uses ieee floating point. Mzscheme can directly read it with something like:
(= doomsday* +inf.0)
Alternatively, you can divide by 0, if you're sure that the division will happen in float-mode -- division-by-zero is well-defined in ieee floating arithmetic.
My motivation for currying macros came from the recent "afn with" discussion. I had a w/afn macro which looked like a manually-curried function, so I figured it wouldn't hurt to add it to the curry fn:
(mac w/afn args
`(w/rfn self ,@args))
vs.
(= w/afn (>_ w/rfn 'self))
Your [] syntax definitely looks useful, but I use (fn ((x y))) more than (fn (x y)).
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)))
Have you looked at _Essentials of Programming Languages_? It focuses on interpreters rather than compilers, but its a good place to start if you're not clear about how to lower some construct (eg, closures) that your syntax defines but which don't directly correspond to something in vbs.
On a side note, is there any particular reason you wouldn't want to use a lispey syntax? You get a lexer for free, and could implement whatever domain-specific constructs you like as macros.