Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
BIG successes of Lisp (was ...)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Wade Humeniuk, post: 1732424"] Paul Rubin wrote: That's the spirit, now (defun mostn (fn lst &aux (mostn-elems nil) (max nil)) (tagbody find-mostn (unless (null lst) ((lambda (score) (cond ((or (null max) (> score max)) (setf max score mostn-elems (list (car lst)))) ((= score max) (push (car lst) mostn-elems)))) (funcall fn (car lst))) (setf lst (cdr lst)) (go find-mostn))) (values (nreverse mostn-elems) max)) or (defun mostn (fn lst &aux (mostn-elems nil) (max nil)) (map nil (lambda (score elem) (cond ((or (null max) (> score max)) (setf max score mostn-elems (list elem))) ((= score max) (push elem mostn-elems)))) (mapcar fn lst) lst) (values (nreverse mostn-elems) max)) Wade [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
BIG successes of Lisp (was ...)
Top