Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Show-ASCII-table/Factor/show-ascii-table-1.factor
Normal file
15
Task/Show-ASCII-table/Factor/show-ascii-table-1.factor
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
USING: combinators formatting io kernel math math.ranges
|
||||
pair-rocket sequences ;
|
||||
IN: rosetta-code.ascii-table
|
||||
|
||||
: row-values ( n -- seq ) [ 32 + ] [ 112 + ] bi 16 <range> ;
|
||||
|
||||
: ascii>output ( n -- str )
|
||||
{ 32 => [ "Spc" ] 127 => [ "Del" ] [ "" 1sequence ] } case ;
|
||||
|
||||
: print-row ( n -- )
|
||||
row-values [ dup ascii>output "%3d : %-3s " printf ] each nl ;
|
||||
|
||||
: print-ascii-table ( -- ) 16 <iota> [ print-row ] each ;
|
||||
|
||||
MAIN: print-ascii-table
|
||||
19
Task/Show-ASCII-table/Factor/show-ascii-table-2.factor
Normal file
19
Task/Show-ASCII-table/Factor/show-ascii-table-2.factor
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
USING: combinators formatting io kernel math math.ranges
|
||||
pair-rocket sequences ;
|
||||
IN: rosetta-code.ascii-table
|
||||
|
||||
: main ( -- )
|
||||
16 <iota> [
|
||||
32 + 127 16 <range> [
|
||||
dup {
|
||||
32 => [ "Spc" ]
|
||||
127 => [ "Del" ]
|
||||
[ "" 1sequence ]
|
||||
} case
|
||||
"%3d : %-3s " printf
|
||||
] each
|
||||
nl
|
||||
] each
|
||||
;
|
||||
|
||||
MAIN: main
|
||||
Loading…
Add table
Add a link
Reference in a new issue