diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-11 00:28:31 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:50 -0800 |
commit | 7f7e2431f5d1f7c1782ed6e774ccfc70fb4c87cf (patch) | |
tree | b790d22b440455913c70f6af62033c215578c21d /src/lisp/ao_lisp_cons.c | |
parent | f5a36c15f894803f8804bbc3daf105eed53d5ff6 (diff) |
altos/lisp: add length, pack, unpack and flush
lots more builtins
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_cons.c')
-rw-r--r-- | src/lisp/ao_lisp_cons.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lisp/ao_lisp_cons.c b/src/lisp/ao_lisp_cons.c index cd8a8d1d..b75ffaa0 100644 --- a/src/lisp/ao_lisp_cons.c +++ b/src/lisp/ao_lisp_cons.c @@ -107,3 +107,14 @@ ao_lisp_cons_patom(ao_poly c) cons = ao_lisp_poly_cons(cons->cdr); } } + +int +ao_lisp_cons_length(struct ao_lisp_cons *cons) +{ + int len = 0; + while (cons) { + len++; + cons = ao_lisp_poly_cons(cons->cdr); + } + return len; +} |