Re: [racket-users] Understanding recursion in the function normalize-definition form the racket sources

2021-04-17 Thread Dan Synek
(blush)
No you are not misunderstanding my question. I was wrong about 
define-values and confused by an error message related to 
normalize-definition not being known in another
part of the program due to phase problems. Thank you so much for taking the 
time to help me out!
Dan


On Sunday, April 18, 2021 at 12:25:38 AM UTC+3 johnbclements wrote:

> I’m confused by your assertion that define-values can’t be used 
> recursively. Here’s a program that does this:
>
> #lang racket
>
> (define-values (fact)
> (λ (x) (if (= x 0) 1 (* x (fact (sub1 x))
>
> (fact 14)
>
> Am I misunderstanding your message?
>
> John Clements
>
> > On Apr 17, 2021, at 05:02, Dan Synek  wrote:
> > 
> > I am trying to implement a variation of define. In order to do that I am 
> trying to understand the source of the define macro in racket.
> > It calls a function normalize-definition which looks like this:
> > (define-values (normalize-definition)
> > (case-lambda 
> > [(stx lambda-stx check-context? allow-key+opt?)
> > (let-values ([(id mk-rhs body)
> > (normalize-definition/mk-rhs stx lambda-stx check-context? 
> allow-key+opt? #t)])
> > (values id (mk-rhs body)))]
> > [(stx lambda-stx check-context?) (normalize-definition stx lambda-stx 
> check-context? #f)]
> > [(stx lambda-stx) (normalize-definition stx lambda-stx #t #f)])))
> > 
> > In the two last cases of the case-lambda there is a call to 
> normalize-definition. It is not a recursive call, since define-values 
> cannot be used recursively. I cannot find any other normalize-definition in 
> the modules required by the norm-define module.
> > If I try to enter a copy of the definition (renamed to 
> normalize-definition1) I get (as expected) that normalize-definition1 is 
> undefined.
> > What is going on?
> > Thanks
> > Dan
> > 
> > 
> > -- 
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/ce5ce36e-03ee-44b1-a5ae-4f5a6e7b9d1en%40googlegroups.com
> .
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/16ec142a-af81-4fa4-8ce7-3fcf833c68f5n%40googlegroups.com.


Re: [racket-users] Understanding recursion in the function normalize-definition form the racket sources

2021-04-17 Thread 'John Clements' via Racket Users
I’m confused by your assertion that define-values can’t be used recursively. 
Here’s a program that does this:

#lang racket

(define-values (fact)
  (λ (x) (if (= x 0) 1 (* x (fact (sub1 x))

(fact 14)

Am I misunderstanding your message?

John Clements

> On Apr 17, 2021, at 05:02, Dan Synek  wrote:
> 
> I am trying to implement a variation of define. In order to do that I am 
> trying to understand the source of the define macro in racket.
>  It calls a function normalize-definition which looks like this:
>   (define-values (normalize-definition)
> (case-lambda 
>  [(stx lambda-stx check-context? allow-key+opt?)
>   (let-values ([(id mk-rhs body)
> (normalize-definition/mk-rhs stx lambda-stx 
> check-context? allow-key+opt? #t)])
> (values id (mk-rhs body)))]
>  [(stx lambda-stx check-context?) (normalize-definition stx lambda-stx 
> check-context? #f)]
>  [(stx lambda-stx) (normalize-definition stx lambda-stx #t #f)])))
> 
> In the two last cases of the case-lambda there is a call to 
> normalize-definition. It is not a recursive call, since define-values cannot 
> be used recursively. I cannot find any other normalize-definition in the 
> modules required by the norm-define module.
>  If I try to enter a copy of the definition (renamed to 
> normalize-definition1) I get (as expected) that normalize-definition1 is 
> undefined.
> What is going on?
> Thanks
> Dan
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/ce5ce36e-03ee-44b1-a5ae-4f5a6e7b9d1en%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3e1d308f-ab29-47e5-b42e-fdff07739645%40mtasv.net.


[racket-users] Understanding recursion in the function normalize-definition form the racket sources

2021-04-17 Thread Dan Synek
I am trying to implement a variation of define. In order to do that I am 
trying to understand the source of the define macro in racket.
 It calls a function normalize-definition which looks like this:
  (define-values (normalize-definition)
(case-lambda 
 [(stx lambda-stx check-context? allow-key+opt?)
  (let-values ([(id mk-rhs body)
(normalize-definition/mk-rhs stx lambda-stx 
check-context? allow-key+opt? #t)])
(values id (mk-rhs body)))]
 [(stx lambda-stx check-context?) (normalize-definition stx lambda-stx 
check-context? #f)]
 [(stx lambda-stx) (normalize-definition stx lambda-stx #t #f)])))

In the two last cases of the case-lambda there is a call to 
normalize-definition. It is not a recursive call, since define-values 
cannot be used recursively. I cannot find any other normalize-definition in 
the modules required by the norm-define module.
 If I try to enter a copy of the definition (renamed to 
normalize-definition1) I get (as expected) that normalize-definition1 is 
undefined.
What is going on?
Thanks
Dan

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ce5ce36e-03ee-44b1-a5ae-4f5a6e7b9d1en%40googlegroups.com.