Skip to content

Mistake in destructuring-pair?? #44

@genovese

Description

@genovese

The definition of destructuring-pair? looks like it is missing something in the second clause:

(defn- pair? [x] (and (vector? x) (= 2 (core/count x))))
(defn- destructuring-pair? [x]
  (and (pair? x) (not (or (keyword? x) (= '& x)))))

[Lines 30-32 in current version.]

If pair? x is true, then x is certainly not a keyword or a symbol, so the second clause is automatically true, obviating the need for the function. Should the second clause be replaced with (not (some #(or (keyword? %) (= '& %)) x)), or perhaps (not (or (some keyword? x) (= '& (first x)))) if preferred for your intent?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions