clone url: git://git.m455.casa/fa
esperbuild/espersrc/fennel-0.7.0/test/macros.fnl
1 | ;; this module is loaded by the test suite. |
2 | {"->1" (fn [val ...] |
3 | (var x val) |
4 | (each [_ elt (ipairs [...])] |
5 | (table.insert elt 2 x) |
6 | (set x elt)) |
7 | x) |
8 | :defn1 (fn [name args ...] |
9 | (assert (sym? name) "defn1: function names must be symbols") |
10 | `(global ,name (fn ,args ,...))) |
11 | :inc (fn [n] (if (not (list? n)) `(+ ,n 1) |
12 | `(let [num# ,n] (+ num# 1)))) |
13 | :inc! (fn [a ?n] `(set ,a (+ ,a (or ,?n 1)))) |
14 | :multigensym (fn [] |
15 | `(let [x# {:abc (fn [] 518)} |
16 | y# {:one 1}] |
17 | (+ (x#:abc) y#.one))) |
18 | :unsandboxed (fn [] ((require :fennelview) [:no :sandbox]))} |