>>>>> "Sam" == Samuel Tardieu <s...@rfc1149.net> 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

<PRIVATE

SYMBOL: (primes-under-million)

[ 1000000 primes-upto (primes-under-million) set ] with-compilation-unit

PRIVATE>

: 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

Reply via email to