Skip to content

Spec predicates for map with at least one empty sequence #85

Description

@elenam

Calling map with at least one empty sequence results in an empty sequence regardless of the first argument. However, a map with a non-function as the first argument is an error:

user=> (map 5 [])
()
user=> (map 5 [] [])
()
user=> (map 5 [] [1])
()
user=> (map 5 [1] [])
()
user=> (map 5 [1] [6])
Error printing return value (ClassCastException) at clojure.core/map$fn (core.clj:2777).
class java.lang.Long cannot be cast to class clojure.lang.IFn (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IFn is in unnamed module of loader 'app')

To handle this properly, we need a predicate for at least one empty sequence, and then we need to add handling of this case when an error message is generated from the spec error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions