Bob Tolbert
c80e3c75a0
Adding automatic gensym macro
Adding to the manual gensym for macros are 2 new macros, but very literal from the CL in letoverlambda. The first is the (with-gensyms ...) macro that can generate a small set of syms for a macro. Works something like: (defmacro adder2 [A B] (with-gensyms [a b] `(let [[~a ~A] [~b ~B]] (+ ~a ~b)))) and ~a and ~b will be replaced with (gensym "a") and (gensym "b") respectively. Then the final macro is a new defmacro that will automatically replace symbols prefaced with "g!" with a new gensym based on the rest of the symbol. So in this final version of 'nif': (defmacro/g! nif4 (expr pos zero neg) `(let [[~g!result ~expr]] (cond [(pos? ~g!result) ~pos] [(zero? ~g!result) ~zero] [(neg? ~g!result) ~neg]))) all uses of ~g!result will be replaced with (gensym "result").
Hy
Lisp and Python should love each other. Let's make it happen. Try it.
Hylarious Hacks
OK, so, why?
Well. Python is awesome. So awesome, that we have so many tools to alter the languge in a core way, but we never use them.
Why?
Well, I wrote Hy to help people realize one thing about Python:
It's really goddamn awesome.
Oh, and lisps are neat.
(fan art from the one and only doctormo)
Project
- Code: https://github.com/hylang/hy
- Docs: http://hy.rtfd.org/
- Quickstart: http://hy.rtfd.org/quickstart
- Bug reports: We have no bugs! Your bugs are your own! (https://github.com/hylang/hy/issues)
- License: MIT (Expat)
Description
Languages
Python
50.7%
Hy
41.5%
reStructuredText
7.1%
Batchfile
0.4%
Makefile
0.3%