Description Usage Arguments Value See Also Examples
View source: R/GrammarIsTerminal.R
Checks a phenotype object for containing non-terminal symbols.
1 |
x |
A |
TRUE
if phenotype is terminal, FALSE
otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Define a recursive grammar
# <expr> ::= <expr>+<expr> | var
# <var> ::= A | B | C
ruleDef <- list(expr = grule(expr+expr, var),
var = grule(A, B, C))
# Create a grammar object
grammarDef <- CreateGrammar(ruleDef)
# a short sequence leading to infinite recursion
sq <- c(0)
expr <- GrammarMap(sq, grammarDef)
print(expr)
# check the phenotype for being non-terminal
print(GrammarIsTerminal(expr))
# a terminal sequence
sq <- c(0, 1, 0, 1, 2)
expr <- GrammarMap(sq, grammarDef)
print(expr)
print(GrammarIsTerminal(expr))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.