utils

Entry points · Kotlin object UtilsModule · library prolog.argumentation.utils

Utilities on lists and on the labels of the context (module utils), most of them native primitives.

PredicateDescription
writeList/1The items of List written one after the other, then a new line
writeListNl/1The items of List written each on a line
appendFast/3List is List1 followed by List2, in one step
appendLists/2Result is the concatenation of the lists in Lists
assertAll/1Each of Clauses asserted in the context
forEach/3Goal (all its solutions) for each element of List, as findall(_, (member(Element, List), Goal), _), but without List in the goals of the iterations: with variable tracking, every resolution step visits the terms of the goal it belongs to, so the list would make every step as costly as it is long
contains/2An element of List matches Element (without binding it)
containsAny/2An element of List matches one of Elements (without binding them)
sort/2Reverse standard order of terms, duplicates kept (as the former quicksort)
deduplicate/2Standard order of terms, duplicates removed (as setof/3)
sortDistinct/2Reverse standard order of terms, duplicates removed (deduplicate/2, then sort/2)
minimalBySet/2The values of the Set-Value pairs whose Set has no strict subset among the others (elements compared as ground terms), in order: minimal_set/2 over a whole collection in one step
uniqueByFirst/2Lists keeping, among the lists with the same first element, only the last one (in their order)
intersection/2The elements of the first list in Sets that are in all of them, in its order (elements compared as ground terms); fails if Sets is empty
subtract/3The elements of List not in Removed, in order (elements compared as ground terms), without the recursion of a Prolog subtract (whose frames would all keep the rest of the list)
sccs/1Strongly connected components of the attack graph, as lists of argument identifiers, in topological order (a component is only attacked by itself and by the components before it)
sccs/2Strongly connected components of the subgraph of the arguments in Ids, as lists of argument identifiers, in topological order

writeList/1

writeList(+List)

The items of List written one after the other, then a new line.

writeListNl/1

writeListNl(+List)

The items of List written each on a line.

appendFast/3

appendFast(+List1, +List2, -List)

Native primitive.

List is List1 followed by List2, in one step

appendLists/2

appendLists(Lists, Result)

Native primitive.

Result is the concatenation of the lists in Lists

assertAll/1

assertAll(+Clauses)

Native primitive.

Each of Clauses asserted in the context

forEach/3

forEach(?Element, +List, +Goal)

Native primitive.

Goal (all its solutions) for each element of List, as findall(_, (member(Element, List), Goal), _), but without List in the goals of the iterations: with variable tracking, every resolution step visits the terms of the goal it belongs to, so the list would make every step as costly as it is long. Goal runs in this module: other modules are called through ::.

contains/2

contains(?Element, +List)

Native primitive.

An element of List matches Element (without binding it)

containsAny/2

containsAny(+Elements, +List)

Native primitive.

An element of List matches one of Elements (without binding them)

sort/2

sort(+List, ?Sorted)

Native primitive.

Reverse standard order of terms, duplicates kept (as the former quicksort)

deduplicate/2

deduplicate(+List, ?Deduplicated)

Native primitive.

Standard order of terms, duplicates removed (as setof/3)

sortDistinct/2

sortDistinct(+List, ?Sorted)

Native primitive.

Reverse standard order of terms, duplicates removed (deduplicate/2, then sort/2)

minimalBySet/2

minimalBySet(+Pairs, -Values)

Native primitive.

The values of the Set-Value pairs whose Set has no strict subset among the others (elements compared as ground terms), in order: minimal_set/2 over a whole collection in one step

uniqueByFirst/2

uniqueByFirst(+Lists, ?Unique)

Native primitive.

Lists keeping, among the lists with the same first element, only the last one (in their order)

intersection/2

intersection(+Sets, -Intersection)

Native primitive.

The elements of the first list in Sets that are in all of them, in its order (elements compared as ground terms); fails if Sets is empty

subtract/3

subtract(+List, +Removed, ?Rest)

Native primitive.

The elements of List not in Removed, in order (elements compared as ground terms), without the recursion of a Prolog subtract (whose frames would all keep the rest of the list)

sccs/1

sccs(-Sccs)

Native primitive.

Strongly connected components of the attack graph, as lists of argument identifiers, in topological order (a component is only attacked by itself and by the components before it).

sccs/2

sccs(+Ids, -Sccs)

Native primitive.

Strongly connected components of the subgraph of the arguments in Ids, as lists of argument identifiers, in topological order.