Code Monkey home page Code Monkey logo

Comments (6)

borsboom avatar borsboom commented on July 30, 2024

nub is such a common source of accidental performance problems in Haskell code, so I'm very much +1 on this. The extra package's implementation of nubOrd doesn't depend on sets or maps.

from purescript-arrays.

matthewleon avatar matthewleon commented on July 30, 2024

This is a little bit difficult with respect to dependencies because we would probably want to depend on sets to do this, but maps (which is a dependency of sets) already depends on arrays. So that's one issue to sort out, if we do agree that we want to do this.

I think this is another reason in favor of purescript-deprecated/purescript-sets#46

from purescript-arrays.

matthewleon avatar matthewleon commented on July 30, 2024

On further thought, it's not clear to me that Set is necessary, or beneficial, to do this. We could use Array's own sort, which uses FFI to the JS engine's native Array.sort, and do nub the imperative way. It would avoid the extra dep, and also quite possibly be faster.

from purescript-arrays.

matthewleon avatar matthewleon commented on July 30, 2024

I've taken a shot at nub here: #128

from purescript-arrays.

hdgarrood avatar hdgarrood commented on July 30, 2024

Currently nub preserves order, though, ie nub xs == xs when xs has no duplicates. If I understand correctly your implementation doesn’t have this property. I think it’s a useful property, though, and so I’d rather not lose it.

from purescript-arrays.

garyb avatar garyb commented on July 30, 2024

Resolved in the 0.12 branch

from purescript-arrays.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.