[erlang-questions] Maps branch and disclaimers
Anthony Ramine
n.oxyde@REDACTED
Mon Oct 28 17:27:31 CET 2013
‘<-‘ can’t be used for binary generators so it can’t be generic.
And lists:map/2 doesn’t help for non-skipping bit strings generators, nor it helps for bit string comprehensions.
--
Anthony Ramine
Le 28 oct. 2013 à 17:13, Pierre Fenoll <pierrefenoll@REDACTED> a écrit :
> IMHO I would love to think of '<-' as a generic generator, which generates elements out of its rhs without any regard to the type.
> Otherwise '<-' would not be as not-type-specific as most (every?) other operator is, in this dynamic language.
> I mean, one could also think of tuple-comprehensions (though I don't see why immediately, but I am not all-seeing).
>
> Anthony, fcall()#{ k := new_val } for example? Modify a key's value just after a call.
>
> Regarding not skipping items in *-comprehensions: well, that's what lists:map/2 is for.
>
>
> Cheers,
> --
> Pierre Fenoll
>
>
>
> On 28 October 2013 16:07, Jesper Louis Andersen <jesper.louis.andersen@REDACTED> wrote:
>
> On Mon, Oct 28, 2013 at 5:05 PM, Anthony Ramine <n.oxyde@REDACTED> wrote:
> I would avoid any ‘:’ character in the new operator because Jesper once had the idea of introducing strict generators with ‘<:-‘ and ‘<:=‘, which would not skip items that doesn’t match (e.g. "[ X || {ok, X} <:- [{error,Reason}] ]" would crash).
>
> Yes. It is a problem I have encountered quite often, where the code throws away terms deliberately and you have no way to fix this but to use a standard lists:map/2 call.
>
>
> --
> J.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
More information about the erlang-questions
mailing list