Skip to content
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

Building PersistentHashMap through in-line for loop has different behavior than Dict #63

Open
mopg opened this issue Jul 4, 2020 · 0 comments

Comments

@mopg
Copy link

mopg commented Jul 4, 2020

The code below throws an error BoundsError: attempt to access 1-element Array{Float64,1} at index [2], which seems to be a bug. When in the same code PersistentHashMap is replaced with Dict, the code works as expected.

function update()
    
    idx = 1

    a = Dict(:a=>0.)

    vec = [2.]

    results_cases = PersistentHashMap(
        case_key => 
            begin
                @info " " idx
                idx += 1
                vec[idx-1]
            end
         for (case_key,case) in a
    )

    return results_cases

end

update()

(I realize this code in and of itself does not make sense, however, it's part of a bigger piece of code where this kind of code is needed. Regardless this seems like a bug that should be fixed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant