home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CLIPB52.ZIP / MENU.ZIP / ARRAYFUN.PRG < prev    next >
Encoding:
Text File  |  1990-04-13  |  740 b   |  27 lines

  1. *....ACOMP: Do comparison up and down entire array, returning value of
  2. *....       of element that is the least or greatest
  3. *....
  4. *....acomp( <aArray>, <bComp>, <[nStart]>, <[nStop]> ) --> (array element)
  5. *....
  6. *....Parameters:
  7. *....
  8. *....  aArray - Array of ? to compare
  9. *....   bComp - Block that compares two elements and returns .T. if first
  10. *....           element is the answer you want
  11. *....  nStart - Element to start on
  12. *....   nStop - Element to stop on
  13. *....
  14. *....Returns:
  15. *....   
  16. *....  Element that satisfies request
  17. *....
  18.  
  19. function acomp( aArray, bComp, nStart, nStop )
  20.  
  21. local uVal := aArray[1]
  22.  
  23. aeval( aArray, {|x| uVal := iif( eval( bComp, x, uVal) , x, uVal )}, nStart, nStop )
  24.  
  25. return( uVal )
  26.  
  27.