some->,some->>,cond->,cond->> and as-> doesn't work with (recur)

Description

some-> and his friends doesn't work with recur, because they never place the last expression in tail position. For example:

raises UnsupportedOperationException: Can only recur from tail position

This is similar to the bug reported for as-> at http://dev.clojure.org/jira/browse/CLJ-1418 (see the comment at http://dev.clojure.org/jira/browse/CLJ-1418?focusedCommentId=35702&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-35702)

It can be fixed by changing the some-> definition to:

Similar fixes can be done for some->>, cond->, cond->> and as->.

Note -> supports recur without problems, fixing this will homogenize *-> macros behaviour.

Patch: fix-CLJ-1418_and_1562.patch (code) and 1562-tests.patch (tests)

Screened by: Alex Miller

Examples before/after:

1) (as-> 0 x (inc x))

2) (some-> 1 (- 2))

3) (some->> 1 (- 2))

4) (cond-> 0 true inc true (- 2))

5) (cond->> 0 true inc true (- 2))

Environment

None

Status

Assignee

Unassigned

Reporter

nahuel

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Priority

Critical
Configure