Maximum difference between adjacent elements of list: Difference between revisions

Added 11l
m (move ๐˜ด๐˜ถ๐˜ฃsection โ†’โ€ŽFree Pascal: introduced in preceding revision 549A2 to its ๐˜ฐ๐˜ธ๐˜ฏ section, mark as translation of Pascal)
(Added 11l)
Line 15:
10,3 ==> 7
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F maxDeltas(ns)
V pairs = zip(ns, ns[1..]).map((a, b) -> (abs(a - b), (a, b)))
V delta = max(pairs, key' ab -> ab[0])[0]
R pairs.filter(ab -> @delta == ab[0])
 
V maxPairs = maxDeltas([Float(1), 8, 2, -3, 0, 1, 1, -2.3, 0, 5.5, 8, 6, 2, 9, 11, 10, 3])
 
L(ab) maxPairs
print(ab)</lang>
 
{{out}}
<pre>
(7, (1, 8))
(7, (2, 9))
(7, (10, 3))
</pre>
 
=={{header|ALGOL 68}}==
1,481

edits