[Haskell-beginners] Laziness to efficiently get one element from a set
Jeffrey Brown
jeffbrown.the at gmail.com
Sat Mar 7 21:52:08 UTC 2015
Hi,
Suppose S is a big set, and I'd like to access just a single element from
it. The only natural way I've come up with to do that is this: head $
Data.Set.toList S. If I do that, am I correct that Haskell will not try to
convert all of S to a list; instead it will only convert one element, and
then return it, and leave the rest of the list unevaluated?
Thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150307/451d4a88/attachment.html>
More information about the Beginners
mailing list