Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active August 10, 2020 19:14
Show Gist options
  • Save cellularmitosis/5cb95fccc7ebd16308b24534f7eaf7d4 to your computer and use it in GitHub Desktop.
Save cellularmitosis/5cb95fccc7ebd16308b24534f7eaf7d4 to your computer and use it in GitHub Desktop.
Janet 1.10.1 Stdlib, organized by topic

Janet 1.10.1 Stdlib, organized by topic

Appologies if some of these are mis-categorized, I am a Janet newb!

Declaration / Binding / Environment

  • def
  • def-
  • defglobal
  • default
  • var
  • var-
  • varglobal
  • set
  • fn
  • short-fn
  • defn
  • defn-
  • varfn
  • defmacro
  • defmacro-
  • all-bindings
  • dyn
  • setdyn
  • with-dyns
  • all-dynamics

Scoped Binding

  • let
  • with
  • with-syms
  • with-vars
  • with-dyns

Types and Data Structures

  • identity
  • freeze

Screen Shot 2020-07-04 at 3 50 01 PM

Type checks

  • type
  • nil?
  • boolean?
  • number?
  • int?
  • function?
  • cfunction?
  • symbol?
  • keyword?
  • string?
  • buffer?
  • tuple?
  • array?
  • struct?
  • table?
  • bytes?
  • indexed?
  • dictionary?
  • idempotent?
  • abstract?

Screen Shot 2020-07-04 at 4 36 05 PM

Booleans

  • boolean?
  • true?
  • false?
  • truthy?
  • not
  • (note: not can be used as falsey?)
  • and
  • or

Integers

  • int?
  • int/s64
  • int/u64

Indexed (Sequential) and Associative Data Structures

On symbol, keyword, string/buffer, tuple/array, struct/table:

  • length
  • get
  • in
  • get-in
  • keys
  • values
  • kvs
  • pairs
  • next

On array, table, buffer:

  • put
  • put-in
  • update
  • update-in

Screen Shot 2020-07-04 at 4 35 55 PM

Symbols

  • symbol?
  • symbol

Keywords

  • keyword?
  • keyword

Strings

  • string?
  • string
  • string/ascii-lower
  • string/ascii-upper
  • string/check-set
  • string/find
  • string/find-all
  • string/has-prefix?
  • string/has-suffix?
  • string/format
  • doc-format
  • string/from-bytes
  • string/bytes
  • string/repeat
  • string/replace
  • string/replace-all
  • string/reverse
  • string/slice
  • string/join
  • string/split
  • string/trim
  • string/triml
  • string/trimr
  • chr

Buffers

  • buffer?
  • buffer
  • buffer/new
  • buffer/new-filled
  • buffer/fill
  • buffer/clear
  • buffer/trim
  • buffer/push-byte
  • buffer/push-string
  • buffer/push-word
  • buffer/popn
  • buffer/slice
  • buffer/bit
  • buffer/bit-clear
  • buffer/bit-set
  • buffer/bit-toggle
  • buffer/blit
  • buffer/format
  • marshal
  • unmarshal

Tuples

  • tuple?
  • tuple/type
  • tuple
  • tuple/brackets
  • tuple/slice
  • tuple/sourcemap
  • tuple/setmap

Arrays

  • array?
  • array
  • array/new
  • array/new-filled
  • array/slice
  • array/insert
  • array/remove
  • array/concat
  • array/fill
  • array/peek
  • array/pop
  • array/push
  • array/ensure
  • array/trim

Typed arrays

  • tarray/new
  • tarray/buffer
  • tarray/length
  • tarray/properties
  • tarray/copy-bytes
  • tarray/swap-bytes
  • tarray/slice

Structs

  • struct?
  • struct

Tables

  • table?
  • table
  • table/new
  • table/clone
  • table/rawget
  • table/getproto
  • table/setproto
  • table/to-struct

Functional / Operations on Sequential/Associative Data Structures

Sequence in, Atom out

  • length
  • empty?
  • count
  • get
  • in
  • get-in
  • first
  • last
  • extreme
  • find
  • find-index
  • and
  • or
  • some
  • all
  • every?
  • reduce
  • reduce2
  • accumulate
  • accumulate2

Sequence in, Sequence out

In-place mutation:

  • sort
  • sort-by

Copying:

  • sorted
  • sorted-by
  • reverse
  • slice
  • drop
  • take
  • filter
  • keep
  • drop-while
  • take-while
  • drop-until
  • take-until
  • distinct
  • map
  • mapcat
  • keys
  • values
  • kvs
  • pairs
  • partition
  • flatten
  • flatten-into
  • interleave
  • interpose

Sequence in, Table out

  • zipcoll
  • frequencies

Table in, Table out

  • invert
  • merge
  • merge-into

Functions Which Generate Values

  • range
  • generate

Functions Returning Functions, Oh My!

  • comp
  • complement
  • partial
  • juxt

Macros

  • gensym
  • macex
  • macex1
  • idempotent?

Control Flow

  • do
  • defer
  • edefer
  • when
  • unless
  • if
  • cond
  • case
  • match
  • when-let
  • when-with
  • if-let
  • if-not
  • if-with
  • each
  • eachk
  • eachp
  • for
  • while
  • loop
  • seq
  • break
  • next
  • walk
  • postwalk
  • prewalk
  • yield
  • quit
  • prompt
  • return
  • try
  • protect
  • assert
  • error
  • errorf
  • signal
  • propagate
  • label

Threading

  • ->
  • ->>
  • -?>
  • -?>>
  • as->
  • as?->

Concurrency

  • resume

Equality and Comparison

  • =
  • not=
  • deep=
  • deep-not=
  • <
  • <=
  • >
  • >=
  • compare
  • compare-primitive
  • compare<
  • compare<=
  • compare=
  • compare>
  • compare>=

Bitwise

  • bnot
  • band
  • bor
  • bxor
  • blshift
  • brshift
  • brushift

Math

  • number?
  • nan?
  • nat?
  • pos?
  • neg?
  • zero?
  • one?
  • even?
  • odd?
  • math/inf
  • math/-inf
  • math/nan
  • math/pi
  • math/e
  • +
  • -
  • *
  • /
  • %
  • mod
  • +=
  • -=
  • *=
  • /=
  • %=
  • ++
  • --
  • inc
  • dec
  • math/next
  • identity
  • hash
  • sum
  • product
  • max
  • min
  • mean
  • math/abs
  • math/ceil
  • math/floor
  • math/round
  • math/trunc
  • math/pow
  • math/sqrt
  • math/cbrt
  • math/exp
  • math/exp2
  • math/expm1
  • math/log
  • math/log2
  • math/log10
  • math/log1p
  • math/erf
  • math/erfc
  • math/gamma

Random

  • math/random
  • math/seedrandom
  • math/rng
  • math/rng-int
  • math/rng-uniform
  • math/rng-buffer

Trigonometry

  • math/sin
  • math/cos
  • math/tan
  • math/asin
  • math/acos
  • math/atan
  • math/atan2
  • math/sinh
  • math/cosh
  • math/tanh
  • math/asinh
  • math/acosh
  • math/atanh
  • math/hypot

Console I/O

  • print
  • prin
  • printf
  • prinf
  • flush
  • eprinf
  • eprin
  • eprintf
  • eprint
  • eflush
  • describe
  • pp
  • getline

File I/O

  • slurp
  • spit
  • file/open
  • file/close
  • file/seek
  • file/read
  • file/write
  • file/flush
  • file/temp
  • file/popen
  • stdin
  • stdout
  • stderr

Network I/O

  • net/connect
  • net/server
  • net/read
  • net/chunk
  • net/write
  • net/close

OS

  • os/which
  • os/arch
  • os/cryptorand
  • os/exit

Time

  • os/clock
  • os/time
  • os/date
  • os/mktime
  • os/sleep

Shell

  • os/environ
  • os/getenv
  • os/setenv
  • os/shell
  • os/execute

Filesystem

  • os/cwd
  • os/cd
  • os/touch
  • os/rm
  • os/rename
  • os/mkdir
  • os/rmdir
  • os/dir
  • os/link
  • os/symlink
  • os/readlink
  • os/realpath
  • os/stat
  • os/lstat
  • os/chmod
  • os/perm-int
  • os/perm-string
  • os/umask

Parsing

  • peg/compile
  • peg/match
  • default-peg-grammar
  • parse
  • parser/new
  • parser/clone
  • parser/byte
  • parser/consume
  • parser/eof
  • parser/error
  • parser/flush
  • parser/has-more
  • parser/insert
  • parser/produce
  • parser/state
  • parser/status
  • parser/where
  • scan-number

Modules

  • use
  • import
  • import*
  • require
  • native
  • dofile
  • module/add-paths
  • module/expand-path
  • module/cache
  • module/find
  • module/loaders
  • module/loading
  • module/paths

REPL

  • repl
  • cli-main
  • run-context
  • trace
  • tracev
  • untrace
  • root-env
  • make-env
  • make-image
  • make-image-dict
  • load-image
  • load-image-dict

Evaluation

  • eval
  • eval-string
  • apply
  • env-lookup
  • comment

Debugger

  • debug
  • debug/stacktrace
  • debug/step
  • debug/break
  • debug/unbreak
  • debug/fbreak
  • debug/unfbreak
  • debug/lineage
  • debug/stack
  • debug/arg-stack
  • debugger-env

Compilation

  • asm
  • disasm
  • compile
  • comptime
  • bad-compile
  • bad-parse

Garbage Collector

  • gccollect
  • gcinterval
  • gcsetinterval

About Janet

  • janet/version
  • janet/build
  • janet/config-bits
  • doc
  • doc*

Janet Implementation: Special Forms

  • def
  • var
  • set
  • fn
  • do
  • if
  • while
  • break
  • quote
  • quasiquote
  • unquote
  • splice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment