Order two numerical lists: Difference between revisions
Content added Content deleted
(→{{header|JavaScript}}: ES6) |
|||
Line 591: | Line 591: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|JavaScript}}== |
|||
===ES6=== |
|||
<= is already defined for numeric lists. |
|||
<lang JavaScript>(() => { |
|||
'use strict'; |
|||
// <= is already defined for lists in JS |
|||
// compare :: [a] -> [a] -> Bool |
|||
const compare = (xs, ys) => xs <= ys; |
|||
// TEST |
|||
return [ |
|||
compare([1, 2, 1, 3, 2], [1, 2, 0, 4, 4, 0, 0, 0]), |
|||
compare([1, 2, 0, 4, 4, 0, 0, 0], [1, 2, 1, 3, 2]) |
|||
]; |
|||
// --> [false, true] |
|||
})() |
|||
</lang> |
|||
{{Out}} |
|||
<lang JavaScript>[false, true]</lang> |
|||
=={{header|Joy}}== |
=={{header|Joy}}== |