On Tue, Sep 13, 2011 at 3:09 PM, Bill Schottstaedt
wrote:
> if lambda were applicable, this would work in both cases:
>
> (define-macro (progv vars vals . body)
> `(apply (apply lambda ,vars ',body) ,vals))
>
>> (let ((s '(one two)) (v '(1 2))) (progv s v (+ one two)))
> 3
>> (progv '(one two) '(
if lambda were applicable, this would work in both cases:
(define-macro (progv vars vals . body)
`(apply (apply lambda ,vars ',body) ,vals))
> (let ((s '(one two)) (v '(1 2))) (progv s v (+ one two)))
3
> (progv '(one two) '(1 2) (+ one two))
3
(running a mystery scheme...)
2011/9/13, Ian Price :
>> Hello,
>> Is there any clever way of binding values to the list of unknown
>> symbols in scheme?
> I have to admit, I don't understand why you would want to bind values
> to a list of _unknown_ symbols; changing random bindings is just asking
> for trouble. :-)
The existe
Panicz Maciej Godek writes:
> Hello,
> Is there any clever way of binding values to the list of unknown
> symbols in scheme?
I have to admit, I don't understand why you would want to bind values
to a list of _unknown_ symbols; changing random bindings is just asking
for trouble. :-)
> In common
> and that I don't know what's in that list.
oops, I missed that requirement. hmmm -- there must be a way.
Hi,
Panicz Maciej Godek skribis:
> for now, the problem is that I want to bind the variables that are
> contained within a list, and that I don't know what's in that list.
I would recommend using (ice-9 match):
(match '(1 2 3)
((a b c) `((a . ,a) (b . ,b) (c . ,c
=> ((a . 1) (b .
I think this works in Guile 1.8.7 (I don't have a later version):
(define-macro (progv vars vals . body)
`(let (,@(map (lambda (var val)
(list var val))
(cadr vars)
(cadr vals)))
,@body))
(progv '(one two) '(1 2) (+ one two))
3
Maybe pre
On Tue, Sep 13, 2011 at 12:04 PM, Panicz Maciej Godek
wrote:
> 2011/9/13, Andrew Gwozdziewycz :
>>
>> Seems likely that you could use `syntax-case' to create a `let` out of
>> these:
>>
>> (define-syntax progv
>> (lambda (stx)
>> (define (create-bindings syms vals)
>> (datum->syntax st
2011/9/13, Andrew Gwozdziewycz :
>
> Seems likely that you could use `syntax-case' to create a `let` out of
> these:
>
> (define-syntax progv
> (lambda (stx)
> (define (create-bindings syms vals)
> (datum->syntax stx (zip (syntax->datum syms) (syntax->datum vals
> (syntax-case s
On Tue, Sep 13, 2011 at 9:54 AM, Panicz Maciej Godek
wrote:
> Hello,
> Is there any clever way of binding values to the list of unknown
> symbols in scheme?
>
> In common lisp there is a form "progv" that takes the list of symbols
> and their corresponding values and binds them within the body of
On Tue, Sep 13, 2011 at 10:25 AM, Andrew Gwozdziewycz wrote:
> On Tue, Sep 13, 2011 at 9:54 AM, Panicz Maciej Godek
> wrote:
>> Hello,
>> Is there any clever way of binding values to the list of unknown
>> symbols in scheme?
>>
>> In common lisp there is a form "progv" that takes the list of symb
Hello,
Is there any clever way of binding values to the list of unknown
symbols in scheme?
In common lisp there is a form "progv" that takes the list of symbols
and their corresponding values and binds them within the body of
progv.
It is possible to do it using eval, like this:
(define (bind-and
12 matches
Mail list logo