> On Jul 15, 2016, at 12:22 PM, David Storrs <david.sto...@gmail.com> 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 (listof (and/c integer? (>/c 0)))]
>        [list2 (list1) (and/c
>                        (listof (and/c integer? (>/c 0)))
>                        (equal? (length list1) (length list2)))])
> 
>       [result (list1 list2) number?])
>  (begin
>    (println "I was called")
>    300))
> 
> Result =>
> t.rkt:21:79: list2: unbound identifier in module
>  in: list2
> 
> Nope.  Unsurprisingly, 'arg2' is not available inside its own binding.



You are writing a predicate on arg2 here. So why not bind it with a lambda: 

#lang racket

(define/contract (tau l m)
  (->i ([list1 (listof (and/c integer? (>/c 0)))]
        [list2 (list1) (and/c
                        (listof (and/c integer? (>/c 0)))
                        (λ (list2) (equal? (length list1) (length list2))))])
       [result (list1 list2) number?])
  (begin
    (println "I was called")
    300))




> On a separate question:  How do I contribute to the docs?  

git pull requests on github are highly welcome. 

— Matthias


-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to