Greg Chapman
unread,May 21, 2013, 6:15:23 PM5/21/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to FSharp Open Source Community
I've noticed that both the PowerPack and ExtCore implementations of
LazyList wrap a delay around the LazyLists produced by cons and
consDelayed. It seems to me that this is unnecessary, since both
functions are given the value which will be the head of the new
LazyList (so there's no need to delay calculating it). To be specific,
here's some code from the PowerPack:
let lzy f = { status = Delayed f }
let notlazy v = { status = Value v }
let consc x l = CellCons(x,l)
let cons x l = lzy(fun () -> (consc x l))
It seems to me that you could change cons to:
let cons x l = notlazy (consc x l)
without breaking anything or decreasing the laziness. Am I missing
something?