Skip to content

Instantly share code, notes, and snippets.

@joom
Created October 11, 2014 18:20
Show Gist options
  • Save joom/d9ae61c540799433f2e5 to your computer and use it in GitHub Desktop.
Save joom/d9ae61c540799433f2e5 to your computer and use it in GitHub Desktop.
% adds X to the beginning of each list in the second argument.
% Haskell equiv: map (X:) secondArg
cons_all(_, [], []).
cons_all(X, [H|Tl], [[X|H]|NewTl]) :-
cons_all(X, Tl, NewTl).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment