On Tue, Feb 10, 2015 at 9:51 AM, Jonathan S. Shapiro <[email protected]> wrote: > On Mon, Feb 9, 2015 at 7:37 PM, Matt Rice <[email protected]> wrote: >> >> On Mon, Feb 9, 2015 at 3:03 PM, Jonathan S. Shapiro <[email protected]> >> wrote: >> > >> > So what kind of comprehension is the example I gave: >> > >> > [ c | c <- s : String ] >> > >> > >> > because it seems to me that the input here is a String and the output is >> > a >> > list of characters. Is this a string comprehension, a list >> > comprehension, or >> > some third thing? >> >> It seems to me that it'd be a list comprehension, because a string (as >> the output collection) is not generally incrementally constructed... > > > It took me a while to figure out what you meant here. I'm afraid that wasn't > the precedence I intended. What I intended was: > > [ c | c <- (s : String) ] > > > That is: we are forming a list of characters obtained by exploding a string. > Naively, I would have expected that since the thing being comprehended (so > to speak) is a string, this would be considered a string comprehension.
> I think you assumed > in your reading that it was binding with low precedence. Apologies, I didn't misunderstand your example and that it was intended to return a list of characters, I was trying to get at the notion that 'list comprehension', is ambiguous with regards to whether it's referring to the input list, the creation of the output list, or the act of conversion from one to the other, and there is a potential source of confusion when interpreted in the ways beyond your example, and that those ways may not work or admit any performant implementation, since there is less restriction on the input type than the output type... _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
