Closed francescoagati closed 14 years ago
Just to be clear, the current readme is very old and out of date. The updated docs are http://scriptor.github.com/pharen/index.html.
There is a working macro reader, meaning you can quote, unquote, and splice. The # character is currently being used to specify function names when they are used as values:
(fn foo (val) (* val 2))
(map #foo [1 2 3]) ; Returns [2 4 6]
Normally in PHP, you would use regular strings: "foo". This won't work because Pharen does some processing to the names such as converting dashes to underscores, and it won't do that in regular strings.
actualli i try to make some example of onlisp with pharen with thinks like macros that define macros but i have some errors when i compile to php.
Have you try some example from onlisp? can i help you on macro definition?
I haven't tried using some of the examples from onlisp. Can you send me some of the code?
Also, make sure you are following the documentation from the link I posted above.
for example this macro in lisp return another macro in lisp
(defmacro propmacro (propname) ‘(defmacro ,propname (obj) ‘(get ,obj ’,’,propname)))
i have tried to use with pharen but i get always error
Could you paste the Pharen code that you use? Also, remember that the unquote symbol in Pharen is ~ (tilde) not , (comma).
Also, I just realized that there is a bug when you try to unquote list/dictionary indexing. For example: (defmacro foo-key (d) '(~:dict "foo")) This gives an error.
Otherwise, a macro that returns another macro should be possible.
EDIT: Since this seems to be separate from the original issue, I will create another issue for the list/dictionary indexing bug. Otherwise, if you continue having problems with the macro-inside-macro code, please make sure your version of Pharen is updated. If you still have problems, create another issue so that it can be handled separately from others.
should be nice having support for macro reader and for macro igienic con symbol generator like in clojure with character #