summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-01 07:05:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-01 07:05:35 -0700
commitcd8cf4f8fd827e428c53f2e6d7fcce5cd9727e7f (patch)
tree5acb1cb50e758409457f971d3e2fefa484ed9890 /lib.h
parent8a443d67ef95021529db7eb451479e79fb39b272 (diff)
downloadtxr-cd8cf4f8fd827e428c53f2e6d7fcce5cd9727e7f.tar.gz
txr-cd8cf4f8fd827e428c53f2e6d7fcce5cd9727e7f.tar.bz2
txr-cd8cf4f8fd827e428c53f2e6d7fcce5cd9727e7f.zip
Methods for turning objects into sequences.
Struct objects can now define methods car, cdr and nullify. With these, they can participate in operations on sequences. * eval.h (car_s, cdr_s): Declared. * lib.c (nullify_s): New symbol variable. (car, cdr): Implement for struct objects via, respectively, their car and cdr methods. (tolist): Handle objects by mapping through identity. (nullify): Implement for objects optionally: if an object is a struct with a nullify method, use it, otherwise go through default case of just returning the object. (empty): Implement for objects that have nullify method. (obj_init): Initialize nullify_s. * struct.c (maybe_slot): New function. * struct.h (maybe_slot): Declared. * txr.1: Documented car, cdr and nullify method convention.
Diffstat (limited to 'lib.h')
0 files changed, 0 insertions, 0 deletions