Amazed!
Raul, did you create this now or used it earlier?
Thanks! Shall try it and get back.
BTW, does your practice of programming in J reflect what I stated? Just
curious...
On 10/1/06, Miller, Raul D <[EMAIL PROTECTED]> wrote:
Yuvaraj Athur Raghuvir wrote:
> 6) Missing: Save the session that has unfinished experiments....
>
> Since Step 6 is not recommended, how do you accomplish that part?
Well... you could write something that supports what you need.
For example, with the following script, you could run the line
save_namespace_'base'
before you quit, and later on
read_namespace_'base'
to recover what you had in the 'base' namespace. The result
will be the number of names saved or read.
This creates a directory with one file per name in the namespace.
You can delete files corresponding to names you don't want.
You should probably delete the entire directory if you want it
to be replaced with something different.
Cautions:
I'm using my "broken email client" -- hopefully it won't break the script.
Also, this is meant to be a script. If you instead paste it into a
session
you should probably execute cocurrent'base' after executing these
commands.
Errors are ignored (except, they do not contribute to the name count
for the result).
cocurrent 'namespace'
save=:3 :0
y save y
:
wd=:1!:43''
1!:5 ::]<x
r=.x savenamespace ::(1!:44 bind wd)<y
1!:44 wd
r
)
savenamespace=:4 :0
r=. 0
1!:44 x
for_nm. nl__y'' do.
name=.(>nm),'__y'
try.
(3!:1]5!:1<name) 1!:2 nm
r=.r+1
catch.end.
end.
r
)
read=:3 :0
y read y
:
wd=:1!:43''
r=. x readnamespace ::(1!:44 bind wd)<y
1!:44 wd
r
)
readnamespace=:4 :0
1!:44 x
r=.0
for_nm. {."1]1!:0 '*' do.
try.
name=.(>nm),'__y'
".name,'=: (3!:2]1!:1 nm) 5!:0'
r=.r+1
catch.end.
end.
r
)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm