Skip to content

Instantly share code, notes, and snippets.

@danking
Created November 7, 2013 23:52
Show Gist options
  • Select an option

  • Save danking/7363937 to your computer and use it in GitHub Desktop.

Select an option

Save danking/7363937 to your computer and use it in GitHub Desktop.
#lang typed/racket
(require math)
(define-type w-space [Vector Real
Real Real Real
Real Real Real
Real Real Real])
(: ten-dim-normal-pdf : (case-> (w-space -> Flonum)
(w-space Any -> Flonum)))
(define (ten-dim-normal-pdf w [log? #f])
(if log?
(for/sum: : Flonum ([element : Real w])
(pdf (normal-dist 0 1) element #t))
(for/product: : Flonum ([element w])
(pdf (normal-dist 0 1) element))))
@danking
Copy link
Author

danking commented Nov 7, 2013

Type Checker: Expected Flonum, but got One in: (for/product: : Flonum ((element w)) (pdf (normal-dist 0 1) element))

Type Checker: Expected Flonum, but got Zero in: (for/sum: : Flonum ((element : Real w)) (pdf (normal-dist 0 1) element #t))

Type Checker: Expected Flonum, but got One in: (for/product: : Flonum ((element w)) (pdf (normal-dist 0 1) element))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment