Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum > General > > "Searching for a function."

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:2+2 =



Original Message (ID '272359') By yehuda:
Try to use internal functions as much as possible. The key function here is Split, all the rest is "cosmetics" l = {1, 2, 5, 9, 4, 2, 1, 10, 12, 1}; ups = Length@Select[Split[l, #1 < #2 &], Length[#] > 1 &] downs = Length@Select[Split[l, #1 > #2 &], Length[#] > 1 &] or similarly, using Count ups=Count[Split[l, #1 < #2 &], x_ /; Length[x] > 1] downs=Count[Split[l, #1 > #2 &], x_ /; Length[x] > 1] yehuda