Oleg nailing it again. That's what I was looking for. Thanks :-)

It is just an if-then-else-if function, with an arbitrary number of ifs.
Was there already something like that or was there a simpler way of doing
it?

Dario


On Wed, 20 May 2020 at 12:11, Oleg Nesterov <[email protected]> wrote:

> On 05/19, Dario Sanfilippo wrote:
> >
> > Hello, list. I hope that you're all well.
> >
> > I just started using pattern matching and I'd kindly ask for your help to
> > better understand how things work.
> >
> > The goal is to implement an *ifthenelseif* function that takes cond-then
> > pairs as arguments except the last set of arguments that are
> > cond-then-else. The function should look like this,
> >
> > ifthenelseif(C1, T1, C2, T2, Cn, Tn, E);
> >
> > and unfold into this,
> >
> > if(C1, T1, if(C2, T2, if(Cn, Tn, E))); .
>
> Not sure I understand what exactly do you want... but you can pass a single
> list. Say,
>
>         ifthenelse((c, t, e)) = select2(c, ifthenelse(e), t);
>         ifthenelse(e) = e;
>
>         process = ifthenelse((C1,T1, C2,T2, ..., Cn,Tn, E));
>
> Oleg.
>
>
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to