DocsLanguages

Languages

The same script in each language Weft speaks. All four compile to the same ops (the counter below is 91 bytes in each) and share one standard library.

JavaScript91 bytes
let n = load("count") ?? 0
store("count", n + 1)
log("run", n + 1)
Open in the playground
Python91 bytes
n = load("count") or 0
store("count", n + 1)
print("run", n + 1)
Open in the playground
Lua91 bytes
local n = load("count") or 0
store("count", n + 1)
print("run", n + 1)
Open in the playground
Lisp91 bytes
(define n (or (load "count") 0))
(store "count" (+ n 1))
(log "run" (+ n 1))
Open in the playground
LanguageBlocks and loopsValues
JavaScriptlet/const, function, arrows, if, while, for, for…of, for…innumbers, strings, arrays, objects, template strings, ?? and ?:
Pythondef, lambda, if/elif/else, while, for over range, lists, dicts, items(), enumerate()lists, dicts, f-strings, slices, in
Lualocal, function, if/elseif, while, repeat, numeric for, pairs, ipairstables as 1-based lists and maps, .., #, s:method()
Lispdefine, lambda, if, cond, let, begin, while, for, dotimeslists, dicts, strings; the last form is the value

Truthiness is one rule in every language: nil, false, 0 and the empty string are false; everything else is true.