git.m455.casa

fa

clone url: git://git.m455.casa/fa


esperbuild/espersrc/fennel-0.7.0/README.md

Fennel

Fennel is a lisp that compiles to Lua. It aims to be easy to use, expressive, and has almost zero overhead compared to handwritten Lua.

At https://fennel-lang.org there's a live in-browser repl you can use without installing anything.

Documentation

For a small complete example that uses the LÖVE game engine, see pong.fnl.

The changelog has a list of user-visible changes for each release.

Example

Hello World

(print "hello, world!")

Fibonacci sequence

``` (fn fib [n] (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))

(print (fib 10)) ```

Building Fennel from source

Building Fennel from source allows you to use versions of Fennel that haven't been released, and makes contributing to Fennel easier.

To build Fennel from source

  1. cd to a directory in which you want to download Fennel, such as ~/src
  2. Run git clone https://git.sr.ht/~technomancy/fennel
  3. Run cd Fennel
  4. Run make fennel to create a standalone script called fennel
  5. Copy or link the fennel script to a directory on your $PATH, such as /usr/local/bin

Note: If you copied the fennel script to one of the directories on your $PATH, then you can run fennel filename.fnl to run a Fennel file anywhere on your system.

Differences from Lua

Differences from other lisp languages

(Obviously not all these apply to every lisp you could compare Fennel to.)

Why not Fennel?

Fennel inherits the limitations of the Lua runtime, which does not offer pre-emptive multitasking or OS-level threads. Libraries for Lua work great with Fennel, but the selection of libraries is not as extensive as it is with more popular languages. While LuaJIT has excellent overall performance, purely-functional algorithms will not be as efficient as they would be on a VM with generational garbage collection.

Even for cases where the Lua runtime is a good fit, Fennel might not be a good fit when end-users are expected to write their own code to extend the program, because the available documentation for learning Lua is much more readily-available than it is for Fennel.

Resources

License

Copyright © 2016-2020 Calvin Rose and contributors

Released under the MIT license.