Re: [racket-users] Pattern matching as computation

2019-06-27 Thread David Storrs
Oh, neat. Thank you, Sorawee. On Thu, Jun 27, 2019 at 7:26 PM Sorawee Porncharoenwase < sorawee.pw...@gmail.com> wrote: > If you want only one match, it seems what you really want is ~seq-like > form from syntax/parse. E.g., > > #lang racket > > (require syntax/parse) > > (define ->value

Re: [racket-users] Pattern matching as computation

2019-06-27 Thread Sorawee Porncharoenwase
If you want only one match, it seems what you really want is ~seq-like form from syntax/parse. E.g., #lang racket (require syntax/parse) (define ->value syntax->datum) (define (apply-lift op args) (datum->syntax #f (apply op (->value args (syntax-parse (vector 1 2 3 4) [#(a {~and

Re: [racket-users] Pattern matching as computation

2019-06-27 Thread David Storrs
On Thu, Jun 27, 2019 at 5:13 PM Eric Griffis wrote: > On Thu, Jun 27, 2019 at 11:56 AM David Storrs > wrote: > > > > Suppose instead I wanted to have a pattern like so (this does not work): > > > > (match (vector 1 2 3 4) > > [(vector a (app + b ..2 x) c) (list a b c x)] > > ; => '(1 (2 3) 4

Re: [racket-users] Pattern matching as computation

2019-06-27 Thread Eric Griffis
On Thu, Jun 27, 2019 at 11:56 AM David Storrs wrote: > > Suppose instead I wanted to have a pattern like so (this does not work): > > (match (vector 1 2 3 4) > [(vector a (app + b ..2 x) c) (list a b c x)] > ; => '(1 (2 3) 4 5)) ; NB: does not work We have a few problems here. The pattern

[racket-users] Pattern matching as computation

2019-06-27 Thread David Storrs
This works: (match (vector 1 2 3 4) [(vector a b (app add1 c) d) (list a b c d)]) ; => '(1 2 4 4) Suppose instead I wanted to have a pattern like so (this does not work): (match (vector 1 2 3 4) [(vector a (app + b ..2 x) c) (list a b c x)] ; => '(1 (2 3) 4 5)) ; NB: does not work Is