xo-interpreter2: + nil + cons
This commit is contained in:
parent
84ddc0338b
commit
87f08a4e4d
2 changed files with 24 additions and 4 deletions
|
|
@ -26,11 +26,14 @@ namespace xo {
|
|||
DList(xo::obj<AGCObject> h,
|
||||
DList * r) : head_{h}, rest_{r} {}
|
||||
|
||||
/** sentinel for null list.
|
||||
/** sentinel for null list. Idempotent.
|
||||
* Application code may prefer ListOps::nil()
|
||||
**/
|
||||
static DList * _nil();
|
||||
|
||||
/** like _nil(), but retrn fop wrapper **/
|
||||
static obj<AGCObject,DList> nil();
|
||||
|
||||
/** list with first element @p car,
|
||||
* followed by contents of list @p cdr.
|
||||
* Shares structure with @p cdr
|
||||
|
|
@ -40,6 +43,11 @@ namespace xo {
|
|||
obj<AGCObject> car,
|
||||
DList * cdr);
|
||||
|
||||
/** like @c _cons(mm,car,cdr), but return fop wrapper **/
|
||||
static obj<AGCObject,DList> cons(obj<AAllocator> mm,
|
||||
obj<AGCObject> car,
|
||||
DList * cdr);
|
||||
|
||||
/** DList length is at least 1 **/
|
||||
bool is_empty() const noexcept;
|
||||
/** DList models a finite sequence **/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue