Skip to content

Instantly share code, notes, and snippets.

@ddqd
Forked from knutin/gist:1383321
Created August 2, 2014 16:50
Show Gist options
  • Select an option

  • Save ddqd/f1038693e8e38db620f4 to your computer and use it in GitHub Desktop.

Select an option

Save ddqd/f1038693e8e38db620f4 to your computer and use it in GitHub Desktop.
-module(urljoin).
-compile([export_all]).
s() ->
lists:flatten(urljoin([{foo, "bar"}, {baz, "quux"}, {fubar, "ok"}])).
%%iolist_to_binary(urljoin([{foo, "bar"}, {baz, "quux"}, {fubar, "ok"}])).
urljoin([{K, V}]) ->
[atom_to_list(K), "=", V];
urljoin([{K, V} | T]) ->
[atom_to_list(K), $=, V, $& | urljoin(T)].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment