Jump to content

Order two numerical lists: Difference between revisions

Added Elixir
No edit summary
(Added Elixir)
Line 56:
TRUE
</pre>
 
 
=={{header|AutoHotkey}}==
Line 68 ⟶ 67:
return L1.MaxIndex() < L2.MaxIndex()
}</lang>
 
=={{header|AWK}}==
<lang AWK>
Line 291:
 
[1,2,1,3,2] <. [1,2,0,4,4,0,0,0]</lang>
 
=={{header|Elixir}}==
The built-in comparison functions already do this (not only for lists of numbers, but for any arbitrary data type).
<lang elixir>iex(1)> [1,2,3] < [1,2,3,4]
true
iex(2)> [1,2,3] < [1,2,4]
true</lang>
 
=={{header|Erlang}}==
Line 334 ⟶ 341:
[0; 0] >= [0]
[0; 0] < [1]</pre>
 
 
 
 
=={{header|Factor}}==
Line 470 ⟶ 474:
b = [2, -1, 0, -17] as CList; assert (a < b)
a = [2, 8, 0] as CList; assert ! (a < b)</lang>
 
=={{header|Haskell}}==
The built-in comparison operators already do this:
Line 722 ⟶ 727:
{{trans|AutoHotkey}}
{{VI solution|LabVIEW_Order_two_numerical_lists.png}}
 
 
=={{header|Lasso}}==
Line 1,286 ⟶ 1,290:
<lang ruby>>> ([1,2,1,3,2] <=> [1,2,0,4,4,0,0,0]) < 0
=> false</lang>
 
=={{header|Scala}}==
<lang Scala>def lessThan1(a: List[Int], b: List[Int]): Boolean =
Line 1,321 ⟶ 1,326:
((= (car a) (car b)) (lex<? (cdr a) (cdr b)))
(else (< (car a) (car b)))))</lang>
 
 
=={{header|Seed7}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.