wisp: Whitespace to Lisp
source link: https://www.draketo.de/software/wisp
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Wisp basics
- Wisp turns indentation into lisp expressions.
- Why Wisp?
- Get it
- from its Mercurial repository:
hg clone https://hg.sr.ht/~arnebab/wisp
- Or via GNU Guix:
guix install guile guile-wisp
- Or via the package guile-wisp-hg for Arch Linux.
- Or via
./configure; make install
from the releases.
- from its Mercurial repository:
- See more examples and tests.
Update (2022-02-04):
Inspired by the FOSDEM talk Lisp, but Beautiful; Lisp for Everyone (video: lispforeveryone.webm)
by Christine Lemmer-Webber, wisp-mode 0.3.0 now
provides wisp-color-indentation-minor-mode
— optional highlighting
of the semantic indentation level using a light background color:
Also there is an experimental mode that highlights the current indentation level, but being experimental means that it might go away or receive bigger changes to behavior:
You can get wisp-mode directly from melpa.
If you have additional questions, see the FAQ
and chat in #guile at libre.chat.
That's it - have fun with wisp syntax!
Update (2021-12-20):
Wisp 1.0.7 fixes a bug in 1.0.6 that broke the insta-repl
with a lisp-style comment in a shell-script. You can again get a
wisp
shell with a single command on Guix:
guix environment --ad-hoc guile guile-wisp -- wisp
Wisp 1.0.6 enables using meta-commands in the wisp shell
(REPL). To make that possible, a single space at the start of a
chunk is ignored (this caused a syntax error in earlier versions).
Also it ensures that (language wisp)
is compiled when you run
wisp
If you have additional questions, see the Frequently asked Questions (FAQ) and chat in #guile at libre.chat.
That's it - have fun with wisp syntax!
Update (2021-05-21):
If you use GNU Guix, you can get an instant
wisp
shell with a single command:
guix environment --ad-hoc guile guile-wisp -- wisp
That’s the guix wisp insta-REPL ☺
$ guix environment --ad-hoc guile guile-wisp -- wisp GNU Guile 3.0.7 Copyright (C) 1995-2021 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. wisp@(guile-user)>
No need to install it into your system: with Guix Wisp is always at your fingertips when you need it.
Update (2021-05-02): Wisp 1.0.5 improves wisp-mode (support for imenu, thanks to Greg Reagle!), adds a test for receive, and fixes links in the documentation to point to hg.sr.ht/~arnebab/wisp.
Also it clears up license information, making it explicit that the project itself and the examples are licensed under GPLv3 or later while wisp as language and implementation of SRFI-119 as well as the tests and supporting files are licensed under the lax expat-license (thanks to Jan Wedekind for the permission!) to make it easier to embed Wisp in games that use Guile — for example Shitsumon, a game example written for the Tsukundere Visual Novel Engine.
And Tsukundere supports games written in wisp!
Also wisp-mode is available from melpa again.
If you want to see Wisp put to practical use for practical reproducible research (German article), for example in bioinformatics, have a look at the examples of the Guix Workflow Language. Deepest thanks to Ricardo Wurmus for making this a reality! This might turn wisp that I wrote just to do things right into my largest contribution to science ☺.
After installation, just run wisp
to enter a wisp-shell (REPL).
For more info about Wisp 1.0.5, see the
NEWS file.
To test wisp v1.0.5, install Guile 2.0.11 or later and bootstrap wisp:
wget https://www.draketo.de/software/wisp-1.0.5.tar.gz ; \ tar xf wisp-1.0.5.tar.gz ; cd wisp-1.0.5/ ; \ ./configure ; make check ; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
If you have additional questions, see the Frequently asked Questions (FAQ) and chat in
#guile at freenode.
That's it - have fun with wisp syntax!
Update (2020-09-15):
Wisp 1.0.3 provides a wisp
binary to start a wisp repl or run wisp files, builds with Guile 3,
and moved to sourcehut for libre hosting:
hg.sr.ht/~arnebab/wisp.
After installation, just run wisp
to enter a wisp-shell (REPL).
This release also ships wisp-mode 0.2.6 (fewer autoloads), ob-wisp 0.1 (initial support for org-babel), and additional examples. New auxiliary projects include wispserve for experiments with streaming and download-mesh via Guile, and wisp in conf:
conf new -l wisp PROJNAME
creates an autotools project with wisp, while
conf new -l wisp-enter PROJAME
creates a project with natural script writing and guile doctests set up. Both also install a script to run your project with minimal start time: I see 23ms to 27ms runtime for hello world with rare outliers at 100ms. The name of the script is the name of your project.
For more info about Wisp 1.0.3, see the
NEWS file.
To test wisp v1.0.3, install Guile 2.0.11 or
later and bootstrap wisp:
wget https://www.draketo.de/files/wisp-1.0.3.tar_.gz; \ tar xf wisp-1.0.3.tar_.gz ; cd wisp-1.0.3/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
If you have additional questions, see the Frequently asked
Questions (FAQ) and chat in
#guile
at freenode.
That's it - have fun with wisp syntax!
Update (2019-06-16): In c programming the uncommon way, specifically c-indent, tantalum is experimenting with combining wisp and sph-sc, which compiles scheme-like s-expressions to c. The result is a program written like this:
pre-include "stdio.h" define (main argc argv) : int int char** declare i int printf "the number of arguments is %d\n" argc for : (set i 0) (< i argc) (set+ i 1) printf "arg %d is %s\n" (+ i 1) (array-get argv i) return 0 ;; code-snippet under GPLv3+
To me that looks so close to C that it took me a moment to realize that it isn't just using a parser which allows omitting some special syntax of C, but actually an implementation of a C-generator in Scheme (similar in spirit to cython, which generates C from Python), which results in code that looks like a more regular version of C without superfluous parens. Wisp really completes the round-trip from C over Scheme to something that looks like C but has all the regularity of Scheme, because all things considered, the code example is regular wisp-code. And it is awesome to see tantalum take up the tool I created and use it to experiment with ways to program that I never even imagined! ♡
TLDR: tantalum uses wisp for code that looks like C and compiles to C but has the regularity of Scheme!
Update (2019-06-02): The repository at https://www.draketo.de/proj/wisp/ is stale at the moment, because the staticsite extension I use to update it was broken by API changes and I currently don't have the time to fix it. Therefore until I get it fixed, the canonical repository for wisp is https://hg.sr.ht/~arnebab/wisp/. I'm sorry for that. I would prefer to self-host it again, but the time to read up what i have to adjust blocks that right now (typically the actual fix only needs a few lines). A pull-request which fixes the staticsite extension for modern Mercurial would be much appreciated!
Update (2019-02-08): wisp v1.0 released as announced at FOSDEM. Wisp the language is complete:
display "Hello World!" ↦ (display "Hello World!")
And it achieves its goal:
“Wisp allows people to see code how Lispers perceive it. Its structure becomes apparent.” — Ricardo Wurmus at FOSDEM
Tooling, documentation, and porting of wisp are still work in progress, but before I go on, I want thank the people from the readable lisp project. Without our initial shared path, and without their encouragement, wisp would not be here today. Thank you! You're awesome!
With this release it is time to put wisp to use. To start your own project, see the tutorial Starting a wisp project and the wisp tutorial. For more info, see the NEWS file. To test wisp v1.0, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-1.0.tar.gz; \ tar xf wisp-1.0.tar.gz ; cd wisp-1.0/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
If you have additional questions, see the Frequently asked
Questions (FAQ) and chat in
#guile
at freenode.
That's it - have fun with
wisp
syntax!
Update (2019-01-27): wisp v0.9.9.1 released which includes the emacs support files missed in v0.9.9, but excludes unnecessary files which increased the release size from 500k to 9 MiB (it's now back at about 500k). To start your own wisp-project, see the tutorial Starting a wisp project and the wisp tutorial. For more info, see the NEWS file. To test wisp v0.9.9.1, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.9.1.tar.gz; \ tar xf wisp-0.9.9.1.tar.gz ; cd wisp-0.9.9.1/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2019-01-22): wisp v0.9.9 released with support for literal arrays in Guile (needed for doctests), example start times below 100ms, ob-wisp.el for emacs org-mode babel and work on examples: network, securepassword, and downloadmesh. To start your own wisp-project, see the tutorial Starting a wisp project and the wisp tutorial. For more info, see the NEWS file. To test wisp v0.9.9, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.9.tar.gz; \ tar xf wisp-0.9.9.tar.gz ; cd wisp-0.9.9/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2017-11-10): wisp v0.9.8 released with installation fixes (thanks to benq!). To start your own wisp-project, see the tutorial Starting a wisp project. For more info, see the NEWS file. To test wisp v0.9.8, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.8.tar.gz; \ tar xf wisp-0.9.8.tar.gz ; cd wisp-0.9.8/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2017-10-17): wisp v0.9.7 released with bugfixes. To start your own wisp-project, see the tutorial Starting a wisp project. For more info, see the NEWS file. To test wisp v0.9.7, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.7.tar.gz; \ tar xf wisp-0.9.7.tar.gz ; cd wisp-0.9.7/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2017-10-08):
wisp
v0.9.6 released with compatibility for tests on OSX and old
autotools, installation to guile/site/(guile version)/language/wisp
for cleaner installation, debugging and warning when using not yet
defined lower indentation levels, and with wisp-scheme.scm
moved to
language/wisp.scm
. This allows creating a wisp project by simply
copying language/
. A short tutorial for creating a wisp project is
available at
Starting
a wisp project as part of
With Guise and
Guile. For more info, see the
NEWS file. To
test wisp v0.9.6, install Guile 2.0.11 or
later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.6.tar.gz; \ tar xf wisp-0.9.6.tar.gz ; cd wisp-0.9.6/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2017-08-20): wisp v0.9.2 released with many additional examples including the proof-of-concept for a minimum ceremony dialog-based game duel.w and the datatype benchmarks in benchmark.w. For more info, see the NEWS file. To test it, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.2.tar.gz; \ tar xf wisp-0.9.2.tar.gz ; cd wisp-0.9.2/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2016-01-30): I presented Wisp in the Guile devroom at FOSDEM. The reception was unexpectedly positive — given some of the backlash the readable project got I expected an exceptionally sceptical audience, but people rather asked about ways to put Wisp to good use, for example in templates, whether it works in the REPL (yes, it does) and whether it could help people start into Scheme.
Wisp is ”The power and simplicity of #lisp with the familiar syntax of #python” talk by @ArneBab #fosdem pic.twitter.com/TaGhIGruIU — Jan Nieuwenhuizen (@JANieuwenhuizen) January 30, 2016
The atmosphere in the Guile devroom was very constructive and friendly
during all talks, and I'm happy I could meet the Hackers there in
person. I'm definitely taking good memories with me. Sadly the video
did not make it, but the
schedule-page
includes the
presentation
(pdf, 10 slides) and its
source
(org).
Have fun with
wisp
syntax!
Update (2015-10-01): wisp v0.9.0 released which no longer depends on Python for bootstrapping releases (but ./configure still asks for it — a fix for another day). And thanks to Christopher Webber there is now a patch to install wisp within GNU Guix. For more info, see the NEWS file. To test it, install Guile 2.0.11 or later and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.0.tar.gz; \ tar xf wisp-0.9.0.tar.gz ; cd wisp-0.9.0/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax!
Update (2015-09-12):
wisp
v0.8.6 released with fixed macros in interpreted code, chunking by
top-level forms, : .
parsed as nothing, ending chunks with a
trailing period, updated example
evolve
and added examples
newbase60,
cli,
cholesky
decomposition,
closure
and
hoist
in loop. For more info, see the
NEWS file.To
test it, install Guile 2.0.x or 2.2.x and
Python 3 and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.8.6.tar.gz; \ tar xf wisp-0.8.6.tar.gz ; cd wisp-0.8.6/; \ ./configure; make check; examples/newbase60.w 123
If it prints 23 (123 in NewBase60),
your wisp is fully operational.
That's it - have fun with
wisp
syntax! And a happy time together for the ones who merge their paths
today ☺
Update (2015-04-10): wisp v0.8.3 released with line information in backtraces. For more info, see the NEWS file.To test it, install Guile 2.0.x or 2.2.x and Python 3 and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.8.3.tar.gz; \ tar xf wisp-0.8.3.tar.gz ; cd wisp-0.8.3/; \ ./configure; make check; guile -L . --language=wisp tests/factorial.w; echo
If it prints 120120 (two times 120, the factorial of 5), your wisp is
fully operational.
That's it - have fun with
wisp
syntax!
Update (2015-03-18): wisp v0.8.2 released with reader bugfixes, new examples and an updated draft for SRFI 119 (wisp). For more info, see the NEWS file.To test it, install Guile 2.0.x or 2.2.x and Python 3 and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.8.2.tar.gz; \ tar xf wisp-0.8.2.tar.gz ; cd wisp-0.8.2/; \ ./configure; make check; guile -L . --language=wisp tests/factorial.w; echo
If it prints 120120 (two times 120, the factorial of 5), your wisp is
fully operational.
That's it - have fun with
wisp
syntax!
Update (2014-11-06): wisp v0.8.0 released! The new parser now passes the testsuite and wisp files can be executed directly. For more details, see the NEWS file. To test it, install Guile 2.0.x and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.8.0.tar.gz; \ tar xf wisp-0.8.0.tar.gz ; cd wisp-0.8.0/; \ ./configure; make check; guile -L . --language=wisp tests/factorial.w; echo
If it prints 120120 (two times 120, the factorial of 5), your wisp is
fully operational.
That's it - have fun with
wisp
syntax!
On a personal note: It's mindboggling that I could get this far! This is actually a fully bootstrapped indentation sensitive programming language with all the power of Scheme underneath, and it's a one-person when-my-wife-and-children-sleep sideproject. The extensibility of Guile is awesome!
Update (2014-10-17): wisp v0.6.6 has a new implementation of the parser which now uses the scheme read function. `wisp-scheme.w` parses directly to a scheme syntax-tree instead of a scheme file to be more suitable to an SRFI. For more details, see the NEWS file. To test it, install Guile 2.0.x and bootstrap wisp:
wget https://web.archive.org/web/20170219091257/https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.6.6.tar.gz; \ tar xf wisp-0.6.6.tar.gz; cd wisp-0.6.6; \ ./configure; make; guile -L . --language=wisp
That's it - have fun with
wisp
syntax at the REPL!
Caveat: It does not support the ' prefix yet (syntax point 4).
Update (2013-09-13): Wisp now has a REPL! Thanks go to
GNU Guile and especially Mark Weaver, who
guided me through the process (along with nalaginrut who answered my
first clueless questions…).
To test the REPL, get the
current code
snapshot, unpack it, run ./bootstrap.sh
, start guile with
$ guile -L .
(requires guile 2.x) and enter ,language wisp
.
Example usage:
display "Hello World!\n"
then hit enter thrice.
Voilà, you have wisp at the REPL!
/Caveeat: the wisp-parser is still experimental and contains known
bugs. Use it for testing, but please do not rely on it for important
stuff, yet./
Table of Contents
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK