diff options
| author | mryouse | 2022-05-24 03:56:41 +0000 |
|---|---|---|
| committer | mryouse | 2022-05-24 03:56:41 +0000 |
| commit | 1ab8d550f657c9abb546c402ff8fda6251e8eb18 (patch) | |
| tree | 824c1bd9b32b2d5bd3e25be9d1166382d6b9405c /README.md | |
| parent | 389b8e77f90f3b9586f38366aef9a7c955c4c4c3 (diff) | |
progress 5/23
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 61 |
1 files changed, 47 insertions, 14 deletions
@@ -17,6 +17,20 @@ - `(print [out :string]) => :bool ; print to stdout` - TODO `(print-all [strings :list]) => :bool ; a list of strings` +### file system + - `(glob [regex :string]) => :list` + - `(read-lines [filename :string]) => :list` + +### comparison and boolean + - `(and [arg :bool] [many :bool]) => :bool` + - `(or [arg :bool] [many :bool]) => :bool` + - `(eq? [arg1 :literal] [arg2 :literal]) => :bool` + - `(> [left :number] [right :number]) => :bool` + - `(>= [left :number] [right :number]) => :bool` + - `(< [left :number] [right :number]) => :bool` + - `(<= [left :number] [right :number]) => :bool` + - `(not [arg :bool]) => :bool` + ### math - `(+ [arg :number] [many :number]) => :number` - `(- [arg :number] [many :number]) => :number` @@ -24,11 +38,14 @@ - `(/ [num :number] [denom :number]) => :number` ### string - - TODO `(concat [arg :string] [many :string]) => :string` + - `(concat [arg :string] [many :string]) => :string` + - `(split [arg :string] [split-val :string]) => :list` + - `(strip [arg :string]) => :string` ### flow control - `(if [cond :bool] [t-branch :any|:expr] [[f-branch :any|:expr]]) => :any` - `(for-count [count :int] [many :expr]) => :any ; creates 'idx' variable with loop count` + - `(for-each [items :list] [many :expr]) => :any ; creates '_item_' variable with current item` - `(| [first :expr] [many :expr]) => :any ; creates 'items' variable` - `(branch ([cond1 :bool] [expr1 :any]) [([condN: :bool] [exprN :any])]) => :any` @@ -39,22 +56,38 @@ - `(number? [arg :any]) => :bool ; returns #true for :int or :float` - `(bool? [arg :any]) => :bool` -### type conversion TODO - - `(int->string [arg :int]) => :string` - - `(float->string [arg :float]) => :string` - - `(number->string [arg :number]) => :string` - - `(bool->string [arg :bool]) => :string` +### type conversion + - TODO `(int->string [arg :int]) => :string` + - TODO `(float->string [arg :float]) => :string` + - TODO `(number->string [arg :number]) => :string` + - TODO `(bool->string [arg :bool]) => :string` - `(->string [arg :literal]) => :string ; works for all literals` + - `(string->int [arg :string]) => :int` -### global variables - - `(def [name :string] [value :expr]) => ?` +### variables + - `(def [name :string] [value :expr]) => ? ; lexically scoped` + - `(redef [name :string] [value :expr]) => ? ; must already be defined` -### shell TODO +### shell - `($ [command :string]) => :list ; doesn't support pipes, first item is return code` - - `($| [commands :list]) => :bool ; pipes together multiple shell commands` + - TODO `($| [commands :list]) => :bool ; pipes together multiple shell commands` ### functions - - `(lambda (args) (expr1) (expr2) ... (exprN)) => :any + - `(lambda (args) (expr1) (expr2) ... (exprN)) => :any` + - `(func name (args) (expr1) (expr2) ... (exprN)) => :any` + +### lists + - `(empty? [arg :list]) => :bool` + - `(first [arg :list]) => :any ; car` + - `(list [arg :any] [many :any]) => :list` + - `(list-length [arg :list]) => :int` + - `(list-reverse [arg :list]) => :int` + - `(rest [arg :list]) => :any ; cdr` + - `(zip [arg1 :list] [arg2 :list]) => :list` + +### "higher order" + - `(apply [func :symbol] [target :list]) => :any` + - `(map [func :symbol] [target :list]) => :list` ### other - pretty much nothing else @@ -68,8 +101,8 @@ - [x] build an AST like a real person (sorta?) ### math -- [ ] division (float) -- [ ] division (int) +- [x] division (float) +- [x] division (int) - [ ] mod (int) - [ ] exponent @@ -81,7 +114,7 @@ ### flow control - [x] if - [x] if with empty else -- [ ] branch +- [x] branch - [x] pipe ### lists |
