Skip to content

Instantly share code, notes, and snippets.

@amtal
amtal / homework.lisp
Created April 11, 2011 21:19
I like helping people
(defmodule homework (export letters))
(defun lut (x)
(: lists nth (- x (car '"/"))
'("0"
"1" "abc" "def"
"ghi" "jkl" "mno"
"pqrs" "tuv" "wxyz")))
(defun letters
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^.git/.*"]},
{excl_archive_filters, [".*"]},
ak@rifter:~/code/erl/erlang_rebar_example_project$ rebar generate-upgrade previous_release=dummynode_first -v
DEBUG: Rebar location: "/home/ak/bin/rebar"
DEBUG: Entering /home/ak/code/erl/erlang_rebar_example_project
DEBUG: Available deps: []
DEBUG: Missing deps : []
DEBUG: Predirs: ["/home/ak/code/erl/erlang_rebar_example_project/apps/dummy_app",
"/home/ak/code/erl/erlang_rebar_example_project/rel"]
DEBUG: Entering /home/ak/code/erl/erlang_rebar_example_project/apps/dummy_app
DEBUG: Available deps: []
DEBUG: Missing deps : []
We couldn’t find that file to show.
%% @doc Function description.
-spec f( Item::type() % description of item
, Action::type() % yet another description
...
) -> type() % blah
f(Item,Action) ->
@amtal
amtal / gist:873987
Created March 17, 2011 08:02
Augment code with tracing capability!
> (c 'trace)
#(module trace)
> (l 'trace)
(#(module trace))
> (: trace start)
IN [ myfunc, x=0 ]
IN [ myfunc, x=1 ]
IN [ myfunc, x=2 ]
IN [ myfunc, x=3 ]
OUT[ myfunc, x=3 => 0 ]
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
import Data.Vector as V
import Data.Word
import Data.Bits
data Instr = Seed Word32
| Mutate Word32
| JmpFwd Word16
| JmpRev Word16