[julia-users] Re: Overwritten method with variable - how to get rid of variable?

2014-01-14 Thread Sven Mesecke
So simple! Thanks to both of you!

Sven


On Tuesday, January 14, 2014 12:30:44 PM UTC+1, Ivar Nesje wrote:
>
> You can actually use
>
> keys = Base.keys
>
> Ivar
>
> kl. 12:15:54 UTC+1 tirsdag 14. januar 2014 skrev Avik Sengupta følgende:
>>
>> Use Base.keys(..)
>>
>> julia> a=Dict()
>> Dict{Any,Any}()
>>
>> julia> a["x"]="y"
>> "y"
>>
>> julia> keys(a)
>> KeyIterator{Dict{Any,Any}}({"x"=>"y"})
>>
>> julia> keys="z"
>> Warning: imported binding for keys overwritten in module Main
>> "z"
>>
>> julia> keys(a)
>> ERROR: type: apply: expected Function, got ASCIIString
>>
>> julia> Base.keys(a)
>> KeyIterator{Dict{Any,Any}}({"x"=>"y"})
>>
>>
>> On Tuesday, 14 January 2014 10:22:24 UTC, Sven Mesecke wrote:
>>>
>>> Hi,
>>>
>>> too early this morning I assigned some values to `keys`, thereby 
>>> accidentally making the `keys()` method of `dicts` inaccessible. Is 
>>> there a way to get rid of this without restarting the REPL? Stupid, I know.
>>>
>>> Second question: what I want in the end is a list of keys from a dict 
>>> sorted according to their value. Is there any other way than extracting 
>>> keys and values, using `sortperm` to get the index vector and then 
>>> reordering the keys array?
>>>
>>> Thanks a lot,
>>> best,
>>>
>>> Sven
>>>
>>> -- 
>>> Sven Meseckesveme.org
>>>
>>>

[julia-users] Re: Overwritten method with variable - how to get rid of variable?

2014-01-14 Thread Ivar Nesje
You can actually use

keys = Base.keys

Ivar

kl. 12:15:54 UTC+1 tirsdag 14. januar 2014 skrev Avik Sengupta følgende:
>
> Use Base.keys(..)
>
> julia> a=Dict()
> Dict{Any,Any}()
>
> julia> a["x"]="y"
> "y"
>
> julia> keys(a)
> KeyIterator{Dict{Any,Any}}({"x"=>"y"})
>
> julia> keys="z"
> Warning: imported binding for keys overwritten in module Main
> "z"
>
> julia> keys(a)
> ERROR: type: apply: expected Function, got ASCIIString
>
> julia> Base.keys(a)
> KeyIterator{Dict{Any,Any}}({"x"=>"y"})
>
>
> On Tuesday, 14 January 2014 10:22:24 UTC, Sven Mesecke wrote:
>>
>> Hi,
>>
>> too early this morning I assigned some values to `keys`, thereby 
>> accidentally making the `keys()` method of `dicts` inaccessible. Is 
>> there a way to get rid of this without restarting the REPL? Stupid, I know.
>>
>> Second question: what I want in the end is a list of keys from a dict 
>> sorted according to their value. Is there any other way than extracting 
>> keys and values, using `sortperm` to get the index vector and then 
>> reordering the keys array?
>>
>> Thanks a lot,
>> best,
>>
>> Sven
>>
>> -- 
>> Sven Meseckesveme.org
>>
>>

[julia-users] Re: Overwritten method with variable - how to get rid of variable?

2014-01-14 Thread Avik Sengupta
Use Base.keys(..)

julia> a=Dict()
Dict{Any,Any}()

julia> a["x"]="y"
"y"

julia> keys(a)
KeyIterator{Dict{Any,Any}}({"x"=>"y"})

julia> keys="z"
Warning: imported binding for keys overwritten in module Main
"z"

julia> keys(a)
ERROR: type: apply: expected Function, got ASCIIString

julia> Base.keys(a)
KeyIterator{Dict{Any,Any}}({"x"=>"y"})


On Tuesday, 14 January 2014 10:22:24 UTC, Sven Mesecke wrote:
>
> Hi,
>
> too early this morning I assigned some values to `keys`, thereby 
> accidentally making the `keys()` method of `dicts` inaccessible. Is 
> there a way to get rid of this without restarting the REPL? Stupid, I know.
>
> Second question: what I want in the end is a list of keys from a dict 
> sorted according to their value. Is there any other way than extracting 
> keys and values, using `sortperm` to get the index vector and then 
> reordering the keys array?
>
> Thanks a lot,
> best,
>
> Sven
>
> -- 
> Sven Meseckesveme.org
>
>