tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
24
Task/Rot-13/Factor/rot-13.factor
Normal file
24
Task/Rot-13/Factor/rot-13.factor
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env factor
|
||||
|
||||
USING: kernel io ascii math combinators sequences ;
|
||||
IN: rot13
|
||||
|
||||
: rot-base ( ch ch -- ch ) [ - 13 + 26 mod ] keep + ;
|
||||
|
||||
: rot13-ch ( ch -- ch )
|
||||
{
|
||||
{ [ dup letter? ] [ CHAR: a rot-base ] }
|
||||
{ [ dup LETTER? ] [ CHAR: A rot-base ] }
|
||||
[ ]
|
||||
}
|
||||
cond ;
|
||||
|
||||
: rot13 ( str -- str ) [ rot13-ch ] map ;
|
||||
|
||||
: main ( -- )
|
||||
[ readln dup ]
|
||||
[ rot13 print flush ]
|
||||
while
|
||||
drop ;
|
||||
|
||||
MAIN: main
|
||||
Loading…
Add table
Add a link
Reference in a new issue