Uploaded image for project: 'ClojureScript'
  1. CLJS-2034

Sequence and Eduction produce infinite loop in transducer that appends to the reduction

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: 1.9.655
    • Labels:
    • Patch:
      Code and Test

      Description

      Example: a transducer that appends :foo to the result of the reduction:

      (defn xf []
        (fn [rf]
          (fn
            ([] (rf))
            ([result] (rf result :foo))
            ([result input]
             (rf result input)))))
      
      (sequence (xf) [1 2 3])
      

      In Clojure, the above code yields

      '(1 2 3 :foo)

      . In ClojureScript, it results in an infinite loop. The same happens with `eduction`.
      However,

      (into [] (xf) [1 2 3])

      doesn't produce an error.

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              anmonteiro António Monteiro
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: