Equilibrium index: Difference between revisions
Content added Content deleted
(→{{header|Quackery}}: tweaked code) |
(→{{header|Quackery}}: improved efficiency) |
||
Line 2,423: | Line 2,423: | ||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
<syntaxhighlight lang="Quackery"> [ [] 0 |
<syntaxhighlight lang="Quackery"> [ dip [ [] [] 0 ] |
||
witheach |
witheach |
||
[ + dup dip join ] |
[ + dup dip join ] |
||
⚫ | |||
⚫ | |||
[ [] over cumsum |
|||
rot reverse cumsum |
|||
witheach |
witheach |
||
[ |
[ dip over - join ] |
||
join -1 split drop |
|||
witheach |
|||
⚫ | |||
[ over i^ peek = if |
|||
drop ] is equilibria ( --> [ ) |
|||
[ dip [ i^ join ] ] ] |
|||
⚫ | |||
' [ -7 1 5 2 -4 3 0 ] equilibria echo</syntaxhighlight> |
' [ -7 1 5 2 -4 3 0 ] equilibria echo</syntaxhighlight> |