summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-22 07:37:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-22 07:37:22 -0700
commit420a230dbae897ee32c03297f7e4bb18f683a8b1 (patch)
treeca542bbde5776b9a5f8ed5ecbd1769dc19956038 /share
parentfb8a30d4540d04b02f98e7895cdb02d5c7f6c2e6 (diff)
downloadtxr-420a230dbae897ee32c03297f7e4bb18f683a8b1.tar.gz
txr-420a230dbae897ee32c03297f7e4bb18f683a8b1.tar.bz2
txr-420a230dbae897ee32c03297f7e4bb18f683a8b1.zip
Implementing second through tenth as places.
* eval.c (eval_init): Register second through tenth as intrinsic. * gencadr.txr: New cadr.c changes encoded. * lib.c (second, third, fourth, fifth, sixth): Functions reimplemented using ref, so they are much more efficient for vectors and strings. (seventh, eighth, ninth, tenth): New functions. * lib.h (seventh, eighth, ninth, tenth): Declared. * share/txr/stdlib/place.tl: place macros defined for second through tenth. * txr.1: Documented.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/place.tl9
1 files changed, 9 insertions, 0 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index 0356e81e..67a593fb 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -614,3 +614,12 @@
(define-place-macro first (obj) ^(car ,obj))
(define-place-macro rest (obj) ^(cdr ,obj))
+(define-place-macro second (obj) ^(ref ,obj 1))
+(define-place-macro third (obj) ^(ref ,obj 2))
+(define-place-macro fourth (obj) ^(ref ,obj 3))
+(define-place-macro fifth (obj) ^(ref ,obj 4))
+(define-place-macro sixth (obj) ^(ref ,obj 5))
+(define-place-macro seventh (obj) ^(ref ,obj 6))
+(define-place-macro eighth (obj) ^(ref ,obj 7))
+(define-place-macro ninth (obj) ^(ref ,obj 8))
+(define-place-macro tenth (obj) ^(ref ,obj 9))