[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] How to pass a list to amb?
From: |
Kon Lovett |
Subject: |
Re: [Chicken-users] How to pass a list to amb? |
Date: |
Sun, 24 Aug 2014 12:59:16 -0700 |
On Aug 24, 2014, at 12:48 PM, Sascha Ziemann <address@hidden> wrote:
> I tried to pass a list to amb but I do not know how to use amb-thunks. I
> tried this:
>
> (require-extension amb)
>
> (let ((names '(a b c)))
> (amb-collect
> (let ((name (amb-thunks (map (lambda (x) x) names)))
(name (amb-thunks (map (lambda (x) (lambda () x)) names)))
> (value (amb 'c 'b 'a)))
> (amb-assert (eq? name value))
> value)))
>
> (let ((names '(a b c)))
> (amb-collect
> (let ((name (amb-thunks names))
> (value (amb 'c 'b 'a)))
> (amb-assert (eq? name value))
> value)))
>
> But both failes with:
>
> Process scheme exited abnormally with code 139
>
> This looks like a bug to me.
Yes, it should not segv but your argument for amb-thunks is invalid. Must be a
list of thunks.
#;2> ,x (amb 'c 'b 'a)
(amb-thunks (list (lambda () 'c) (lambda () 'b) (lambda () 'a)))
>
> I have tested with 4.7.0 on Debian (Intel 32).
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users