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
| Exception in thread "Thread-3" SocketException The transport's socket appears to have lost its connection to the nREPL server | |
| clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 137} | |
| at clojure.core$ex_info.invoke(core.clj:4403) | |
| at leiningen.core.eval$fn__6725.invoke(eval.clj:236) | |
| at clojure.lang.MultiFn.invoke(MultiFn.java:231) | |
| at leiningen.core.eval$eval_in_project.invoke(eval.clj:337) | |
| at leiningen.repl$server$fn__10717.invoke(repl.clj:241) | |
| at clojure.lang.AFn.applyToHelper(AFn.java:152) | |
| at clojure.lang.AFn.applyTo(AFn.java:144) | |
| at clojure.core$apply.invoke(core.clj:624) |
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
| type v2 = { x : float; | |
| y : float } | |
| let lerp a b v = | |
| a *. (1.0 -. v) +. b *. v | |
| let smooth v = | |
| v *. v *. (3.0 -. 2.0 *. v) |
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
| let rec elem x xs = | |
| match xs with | |
| | [] -> false | |
| | y :: ys -> x = y || elem x ys | |
| let rec uniques l = | |
| let rec helper l acc = | |
| match l with | |
| | [] -> acc | |
| | x :: xs -> |
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
| $ opam install --verbose ketrew | |
| The following actions will be performed: | |
| - install ketrew.master | |
| === + 1 === | |
| =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫 | |
| [ketrew] Fetching https://github.com/hammerlab/ketrew | |
| HEAD is now at b782227 Remove obsolete configuration value | |
| =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫 |
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
| type point = { x : int; y : int };; | |
| type 'a cell = { coord : point; level : int; cargo : 'a } ;; | |
| List.Assoc.find;; | |
| let assoc = [(2, "a"); (3, "b"); (5, "d")];; | |
| List.Assoc.find assoc 3;; | |
| \ntype point = { x : int; y : int }\nlet point ~x ~y = { x ; y }\n;; | |
| point ~x:2 ~y: 12;; | |
| let point_of_pair (x, y) = point ~x ~y;; | |
| let points = List.map [(1,2); (3, 1); (5, 1); (10; 23)] ~f:point_of_pair;; | |
| let points = List.map [(1,2); (3, 1); (5, 1); (10, 23)] ~f:point_of_pair;; |
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
| let add_missing_hours | |
| : Date.t -> (Time.t * 'a) list -> (Time.t * 'a) list | |
| = fun date hourly_counts -> | |
| let gen_day_hours ~start = | |
| List.map (List.range 0 24) (fun hr -> Time.add start (Time.Span.create ~hr ())) in | |
| let day_hours = gen_day_hours | |
| ~start:(Time.of_date_ofday date Core.Ofday.start_of_day Core.Zone.utc) in | |
| List.fold day_hours ~init:hourly_counts | |
| ~f:(fun hourly_counts' hour -> | |
| if List.Assoc.mem hourly_counts' hour then hourly_counts' |
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
| signature COROUTINE = | |
| sig | |
| type ('a, 'b, 'r) t | |
| val await : ('a, 'b, 'a) t | |
| val yield : 'b -> ('a, 'b, unit) t | |
| (* Monadic interface and stuffs *) | |
| val map : ('c -> 'd) -> ('a, 'b, 'c) t -> ('a, 'b, 'd) t | |
| val return : 'c -> ('a, 'b, 'c) t |
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
| module Person = struct | |
| type t = { | |
| name : string; | |
| age : int; | |
| } | |
| type 'a with_meta = t * 'a | |
| end |
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
| open Elements | |
| type ('a, 'state) step = 'state -> 'a -> [ `Continue of 'state | `Stop of 'state ] | |
| type ('a, 'b, 'state) transducer = | |
| ('b, 'state) step -> ('a, 'state) step | |
| let map f = | |
| fun step -> fun r x -> |
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
| // List Processor | |
| function map(f, seq) { | |
| return function(step) { | |
| seq (function(x) { | |
| return step (f(x)); | |
| }); | |
| }; | |
| } |