Complete library index
Calque ships a large library, including general-purpose functions, specialist algorithms, compatibility aliases, and low-level building blocks used to implement the higher-level APIs. The normal public starting points are shown with runnable code in Functions by example.
This page tells you where every exported name belongs. The compiler installed on your machine is the authoritative source for exact signatures and source:
que --lib names '*'
que --lib types 'Table/*'
que --lib source Table/update-or!
Common functions
Most Calque programs use a fairly small part of the library. Start with these names; the sections below remain the complete family index, and Functions by example shows each of these patterns in runnable code.
| Need | Start with |
|---|---|
| Build integer data | range, range/exclusive, fill, replicate |
| Transform or retain vector values | map, map/i, filter (or select), exclude, flat-map |
| Visit for effects | for, each, for/i, each/i |
| Combine or inspect values | reduce, sum, product, count, find, some?, every?, minimum, maximum |
| Reshape a vector | reverse, flat, zip, unzip, slice, take/first, drop/first, partition, pairwise |
| Order or classify values | sort, group, unique/int, unique/char |
| Parse or assemble text | split, split/lines, split/spaces, split/words, trim, join, String->Integer, Integer->String |
| Use key-value data | Table/new, Table/set!, Table/get, Table/has?, Table/entries, Table/update-or!, Table/count |
| Work directly with a vector | length, get, set!, push!, pop!, pop-val!, empty!, capacity!, in-bounds? |
The usual collection convention is data last, so calls compose through
|>:
(|> [1 2 3 4]
(map (lambda (x) (* x x)))
(filter (lambda (x) (> x 4)))
sum)
; 25
get, pop-val!, first, and last require a valid value. When an index or
input length is dynamic, check it with in-bounds? or use Vector/get*,
which returns (Option T).
Core language operations
The compiler provides vector and tuple primitives: length, get, set!,
push!, pop!, pop-val!, empty!, capacity!, car, cdr, cons,
fst, snd, box, and swap!. It also provides arithmetic,
comparison, bitwise, boolean, character, decimal, I/O, serialization, and
filesystem primitives. These are described in the language chapters rather
than duplicated as library implementations.
Macros include cond, when, when-not, unless, |>, <|, comp,
apply, loop, loop/for, loop/in, loop/in/i, times, mutation sugar
such as ++ and +=, and compile-time helpers such as test.
Functional and vector helpers
The unnamespaced functional collection surface is in lisp/fp.lisp:
- Construction and shape:
range,range/inclusive,range/exclusive,range/dec,fill,replicate,copy,reverse,flat,flat-map,zip,unzip,zip-with,transpose,interleave,intersperse,partition,window,pairwise,slice,take/first,take/last,drop/first,drop/last,take/while,drop/while,cycle,subset,permutation,combination,combination/n, andscan. - Traversal:
map,map/i,filter,filter/i,select,exclude,for,for/i,each,each/i,reduce,reduce/i,map/until,map/until/i,reduce/until,reduce/until/i,for/until, andfor/until/i. - Queries and aggregation:
empty?,not-empty?,in-bounds?,find,count,count/int,count/char,count/dec,count/bool,some?,some/i?,every?,every/i?,sum,sum/dec,product,product/dec,minimum,minimum/dec,maximum,maximum/dec,mean,mean/dec,median,median/dec,avg, andavg/dec. - Ordering and specialized operations:
sort,group,unique/int,unique/char,pairwise,map/adjacent,map/tuple,map/fst,map/snd,resolve/option,autocorrect,match?,cartesian-product, andneighborhood. - Safe lookup:
get*,at*, andfind*. They return(Option T); match onNoneand(Some value)rather than using a sentinel value.
The Vector/* namespace supplies regular versions and lower-level helpers:
Vector/new, Vector/of, Vector/first, Vector/last, Vector/at!,
Vector/get*, Vector/at*, Vector/find*, Vector/get-unsafe,
Vector/in-bounds?, Vector/set!,
Vector/push!, Vector/pop!, Vector/pull!, Vector/append!,
Vector/concat, Vector/cons, Vector/reverse!, Vector/sort!, and
Vector/swap!. Names ending in /raw are implementation-level variants;
prefer the non-raw name unless you are extending the library itself.
Text, numbers, and conversion
- Text:
split,split/lines,split/spaces,split/words,split/commas,join,trim,trim/left,trim/right,lower,upper,digit?,space?,String/starts?,String/ends?,String/contains?,String/equal?,String/lt?,String/lte?,String/gt?,String/gte?,String/find,String/find/last,String/matches-at?,String/damerau-levenshtein,String/quote,String/dquote,String/prepend-zeroes,String/regex,String/regex/valid?,String/regex/matches?,String/regex/contains?,String/matches-regex?, andString/contains-regex?. - Conversions:
String->Integer,Integer->String,String->Dec,Dec->String,String->Bool,String->Vector,Char->Int,Int->Char,Char->Bool,Bool->Char,Bool->Int,Int->Bool,Int->Dec,Dec->Int,Integer->Bits,Bits->Integer,Integer->Digits,Digits->Integer,Digits->Chars,Chars->Digits,Chars->Integer, and their/baseor/decvariants. - Integer math:
abs,square,gcd,lcm,min,max,clamp,clamp-range,sqrt,expt,floor,ceil,delta,divisible?,positive?,negative?,zero?,one?,negative-one?,even?,odd?,invert, andInt/euclidean-mod. - Decimal math mirrors the applicable integer functions with
.or/decspellings. Safety predicates are+/safe?,-/safe?,*/safe?,/safe?,%/safe?, plus decimal equivalents such as+./safe?. - Deterministic pseudo-random helpers are
random,random/int,random., andrandom/dec; mathematical constants live underconst/dec/*.
Structured data
- Tables:
Table/new,Table/new/capacity,Table/set!,Table/get,Table/get*,Table/get-unsafe,Table/has?,Table/remove!,Table/drop!,Table/keep,Table/omit,Table/entries,Table/keys,Table/values,Table/update!,Table/update-or!,Table/push-or!,Table/count,Table/frequency,Table/merge,Table/merge!,Table/resize!,Table/compact!, andTable/count-entries. - Sets:
Set/new,Set/new/capacity,Set/add!,Set/remove!,Set/has?,Set/values,Set/size,Set/count,Set/intersection,Set/union,Set/difference,Set/xor,Set/resize!, andSet/compact!. - Heaps:
Heap/push!,Heap/pop!,Heap/peek!,Heap/replace!,Heap/empty!,Heap/empty?,Heap/not-empty?,Heap/parent,Heap/left,Heap/right,Heap/sift-up!, andHeap/sift-down!. - Deques:
Que/new,Que/length,Que/empty?,Que/not-empty?,Que/get,Que/at,Que/peek,Que/first,Que/last,Que/append!,Que/enque!,Que/push!,Que/prepend!,Que/pop!,Que/tail!,Que/deque!, andQue/empty!. - Matrices:
Matrix/new,Matrix/in-bounds?,Matrix/for/i, andMatrix->String.neighborhood/*constants provide common coordinate kernels.
Specialist representations
BigInt/* implements unsigned arbitrary-precision arithmetic, including
new, add, sub, mul, div, mod, comparisons, pow, square,
sum, product, and range. BigInt is a nominal record around its digit
storage, so it cannot be confused with an ordinary [Int]. SignedBigInt/*
supplies the corresponding nominal signed representation, and
StructBigDec/* supplies arbitrary-precision decimal arithmetic with an
explicit precision. BigInt is unsigned: BigInt/sub requires its first
argument to be at least its second, and div/mod require a nonzero divisor.
Violating either precondition traps rather than wrapping or manufacturing a
value. Signed and decimal division likewise trap on a zero divisor. Date/* extracts pieces of the date-vector format;
Meta/* parses lightweight metadata; Payload/get accesses embedded payload
text.
The following names are intentionally low-level: */raw, */unchecked!,
Table/hash, Set/hash, allocation/bucket helpers, implementation constants,
and aliases maintained for library implementation. They are exported because
the library is Calque source, not because new applications should depend on
their representation. Query their source before using them.