If forgot to mention I'm using this version:
julia> versioninfo()
Julia Version 0.4.0-dev+2403
Commit dae10ab (2015-01-02 13:56 UTC)
Platform Info:
System: Linux (i686-pc-linux-gnu)
CPU: Intel(R) Atom(TM) CPU N570 @ 1.66GHz
WORD_SIZE: 32
BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Atom)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3
El sábado, 3 de enero de 2015 10:29:08 UTC-6, Ismael VC escribió:
>
> I'm trying to port this Python class:
>
> class Env(dict):
> "An environment: a dict of {'var':val} pairs, with an outer Env."
> def __init__(self, parms=(), args=(), outer=None):
> self.update(zip(parms, args))
> self.outer = outer
> def find(self, var):
> "Find the innermost Env where var appears."
> return self if (var in self) else self.outer.find(var)
>
> Haven't even got to the `find` method yet! :( ...this is what I've done:
>
> Environment type:
>
> julia> type Env
> data::Dict
> outer::Nullable{Env}
> Env() = new(Dict(), Nullable{Env}())
> end
>
>
> Outer constructor:
>
> julia> function Env(parms::Tuple, args::Tuple, outer::Env)
> Env(Dict(zip(parms, args)), Nullable(outer))
> end
> Env
>
>
> So far so good:
>
> julia> parms = (:foo, :bar, :baz);
>
> julia> args = (1, 2, 3);
>
> julia> outer = Env()
> Env(Dict{Any,Any}(),Nullable{Env}())
>
>
> I've spent a lot of time trying to understand this, without success:
>
> julia> inner = Env(parms, args, outer)
> ERROR: `convert` has no method matching convert(::Type{Env},
> ::(Symbol,Symbol,Symbol), ::(Int32,Int32,Int32), ::Env)
> in call at base.jl:35
>
>
> I'll have to go to work before soon, I know this'll be itching my head all
> day long! :P
>
> What am I doing wrong? or How many things am I doing wrong? :O
>
> Thanks in advance!
>