From a2827158e185228cfc86729f56c19181889d702c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 12 Feb 1998 19:24:15 +0100 Subject: [PATCH] Added Array.longest_ordered_sequence(). Rev: tutorial/tutorial.wmml:1.71 --- tutorial/tutorial.wmml | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index e294e9f665..241b596790 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -5285,6 +5285,56 @@ Array.sum_arrays, Array.map <hr noshade size=1> +<function name=Array.longest_ordered_sequence + title="find the longest ordered sequence of elements"> +<man_syntax> +array(int) longest_ordered_sequence(array a);<br> +</man_syntax> +<man_description> +This function returns an array of the indices in the longest +ordered sequence of elements in the array. +</man_description> +<man_example> +> array a = ({ 1,2,3,4,2,3,5,6 }); +Result: ({ /* 8 elements */ + 1, + 2, + 3, + 4, + 2, + 3, + 5, + 6 +}) +> array seq = Array.longest_ordered_sequence(a); +Result: ({ /* 6 elements */ + 0, + 1, + 4, + 5, + 6, + 7 +}) +> rows(a,seq); +Result: ({ /* 6 elements */ + 1, + 2, + 2, + 3, + 5, + 6 +}) +</man_example> +<man_note> +This function is only available in Pike 0.6 and later. +</man_note> +<man_see> +Array.diff +</man_see> +</function> + +<hr noshade size=1> + <function name=Array.map title="map an array or mapping over a function"> <man_syntax> array map(array <I>arr</I>,function <I>fun</I>,mixed ... <I>args</I>);<br> -- GitLab