Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
Thanks Jens! On Fri, Jul 15, 2016 at 1:00 PM, Jens Axel Søgaard wrote: > 2016-07-15 18:22 GMT+02:00 David Storrs : > >> >> On a separate question: How do I contribute to the docs? The >> contract docs are nearly silent on using preconditions and

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
> On Fri, Jul 15, 2016 at various times, various people said: > Here, let me solve your problem You guys are great. Thank you very much. Dave On Fri, Jul 15, 2016 at 12:47 PM, Daniel Feltey wrote: > Here's a version that uses a #:pre condition: > > #lang racket > >

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread Jens Axel Søgaard
2016-07-15 18:22 GMT+02:00 David Storrs : > On a separate question: How do I contribute to the docs? The > contract docs are nearly silent on using preconditions and > postconditions, Section 7.4, "A Thorough Example of Contracts" is > anything but thorough, and the

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread Daniel Feltey
Here's a version that uses a #:pre condition: #lang racket (define/contract (tau l m) (->i ([list1 (listof (and/c exact-integer? (>/c 0)))] [list2 (listof (and/c exact-integer? (>/c 0)))]) #:pre (list1 list2) (= (length list1) (length list2)) [_ number?]) (begin

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread Ben Greenman
On Fri, Jul 15, 2016 at 12:31 PM, Matthias Felleisen wrote: > > On a separate question: How do I contribute to the docs? > > git pull requests on github are highly welcome. The easiest way to make a docs pull request is to: 1. Go to github.com, find the file you want to

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread Matthias Felleisen
> On Jul 15, 2016, at 12:22 PM, David Storrs wrote: > > Hi folks, > > I'm writing a stats library … > Okay, good, that has the same results as the one above. Now let's try > to get the 'equal length' criteria working. > > (define/contract (tau l m) > (->i ([list1

[racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
Hi folks, I'm writing a stats library (I'm sure there is already one out there; this is a learning exercise), and I'm currently implementing Kendall's Tau-a. I've got my head wrapped part of the way around contracts, but not all the way. I'd like to be able to express the following: (tau l m)