Live data from Hacker News

Pseudo Scheme: Scheme Implemented on Top of Common Lisp

cs.cmu.edu

11–19 of 19 posts

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#11
post #9
post #4

I've sometimes done the opposite - when working in scheme/racket, searched for implementations of things like loop, defmacro or tagbody. (They have their quirks, but when they're a good fit for a problem they can save a lot of typing.)

Chicken has a Common Lisp style `loop` egg: https://wiki.call-cc.org/eggref/5/loop I think it's based on a more generic Scheme version but I don't have a link to the original. SLIB has an implementation of pretty much the entirety of CL's `format` that I ported to Racket: https://docs.racket-lang.org/slib-format/index.html I also implemented a bunch of other CL stuff for Racket in https://docs.racket-lang.org/soup-li…

Oops! Chicken is BSD licensed, but this is GPL.

If you ship a program that includes this, it is tainted.

Possibly, the code generated by the loop macro doesn't fall under the license, but you still have to ensure that the macro itself is scrubbed from your application.

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#12
post #7

I'm curious how it handles call/cc. I at least think you would have to make your own continuation stack, unless there's some way to get at the internals of unwind-protect that would make doing it natively possible.

That's how PAIP does it, their interpreter uses continuation passing style:

22.5 An Interpreter Supporting Call/cc

https://github.com/norvig/paip-lisp/blob/main/docs/chapter22...

23.2 Introducing Call/cc [see the next chapter, 23.3 The Abstract Machine, for the implementation in bytecode]

https://github.com/norvig/paip-lisp/blob/main/docs/chapter23...

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#13
post #9

Earlier quoted context omitted.

Chicken has a Common Lisp style `loop` egg: https://wiki.call-cc.org/eggref/5/loop I think it's based on a more generic Scheme version but I don't have a link to the original. SLIB has an implementation of pretty much the entirety of CL's `format` that I ported to Racket: https://docs.racket-lang.org/slib-format/index.html I also implemented a bunch of other CL stuff for Racket in https://docs.racket-lang.org/soup-li…

Oops! Chicken is BSD licensed, but this is GPL. If you ship a program that includes this, it is tainted. Possibly, the code generated by the loop macro doesn't fall under the license, but you still have to ensure that the macro itself is scrubbed from your application.

Or... Just release your program under the GPL.

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#14
post #8

Earlier quoted context omitted.

Defmacro is trivial to implement in syntax-case, but you are in for a world of pain if you want to use bindings across modules. In have an implementation of tagbody for guile scheme somewhere, using delimited continuations. I have seen it for racket as well. There is an implementation of loop for racket, but it relies heavily on set! which will tank performance, since chez and racket (and many schemes) is pretty bad…

Defmacro isn't hygienic, while syntax- is. Is there way to use arbitrary names in hygienic syntax- macros?

If you know the name ahead of time, syntax parameters[1] (if your scheme supports them) work well. syntax-case lets you break hygiene to insert new names in a controlled fashion (but has issues with names known ahead of time; see linked paper). Renaming macros do too, I believe.

1: http://scheme2011.ucombinator.org/papers/Barzilay2011.pdf

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#15
post #2

I feel like one of the major benefits of using Scheme is how easy it is to interoperate with just about any environment. Want to embed Scheme in your C application? Take your pick from GNU Guile, Chibi, Gambit, or Chicken. How about the JVM? Kawa is solid, option. .NET? IronScheme has got you covered. Javascript? There is LIPS or BiwaScheme.

In the CL world: to embed CL in your C app: ECL; interface with the JVM: ABCL and LispWorks; for .NET: Bike (https://github.com/Lovesan/bike/). JS: JSCL and Valtan (might need more love).

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#16
post #2

I feel like one of the major benefits of using Scheme is how easy it is to interoperate with just about any environment. Want to embed Scheme in your C application? Take your pick from GNU Guile, Chibi, Gambit, or Chicken. How about the JVM? Kawa is solid, option. .NET? IronScheme has got you covered. Javascript? There is LIPS or BiwaScheme.

In the CL world: to embed CL in your C app: ECL; interface with the JVM: ABCL and LispWorks; for .NET: Bike ( https://github.com/Lovesan/bike/ ). JS: JSCL and Valtan (might need more love).

CLASP in C and C++ via LLVM.

LispWorks and Allegro CL as shared libraries in various environments. LispWorks in iOS and Android Apps.

SBCL, I think, now possibly works also as a shared library.

Re: Pseudo Scheme: Scheme Implemented on Top of Common Lisp

#18
post #8

Earlier quoted context omitted.

Defmacro is trivial to implement in syntax-case, but you are in for a world of pain if you want to use bindings across modules. In have an implementation of tagbody for guile scheme somewhere, using delimited continuations. I have seen it for racket as well. There is an implementation of loop for racket, but it relies heavily on set! which will tank performance, since chez and racket (and many schemes) is pretty bad…

Defmacro isn't hygienic, while syntax- is. Is there way to use arbitrary names in hygienic syntax- macros?

syntax-case can introduce arbitrary bindings using datum->syntax.
Post reply on HN