Issue with ⍎ that worked fine in APLWIN and APLX
3 posts
• Page 1 of 1
Issue with ⍎ that worked fine in APLWIN and APLX
Hello,
I'm hoping someone has an idea about this. I have a simple piece of code that ran fine in WINAPL and APLX, but doesn't in Dyalog. The code extracts date information, (yyyymmdd, e.g., 20170910), from a character matrix and converts it to numeric, but I get a rank error in Dyalog. The code is: ⍎STATS[(1↑⍴STATS);cDATE]. The 1↑⍴STATS is going to give me the last row of the table, and cDATE is simply the columns 1 2 3 4 5 6 7 8, so I would get the latest date in character format, such as 20170910, and then convert this to a number, but this fails with a rank error.
I did find that the error is because the shape of STATS[(1↑⍴STATS);cDATE] evaluates to 1 8 and Dyalog doesn't like this. However, it also evaluated to 1 8 in APLWIN and APLX, but I did not get this rank error. Is there a setting in Dyalog to get around this error or am I going to have to resolve the error adding the ravel operator like this: ⍎,STATS[(1↑⍴STATS);cDATE] ?
Thanks & Regards,
Lance
I'm hoping someone has an idea about this. I have a simple piece of code that ran fine in WINAPL and APLX, but doesn't in Dyalog. The code extracts date information, (yyyymmdd, e.g., 20170910), from a character matrix and converts it to numeric, but I get a rank error in Dyalog. The code is: ⍎STATS[(1↑⍴STATS);cDATE]. The 1↑⍴STATS is going to give me the last row of the table, and cDATE is simply the columns 1 2 3 4 5 6 7 8, so I would get the latest date in character format, such as 20170910, and then convert this to a number, but this fails with a rank error.
I did find that the error is because the shape of STATS[(1↑⍴STATS);cDATE] evaluates to 1 8 and Dyalog doesn't like this. However, it also evaluated to 1 8 in APLWIN and APLX, but I did not get this rank error. Is there a setting in Dyalog to get around this error or am I going to have to resolve the error adding the ravel operator like this: ⍎,STATS[(1↑⍴STATS);cDATE] ?
Thanks & Regards,
Lance
- lancepawl
- Posts: 10
- Joined: Tue Sep 05, 2017 1:43 pm
Re: Issue with ⍎ that worked fine in APLWIN and APLX
Yes. Or you could change "1↑⍴" to be "⍬⍴" so that you don't get a matrix to begin with.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: Issue with ⍎ that worked fine in APLWIN and APLX
Note that ISO/IEC 13751:2001(E), the ISO standard for extended APL, had this to say about ⍎B (page 135):
In addition to Phil's suggestion, you can also replace (1↑⍴STATS) by ≢STATS.
If the rank of B is greater-than one, signal rank-error.
In addition to Phil's suggestion, you can also replace (1↑⍴STATS) by ≢STATS.
- Roger|Dyalog
- Posts: 238
- Joined: Thu Jul 28, 2011 10:53 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group