Brian Heim 2018-06-19
- Introduction
FourteenBitCC { | |
/* | |
//Use Case: | |
MIDIIn.connectAll; | |
~x = FourteenBitCC.new("x", 72, 104); | |
~x.func = {|val| ("x: "++val).postln}; | |
//MPE Example with Sensel Morph | |
MIDIIn.connectAll |
(ns blog.errors.core | |
(:require-macros | |
[cljs.core.async.macros :refer [go]] | |
[blog.utils.macros :refer [<?]]) | |
(:require | |
[cljs.core.async :refer [>! <! chan close!]])) | |
;; convert Node.js async function into a something | |
;; that returns a value or error on a channel | |
(defn run-task [f & args] |
(ns om-data.core | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[datascript :as d])) | |
(enable-console-print!) | |
(def schema {}) | |
(def conn (d/create-conn schema)) | |
(defui Artist | |
static IQuery | |
(query [cl _] | |
[:db/id :artist/name]) | |
Object | |
(render [{:keys [props]}] | |
(dom/div nil (:artist/name props)))) | |
(defui ArtistList | |
static IQuery |
(defn get-square [rows x y] | |
(for [x (range x (+ x 3)) | |
y (range y (+ y 3))] | |
(get-in rows [x y]))) | |
(defn init [vars hints] | |
(if (seq vars) | |
(let [hint (first hints)] | |
(all | |
(if-not (zero? hint) |
(ns logic.y | |
(:refer-clojure :exclude [== reify inc]) | |
(:use [clojure.core.logic minikanren prelude | |
nonrel match])) | |
(defna findo [x l o] | |
([_ [[?y :- o] . _] _] | |
(project [x ?y] (== (= x ?y) true))) | |
([_ [_ . ?c] _] (findo x ?c o))) |
NOTE: This proposal is dead. A simpler solution was arrived at via the new `:bundle` target.
The current Webpack solution works reasonable well for application oriented development, but does not address the wider issue of developing ClojureScript libraries that depend on the wider JavaScript ecosystem where the artifacts do not reside in Java-centric distrubtion like Maven (i.e. NPM). Currently a ClojureScript library cannot express these kinds of foreign library dependencies at all. Thus users must constantly redefine basic dependencies from NPM such as React, boilerplate Webpack configuration, boilerplate import/export files, and thus cannot create and share reusable ClojureScript components that depend on this vast ecosystem.
Add a new :target
option, :bundle
. When this target is set :nodejs
is true
and :nodejs-rt
is false
. We want to take advantage of the fact that the :nodejs
target
emits Node.js require
for libs found in node_modules
. :nodejs-rt false
clarifies that
we are not actually going to target the Node.js runtime.
The :bundle
target always generates an index.js
file, it need only be created once.
The contents of index.js looks like the following:
( | |
var notes, synths, on, off, mod, bend, touch; | |
~num_channels = 8; | |
~bend_range = 24; | |
MIDIIn.connectAll; | |
notes = Array.newClear(~num_channels); | |
synths = Array.newClear(~num_channels); |