Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / idan / manual / 03-statements /

03-component-lists.mdwn

[[!meta title=“3.3 | Component Lists”]]

Component Lists

Component lists are one of the ways Idan offers, for “refactoring” common parts of statements, i.e. avoiding repetition and expressing more in less text. They are not considered blocks, and the way they work isn’t the same as blocks, which are introduced in the next sections.

Components lists allow express a statement component in the text as a list of components. The result is that several statements are expressed. Only subjects, predicated and objects can be component lists. Identifiers cannot be.

A component list is delimited by parentheses (()), and elements are separated by commas (,). For example, the following statements share the subject and the object:

<%> myns:uses_gnu_linux true
#^  myns:uses_gnu_hurd  true

Using a component list, the same information can be expressed like this:

<%> (myns:uses_gnu_linux, myns:uses_gnu_hurd) true

When a statement in Idan text contains a component list, it expresses the same information as the list of statements created by placing each individual list element in place of the list itself. If there is more than one list in a statement, the resulting statements can be broken down further until the results have no component lists.

A statement which contains a component list can’t have an identifier (not even a generator or an anchor label), and positional references must not point to a component list.

Algorithm:

The meaning of this is that when having more than one list in a statement, each combination of elements from different lists expresses a Smaoin statement. For example, consider the following 6 statements:

<%> myns:likes myns:tomato
#^  myns:likes myns:carrot
#^  myns:likes myns:cabbage
#^  myns:eats  myns:tomato
#^  myns:eats  myns:carrot
#^  myns:eats  myns:cabbage

Can be made shorter using component lists in several ways. It is possible to combine the predicates alone:

<%> (myns:likes, myns:eats) myns:tomato
#^  (myns:likes, myns:eats) myns:carrot
#^  (myns:likes, myns:eats) myns:cabbage

It is also possible to combine the objects alone:

<%> myns:likes (myns:tomato, myns:carrot, myns:cabbage)
#^  myns:eats  (myns:tomato, myns:carrot, myns:cabbage)

It is also possible to combine both:

<%> (myns:likes, myns:eats) (myns:tomato, myns:carrot, myns:cabbage)

When all the elements of a list which are PLrefs begin with the same label, the label can be written once outside the parentheses. Consider the following statements:

<%> myns:likes myns:tomato
#^  myns:likes $,,
#^  myns:likes myns:subns:cabbage
<%> myns:has_name "carrot"

Using rules already demonstrated, it can be shortened into this:

<%> myns:likes (myns:tomato, $,, , myns:subns:cabbage)
<%> myns:has_name "carrot"

Note the space between the $,, and the comma. Without it, $,,, would be interpreted as if it were $,3. Writing $,2 instead of $,, there may make it cleaner in this case.

Using the last rule introduced - writing the prefix outside - the same statements above can be written as follows:

<%> myns:likes myns:(tomato, $,, , subns:cabbage)
<%> myns:has_name "carrot"

As far as blocks and positional references are concerned, a statement containing a component list still counts a single statement. While referring to components expressed as lists is invalid, referring to non-list components of such a statement is perfectly valid and works in the usual way.

[See repo JSON]