Paste: coreutils factor

Author: erg
Mode: factor
Date: Sun, 13 Dec 2009 05:42:06
Plain Text |
: unix-factor ( string -- )
    dup string>number [
        [ ": " append write ]
        [ factors [ number>string ] map " " join print ] bi*
    ] [
        "factor: `" "' is not a valid positive integer" surround print
    ] if* ;

: run-unix-factor ( -- )
    [ readln [ unix-factor t ] [ f ] if* ] loop ;

MAIN: run-unix-factor

New Annotation

Summary:
Author:
Mode:
Body: