funcool / funcool/lentes

`nth` should support lists

Open
#10 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
107
Forks
12
PR merge metrics
No merged PRs in 30d

Description

This would be convenient because often parts of bigger data end up being lists after applying core functions (e.g. `map`).

**Steps:**

```
(require '[lentes.core :as l])
(let [data (list 0 1 2 3)
lense (l/nth 2)]
(println "A ->" (l/focus lense data))
(l/over lense inc data)
(println "B ->" (l/focus lense data)))
```

**Expected:**

```
A -> 2
B -> 3
```

**Actual:**

```
1 -> 2
Uncaught Error: No protocol method IAssociative.-assoc defined for type cljs.core/List: (0 1 2 3)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.