~xguerin/minima.l

fb4d12b0bbd1d85fa6f2f893ba23ab1cffe16636 — Xavier R. Guerin 2 months ago 6131301
Add CDDR function in manips
4 files changed, 13 insertions(+), 7 deletions(-)

M docs/manual/Reference.md
M etc/vim/syntax/minimal.vim
M lib/mnml/CMakeLists.txt
M share/mnml/manips.l
M docs/manual/Reference.md => docs/manual/Reference.md +6 -5
@@ 76,11 76,12 @@
|:----------|:----------------------------|:------:|:------------|
| `append`    | `(append 'lst . any)`         |        | Recursively append `any` to `lst` |
| `car`       | `(car 'lst)`                  | `std`    | Get the head element of `lst` |
| `cadr`      | `(cdr 'lst)`                  |        | Get the 2nd element of `lst` |
| `caddr`     | `(caddr 'lst)`                |        | Get the 3rd element of `lst` |
| `caar`      | `(caar 'lst)`                 |        | Get the 1st element of the head of `lst` |
| `cadar`     | `(cadar 'lst)`                |        | Get the 2nd element of the head of `lst` |
| `cdar`      | `(cdar 'lst)`                 |        | Get the tail of the head of `lst` |
| `cadr`      | `(cadr 'lst)`                 | `manips` | Get the 2nd element of `lst` |
| `cddr`      | `(cddr 'lst)`                 | `manips` | Get the tail of the tail of `lst` |
| `caddr`     | `(caddr 'lst)`                | `manips` | Get the 3rd element of `lst` |
| `caar`      | `(caar 'lst)`                 | `manips` | Get the 1st element of the head of `lst` |
| `cadar`     | `(cadar 'lst)`                | `manips` | Get the 2nd element of the head of `lst` |
| `cdar`      | `(cdar 'lst)`                 | `manips` | Get the tail of the head of `lst` |
| `cdr`       | `(cdr 'lst)`                  | `std`    | Get the tail of `lst` |
| `chr`       | `(chr 'num)`                  | `std`    | Get the character for ASCII numner `num` |
| `conc`      | `(conc 'lst 'lst)`            | `std`    | [Concatenate](#conc) two lists into one |

M etc/vim/syntax/minimal.vim => etc/vim/syntax/minimal.vim +2 -1
@@ 46,6 46,7 @@ syn keyword MinimalFuncs
      \ assoc
      \ atm?
      \ caar
      \ cddr
      \ cadar
      \ caddr
      \ cadr


@@ 128,6 129,6 @@ hi default link MinimalFuncs      Function
hi default link MinimalOperator   Operator

set lisp
set lispwords=%,*,+,-,/,<,<-,<=,<>,<\|>,=,>,>=,>&,\\,\|>,$+,and,append,assoc,atm?,caar,cadar,caddr,cadr,car,cdar,cdr,chr,chr?,close,conc,cond,cons,dedup,def,dup,eval,filter,flatten,foldl,foldr,has,if,in,insert,iter,iter2,last,len,let,list,load,lst?,map,map2,match,merge,nil?,not,ntoa,num?,or,out,prin,prinl,print,printl,prog,quit,quote,read,readline,rep,rev,setq,split,str,str?,sym,sym?,time,truncl,truncr,unless,unlink,tru?,when,while,zip
set lispwords=%,*,+,-,/,<,<-,<=,<>,<\|>,=,>,>=,>&,\\,\|>,$+,and,append,assoc,atm?,caar,cddr,cadar,caddr,cadr,car,cdar,cdr,chr,chr?,close,conc,cond,cons,dedup,def,dup,eval,filter,flatten,foldl,foldr,has,if,in,insert,iter,iter2,last,len,let,list,load,lst?,map,map2,match,merge,nil?,not,ntoa,num?,or,out,prin,prinl,print,printl,prog,quit,quote,read,readline,rep,rev,setq,split,str,str?,sym,sym?,time,truncl,truncr,unless,unlink,tru?,when,while,zip

let b:current_syntax = "minimal"

M lib/mnml/CMakeLists.txt => lib/mnml/CMakeLists.txt +1 -1
@@ 50,7 50,7 @@ if(MNML_WITH_TRANSFN)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
  #
  Transpile(iterators "foldl,foldr,map,map2,zip")
  Transpile(manips "assoc,caar,cadar,caddr,cadr,cdar,last,rep,truncl")
  Transpile(manips "assoc,caar,cddr,cadar,caddr,cadr,cdar,last,rep,truncl")
  #
  foreach(MODULE ${MODULES})
    add_library(${MODULE} SHARED ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.c)

M share/mnml/manips.l => share/mnml/manips.l +4 -0
@@ 11,6 11,10 @@
	"Call CAR CAR on X."
	(car (car x)))

(def cddr (x)
	"Call CDR CDR on X."
	(cdr (cdr x)))

(def cadar (x)
	"Call CAR CDR CAR on X."
	(car (cdr (car x))))