Re: [Chicken-users] amb egg bug/confusion

2012-03-19 Thread Alan Post
On Thu, Mar 15, 2012 at 01:38:19AM +0100, Thomas Chust wrote:
 On Wed, 2012-03-14 at 18:23 -0600, Alan Post wrote:
  [...]
(pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
  [...]
  produces:
  [...]
(0)
  [...]
 
 Hello,
 
 to me this behaviour looks correct. amb-collect is supposed to collect
 all the different values its argument can take on, but in your example s
 is not an ambivalent expression -- the fact that s is bound to a value
 produced by amb only makes the let expression ambivalent.
 
 To phrase it more technically: Every amb-collect creates a new dynamic
 scope for backtracking. Any ambivalence introduced in that dynamic scope
 will be resolved and the results will be collected but any outer dynamic
 scope will not be affected.
 

Thomas, John,

Thank you both very much.  I did manage to start properly using the
amb egg, and completed a one-off homework assignment:

https://github.com/alanpost/permaculture-design-course/blob/master/guild/README

amb is very neat.  I'll likely throw larger datasets and more
interesting constraints at it as I continue to explore this
problem space.

-Alan
-- 
.i ma'a lo bradi cu penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] amb egg bug/confusion

2012-03-19 Thread Matt Welland
On Mon, Mar 19, 2012 at 5:55 AM, Alan Post alanp...@sunflowerriver.orgwrote:

 On Thu, Mar 15, 2012 at 01:38:19AM +0100, Thomas Chust wrote:
  On Wed, 2012-03-14 at 18:23 -0600, Alan Post wrote:
   [...]
 (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
   [...]
   produces:
   [...]
 (0)
   [...]
 
  Hello,
 
  to me this behaviour looks correct. amb-collect is supposed to collect
  all the different values its argument can take on, but in your example s
  is not an ambivalent expression -- the fact that s is bound to a value
  produced by amb only makes the let expression ambivalent.
 
  To phrase it more technically: Every amb-collect creates a new dynamic
  scope for backtracking. Any ambivalence introduced in that dynamic scope
  will be resolved and the results will be collected but any outer dynamic
  scope will not be affected.
 

 Thomas, John,

 Thank you both very much.  I did manage to start properly using the
 amb egg, and completed a one-off homework assignment:


 https://github.com/alanpost/permaculture-design-course/blob/master/guild/README

 amb is very neat.  I'll likely throw larger datasets and more
 interesting constraints at it as I continue to explore this
 problem space.


Wow, another permaculturist on the chicken scheme list, what is the
probability of that? I got my design certification just over a year ago.
Nice work on the guild design! Do you have further plans for the code?


 -Alan
 --
 .i ma'a lo bradi cu penmi gi'e du

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] amb egg bug/confusion

2012-03-19 Thread Alan Post
On Mon, Mar 19, 2012 at 09:18:29AM -0700, Matt Welland wrote:
On Mon, Mar 19, 2012 at 5:55 AM, Alan Post
[1]alanp...@sunflowerriver.org wrote:
 
  On Thu, Mar 15, 2012 at 01:38:19AM +0100, Thomas Chust wrote:
   On Wed, 2012-03-14 at 18:23 -0600, Alan Post wrote:
[...]
* (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
[...]
produces:
[...]
* (0)
[...]
  
   Hello,
  
   to me this behaviour looks correct. amb-collect is supposed to collect
   all the different values its argument can take on, but in your example
  s
   is not an ambivalent expression -- the fact that s is bound to a value
   produced by amb only makes the let expression ambivalent.
  
   To phrase it more technically: Every amb-collect creates a new dynamic
   scope for backtracking. Any ambivalence introduced in that dynamic
  scope
   will be resolved and the results will be collected but any outer
  dynamic
   scope will not be affected.
  
 
  Thomas, John,
 
  Thank you both very much. *I did manage to start properly using the
  amb egg, and completed a one-off homework assignment:
 
  
 [2]https://github.com/alanpost/permaculture-design-course/blob/master/guild/README
 
  amb is very neat. *I'll likely throw larger datasets and more
  interesting constraints at it as I continue to explore this
  problem space.
 
Wow, another permaculturist on the chicken scheme list, what is the
probability of that? I got my design certification just over a year ago.
Nice work on the guild design! Do you have further plans for the code?
*
 

Ossum!  I'm inclined to agree with Jorg and say it's because it's
*Chicken* Scheme.  _ 

I do have further plans for the code.  I'm taking a 7-weekend
course, with 2 weeknds left.  I won't be working on it again
until I finish the course, which happens at the end of April.

I'm not sure in which direction I'll go first: it really depends
on which problem in front of me I have the best data on.  This
project convinced me that I needed to start compiling and collecting
such data: the constraint exploration was the finishing touch and
my playground, and the more data I have the more options I have
to play with.

A local-to-me ecologist is interested in sitting down and
brainstorming, I hope something interesting comes of that. 

-Alan
-- 
.i ma'a lo bradi cu penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] amb egg bug/confusion

2012-03-19 Thread Alan Post
On Mon, Mar 19, 2012 at 10:05:19PM +0100, Jörg F. Wittenberger wrote:
 On Mar 19 2012, Alan Post wrote:
 
 On Mon, Mar 19, 2012 at 09:18:29AM -0700, Matt Welland wrote:
On Mon, Mar 19, 2012 at 5:55 AM, Alan Post
 A local-to-me ecologist is interested in sitting down and
 brainstorming, I hope something interesting comes of that.
 
 -Alan
 
 Alan, now I you made me curious.
 
 Which of the ecologists is going to sit down?
 
 Will the result relate more to plants?
 
 Or is the egg system going to get a layer where one can bind
 those tentative identifiers used within the implementation
 of the importing module by specifying constraints instead of
 source locations upon import?
 
 I'd love it!
 

The things I found myself wanting:

 + I wanted to know why some elements were excluded.  What
   constraints were filtering which plants?  Basically: why
   did my final group represent only a fraction of my available
   plants?  I wanted reporting data that I could see and play
   with.
 + I wanted a constraint library.  stuff like require one of
   a set to have a property with value foo. and require every
   element of this set to have the property value foo.  But also
   ensure 4 out of 5 property values are present.  I can see
   myself developing this library if I use amb more.
 + I wanted to compare runs when I had different constraints.  I'm
   confused on what exactly I want to compare: mostly I think I
   want to store the output along with the set of constraints in
   a notebook so I can refer to previous explorations.

Any work I do here is pretty likely to be specific to my problem
domain (plants), but perhaps something general would emerge.

You've probably never heard of the ecologist, he's pretty obscure
(hehe, I think it's a student at my local uni, but I'm not sure,
we haven't met in real life.)

-Alan
-- 
.i ma'a lo bradi cu penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] amb egg bug/confusion

2012-03-14 Thread Alan Post
I'm confused by the following behavior in the amb egg:

  (require-extension extras amb)

  (pretty-print (amb-collect (amb 0 1 2)))
  (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
  (exit)

produces:

  (0 1 2)
  (0)

I would expect both forms to produce (0 1 2).

What am I missing?  I'm trying to do something more complicated than
the above, but this was the test case I was able to produce.

-Alan
-- 
.i ma'a lo bradi cu penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] amb egg bug/confusion

2012-03-14 Thread Thomas Chust
On Wed, 2012-03-14 at 18:23 -0600, Alan Post wrote:
 [...]
   (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
 [...]
 produces:
 [...]
   (0)
 [...]

Hello,

to me this behaviour looks correct. amb-collect is supposed to collect
all the different values its argument can take on, but in your example s
is not an ambivalent expression -- the fact that s is bound to a value
produced by amb only makes the let expression ambivalent.

To phrase it more technically: Every amb-collect creates a new dynamic
scope for backtracking. Any ambivalence introduced in that dynamic scope
will be resolved and the results will be collected but any outer dynamic
scope will not be affected.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] amb egg bug/confusion

2012-03-14 Thread John Cowan
Alan Post scripsit:

   (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))

You're assuming that the result of amb is an amb object that you
can bind to a variable, but that's not how amb works.  It provides
a non-linear flow of control in the evaluation of its arguments, but
once it terminates, it returns the single value produced by the first
non-failing argument, in this case 0.

-- 
Go, and never darken my towels again!   John Cowan
--Rufus T. Firefly  http://ccil.org/~cowan

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users