Three word location: Difference between revisions

Added Uiua solution
(added RPL)
(Added Uiua solution)
 
Line 1,649:
</pre>
 
=={{header|Uiua}}==
{{trans|Wren}}
{{Works with|Uiua|0.12.0-dev.1}}
<syntaxhighlight lang="uiua">
# Calculate 'Three Word' indexes from lat, long.
# w1 w2 w3 ? lat long
LLtoWix ← setinv(
+×ⁿ22 2 ⊃(+9e5|+18e5◌)∩(⁅×1e4) # combine to one int.
⊃(°⋯↙¯15|°⋯↙¯14↘¯15|°⋯↘¯28)⋯ # split into three
| ++⊃(×ⁿ28 2|×ⁿ14 2◌|⋅⋅∘)
∩(÷1e4)⊃(-9e5|-18e5◌)∩°⋯⊃(↘22|↙22)⋯
)
&p $"Lat/Long = (_, _)",, 28.38521 ¯81.56379
&p $"Three word indexes: _ _ _"⊃(⊙⊙∘|⊙⊙∘) LLtoWix
&p $"And back again. (_, _)"°LLtoWix
</syntaxhighlight>
{{out}}
<pre>
Lat/Long = (28.38521, -81.56379)
Three word indexes: 18497 11324 1322
And back again. (28.3852, -81.5638)
</pre>
=={{header|V (Vlang)}}==
{{trans|Go}}
173

edits