In article
<
ef550acd-9dfb-443b...@dp8g2000vbb.googlegroups.com>,
Adarsh <
adars...@gmail.com> writes
>On 14 Jan, 15:22, Ellis Morgan <
el...@ellismorgan.co.uk> wrote:
>> On Jan 14, 10:45 am, Adarsh <
adarsha...@gmail.com> wrote:
>>
>>
>>
>>
>>
>> > On 14 Jan, 00:09, Ellis Morgan <
el...@ellismorgan.co.uk> wrote:
>>
>> > > On Jan 13, 9:31 pm, Adarsh <
adarsha...@gmail.com> wrote:
>>
>> > > > Hi All,
>>
>> > > > Can you guide me how to fix the below code in Dyalog APL.
>>
>> > > > This code gives desired results in IBM APL2 on Mainframes, but LENGTH
>> > > > ERROR in Dyalog APL 12.1
>>
>> > > > APL2 Code:
>>
>> > > > X0 >>
>> > > > (~0 >>
>> > > > The result of above statement in APL2 is 23 rows and 2 column matrix
>> > > > of spaces.
>>
>> > > > My ultimate objective is to get result as no of columns of right hand
>> > > > argument and no of rows of left argument. I mean 23 rows and 2 column
>> > > > matrix of space.
>>
>> > > > I tried with below logic, but I am getting 0's as result instead
>> > > > spaces, only when my left argument is an array of numeric 1. If its
>> > > > is 0, then it gives LENGTH ERROR
>>
>> > > > (y0 >> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>> > > > 00
>>
>> > > I am not quite sure what you want to do, here is what I see in Dyalog
>> > > 12.1 ...
>> > > X0 >> > > (~0 >> > > DOMAIN ERROR
>> > > (~0 >> > > 0 >> > > (~0 >> > > LENGTH ERROR
>> > > (~0 >> > > 0 >>
>> > > y0 >> > > y
>> > > 0 1 1 1 0
>> > > (y0 >> > > LENGTH ERROR
>> > > (y0 >> > > 0 >> > > (y0 >>
>> > > 00
>> > > 00
>> > > 00
>>
>> > > 0 >> > > 5 2- Dölj citerad text -
>>
>> > > - Visa citerad text -
>>
>> > Hi Ellis,
>>
>> > Thanks for your prompt response !
>>
>> > It was a typo error from my side, you are right, the right hand
>> > argument's first dimension is same as left one.
>>
>> > The code in APL2 looks as below
>>
>> > (~0 >>
>> > Now, my task is to get the same output in Dyalog APL with the same
>> > input.
>> > I need not limit myself to the same
>> > operator in Dyalog APL. Can you suggest how should i do this !
>>
>> Here is one way ...
>>
>> 0 >> 0
>>
>> X0 >> X
>>
>> ??
>> ?
>> ?
>>
>> ??
>>
>> (0 >>
>> 00
>>
>> 0 >> 0 >> 0 >> 0
>> 0 >>
>> 00
>>
>> 0 >>
>> - Visa citerad text -
>
>Ellis,
>
>Your solution seems interesting!
>
>But, I was looking ultimately a matrix with 23 rows and 2 columns. In
>my example, the no of columns was decided by the right argument's (1 2
>0 >what the challenge in Dyalog APL to achive for me.
>
>I tried with your above logic to suit my requirement. But, I'm getting
>Lenght Error in most of the cases.
>
>Please suggest if you have better approach.
The number of rows in the answer will equal the number of elements in
"X". I chose 7 to save space. As Phil pointed out in this case APL2
allows you to treat one of something as if it were scalar. Dyalog is not
so generous (or careless, depending on your point of view) so to use a
similar idiom in Dyalog to the one you used in APL2 you must start with
a scalar. There are so many ways to get the answer you want that how you
go about it is a matter of choice and style. Once you know what is going
on it will be up to you how you go about it.
--
Ellis Morgan