Skip to content

Instantly share code, notes, and snippets.

@msassak
Created September 19, 2013 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msassak/6630386 to your computer and use it in GitHub Desktop.
Save msassak/6630386 to your computer and use it in GitHub Desktop.
acc_func(Xs) ->
acc_func(Xs, []).
acc_func([], Acc) ->
lists:reverse(Acc);
acc_func([X|Xs], Acc) ->
acc_func(Xs, [X * 2|Acc]).
(defn acc-func [xs]
(loop [my-xs (seq xs) acc []]
(if-let [x (first my-xs)]
(recur (rest my-xs) (conj acc (* 2 x)))
acc)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment