isPrime is now Primo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

isPrime is now Primo

Chris Cunnington
Imagine yourself staring at this for long periods of time: 

amb := Amb new. 

results := amb allValues:
[x := amb oneOf: (1 to: 10).
amb assert: (x > 5).
x].

You say to yourself that it should be easy to change the block to (x isPrime) instead of (x >5). 
But no...in 3.10.2 you get an error. You panic. This is proof of some mystery about continuations you don't grok. 
Then you read the implementation in 3.10.2 and it throws an error if it encounters a 1. 




Reply | Threaded
Open this post in threaded view
|

Re: isPrime is now Primo

Gary Dunn
On Tue, 2010-03-09 at 17:34 -0500, Chris Cunnington wrote:
> Imagine yourself staring at this for long periods of time:

Mmmmm. Primo.  http://www.primobeer.com


--
Gary Dunn, Honolulu
[hidden email]
http://openslate.net/
http://e9erust.blogspot.com/
Sent from Slate001