morse: add a default speed to play at
parent
ce2412c4c8
commit
b729186986
|
@ -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
|
||||
|
|
|
@ -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* ;
|
||||
|
|
Loading…
Reference in New Issue