View Problem

Produce the combinations from two lists

Given two lists, produce the list of tuples formed by taking the combinations from the individual lists. E.g. given the letters ["a", "b", "c"] and the numbers [4, 5], produce the list: [["a", 4], ["b", 4], ["c", 4], ["a", 5], ["b", 5], ["c", 5]]
ExpandDiskEdit
php
foreach ($short as $s) {
foreach ($long as $l) {
$list[] = array($l, $s);
}
}
DiskEdit
clojure
(defn combine [lst1 lst2]
(mapcat (fn [x] (map #(list % x) lst1)) lst2))
DiskEdit
clojure
(mapcat (fn [x] (map #(list % x) ["a", "b", "c"])) [4, 5])

Submit a new solution for php or clojure
There are 23 other solutions in additional languages (cpp, csharp, erlang, fantom ...)