math.primes.factors: support command-line args like factor(1).

char-rename
John Benediktsson 2017-02-08 11:14:24 -08:00
parent 9d2e62f8e1
commit b5dd40cc53
1 changed files with 8 additions and 4 deletions

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007-2009 Samuel Tardieu. ! Copyright (C) 2007-2009 Samuel Tardieu.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs combinators kernel make math math.functions USING: arrays assocs combinators command-line io kernel make
math.primes math.ranges sequences sequences.product sorting math math.functions math.parser math.primes math.ranges
io math.parser ; namespaces sequences sequences.product sorting ;
IN: math.primes.factors IN: math.primes.factors
<PRIVATE <PRIVATE
@ -62,6 +62,10 @@ PRIVATE>
] if* ; ] if* ;
: run-unix-factor ( -- ) : run-unix-factor ( -- )
[ readln [ unix-factor t ] [ f ] if* ] loop ; command-line get [
[ readln [ unix-factor t ] [ f ] if* ] loop
] [
[ unix-factor ] each
] if-empty ;
MAIN: run-unix-factor MAIN: run-unix-factor