Perhaps also of note is that J has supports several forms of
serialization (as well as similar operations), though they each have
their limitations.

If you are working with nouns, 5!:5 is probably the best serialization
mechanism (and, when working with nouns, 5!:6 is equivalent):

   X=: i.2 3
   5!:5<'X'
i.2 3
   5!:6<'X'
i.2 3

Remember that you need to parenthesize this kind of result, at least
in some contexts.

That said, note that -- if you're going to be using 5!:5 (or 5!:6) for
things that are not nouns -- its results are designed for use in 0!:
contexts and not all of the results will work in ". contexts.

FYI,

-- 
Raul

On Tue, Feb 4, 2020 at 9:08 AM 'Pascal Jasmin' via Programming
<programm...@jsoftware.com> wrote:
>
>  The way to return a conjunction from a conjunction (which I understand you 
> were struggling with) is to build a string, substituting your initial u and v 
> into the returned conjunction and placing literal u/v into string.
> A conjunction that returns a conjunction that adds all of its parameters
>
>    c =: 2 : 0
>
> s =. 'm + ' , (": m) , ' + ' , (":n) , ' + n'
>
> alt =. 'm + ' , (": m + n) , ' + n'
>
> smoutput s
>
> 2 : alt
>
> )
>
>  3 c 2
>
> m + 3 + 2 + n
>
> 2 : 'm + 5 + n'
>
>
>
>
> (1) 3 c 2 (1)
>
> m + 3 + 2 + n
>
> 7
>
>
>     On Tuesday, February 4, 2020, 01:23:32 a.m. EST, Raoul Schorer 
> <raoul.scho...@gmail.com> wrote:
>
>  Hi,
>
> I've been working hard implementing minikanren in J. It's a minimal logic
> language that at the difference of prolog is purely relational and very
> well suited to a library due to its shallow embedding.
>
> The lib currently can compute on lazy "streams" and does conjunction,
> disjunction and syntactic equivalence constraints on array terms.
>
> I am however totally stuck on how to write the 'append' relation. I know
> this is rather specific and probably of little interest to most, but if you
> are interested help is welcome.
>
> The core implementation is at:
> https://github.com/Rscho314/J_microkanren/blob/master/microkanren.ijs
>
> And my attempts at the append relation:
> https://github.com/Rscho314/J_microkanren/blob/master/test/microkanren_test_programs.ijs
>
> Cheers!
> Raoul
> ----------------------------------------------------------------------
> 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