[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] allow procedure in operator position of evalua
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] allow procedure in operator position of evaluated lists |
Date: |
Mon, 31 Oct 2011 09:07:24 +0100 (CET) |
The attached patch handles procedure-objects in operator position of
evaluated lists. This adds an small inconsistency between interpreted
and compiled code (in macro-transformers, for example), but allows
for interesting uses of "eval".
>From 7a943fb2a611be113bbf404657740809100ef0b6 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Mon, 31 Oct 2011 09:03:22 +0100
Subject: [PATCH] allow procedure in operator-position of evaluated list (#705,
suggested by John Cowan)
---
eval.scm | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/eval.scm b/eval.scm
index e66462c..5999a38 100644
--- a/eval.scm
+++ b/eval.scm
@@ -752,10 +752,13 @@
[else #f] ) ) )
(define (compile-call x e tf cntr se)
- (let* ([fn (compile (##sys#slot x 0) e #f tf cntr se)]
- [args (##sys#slot x 1)]
- [argc (checked-length args)]
- [info x] )
+ (let* ((head (##sys#slot x 0))
+ (fn (if (procedure? head)
+ (lambda _ head)
+ (compile (##sys#slot x 0) e #f tf cntr se)))
+ (args (##sys#slot x 1))
+ (argc (checked-length args))
+ (info x) )
(case argc
[(#f) (##sys#syntax-error/context "malformed expression" x)]
[(0) (lambda (v)
--
1.6.0.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-hackers] [PATCH] allow procedure in operator position of evaluated lists,
Felix <=