NB this moved to https://docs.google.com/spreadsheets/d/1v_3tHbRJyLBEzdJQ1JMtOdNVOZG9DhH0f1lIxgLYdqs/edit?usp=sharing
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 latinsq.core | |
(:use [clojure.set :only (difference)])) | |
(defn replace-at | |
"in string s, replaces character at index p with c" | |
[s p c] | |
(str | |
(.substring s 0 p) | |
c |
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 json | |
import urllib2 | |
import sys | |
try: | |
input = json.loads(''.join(sys.stdin.readlines()))['body'] | |
except: | |
input="" | |
if input == "": |
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 void handleRequest(ScrapeReq input) throws Exception { | |
FlowFuture<ScrapeResp> scrapes = currentFlow().invokeFunction("./scraper", input, ScrapeResp.class); | |
scrapes.thenCompose(resp -> { | |
List<ScrapeResp.ScrapeResult> results = resp.result; | |
List<FlowFuture<?>> pendingTasks = results | |
.stream() |
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
FROM debian:sid-slim | |
ADD jdk-10-ea+39_linux-x64_bin.tar.gz /java | |
ENTRYPOINT ["/java/jdk-10/bin/jshell", "-q"] |
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
--- host.flags 2018-01-16 13:09:27.257621324 +0000 | |
+++ container.flags 2018-01-16 13:12:20.832503747 +0000 | |
@@ -56,7 +56,7 @@ | |
bool C1ProfileInlinedCalls = true {C1 product} {default} | |
bool C1ProfileVirtualCalls = true {C1 product} {default} | |
bool C1UpdateMethodData = true {C1 product} {default} | |
- intx CICompilerCount = 18 {product} {ergonomic} | |
+ intx CICompilerCount = 15 {product} {ergonomic} | |
bool CICompilerCountPerCPU = true {product} {default} | |
bool CITime = false {product} {default} |
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
;; A polynomial was produced by my GP to fit points generated by this function in the range [-10 <= a < 10]: | |
(def archetype (fn [a] (if (pos? a) 1 0))) | |
;; The results | |
(clojure.pprint/pprint (for [x (range -10 10)] (generated x))) | |
;; => (-0.00350264540310313 | |
;; 0.0024697321715263917 | |
;; -0.0034714670565933682 |
Test | Implementation |
---|---|
2 is prime | return true; |
3 is prime | return true; |
4 is not prime | return n!=4; |
5 is prime | return n!=4; |
6 is not prime | return true unless n is even |
7 is prime | return true unless n is even |
8 is not prime | return true unless n is even |
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
;; Rewrite of https://en.wikipedia.org/wiki/A*_search_algorithm#Pseudocode in a functional way | |
#?(:cljs (def INFINITY 9007199254740991)) ;; Math.pow(2,53)-1 | |
#?(:clj (def INFINITY Integer/MAX_VALUE)) | |
(defn a* | |
([graph start goal heuristic] (a* graph start goal heuristic | |
#{start} #{} {} | |
{start 0} {start (heuristic start goal)})) | |
([graph start goal h |
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
line 21 sidesteps the fact that Math/abs doesn't work for clojure's Rational (ie fractional) datatype. |