Skip to content

Union of elements from separate sets #69

@CICS-Oleg

Description

@CICS-Oleg

Suppose we have a knowledge base:

(a title1 tutorial1)
(a creator Alice)

(b title2 tutorial2)
(b creator Bob)

(c title1 tutorial3)
(c title2 tutorial3Updated)
  1. I want a query to get something like this:

[tutorial1, tutorial2, tutorial3, tutorial3Updated]

  1. and query, which will give something like that:

[(tutorial1, tutorial3), (tutorial2, tutorial3Updated)]

I can do something like that as a wrong attempt to solve the first task:

!(unify &self (, ($x title1 $title) ($y title2 $title2)) (superpose ($title $title2)) Fail)

But it will obviously generate an explicit set of nondeterministic results in the form of

[tutorial2, tutorial1, tutorial3Updated, tutorial1, tutorial2, tutorial3, tutorial3Updated, tutorial3]

Same as if I try to solve the second task by this

!(match &self (, ($x title1 $title) ($y title2 $title2)) ($title $title2))

The result is all possible pairs of titles 1 and 2:

[(tutorial1 tutorial3Updated), (tutorial1 tutorial2), (tutorial3 tutorial3Updated), (tutorial3 tutorial2)]

But what I want is to get set of titles which is

  1. union of title1 and title2 types of titles
  2. 2 tuples with title1 names and title2 names respectively.

An order of names in the union and tuples in the resulting output "list" does not matter.

Metadata

Metadata

Labels

answeredTutorial question is answered but not added to docshelp wantedExtra attention is neededquestionFurther information is requestedtutorialTutorial question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions