1.0.0-alpha.8 • Published 3 years ago

lispish v1.0.0-alpha.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

A lisp implementation in Typescript. Could be used in browser, node.js or as a CLI.

REPL

Documentation

mojir.github.io/lispish

Install

npm i -g lispish

Repl usage

Start the lispish REPL in a terminal by enter lispish

  • Tab completion
  • History stored on file
$ lispish
Type "`help" for more information.
LISPISH> (+ 7 4)
11
LISPISH> (let ((day (* 24 60 60 1000))) (* 7 day)) ; Ever wondered how many milliseconds there are in a week?
604800000
$ lispish --help
Usage: lispish [options]

Options:
  -g ...                          Global variables as a JSON string
  -G ...                          Global variables file (.json file)
  -f ...                          .lispish file
  -e ...                          Lispish expression
  -h, --help                      Show this help
  -h, --help <builtin function>   Show help for <builtin function>
  -v, --version                   Print lispish version
$ lispish -e "(/ 81 9)"
9

API

Install api

npm i lispish

How to use?

import { Lispish } from 'lispish'

const lispish = new Lispish()
lispish.run('(+ 1 2 3 4)'); // returns 10

Builtin Functions

Special functions

  • and
  • cond
  • def
  • defn
  • defns
  • defs
  • do
  • fn
  • for
  • if
  • if-let
  • if-not
  • let
  • loop
  • or
  • recur
  • throw
  • time!
  • try
  • when
  • when-first
  • when-let
  • when-not

Normal functions

Predicate

  • array?
  • boolean?
  • coll?
  • even?
  • false?
  • finite?
  • function?
  • integer?
  • nan?
  • neg?
  • negative-infinity?
  • nil?
  • number?
  • object?
  • odd?
  • pos?
  • positive-infinity?
  • regexp?
  • seq?
  • string?
  • true?
  • zero?

Sequence

  • cons
  • distinct
  • drop
  • drop-last
  • drop-while
  • filter
  • first
  • frequencies
  • group-by
  • index-of
  • join
  • last
  • map
  • next
  • nth
  • nthnext
  • nthrest
  • partition
  • partition-all
  • partition-by
  • pop
  • position
  • push
  • rand-nth!
  • random-sample!
  • reduce
  • reduce-right
  • remove
  • rest
  • reverse
  • second
  • shift
  • shuffle
  • slice
  • some
  • sort
  • sort-by
  • split-at
  • split-with
  • take
  • take-last
  • take-while
  • unshift

Collection

  • any?
  • assoc
  • assoc-in
  • concat
  • contains?
  • count
  • empty?
  • every?
  • get
  • get-in
  • has?
  • has-every?
  • has-some?
  • not-any?
  • not-every?
  • update
  • update-in
  • Array
  • array
  • flatten
  • mapcat
  • range
  • repeat

Object

  • dissoc
  • entries
  • find
  • keys
  • merge
  • merge-with
  • object
  • select-keys
  • vals
  • zipmap

String

  • from-char-code
  • lower-case
  • number
  • number-to-string
  • pad-left
  • pad-right
  • split
  • str
  • string-repeat
  • subs
  • template
  • to-char-code
  • trim
  • trim-left
  • trim-right
  • upper-case

Math

  • *
  • +
  • /
  • abs
  • acos
  • acosh
  • asin
  • asinh
  • atan
  • atanh
  • cbrt
  • ceil
  • cos
  • cosh
  • dec
  • e
  • epsilon
  • exp
  • floor
  • inc
  • log
  • log10
  • log2
  • max
  • max-safe-integer
  • max-value
  • min
  • min-safe-integer
  • min-value
  • mod
  • nan
  • negative-infinity
  • pi
  • positive-infinity
  • pow
  • quot
  • rand!
  • rand-int!
  • rem
  • round
  • sign
  • sin
  • sinh
  • sqrt
  • tan
  • tanh
  • trunc

Functional

  • apply
  • comp
  • complement
  • constantly
  • every-pred
  • fnil
  • identity
  • juxt
  • partial
  • some-pred

Regular expression

  • match
  • regexp
  • replace

Bitwise

  • bit-and
  • bit-and-not
  • bit-clear
  • bit-flip
  • bit-not
  • bit-or
  • bit-set
  • bit-shift-left
  • bit-shift-right
  • bit-test
  • bit-xor

Misc

  • <
  • <=
  • =
  • >
  • >=
  • assert
  • boolean
  • compare
  • debug!
  • equal?
  • get-path
  • inst-ms
  • lispish-version
  • not
  • not=
  • write!
1.0.0-alpha.8

3 years ago

1.0.0-alpha.7

3 years ago

1.0.0-alpha.6

3 years ago

1.0.0-alpha.5

3 years ago

1.0.0-alpha.4

3 years ago

1.0.0-alpha.3

3 years ago

1.0.0-alpha.2

3 years ago

1.0.0-alpha.1

3 years ago

0.1.52

3 years ago

0.1.53

3 years ago

0.1.54

3 years ago

0.1.55

3 years ago

0.1.56

3 years ago

0.1.57

3 years ago

0.1.58

3 years ago

0.1.59

3 years ago

0.1.50

3 years ago

0.1.51

3 years ago

0.1.49

3 years ago

0.1.41

3 years ago

0.1.42

3 years ago

0.1.43

3 years ago

0.1.44

3 years ago

0.1.45

3 years ago

0.1.46

3 years ago

0.1.47

3 years ago

0.1.48

3 years ago

0.1.40

3 years ago

0.1.38

3 years ago

0.1.39

3 years ago

0.1.32

3 years ago

0.1.33

3 years ago

0.1.34

3 years ago

0.1.35

3 years ago

0.1.36

3 years ago

0.1.37

3 years ago

0.1.60

3 years ago

0.1.61

3 years ago

0.1.30

3 years ago

0.1.31

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.25

3 years ago

0.1.26

3 years ago

0.1.22

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.19

3 years ago

0.1.18

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.14

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.28

3 years ago

0.0.23

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago