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 fibonacci [n] | |
(letfn [(power-accumulate-positive [r a n op] | |
(let [r (if (odd? n) (op r a) r)] | |
( if (= 1 n) r (recur r (op a a) (bigint (/ n 2)) op)))) | |
(power [a n op] | |
(if (odd? n) | |
(let [n (bigint (/ n 2))] | |
(if (zero? n) a (power-accumulate-positive a (op a a) n op))) | |
(recur (op a a) (bigint (/ n 2)) op))) | |
(fibonacci-matrix-multiply [[x0 x1] [y0 y1]] |
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
#!/usr/bin/env bash | |
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" | |
wget -q "http://mary.dfki.de:59125/process?INPUT_TYPE=TEXT&OUTPUT_TYPE=AUDIO&INPUT_TEXT="$(cat ${input} | od -An -tx1 | tr ' ' % | xargs printf "%s")"&OUTPUT_TEXT=&effect_Volume_selected=&effect_Volume_parameters=amount%3A2.0%3B&effect_Volume_default=Default&effect_Volume_help=Help&effect_TractScaler_selected=&effect_TractScaler_parameters=amount%3A1.5%3B&effect_TractScaler_default=Default&effect_TractScaler_help=Help&effect_F0Scale_selected=&effect_F0Scale_parameters=f0Scale%3A2.0%3B&effect_F0Scale_default=Default&effect_F0Scale_help=Help&effect_F0Add_selected=&effect_F0Add_parameters=f0Add%3A50.0%3B&effect_F0Add_default=Default&effect_F0Add_help=Help&effect_Rate_selected=&effect_Rate_parameters=durScale%3A1.5%3B&effect_Rate_default=Default&effect_Rate_help=Help&effect_Robot_selected=&effect_Robot_parameters=amount%3A100.0%3B&effect_Robot_default=Default&effect_Robot_help=Help&effect_Whisper_selected=&effect_Whisper_parameters=amount%3A10 |
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 interpret.core | |
(:require [instaparse.core :as insta]) | |
(:import (clojure.asm Opcodes Type ClassWriter) | |
(clojure.asm.commons Method GeneratorAdapter)) ) | |
(def parser-arith | |
(insta/parser | |
"<expr> = spaces add-sub spaces | |
<add-sub> = mul-div | add | sub | |
add = add-sub spaces <'+'> spaces mul-div |
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
import turtle | |
import math | |
import random | |
import sys | |
# point is (x,y,z) float cooords | |
# polygon is ([points], color) is oriented for vector product to know if facing | |
# object is [polygons] is convex (cf. orientation) | |
# rotating_object is (object, (a,(u,v,w)) angle and axis of rotation (center of rotation is barycenter of object) | |
# figure is [rotating_objects] |
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
import math | |
import turtle | |
def rotate(a, v): | |
(x, y)= v | |
return (math.cos(a)*x - math.sin(a)*y, math.sin(a)*x + math.cos(a)*y) | |
def demo0(n): | |
angle_step= 2*math.pi/n | |
p= (0,100) |
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
;; cf https://github.com/aengelberg/loco/blob/master/test/loco/integer/sendmoremoney1.clj | |
(ns constrained-grouping.core | |
(:use loco.constraints | |
loco.core)) | |
(defn initialize-digits [vars] | |
(for [v vars] | |
($in v 0 9))) | |
(def letters |
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 physics-demos.fractals | |
(:require | |
[thi.ng.geom.core :as g] | |
[thi.ng.geom.core.vector :as v :refer [vec2 vec3]] | |
[thi.ng.geom.core.matrix :as mat :refer [M32 M44]] | |
[thi.ng.geom.circle :as c] | |
[thi.ng.geom.spatialtree :as accel] | |
[thi.ng.geom.svg.core :as svg] | |
[thi.ng.geom.physics.core :as phys] | |
[thi.ng.geom.webgl.animator :refer [animate]] |
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
public class GoGUI { | |
final static int SIZE= 8; | |
final static double EMPTY_RADIUS=0.1; | |
final static double STONE_RADIUS=0.45; | |
final static String PASS_STRING= "PASS"; | |
final static int PASS_X=0; | |
public static void main(String args[]){ | |
StdDraw.setXscale(-1, SIZE); | |
StdDraw.setYscale(-1, SIZE); |
OlderNewer