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

Re: [racket-users] Typed Racket: type relations

2021-04-17 Thread Sam Tobin-Hochstadt
Ok, three parts: 1. Is it possible to make `average` on `Byte` provably produce a `Byte`? This is not going to be possible with plain Typed Racket, even with refinements to the numeric tower. The problem is that maintaining the invariant that a <= (* n 255) is not something that we can express jus

[racket-users] Checking for fallbacks in generic contracts

2021-04-17 Thread Sage Gerard
Playing with this program. Its output is in the comments. ; /tmp/gen.rkt:9:10: assertion violation ; expected: a procedure ; given: #f ; in: method m ; (I/c (m (-> I? 1))) ; [...removed the rest of the error...] ; 1 (module gen-contracts racket/base (require racket/contract racket/exn racket/gene

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

[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? al