Big problem with not big list

Đang mở
#142 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
backend

Hướng nghiên cứu

The report includes a reproducer using Data.List.Lazy.iterate, take, and length, and points to src/Data/List/Lazy.purs near line 189 as a possible cause. Start by reproducing the stack overflow with the provided examples and inspect the lazy list implementation there. Done means the large iterate examples work without a stack overflow or the issue is clarified as expected behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

status: needs more info

Hello everyone! I have some experiments with lazy list. But I have some problem.

module Main where

import Prelude (Unit, map, mod, show, ($), (*), (+), (/=), (<<<), (<=))
import Data.List.Lazy (all, filter, repeat, take, iterate, length, takeWhile, (:))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Lazy (defer, force)

main :: Eff (console::CONSOLE) Unit
main = do
  -- log <<< show <<< length <<< take 1000000 <<< map (_+10) <<< repeat $ 1 -- works
  -- log <<< show <<< length <<< take 10000000 <<< map (_+10) <<< repeat $ 1 -- hard
  -- log <<< show <<< length <<< take 100000000 <<< map (_+10) <<< repeat $ 1 -- oh my...
  -- log <<< show <<< length <<< take 100000 <<< iterate(_+1) $ 1 -- Maximum call stack size exceeded
  -- log <<< show <<< length <<< take 10000 <<< iterate(_+1) $ 1 -- Maximum call stack size exceeded
  log <<< show <<< length <<< take 1000 <<< iterate(_+1) $ 1 -- only this code works!!!

As u can see iterate has some strange behavior. I think this problem in map here https://github.com/purescript/purescript-lists/blob/master/src/Data/List/Lazy.purs#L189

Or maybe I don't know how use lazy list in purescript. If it is, please help me =)

Ngôn ngữ chính
PureScript
Star
61
Fork
50
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của purescript/purescript-lists

Tất cả issue của purescript/purescript-lists

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.