ClojureScript

filter on lazy seq causes stack overflow

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Tested in firefox 21.0 and chromium 27.0.1453.93

Description

This expression causes a stack overflow, instead evaluating to 9999:

(first (filter #(= 9999 %) (range)))

These expressions should be equivalent, and do not cause a stack overflow:

(first (filter #(= 9999 %) (vec (take 10000 (range)))))
(some #(when (= 9999 %) %) (range))

Thus, it seems as if filter cannot handle an input that's already lazy.

More elaborate version: https://www.refheap.com/18490

See also this google group thread: https://groups.google.com/forum/#!topic/clojurescript/3NlQOxwNrRc

    1. Please consider using ssl on dev.clojure.org ##

Activity

David Nolen made changes -
Field Original Value New Value
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: