practicalli / practicalli/clojure

Updating only existing keys in a map

Open
#150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
117
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Does anything already exist to do the following, basically doing update but ignoring ops on non-existant keys

(defn update-existing
  [m k f & args]
  (if (contains? m k)
    (apply update m k f args)
    m))

3 replies

a function that does this is in medley
https://github.com/weavejester/medley/blob/master/src/medley

and in Void, more tightly focused on map manipulation: https://github.com/dvlopt/void.cljc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed update-existing function in the issue and compare the linked medley and Void implementations. Then inspect the repository for an existing map-manipulation entry point; done means determining whether this project should add or document such a function, with any needed tests identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.