Skip to content

Instantly share code, notes, and snippets.

@offby1
Created June 25, 2012 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save offby1/2986020 to your computer and use it in GitHub Desktop.
Save offby1/2986020 to your computer and use it in GitHub Desktop.
(define (max-and-index seq)
(for/fold ([max #f][index #f])
([(x i) (in-indexed seq)])
(if (or (not max)
(< max x))
(values x i)
(values max index))))
(define (max-and-index seq)
(for/fold ([max #f][index #f])
([(x i) (in-indexed seq)])
(if (or (not max)
(< max x))
(values x i)
(values max index))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment