findall {rolog} | R Documentation |
Invoke a query several times
Description
Invoke a query several times
Usage
findall(
query = call("member", expression(X), list(quote(a), "b", 3L, 4, TRUE, expression(Y))),
options = list(portray = FALSE),
env = globalenv()
)
Arguments
query |
an R call. The R call consists of symbols, integers and real numbers, character strings, boolean values, expressions, lists, and other calls. Vectors of booleans, integers, floating point numbers, and strings with length N > 1 are translated to prolog compounds !/N, %/N, #/N and $$/N, respectively. The names can be modified with the options below. |
options |
This is a list of options controlling translation from and to prolog.
|
env |
The R environment in which the query is run (default: globalenv()). This is mostly relevant for r_eval/2. |
Value
If the query fails, an empty list is returned. If the query
succeeds N >= 1 times, a list of length N is returned, each element
being a list of conditions for each solution, see once()
.
See Also
once()
for a single query
query()
, submit()
, and clear()
for fine-grained control over
non-deterministic queries
Examples
# This query returns a list stating that it works if X = a, "b", ...
findall(call("member", expression(X), list(quote(a), "b", 3L, 4, TRUE, NULL, NA)))
# Continued
findall(call("member", expression(X), list(call("sin", call("/", quote(pi), 2)), expression(Y))))
# The same using simplified syntax
q <- quote(member(.X, ""[a, "b", 3L, 4, TRUE, NULL, NA, sin(pi/2), .Y]))
findall(as.rolog(q))