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 toolbox.collections.entity-list-test | |
(:require [toolbox.collections.entity-list :as entity-list] | |
[clojure.test :refer [deftest is] :include-macros true])) | |
(def el entity-list/create) | |
(defn indexes [elist] | |
(map (fn [v] [(entity-list/item->index elist v) v]) elist)) | |
(deftest test-equiv |
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 life | |
(:require [clojure.set :as set])) | |
(defn neighbors [[cell-x cell-y :as cell]] | |
(for [x (range (dec cell-x) (+ cell-x 2)) | |
y (range (dec cell-y) (+ cell-y 2)) | |
:let [neighbor [x y]] | |
:when (not= neighbor cell)] | |
neighbor)) |
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
user> (use 'criterium.core) | |
nil | |
user> (def sites (vec (for [i (range 1000)] {:stations (vec (for [j (range 10)] [{:id (str i "-" j)}]))}))) | |
#'user/sites | |
user> (bench (doall (mapcat (fn [site] (map :id (:stations site))) sites))) | |
Evaluation count : 74280 in 60 samples of 1238 calls. | |
Execution time mean : 802.413222 µs | |
Execution time std-deviation : 10.087328 µs | |
Execution time lower quantile : 786.940250 µs ( 2.5%) | |
Execution time upper quantile : 823.245990 µs (97.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
package name.mattp; | |
import io.netty.bootstrap.ServerBootstrap; | |
import io.netty.bootstrap.Bootstrap; | |
import io.netty.channel.Channel; | |
import io.netty.channel.ChannelFuture; | |
import io.netty.channel.ChannelPipeline; | |
import io.netty.channel.ChannelHandler; | |
import io.netty.channel.ServerChannel; |