An "easy" fix for this would be to treat an input other than a char code as 
input value of 0 (other char) for ;: purposes.

"magic" state machine chars would just be limited to the first 256, but 
"baggage" could be any.

converting to utf8 works though,


cutr ": 'a b  1',(u:246),'cd f'
┌─┬─┬────┬─┐
│a│b│1öcd│f│
└─┴─┴────┴─┘




________________________________
From: bill lam <[email protected]>
To: 'Pascal Jasmin' via Programming <[email protected]> 
Sent: Friday, April 7, 2017 12:47 PM
Subject: Re: [Jprogramming] 4x+ speed 2x space improvement to cut


the cut in stdlib can handle unicode but cutr cannot.

   cutr 'a b  1',(u:246),'cd f'
|domain error: cutr
|       (0;(2 2 2$1 1 0 0 1 0 0 3);(a.e.x))&;:y
   cut 'a b  1',(u:246),'cd f'
+-+-+----+-+
|a|b|1öcd|f|
+-+-+----+-+

Apparently ;: itself assume there are only 256 character 
symbols and cannot handle unicode (literal2, literal4).


Пт, 07 апр 2017, jprogramming написал(а):
> 
> 
> cutr =: ' '&$: : (4 : '(0;(2 2 2$1 1 0 0 1 0 0 3);(a. e. x))&;: y') 
> :.joinstring
> 
> seems to work identically to built-in cut.  The speed metrics are on a 100Kb~ 
> string on amd j806.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3

----------------------------------------------------------------------
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