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
<[email protected]> 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