From 6819227307fed19c5ff595ae281447f1999e5ad3 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 28 Feb 2020 13:16:58 -0800 Subject: [PATCH] websites.factorcode: more examples. --- extra/websites/factorcode/examples.txt | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/extra/websites/factorcode/examples.txt b/extra/websites/factorcode/examples.txt index ff65c2523f..b9be294da6 100644 --- a/extra/websites/factorcode/examples.txt +++ b/extra/websites/factorcode/examples.txt @@ -83,14 +83,8 @@ 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 +ascii file-lines { "%" } split random +[ print ] each ---- USING: combinators io kernel locals math.functions math.parser math.ranges @@ -104,3 +98,20 @@ sequences ; [ i number>string ] } cond print ] each +---- +USING: kernel math sequences text-to-speech ; + +"factor" + +dup [ "aeiou" member? ] find drop [ + [ "way" append ] + [ cut swap "ay" 3append ] if-zero +] when* + +speak-text +---- +USING: math.text.english morse sequences ; + +{ 4 8 15 16 23 42 } [ + number>text play-as-morse +] each