[CLJ-1110] let-> needs improvement Created: 20/Nov/12 Updated: 11/Dec/12 Resolved: 29/Nov/12 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Alex Nixon | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Approval: | Not Approved |
| Description |
|
The function clojure.core/let-> is suboptimal in a few regards: Possible solutions:
Google groups discussion: https://groups.google.com/d/topic/clojure/67JQ7xSUOM4/discussion |
| Comments |
| Comment by Yongqian Li [ 11/Dec/12 12:22 AM ] |
|
Has it been decided whether as-> supports de-structuring or not? Right now it is inconsistent. (as-> [0 1]
[a b]
[(inc a) (inc b)])
=> [1 2]
(as-> {:a 0 :b 1}
{:keys [a b]}
{:a (inc a) :b (inc b)})
=> {:keys [1 2]}
|
| Comment by Yongqian Li [ 11/Dec/12 12:50 AM ] |
|
Also, what about changing the name to (-> 0
(->as name
(...))
Makes it clearer that you are consuming a pipeline and the expressions within ->as are no longer being influenced by ->. |
| Comment by Yongqian Li [ 11/Dec/12 1:03 AM ] |
|
Has the addition of ->>as been considered? That way you can use it inside a ->> like this: (->> a
(->>as name
(...)))
(-> a
(->as name
(...)))
The signature would be [name forms init-expr]. |