Fennel: a Lua-like LISP
(fennel-lang.org)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 09 Sep 21:14
https://programming.dev/post/19196607
from armchair_progamer@programming.dev to programming_languages@programming.dev on 09 Sep 21:14
https://programming.dev/post/19196607
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.
- Full Lua compatibility: Easily call any Lua function or library from Fennel and vice-versa.
- Zero overhead: Compiled code should be just as efficient as hand-written Lua.
- Compile-time macros: Ship compiled code with no runtime dependency on Fennel.
- Embeddable: Fennel is a one-file library as well as an executable. Embed it in other programs to support runtime extensibility and interactive development.
Anywhere you can run Lua code, you can run Fennel code.
Example:
;; Sample: read the state of the keyboard and move the player accordingly (local dirs {:up [0 -1] :down [0 1] :left [-1 0] :right [1 0]}) (each [key [dx dy] (pairs dirs)] (when (love.keyboard.isDown key) (let [[px py] player x (+ px (* dx player.speed dt)) y (+ py (* dy player.speed dt))] (world:move player x y))))
threaded - newest
Wait,
let
is to introducelocal
s butlocal
is to introduce variables available in the whole file?…so
local
creates global variables? What?…and
local
creates constant values?