This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env th | |
| local distrib = require 'distributions' | |
| local cephes = require 'cephes' | |
| local function logp_studentT(x, mu, chol_sigma, v) | |
| local lgam = cephes.lgam | |
| local d = mu:size(1) | |
| local inv_sigma = torch.potri(chol_sigma) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; From https://groups.google.com/forum/?fromgroups#!msg/clojure/CqV6smX3R0o/-FRxB8pTu1EJ | |
| (defn keyword? [x] | |
| (instance? clojure.lang.Keyword x)) | |
| (defmacro defnk [sym args & body] | |
| (let [pos-keys (split-with (complement keyword?) args) | |
| ps (pos-keys 0) | |
| ks (apply array-map (pos-keys 1)) | |
| gkeys (gensym "gkeys__") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is just pseudocode, haven't tested it. | |
| s = []; | |
| s.push((root, False)); | |
| while !s.empty(): | |
| node, seen = s.pop(); | |
| if !seen: | |
| if node.right: | |
| s.push((node.right, False)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns blah.core | |
| (:require [clojure.string :as string]) | |
| (:use lamina.core) | |
| (:use [aleph.http :as http] | |
| [aleph.formats :as formats])) | |
| (defn get-content-channel [url] | |
| (run-pipeline | |
| url | |
| #(http/http-request {:method :get :url %1}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Implement this! | |
| # Look here for answer: http://www.rfc1149.net/blog/2011/01/07/the-third-readers-writers-problem/ |