"Direct" idioms

For users of dfns, both novice and expert

"Direct" idioms

Postby Phil Last on Mon Nov 30, 2009 9:22 am

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.
User avatar
Phil Last
 
Posts: 557
Joined: Thu Jun 18, 2009 6:29 pm

Re: "Direct" idioms

Postby Morten|Dyalog on Mon Nov 30, 2009 10:51 pm

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":

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"?
User avatar
Morten|Dyalog
 
Posts: 394
Joined: Tue Sep 09, 2008 3:52 pm

Re: "Direct" idioms

Postby Phil Last on Tue Dec 01, 2009 7:56 am

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.
User avatar
Phil Last
 
Posts: 557
Joined: Thu Jun 18, 2009 6:29 pm

Re: "Direct" idioms

Postby JohnS|Dyalog on Tue Dec 01, 2009 8:28 am

> 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:

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

Postby Morten|Dyalog on Tue Dec 01, 2009 9:51 am

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".
User avatar
Morten|Dyalog
 
Posts: 394
Joined: Tue Sep 09, 2008 3:52 pm


Return to Functional Programming

Who is online

Users browsing this forum: No registered users and 1 guest