[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] unbound variable: or
From: |
Michele La Monaca |
Subject: |
Re: [Chicken-users] unbound variable: or |
Date: |
Sat, 30 May 2015 01:44:59 +0200 |
On Fri, May 29, 2015 at 3:10 AM, Jinsong Liang <address@hidden> wrote:
> Thank you Michele! This is a nice example.
Nice but maybe not very useful:
(apply-syntax or (#f (+ 1 2) (print "hello")))
is just a longer and more cumbersome version of
(or (#f (+ 1 2) (print "hello")))
A far more valuable macro is the following:
(define-macro apply-any
(lambda (_ lst)
(eval `(cons ',_ ,lst))))
(define l '(#f (+ 1 2) (print "hello")))
(apply-any or l)
=> 3
(let ((x 9)) (apply-any or '(#f (+ x 1) (print "hello"))))
=> 10
(apply-any + (list 1 2 3))
=> 6
Regards,
Michele
- [Chicken-users] unbound variable: or, Jinsong Liang, 2015/05/27
- Re: [Chicken-users] unbound variable: or, Mario Domenech Goulart, 2015/05/27
- Re: [Chicken-users] unbound variable: or, Peter Bex, 2015/05/27
- Re: [Chicken-users] unbound variable: or, Jinsong Liang, 2015/05/27
- Re: [Chicken-users] unbound variable: or, John Cowan, 2015/05/27
- Re: [Chicken-users] unbound variable: or, Jinsong Liang, 2015/05/27
- Re: [Chicken-users] unbound variable: or, Michele La Monaca, 2015/05/28
- Re: [Chicken-users] unbound variable: or, Jinsong Liang, 2015/05/28
- Re: [Chicken-users] unbound variable: or,
Michele La Monaca <=
- Re: [Chicken-users] unbound variable: or, Jinsong Liang, 2015/05/29
- Re: [Chicken-users] unbound variable: or, Matt Gushee, 2015/05/29
- Re: [Chicken-users] unbound variable: or, John Cowan, 2015/05/29
- Re: [Chicken-users] unbound variable: or, Peter Bex, 2015/05/30
- Re: [Chicken-users] unbound variable: or, Michele La Monaca, 2015/05/30
- Re: [Chicken-users] unbound variable: or, Peter Bex, 2015/05/30
- Re: [Chicken-users] unbound variable: or, Michele La Monaca, 2015/05/30
- Re: [Chicken-users] unbound variable: or, chi, 2015/05/31
- Re: [Chicken-users] unbound variable: or, Peter Danenberg, 2015/05/31
- Re: [Chicken-users] unbound variable: or, Peter Bex, 2015/05/31