⎕R oddity - [resolved]

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 !

⎕R oddity - [resolved]

Postby Tomas Gustafsson on Sun Jan 11, 2015 7:45 pm

      ('-' 'ef'⎕R'¯' 'x')'-ab cd ef'
¯xab cd ¯x <- I expected ¯ab cd x
('-' 'ef'⎕R'¯' 'xx')'-ab cd ef'
¯ab cd xx
('-' 'ef'⎕R'¯' 'xxx')'-ab cd ef'
¯ab cd xxx

      ('-' 'cd'⎕R'¯' 'x')'-ab cd ef'
¯xab ¯x ef <- I expected ¯ab x ef
('-' 'cd'⎕R'¯' 'xx')'-ab cd ef'
¯ab xx ef
('-' 'cd'⎕R'¯' 'xxx')'-ab cd ef'
¯ab xxx ef

Doesn't seem fully right, imho? x's and -'s appear at unexpected locations in the single-character cases. Anyone who could explain the behaviour for me?

      #.DISP #.APLVersion
┌───────┬────────────┬─┬───────────┐
│Windows│14.0.23160.0│W│Development│
└───────┴────────────┴─┴───────────┘
Last edited by Tomas Gustafsson on Mon Jan 12, 2015 3:23 pm, edited 1 time in total.
Tomas Gustafsson
 
Posts: 101
Joined: Mon Sep 19, 2011 6:43 pm

Re: ⎕R oddity

Postby Phil Last on Sun Jan 11, 2015 8:53 pm

First off
      '¯' 'x' ≡ '¯x'

I guess if ⍺⍺ is a nested list and ⍵⍵ is a simple string then the string applies to all members of ⍺⍺. Normally you'd expect item conformability so that you'd need to enclose ⍵⍵ if you wanted it to apply to each ⍺⍺. But of course they aren't function arguments, they're operands. Nor is ⎕R scalar.

You could ensure what you expect by
      ('-' 'ef'⎕R(,¨'¯' 'x'))...
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: ⎕R oddity

Postby Tomas Gustafsson on Sun Jan 11, 2015 10:00 pm

Ah, good point Phil. I tried

      ⎕R ,¨ ... )

but not

      ⎕R (,¨ ...) )

Thx!
Tomas Gustafsson
 
Posts: 101
Joined: Mon Sep 19, 2011 6:43 pm


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest