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(bench). | |
-compile(export_all). | |
%% Luke Gorrie's favourite profiling macro. | |
-define(TIME(Tag, Expr), | |
(fun() -> | |
%% NOTE: timer:tc/4 does an annoying 'catch' so we | |
%% need to wrap the result in 'ok' to be able to | |
%% detect an unhandled exception. | |
{__TIME, __RESULT} = |
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
#!/usr/bin/mawk -f | |
# long lines | |
length() > 79 | |
# trailing whitespace | |
/[ ]+$/ | |
# tabs | |
/[\t]/ |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Clojure port of Scheme's SRFI-26 ``Curry Upon This'' macro package | |
;;; (strictly inferior to Clojure's built-in lambda-syntax). | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;_* Declarations ===================================================== | |
(ns cut | |
(:use clojure.test)) | |
(declare gen slot? rest-slot? eval?) |
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(reftrick). | |
-compile(export_all). | |
%% Luke Gorrie's favourite profiling macro. | |
-define(TIME(Tag, Expr), | |
(fun() -> | |
%% NOTE: timer:tc/4 does an annoying 'catch' so we | |
%% need to wrap the result in 'ok' to be able to | |
%% detect an unhandled exception. | |
{__TIME, __RESULT} = |
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
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] | |
Eshell V5.9.2 (abort with ^G) | |
1> c(reftrick). | |
{ok,reftrick} | |
2> spawn(fun() -> reftrick:plain() end). | |
<0.38.0> | |
time(reftrick): 3.410ms recv1 | |
time(reftrick): 704.826ms recv2 | |
3> spawn(fun() -> reftrick:plain() 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
{function, recv, 1, 9}. | |
{label,8}. | |
{line,[{location,"reftrick.erl",33}]}. | |
{func_info,{atom,reftrick},{atom,recv},1}. | |
{label,9}. | |
{test,is_eq_exact,{f,10},[{x,0},{integer,0}]}. | |
{move,{atom,ok},{x,0}}. | |
return. | |
{label,10}. | |
{allocate_zero,1,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
[info] Starting scala interpreter... | |
[info] | |
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_32). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> def f = 1 | |
def f = 1 | |
f: Int |
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
### Keybase proof | |
I hereby claim: | |
* I am cannedprimates on github. | |
* I am cannedprimates (https://keybase.io/cannedprimates) on keybase. | |
* I have a public key whose fingerprint is 734D ECBA C500 533A 95AA 32B7 333D C302 DD8D 2180 | |
To claim this, I am signing this object: |
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
// build.sbt | |
scalaVersion := "2.11.6" | |
libraryDependencies ++= Seq( | |
"org.scalaz" %% "scalaz-core" % "7.1.1", | |
"org.scalaz" %% "scalaz-effect" % "7.1.1", | |
"org.scalaz" %% "scalaz-concurrent" % "7.1.1", | |
"org.tpolecat" %% "doobie-core" % "0.2.1", | |
"org.tpolecat" %% "doobie-contrib-postgresql" % "0.2.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
/* example from cohttp readme, works with rebuild -pkg cohttp.lwt wtf.native */ | |
open Lwt; | |
open Cohttp; | |
open Cohttp_lwt_unix; | |
let coroutine = | |
Client.get (Uri.of_string "http://www.reddit.com/") >>= fun (resp, body) => { | |
let code = resp |> Response.status |> Code.code_of_status; | |
Printf.printf "Response code: %d\n" code; |
OlderNewer