-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expr vs call? #31
Comments
Example that helped me understand: julia> using TermInterface
julia> e = :(x + 2)
:(x + 2)
julia> isexpr(e)
true
julia> iscall(e)
true
julia> head(e)
:call
julia> children(e)
3-element Vector{Any}:
:+
:x
2
julia> operation(e)
:+
julia> arguments(e)
2-element view(::Vector{Any}, 2:3) with eltype Any:
:x
2 |
Actually, I still don't understand what are the semantics of E.g., suppose I have a type like this: struct Expression
operation
arguments::Vector{Any}
end Clearly I need these: TermInterface.iscall(::Expression) = true
TermInterface.operation(e::Expression) = e.operation
TermInterface.arguments(e::Expression) = e.arguments But what about |
See also this issue @nsajko : #37
In a functional language, all nodes are function calls (e.g. SymbolicUtils). Let's say that you have an hybrid array/functional language. The same goes for Julia |
Thanks for all the fixes and reports! What are you working on? Wanna get in touch on Zulip/Slack ? |
Thanks for the explanation!
You're welcome!
CallableExpressions.jl. The main branch should now support TermInterface.jl. The package extension gives the same definition for
Sure, is there a group or something? |
Yes, the #metatheory stream on Julia Zulip |
I don't understand the difference between
isexpr
andiscall
. Perhaps give in the docs an example: a typeT
andx::T
such thatisexpr(x) != iscall(x)
?The text was updated successfully, but these errors were encountered: