Skip to content

Instantly share code, notes, and snippets.

khia

Block or report user

Report or block khia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4312157
'/Users/some_user/dev/myproject/apps/myapp/ebin',
'/Users/some_user/dev/myproject/apps/myapp/deps/gen_leader/ebin',
'/Users/some_user/dev/myproject/apps/myapp/deps/edown/ebin',
'/Users/some_user/dev/myproject/apps/myapp/deps/gproc/ebin',
'/Users/some_user/dev/myproject/apps/myapp/deps/genx/ebin',
'.',
'/usr/local/dev/erlang/R15B02/lib/erlang/lib/kernel-2.15.2/ebin',
'/usr/local/dev/erlang/R15B02/lib/erlang/lib/stdlib-1.18.2/ebin',
'/Users/some_user/dev/myproject/deps/elixir/bin/../lib/mix/ebin',
'/Users/some_user/dev/myproject/deps/elixir/bin/../lib/iex/ebin',
View gist:3960633
delegate [
capabilities(_self),
delete(_self),
url(_self), url(url, _self),
forward(_self), back(_self),
],
to: :htse_session, with: _pid
View gist:3960612
defmacrop _pid(args) do
[_self|rest] = Enum.reverse(args)
session_pid = quote do: unquote(_self).session_pid
element = quote do: unquote(_self).element
[session_pid,element|Enum.reverse(rest)]
end
delegate [element(strategy, value, _self)],
to: :htse_session, as: :element_element, with: _pid
View gist:3900083
```
Performance:
| asymptotic | length |
| | 10 | 100 | 1000 | 10000 |
| |min med max avg|min med max avg|min med max avg|min med max avg|
cons | | 0, 0, 537, 0 | 0, 0, 572, 0 | 0, 0, 223, 0 | 0, 0, 431, 0 |
drop | | 0, 0, 204, 0 | 0, 1, 356, 1 | 1, 1, 204, 1 | 1, 1, 450, 2 |
drop_tail | | 2, 3, 393, 3 | 1, 2, 588, 2 |294,302,501,306|2627,2768,9390,2812|
drop_tail_r| | 1, 2, 588, 2 | 16,17,404,17 |156,165,385,167|1364,1486,3650,1498|
from_list_r| | 0, 1, 405, 1 | 9,10,519,10 |112,114,879,116| 996,1037,3104,1060|
View gist:3874237
iex(6)> defmodule Test do
...(6)> defmacrop foo() do
...(6)> quote location: [line: 54], do: __ENV__.line
...(6)> end
...(6)> def test, do: foo
...(6)> end
iex:6: redefining module Test
{:module,Test,<<70,79,82,49,0,0,5,52,66,69,65,77,65,116,111,109,0,0,0,146,0,0,0,16,11,69,108,105,120,105,114,45,84,101,115,116,8,95,95,105,110,102,111,95,95,4,100,111,99,115,...>>,{:test,0}}
iex(7)> Test.test
10
You can’t perform that action at this time.