Re: [Factor-talk] An alternative for "foldable"?
Slava> Make it a MEMO: word. Then the result will only be computed Slava> once. Sam> Done, you can pull from Sam> git://git.rfc1149.net/factor.git for-slava Sam> However, this will degrade performance for Sam> "benchmark.binary-search", as the list will be computed at the Sam> first occurrence. Doug> call it as a toplevel form and drop the result. Doug Fair enough. Pushed to the same place as well. Sam -- Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/ -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] An alternative for "foldable"?
call it as a toplevel form and drop the result. Doug On Dec 29, 2008, at 12:10, Samuel Tardieu wrote: >> "Slava" == Slava Pestov writes: > > Slava> Make it a MEMO: word. Then the result will only be computed > Slava> once. > > Done, you can pull from > > git://git.rfc1149.net/factor.git for-slava > > However, this will degrade performance for "benchmark.binary-search", > as the list will be computed at the first occurrence. > > Sam > -- > Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/ > > > --- > --- > --- > - > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] An alternative for "foldable"?
> "Slava" == Slava Pestov writes: Slava> Make it a MEMO: word. Then the result will only be computed Slava> once. Done, you can pull from git://git.rfc1149.net/factor.git for-slava However, this will degrade performance for "benchmark.binary-search", as the list will be computed at the first occurrence. Sam -- Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/ -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] An alternative for "foldable"?
On Mon, Dec 29, 2008 at 5:07 AM, Samuel Tardieu wrote: > One intermediate solution is to make it foldable despite its output > being mutable. Make it a MEMO: word. Then the result will only be computed once. Slava -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] An alternative for "foldable"?
> "Sam" == Samuel Tardieu writes: Sam> What is the best way to initialize "primes-under-million" at Sam> parsing time? One intermediate solution is to make it foldable despite its output being mutable. This is not worse semantically than what was done before when the list was hardcoded (it can be modified by one of its users). However, it also means that the primes list will be recomputed when parsing every word that uses primes-under-million. The following makes it be computed at parsing time, but I guess there is a cleaner alternative: USING: compiler.units math.primes namespaces ; IN: math.primes.list : primes-under-million ( -- seq ) (primes-under-million) get ; -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] An alternative for "foldable"?
> "Sam" == Samuel Tardieu writes: Sam> Sure, but that was just an example. It would be great to be able Sam> to indicate that the list of primes between two numbers can be Sam> known at compile time if the bounds are. Argh, this is what broke "benchmark.binary-search" (sorry about that): it uses "primes-under-million" in a loop, which gets recomputed every time because I removed the incorrect "foldable" on "primes-upto". What is the best way to initialize "primes-under-million" at parsing time? Sam -- Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/ -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk