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
(ns joy.q | |
"Lazy, tail-recursive quick-sort implementation from section 6.4") | |
(defn nom [n] (take n (repeatedly #(rand-int n)))) | |
(def cmpc (atom 0)) | |
(defn sort-parts | |
"Lazy, tail-recursive, incremental quicksort. Works against | |
and creates partitions based on the pivot, defined as 'work'." |
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
https://www.erlang-solutions.com/downloads/download-erlang-otp | |
sudo apt-get build-dep erlang | |
sudo apt-get install libwxgtk2.8-0 libwxbase2.8-0 | |
sudo dpkg -i ПАКЕТ | |
для 12.04: | |
sudo add-apt-repository ppa:cassou/emacs | |
sudo apt-get update |
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
si14@si14-laptop:~ | |
> cabal install uvector | |
Warning: The package list for 'hackage.haskell.org' is 20 days old. | |
Run 'cabal update' to get the latest list of available packages. | |
Resolving dependencies... | |
Downloading uvector-0.1.1.1... | |
Configuring uvector-0.1.1.1... | |
Building uvector-0.1.1.1... | |
Preprocessing library uvector-0.1.1.1... |
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
enqueue_asker(Asker) -> | |
AskerQueueLen = 5, | |
case catch ets:update_counter(asker_queues, Asker, | |
{2, 1, AskerQueueLen+1, AskerQueueLen+1}) of | |
{'EXIT', {badarg, _}} -> ets:insert(asker_queues, [{Asker, 0}]), | |
enqueue_asker(Asker); | |
X when not is_integer(X) -> throw({cant_be1, X}); | |
X when X > AskerQueueLen -> busy; | |
X when X =< 0 -> throw(cant_be2); | |
X when X == 1 -> Result = do_job(), |
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
> rebar compile skip_deps=true master [999ea85] untracked | |
==> hidranto (compile) | |
src/sieve.jxa:3:5 *error* invalid use declaration: bad namespace name 'joxa.core' | |
src/sieve.jxa:11:36 *error* invalid reference 'rem'/2 | |
src/sieve.jxa:11:32 *error* invalid reference '!='/2 | |
src/sieve.jxa:12:14 *error* invalid reference '+'/2 | |
ERROR: build failure | |
ERROR: compile failed while processing /home/si14/repos/hidranto: rebar_abort |
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
(defn foobar [] | |
(defn dominanto [dominance strand1 strand2 fenotype] | |
(conda [(membero strand1 dominance) | |
(== fenotype strand1)] | |
[(membero strand2 dominance) | |
(== fenotype strand2)] | |
[(== strand1 strand2) | |
(== fenotype strand1)])) | |
(defn inherito [dominance parent1 parent2 fenotype] |
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
a(X) when is_integer(X) -> {ok, X*2}; | |
a(X) when is_atom(X) -> {error, atom_not_allowed}; | |
a(X) when is_list(X) -> {error, lists_not_allowed}. | |
A = z_validator(fun a/1, [atom_not_allowed, lists_not_allowed]), | |
z_apply(A, z_wrap(123), {error, generic}), %% result is 246 | |
z_apply(A, z_wrap(atom), {error, generic}), %% throws {error, atom_not_allowed} | |
z_apply(A, z_wrap([a,b,c]), {error, generic}), %% throws {error, lists_not_allowed} | |
z_apply(A, z_wrap({illegal_pattern}), {error, generic}). %% throws {error, generic} because of pattern mismatch |
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
(circa_dev@si14-laptop)10> ATT = [218031268785524224,1013751539199691264, | |
(circa_dev@si14-laptop)10> 1148798475812614400]. | |
[218031268785524224,1013751539199691264,1148798475812614400] | |
(circa_dev@si14-laptop)14> lists:foldl(fun (A,B) -> A + B end, 0, ATT) / 3. | |
793527094599276500.0 |
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
(defn- node? [x] | |
(or (string? x) (map? x))) | |
(defn as-nodes [node-or-nodes] | |
(if (node? node-or-nodes) | |
[node-or-nodes] | |
node-or-nodes)) |
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
8> {status, _, _, [_, _, _, _, A1]} = sys:get_status(ranch_sup). | |
9> A1. | |
[{header,"Status for generic server ranch_sup"}, | |
{data, | |
[{"Status",running}, | |
{"Parent",<0.43.0>}, | |
{"Logged events",[]}]}, | |
{data, | |
[{"State", | |
{state, |