45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
[ $ /
|
|
import subprocess
|
|
subprocess.run(["say",
|
|
string_from_stack()])
|
|
/ python ] is speak ( $ --> )
|
|
|
|
[ 3 times [ $ " " speak ] ] is pause ( --> )
|
|
|
|
[ [] swap witheach
|
|
[ char - = iff
|
|
[ $ "dash " join ]
|
|
else [ $ "dot " join ] ]
|
|
space join ] is dotdash ( $ --> $ )
|
|
|
|
[ table ] is letter ( n --> $ )
|
|
$ ".- -... -.-. -.. . ..-.
|
|
--. .... .. .--- -.-
|
|
.-.. -- -. --- .--.
|
|
--.- .-. ... - ..- ...-
|
|
.-- -..- -.-- --.."
|
|
nest$ witheach
|
|
[ dotdash ' letter put ]
|
|
|
|
|
|
[ table ] is number ( n --> $ )
|
|
$ "----- .---- ..--- ...--
|
|
....- ..... -.... --...
|
|
---.. ----."
|
|
nest$ witheach
|
|
[ dotdash ' number put ]
|
|
|
|
[ witheach
|
|
[ dup space = iff
|
|
[ drop pause ] done
|
|
dup char 0 char 9 1+
|
|
within iff
|
|
[ char 0 -
|
|
number speak ] done
|
|
upper
|
|
dup char A char Z 1+
|
|
within iff
|
|
[ char A -
|
|
letter speak ] done
|
|
drop ] ] is morse ( $ --> )
|