Dict Expression Problem

question

#1

Hi,

I am getting the following error:

julia> ex =Expr(:call,:Dict{Symbol,Tuple{Function,Function}},(:x => (()->begin x end, x330-> begin x= x330 end)))
ERROR: TypeError: Type{...} expression: expected Type{T}, got Symbol

I can’t figure out why?
Thanks


#2

Put parenthesis around quotes.

The error message isn’t given for no reason, you should be able to figure out what’s wrong by running each arguments.


#3
Dict(:x => (()->begin x end, x11-> begin x= x11 end))
Dict{Symbol,Tuple{##17#19,##18#20}} with 1 entry:
  :x => (#17,#18)

Dict{Symbol,Tuple{Function,Function}}(:x => (()->begin x end, x11-> begin x= x11 end))
Dict{Symbol,Tuple{Function,Function}} with 1 entry:
  :x => (#25,#26)

 ex = :(Dict{Symbol,Tuple{Function,Function}}(:x => (()->begin x end, x11-> begin x= x11 end)))
:(Dict{Symbol,Tuple{Function,Function}}(:x => ((()->begin  # REPL[13], line 1:
                        begin  # REPL[13], line 1:
                            x
                        end
                    end),(x11->begin  # REPL[13], line 1:
                        begin  # REPL[13], line 1:
                            x = x11
                        end
                    end))))

I am doing basically the same thing. I don’t see what I am missing


#4

You wrote

So,

julia> :call
:call

julia> :Dict{Symbol,Tuple{Function,Function}}
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Symbol

julia> (:x => (()->begin x end, x330-> begin x= x330 end))
:x => (getfield(Main, Symbol("##5#7"))(), getfield(Main, Symbol("##6#8"))())

You are also missing the quote on the argument of the call.


#5

Now i see it, thank you.!