Commit Graph

9 Commits

Author SHA1 Message Date
Vincent Ollivier be6ca0c744
Replace some rust programs with lisp scripts (#445)
* Replace colors command with colors.lsp

* Replace geotime command with geotime.lsp

* Remove commands from shell

* Add comment
2022-11-30 23:27:15 +01:00
Vincent Ollivier ab9b488a49
Update lisp doc and examples (#428)
* Update documentation

* Add macro?

* Rewrite and and or with macros

* Move string-join

* Update built-in autocompletion

* Use define instead of def in core and examples

* Add changelog to doc

* Move aliases to lib

* Add let macro

* Add caar cadr cdar cddr functions

* Add fixme

* Fix let macro
2022-11-01 11:02:50 +01:00
Vincent Ollivier 0037e24961
Add macro to Lisp (#425)
* Add expand to lisp

* Update tests

* Add quasiquote and unquote

* Rename Lambda into Function

* Add macro

* Fix function_env

* Dry code

* Add define-macro shortcut

* Add mac shortcut

* Refactor inner env

* Move expand to a module

* Add unquote-splicing

* Fix test

* Refactor tests

* Add function args symbol

* Fix typo

* Remove old append

* Add dotted pair

* Revert "Add dotted pair"

This reverts commit 10544b56d8.
2022-10-28 18:43:22 +02:00
Vincent Ollivier fcf3a7e72f
Add if and while to Lisp (#418)
* Change Lisp loop into while

* Rename define to def

* Replace cond by if

* Fix pi computation

* Fix number parsing error

* Fix or function

* Add test to while

* Rewrite test

* Add missing fun

* Add examples to doc
2022-10-21 10:10:14 +02:00
Vincent Ollivier 892b697bd3
Add BigInt support to Lisp (#415)
* Add bigint support to Lisp

* Remove Box

* Replace BigInt by i64

* Add back big int

* Work around big int errors

* Print floats with a dot

* Add conversion to f64

* Use Number#parse instead of double

* Add trigo functions to Number

* Add conversion from number to byte

* Add addition to Number

* Add multiplication to Number

* Add negation and substraction to Number

* Add division to Number

* Add reminder to Number

* Add pow to Number

* Fix tests

* Re-enable BigInt

* Add parsing and printing of BigInt

* Add sign

* Add operations on BigInt

* Fix compilation issues

* Add support for add and mul overflow

* Fix bigint conversion to and from str

* Add number-type function

* Add tests

* Add support for pow overflow

* Fix tests

* Add more checks for overflow

* Add check for division by zero

* Fix typo

* Return inf for large exponential operations

* Check for division by zero in modulo

* Add shift operations

* Rewrite comparisons

* Add lazy eval to cond expressions

* Add set fonction

* Add loop function

* Add pi example

* Add builtin pi example to shell

* Update allocation error messages

* Rewrite number conversions

* Remove debug output from pi example

* Move pi command to a dedicated file

* Rewrite bytes->number and number->bytes

* Update doc

* Move op impl to Number

* Add macros to dry code

* Add more macros

* Run clippy
2022-10-17 20:58:08 +02:00
Vincent Ollivier ec57ff1540
Extend and refactor Lisp implementation (#412)
* Adopt a syntax closer to scheme

* Add parse and eval

* Replace Exp::Func with Exp::Primitive

* Refactor built in autocompletion

* Replace null by nil

* Fix test

* Update doc

* Bump version
2022-09-20 19:57:55 +02:00
Vincent Ollivier 1bafa2271c
Add apply to Lisp (#410)
* Replace mapcar by apply

* Add map and reduce to core lib

* Add pi.lsp example

* Fix tests

* Refactor pi-digits

* Move builtin join to core lib as string-join

* Rename decode-* and encode-* to *-decode and *-encode

* Update doc
2022-09-15 20:50:23 +02:00
Vincent Ollivier 55531b9e3d
Improve Lisp forms (#402)
* Use x and y variables instead of a and b

* Rewrite not form

* Move boolean forms to core lib

* Handle special arithmetic cases

* Add range form

* Add pr and prn for print and println

* Add more tests to cond
2022-09-03 15:27:52 +02:00
Vincent Ollivier 0724b5a07b
Move /ini/lisp to /lib/lisp (#398) 2022-08-27 13:07:32 +02:00