Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. (define (getMaxWrapper list currMax)
  2. (if (null? list ) currMax
  3. (if (> (car list) currMax)
  4. (getMaxWrapper (cdr list) (car list))
  5. (getMaxWrapper (cdr list) currMax))))
  6.  
  7. (define (getMax list)
  8. (getMaxWrapper list (car list)))
  9.  
  10. (define (getMinWrapper list currMin)
  11. (if (null? list) currMin
  12. (if (< (car list) currMin)
  13. (getMinWrapper (cdr list) (car list))
  14. (getMinWrapper (cdr list) currMin))))
  15.  
  16. (define (getMin list)
  17. (getMinWrapper list (car list)))
  18.  
  19. (define (getRes matrix)
  20. (getMin (map getMax matrix)))
  21.  
  22. (define (im matrix curMat)
  23. (if (null? matrix) curMat
  24. (if (null? (car matrix)) curMat
  25. (im (map cdr matrix) (append curMat (list (map car matrix)))))))
  26.  
  27. (if (null? (car '(()()))) 1 2)
  28.  
  29. (define matrix '((1 2 3 4 )((4 5 6 7))))
  30. ;(append '() (list '(1 4)) (list '(2 3)) (list '(3 6)))
  31. (im matrix '())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement