- cross-posted to:
- [email protected]
- cross-posted to:
- [email protected]
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))))
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?