I have started learning Factor and after trying out the palindrome tutorial, I am now trying to make a simple program for filtering out non-prime numbers from a list.
I have made a word multiple-of? which returns true if x is a multiple of y. : multiple-of? ( x y -- ? ) [ = not ] [ mod 0 = ] 2bi and ; I would like to use it filter a sequence of numbers like the expression below, but looping through each of the numbers in the sequence to remove its multiples, leaving only prime numbers. { 2 3 4 5 6 7 8 9 10 } [ 2 multiple-of? not ] filter Is there some loop or combinator that I could use to do this in Factor? -------------------------------------- Thanks 10 years! Yahoo! Shopping and Yahoo! Auctions http://pr.mail.yahoo.co.jp/ec10years/ ------------------------------------------------------------------------------ Come build with us! The BlackBerry® 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/devconf _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk