I can't answer the question fully.  I have not studied this kind of problem enough.

I mean, J can answer such questions about SOME such structures. The natural numbers, for example, are infinite.  But in general, I don't know.

The F. family was intended to help with such problems.  It is new in J9.01 and has been used little.  Why don't you try to solve your problems using F. and see if it works, or if it needs to be extended?  For now the F. primitives are implemented in an addon and it will be easy to improve them.

Henry Rich


On 1/7/2020 8:24 PM, Raoul Schorer wrote:
Well, I guess that out of context my question boils down to:

'Is it possible to define infinite data structures and operate on them in
J?'

For example, take the first ten elements of an infinite list, as in Haskell.
The 'F.' primitive family seems promising indeed.



Le mer. 8 janv. 2020 à 01:56, Henry Rich <henryhr...@gmail.com> a écrit :

I don't understand the task at all.  You might look in NuVoc for $:, F.
etc., and M.

Henry Rich

On 1/7/2020 7:51 PM, Raoul Schorer wrote:
Hi,

Implementing  Minikanren <http://minikanren.org/> in J by translating
from
Scheme, I stumbled on the following:
I have a Scheme procedure 'fives'
<
https://github.com/jasonhemann/microKanren/blob/master/microKanren-test-programs.scm
that is passed a vector and yields a procedure that then takes a pair.
((fives (vector 0)) '(() . 0))

My problem is that this then evaluates to a pair data -- procedure:
((((#(0) . 5)) . 0) . #<procedure at microKanren-test-programs.scm:677>)

The second member of the pair (the procedure) is then evaluated on demand
to yield another similar structure of length n+1, therefore allowing the
lazy evaluation of this infinite "stream".

Is switching to iterative/eager eval the only realistic way?
Can someone help me with lazy eval of infinite structures in J, or give
me
pointers to resources on the topic?

Thanks!
Raoul Schorer
----------------------------------------------------------------------
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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to