Skip to content

Instantly share code, notes, and snippets.

@nicolaspayette
Created July 23, 2016 17:49
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 nicolaspayette/c261b21f783f1d21a278b5e5ac70fd08 to your computer and use it in GitHub Desktop.
Save nicolaspayette/c261b21f783f1d21a278b5e5ac70fd08 to your computer and use it in GitHub Desktop.
to-report max-one-of-list [ the-list reporter-task ]
let results map reporter-task the-list
let highest max results
let indices n-values length the-list [ ? ]
let indices-with-highest filter [ item ? results = highest ] indices
report item (one-of indices-with-highest) the-list
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment