tools.seq: adding "seq" tool.

db4
John Benediktsson 2015-04-01 14:37:00 -07:00
parent 54595382ff
commit a1b3886327
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1 @@
John Benediktsson

View File

@ -0,0 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-name "seq" }
{ deploy-ui? f }
{ deploy-c-types? f }
{ deploy-console? t }
{ deploy-unicode? f }
{ "stop-after-last-window?" t }
{ deploy-io 3 }
{ deploy-reflection 6 }
{ deploy-word-props? f }
{ deploy-math? t }
{ deploy-threads? t }
{ deploy-word-defs? f }
}

View File

@ -0,0 +1,23 @@
! Copyright (C) 2011 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: combinators command-line io kernel math.order math.parser
math.ranges namespaces sequences ;
IN: tools.seq
: usage ( -- )
"Usage: seq [first [incr]] last" print ;
: seq ( a step b -- )
swap <range> [ number>string print ] each ;
: run-seq ( -- )
command-line get dup length {
{ 1 [ first string>number [ 1 1 ] dip seq ] }
{ 2 [ first2 [ string>number ] bi@ 2dup before? 1 -1 ? swap seq ] }
{ 3 [ first3 [ string>number ] tri@ seq ] }
[ 2drop usage ]
} case ;
MAIN: run-seq