diff options
Diffstat (limited to 'gruel/src/lib/pmt/pmt.cc')
-rw-r--r-- | gruel/src/lib/pmt/pmt.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc index 1d9125d4e..3eb39ed7b 100644 --- a/gruel/src/lib/pmt/pmt.cc +++ b/gruel/src/lib/pmt/pmt.cc @@ -1325,6 +1325,22 @@ pmt_list_add(pmt_t list, const pmt_t& item) } pmt_t +pmt_list_rm(pmt_t list, const pmt_t& item) +{ + if(pmt_is_pair(list)){ + pmt_t left = pmt_car(list); + pmt_t right = pmt_cdr(list); + if(!pmt_equal(left, item)){ + return pmt_cons(left, pmt_list_rm(right, item)); + } else { + return pmt_list_rm(right, item); + } + } else { + return list; + } +} + +pmt_t pmt_caar(pmt_t pair) { return (pmt_car(pmt_car(pair))); |