From 420a230dbae897ee32c03297f7e4bb18f683a8b1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 22 Jul 2015 07:37:22 -0700 Subject: 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. --- share/txr/stdlib/place.tl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'share') 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)) -- cgit v1.2.3