ClojureScript

incorrect result for (set [1 2 2])

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

(set [1 2 2]) => #{1 2 2}

Activity

Hide
David Nolen added a comment -

The optimizations in place for set construction around IndexedSeq are not correct - they allow duplicates.

Show
David Nolen added a comment - The optimizations in place for set construction around IndexedSeq are not correct - they allow duplicates.
Hide
Michał Marczyk added a comment -

Fix with test.

Show
Michał Marczyk added a comment - Fix with test.
Hide
David Nolen added a comment -

Ooops haha Applied fix before seeing yours. I think the original code was a bit to simplistic and not worth attempting to correct as you'd just end up duplicating code written elsewhere (didn't really handle complex keys or anything like that).

Show
David Nolen added a comment - Ooops haha Applied fix before seeing yours. I think the original code was a bit to simplistic and not worth attempting to correct as you'd just end up duplicating code written elsewhere (didn't really handle complex keys or anything like that).
Hide
Michał Marczyk added a comment -

Yeah, areduce is probably the better optimization. I actually like the boost to pouring larger arrays into sets that it should bring.

This made me notice some related issues; I'll file separate tickets for those.

Show
Michał Marczyk added a comment - Yeah, areduce is probably the better optimization. I actually like the boost to pouring larger arrays into sets that it should bring. This made me notice some related issues; I'll file separate tickets for those.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: