This file contains 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 overtone-tutorial.mary) | |
(use 'overtone.core) | |
(boot-external-server) | |
(definst saw-wave [freq 440 attack 0.01 sustain 0.4 release 0.1 vol 0.4] | |
(* (env-gen (lin-env attack sustain release) 1 1 0 1 FREE) | |
(saw freq) | |
vol)) |
This file contains 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
INFO - Starting navdata stream | |
INFO - Creating navdata stream | |
INFO - navdata: {:altitude 0.0, :control-state :default, :seq-num 22291} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am too low | |
INFO - navdata: {:altitude 0.0, :control-state :landed, :seq-num 22292} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed | |
INFO - navdata: {:altitude 0.0, :control-state :trans-takeoff, :seq-num 22293} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed | |
INFO - navdata: {:altitude 0.0, :control-state :trans-takeoff, :seq-num 22294} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed |
This file contains 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 clj-drone.core | |
(:import (java.net DatagramPacket DatagramSocket InetAddress))) | |
(def drone-host (InetAddress/getByName "192.168.1.1")) | |
(def at-port 5556) | |
(def socket (DatagramSocket. )) | |
(defn send-command [data] | |
(.send socket |
This file contains 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
defn change-for [change coins returning] | |
(let [ coin (first coins) | |
others (rest coins) | |
] | |
(cond | |
(= change 0) returning | |
(>= change coin) (change-for (mod change coin) others (conj returning {coin (int (/ change coin))})) | |
:else (change-for change others returning)))) | |
(defn make-change [price tendered] |
This file contains 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 reducers.core | |
(:require [clojure.core.reducers :as r])) | |
(map + [1 2 3]) ;=> (1 2 3) | |
(class(map + [1 2 3])) ;=> (1 2 3) | |
(def odyssey-text (slurp "odyssey.txt")) | |
(class odyssey-text) ;=> java.lang.String | |
(first odyssey-text) ;=> \P |
This file contains 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
;; given 3 integers in a sequence | |
;; generate the number of lights that are on in a berlin clock, | |
;; returning 5 rows | |
(defn make-counts [[hours minutes seconds]] | |
[ | |
(- 1 (mod seconds 2)) | |
(int (/ hours 5)) | |
(mod hours 5) | |
(int (/ minutes 5)) | |
(mod minutes 5) |
This file contains 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
1) Get a browser open to http://23.23.246.103:8080 (you will need this later) | |
2) Download the private key for swarming http://23.23.246.103:8080/keys/cincyfp | |
3) ssh -i cincyfp [email protected] | |
Follow the instructions when you get in! | |
This file contains 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
;; Current version -- note the use of `when-valid`... it is essentially duplicating the work the | |
;; syntax-validation-m monad should be able to handle, so I've been attempting to | |
;; clean it up / refactor it to use only the monad | |
(defmacro expect | |
"Run the call form, check that all the mocks defined in the fakes | |
(probably with 'fake') have been satisfied, and check that the actual | |
results are as expected. If the expected results are a function, it | |
will be called with the actual result as its single argument. |
This file contains 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
;; Current version -- note the use of `when-valid`... it is essentially duplicating the work the | |
;; syntax-validation-m monad should be able to handle, so I've been attempting to | |
;; clean it up / refactor it to use only the monad | |
(defmacro expect | |
"Run the call form, check that all the mocks defined in the fakes | |
(probably with 'fake') have been satisfied, and check that the actual | |
results are as expected. If the expected results are a function, it | |
will be called with the actual result as its single argument. |
This file contains 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 roman-nums | |
(:use clojure.test)) | |
(def chart (zipmap [1 4 5 9 10 40 50 90 100 400 500 900 1000] | |
["I" "IV" "V" "IX" "X" "XL" "L" "XC" "C" "CD" "D" "CM" "M"])) | |
;; Using no tail recursion | |
(defn arabic-to-roman [n] | |
(let [[val c] (last |