Re: [racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-15 Thread David Storrs
On Wed, Aug 15, 2018 at 9:22 AM, Matthias Felleisen 
wrote:

>
> Also, do take a look at struct/c.
>

I don't think it covers the same need.  It creates a contract that will
review a struct after it has been created and identify whether or not it is
well-formed, but it will not prevent you from creating a non-well-formed
struct in the first place.  Also, it obviously doesn't offer the other
features of struct++.

Keyword ctor, contracts, default values, field wrappers, and supertypes are
working.  Next step: shamelessly stea...er, take inspiration from
lexi-lambda's work on struct-update so that I can make functional setters.
(The only real difference I want is to set more specific contracts on the
arguments to the setter instead of the any/c that struct-update uses.)



>
> > On Aug 15, 2018, at 1:31 AM, gfb  wrote:
> >
> > You're losing the binding information by doing syntax->datum. Here's a
> quick change to get you unstuck:
> >
> > ...
> >(only-in racket/list partition flatten
> append-map))) ; Include append-map
> > ...
> >(partition (syntax-parser [(flag _) (syntax-e #'flag)])
> >   (syntax->list #'(item ...)))])
> >(define flat-mand (append-map (syntax-parser [(_ (kw contr))
> (list #'kw #'contr)])
> >  mandatory))
> >(define flat-opt (append-map (syntax-parser [(_ (kw contr))
> (list #'kw #'contr)])
> > optional))
> > ...
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-15 Thread David Storrs
Brilliant.  This is exactly what I needed, thank you.


On Wed, Aug 15, 2018 at 1:31 AM, gfb  wrote:

> You're losing the binding information by doing syntax->datum. Here's a
> quick change to get you unstuck:
>
> ...
>(only-in racket/list partition flatten
> append-map))) ; Include append-map
> ...
>(partition (syntax-parser [(flag _) (syntax-e #'flag)])
>   (syntax->list #'(item ...)))])
>(define flat-mand (append-map (syntax-parser [(_ (kw contr))
> (list #'kw #'contr)])
>  mandatory))
>(define flat-opt (append-map (syntax-parser [(_ (kw contr))
> (list #'kw #'contr)])
> optional))
> ...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-15 Thread Matthias Felleisen


Also, do take a look at struct/c. 


> On Aug 15, 2018, at 1:31 AM, gfb  wrote:
> 
> You're losing the binding information by doing syntax->datum. Here's a quick 
> change to get you unstuck:
> 
> ...
>(only-in racket/list partition flatten append-map))) ; 
> Include append-map
> ...
>(partition (syntax-parser [(flag _) (syntax-e #'flag)])
>   (syntax->list #'(item ...)))])
>(define flat-mand (append-map (syntax-parser [(_ (kw contr)) (list 
> #'kw #'contr)])
>  mandatory))
>(define flat-opt (append-map (syntax-parser [(_ (kw contr)) (list 
> #'kw #'contr)])
> optional))
> ...
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-14 Thread gfb
You're losing the binding information by doing syntax->datum. Here's a 
quick change to get you unstuck:

...
   (only-in racket/list partition flatten append-map))) 
; Include append-map
...
   (partition (syntax-parser [(flag _) (syntax-e #'flag)])
  (syntax->list #'(item ...)))])
   (define flat-mand (append-map (syntax-parser [(_ (kw contr)) 
(list #'kw #'contr)])
 mandatory))
   (define flat-opt (append-map (syntax-parser [(_ (kw contr)) 
(list #'kw #'contr)])
optional))
...

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.