A further point would be if you can iterate a String, why would you want to
convert it into a List. Seems very inefficient to me. The tendency to
convert everything to lists for processing is working around a deficiency
in the design of the language. Generic iterators allow algorithms to be
expressed in a way that they do not rely on the type of the collection
being a list, but intact relate the algorithm directly to the
access-pattern required (forward, bi-direction, indexed, random,
bifurcating, 2-dimensional etc...).

Keean.

On 10 February 2015 at 18:07, Jonathan S. Shapiro <[email protected]> wrote:

> On Tue, Feb 10, 2015 at 9:54 AM, Keean Schupke <[email protected]> wrote:
>
>> It seems square brackets are closely associated with lists, so would:
>>
>> f s = ({ c | c <- (s :: String) } :: String)
>>
>> Be better?
>>
>
> I don't think so. the intent of my original example was to explode a
> string and produce a list of its elements.
>
> But I see after a little poking around on the web that "list
> comprehension" is indeed generally understood as a construct mapping a list
> to a list. Perhaps more strangely (at least to me), OCaml Batteries
> Included has other comprehensions, but in their version *all* inputs are
> lists (rather than iterables) and it's called a Foo comprehension if it
> produces a Foo. Their syntax is uniform, independent of the output type.
>
>
> shap
>
> _______________________________________________
> bitc-dev mailing list
> [email protected]
> http://www.coyotos.org/mailman/listinfo/bitc-dev
>
>
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to