"Direct" idioms
5 posts
• Page 1 of 1
"Direct" idioms
In 12.0 the following dfns were all recognised by the interpreter as "idioms":
{(+/∧\' '=⍵)↓⍵}
{(+/∨\' '≠⌽⍵)↑¨↓⍵}
{(↓⍺)⍳↓⍵}
{(∨\' '≠⍵)/⍵}
{0}
{}
{⍵}
{⍺ ⍵}
{⍺}
I've done no performance testing but in 12.1 there are three differences in their treatment.
In 12.0.5:
⍝ Recognised in syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as "primitive"
3.3
⎕cr'id' ⍝ no name
{⍵}
In 12.1.1.3908:
⍝ Not recognised by syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as dfn
3.2
⎕cr'id' ⍝ name included
id←{⍵}
Can all this mean they are no longer "idioms".
PS. there doesn't seem to be a way to keep my six leading spaces in any of the above without burying the output in overegged presentation.
{(+/∧\' '=⍵)↓⍵}
{(+/∨\' '≠⌽⍵)↑¨↓⍵}
{(↓⍺)⍳↓⍵}
{(∨\' '≠⍵)/⍵}
{0}
{}
{⍵}
{⍺ ⍵}
{⍺}
I've done no performance testing but in 12.1 there are three differences in their treatment.
In 12.0.5:
⍝ Recognised in syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as "primitive"
3.3
⎕cr'id' ⍝ no name
{⍵}
In 12.1.1.3908:
⍝ Not recognised by syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as dfn
3.2
⎕cr'id' ⍝ name included
id←{⍵}
Can all this mean they are no longer "idioms".
PS. there doesn't seem to be a way to keep my six leading spaces in any of the above without burying the output in overegged presentation.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: "Direct" idioms
Phil, we'll investigate the issues with idioms and get back to you. Regarding formatting, I think the following looks OK, using 3 "code" blocks?
----- Reformattet Copy of Phil's Posting follows -----
In 12.0 the following dfns were all recognised by the interpreter as "idioms":
I've done no performance testing but in 12.1 there are three differences in their treatment.
In 12.0.5:
In 12.1.1.3908:
Can all this mean they are no longer "idioms"?
----- Reformattet Copy of Phil's Posting follows -----
In 12.0 the following dfns were all recognised by the interpreter as "idioms":
- Code: Select all
{(+/∧\' '=⍵)↓⍵}
{(+/∨\' '≠⌽⍵)↑¨↓⍵}
{(↓⍺)⍳↓⍵}
{(∨\' '≠⍵)/⍵}
{0}
{}
{⍵}
{⍺ ⍵}
{⍺}
I've done no performance testing but in 12.1 there are three differences in their treatment.
In 12.0.5:
- Code: Select all
⍝ Recognised in syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as "primitive"
3.3
⎕cr'id' ⍝ no name
{⍵}
In 12.1.1.3908:
- Code: Select all
⍝ Not recognised by syntax colouring.
id←{⍵}
⎕nc⊂'id' ⍝ treated as dfn
3.2
⎕cr'id' ⍝ name included
id←{⍵}
Can all this mean they are no longer "idioms"?
-
Morten|Dyalog - Posts: 460
- Joined: Tue Sep 09, 2008 3:52 pm
Re: "Direct" idioms
Yes, that's more or less what I got 'though I cut down the number of separate sections of interspersed text after removing the [ code ] tags so it doesn't look as bad as it did.
Do you have to keep the unnecessary and distracting | CODE: SELECT ALL | headers? You can't use them to select the code without a mouse and with one you can position the pointer and drag it or use shift+cursor-down.
Do you have to keep the unnecessary and distracting | CODE: SELECT ALL | headers? You can't use them to select the code without a mouse and with one you can position the pointer and drag it or use shift+cursor-down.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: "Direct" idioms
> In 12.0 the following dfns were all recognised by the interpreter as "idioms":
This change in V12.1 was in response to issue 2583: "Dfns that are idioms don't include their name in their ⎕CR and ⎕CR is not a matrix".
It's OK, the code is still recognised as an idiom and only the ⎕CR has changed. For example:
I'll check the syntax-colouring issue ...
This change in V12.1 was in response to issue 2583: "Dfns that are idioms don't include their name in their ⎕CR and ⎕CR is not a matrix".
It's OK, the code is still recognised as an idiom and only the ⎕CR has changed. For example:
- Code: Select all
Dyalog APL/W Version 12.1.1
Serial No : 000000
Unicode Edition
DEBUG Build
Tue Dec 01 08:21:50 2009
clear ws
zero←{0} ⍝ idiom
life←{42} ⍝ non-idiom
)copy dfns cmpx
u:\ws\dfns saved Mon Nov 30 18:25:33 2009
cmpx'life 88' 'zero 88' ⍝ idiom is faster see [url]www.dyalog.com/dfnsdws/n_cmpx.htm[/url]
life 88 → 1.2E¯6 | 0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* zero 88 → 2.5E¯7 | -79% ⎕⎕⎕⎕⎕⎕⎕⎕
⎕cr¨'zero' 'life' ⍝ both ⎕CRs include the function name.
zero←{0} life←{42}
I'll check the syntax-colouring issue ...
- JohnS|Dyalog
Re: "Direct" idioms
Phil Last wrote:Do you have to keep the unnecessary and distracting | CODE: SELECT ALL | headers? You can't use them to select the code without a mouse and with one you can position the pointer and drag it or use shift+cursor-down.
I agree that these are a bit intrusive and not particularly useful. We're collecting a list of things we'd like to change and will have a crack at making the necessary mods in "a while".
-
Morten|Dyalog - Posts: 460
- Joined: Tue Sep 09, 2008 3:52 pm
5 posts
• Page 1 of 1
Return to Functional Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group