Few days ago Mike Anderson wrote [a proposal][mike] for a generic matrix API in Clojure which could compete with NumPy. I wanted to write a similar post for months, but was reluctant to start. This problem is very dear to me. Basically, it is a matter if I can use Clojure for most of my work, or it remains a toy language for me. Thanks to Mike for bringing the question up. Though, I have a different vision of how we should approach arrays and matrices in Clojure.
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 a Haskell implementation of aphyr's | |
| -- "Clojure from the ground up - modeling" | |
| -- | |
| -- http://aphyr.com/posts/312-clojure-from-the-ground-up-modeling | |
| -- | |
| -- Compile this with: | |
| -- | |
| -- $ ghc -O Rocket.hs | |
| import GHC.Exts |
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 now in a library: https://github.com/cemerick/shoreleave-remote-ring | |
| (ns ^{:doc "Server-side RPC support for use with shoreleave (and maybe fetch?). | |
| Mostly copied from https://github.com/shoreleave/shoreleave-remote-noir; | |
| changed to eliminate the noir-isms..."} | |
| cemerick.cljs.rpc) | |
| (def default-remote-uri "/_fetch") | |
| (def remotes (atom {})) |
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
| ;; using defc from core.logic master | |
| ;; guarantee that a path of keys does not occur in map x, | |
| ;; note that the body of a defc is in fact just regular | |
| ;; Clojure code | |
| (defc not-pathc [x path] | |
| (= (get-in x path :not-found) :not-found)) | |
| (comment |
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 speed-test.core | |
| ;; Original Java Source | |
| (:import LCS)) | |
| (set! *warn-on-reflection* true) | |
| (defn time-it [num-trials f] | |
| (loop [sum-ms 0 trials-left num-trials] | |
| (let [start (System/currentTimeMillis)] | |
| (f) |
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
| ;; I wrote this in the Eurostar on my way back from the last lambdanext.eu clojure course. | |
| (ns comprehensions | |
| (:refer-clojure :exclude [for doseq]) | |
| (:require [clojure.core.reducers :as r])) | |
| ;; borrowed from clojure.core | |
| (defmacro ^{:private true} assert-args | |
| [& pairs] | |
| `(do (when-not ~(first pairs) |
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
| macro thread { | |
| case { $name ($args (,) ...) { $body ... } } => { | |
| var result = makeIdent('$_', #{$name}) | |
| return withSyntax($$_ = [result]) { | |
| console.log('here') | |
| return #{ | |
| (function () { | |
| var $$_ = arguments.length > 1 ? [].slice.call(arguments) : arguments[0]; | |
| thread_body $$_ $body ...; | |
| return $$_ |
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
| # WINDOWS | |
| # ======= | |
| # This assumes you already have chocolatey installed: | |
| # From cmd.exe: | |
| # @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin | |
| # From powershell: | |
| # iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
| # | |
| # This assumes you have vagrant already installed: | |
| # cinst vagrant |
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
| /** | |
| * asm-helpers.js | |
| * A simple helper module for managing memory allocation of | |
| * collections of objects, particularly for use in asm.js code | |
| * | |
| * Copyright (c) 2013 Jasper Palfree <jasper@wellcaffeinated.net> | |
| * Licensed MIT | |
| */ | |
| (function (root, factory) { | |
| if (typeof exports === 'object') { |
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
| A list of features that we want to see in CouchDB. Needs to be voted on so that it can become a priority queue. | |
| User Facing Features | |
| ==================== | |
| 1. Conflicts are the rule, not the exception | |
| All previous versions of CouchDB hide conflicts by default (selecting | |
| an arbitrary but consistent winning revision). Expert users can find | |
| and resolve conflicts. |
OlderNewer