Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

# Why in APL there is different behaviour of ,{dieresis} for differents types?

82 views

### Rosario19

Nov 15, 2023, 8:44:27 AM11/15/23
to

Why ",{dieresis}" has a different behaviour in 1,{dieresis}1 2 3 4 and
b,{dieresis}a?
a{leftarrow}(1 2)(2 3)(4 5)(6 7)
o a
+4--------------------------+
Ś+2---+ +2---+ +2---+ +2---+Ś
ŚŚ 1 2Ś Ś 2 3Ś Ś 4 5Ś Ś 6 7ŚŚ
Ś+~---+ +~---+ +~---+ +~---+2
+?--------------------------+
b{leftarrow}(0 0)
o b
+2---+
Ś 0 0Ś
+~---+
o b,{dieresis}a
LENGTH ERROR
o b,{dieresis}a
?
o 1 2 3 4
+4-------+
Ś 1 2 3 4Ś
+~-------+
o 1
1
~
o 1,{dieresis}1 2 3 4
+4--------------------------+
Ś+2---+ +2---+ +2---+ +2---+Ś
ŚŚ 1 1Ś Ś 1 2Ś Ś 1 3Ś Ś 1 4ŚŚ
Ś+~---+ +~---+ +~---+ +~---+2
+?--------------------------+

### Bob Smith

Nov 16, 2023, 3:16:40 PM11/16/23
to
On 11/15/2023 8:43 AM, Rosario19 wrote:
>
> Why ",{dieresis}" has a different behaviour in 1,{dieresis}1 2 3 4 and
> b,{dieresis}a?
> a{leftarrow}(1 2)(2 3)(4 5)(6 7)
> o a
> +4--------------------------+
> ¦+2---+ +2---+ +2---+ +2---+¦
> ¦¦ 1 2¦ ¦ 2 3¦ ¦ 4 5¦ ¦ 6 7¦¦
> ¦+~---+ +~---+ +~---+ +~---+2
> +?--------------------------+
> b{leftarrow}(0 0)
> o b
> +2---+
> ¦ 0 0¦
> +~---+
> o b,{dieresis}a
> LENGTH ERROR
> o b,{dieresis}a
> ?

This expression produces an error because b is a two-element vector and
a is a four-element vector, and are of incompatible lengths for ,¨ .
When you specified the elements of a, you enclosed each element in
parens which works only when there are two or more elements. When you
specified b as in b←(0 0), the parens don't enclose the value. Perhaps
what you meant is to use the enclose function explicitly as in b←⊂0 0. Now

b,¨a
┌4──────────────────────────────────────────┐
│┌4───────┐ ┌4───────┐ ┌4───────┐ ┌4───────┐│
││ 0 0 1 2│ │ 0 0 2 3│ │ 0 0 4 5│ │ 0 0 6 7││
│└~───────┘ └~───────┘ └~───────┘ └~───────┘2
└∊──────────────────────────────────────────┘

> o 1 2 3 4
> +4-------+
> ¦ 1 2 3 4¦
> +~-------+
> o 1
> 1
> ~
> o 1,{dieresis}1 2 3 4
> +4--------------------------+
> ¦+2---+ +2---+ +2---+ +2---+¦
> ¦¦ 1 1¦ ¦ 1 2¦ ¦ 1 3¦ ¦ 1 4¦¦
> ¦+~---+ +~---+ +~---+ +~---+2
> +?--------------------------+

In this case, the scalar left argument to ,¨ extends to catenate the
scalar to each element in the right arg, as in

1,¨1 2 3 4
┌4──────────────────────────┐
│┌2───┐ ┌2───┐ ┌2───┐ ┌2───┐│
││ 1 1│ │ 1 2│ │ 1 3│ │ 1 4││
│└~───┘ └~───┘ └~───┘ └~───┘2
└∊──────────────────────────┘

The most recent beta version of NARS2000.org supports )BOX ON to produce
the boxed displays seen above.

BTW, if you set your email client to encode the text as UTF-8, then you
can copy text directly from your APL program into an email msg, as I did
above.

--
_________________________________________
Bob Smith -- bsm...@sudleydeplacespam.com
http://www.sudleyplace.com - http://www.nars2000.org

To reply to me directly, delete "despam".

### Rosario19

Nov 17, 2023, 3:50:31 AM11/17/23
to
>specified b as in b?(0 0), the parens don't enclose the value.

enclose for me means that operator depth here {equalunderbar} return
great than 0

{equalunderbar}1 2{cr}{lf}
1{cr}{lf}
{equalunderbar}1{cr}{lf}
0{cr}{lf}

>Perhaps
>what you meant is to use the enclose function explicitly as in b??0 0. Now
>
> b,¨a
>?4???????????????????????????????????????????
>??4???????? ?4???????? ?4???????? ?4?????????
>?? 0 0 1 2? ? 0 0 2 3? ? 0 0 4 5? ? 0 0 6 7??
>??~???????? ?~???????? ?~???????? ?~????????2
>?????????????????????????????????????????????
>
>> o 1 2 3 4
>> +4-------+
>> ¦ 1 2 3 4¦
>> +~-------+
>> o 1
>> 1
>> ~
>> o 1,{dieresis}1 2 3 4
>> +4--------------------------+
>> ¦+2---+ +2---+ +2---+ +2---+¦
>> ¦¦ 1 1¦ ¦ 1 2¦ ¦ 1 3¦ ¦ 1 4¦¦
>> ¦+~---+ +~---+ +~---+ +~---+2
>> +?--------------------------+
>
>In this case, the scalar left argument to ,¨ extends to catenate the
>scalar to each element in the right arg, as in
>
> 1,¨1 2 3 4
>?4???????????????????????????
>??2???? ?2???? ?2???? ?2?????
>?? 1 1? ? 1 2? ? 1 3? ? 1 4??
>??~???? ?~???? ?~???? ?~????2
>?????????????????????????????
>
>The most recent beta version of NARS2000.org supports )BOX ON to produce
>the boxed displays seen above.

yes i know that

### Rosario19

Nov 17, 2023, 3:56:06 AM11/17/23
to
On Fri, 17 Nov 2023 09:49:41 +0100, Rosario19 <R...@invalid.invalid>
wrote:

>On Thu, 16 Nov 2023 15:16:37 -0500, Bob Smith wrote:
>>The most recent beta version of NARS2000.org supports )BOX ON to produce
>>the boxed displays seen above.
>
>yes i know that

above is wrong i did not know that, i would think the speech was for
fmt

so ok )BOX ON is fmt for all input

### Rosario19

Nov 17, 2023, 4:04:48 AM11/17/23
to
On Fri, 17 Nov 2023 09:55:17 +0100, Rosario19 <R...@invalid.invalid>
thank you