[PATCH] Add 'switch' statement to match.pd language

2015-07-14 Thread Richard Biener
The following as promised adds a 'switch' statement. This way (if (A) B (if (B) C (if (C) D E))) can now be written as (switch (if (A) B) (if (B) C) (if (C) D) E) the ifs immediately nested in the switch cannot have else clauses and I reject switches that

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-15 Thread Michael Matz
Hi, On Tue, 14 Jul 2015, Richard Biener wrote: > I know Micha detests the extra 'if' as much as the extra braces thus > would have prefered > > (switch > (A) B > (B) C > (C) D > E) The lispy way would have been (switch (A) (B) (C) (D) (E) (F) G) i.e. parenthesize t

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-15 Thread Richard Biener
On July 15, 2015 4:21:03 PM GMT+02:00, Michael Matz wrote: >Hi, > >On Tue, 14 Jul 2015, Richard Biener wrote: > >> I know Micha detests the extra 'if' as much as the extra braces thus >> would have prefered >> >> (switch >> (A) B >> (B) C >> (C) D >> E) > >The lispy way would have been >

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-15 Thread Michael Matz
Hi, On Wed, 15 Jul 2015, Richard Biener wrote: > >> (switch > >> (A) B > >> (B) C > >> (C) D > >> E) > > > >The lispy way would have been > > > > (switch > >(A) (B) > >(C) (D) > >(E) (F) > >G) > > > >i.e. parenthesize the result as well, which then would be unambiguousl

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-15 Thread Richard Sandiford
Michael Matz writes: >> >> (switch >> >> (A) B >> >> (B) C >> >> (C) D >> >> E) >> > >> >The lispy way would have been >> > >> > (switch >> >(A) (B) >> >(C) (D) >> >(E) (F) >> >G) >> > >> >i.e. parenthesize the result as well, which then would be unambiguously >> >> Tha

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-16 Thread Richard Biener
On Wed, 15 Jul 2015, Michael Matz wrote: > Hi, > > On Wed, 15 Jul 2015, Richard Biener wrote: > > > >> (switch > > >> (A) B > > >> (B) C > > >> (C) D > > >> E) > > > > > >The lispy way would have been > > > > > > (switch > > >(A) (B) > > >(C) (D) > > >(E) (F) > > >G) >

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-16 Thread Richard Biener
On Wed, 15 Jul 2015, Richard Sandiford wrote: > Michael Matz writes: > >> >> (switch > >> >> (A) B > >> >> (B) C > >> >> (C) D > >> >> E) > >> > > >> >The lispy way would have been > >> > > >> > (switch > >> >(A) (B) > >> >(C) (D) > >> >(E) (F) > >> >G) > >> > > >> >i.e

Re: [PATCH] Add 'switch' statement to match.pd language

2015-07-16 Thread Michael Matz
Hi, On Thu, 16 Jul 2015, Richard Biener wrote: > > Similar, if the condition is an atom you should be able to leave the > > parens away: > > > > (switch > > cond (minus @0 @1) > > ) > > > > (given a predicate 'cond' defined appropriately). > > Yes. Though techincally the condition cannot