Re: [racket-users] contract for an "overloaded function"

2019-11-29 Thread Ben Greenman
Try ->i. I wouldn't worry about performance until makes itself a problem. On 11/29/19, Ryan Kramer wrote: > Thanks, but I don't think `case->` works for me. It looks like it chooses a > > case purely based on the number of arguments. The following example, when > given two arguments, will always

Re: [racket-users] contract for an "overloaded function"

2019-11-29 Thread Ryan Kramer
Thanks, but I don't think `case->` works for me. It looks like it chooses a case purely based on the number of arguments. The following example, when given two arguments, will always choose the integer? case even if both arguments are strings. (case-> [-> integer? integer? list?] [->

Re: [racket-users] contract for an "overloaded function"

2019-11-29 Thread David Storrs
I think you want `case->`: https://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._case-~3e%29%29 On Fri, Nov 29, 2019 at 2:28 PM Ryan Kramer wrote: > I'm not exactly sure what I mean by "overloaded function", but I think you > will

[racket-users] contract for an "overloaded function"

2019-11-29 Thread Ryan Kramer
I'm not exactly sure what I mean by "overloaded function", but I think you will understand. I'm looking for something that would allow me to write a function contract like (magic-> [integer? integer? -> integer?] [string? symbol? -> string?] [string? ...+ -> string?]) The

[racket-users] Confused about Semantics Engineering Exercise 12.6

2019-11-29 Thread Mike MacHenry
Hey everyone, I am a little confused about Exercise 12.6 from Semantics Engineering with PLT-Redex. The exercise is as follows: "Formulate a general reduction relation for ISWIM using a with clause. Use traces to demonstrate that programs may be reduced to values along several different paths in

[racket-users] reading scribble include-section code

2019-11-29 Thread Hendrik Boom
I was reading Scribble's include-section code from https://github.com/racket/scribble/blob/master/scribble-lib/scribble/base.rkt and I can't figure out how this makes a section: (define-syntax (include-section stx) (syntax-case stx () [(_ mod) (with-syntax ([doc-from-mod (datum->syntax