clojuredatascience / ch2-inference

Eclipse Public License 1.0
4 stars 8 forks source link

Browser Simulation: Uncaught TypeError #4

Open jellenberger opened 7 years ago

jellenberger commented 7 years ago

When trying to run the browser simulation, I get the error: Uncaught TypeError: Cannot read property 'call' of undefined at the following line of generated Javascript:

var sample_a = cljs.core.take.call(null, sample_size, cljds.ch2.stats.exponential_distribution.call(null, 1 / mean_a));

This line is in the function definition for cljds.ch2.models.update_sample. Chrome DevTools indicates that cljds.ch2.stats exists, but is missing the update_sample function. The source code for update_sample is in models.cljs and contains the following require:

(ns cljds.ch2.models (:require [reagent.core :as r] [cljds.ch2.stats :refer [exponential-distribution mean]]))

The other required function, mean (which I don't think is actually used in models.cljs), seems to be missing from cljds.ch2.stats also. I'm relatively new to Clojure and completely new to ClojureScript, so I'm not sure how to continue troubleshooting this.

stw commented 5 years ago

Know this is old, but in case anyone else runs into this, just rename the src/cljds/ch2/stats.cljc to src/cljds/ch2/stats.cljc.old and that should clear it up.

Looks like cljds.ch2.stats was compiling to a blank file because of that file, which caused update-sample in models to not be able to find exponential-distribution.