Re: [racket-users] Confused about syntax properties

2017-02-02 Thread Dupéron Georges
PS: a nice example to try in the macro stepper, to see the evaluation order:

#lang racket
(define-syntax (foo stx) #'1)
(define-syntax (bar stx) #'foo)

(let ()
  bar
  (let ()
bar
(let ()
  bar
  bar)
(#%expression bar)
bar)
  (+ bar bar)
  bar)

-- 
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] Confused about syntax properties

2017-02-02 Thread Dupéron Georges
Le lundi 30 janvier 2017 06:25:29 UTC+1, Matias Eyzaguirre a écrit :
> Nice, thanks! I wasn’t aware of that. so macros are expanded in the order 
> that the reader reads them, not in so called evaluation order.

>From experience, the order is outside-in, each form after the preceding one 
>(except when a macro produces a begin form, in which case the contents of the 
>begin are spliced, and handled one by one). The contents of let-values forms 
>are initially skipped, and expanded after every form in the outer let has been 
>expanded enough to determine that it is not a definition. This means that 
>within the body of a let (or of a module, I think), forms are expanded until 
>the first element is not a macro anymore (e.g. a function application with 
>#%app, an expression with #%expression, or a datum), as any remaining macro 
>could potentially expand to a definition.

Add to that a few exceptions, like things lifted with 
syntax-local-lift-expression or syntax-local-lift-module-end-declaration, and 
explicit expansion with local-expand.

I wonder if there's a definitive reference in the docs about this? I'd enjoy 
reading about how the built-in forms behave, and what mechanisms may influence 
the order of expansion (#%expression, local-expand, maybe some others?).

-- 
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] implementing make in racket

2017-02-02 Thread Matthias Felleisen

(And you also want to catch all exns at that points and put them into ch. But I 
suspect you’d have known.)


> On Feb 2, 2017, at 9:11 AM, Jay McCarthy  wrote:
> 
> I would do something like:
> 
> (define ch (make-channel))
> (submit-job! jq (lambda () (define ans ...) (channel-put ch ans)))
> (channel-get ch ans)
> 
> This will synchronously wait for the job to finish. Presumably you'd
> do this when you already started up the workers and from a context
> where you have a lot of jobs running.
> 
> Jay
> 
> 
> 
> On Wed, Feb 1, 2017 at 2:21 PM, Dan Liebgold
>  wrote:
>> On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
>>> The typed-racket code returns a value from the job, whereas this code
>>> assumes the job is fully self-contained. Perhaps job-queue should
>>> protect itself from job exceptions.
>>> 
>> 
>> BTW, how would you recommend returning a value from a job in job-queue?
>> 
>> --
>> 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.
> 
> 
> 
> -- 
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> 
>   "Wherefore, be not weary in well-doing,
>  for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>  - D 64:33
> 
> -- 
> 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] implementing make in racket

2017-02-02 Thread Jay McCarthy
I would do something like:

(define ch (make-channel))
(submit-job! jq (lambda () (define ans ...) (channel-put ch ans)))
(channel-get ch ans)

This will synchronously wait for the job to finish. Presumably you'd
do this when you already started up the workers and from a context
where you have a lot of jobs running.

Jay



On Wed, Feb 1, 2017 at 2:21 PM, Dan Liebgold
 wrote:
> On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
>> The typed-racket code returns a value from the job, whereas this code
>> assumes the job is fully self-contained. Perhaps job-queue should
>> protect itself from job exceptions.
>>
>
> BTW, how would you recommend returning a value from a job in job-queue?
>
> --
> 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.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
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] Beginners question: implementing existing generics for existing structs

2017-02-02 Thread Ronie Uliana
Thank you, Jon and andmkent!

Jon, I understand the reason. However, I guess it's possible to fix that kind 
of problem using precedence the same way some languages do with traits and 
mixins.

:)

Anyway, thank you again!

-- 
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.