Advertisement
Guest User

Untitled

a guest
Aug 9th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.52 KB | None | 0 0
  1. CL-USER> (time (let ((top-10 '(0 0 0 0 0 0 0 0 0 0)))
  2.        (map nil (lambda (el)
  3.               (when (> el (first top-10))
  4.             (pop top-10)
  5.             (push el top-10)
  6.             (sort top-10 #'<)))
  7.         '( 12 50954 039 09 4 98 34 88 437  728 73 3 7 37 3 8373827 34 328 1 3  23 3 323 23 3545))
  8.        top-10))
  9. Evaluation took:
  10.   0.000 seconds of real time
  11.   0.000047 seconds of total run time (0.000041 user, 0.000006 system)
  12.   100.00% CPU
  13.   127,121 processor cycles
  14.   0 bytes consed
  15.  
  16. (73 88 98 323 328 437 728 3545 50954 8373827)
  17.  
  18. CL-USER> (time (let ((top-10 '(0 0 0 0 0 0 0 0 0 0)))
  19.        (map nil (lambda (el)
  20.               (when (> el (first top-10))
  21.             (pop top-10)
  22.             (setf top-10 (merge 'list (list el) top-10 #'<))))
  23.         '(12 50954 039 09 4 98 34 88 437 728 73 3 7 37 3 8373827 34 328 1 3 23 3 323 23 3545))
  24.        top-10))
  25. Evaluation took:
  26.   0.000 seconds of real time
  27.   0.000024 seconds of total run time (0.000021 user, 0.000003 system)
  28.   100.00% CPU
  29.   59,641 processor cycles
  30.   0 bytes consed
  31.  
  32. (73 88 98 323 328 437 728 3545 50954 8373827)
  33.  
  34. CL-USER> (time (let ((top-10 '(0 0 0 0 0 0 0 0 0 0)))
  35.        (map nil (lambda (el)
  36.               (when (> el (first top-10))
  37.             (setf (first top-10) el)
  38.             (sort top-10 #'<)))
  39.         '(12 50954 039 09 4 98 34 88 437 728 73 3 7 37 3 8373827 34 328 1 3 23 3 323 23 3545))
  40.        top-10))
  41. Evaluation took:
  42.   0.000 seconds of real time
  43.   0.000036 seconds of total run time (0.000031 user, 0.000005 system)
  44.   100.00% CPU
  45.   95,138 processor cycles
  46.   0 bytes consed
  47.  
  48. (73 88 98 323 328 437 728 3545 50954 8373827)
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement