Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about gensym? #28

Open
ooichu opened this issue Mar 23, 2023 · 2 comments
Open

What about gensym? #28

ooichu opened this issue Mar 23, 2023 · 2 comments

Comments

@ooichu
Copy link

ooichu commented Mar 23, 2023

The gensym function can be very useful in macros. It can be effectively implemented by creating symbols that are not added to symlist, so such symbols can be removed by the garbage collector and may not have a string representation.
This is how you can change the implementation of the for macro from 'scripts/macros.fe' using gensym:

(= for (mac (item lst . body)
  (let for-iter (gensym))
  (list 'do
    (list 'let for-iter lst)
    (list 'while for-iter
      (list 'let item (list 'car for-iter))
      (list '= for-iter (list 'cdr for-iter))
      (cons 'do body)
    )
  )
))

It is assumed that for-iter should not be visible when body is called. I'm implemented it in my fork.

@ghost
Copy link

ghost commented Mar 25, 2023

@ooichu It seems this project is dead.

@ooichu
Copy link
Author

ooichu commented Mar 25, 2023

Maybe. But I hope @rxi just doesn't have time for his projects right now. Most of his projects are not dead, but completed. This project is more complete than dead. I'm very fascinated by the minimalism, simplicity, and practicality of this language and sometimes find (I think) possible improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant