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
-module(trecord_test). | |
-compile({parse_transform, trecord}). | |
-export([x/0]). | |
-record(bar, | |
{baz = 3, quux} | |
). |
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
-module(z). | |
-export([t0/0, t1/0]). | |
t0() -> | |
A = [{"name1", 1}, {"name2", 77}, {"name3", 33}, {"name4", 234}], | |
t(A). | |
t1() -> | |
A = [{"name1", 1}, {"name2", 77}, {"name3", 33}, {"name4", 234}], |
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
% uname -a | |
FreeBSD raspberry-pi 10.0-RELEASE FreeBSD 10.0-RELEASE #0: Sat Mar 8 00:52:09 CET 2014 root@dragon.lan:/usr/home/jlouis/P/crochet-freebsd/work/obj/arm.armv6/usr/src/sys/RPI-B arm | |
% erl | |
Erlang R16B03-1 (erts-5.10.4) [source] [async-threads:10] [kernel-poll:false] | |
Eshell V5.10.4 (abort with ^G) | |
1> | |
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
-module(ex). | |
-compile(export_all). | |
-include_lib("eqc/include/eqc.hrl"). | |
-include_lib("eqc/include/eqc_statem.hrl"). | |
%% reg_ is a register process maintaining a single register | |
reg_proc() -> | |
case whereis(reg) of |
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
-module(agner). | |
-export([ec/2]). | |
fac(N) -> | |
lists:foldl(fun erlang:'*'/2, 1, lists:seq(1, N)). | |
ec(M, U) -> | |
X = math:pow(U, M) / fac(M), | |
Rho = U / M, |
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
-module(integer_coding). | |
-compile(export_all). | |
-include_lib("eqc/include/eqc.hrl"). | |
power(_N, 0) -> 1; | |
power(N, P) -> N * power(N, P-1). | |
perturb() -> |
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
-module(test_tcp). | |
-export([run_tcp/3, recv_tcp/3, send_tcp/4]). | |
-define(SOCKET_OPTS, [{active, false}, binary, {delay_send, true}, {packet, 4}]). | |
run_tcp(Port, P, N) -> | |
spawn_link(fun() -> | |
recv_tcp(Port, P, N) | |
end), |
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
jlouis@eldar:~$ cabal install idris | |
Resolving dependencies... | |
cabal: Could not resolve dependencies: | |
trying: idris-0.9.14.3 | |
trying: network-2.4.1.2/installed-040... | |
trying: parsec-3.1.3/installed-6c6... | |
trying: parsers-0.12.1 | |
rejecting: attoparsec-0.10.4.0/installed-d9f... (conflict: parsers => | |
attoparsec>=0.12.1 && <0.13) | |
rejecting: attoparsec-0.12.1.2, 0.12.1.1, 0.12.1.0 (conflict: parsec => |
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
— [2014-09-22] [GH/jlouis/dht_bt] Thoughts on QuickChecking a DHT | |
I am currently trying to get the BitTorrent DHT, which is Kademlia based into shape. I have code for all of it, but it is tied | |
deeply into the way we did stuff in BitTorrent and I want a way to do this outside of eTorrent, because a world-global DHT | |
for Erlang nodes are generally applicable and useful. So this is where we stand. The BitTorrent DHT has two important properties | |
* Very high resilience against node failure | |
* Slow query rates | |
For a global DHT, these are exactly the properties you are after. We don't care that queries will take a bit of time, as long as they |
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
47> eqc:module({testing_time, 60}, dht_routing_table_eqc). | |
prop_seq: ....................................................................................................(x10)......................................................................................(x1)...Failed! After 964 tests. | |
[{set,{var,1},{call,dht_routing_table_eqc,ranges,[]}}, | |
{set,{var,2}, | |
{call,dht_routing_table_eqc,has_bucket, | |
[{660458869799682934959721832362753874361116000256, | |
660815681722859424929986403855116248145211686912}]}}, | |
{set,{var,3}, | |
{call,dht_routing_table_eqc,range, | |
[1103605397128662530547004573024933458597958554231, |
OlderNewer