 (plot/histogram (repeatedly 1000 #(sample* (categorical (vec (empirical-distribution (collect-results is-states)))))) :normalize :probability-density :bins 100)
 ;; @@
 ;; =>
-;;; {"type":"vega","content":{"width":400,"height":247.2187957763672,"padding":{"top":10,"left":55,"bottom":40,"right":10},"data":[{"name":"1c29b48e-29e6-4e14-a487-7fbff4363e74","values":[{"x":-29.92154534478879,"y":0},{"x":-29.472181249705123,"y":0.002225366937280133},{"x":-29.022817154621457,"y":0.0},{"x":-28.57345305953779,"y":0.0},{"x":-28.124088964454124,"y":0.0},{"x":-27.674724869370458,"y":0.0},{"x":-27.22536077428679,"y":0.0},{"x":-26.775996679203125,"y":0.0},{"x":-26.32663258411946,"y":0.0},{"x":-25.877268489035792,"y":0.0},{"x":-25.427904393952126,"y":0.0},{"x":-24.97854029886846,"y":0.0},{"x":-24.529176203784793,"y":0.0},{"x":-24.079812108701127,"y":0.0},{"x":-23.63044801361746,"y":0.0},{"x":-23.181083918533794,"y":0.0},{"x":-22.731719823450128,"y":0.0},{"x":-22.28235572836646,"y":0.0},{"x":-21.832991633282795,"y":0.0},{"x":-21.38362753819913,"y":0.0},{"x":-20.934263443115462,"y":0.0},{"x":-20.484899348031796,"y":0.0},{"x":-20.03553525294813,"y":0.0},{"x":-19.586171157864463,"y":0.0},{"x":-19.136807062780797,"y":0.0},{"x":-18.68744296769713,"y":0.0},{"x":-18.238078872613464,"y":0.0},{"x":-17.788714777529798,"y":0.0},{"x":-17.33935068244613,"y":0.0},{"x":-16.889986587362465,"y":0.0},{"x":-16.4406224922788,"y":0.0},{"x":-15.99125839719513,"y":0.0},{"x":-15.541894302111462,"y":0.0},{"x":-15.092530207027794,"y":0.0},{"x":-14.643166111944126,"y":0.0},{"x":-14.193802016860458,"y":0.0},{"x":-13.74443792177679,"y":0.0},{"x":-13.295073826693121,"y":0.0},{"x":-12.845709731609453,"y":0.0},{"x":-12.396345636525785,"y":0.6231027424384373},{"x":-11.946981541442117,"y":0.0},{"x":-11.497617446358449,"y":0.0},{"x":-11.04825335127478,"y":0.0},{"x":-10.598889256191113,"y":0.0},{"x":-10.149525161107444,"y":0.0},{"x":-9.700161066023776,"y":0.44507338745602665},{"x":-9.250796970940108,"y":0.002225366937280133},{"x":-8.80143287585644,"y":0.0},{"x":-8.352068780772772,"y":0.0},{"x":-7.902704685689105,"y":0.0},{"x":-7.453340590605437,"y":0.0},{"x":-7.00397649552177,"y":0.0},{"x":-6.554612400438103,"y":0.0},{"x":-6.1052483053544355,"y":0.0},{"x":-5.655884210270768,"y":0.0},{"x":-5.206520115187101,"y":0.0},{"x":-4.757156020103434,"y":0.0},{"x":-4.3077919250197665,"y":0.0},{"x":-3.858427829936099,"y":0.0},{"x":-3.409063734852431,"y":0.015577568560960932},{"x":-2.9596996397687634,"y":0.0},{"x":-2.5103355446850957,"y":0.0},{"x":-2.060971449601428,"y":0.0},{"x":-1.6116073545177603,"y":0.0},{"x":-1.1622432594340926,"y":0.0},{"x":-0.7128791643504249,"y":0.32490357284289945},{"x":-0.2635150692667572,"y":0.0},{"x":0.18584902581691043,"y":0.0},{"x":0.635213120900578,"y":0.0},{"x":1.0845772159842457,"y":0.0400566048710424},{"x":1.5339413110679134,"y":0.0},{"x":1.9833054061515811,"y":0.0},{"x":2.4326695012352486,"y":0.053408806494723196},{"x":2.8820335963189163,"y":0.0},{"x":3.331397691402584,"y":0.7121174199296426},{"x":3.7807617864862517,"y":0.0},{"x":4.230125881569919,"y":0.0},{"x":4.679489976653587,"y":0.0},{"x":5.128854071737254,"y":0.0},{"x":5.578218166820921,"y":0.0},{"x":6.0275822619045885,"y":0.0},{"x":6.476946356988256,"y":0.0},{"x":6.926310452071923,"y":0.0},{"x":7.37567454715559,"y":0.0},{"x":7.8250386422392575,"y":0.0},{"x":8.274402737322925,"y":0.0},{"x":8.723766832406593,"y":0.0},{"x":9.173130927490261,"y":0.0},{"x":9.62249502257393,"y":0.0},{"x":10.071859117657597,"y":0.0},{"x":10.521223212741265,"y":0.0},{"x":10.970587307824934,"y":0.0},{"x":11.419951402908602,"y":0.0},{"x":11.86931549799227,"y":0.0},{"x":12.318679593075938,"y":0.0},{"x":12.768043688159606,"y":0.0},{"x":13.217407783243274,"y":0.0},{"x":13.666771878326943,"y":0.0},{"x":14.11613597341061,"y":0.0},{"x":14.565500068494279,"y":0.0},{"x":15.014864163577947,"y":0.0},{"x":15.464228258661615,"y":0.0066761008118403995},{"x":15.913592353745283,"y":0}]}],"marks":[{"type":"line","from":{"data":"1c29b48e-29e6-4e14-a487-7fbff4363e74"},"properties":{"enter":{"x":{"scale":"x","field":"data.x"},"y":{"scale":"y","field":"data.y"},"interpolate":{"value":"step-before"},"fill":{"value":"steelblue"},"fillOpacity":{"value":0.4},"stroke":{"value":"steelblue"},"strokeWidth":{"value":2},"strokeOpacity":{"value":1}}}}],"scales":[{"name":"x","type":"linear","range":"width","zero":false,"domain":{"data":"1c29b48e-29e6-4e14-a487-7fbff4363e74","field":"data.x"}},{"name":"y","type":"linear","range":"height","nice":true,"zero":false,"domain":{"data":"1c29b48e-29e6-4e14-a487-7fbff4363e74","field":"data.y"}}],"axes":[{"type":"x","scale":"x"},{"type":"y","scale":"y"}]},"value":"#gorilla_repl.vega.VegaView{:content {:width 400, :height 247.2188, :padding {:top 10, :left 55, :bottom 40, :right 10}, :data [{:name \"1c29b48e-29e6-4e14-a487-7fbff4363e74\", :values ({:x -29.92154534478879, :y 0} {:x -29.472181249705123, :y 0.002225366937280133} {:x -29.022817154621457, :y 0.0} {:x -28.57345305953779, :y 0.0} {:x -28.124088964454124, :y 0.0} {:x -27.674724869370458, :y 0.0} {:x -27.22536077428679, :y 0.0} {:x -26.775996679203125, :y 0.0} {:x -26.32663258411946, :y 0.0} {:x -25.877268489035792, :y 0.0} {:x -25.427904393952126, :y 0.0} {:x -24.97854029886846, :y 0.0} {:x -24.529176203784793, :y 0.0} {:x -24.079812108701127, :y 0.0} {:x -23.63044801361746, :y 0.0} {:x -23.181083918533794, :y 0.0} {:x -22.731719823450128, :y 0.0} {:x -22.28235572836646, :y 0.0} {:x -21.832991633282795, :y 0.0} {:x -21.38362753819913, :y 0.0} {:x -20.934263443115462, :y 0.0} {:x -20.484899348031796, :y 0.0} {:x -20.03553525294813, :y 0.0} {:x -19.586171157864463, :y 0.0} {:x -19.136807062780797, :y 0.0} {:x -18.68744296769713, :y 0.0} {:x -18.238078872613464, :y 0.0} {:x -17.788714777529798, :y 0.0} {:x -17.33935068244613, :y 0.0} {:x -16.889986587362465, :y 0.0} {:x -16.4406224922788, :y 0.0} {:x -15.99125839719513, :y 0.0} {:x -15.541894302111462, :y 0.0} {:x -15.092530207027794, :y 0.0} {:x -14.643166111944126, :y 0.0} {:x -14.193802016860458, :y 0.0} {:x -13.74443792177679, :y 0.0} {:x -13.295073826693121, :y 0.0} {:x -12.845709731609453, :y 0.0} {:x -12.396345636525785, :y 0.6231027424384373} {:x -11.946981541442117, :y 0.0} {:x -11.497617446358449, :y 0.0} {:x -11.04825335127478, :y 0.0} {:x -10.598889256191113, :y 0.0} {:x -10.149525161107444, :y 0.0} {:x -9.700161066023776, :y 0.44507338745602665} {:x -9.250796970940108, :y 0.002225366937280133} {:x -8.80143287585644, :y 0.0} {:x -8.352068780772772, :y 0.0} {:x -7.902704685689105, :y 0.0} {:x -7.453340590605437, :y 0.0} {:x -7.00397649552177, :y 0.0} {:x -6.554612400438103, :y 0.0} {:x -6.1052483053544355, :y 0.0} {:x -5.655884210270768, :y 0.0} {:x -5.206520115187101, :y 0.0} {:x -4.757156020103434, :y 0.0} {:x -4.3077919250197665, :y 0.0} {:x -3.858427829936099, :y 0.0} {:x -3.409063734852431, :y 0.015577568560960932} {:x -2.9596996397687634, :y 0.0} {:x -2.5103355446850957, :y 0.0} {:x -2.060971449601428, :y 0.0} {:x -1.6116073545177603, :y 0.0} {:x -1.1622432594340926, :y 0.0} {:x -0.7128791643504249, :y 0.32490357284289945} {:x -0.2635150692667572, :y 0.0} {:x 0.18584902581691043, :y 0.0} {:x 0.635213120900578, :y 0.0} {:x 1.0845772159842457, :y 0.0400566048710424} {:x 1.5339413110679134, :y 0.0} {:x 1.9833054061515811, :y 0.0} {:x 2.4326695012352486, :y 0.053408806494723196} {:x 2.8820335963189163, :y 0.0} {:x 3.331397691402584, :y 0.7121174199296426} {:x 3.7807617864862517, :y 0.0} {:x 4.230125881569919, :y 0.0} {:x 4.679489976653587, :y 0.0} {:x 5.128854071737254, :y 0.0} {:x 5.578218166820921, :y 0.0} {:x 6.0275822619045885, :y 0.0} {:x 6.476946356988256, :y 0.0} {:x 6.926310452071923, :y 0.0} {:x 7.37567454715559, :y 0.0} {:x 7.8250386422392575, :y 0.0} {:x 8.274402737322925, :y 0.0} {:x 8.723766832406593, :y 0.0} {:x 9.173130927490261, :y 0.0} {:x 9.62249502257393, :y 0.0} {:x 10.071859117657597, :y 0.0} {:x 10.521223212741265, :y 0.0} {:x 10.970587307824934, :y 0.0} {:x 11.419951402908602, :y 0.0} {:x 11.86931549799227, :y 0.0} {:x 12.318679593075938, :y 0.0} {:x 12.768043688159606, :y 0.0} {:x 13.217407783243274, :y 0.0} {:x 13.666771878326943, :y 0.0} {:x 14.11613597341061, :y 0.0} {:x 14.565500068494279, :y 0.0} {:x 15.014864163577947, :y 0.0} {:x 15.464228258661615, :y 0.0066761008118403995} {:x 15.913592353745283, :y 0})}], :marks [{:type \"line\", :from {:data \"1c29b48e-29e6-4e14-a487-7fbff4363e74\"}, :properties {:enter {:x {:scale \"x\", :field \"data.x\"}, :y {:scale \"y\", :field \"data.y\"}, :interpolate {:value \"step-before\"}, :fill {:value \"steelblue\"}, :fillOpacity {:value 0.4}, :stroke {:value \"steelblue\"}, :strokeWidth {:value 2}, :strokeOpacity {:value 1}}}}], :scales [{:name \"x\", :type \"linear\", :range \"width\", :zero false, :domain {:data \"1c29b48e-29e6-4e14-a487-7fbff4363e74\", :field \"data.x\"}} {:name \"y\", :type \"linear\", :range \"height\", :nice true, :zero false, :domain {:data \"1c29b48e-29e6-4e14-a487-7fbff4363e74\", :field \"data.y\"}}], :axes [{:type \"x\", :scale \"x\"} {:type \"y\", :scale \"y\"}]}}"}
+;;; {"type":"vega","content":{"width":400,"height":247.2187957763672,"padding":{"top":10,"left":55,"bottom":40,"right":10},"data":[{"name":"c57ddb88-30b1-4616-9f5f-8fb2c4de139f","values":[{"x":-6.243251570872203,"y":0},{"x":-6.0927491641161104,"y":0.3388650128542585},{"x":-5.942246757360018,"y":0.0},{"x":-5.791744350603926,"y":0.0},{"x":-5.641241943847834,"y":0.0},{"x":-5.490739537091741,"y":0.0},{"x":-5.340237130335649,"y":0.0},{"x":-5.189734723579557,"y":0.0},{"x":-5.0392323168234645,"y":0.0},{"x":-4.888729910067372,"y":0.0},{"x":-4.73822750331128,"y":0.0},{"x":-4.587725096555188,"y":0.0},{"x":-4.437222689799095,"y":0.0},{"x":-4.286720283043003,"y":0.0},{"x":-4.136217876286911,"y":0.0},{"x":-3.9857154695308186,"y":0.0},{"x":-3.8352130627747263,"y":0.0},{"x":-3.684710656018634,"y":0.0},{"x":-3.5342082492625417,"y":0.0},{"x":-3.3837058425064495,"y":0.0},{"x":-3.233203435750357,"y":0.0},{"x":-3.082701028994265,"y":0.0},{"x":-2.9321986222381726,"y":0.0},{"x":-2.7816962154820803,"y":0.0},{"x":-2.631193808725988,"y":0.0},{"x":-2.480691401969896,"y":0.0},{"x":-2.3301889952138035,"y":0.0},{"x":-2.1796865884577112,"y":0.0},{"x":-2.029184181701619,"y":0.0},{"x":-1.878681774945527,"y":0.0},{"x":-1.7281793681894349,"y":0.0},{"x":-1.5776769614333428,"y":0.0},{"x":-1.4271745546772507,"y":0.0},{"x":-1.2766721479211587,"y":0.0},{"x":-1.1261697411650666,"y":0.0},{"x":-0.9756673344089746,"y":0.0},{"x":-0.8251649276528825,"y":0.006644412016750167},{"x":-0.6746625208967905,"y":0.0},{"x":-0.5241601141406984,"y":0.0},{"x":-0.3736577073846063,"y":0.0},{"x":-0.22315530062851419,"y":0.0},{"x":-0.07265289387242208,"y":0.0},{"x":0.07784951288367004,"y":0.0},{"x":0.22835191963976215,"y":0.0},{"x":0.37885432639585426,"y":0.0},{"x":0.5293567331519464,"y":0.0},{"x":0.6798591399080385,"y":0.0},{"x":0.8303615466641305,"y":0.0},{"x":0.9808639534202226,"y":0.0},{"x":1.1313663601763146,"y":0.0},{"x":1.2818687669324067,"y":0.0},{"x":1.4323711736884988,"y":0.0},{"x":1.5828735804445908,"y":0.0},{"x":1.7333759872006829,"y":0.0},{"x":1.883878393956775,"y":0.0},{"x":2.034380800712867,"y":0.0},{"x":2.1848832074689595,"y":0.0},{"x":2.3353856142250518,"y":0.0},{"x":2.485888020981144,"y":0.0},{"x":2.6363904277372363,"y":0.0},{"x":2.7868928344933286,"y":0.0},{"x":2.937395241249421,"y":0.0},{"x":3.087897648005513,"y":0.0},{"x":3.2384000547616054,"y":0.0},{"x":3.3889024615176977,"y":0.0},{"x":3.53940486827379,"y":0.0},{"x":3.6899072750298822,"y":0.0},{"x":3.8404096817859745,"y":0.0},{"x":3.990912088542067,"y":0.0},{"x":4.141414495298159,"y":0.0199332360502505},{"x":4.291916902054251,"y":0.0},{"x":4.442419308810344,"y":0.0},{"x":4.592921715566436,"y":0.039866472100501},{"x":4.743424122322528,"y":0.0},{"x":4.8939265290786205,"y":0.0},{"x":5.044428935834713,"y":0.0},{"x":5.194931342590805,"y":0.0},{"x":5.345433749346897,"y":0.0},{"x":5.49593615610299,"y":0.0},{"x":5.646438562859082,"y":0.006644412016750167},{"x":5.796940969615174,"y":0.0},{"x":5.947443376371266,"y":0.0},{"x":6.097945783127359,"y":0.0},{"x":6.248448189883451,"y":0.0},{"x":6.398950596639543,"y":0.0},{"x":6.5494530033956355,"y":0.0},{"x":6.699955410151728,"y":0.6312191415912659},{"x":6.85045781690782,"y":0.0},{"x":7.000960223663912,"y":0.0},{"x":7.151462630420005,"y":0.0},{"x":7.301965037176097,"y":0.0},{"x":7.452467443932189,"y":0.0},{"x":7.6029698506882815,"y":0.0},{"x":7.753472257444374,"y":0.0},{"x":7.903974664200466,"y":0.0},{"x":8.054477070956558,"y":0.0},{"x":8.20497947771265,"y":0.0},{"x":8.355481884468741,"y":0.0},{"x":8.505984291224832,"y":2.305610969812308},{"x":8.656486697980924,"y":0.0},{"x":8.806989104737015,"y":3.295628360308083},{"x":8.957491511493107,"y":0}]}],"marks":[{"type":"line","from":{"data":"c57ddb88-30b1-4616-9f5f-8fb2c4de139f"},"properties":{"enter":{"x":{"scale":"x","field":"data.x"},"y":{"scale":"y","field":"data.y"},"interpolate":{"value":"step-before"},"fill":{"value":"steelblue"},"fillOpacity":{"value":0.4},"stroke":{"value":"steelblue"},"strokeWidth":{"value":2},"strokeOpacity":{"value":1}}}}],"scales":[{"name":"x","type":"linear","range":"width","zero":false,"domain":{"data":"c57ddb88-30b1-4616-9f5f-8fb2c4de139f","field":"data.x"}},{"name":"y","type":"linear","range":"height","nice":true,"zero":false,"domain":{"data":"c57ddb88-30b1-4616-9f5f-8fb2c4de139f","field":"data.y"}}],"axes":[{"type":"x","scale":"x"},{"type":"y","scale":"y"}]},"value":"#gorilla_repl.vega.VegaView{:content {:width 400, :height 247.2188, :padding {:top 10, :left 55, :bottom 40, :right 10}, :data [{:name \"c57ddb88-30b1-4616-9f5f-8fb2c4de139f\", :values ({:x -6.243251570872203, :y 0} {:x -6.0927491641161104, :y 0.3388650128542585} {:x -5.942246757360018, :y 0.0} {:x -5.791744350603926, :y 0.0} {:x -5.641241943847834, :y 0.0} {:x -5.490739537091741, :y 0.0} {:x -5.340237130335649, :y 0.0} {:x -5.189734723579557, :y 0.0} {:x -5.0392323168234645, :y 0.0} {:x -4.888729910067372, :y 0.0} {:x -4.73822750331128, :y 0.0} {:x -4.587725096555188, :y 0.0} {:x -4.437222689799095, :y 0.0} {:x -4.286720283043003, :y 0.0} {:x -4.136217876286911, :y 0.0} {:x -3.9857154695308186, :y 0.0} {:x -3.8352130627747263, :y 0.0} {:x -3.684710656018634, :y 0.0} {:x -3.5342082492625417, :y 0.0} {:x -3.3837058425064495, :y 0.0} {:x -3.233203435750357, :y 0.0} {:x -3.082701028994265, :y 0.0} {:x -2.9321986222381726, :y 0.0} {:x -2.7816962154820803, :y 0.0} {:x -2.631193808725988, :y 0.0} {:x -2.480691401969896, :y 0.0} {:x -2.3301889952138035, :y 0.0} {:x -2.1796865884577112, :y 0.0} {:x -2.029184181701619, :y 0.0} {:x -1.878681774945527, :y 0.0} {:x -1.7281793681894349, :y 0.0} {:x -1.5776769614333428, :y 0.0} {:x -1.4271745546772507, :y 0.0} {:x -1.2766721479211587, :y 0.0} {:x -1.1261697411650666, :y 0.0} {:x -0.9756673344089746, :y 0.0} {:x -0.8251649276528825, :y 0.006644412016750167} {:x -0.6746625208967905, :y 0.0} {:x -0.5241601141406984, :y 0.0} {:x -0.3736577073846063, :y 0.0} {:x -0.22315530062851419, :y 0.0} {:x -0.07265289387242208, :y 0.0} {:x 0.07784951288367004, :y 0.0} {:x 0.22835191963976215, :y 0.0} {:x 0.37885432639585426, :y 0.0} {:x 0.5293567331519464, :y 0.0} {:x 0.6798591399080385, :y 0.0} {:x 0.8303615466641305, :y 0.0} {:x 0.9808639534202226, :y 0.0} {:x 1.1313663601763146, :y 0.0} {:x 1.2818687669324067, :y 0.0} {:x 1.4323711736884988, :y 0.0} {:x 1.5828735804445908, :y 0.0} {:x 1.7333759872006829, :y 0.0} {:x 1.883878393956775, :y 0.0} {:x 2.034380800712867, :y 0.0} {:x 2.1848832074689595, :y 0.0} {:x 2.3353856142250518, :y 0.0} {:x 2.485888020981144, :y 0.0} {:x 2.6363904277372363, :y 0.0} {:x 2.7868928344933286, :y 0.0} {:x 2.937395241249421, :y 0.0} {:x 3.087897648005513, :y 0.0} {:x 3.2384000547616054, :y 0.0} {:x 3.3889024615176977, :y 0.0} {:x 3.53940486827379, :y 0.0} {:x 3.6899072750298822, :y 0.0} {:x 3.8404096817859745, :y 0.0} {:x 3.990912088542067, :y 0.0} {:x 4.141414495298159, :y 0.0199332360502505} {:x 4.291916902054251, :y 0.0} {:x 4.442419308810344, :y 0.0} {:x 4.592921715566436, :y 0.039866472100501} {:x 4.743424122322528, :y 0.0} {:x 4.8939265290786205, :y 0.0} {:x 5.044428935834713, :y 0.0} {:x 5.194931342590805, :y 0.0} {:x 5.345433749346897, :y 0.0} {:x 5.49593615610299, :y 0.0} {:x 5.646438562859082, :y 0.006644412016750167} {:x 5.796940969615174, :y 0.0} {:x 5.947443376371266, :y 0.0} {:x 6.097945783127359, :y 0.0} {:x 6.248448189883451, :y 0.0} {:x 6.398950596639543, :y 0.0} {:x 6.5494530033956355, :y 0.0} {:x 6.699955410151728, :y 0.6312191415912659} {:x 6.85045781690782, :y 0.0} {:x 7.000960223663912, :y 0.0} {:x 7.151462630420005, :y 0.0} {:x 7.301965037176097, :y 0.0} {:x 7.452467443932189, :y 0.0} {:x 7.6029698506882815, :y 0.0} {:x 7.753472257444374, :y 0.0} {:x 7.903974664200466, :y 0.0} {:x 8.054477070956558, :y 0.0} {:x 8.20497947771265, :y 0.0} {:x 8.355481884468741, :y 0.0} {:x 8.505984291224832, :y 2.305610969812308} {:x 8.656486697980924, :y 0.0} {:x 8.806989104737015, :y 3.295628360308083} {:x 8.957491511493107, :y 0})}], :marks [{:type \"line\", :from {:data \"c57ddb88-30b1-4616-9f5f-8fb2c4de139f\"}, :properties {:enter {:x {:scale \"x\", :field \"data.x\"}, :y {:scale \"y\", :field \"data.y\"}, :interpolate {:value \"step-before\"}, :fill {:value \"steelblue\"}, :fillOpacity {:value 0.4}, :stroke {:value \"steelblue\"}, :strokeWidth {:value 2}, :strokeOpacity {:value 1}}}}], :scales [{:name \"x\", :type \"linear\", :range \"width\", :zero false, :domain {:data \"c57ddb88-30b1-4616-9f5f-8fb2c4de139f\", :field \"data.x\"}} {:name \"y\", :type \"linear\", :range \"height\", :nice true, :zero false, :domain {:data \"c57ddb88-30b1-4616-9f5f-8fb2c4de139f\", :field \"data.y\"}}], :axes [{:type \"x\", :scale \"x\"} {:type \"y\", :scale \"y\"}]}}"}
 ;; <=
 
 ;; **

(defquery dirichlet-process-mixture-stick-breaking
  [input-data]
  (let
    [concentration 1.72
     base (fn []
            (let [v (/ 1.0 (sample (gamma 1 10)))]
              (list (sample (normal 0 (sqrt (* v 10)))) 
                    (sqrt v))))
     obs-param (DPmem concentration base)]


(plot/histogram (repeatedly 1000 #(sample* (categorical (vec (empirical-distribution (collect-results smc-states)))))) :normalize :probability-density :bins 100)
;; @@
;; =>
;;; {"type":"vega","content":{"width":400,"height":247.2187957763672,"padding":{"top":10,"left":55,"bottom":40,"right":10},"data":[{"name":"51e28dda-de88-4071-987a-80ae67781ab5","values":[{"x":-18.236384407653375,"y":0},{"x":-17.64083864063221,"y":0.021828716985134774},{"x":-17.045292873611047,"y":0.0},{"x":-16.449747106589882,"y":0.02350784906091437},{"x":-15.854201339568718,"y":0.0},{"x":-15.258655572547553,"y":0.0},{"x":-14.663109805526389,"y":0.0},{"x":-14.067564038505225,"y":0.0},{"x":-13.47201827148406,"y":0.015112188682016383},{"x":-12.876472504462896,"y":0.0},{"x":-12.280926737441732,"y":0.015112188682016383},{"x":-11.685380970420567,"y":0.0},{"x":-11.089835203399403,"y":0.0},{"x":-10.494289436378239,"y":0.0},{"x":-9.898743669357074,"y":0.0},{"x":-9.30319790233591,"y":0.058769622652285934},{"x":-8.707652135314746,"y":0.0},{"x":-8.112106368293581,"y":0.01847045283357558},{"x":-7.516560601272417,"y":0.0},{"x":-6.9210148342512525,"y":0.0},{"x":-6.325469067230088,"y":0.0},{"x":-5.729923300208924,"y":0.015112188682016383},{"x":-5.1343775331877595,"y":0.04197830189448995},{"x":-4.538831766166595,"y":0.026866113212473567},{"x":-3.943285999145431,"y":0.0},{"x":-3.3477402321242673,"y":0.01847045283357558},{"x":-2.7521944651031034,"y":0.09067313209209829},{"x":-2.1566486980819395,"y":0.03694090566715116},{"x":-1.5611029310607756,"y":0.038620037742930755},{"x":-0.9655571640396116,"y":0.026866113212473567},{"x":-0.37001139701844754,"y":0.02518698113669397},{"x":0.22553437000271648,"y":0.06884441510696351},{"x":0.8210801370238805,"y":0.0805983396374207},{"x":1.4166259040450444,"y":0.07220267925852271},{"x":2.0121716710662083,"y":0.045336566046049145},{"x":2.607717438087372,"y":0.01847045283357558},{"x":3.203263205108536,"y":0.04701569812182874},{"x":3.7988089721297,"y":0.04029916981871035},{"x":4.394354739150864,"y":0.04869483019760834},{"x":4.989900506172028,"y":0.04365743397026955},{"x":5.585446273193193,"y":0.04197830189448995},{"x":6.180992040214357,"y":0.10914358492567387},{"x":6.776537807235521,"y":0.013433056606236784},{"x":7.372083574256686,"y":0.01847045283357558},{"x":7.96762934127785,"y":0.05541135850072673},{"x":8.563175108299014,"y":0.031903509439812364},{"x":9.158720875320178,"y":0.02518698113669397},{"x":9.754266642341342,"y":0.0},{"x":10.349812409362507,"y":0.04365743397026955},{"x":10.945358176383671,"y":0.03526177359137156},{"x":11.540903943404835,"y":0.06212788680384513},{"x":12.136449710426,"y":0.0},{"x":12.731995477447164,"y":0.04365743397026955},{"x":13.327541244468328,"y":0.013433056606236784},{"x":13.923087011489493,"y":0.0},{"x":14.518632778510657,"y":0.0},{"x":15.114178545531821,"y":0.01847045283357558},{"x":15.709724312552986,"y":0.021828716985134774},{"x":16.30527007957415,"y":0.05541135850072673},{"x":16.900815846595314,"y":0.020149584909355176},{"x":17.49636161361648,"y":0.0},{"x":18.091907380637643,"y":0.0},{"x":18.687453147658807,"y":0.02518698113669397},{"x":19.282998914679972,"y":0.0},{"x":19.878544681701136,"y":0.0},{"x":20.4740904487223,"y":0.0},{"x":21.069636215743465,"y":0.0},{"x":21.66518198276463,"y":0.021828716985134774},{"x":22.260727749785794,"y":0.02350784906091437},{"x":22.856273516806958,"y":0.0},{"x":23.451819283828122,"y":0.0},{"x":24.047365050849287,"y":0.0},{"x":24.64291081787045,"y":0.0},{"x":25.238456584891615,"y":0.0},{"x":25.83400235191278,"y":0.0},{"x":26.429548118933944,"y":0.0},{"x":27.02509388595511,"y":0.01847045283357558},{"x":27.620639652976273,"y":0.0},{"x":28.216185419997437,"y":0.0},{"x":28.8117311870186,"y":0.030224377364032766},{"x":29.407276954039766,"y":0.0},{"x":30.00282272106093,"y":0.0},{"x":30.598368488082095,"y":0.0},{"x":31.19391425510326,"y":0.0},{"x":31.789460022124423,"y":0.0},{"x":32.38500578914559,"y":0.0},{"x":32.98055155616675,"y":0.0},{"x":33.576097323187916,"y":0.0},{"x":34.17164309020908,"y":0.0},{"x":34.767188857230245,"y":0.0},{"x":35.36273462425141,"y":0.0},{"x":35.958280391272574,"y":0.0},{"x":36.55382615829374,"y":0.0},{"x":37.1493719253149,"y":0.0},{"x":37.74491769233607,"y":0.0},{"x":38.34046345935723,"y":0.0},{"x":38.936009226378395,"y":0.0},{"x":39.53155499339956,"y":0.0},{"x":40.127100760420724,"y":0.0},{"x":40.72264652744189,"y":0.0},{"x":41.31819229446305,"y":0.011753924530457186},{"x":41.91373806148422,"y":0}]}],"marks":[{"type":"line","from":{"data":"51e28dda-de88-4071-987a-80ae67781ab5"},"properties":{"enter":{"x":{"scale":"x","field":"data.x"},"y":{"scale":"y","field":"data.y"},"interpolate":{"value":"step-before"},"fill":{"value":"steelblue"},"fillOpacity":{"value":0.4},"stroke":{"value":"steelblue"},"strokeWidth":{"value":2},"strokeOpacity":{"value":1}}}}],"scales":[{"name":"x","type":"linear","range":"width","zero":false,"domain":{"data":"51e28dda-de88-4071-987a-80ae67781ab5","field":"data.x"}},{"name":"y","type":"linear","range":"height","nice":true,"zero":false,"domain":{"data":"51e28dda-de88-4071-987a-80ae67781ab5","field":"data.y"}}],"axes":[{"type":"x","scale":"x"},{"type":"y","scale":"y"}]},"value":"#gorilla_repl.vega.VegaView{:content {:width 400, :height 247.2188, :padding {:top 10, :left 55, :bottom 40, :right 10}, :data [{:name \"51e28dda-de88-4071-987a-80ae67781ab5\", :values ({:x -18.236384407653375, :y 0} {:x -17.64083864063221, :y 0.021828716985134774} {:x -17.045292873611047, :y 0.0} {:x -16.449747106589882, :y 0.02350784906091437} {:x -15.854201339568718, :y 0.0} {:x -15.258655572547553, :y 0.0} {:x -14.663109805526389, :y 0.0} {:x -14.067564038505225, :y 0.0} {:x -13.47201827148406, :y 0.015112188682016383} {:x -12.876472504462896, :y 0.0} {:x -12.280926737441732, :y 0.015112188682016383} {:x -11.685380970420567, :y 0.0} {:x -11.089835203399403, :y 0.0} {:x -10.494289436378239, :y 0.0} {:x -9.898743669357074, :y 0.0} {:x -9.30319790233591, :y 0.058769622652285934} {:x -8.707652135314746, :y 0.0} {:x -8.112106368293581, :y 0.01847045283357558} {:x -7.516560601272417, :y 0.0} {:x -6.9210148342512525, :y 0.0} {:x -6.325469067230088, :y 0.0} {:x -5.729923300208924, :y 0.015112188682016383} {:x -5.1343775331877595, :y 0.04197830189448995} {:x -4.538831766166595, :y 0.026866113212473567} {:x -3.943285999145431, :y 0.0} {:x -3.3477402321242673, :y 0.01847045283357558} {:x -2.7521944651031034, :y 0.09067313209209829} {:x -2.1566486980819395, :y 0.03694090566715116} {:x -1.5611029310607756, :y 0.038620037742930755} {:x -0.9655571640396116, :y 0.026866113212473567} {:x -0.37001139701844754, :y 0.02518698113669397} {:x 0.22553437000271648, :y 0.06884441510696351} {:x 0.8210801370238805, :y 0.0805983396374207} {:x 1.4166259040450444, :y 0.07220267925852271} {:x 2.0121716710662083, :y 0.045336566046049145} {:x 2.607717438087372, :y 0.01847045283357558} {:x 3.203263205108536, :y 0.04701569812182874} {:x 3.7988089721297, :y 0.04029916981871035} {:x 4.394354739150864, :y 0.04869483019760834} {:x 4.989900506172028, :y 0.04365743397026955} {:x 5.585446273193193, :y 0.04197830189448995} {:x 6.180992040214357, :y 0.10914358492567387} {:x 6.776537807235521, :y 0.013433056606236784} {:x 7.372083574256686, :y 0.01847045283357558} {:x 7.96762934127785, :y 0.05541135850072673} {:x 8.563175108299014, :y 0.031903509439812364} {:x 9.158720875320178, :y 0.02518698113669397} {:x 9.754266642341342, :y 0.0} {:x 10.349812409362507, :y 0.04365743397026955} {:x 10.945358176383671, :y 0.03526177359137156} {:x 11.540903943404835, :y 0.06212788680384513} {:x 12.136449710426, :y 0.0} {:x 12.731995477447164, :y 0.04365743397026955} {:x 13.327541244468328, :y 0.013433056606236784} {:x 13.923087011489493, :y 0.0} {:x 14.518632778510657, :y 0.0} {:x 15.114178545531821, :y 0.01847045283357558} {:x 15.709724312552986, :y 0.021828716985134774} {:x 16.30527007957415, :y 0.05541135850072673} {:x 16.900815846595314, :y 0.020149584909355176} {:x 17.49636161361648, :y 0.0} {:x 18.091907380637643, :y 0.0} {:x 18.687453147658807, :y 0.02518698113669397} {:x 19.282998914679972, :y 0.0} {:x 19.878544681701136, :y 0.0} {:x 20.4740904487223, :y 0.0} {:x 21.069636215743465, :y 0.0} {:x 21.66518198276463, :y 0.021828716985134774} {:x 22.260727749785794, :y 0.02350784906091437} {:x 22.856273516806958, :y 0.0} {:x 23.451819283828122, :y 0.0} {:x 24.047365050849287, :y 0.0} {:x 24.64291081787045, :y 0.0} {:x 25.238456584891615, :y 0.0} {:x 25.83400235191278, :y 0.0} {:x 26.429548118933944, :y 0.0} {:x 27.02509388595511, :y 0.01847045283357558} {:x 27.620639652976273, :y 0.0} {:x 28.216185419997437, :y 0.0} {:x 28.8117311870186, :y 0.030224377364032766} {:x 29.407276954039766, :y 0.0} {:x 30.00282272106093, :y 0.0} {:x 30.598368488082095, :y 0.0} {:x 31.19391425510326, :y 0.0} {:x 31.789460022124423, :y 0.0} {:x 32.38500578914559, :y 0.0} {:x 32.98055155616675, :y 0.0} {:x 33.576097323187916, :y 0.0} {:x 34.17164309020908, :y 0.0} {:x 34.767188857230245, :y 0.0} {:x 35.36273462425141, :y 0.0} {:x 35.958280391272574, :y 0.0} {:x 36.55382615829374, :y 0.0} {:x 37.1493719253149, :y 0.0} {:x 37.74491769233607, :y 0.0} {:x 38.34046345935723, :y 0.0} {:x 38.936009226378395, :y 0.0} {:x 39.53155499339956, :y 0.0} {:x 40.127100760420724, :y 0.0} {:x 40.72264652744189, :y 0.0} {:x 41.31819229446305, :y 0.011753924530457186} {:x 41.91373806148422, :y 0})}], :marks [{:type \"line\", :from {:data \"51e28dda-de88-4071-987a-80ae67781ab5\"}, :properties {:enter {:x {:scale \"x\", :field \"data.x\"}, :y {:scale \"y\", :field \"data.y\"}, :interpolate {:value \"step-before\"}, :fill {:value \"steelblue\"}, :fillOpacity {:value 0.4}, :stroke {:value \"steelblue\"}, :strokeWidth {:value 2}, :strokeOpacity {:value 1}}}}], :scales [{:name \"x\", :type \"linear\", :range \"width\", :zero false, :domain {:data \"51e28dda-de88-4071-987a-80ae67781ab5\", :field \"data.x\"}} {:name \"y\", :type \"linear\", :range \"height\", :nice true, :zero false, :domain {:data \"51e28dda-de88-4071-987a-80ae67781ab5\", :field \"data.y\"}}], :axes [{:type \"x\", :scale \"x\"} {:type \"y\", :scale \"y\"}]}}"}
;; <=

;; @@

;; @@
