]> gitweb.factorcode.org Git - factor.git/commitdiff
morse: add a default speed to play at
authorAlex Chapman <chapman.alex@gmail.com>
Thu, 1 May 2008 01:49:55 +0000 (11:49 +1000)
committerAlex Chapman <chapman.alex@gmail.com>
Thu, 1 May 2008 01:49:55 +0000 (11:49 +1000)
extra/morse/morse-tests.factor
extra/morse/morse.factor

index c87fa483e3a727c2608824a3ae344b83272cfe64..dabb93579dd1eaa1371b41361db953ad322d2a97 100644 (file)
@@ -10,4 +10,4 @@ USING: arrays morse strings tools.test ;
 [ "morse code" ] [ "-- --- .-. ... . / -.-. --- -.. ." morse> ] unit-test
 [ "hello, world!" ] [ "Hello, World!" >morse morse> ] unit-test
 [ ] [ "sos" 0.075 play-as-morse ] unit-test
-[ ] [ "Factor rocks!" 0.05 play-as-morse ] unit-test
+[ ] [ "Factor rocks!" play-as-morse ] unit-test
index d0b9e4003a8ecf89302566e6aee13240d812c17e..ecade14cdbeafb0d0826c561c6cf5e4836d1074e 100644 (file)
@@ -167,8 +167,10 @@ SYMBOLS: source dot-buffer dash-buffer intra-char-gap-buffer letter-gap-buffer ;
 
 PRIVATE>
 
-: play-as-morse ( str unit-length -- )
+: play-as-morse* ( str unit-length -- )
     [
         [ letter-gap ] [ ch>morse play-char ] interleave
     ] swap playing-morse ;
 
+: play-as-morse ( str -- )
+    0.05 play-as-morse* ;