To expand on what Henry Rich said, here's a simple "fix":

seltest =: 3 : 0
  pp 'keyboard read: end to end'
  while. (r =. 1!:1 (1)) do.
    pp 'r was ->';r;'<-';'#r';(#r);'3!:3 r';(3!:3 r)
    select. r
      case.,'0'   do. pp 'zero'
      case.,' '   do. pp 'space'
      case.,'n'   do. pp 'n'
      case. ''    do. pp ''''''
      case.,'p'   do. pp 'p'
      case.,'-'   do. pp 'dash'
      case.,'_'   do. pp 'underscore'
      case. 'end' do. return.
      case.,'e'   do. return.
      case.       do. pp 'nothing matched'
    end.
  end.
)

NB. nothing changed after this point except "white space"
ppbox =: 1

pp =: 3 : 0
  if. (boxed y) +. -. (ppbox) do.
    (y) (1!:2) 2
  else.
    (<y) (1!:2) 2
  end.
  wd'msgs'
  ''
)

boxed =: 3 : 0
  (3!:0 y) = 32
)

Note also, the current crop of browsers screw up code newlines when
you paste it in. I think this is because of conflicting viewpoints
about the distinctions between lines and paragraphs. To work around
this issue, look for a "paste and match style" option.

Thanks,

-- 
Raul


On Sun, Dec 24, 2017 at 12:29 PM, Henry Rich <[email protected]> wrote:
> 'n' does not match ,'n'
>
> Henry Rich
>
>
> On 12/24/2017 11:01 AM, Nick S wrote:
>>
>> I am using jqt on windows.  Specifically:
>>
>>     9!:12 ''
>>
>> 6
>>
>> 9!:14''
>>
>>
>> j806/j64avx/windows/beta-3/commercial/www.jsoftware.com/2017-04-10T18:03:23
>>
>>
>> I stop and start the jqt program.  Then I select my project but I do not
>> load any of the programs into the workspace.  I highlight and select the
>> seltest code from the browser, and try to run it.  It proves that it has
>> not loaded my project because the 'pp' program has not been loaded.  Then
>> I
>> highlight pp and its small dependents and load them into my workspace.
>>
>> So other than stuff that came with J, (like wd), this is the entire
>> environment.
>>
>> I start the program and none of my single character matches work.  For
>> some
>> reason, it matches 'end' when I type 3 characters.  Now, this is an
>> extract
>> of a much larger program that I was trying to use a select in and it was
>> failing, and I couldn't figure out why.  I then realized that I was not
>> quite sure what was being reflected to the program so I added displays
>> which
>>
>>     seltest =: 3 : 0
>>
>>
>> pp 'keyboard read: end to end'
>>
>> while. (r =. 1!:1 (1)) do.
>>
>> pp 'r was ->';r;'<-';'#r';(#r);'3!:3 r';(3!:3 r)
>>
>> select. r
>>
>> case. '0' do. pp 'zero'
>>
>> case. ' ' do. pp 'space'
>>
>> case. 'n' do. pp 'n'
>>
>> case. '' do. pp ''''''
>>
>> case. 'p' do. pp 'p'
>>
>> case. '-' do. pp 'dash'
>>
>> case. '_' do. pp 'underscore'
>>
>> case. 'end' do. return.
>>
>> case. 'e' do. return.
>>
>> case. do. pp 'nothing matched'
>>
>> end.
>>
>> end.
>>
>> )
>>
>> seltest ''
>>
>> |value error: pp
>>
>> | pp'keyboard read: end to end'
>>
>> ppbox =: 1
>>
>> pp =: 3 : 0
>>
>>
>> if. (boxed y) +. -. (ppbox) do.
>>
>> (y) (1!:2) 2
>>
>> else.
>>
>> (<y) (1!:2) 2
>>
>> end.
>>
>> wd'msgs'
>>
>> ''
>>
>> )
>>
>> boxed =: 3 : 0
>>
>>
>> (3!:0 y) = 32
>>
>> )
>>
>> seltest ''
>>
>> ┌─────────────────────────┐
>>
>> │keyboard read: end to end│
>>
>> └─────────────────────────┘
>>
>> 0
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│0│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │3000000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> ┌────────┬┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->││<-│#r│0│3!:3 r│e300000000000000│
>>
>> │ ││ │ │ │ │0200000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> │ ││ │ │ │ │0100000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> └────────┴┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌──┐
>>
>> │''│
>>
>> └──┘
>>
>>
>> ┌────────┬┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->││<-│#r│0│3!:3 r│e300000000000000│
>>
>> │ ││ │ │ │ │0200000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> │ ││ │ │ │ │0100000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> │ ││ │ │ │ │0000000000000000│
>>
>> └────────┴┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌──┐
>>
>> │''│
>>
>> └──┘
>>
>> n
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│n│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │6e00000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> p
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│p│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │7000000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> -
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│-│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │2d00000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> _
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│_│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │5f00000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> e
>>
>> ┌────────┬─┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│e│<-│#r│1│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │6500000000000000│
>>
>> └────────┴─┴──┴──┴─┴──────┴────────────────┘
>>
>> ┌───────────────┐
>>
>> │nothing matched│
>>
>> └───────────────┘
>>
>> end
>>
>> ┌────────┬───┬──┬──┬─┬──────┬────────────────┐
>>
>> │r was ->│end│<-│#r│3│3!:3 r│e300000000000000│
>>
>> │ │ │ │ │ │ │0200000000000000│
>>
>> │ │ │ │ │ │ │0300000000000000│
>>
>> │ │ │ │ │ │ │0100000000000000│
>>
>> │ │ │ │ │ │ │0300000000000000│
>>
>> │ │ │ │ │ │ │656e640000000000│
>>
>> └────────┴───┴──┴──┴─┴──────┴────────────────┘
>>
>>
>>
>>
>> So end matches but nothing else does.
>> When I hit enter it returns the same thing as when there is number of
>> spaces entered and, finally, when I type '   end'  it matches 'end'  and
>> reports a length of 3.  Since I read that select used e. I tried these
>> sentences:
>>
>>     (1!:1 (1)) e. 'e'
>>
>> e
>>
>> 1
>>
>> (1!:1 (1)) e. 'e'
>>
>> z
>>
>> 0
>>
>>
>> They seem to do what I expect.   Also:
>>
>>     (1!:1 (1)) e.~ 'e'
>>
>> z
>>
>> 0
>>
>> (1!:1 (1)) e.~ 'e'
>>
>> e
>>
>> 1
>>
>> Unless I completely misunderstand, I think I have a bug.  I can probably
>> make the select into an if as a bypass.
>
>
>
> ---
> This email has been checked for viruses by AVG.
> http://www.avg.com
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to