I tried Bill's suggestion:

fn =. < 'C:\Users\skip\J904-user\temp'

fn (fwrite~ 3!:1) {2,\?15#50

_1


(3!:2)@fread fn

|domain error

| (3!:2)@fread fn


Looks like some kind of write error. Where in the doc are these errors
defined?

Skip Cave
Cave Consulting LLC


On Wed, Feb 1, 2023 at 11:07 PM bill lam <bbill....@gmail.com> wrote:

> 1!:1 and 1!:2 can only operate on simple strings (rank 1 literal array)
> You can use 3!:1 and 3!:2 to convert between J array and simple string,eg
>
>  fn (fwrite~ 3!:1) {2,\?15#50
>
> (3!:2)@fread fn
>
> this way you need not assign the value of {2,\?15#50 to a name
>
> On Thu, Feb 2, 2023 at 12:48 PM 'Skip Cave' via Programming <
> programm...@jsoftware.com> wrote:
>
> > I have a boxed noun:
> >
> > ] testfile =: {2,\?15#50
> >
> >
> >
> ┌────┬─────┬─────┬─────┬─────┬─────┬────┬────┬────┬────┬─────┬────┬───┬────┐
> >
> > │9 21│21 47│47 37│37 13│13 33│33 20│20 4│4 49│49 6│6 25│25 33│33 9│9 6│6
> > 43│
> >
> >
> >
> └────┴─────┴─────┴─────┴─────┴─────┴────┴────┴────┴────┴─────┴────┴───┴────┘
> >
> >
> > I want to store it in the following location on my machine:
> >
> >
> > ]fn =. < 'C:\Users\skip\J904-user\temp'
> >
> > ┌────────────────────────────┐
> >
> > │C:\Users\skip\J904-user\temp│
> >
> > └────────────────────────────┘
> >
> > Then I will close that J session.
> >
> >
> > Later, I will start a new J session, and I want to read that saved file
> > into a noun called 'test1'
> >
> >
> > What is the J code for writing the noun into a file in the first session?
> >
> > What is the J code to read the file into a noun in the second session?
> >
> > Should I use 1!2 & 1!:1, or fwrite & fread, or something else?
> >
> >
> > Where in the J doc are these file operations and their tradeoffs
> described?
> >
> >
> > Skip
> >
> >
> > Skip Cave
> > Cave Consulting LLC
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> 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