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
#### Clock Ticking Model #### | |
fs = require 'fs'; | |
## Probably, clock should be global rather than per function | |
clock = (f) -> | |
cache = {} | |
(args...) -> | |
time = args[0] |
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
(++ (print "name:") | |
(read) | |
(FN :name | |
(read) | |
(FN :age | |
(print (str "hello, " name " of age " age)) | |
(getJson "http://...") | |
(FN :result ...)))))) | |
;;=> ["name: " print read :name name | |
;; "age: " print read :age name |
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
;;;; 2013 Minori Yamashita <[email protected]> | |
;;;; MIT | |
(defmacro deftransition | |
"Define a function that receives the current state and returns a patch to it. | |
The patch returned will get conjed onto the state. | |
Use `watch-transition` to react to the state change." | |
[name params & body] | |
`(defn ~name [app# & pars#] | |
(let [diff# (apply (fn ~params ~@body) (cons @app# pars#)) |
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
;;nadeko | |
(= fact n | |
(=? n 0 | |
1 | |
(* n (fact (- n 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
["ABAP", | |
"ActionScript", | |
"Ada", | |
"Apex", | |
"AppleScript", | |
"Arc", | |
"Arduino", | |
"ASP", | |
"Assembly", | |
"Augeas", |
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 experiment | |
(:use [cljs.core.async :only [>! <! chan timeout put!]]) | |
(:use-macros [cljs.core.async.macros :only [go]])) | |
;;; Wire events to a channel. Channels are like blocking queues. | |
(def clicker | |
(let [c (chan)] | |
(.addEventListener js/document "click" (fn [] (put! c "clicked"))) | |
c)) |
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
(require '[clojure.core.async :as async :refer :all]) | |
(defn map-chan [f in] | |
(let [c (chan)] | |
(go (loop [] | |
(>! c (f (<! in))) | |
(recur))) | |
c)) | |

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 castorocauda.example | |
(:require [castorocauda.core :as castorocauda]) | |
(:use [castorocauda.util :only [dom-ready q-select]] | |
[castorocauda.timeline :only [tl-map tl-filter tl-merge dom-events]]) | |
(:use-macros [castorocauda.macros :only [run-app]])) | |
(defn render-all [{:keys [a b result] | |
:or {a 0, b 0, result 0}}] | |
[:div |
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
<?php | |
namespace Tweets; | |
//type Tweet = ["id" => String, | |
// "name" => String, | |
// "text" => String, | |
// "deleted" => Boolean] | |
//String * String -> Tweet | |
function mkTweet ($name, $text) { |