Intuition, aesthetics and performance

General APL language issues

Re: Intuition, aesthetics and performance

Postby JohnS|Dyalog on Tue Feb 23, 2010 9:21 am

Regarding a {⍺,⍺⍺,⍵}/ idiom:

I like the idea because it would turn an intuitive way to write this interleaving from an n-squared into a linear algorithm. I have logged an RFE (ref 5750) to this effect.

However, {⍺,⍺⍺,⍵}/ is an incomplete expression (a conjunction of two operators) and so could not be named. We might have to consider a more complex idiom:
Code: Select all
      sandwich ← {↑⍺{⍺,⍺⍺,⍵}/⍵}    ⍝ sandwich idiom.

      '-' sandwich 'now' 'is' 'the' 'time'
now-is-the-time

John.
JohnS|Dyalog
 

Re: Intuition, aesthetics and performance

Postby JohnS|Dyalog on Wed Feb 24, 2010 9:36 am

John'S £2E¯2J0's worth regarding ⎕PATH:

I think there are broadly two markets for a name-finding mechanism.

[1] The first is global and is used to locate utility functions from within any namespace. It is handy to be able to type "display" at the front of an expression, or inject "time" between a function and it's argument, irrespective of where I am in the namespace hierarchy.

[2] The second is more like a language "include" statement and is specific to a particular namespace.

⎕PATH implements the first of these; it is modelled on the opsys library path concept, where, happily, DIR, ls and pwd mean the same wherever I happen to be :-)

V12.1's user-command system: ]display, &co have to some extent replaced the need for [1].

We don't have an equivalent mechanism for [2]. Perhaps we should.
JohnS|Dyalog
 

Re: Intuition, aesthetics and performance

Postby MikeHughes on Wed Feb 24, 2010 1:27 pm

I also like that but was confused by

↑'-'{⍺,⍺⍺,'E',⍵,'D'}/'now' 'is' 'the' 'time'
giving
now-Eis-Ethe-EtimeDDD
User avatar
MikeHughes
 
Posts: 86
Joined: Thu Nov 26, 2009 9:03 am
Location: Market Harborough, Leicestershire, UK

Re: Intuition, aesthetics and performance

Postby Phil Last on Wed Feb 24, 2010 1:35 pm

MikeHughes wrote:↑'-'{⍺,⍺⍺,'E',⍵,'D'}/'now' 'is' 'the' 'time'


In any expression:
      ⊃{... ⍵ ...}/list

⍵ is the result so far from all iterations. In the above case first it's 'time' then the result from 'the'{...}'time' and so on.

Catenating your 'D' to the right of ⍵ means they're all going to be tacked on the end.
User avatar
Phil Last
 
Posts: 572
Joined: Thu Jun 18, 2009 6:29 pm

Re: Intuition, aesthetics and performance

Postby MikeHughes on Wed Feb 24, 2010 2:53 pm

Sorry Im a pratt of course you are right - I fell off a lorry last week - still havent recovered fully obviously :-D
User avatar
MikeHughes
 
Posts: 86
Joined: Thu Nov 26, 2009 9:03 am
Location: Market Harborough, Leicestershire, UK

Previous

Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest