Sum and product puzzle: Difference between revisions

m
→‎{{header|REXX}}: added wordsort as internal procedure
(→‎{{header|jq}}: works with jq)
m (→‎{{header|REXX}}: added wordsort as internal procedure)
Line 2,204:
 
=={{header|REXX}}==
 
 
{{improve|REXX version 1| <br><br>Executing this REXX program causes two identical errors message: <br><br> <big>
'WORDSORT' &nbsp; is not recognized as an internal or external command,
operable program or batch file. </big> <br><br>}}
 
 
===version 1===
Line 2,416 ⟶ 2,410:
s=translate(s,c,c||xrange('00'x,'ff'x))
s=space(s,0)
Return length(s)</lang>
wordsort: Procedure
/**********************************************************************
* Sort the list of words supplied as argument. Return the sorted list
**********************************************************************/
Parse Arg wl
wa.=''
wa.0=0
Do While wl<>''
Parse Var wl w wl
Do i=1 To wa.0
If wa.i>w Then Leave
End
If i<=wa.0 Then Do
Do j=wa.0 To i By -1
ii=j+1
wa.ii=wa.j
End
End
wa.i=w
wa.0=wa.0+1
End
swl=''
Do i=1 To wa.0
swl=swl wa.i
End
/* Say swl */
Return strip(swl)</lang>
{{out}}
<pre>2352 possible pairs
2,295

edits