Sort the letters of string in alphabetical order: Difference between revisions

Content added Content deleted
(Added Quackery.)
(→‎{{header|Quackery}}: fixed to comply with task requirements)
Line 1,239: Line 1,239:
=={{header|Quackery}}==
=={{header|Quackery}}==


With regard to the [[Talk:Sort the letters of string in alphabetical order|discussion]] regarding the nature of the task, I am construing the words "alphabetical order" and "lexicographical order" to mean QACSFOT order. (''Quackery Arbitrary Character Sequence For Ordered Text'').
With regard to the [[Talk:Sort the letters of string in alphabetical order|discussion]] regarding the nature of the task, I am construing the phrases "alphabetical order" and "lexicographical order" to mean QACSFOT order. ('''''Q'''uackery '''A'''rbitrary '''C'''haracter '''S'''equence '''F'''or '''O'''rdered '''T'''ext'')


The task is presented as a dialogue in the Quackery Shell: we take the 96 printable characters that Quackery recognises in their native (ASCII/Unicode) order, and sort them into QACSFOT order, and then back into native order.
We take the 96 printable characters that Quackery recognises in their native (ASCII/Unicode) order, and sort them into QACSFOT order using a word <code>qacsort</code> that we have defined to do that.

<syntaxhighlight lang="Quackery"> [ sortwith [ qacsfot dip qacsfot > ] ] is qacsort ( $ --> $ )

[] 94 times [ i^ 1+ space + join ]

say "Native order:" cr
dup echo$ cr cr
say "QACSFOT order:" cr
qacsort echo$</syntaxhighlight>


{{out}}
{{out}}


<pre>Native order:
<pre>/O> [] 94 times [ i^ 1+ space + join ]
...
... say "Native order:" cr
... dup echo$ cr cr
... say "QACSFOT order:" cr
... sortwith [ qacsfot dip qacsfot > ]
... dup echo$ cr cr
... say "Native order:" cr
... sort
... echo$ cr
...
Native order:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~


QACSFOT order:
QACSFOT order:
0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz()[]{}<>~=+-*/^\|_.,:;?!'"`%@&#$
0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz()[]{}<>~=+-*/^\|_.,:;?!'"`%@&#$</pre>

Native order:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Stack empty.

/O> </pre>


=={{header|Raku}}==
=={{header|Raku}}==