Wish-list: execute changes

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
Post Reply
Peter Merritt
Posts: 3
Joined: Sun Feb 28, 2010 12:21 pm

Wish-list: execute changes

Post by Peter Merritt »

As Christmas is approaching, I thought I'd send Santa's IT support a couple of requests...

1. A new ⎕SET (or something) to replace currently awful WS constructs so assigning a known value to an unknown name goes from:
value←911 'Yes' 'No'
⍎varname,'←value'


to

varname ⎕SET value

2. A more controlled 'execute' - perhaps the old IBM ⎕EA?

(For those born in the last quarter of the 20thC, IBMs' fn took a chr vec as both left and right args. The fn would execute the right arg first until an internal trap which, if it failed, then triggered the left arg instead.)
User avatar
Dick Bowman
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm
Contact:

Re: Wish-list: execute changes

Post by Dick Bowman »

As for your first suggestion, two thoughts come to mind...

0⊃ Have you tried writing a defined function equivalent to your ⎕SET? It would seem relatively easy, assuming you bury it in a utility namespace the only snag I can see is whether the variable name is "relative" (assign in the calling namespace) or "absolute" (you've given the fully qualified name). Distinguishing these cases looks like it might be a task for ⍠ - if its domain would extend beyond ⎕R and ⎕S.

1⊃ Maybe there's a perverse advantage to readability in what we have now, in so far as firstly (or zerothly) we can read it as an idiom (even though the interpreter might not), and secondly (or onethly) having the '←' in the line makes it clear to the reader that the line is changing a value. I value APL's explicit cause-and-effect quite highly - never like losing it.
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
Phil Last
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Wish-list: execute changes

Post by Phil Last »

Mostly agree with Dick. The location, both of the utility function and the destination for the array, can be a snag. The want of a recognisable "idiom" means I currently favour:
      names{⍎'(',⍺,')←⍵'}values        ⍝ for in-situ naming
names space.{⍎'(',⍺,')←⍵'}values ⍝ for a known namespace

The second is usually the necessary choice. The parentheses allow ⍺ to be a list.
Putting it in a utility not only hides the assignment but forces the decision as to the syntax:
      space names is values
names is space values
&c.

where "is" is the utility name that could be any name but unfortunately not "←".
Personally I'd hate to have yet another ⎕fn but could live with or might even welcome some new syntax such as:
      names←:values

that of course wouldn't have to be yet another use of the already heavily used colon but unicode offers a few million other choices. Didn't Adrian suggest a stile overstruck with left-arrow for something like this?
Ken came up with:
      (names)←values
where names is a simple character name or a boxed array of them but APL2 and subsequently Dyalog have precluded this usage with the parentheses around strand assignment used above.
User avatar
kai
Posts: 141
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Wish-list: execute changes

Post by kai »

Peter:

Regarding your first wish I would like to know first why you think you need this. It's not obvious to me.

Regarding the second wish: what exactly is wrong with

EA←{0::⍎⍺ ⋄ ⍎⍵}

?
Post Reply