unoidl2

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/unoidl2.git/
Log | Files | Refs

commit 1f3e79ebc387bb2406e4b76fe459d74e3c4afd54
parent 4100d8255c96bee1c1fd37fdb1bb5baca4d15b9d
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 18 Mar 2012 18:45:45 +0100

intern2 functions exposed

Diffstat:
Munoidl2.c | 6++++--
Munoidl2.h | 4++++
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/unoidl2.c b/unoidl2.c @@ -276,7 +276,7 @@ Any mk_relative(Any x) { //return cons(mk(RELATIVE, "relative"), $1); } -static Any intern2rel(Any k, Any p) { +Any intern2rel(Any k, Any p) { Any r = find(k, cdr(p), equal, caar); if(NIL == r) { con(p, cons(r = list1(list2(k, p)), cdr(p))); @@ -287,7 +287,7 @@ static Any intern2rel(Any k, Any p) { Any root2; -static Any intern2abs(Any x) { +Any intern2abs(Any x) { Any p = root2; for(; NIL != x; x = cdr(x)) p = intern2rel(sym1(car(x)), p); @@ -296,6 +296,8 @@ static Any intern2abs(Any x) { static Any get2(Any x) {return cddr(car(x));} static Any set2(Any x, Any v) {return con(cdr(car(x)), v);} +Any sym2p(Any x) {return cadr(car(x));} +Any sym2k(Any x) {return caar(x);} static Any module2; diff --git a/unoidl2.h b/unoidl2.h @@ -65,6 +65,10 @@ Any mapc(Fn1 fn, Any x); Any find(Any elt, Any lst, Fn2 cmp, Fn1 key); Any reverse(Any x, Any a); Any id(Any x); +Any intern2rel(Any k, Any p); +Any intern2abs(Any x); +Any sym2p(Any x); +Any sym2k(Any x); extern Any subst2_x; Any subst2_rel_abs(Any v); extern Any (*build2_fn)(Any v);