Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Henry Rich
If anyone think NuVoc buries a key issue, they are encouraged to add to the information to NuVoc. I don't mean Raul.  Raul knows this better than anyone and has put a lot of time into all aspects of J.  Others should accept that the old documentation isn't going to change and if NuVoc is defic

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Ak O
On Sat., Feb. 4, 2023, 01:56 bill lam, wrote: > IMO reading documentation seriously by yourself is essential for learning > J. Without doing that others can't help you much. > I will say again, please point me to the document and the exact entry that you are referring to. Tell me what constitut

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread bill lam
IMO reading documentation seriously by yourself is essential for learning J. Without doing that others can't help you much. Please also learn how to use jwiki to search for information you need, eg using the search button. On Sat, 4 Feb 2023 at 3:33 PM Ak O wrote: > On Fri., Feb. 3, 2023, 04:18

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Ak O
Thank you. On Sat., Feb. 4, 2023, 00:39 Raul Miller, wrote: > I guess you might want > https://code.jsoftware.com/wiki/Vocabulary/Foreigns#m3 which has a > link to the page sort of buried part way down > https://code.jsoftware.com/wiki/Vocabulary/bangco > > Personally, I still prefer the old doc

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Ak O
On Fri., Feb. 3, 2023, 07:18 Don Guinn, wrote: > It's nice to not have to read and write the file using mapped files. J or > the system does it for you. The data can be shared by multiple instances of > J or whatever. And data is preserved over restarts. But things get messy if > the array gets b

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Ak O
On Fri., Feb. 3, 2023, 05:55 Raul Miller, wrote: > Minor nitpick: > > 3!:1 (and 3!:3) represent the a noun textually > > 3!:2 reconstitutes the original noun. > > Anyways, personally, I'd prefer to say that 3!:1 gives a > representation of the noun. (Or 3!:3, but 3!:1 is more convenient, and

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-04 Thread Raul Miller
There's also memory limits imposed from outside of J. For example, there's the `ulimit` unix command, and there can be hard coded OS limitations (for example on a 32 bit machine, the OS might limit you to 2GB or 3 GB of memory). And, of course, there's the amount of memory which you actually have

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread 'robert therriault' via Programming
The only memory settings that I am aware of are the 9!:20 and 9!:21 foreigns https://www.jsoftware.com/help/dictionary/dx009.htm Cheers, bob > On Feb 3, 2023, at 23:47, Ak O wrote: > > On Fri., Feb. 3, 2023, 05:17 Jan-Pieter Jacobs, > wrote: > >> 3!:2 just gives a representation of the noun.

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Ak O
On Fri., Feb. 3, 2023, 05:17 Jan-Pieter Jacobs, wrote: > 3!:2 just gives a representation of the noun. JMF memory-maps a file via > the OS, so you can access the file's content as if it were just normal > memory. It will stay only on disk as long as only in-place methods are used > to change it (

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Raul Miller
I guess you might want https://code.jsoftware.com/wiki/Vocabulary/Foreigns#m3 which has a link to the page sort of buried part way down https://code.jsoftware.com/wiki/Vocabulary/bangco Personally, I still prefer the old documentation, like https://www.jsoftware.com/help/dictionary/dx003.htm becau

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Ak O
On Fri., Feb. 3, 2023, 04:18 bill lam, wrote: > Please see nuvoc foreign conjunction for detail if you don't know anything > about 3!:1/3!:2. > Which link takes me to the explanatory documentation that you are referencing? > https://www.jsoftware.com/help/dictionary/d412.htm https://code.jsoftwa

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Devon McCormick
If all you want to do is store J arrays to file, I've been doing this for many years using my own WS code: https://code.jsoftware.com/wiki/Scripts/WS_Files. On Fri, Feb 3, 2023 at 9:18 AM Don Guinn wrote: > It's nice to not have to read and write the file using mapped files. J or > the system do

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Don Guinn
It's nice to not have to read and write the file using mapped files. J or the system does it for you. The data can be shared by multiple instances of J or whatever. And data is preserved over restarts. But things get messy if the array gets bigger than the size of the mapped file. But jmf does not

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Raul Miller
Minor nitpick: 3!:1 (and 3!:3) represent the a noun textually 3!:2 reconstitutes the original noun. Anyways, personally, I'd prefer to say that 3!:1 gives a representation of the noun. (Or 3!:3, but 3!:1 is more convenient, and efficient, when writing to a file.) This is a really minor issu

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Jan-Pieter Jacobs
3!:2 just gives a representation of the noun. JMF memory-maps a file via the OS, so you can access the file's content as if it were just normal memory. It will stay only on disk as long as only in-place methods are used to change it (doing something like othervar=: +: mapped var will copy it entire

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread bill lam
Please see nuvoc foreign conjunction for detail if you don't know anything about 3!:1/3!:2. No, Jmf and 3!:1/3!:2 are totally different. On Fri, 3 Feb 2023 at 6:04 PM Ak O wrote: > I guess one of my questions directed at how the function works under the > hood. > > Is it that 3!:2 is the mechan

[Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Ak O
I guess one of my questions directed at how the function works under the hood. Is it that 3!:2 is the mechanism jmf uses to treat the map? How do these forms differ? Ak On Thu., Feb. 2, 2023, 22:31 Raul Miller, wrote: > You can measure overhead with timespacex > > Maybe you had already been do

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread Raul Miller
You can measure overhead with timespacex Maybe you had already been doing that? -- Raul On Thu, Feb 2, 2023 at 11:29 PM Ak O wrote: > > Is this less overhead than the jmf form? > > In your example, every case where I want to operate on a file or an object > within the file requires translation

[Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread Ak O
Is this less overhead than the jmf form? In your example, every case where I want to operate on a file or an object within the file requires translation through the 3!:2 operator. Maybe it is functionally the same as the map_jmf_ function, or am I thinking about this incorrectly? Or can you pleas

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread Don Guinn
'testfile.txt' fwrite~3!:1 'Hello World!';(i.3 4);<2 1$'Text Here';1 2 3 4 456 3!:2 fread 'testfile.txt' ┌┬─┬───┐ │Hello World!│0 1 2 3│┌─┐│ │ │4 5 6 7││Text Here││ │ │8 9 10 11│├─┤│ │ │ ││1 2 3 4 ││ │ │ │└─┘│ └┴─┴

[Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread Ak O
In this case the data is an array of boxes. The datatype is 'boxe'd. The data is of some shape. These things have to be preserved in order to correctly restore them later. (at some cost, up-front to specify them, afterwards to recall the specifics, or something else) It might be easy to write as

Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread bill lam
Using Jmf is overkill. Also what are the advantages of jmf over 3!:1/3!:2 in this case? On Thu, 2 Feb 2023 at 7:17 PM Ak O wrote: > load 'jmf' > NB. Loads jmf facilities. > > testfile =: {2,\?50#75 > > fn =: jpath 'C:\Users\skip\J904-user\temp\foo\testfile_name.jmf' > NB. Links a

[Jprogramming] File Operations -> JMF Alternative

2023-02-02 Thread Ak O
load 'jmf' NB. Loads jmf facilities. testfile =: {2,\?50#75 fn =: jpath 'C:\Users\skip\J904-user\temp\foo\testfile_name.jmf' NB. Links a covername to the file path. createjmf_jmf_ fn;(([:(*&8)#);testfile) NB. Create the container for your file. NB. -fn is your reference name N

Re: [Jprogramming] File Operations

2023-02-02 Thread Jan-Pieter Jacobs
I think this could be of interest as well: https://code.jsoftware.com/wiki/Guides/Component_Files Component files allow to store multiple, different nouns to be saved as well. It's an addon named data/jfiles, you can load, once installed, using: load'jfiles' Best regards, Jan-Pieter On Thu, 2

Re: [Jprogramming] File Operations

2023-02-01 Thread bill lam
fn =. < 'C:\Users\skip\J904-user\temp' this is a folder name you should give a file name, use something like fn =. < 'C:\Users\skip\J904-user\temp\foo' or just fn =. <'~temp/foo' NB. this work for fwrite but not 1!:2 On Thu, Feb 2, 2023 at 1:16 PM 'Skip Cave' via Programming < programm...@jsoft

Re: [Jprogramming] File Operations

2023-02-01 Thread 'Skip Cave' via Programming
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

Re: [Jprogramming] File Operations

2023-02-01 Thread bill lam
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 Ca

Re: [Jprogramming] File Operations

2023-02-01 Thread Elijah Stone
Methinks you want 5!:5, to generate a linear representation to write out, and then "., to parse that representation back into a noun after you've read it back. Actually doing the reading and writing can be done however you prefer; I would just use fread/fwrite. On Wed, 1 Feb 2023, 'Skip Cave'

Re: [Jprogramming] File Operations

2023-02-01 Thread Brian Schott
I think you want to start with 5!:5 <'testfile' which is text. -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] File Operations

2023-02-01 Thread 'Skip Cave' via Programming
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