From 58c05736887b44ce307eae015291dde97716d68f Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 5 Jun 2024 11:44:42 +0000 Subject: [PATCH] build based on ad7e667 --- dev/.documenter-siteinfo.json | 2 +- dev/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 211ab1d..92ad234 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-06-05T11:38:08","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-06-05T11:44:39","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index b135300..2ea5017 100644 --- a/dev/index.html +++ b/dev/index.html @@ -12,4 +12,4 @@ @test_throws ErrorException arguments(ex) @test isexpr(ex) @test !iscall(ex) -@test ex == maketerm(Expr, :ref, [:arr, :i, :j], nothing)

API Docs

TermInterface.argumentsFunction

arguments(x)

Returns the arguments to the function call in a function call expression. iscall(x) must be true as a precondition.

source
TermInterface.arityMethod

arity(x)

When x satisfies iscall, returns the number of arguments of x. Implicitly defined if arguments(x) is defined.

source
TermInterface.childrenFunction
children(x)

Returns the children (aka tail) of the S-expression.

source
TermInterface.headFunction
head(x)

Returns the head of the S-expression.

source
TermInterface.is_operationMethod

is_operation(f)

Returns a single argument anonymous function predicate, that returns true if and only if the argument to the predicate satisfies iscall and operation(x) == f

source
TermInterface.iscallMethod
iscall(x)

Returns true if x is a function call expression. If true, operation(x), arguments(x) must also be defined for x.

If iscall(x) is true, then also isexpr(x) must be true. The other way around is not true. (A function call is always an expression node, but not every expression tree represents a function call).

This means that, head(x) and children(x) must be defined. Together with operation(x) and arguments(x).

Examples

In a functional language, all expression trees are function calls (e.g. SymbolicUtils.jl). Let's say that you have an hybrid array and functional language. iscall on the expression v[i] is false, and iscall on expression f(x) is true, but both of them are nested expressions, and isexpr is true on both.

The same goes for Julia Expr. An Expr(:block, ...) is not a function call and has no operation and arguments, but has a head and children.

The distinction between head/children and operation/arguments is needed when dealing with languages that are not representing function call operations as their head. The main example is Expr(:call, :f, :x): it has both a head and an operation, which are respectively :call and :f.

In other symbolic expression languages, such as SymbolicUtils.jl, the head of a node can correspond to operation and children can correspond to arguments.

source
TermInterface.isexprMethod
isexpr(x)

Returns true if x is an expression tree. If true, head(x) and children(x) methods must be defined for x. Optionally, if x represents a function call, iscall(x) should be true, and operation(x) and arguments(x) should also be defined.

source
TermInterface.maketermFunction
maketerm(T, head, children, metadata)

Constructs an expression. T is a constructor type, head and children are the head and tail of the S-expression. metadata is any metadata attached to this expression.

Note that maketerm may not necessarily return an object of type T. For example, it may return a representation which is more efficient.

This function is used by term-manipulation routines to construct terms generically. In these routines, T is usually the type of the input expression which is being manipulated. For example, when a subexpression is substituted, the outer expression is re-constructed with the sub-expression. T will be the type of the outer expression.

Packages providing expression types must implement this method for each expression type.

Giving nothing for metadata should result in a default being selected.

source
TermInterface.metadataFunction

metadata(expr, md)

Returns a expr with metadata md attached to it.

source
TermInterface.metadataMethod

metadata(x)

Returns the metadata attached to x.

source
TermInterface.node_countMethod

node_count(t) Count the nodes in a symbolic expression tree satisfying isexpr and arguments.

source
TermInterface.operationFunction

operation(x)

Returns the function a function call expression is calling. iscall(x) must be true as a precondition.

source
TermInterface.unsorted_argumentsMethod

unsorted_arguments(x::T)

If x is a expression satisfying iscall(x) and your expression type T provides and optimized implementation for storing the arguments, this function can be used to retrieve the arguments when the order of arguments does not matter but the speed of the operation does.

source
+@test ex == maketerm(Expr, :ref, [:arr, :i, :j], nothing)

API Docs

TermInterface.argumentsFunction
arguments(x)

Returns the arguments to the function call in a function call expression. iscall(x) must be true as a precondition.

source
TermInterface.arityMethod
arity(x)

When x satisfies iscall, returns the number of arguments of x. Implicitly defined if arguments(x) is defined.

source
TermInterface.childrenFunction
children(x)

Returns the children (aka tail) of the S-expression.

source
TermInterface.headFunction
head(x)

Returns the head of the S-expression.

source
TermInterface.is_operationMethod

is_operation(f)

Returns a single argument anonymous function predicate, that returns true if and only if the argument to the predicate satisfies iscall and operation(x) == f

source
TermInterface.iscallMethod
iscall(x)

Returns true if x is a function call expression. If true, operation(x), arguments(x) must also be defined for x.

If iscall(x) is true, then also isexpr(x) must be true. The other way around is not true. (A function call is always an expression node, but not every expression tree represents a function call).

This means that, head(x) and children(x) must be defined. Together with operation(x) and arguments(x).

Examples

In a functional language, all expression trees are function calls (e.g. SymbolicUtils.jl). Let's say that you have an hybrid array and functional language. iscall on the expression v[i] is false, and iscall on expression f(x) is true, but both of them are nested expressions, and isexpr is true on both.

The same goes for Julia Expr. An Expr(:block, ...) is not a function call and has no operation and arguments, but has a head and children.

The distinction between head/children and operation/arguments is needed when dealing with languages that are not representing function call operations as their head. The main example is Expr(:call, :f, :x): it has both a head and an operation, which are respectively :call and :f.

In other symbolic expression languages, such as SymbolicUtils.jl, the head of a node can correspond to operation and children can correspond to arguments.

source
TermInterface.isexprMethod
isexpr(x)

Returns true if x is an expression tree. If true, head(x) and children(x) methods must be defined for x. Optionally, if x represents a function call, iscall(x) should be true, and operation(x) and arguments(x) should also be defined.

source
TermInterface.maketermFunction
maketerm(T, head, children, metadata)

Constructs an expression. T is a constructor type, head and children are the head and tail of the S-expression. metadata is any metadata attached to this expression.

Note that maketerm may not necessarily return an object of type T. For example, it may return a representation which is more efficient.

This function is used by term-manipulation routines to construct terms generically. In these routines, T is usually the type of the input expression which is being manipulated. For example, when a subexpression is substituted, the outer expression is re-constructed with the sub-expression. T will be the type of the outer expression.

Packages providing expression types must implement this method for each expression type.

Giving nothing for metadata should result in a default being selected.

source
TermInterface.metadataFunction
metadata(expr, md)

Returns a expr with metadata md attached to it.

source
TermInterface.metadataMethod
metadata(x)

Returns the metadata attached to x.

source
TermInterface.node_countMethod

node_count(t) Count the nodes in a symbolic expression tree satisfying isexpr and arguments.

source
TermInterface.operationFunction
operation(x)

Returns the function a function call expression is calling. iscall(x) must be true as a precondition.

source
TermInterface.unsorted_argumentsMethod
unsorted_arguments(x::T)

If x is a expression satisfying iscall(x) and your expression type T provides and optimized implementation for storing the arguments, this function can be used to retrieve the arguments when the order of arguments does not matter but the speed of the operation does.

source