In the page of internet of "rosetta code", there is one APL function
qsort
but here in Nars2000 there is some problem
qsort {leftarrow} {leftbrace}1{rightcaretunderbar}r{leftarrow}{notequalunderbar}{omega}:{omega}{diamond}p{leftarrow}{omega}[?r]{diamond}({del}({omega}<p)/{omega}),(({omega}=p)/{omega}),({del}({omega}>p)/{omega}){rightbrace}
qsort 45 7 88 55 4 6 89
LIMIT ERROR
My workaround is not write ?r but use floor(r/2) instead. Than addeddieresis}{omega}{diamond}({alpha}{alpha}{del}{del}(0<k)/{omega}),((0=k)/{omega}),({alpha}{alpha}{del}{del}(0>k)/{omega}){rightbrace}
some code for use one extern compare function for 2 elements
qsortf{leftarrow}{leftbrace}1{rightcaretunderbar}r{leftarrow}{notequalunderbar}{omega}:{omega}{diamond}p{leftarrow}{omega}{rightshoe}{dieresistilde}{downstile}r{colonbar}2{diamond}k{leftarrow}{alpha}{alpha}{leftbrace}{omega}{alpha}{alpha}p{rightbrace}{
This order using function -
-qsortf 45 7 88 55 4 6 89
+7-----------------+
Ś 89 88 55 45 7 6 4Ś
+~-----------------+
this use the function -{dieresistilde} (im not so sure {dieresistilde}
is the right traslation)
-{dieresistilde}qsortf 45 7 88 55 4 6 89
+7-----------------+
Ś 4 6 7 45 55 88 89Ś
+~-----------------+
this order using the first element of array element {?[1]<?[1]:Ż1??[1]=?[1]:0?1} qsortf (45 2) (7 9) (88 1) (55 3)
(4 5) (6 11) (89 8)
+7----------------------------------------------------+
Ś+2----+ +2----+ +2----+ +2----+ +2---+ +2----+ +2---+Ś
ŚŚ 89 8Ś Ś 88 1Ś Ś 55 3Ś Ś 45 2Ś Ś 7 9Ś Ś 6 11Ś Ś 4 5ŚŚ Ś+~----+ +~----+ +~----+ +~----+ +~---+ +~----+ +~---+2 +?----------------------------------------------------+
someone note something wrong? is there some error (because i'm not
familiar in use function {alpha}{alpha} or {del}{del} )?
On Sun, 26 Nov 2023 18:16:42 -0800 (PST), Sudleyplace <bsmith@sudleyplace.com> wrote:
if there is one wuestion i would ask? yes one general apl question
why enter as input
1 1
is one array of 2 elements
the same of
(1 1)
?
Why (1 1) is not the array 1 1, enclosed?
On 11/27/2023 11:52 PM, Rosario19 wrote:
On Sun, 26 Nov 2023 18:16:42 -0800 (PST), Sudleyplace
<bsmith@sudleyplace.com> wrote:
if there is one wuestion i would ask? yes one general apl question
why enter as input
1 1
is one array of 2 elements
the same of
(1 1)
?
Why (1 1) is not the array 1 1, enclosed?
The best description I've found to answer this question is from the APL2 >Language Reference Manual (apl2lrm.pdf, p.37) which says
"In expressions of arrays, parentheses that do not separate and group
are redundant".
That is, in a?(1 1) the parens group but do not separate, and so they
are redundant, meaning that a?(1 1) is equivalent to a?1 1.
In a?(1 1) (2 2) as in a?(1 1) 2 2 the parens both group and separate,
and so they are not redundant, meaning that no set of parens may be
removed without changing the meaning of that expression.
In a?(1) (2) as in a?(1) 2 the parens separate but do not group, so they
are all redundant.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 71:44:07 |
Calls: | 6,694 |
Calls today: | 4 |
Files: | 12,228 |
Messages: | 5,346,587 |
Posted today: | 1 |