Wiki: Janet
- Take advantage of short functions. For example, something like
(some-function(def a val)a)
can be (|(some-function $ $)val)
- Recursive functions are often shorter than mutable variables.
(defn f[a]...)(f a)
=> ((fn f[a]...)a)
- Use
pp
instead of print
for numbers and quotes
- Often you can use a symbol or quote instead of a string, e.g.
"Fizz"
=> 'Fizz
or :Fizz
. Using 'Fizz
also means it will work with pp
case
often saves over if
- Read the docs. There are a lot of useful functions in there.
- Splice is useful, e.g.
sum
=> +;
, or you can do string;
to join a list, print;
, etc.
- Remove
in
unless you need the default argument. You can just do ([a b c]idx)