Live data from Hacker News

Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

github.com

11–20 of 30 posts

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#12
post #6

I pine for a Lisp with the embeddable ease of Lua.

It could be trivially implemented in Lua as a pre-processor. Lua has lambdas, higher level functions, lexical scope and tail call elimination. The main problem is that it doesn't have a ternary operator, making conditional expression problematic to represent (you have to wrap an if statement in a lambda called on the fly). For something more fully featured, see [0], it is written in MoonScript (which itself compiles…

Wrapping an if in a lambda is unlikely to work as expected.

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#13

I pine for a Lisp with the embeddable ease of Lua.

Lysp ( http://piumarta.com/software/lysp/ ) is fairly close to what I'm guessing you're "pining" for and if not, hey it's open source so have at it!

Lysp uses a lot of non-standard (and rarely implemented) extensions, and so would be very hard to use in most places.

The author's own Maru (http://piumarta.com/software/maru/) might be better suited for this, but I'm not sure..

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#14
post #12
post #6

Earlier quoted context omitted.

It could be trivially implemented in Lua as a pre-processor. Lua has lambdas, higher level functions, lexical scope and tail call elimination. The main problem is that it doesn't have a ternary operator, making conditional expression problematic to represent (you have to wrap an if statement in a lambda called on the fly). For something more fully featured, see [0], it is written in MoonScript (which itself compiles…

Wrapping an if in a lambda is unlikely to work as expected.

    ((if foo + -) 4 6)
Can be compiled to

    (function()
        if foo then return plus
        else return minus
        end
    end)()(4, 6)
It is far too verbose to be used in manually crafted Lua, but acceptable if you treat it as a compiler target (with the caveat that the lambda creation will prevent LuaJIT from JITting that piece of code).

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#16
post #4

Not to be confused with Wisp: Homoiconic JS with clojure syntax, s-expressions and macros: https://github.com/Gozala/wisp

Or my: https://github.com/espringe/wisp (Whitespace lISP) with f-expressions!

You might like my whitespace lisp with f-expressions: http://akkartik.name/blog/wart

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#18
post #15

Does anyone have any good, language agnostic resources for writing interpreters (not just for lisp)?

/r/compilers [1] has some good resources. You can also check its top submissions [2].

I also recently found Matt Might's Compilers class [3] via a submission here on HN. It has a lot of language-agnostic resources.

[1]: http://www.reddit.com/r/compilers

[2]: http://www.reddit.com/r/compilers/top/

[3]: http://matt.might.net/teaching/compilers/spring-2013/

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#19
post #5

> wisp lives in the ST (optionally IO) monad. separate > interpreters with completely segregated environments can be > run concurrently. wisp has a few IO facilities, but they're > completely sandboxed and can't accidentally affect the host > program or environment. This is wonderful. There's already an embedded R5RS Scheme for Haskell ( http://hackage.haskell.org/package/husk-scheme ) but it runs everything in the I…

Apart from its use of ST rather than IO, I'm curious how else Wisp compares to Husk. As far as I can tell, despite the name, Wisp appears to be a Lisp-1 (single namespace for functions and variables, no need to call "apply" or similar on variables referencing functions to call them).

Re: Wisp: Small-but-featureful embeddable Lisp interpreter written in Haskell

#20

I pine for a Lisp with the embeddable ease of Lua.

Alex Shinn's Chibi scheme, weighing in at 50kB (but with a dependency on the Boehm garbage collector, which weighs >1 Mb ...), might fit the bill.

Some links

1. Andy Wingo (main Guile implemetor)'s "buyer's guide" to Scheme implementations - http://wingolog.org/archives/2013/01/07/an-opinionated-guide...

2. Chibi Scheme homepage - http://synthcode.com/scheme/chibi/

Post reply on HN