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.
let n = load("count") ?? 0
store("count", n + 1)
log("run", n + 1)Open in the playgroundn = load("count") or 0
store("count", n + 1)
print("run", n + 1)Open in the playgroundlocal n = load("count") or 0
store("count", n + 1)
print("run", n + 1)Open in the playground(define n (or (load "count") 0))
(store "count" (+ n 1))
(log "run" (+ n 1))Open in the playground| Language | Blocks and loops | Values |
|---|---|---|
| JavaScript | let/const, function, arrows, if, while, for, for…of, for…in | numbers, strings, arrays, objects, template strings, ?? and ?: |
| Python | def, lambda, if/elif/else, while, for over range, lists, dicts, items(), enumerate() | lists, dicts, f-strings, slices, in |
| Lua | local, function, if/elseif, while, repeat, numeric for, pairs, ipairs | tables as 1-based lists and maps, .., #, s:method() |
| Lisp | define, lambda, if, cond, let, begin, while, for, dotimes | lists, 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.