f=: 13 :'(":5 1$>0{"1 y),.(5 3$'' ''),. >1{"1 y'
f
([: ": 5 1 $ [: > 0 {"1 ]) ,. (5 3$' ') ,. [: > 1 {"1 ]
f ts2
355 freeways
356 traffic
357 ninety one west
358 yes
361 sixty
This may help you understand how you can manipulate numeric and literal data.
Study the verbs in the definition f from the right to the left and see how
they work.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Björn Helgason
Sent: Sunday, November 27, 2011 12:44 PM
To: Programming forum
Subject: Re: [Jprogramming] Unboxing a matrix
The mapped database lab works in J6
It is absolutely brilliant and seem to be what you want
2011/11/27 Skip Cave <[email protected]>
> Björn,
>
> The mapped database sounds interesting. I'm using J6.2.
>
> I think I would first like to get a mapped array of all my log files.
> I can get an array of all the logs, with each one boxed, in this way
>
> zipth =: '"c:\Gzip\gzip.exe -d -c "'
> NB. This is the path to the zip/unzip utility.
>
> mainpth =: 'c:\testasr\log.gz'
> NB. This is the path to the log files.
>
> ]/; ww =: ([: shell zipth&,) each {."1 dirtree mainpth
> NB. This gets all the log files, and puts them in a boxed array ww
>
> The boxed array is really big, as it takes several minutes to run the shell
> command.
>
> $ww
> 9248
>
> So there are 9248 boxes in ww, each holding the text of one log file.
>
> $ ; ww
> |out of memory NB. ww is big
> | $ ;ww
>
> $ > 0 } ww
> 3605
> $ > 1 } ww
> 2216
> $ > 2 } ww
> 3605
> $ > 3 } ww
> 2176
>
> I would like to make ww a mapped array.
>
> JCHAR map_jmf_ (;ww); 'c:\testasr\ww.txt'
> |out of memory
> | JCHAR map_jmf_( ;ww);'c:\testasr\ww.txt'
>
> No luck. I probably need to map ww in the first place. How would I do that?
>
> Skip
>
>
> 2011/11/27 Björn Helgason <[email protected]>
>
> > You may want to look at the mapped file database lab.
> >
> > It has a very advanced database demo doing similar things.
> >
> > If you use the J7 lab you need to put in this fix
> >
> > NB. open '~system\extras\labs\system\mappeddb.ijs'
> > NB. load '~system\extras\labs\system\mappeddb.ijs'
> > open '~addons\labs\labs\system\mappeddb.ijs'
> > load '~addons\labs\labs\system\mappeddb.ijs'
> >
> > You can do it when arriving at that step and then go on
> >
> > The verb jcreate is also missing in J7 but for now you can just step past
> > it
> >
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
twitter: @flugfiskur
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm