Zalgorithm

Hello Fennel!

Fennel is a programming language that brings together the simplicity, speed, and reach of Lua with the flexibility of a lisp syntax and macro system: fennel-lang.org .

Install Fennel #

See Setting up Fennel .

sudo pacman -S fennel

Try Fennel? #

This works:

❯ fennel
Welcome to Fennel 1.6.1 on PUC Lua 5.4!
Use ,help to see available commands.
Try installing readline via luarocks for a better repl experience.
>> (+ 2 4 (+ 3 5))
14
>>

Installing readline via luarocks for a better experience #

I’ve got LuaRocks installed. Install the Lua readline module for Lua 5.4 with:

luarocks --lua-version=5.4 install --local readline

Using the --local flag in the above command so that the module is installed to my home directory—so it can be used without sudo.

Make LuaRocks module paths available in the current shell:

eval "$(luarocks --lua-version=5.4 path)"

Start Fennel:

❯ fennel
Welcome to Fennel 1.6.1 on PUC Lua 5.4!
Use ,help to see available commands.
>> ,help
Welcome to Fennel.
This is the REPL where you can enter code to be evaluated.
You can also run these repl commands:

  ,apropos - Print all functions matching a pattern in all loaded modules.
  ,apropos-doc - Print all functions that match the pattern in their docs
  ,apropos-show-docs - Print all documentations matching a pattern in function name
  ,compile - compiles the expression into lua and prints the result.
  ,complete - Print all possible completions for a given input symbol.
  ,doc - Print the docstring and arglist for a function, macro, or special form.
  ,find - Print the filename and line number for a given function
  ,help - Show this message.
  ,reload - Reload the specified module.
  ,reset - Erase all repl-local scope.
  ,return FORM - Evaluate FORM and return its value to the REPL's caller.
  ,exit - Leave the repl.

Use ,doc something to see descriptions for individual macros and special forms.
Values from previous inputs are kept in *1, *2, and *3.

For more information about the language, see https://fennel-lang.org/reference

Fennel + Neovim #

I’ve got the Conjure plugin installed. It should provide a Fennel REPL… and it does!

Fennel on Neovim
Fennel on Neovim

Tags: