Three word location: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured, made p2js compatible) |
(J) |
||
Line 543: | Line 543: | ||
latitude = 28.3852, longitude = -81.5638 |
latitude = 28.3852, longitude = -81.5638 |
||
</pre> |
</pre> |
||
=={{header|J}}== |
|||
To take full advantage of the bit space, I think we should use 11650.8444 for the multiplier (2^21 - log2 180), but that's not what was asked for here.<lang J>wloc=: {{ ;:inv wordlist{~ (15 14 14#i.3)#./.;(21 22#&.>2) #:&.> <.0.5+10000*90 180+y }} |
|||
colw=: {{ _90 _180+1e_4*21({.,&#.}.);(15 14 14#&.>2)#:&.>wordlist i.;:y }}</lang> |
|||
With <code>wordlist=: ('W',}.@":)&.> 1e5+i.3e4</code> |
|||
<lang J> wloc 28.3852 _81.5638 |
|||
W18497 W11324 W01322 |
|||
colw wloc 28.3852 _81.5638 |
|||
28.3852 _81.5638</lang> |
|||
With <code>wordlist=: cutLF CR-.~fread 'wordlist'</code> based on the file 'wordlist' from http://www-personal.umich.edu/~jlawler/wordlist <lang J> wloc 28.3852 _81.5638 |
|||
diplotene chamomile aeroplanist |
|||
colw wloc 28.3852 _81.5638 |
|||
28.3852 _81.5638</lang> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |