I am trying to understand what you mean here.

Your 'read' verb does not read from memory. Instead, it writes a zero
to an offset in some freshly allocated memory and returns the address
of that allocation.

Similarly, your 'write' verb does not write to memory. Instead, it
reads characters from the previously allocated memory, up to the point
where it finds a zero (and fortunately, you had ensured that there
would be one when you invoked 'read').

Anyways, basically it looks like you've built a small system to read
some arbitrary bytes from memory and then are using them in some
larger algorithm.

But I am not sure why you would expect an operation which reads
arbitrary memory to be deterministic.

Have I overlooked something important?

Thanks,

-- 
Raul

On Fri, Feb 25, 2022 at 3:01 PM John Ference <[email protected]> wrote:
>
> Hello,
> Is this construction consistent with the design specs of the memory
> management functions?
>
> s =. 'Hello world'
>
> read =. {{p [ y memw p,0,(>: # y),2 [ p =. mema >: # y}}
>
> write =. {{res [ memf y [ res =. memr y,0,_1,2}}
>
>
> NB. test:
>
> <./ (,. write@read&.> <\ s) = (,. <\ s)
>
> Results are non-deterministic, but the results at the test at the end
> typically return 0.
>
> Visual inspection of the result suggests the capability to auto-append and
> then auto-find an end-of-string indicator may not be working.
>
> specs: https://code.jsoftware.com/wiki/Guides/DLLs/Memory_Management
>
> Regards,
> John
> ----------------------------------------------------------------------
> 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