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?] [-> st

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 un

[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 abov