November 6, 2015
- Bill Tozier
- email: bill@vagueinnovation.com
- twitter/github: @Vaguery
November 6, 2015
Every Clojush instruction registered in any file in the Clojush repo, including a few that are commented out.
| (ns my-clojush.polynomials | |
| (:use [clojush.stuff.whatever])) | |
| ;; define the new domain type and giving it useful protocols | |
| (defrecord Polynomial [constants] ...) | |
| ;; convenience functions | |
| (defn make-polynomial ...) | |
| ;; thoroughly tested domain-specific Clojure functions |
it includes some multi-paragraph items
x = y + 1| ;; I've used «» to indicate the results of applying an instruction to arguments | |
| ;; initial state | |
| EXEC: (exec_dup (\space \newline in1 string_replacechar) print_string \newline string_removechar string_length) | |
| ;; program gets "unwrapped" | |
| EXEC: exec_dup (\space \newline in1 string_replacechar) print_string \newline string_removechar string_length | |
| ;; duplicate next item on exec | |
| EXEC: (\space \newline in1 string_replacechar) (\space \newline in1 string_replacechar) print_string \newline string_removechar string_length |
| ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( | |
| ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( | |
| (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((64*5)/2)+x)*(x+((60-26)-(x-x))))+85)-x)/41)/60)+(42/51))* | |
| (x*x))-52)-(x+33))+x)+(46-(x*x)))+49)-90)-x)*(x*x))-10)*x)*(74*64))+((54+(x*x))/82))*(44*(((86*x)-x)-68)))-26)*(95- | |
| x))*((75*(x-7))+93))/78)-68)-47)/((x-x)-26))+x)-(x+x))*x)-13)*75)-(x-7))*x)+(x+x))*49)-(18+(x/(48+x))))/(x-41))*0)+x)* | |
| (37-x))-x)-62)-68)+x)/10)-x)*x)/96)-x)/(82+x))+59)+(x*92))-22)-(74-x))-x)*(79-x))+95)+x)-x)*x)-6)/21)+((x-85)*x))+ | |
| (x/39))+95)/(63+49))-x)-x)*((x/83)*x))+x)+((x*x)/56))+x)-(((62-x)-(61*29))+(x+37)))/(x+3))/14)/18)+x)+14)*((((x-x)* | |
| 86)+x)-(98*(x-x))))*x)*((x-((33-35)*x))-(x/(x-74))))-(x-67))-x)-x)/31)+28)*x)+(5+x))-96)-(x-((x-(x-75))*(17-(x/((x+ | |
| 14)+x))))))+((x*x)+((x*(x*(((x*((x-(x*(61*83)))+x))-87)*67)))-x)))-x)*x)*52)-3)*84)-54)/73)+7 |
brew doctorbrew listbrew install python3brew linkapps python3 [per instructions]pip3 install --upgrade pip setuptools [per instructions]pip3 install "ipython[notebook]" [per the iPython page]pip3 install "ipython[test]" (to get nose testing working in notebooks)brew install pyqtbrew linkapps qt| Patterns in [10, 1, 3, 2, 8, 9, 5, 4, 6, 7]: | |
| [10, 1, 3] => 312 | |
| [10, 1, 2] => 312 | |
| [10, 1, 8] => 312 | |
| [10, 1, 9] => 312 | |
| [10, 1, 5] => 312 | |
| [10, 1, 4] => 312 | |
| [10, 1, 6] => 312 | |
| [10, 1, 7] => 312 | |
| [10, 3, 2] => 321 |
(N.B.: the combinatorics have not been checked carefully, and I've had a lovely glass of wine or two)
Here's a very nice introduction to the current (and rather lively) world of permutation patterns, and forbidden patterns, in sequences of numbers or letters or DNA base pairs or thingies you can sort.
Salient bit for my purposes at the moment:
Start with an arbitrary sequence of numbers (all different, for the moment). For example look at this random sequence of 7 integers I just made my computer puke out (using Ruby, so that's the notational convention I'll stick with here):
Simplest definition I can come up with for his original formulation: