Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.
This repository was archived by the owner on Mar 8, 2021. It is now read-only.

Minor code improvement for the gets function #159

Description

@beoliver

not really that important but the implementation of gets could be cleaner.
would make more sense to be implemented as

(defn gets
  "Returns the first value mapped to key found in the provided maps."
  [k & maps]
  (->> (map #(get % k) maps)
       (remove nil?)
       first))

As you are mapping and filtering nil will never be returned meaning that the threading will continue (= (list) (some->> (map identity []))). If get is used then the call to first will either be a value or nil.

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