Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    user=> (doc vector?)
    -------------------------
    clojure.core/vector?
    ([x])
      Return true if x implements IPersistentVector
    nil
So `MapEntry` implements `IPersistentVector`, but is not a vector. It does not make sense to have an empty `MapEntry`, so IMHO the behavior implemented is valid.


'Hey, if I peek under the abstraction, it all makes sense'. Obviously. The code does what it's written to do. That doesn't make such leaky abstractions okay. `vector?` is, AFAIK, the way to check if something is a vector, and if empty doesn't work on some `vector?`s, then i can't trust it.

empty mapentry returning nil is meh. If it returned an empty vector it'd be what you want 99% of the time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: