websites.factorcode: more examples.

master
John Benediktsson 2020-02-28 13:04:46 -08:00
parent ed3cdf7ec7
commit 9237a4f289
1 changed files with 26 additions and 0 deletions

View File

@ -78,3 +78,29 @@ USING: ascii tools.test ;
{ "HELLO" } [ "HeLlO" >upper ] unit-test { "HELLO" } [ "HeLlO" >upper ] unit-test
{ "Hello" } [ "HeLlO" >title ] unit-test { "Hello" } [ "HeLlO" >title ] unit-test
{ "hello" } [ "HeLlO" >lower ] unit-test { "hello" } [ "HeLlO" >lower ] unit-test
----
USING: io io.encodings.ascii io.files
random sequences splitting ;
"/usr/share/games/fortune/fortunes"
ascii file-lines { "%" } split
random [ print ] each
----
USING: morse text-to-speech ;
"Hello, world!" speak-text
"Factor" play-as-morse
----
USING: combinators io kernel locals
math.functions math.parser math.ranges
sequences ;
100 [1,b] [| i |
{
{ [ i 15 divisor? ] [ "FizzBuzz" ] }
{ [ i 3 divisor? ] [ "Fizz" ] }
{ [ i 5 divisor? ] [ "Buzz" ] }
[ i number>string ]
} cond print
] each