Note that, in the case of the HOW-FAR values being equal, I arbitrarily 
chose to try 1 first and 0 second. If this is done the other way around you 
still get a correct answer, but the time required will be different. For 
some seed values, this will be improve the speed, and for other seed values 
this will slow down the search. If you implement it the same as I did, then 
the number of visits to <FIND-SEED>  will be equal to 464723587 (see the 
comment at the bottom of the source file). There is debugging code in the 
Forth program (optionally compiled if DEBUG? is set to true) that checks for 
this (not in Slava's Factor program though).

Note for Slava: Maybe you should include comparable debugging code in your 
version of LC53 to make sure that it is visiting <FIND-SEED> the same number 
of times as the Forth program. If it isn't, this might be why your program 
ran slower than expected, even though it produced the correct seed 
ultimately. When I was developing LC53, at one time my Forth, Factor and 
assembly-language versions were all out of whack with each other, even 
though they all produced the correct seed ultimately. I'll leave it up to 
you to do this, as I haven't yet figured out all of the new words that you 
introduced in your version, so I don't want to try modifying it.

As for the Clojure version, I would recommend first writing a version that 
is purely sequential and does exactly what the Forth program does (visiting 
<FIND-SEED> the same number of times). After this is done, write another 
version that takes advantage of Clojure's concurrency. In the event that the 
HOW-FAR values are equal, try both 1 and 0 simultaneously. If possible, run 
this on a multi-core computer.

If you have questions about LC53 implementation, contact me directly through 
my email --- we don't want to clutter up the Factor mailing list with 
discussions of Java and Clojure programming, which would be considered 
off-topic.

> Message: 2
> Date: Tue, 27 Oct 2009 16:37:47 +0000
> From: Emeka <[email protected]>
> Subject: Re: [Factor-talk] LC53 --- volunteers needed for porting
> To: [email protected]
> Message-ID:
> <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hugh,
>
> I would look into porting your  LC53 to Clojure and Java
>
> Regards,
> Emeka


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to