Many thanks, all clear now. The comma did the trick.

] rawdata =: fread'/home/dg/dev/za2.txt'
1,2,3,b,4
1,2,3,c,4

 ] data=: >',' cut each cutLF rawdata

┌─┬─┬─┬─┬─┐
│1│2│3│b│4│
├─┼─┼─┼─┼─┤
│1│2│3│c│4│
└─┴─┴─┴─┴─┘
   (<*,*'c') = data
0 0 0 1 0
0 0 0 0 0
   (<,'c') = data
0 0 0 0 0
0 0 0 1 0

On Wed, Aug 30, 2023 at 9:21 PM 'Pascal Jasmin' via General <
gene...@jsoftware.com> wrote:

>   ,$ &> ;: 'a b c'  NB. words, or csv create boxed lists
> 1 1 1
>
> $ 'Q' NB. atom
> <empty>
>
> $ ,'Q' NB. list
> 1
>     On Wednesday, August 30, 2023 at 02:59:28 p.m. EDT, Raul Miller <
> rauldmil...@gmail.com> wrote:
>
>    'Q'-:,'Q'
> 0
>
> --
> Raul
>
> On Wed, Aug 30, 2023 at 2:19 PM Dimitri Georganas <d...@biodys.com> wrote:
> >
> > Hi all,
> >
> > Small problem or newbie trap? After loading a table using 'tables/csv'
> (or
> > tables/dsv' - doesn't matter), I noticed that single characters are not
> > being matched using the below approach. (J version 9.4) on Ubuntu Linux
> > 22.04.
> >
> > Is there some hidden character that causes the match to fail? Is it a
> > character set issue? What am I missing?
> >
> > Best regards,
> > Dimitri Georganas
> > Biodys BV
> > The Netherlands
> >
> >
> >
> >    data=: readcsv'/home/dg/dev/za2.txt'
> >    data
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│c│4│
> > └─┴─┴─┴─┴─┘
> >    control =: ('1';'2';'3';'b';'4')
> >    control =: control,:control
> >    control
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│b│4│
> > └─┴─┴─┴─┴─┘
> >  ] control =: (<'c') (<1 3) } control
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│c│4│
> > └─┴─┴─┴─┴─┘
> >
> >    $data
> > 2 5
> >    $control
> > 2 5
> >    (<'c') = control
> > 0 0 0 0 0
> > 0 0 0 1 0
> >    (<'c') = data
> > 0 0 0 0 0
> > 0 0 0 0 0
> >
> >    data =: (<'p') (< 1 3) } data
> >    data
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│p│4│
> > └─┴─┴─┴─┴─┘
> >    (<'p') = data
> > 0 0 0 0 0
> > 0 0 0 1 0
> >    (<'b') = data
> > 0 0 0 0 0
> > 0 0 0 0 0
> >
> >
> > NB. Section bypassing 'tables/csv'
> >
> >  rawdata =: fread'/home/dg/dev/za2.txt'
> >    rawdata
> > 1,2,3,b,4
> > 1,2,3,c,4
> >
> >    'b' = rawdata
> > 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
> >
> >    cutLF rawdata
> > ┌─────────┬─────────┐
> > │1,2,3,b,4│1,2,3,c,4│
> > └─────────┴─────────┘
> >    ',' cut each cutLF rawdata
> > ┌───────────┬───────────┐
> > │┌─┬─┬─┬─┬─┐│┌─┬─┬─┬─┬─┐│
> > ││1│2│3│b│4│││1│2│3│c│4││
> > │└─┴─┴─┴─┴─┘│└─┴─┴─┴─┴─┘│
> > └───────────┴───────────┘
> >
> >    >',' cut each cutLF rawdata    NB. there's probably a more elegant
> way :)
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│c│4│
> > └─┴─┴─┴─┴─┘
> >    (<'c') = >',' cut each cutLF rawdata
> > 0 0 0 0 0
> > 0 0 0 0 0
> >    (<'Q') (< 1 3) } >',' cut each cutLF rawdata
> > ┌─┬─┬─┬─┬─┐
> > │1│2│3│b│4│
> > ├─┼─┼─┼─┼─┤
> > │1│2│3│Q│4│
> > └─┴─┴─┴─┴─┘
> >    (<'Q') = (<'Q') (< 1 3) } >',' cut each cutLF rawdata
> > 0 0 0 0 0
> > 0 0 0 *1* 0
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> |  | Virus-free.www.avast.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