Re: Morse
- Posted by ghaberek (admin) Sep 09, 2014
- 1322 views
petelomax said...
(Obviously I use Phix so you might need to change that {data,dot,dash} = data to dash = data[3] dot = data[2] data = data[1], not tested on OpenEu.)
Tested and works. Although your multiple assignment statement may not even be necessary. I just passed the values directly to ext().
if sequence( data ) then -- {data,dot,dash} = data -- ext( root, data ) -- ext( root & '.', dot ) -- ext( root & '-', dash ) ext( root, data[1] ) ext( root & '.', data[2] ) ext( root & '-', data[3] ) elsif data != 0 then morse[data] = root printf(1,"morse['%s']:=%s\n",{data,root}) end if
petelomax said...
I think the word you're looking for is "ugly".
Indeed. Efficiency isn't always pretty.
-Greg