summaryrefslogtreecommitdiff
path: root/.fenneldoc
blob: dd836638cdc33291f34c939ecbd7fe10c6f96f4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
;; -*- mode: fennel; -*- vi:ft=fennel
;; Configuration file for Fenneldoc v0.1.9
;; https://gitlab.com/andreyorst/fenneldoc

{:fennel-path {}
 :function-signatures true
 :ignored-args-patterns ["[a-z]"
                         "%.%.%."
                         "[xkf]s"
                         "kvs"
                         "col[0-9]"
                         "cols?"
                         "rest"
                         "more"
                         "keys"
                         "tbl"
                         "_"
                         "%+"
                         "cs"
                         "sep"
                         "coll"
                         "Set"
                         "s[0-9]+"
                         "ss"
                         "args"]
 :inline-references "link"
 :insert-comment true
 :insert-copyright true
 :insert-license true
 :insert-version true
 :mode "checkdoc"
 :modules-info
 {:cljlib.fnl
  {:description "Fennel-cljlib - functions from Clojure's core.clj implemented on top of Fennel.

This library contains a set of functions providing functions that behave similarly to Clojure's equivalents.
The library itself apart from macros has nothing Fennel-specific, so it should work on Lua, e.g.:

``` lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> clj = require\"cljlib\"
> table.concat(clj.mapv(function (x) return x * x end, {1, 2, 3}), \" \")
-- 1 4 9
```

This example is mapping an anonymous `function' over a table, producing a new table, and concatenating it with `\" \"`.

However, this library also provides a Fennel-specific set of [macros](./macros.md), which provides additional facilities like `defn' or `defmulti' which extends the language allowing writing code that looks and works mostly like Clojure.

Each function in this library is created with `defn', which is a special macro for creating multi-arity functions.
So when you see a function signature like `(foo [x])`, this means that this is function `foo', which accepts exactly one argument `x'.
On the contrary, functions created with `fn' will produce a `(foo x)` signature (`x' is not inside brackets).

Functions, which signatures look like `(foo ([x]) ([x y]) ([x y & zs]))`, it is a multi-arity function, which accepts either one, two, or three or more arguments.
Each `([...])` represents a different body of a function which is chosen by checking the amount of arguments passed to the function.
See [Clojure's doc section on multi-arity functions](https://clojure.org/guides/learn/functions#_multi_arity_functions).

## Compatibility

This library is mainly developed with Lua 5.4 and tested against Lua 5.2, 5.3, 5.4, and LuaJIT 2.1.0-beta3.
Note, that in Lua 5.2 and LuaJIT equality semantics are a bit different from Lua 5.3 and Lua 5.4.
The main difference is that when comparing two tables, they must have exactly the same `__eq` metamethods, so comparing hash sets with hash sets will work, but comparing sets with other tables works only in Lua5.3+.
Another difference is that Lua 5.2 and LuaJIT don't have an inbuilt UTF-8 library, therefore `seq' function will not work for non-ASCII strings."
   :doc-order ["ns"
               "in-ns"
               "def"
               "fn*"
               "defn"
               "defn-"
               "time"
               "if-let"
               "when-let"
               "if-some"
               "when-some"
               "defmulti"
               "defmethod"
               "cond"
               "loop"
               "try"
               "lazy-seq"
               "lazy-cat"
               "apply"
               "add"
               "sub"
               "mul"
               "div"
               "le"
               "lt"
               "ge"
               "gt"
               "inc"
               "dec"
               "eq"
               "map?"
               "vector?"
               "multifn?"
               "set?"
               "nil?"
               "zero?"
               "pos?"
               "neg?"
               "even?"
               "odd?"
               "string?"
               "boolean?"
               "true?"
               "false?"
               "int?"
               "pos-int?"
               "neg-int?"
               "double?"
               "empty?"
               "not-empty"
               "vector"
               "seq"
               "first"
               "rest"
               "last"
               "butlast"
               "conj"
               "disj"
               "cons"
               "concat"
               "reduce"
               "reduced"
               "reduce-kv"
               "mapv"
               "filter"
               "every?"
               "some"
               "not-any?"
               "range"
               "reverse"
               "take"
               "nthrest"
               "partition"
               "identity"
               "comp"
               "complement"
               "constantly"
               "memoize"
               "assoc"
               "hash-map"
               "get"
               "get-in"
               "keys"
               "vals"
               "find"
               "dissoc"
               "remove-method"
               "remove-all-methods"
               "methods"
               "get-method"
               "hash-set"]
   :name "cljlib"}}
 :order "alphabetic"
 :out-dir "./doc"
 :project-copyright "Copyright (C) 2020-2021 Andrey Listopadov"
 :project-license "[MIT](https://gitlab.com/andreyorst/fennel-cljlib/-/raw/master/LICENSE)"
 :project-version "v1.1.1"
 :sandbox false
 :test-requirements {:cljlib.fnl "(require-macros (doto :cljlib require))
                                  (require-macros (doto :fennel-test.fennel-test require))"}
 :toc true}