CAS Best Practices

julia> using Symbolics
julia> Term(sqrt,[2])
sqrt(2)

I don’t get why you’d work harder than that. You can build any expression to be lazily like that, or use @register on others.

I thought the reason for it was because the poster wanted “a zero in the type of x”:

In which case trying to get 0 * x as they posted is an X-Y problem: just writing it as zero(x) is more direct and means what they actually meant using Base Julia functionality.

4 Likes