Original text from http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.html
From: Mark Jason Dominus <mjd@plover.com>
Date: Jul 28, 2005 11:16 PM
Subject: Re: HOP -vs- SICP
(ns big-bang.examples.unknown-pleasures | |
(:require | |
[jayq.core :refer [show]] | |
[enchilada :refer [ctx canvas canvas-size value-of]] | |
[big-bang.examples.unknown-pleasures.data :refer [data-points]] | |
[monet.canvas :refer [begin-path move-to line-to close-path | |
fill fill-rect fill-style | |
stroke-join stroke-cap stroke-width stroke-style stroke | |
translate scale save restore]])) |
Original text from http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.html
From: Mark Jason Dominus <mjd@plover.com>
Date: Jul 28, 2005 11:16 PM
Subject: Re: HOP -vs- SICP
import struct | |
import spidev | |
import sys | |
import time | |
import random | |
import RPi.GPIO as gpio | |
ascii = [ | |
[ 0x55, 0x00, 0x55, 0x00, 0x55 ], | |
[ 0x55, 0x00, 0x55, 0x00, 0x55 ], |
(ns lindenmayer-systems.demo | |
(:use [turtle.core :only [draw!]] | |
[turtle.renderer.vector :only [->svg]] | |
[turtle.renderer.canvas :only [->canvas]] | |
[enchilada :only [ctx canvas svg]] | |
[dommy.core :only [set-html! insert-after! replace! hide! show!]] | |
[jayq.core :only [show]]) | |
(:use-macros [dommy.macros :only [sel1]])) | |
(def L '(:left 36)) |
(ns quadratic-residue.demo.core) | |
(defn follow [lookup-table] | |
(fn [n] | |
(loop [k n | |
edges {}] | |
(let [next-k (lookup-table k)] | |
(if (edges next-k) | |
edges | |
(recur next-k (assoc edges k next-k))))))) |
(ns big-bang.example.cat-animation | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [enchilada :refer [canvas ctx canvas-size proxy-request]] | |
[cljs.core.async :as async :refer [<!]] | |
[dataview.loader :refer [fetch-image]] | |
[big-bang.core :refer [big-bang!]] | |
[jayq.core :refer [show attr]])) | |
(defn increment-and-wrap [x] | |
(if (< x 800) |
Move the mouse around to see a demonstration of Big-Bang mouse-move event handling. Big-bang uses core.async to handle events in a reactive manner, dispatching to relevant state-handlers so that manipulating state occurs in a purely functional manner.
In the code below, the update function is only fired when a new mouse-move event is delivered to big-bang's event loop. It is passed the event and the current 'world-state', of which it returns a modified version. The render function is invoked on a javascript requestAnimationFrame() callback only if the world state has been changed.
Big-bang is a new library, and is subject to ongoing change, but supports a flexible architecture which allows:
<canvas>
, but as demonstrated below there is no restriction)Move the mouse around the page, and watch as OM reactively sets the co-ordinates. This was slightly modified from David Nolan's examples at https://github.com/swannodette/om/blob/master/examples/mouse/src/core.cljs to add a <div id="app"></div>
programmatically. I imagine there's an official OM way to splice components into a page, but used Dommy instead ... FTW.
Compare and contrast to the equivalent Big-Bang version: http://programming-enchiladas.destructuring-bind.org/rm-hull/8617788
#include <nall/platform.hpp> | |
#include <nall/stdint.hpp> | |
using namespace nall; | |
extern "C" { | |
void filter_size(unsigned&, unsigned&); | |
void filter_render(uint32_t*, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); | |
}; | |
enum { |