Giter Site home page Giter Site logo

macros about pharen HOT 5 CLOSED

scriptor avatar scriptor commented on September 3, 2024
macros

from pharen.

Comments (5)

Scriptor avatar Scriptor commented on September 3, 2024

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.

from pharen.

francescoagati avatar francescoagati commented on September 3, 2024

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?

from pharen.

Scriptor avatar Scriptor commented on September 3, 2024

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.

from pharen.

francescoagati avatar francescoagati commented on September 3, 2024

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

from pharen.

Scriptor avatar Scriptor commented on September 3, 2024

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.

from pharen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.