Thanks, that's nicer.

But even that is not quite correct. 

'z' lessThan 'z'
1

perhaps 
lt=: (({.@:sort -: {.) *. ({.~:{:))@,&<&,

     On Saturday, March 14, 2020, 12:59:15 AM GMT+9, Raul Miller 
<rauldmil...@gmail.com> wrote:  
 
 Maybe
  lessThan=: ({.@:sort -: {.)@,&<&,

Thanks,

-- 
Raul

On Fri, Mar 13, 2020 at 11:41 AM 'Jon Hough' via Programming
<programm...@jsoftware.com> wrote:
>
>  Thanks,
>
> you are, of course, correct, and I should have thought about it a bit more. I 
> am trying to make string comparison verbs
> and this will make the solution a little more ugly.
>
>  lessThan=: ({.@:sort -: {.)@:;
>  'abc' lessThan 'def'
> 1
>
>
>  'z' lessThan 'ab'
> 1
>  Needs a little more work for literals with no rank.
>  ]`(1&$)@.((''&-:)@:$) 'z'
>
> As far as I can see there is no string comparison in the J stdlib.
>
> Thanks,
> Jon
>
>      On Friday, March 13, 2020, 03:12:48 PM GMT+9, Thomas McGuire 
><tmcguir...@gmail.com> wrote:
>
>  The first 2 of the list have no rank.
>
> $ each words
>
>  $ each words
> ┌┬┬─┬─┬─┬─┐
> │││3│3│4│4│
> └┴┴─┴─┴─┴─┘
> words =: (1$'a');(1$'z');'zza';'abc';'zabc';’abbb'
>
> $ each words
> ┌─┬─┬─┬─┬─┬─┐
> │1│1│3│3│4│4│
> └─┴─┴─┴─┴─┴─┘
>  sort words
> ┌─┬────┬───┬─┬────┬───┐
> │a│abbb│abc│z│zabc│zza│
> └─┴────┴───┴─┴────┴───┘
> Above if I give everything a 1 dimensional rank it works as you would expect.
>
> Single letter in quotes is not a string
>
> It happens with single numbers as well:
>  b =:1
> $b
>
>
> No output back
>
> Tom McGuire
>
> > On Mar 13, 2020, at 1:19 AM, 'Jon Hough' via Programming 
> > <programm...@jsoftware.com> wrote:
> >
> > words =: 'a';'z';'zza';'abc';'zabc';'abbb'
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
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