Note that should be

f2v=: 3 : 0
NB.* f2v: File to Vector: read file -> vector of lines.
  vec=. l2v 1!:1 <y.
)

Thanks for using these - some of these problems are because I use general
utilities that I keep in other files but have included them in the
distributed file
for completeness.  However, at one point I must have commented them out
but it doesn't affect my usage because I have the utilities already loaded
so
I don't have the problems you're having here.

The problem for me with leaving them uncommented is that if I change any
of these in my usual file, they'll be overwritten with an outdated version
if I
load, e.g. WS.ijs.

The getTempDir is not multi-platform because I've been lazy about making
it so.  I notice that "break.ijs" appears to attempt a multi-platform
solution for
this in the "setbreak" verb.

Don't hesitate to let me know if you have any other problems with these.

Thanks,

Devon

On 7/9/07, Devon McCormick <[EMAIL PROTECTED]> wrote:

There are some general utilities at the end of WS.ijs that are commented
out
but perhaps should not be - I'll fix the existing wiki reference but for
now, these are as follows:

dsp=: deb"[EMAIL PROTECTED]"1
isNum=: 3 : '0=1{.0$,y.' NB. 1 if numeric arg
nameExists=: 0:"_<:[:4!:0 <^:(L.=0:) NB. 1 if var or fnc name exists, else
0.
dirExists=: 3 : '0~:#(1!:0)@< (-''\''={:y.)}.y.' NB. 0: dir does not

f2v=: 3 : 0
NB.* f2v: File to Vector: read file -> vector of lines.
   vec=. l2v 1!:1 <y.
NB.)

v2f=: 4 : 0
NB.* v2f: Vector to File: write vector of lines to file as lines.
   if. -.nameExists 'EOL' do. EOL=. LF end.
   (;x.,&.><EOL) 1!:2 <y.
NB.EG ('line 1';'line 2';<'line 3') v2f 'C:\test.tmp'
)

l2v=: 3 : 0
NB.* l2v: Lines to Vec: convert lines terminated by LF to vector elements.

   <;._1 LF,y.-.CR
)

baseNum=: 4 : 0
NB.* baseNum: return number y. in base with digits x.: positive
NB. integers only.
   len=. #alph=. x. [ num=. y.
   if. isNum num do.
       digits=. >:<.len^.1>.num
       alph{~(digits$len)#:num
   else. NB. Assume "number" is character -
       len#.alph i. num NB. convert to base 10 number.
   end.
NB.EG '0123456789ABCDEF' baseNum 255
NB.EG '0123456789ABCDEF' baseNum 'FF'
)



On 7/9/07, Ira Fuchs <[EMAIL PROTECTED]> wrote:
>
> Thanks!  That worked fine for logger but I have a new problem using
> WS.ijs:
>
> load '/Users/ihf/Documents/J Books/J Scripts/WS.ijs'
>
> saveAllVars '/Users/ihf/j601/temp/'
> |value error: dsp
> |   nmlst=.<;._1' ',    dsp,(names__ 0),"1' '
>
>
> On Jul 9, 2007, at 8:27 PM, Sherlock, Ric wrote:
>
> > > [mailto:[EMAIL PROTECTED] ] On Behalf Of Ira Fuchs
> > > That would explain it. I was hoping to use these scripts on a
> > > Mac.  I didn't realize they were platform-dependent.
> >
> > I'm pretty sure the only bit that is platform-dependent it the setting
>
> > of the tempdir (in verb todayfile).
> > If you manually set the global variable FNM_logger_ to the name of log
> > file you wish to write to, it will skip that part and then the script
> > should work fine.
> >
> > Alternatively you could replace getTempDir with a Mac version, or
> > even:
> > getTempDir=: 3 : 0
> >   td=. PATHSEP_j_ ,~ jpath '~temp'
> > )
> >
> > Which will write the log file to your J temporary directory on all
> > platforms.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> >
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail




--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to