[erlang-questions] List to proplist?
Zvi
exta7@REDACTED
Fri Oct 31 12:05:43 CET 2008
Richard O'Keefe wrote:
>
>
> On 31 Oct 2008, at 1:26 am, Andras Georgy Bekes wrote:
>> Please note that I proposed an extension for list comprehensions that
>> does the job of unfold/2 and more.
>
> Between [E(X) || X (<-) F]
> and [E(X) || X <- unfold(S, F')]
> there is very little difference,
> *provided* the compiler knows about unfold and treats it specially.
>
> I've been thinking that we wouldn't really need
> syntax for iterating over the elements of a tuple
> if the compiler knew how to handle
> [E(X) || X <- tuple_to_list(T)].
>
I think compiler shouldn't be dependent on standard library, it should be
vice versa.
I for example don't like special treatment of lists:reverse. If there is
some optimized feature in the compiler it should be made first-class citizen
in the language via special syntax or new keyword or reusing already
existing syntax/keywords if it's possible and make sense.
For example instead of of writing lists:reverse(L) - you write ~L or
something like this. When you see how frequently is lists:reverse used in
the tail-recursive functions it really make sense.
Richard O'Keefe wrote:
>
> It's a little more long-winded than
> [E(X) || X <-: T]
> but a lot more obvious.
>
Why there should be multiple variants for '<-' ? After all Erlang has
dynamic typing, recognizing which collection type is T at run-time should
cost just one compare. And if type guards or type spec is present, then it
may be recognized at compile-time.
Zvi
--
View this message in context: http://www.nabble.com/List-to-proplist--tp20063268p20263801.html
Sent from the Erlang Questions mailing list archive at Nabble.com.
More information about the erlang-questions
mailing list