Index of prelude.knk

By Section

Aliases for Primitives

def call apply apply-dict if defmulti defrecord => dict puts! ask! type callable? function? defmodule import import-from = not= < <= > >= <=> eq neq lt lte gt gte cmp abs trunc round ceil floor int->float record->dict record-type record-vals record-values record-type-name record-type-fields fail try rx-match rx-sub par sleep

Stack Shuffling

swap >< rot> <rot rot4> <rot4 dup 2dup 3dup drop 2drop 3drop nip over 2over over2

Combinators

$ 2$ 3$ @ % $$ 2$$ 3$$ dip 2dip 3dip keep 2keep bi tri mlt bi-and bi-or bi$ tri$ mlt$ all? any? bi$-and bi$-or bi~ tri~ mlt~ bi* 2bi 2tri 2bi$ 2bi$' 2bi~ 2bi~' $bi $fst $snd

Conditionals, Logic & Order

? when when1 when2 unless unless1 unless2 ~? bool not and or and' or' ~[=] ~[not=] ~[<] ~[<=] ~[>] ~[>=] ~<=> ~[<=>] ~[eq] ~[neq] ~[lt] ~[lte] ~[gt] ~[gte] ~cmp ~[cmp] min max min' max' min-by max-by cond1 ~>>

Arithmetic

+ - * neg / div mod floor/ div? even? odd? neg? zero? pos? inc dec

Strings & Characters

ord chr char? show ->str kwd->str join join-with ++sep++ lower-case upper-case trim triml trimr starts-with? ends-with?

Nil, Num, Pair & Tuples

~nil ~> ~~> ->nil num? ~neg ~zero ~pos ~num ^pair key val T() T 0T 1T 2T 3T 4T 5T len ->list tuple-show

Sequences, Lists & Ranges

Range range range-unseq range-empty? range-len range-get^' range-has?' range-elem?' [m-n] [m-n) [m-) [0-n] [0-n) [0-) [1-n] [1-n) [1-) [m-n:s] [m-n:s) [m-:s) [0-n:s] [0-n:s) [0-:s) [1-n:s] [1-n:s) [1-:s) 1list 2list 3list LSeq lseq lseq1 lazy-seq seq lseq-seq seq? unseq lseq-unseq first rest empty? seq-len ++ ^list ^seq ~seq ^seq' when-seq with-seq map filter mapl filterl zip zip' foldl foldr foldr' concat reverse range-reverse reverse-as-list each iterate cycle repeat replicate take-first drop-first take-while drop-while take-nth find partition minimum maximum sum product

Lists, Dicts & Indexing

head^ tail^ head tail uncons^ cons sort sort' uniq uniq-by update keys values vals slice [i-j) [i-) [-j) [i-j:s) [i-:s) [-j:s) [:s) slice' range-slice seq-slice get get^ has? elem? get^' has?' elem?' 1st 2nd 3rd last last^ nth nth' indexed indexed' get-in assoc assoc-in assoc' assert-in-range modify modify-in modify' modify-in' dissoc dissoc'

Regexes & String Formatting

=~ grep rx-sub1 rx-suball s/// s///g fmt

"Quasi-Macros"

let

Miscellaneous: Looping, I/O, Exceptions, etc.

id [] const times loop while until do- do-while do-until say! display! ddisplay! fmt! trace! read-line! lines! try-catch try-finally assert

Either, Functor, Monad, etc.

Left Right left right ~either ^either either? ~either' try->either either->fail -> ->' >>= >> =<< return-as bind bind-with do

The Joy of Recursion

linrec binrec

Conversion

as convert-> convert->str convert->list

Modules

require use use-from

Unicode Aliases

¬ ~[≠] ~[≤] ~[≥]

Sorted

$ $$ $bi $fst $snd % * + ++ ++sep++ - -> ->' ->list ->nil ->str / 0T 1T 1list 1st 2$ 2$$ 2T 2bi 2bi$ 2bi$' 2bi~ 2bi~' 2dip 2drop 2dup 2keep 2list 2nd 2over 2tri 3$ 3$$ 3T 3dip 3drop 3dup 3list 3rd 4T 5T < <= <=> <rot <rot4 = =<< => =~ > >< >= >> >>= ? @ LSeq Left Range Right T T() [-j) [-j:s) [0-) [0-:s) [0-n) [0-n:s) [0-n:s] [0-n] [1-) [1-:s) [1-n) [1-n:s) [1-n:s] [1-n] [:s) [] [i-) [i-:s) [i-j) [i-j:s) [m-) [m-:s) [m-n) [m-n:s) [m-n:s] [m-n] ^either ^list ^pair ^seq ^seq' abs all? and and' any? apply apply-dict as ask! assert assert-in-range assoc assoc' assoc-in bi bi$ bi$-and bi$-or bi* bi-and bi-or bind bind-with binrec bi~ bool call callable? ceil char? chr cmp concat cond1 cons const convert-> convert->list convert->str cycle ddisplay! dec def defmodule defmulti defrecord dict dip display! dissoc dissoc' div div? do do- do-until do-while drop drop-first drop-while dup each either->fail either? elem? elem?' empty? ends-with? eq even? fail filter filterl find first floor floor/ fmt fmt! foldl foldr foldr' function? get get-in get^ get^' grep gt gte has? has?' head head^ id if import import-from inc indexed indexed' int->float iterate join join-with keep key keys kwd->str last last^ lazy-seq left len let lines! linrec loop lower-case lseq lseq-seq lseq-unseq lseq1 lt lte map mapl max max' max-by maximum min min' min-by minimum mlt mlt$ mlt~ mod modify modify' modify-in modify-in' neg neg? neq nip not not= nth nth' num? odd? or or' ord over over2 par partition pos? product puts! range range-elem?' range-empty? range-get^' range-has?' range-len range-reverse range-slice range-unseq read-line! record->dict record-type record-type-fields record-type-name record-vals record-values repeat replicate require rest return-as reverse reverse-as-list right rot4> rot> round rx-match rx-sub rx-sub1 rx-suball s/// s///g say! seq seq-len seq-slice seq? show sleep slice slice' sort sort' starts-with? sum swap tail tail^ take-first take-nth take-while times trace! tri tri$ trim triml trimr tri~ trunc try try->either try-catch try-finally tuple-show type uncons^ uniq uniq-by unless unless1 unless2 unseq until update upper-case use use-from val vals values when when-seq when1 when2 while with-seq zero? zip zip' ~<=> ~> ~>> ~? ~[<=>] ~[<=] ~[<] ~[=] ~[>=] ~[>] ~[cmp] ~[eq] ~[gt] ~[gte] ~[lt] ~[lte] ~[neq] ~[not=] ~[≠] ~[≤] ~[≥] ~cmp ~either ~either' ~neg ~nil ~num ~pos ~seq ~zero ~~> ¬