Hex words: Difference between revisions

add RPL
(Initial FutureBasic task solution added)
(add RPL)
Line 2,080:
bade ➡ 47838 ➡ 3
abed ➡ 44013 ➡ 3</pre>
=={{header|RPL}}==
≪ → words
≪ { }
1 words SIZE '''FOR''' w
words w GET
'''IF''' DUP SIZE 4 ≥ '''THEN'''
"abcdef" 1 SF
1 3 PICK SIZE '''FOR''' c
DUP2 SWAP c DUP SUB
'''IF''' POS NOT '''THEN''' 1 CF 99 'c' STO '''END'''
'''NEXT''' DROP
'''IF''' 1 FS? '''THEN''' + '''ELSE''' DROP '''END'''
'''ELSE''' DROP '''END'''
'''NEXT'''
≫ ≫ '<span style="color:blue">HXWORDS</span>' STO
≪ 4 UnixDict <span style="color:blue">HXWORDS</span> 0 0
→ diff hexwords value maxroot
≪ { }
1 hexwords SIZE '''FOR''' h
hexwords h GET
"" 0 'value' STO
1 3 PICK SIZE '''FOR''' c
OVER c DUP SUB
'''IF''' DUP2 POS NOT '''THEN''' SWAP OVER + SWAP '''END'''
NUM 87 - value 16 * + 'value' STO
'''NEXT'''
'''IF''' SIZE diff < '''THEN''' DROP
'''ELSE'''
value 1 - 9 MOD 1 +
DUP maxroot MAX 'maxroot' STO
SWAP value
3 →LIST 1 →LIST +
'''END'''
'''NEXT'''
'hexwords' STO { }
1 maxroot '''FOR''' r
1 hexwords SIZE FOR h
hexwords h GET
'''IF''' DUP 1 GET r == '''THEN''' 1 →LIST + '''ELSE''' DROP '''END'''
'''NEXT NEXT'''
≫ ≫ '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: { { 1 "deaf" 57007 } { 1 "decade" 14600926 } { 3 "abed" 44013 } { 3 "bade" 47838 } { 4 "decca" 912586 } { 6 "bead" 48813 } { 6 "deface" 14613198 } { 7 "fade" 64222 } { 8 "efface" 15727310 } { 8 "facade" 16435934 } { 9 "accede" 11325150 } { 9 "cafe" 51966 } { 9 "face" 64206 } }
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby" line>def report(a)
1,150

edits