Morse code: Difference between revisions
Content deleted Content added
Added Quackery. |
|||
Line 3,836:
windowsmorse(input('A string to change into morse: '))
</syntaxhighlight>
=={{header|Quackery}}==
Mac specific as Quackery sits on top of Python, which is not strong with cross-platform audio.
<syntaxhighlight lang="Quackery"> [ $ /
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 ( $ --> )</syntaxhighlight>
=={{header|Racket}}==
|