lykn
Lisp Flavoured JavaScript
S-expression syntax compiling to clean, readable JS.
No runtime. No magic. Just parentheses.
lykn
;; Type-checked at dev time, zero-cost in production
(func greet
:args (:string name)
:returns :string
:body (template "Hello, " name "!"))
(console:log (greet "world"))
compiled javascript
// Runtime checks in dev, stripped in production
function greet(name) {
if (typeof name !== "string")
throw new TypeError(/* ... */);
const result = `Hello, ${name}!`;
return result;
}
console.log(greet("world"));
$ cargo install lykn-cli
Learn
Walk through the language in 15 interactive examples. Every one compiles live in your browser.
;; Pattern matching with exhaustiveness
(type Shape
(Circle :number radius)
(Rect :number w :number h))
(func area
:args (:any s)
:returns :number
:body
(match s
((Circle r) (* Math:PI r r))
((Rect w h) (* w h)))))
Build
Every form, every syntax, every compilation rule. The complete reference for working developers.
;; Controlled mutation with cells
(bind count (cell 0))
(swap! count (fn (:number n) (+ n 1)))
(console:log (express count))
;; → 1
Explore
Write lykn, see the compiled JavaScript, run it. All in your browser, nothing to install.
;; Threading macros for pipelines
(-> data
(JSON:parse)
(transform)
(JSON:stringify null 2)
(console:log))
What Lykn Learned
- From Scheme — the irreducible core. Five forms from which everything derives. Lykn's kernel follows this: a small set of forms mapping to JavaScript.
-
From Common Lisp — keywords (
:name), the colon-package convention adapted toobj:prop. Practical macros,defmacrostyle. -
From Clojure — threading macros (
->,->>), immutability by default, atoms renamed tocell. The!convention for mutation. - From Erlang/LFE — multi-clause function dispatch. Pattern matching. The functional commitment. The thin-skin-over-host philosophy.
-
From Rust —
Option/Resulttypes, exhaustiveness checking,Cell<T>naming. Making illegal states unrepresentable. - From Fennel — proof that the thin-skin approach works. No runtime. Compile-time macros. Small compiler. Clean output.