This program calculates common factor for given numbers. The original use case is to find a possible resolution for pixel games that scale well with new screen resolutions (that's why I don't have any check and optimizations for big numbers and use simple brute force).
(define (fun1 l d)
(if (apply = (map (lambda (x) (remainder x d)) l))
(print d)))
(define (fun2 l)
(do ((i 1 (+ i 1)))
((= i (apply min l)) i)
(fun1 l i)))
(fun2 `(1080 720))
I'm learning lisp and scheme and want to know if there's any way to make this code more functional and lispy.
Also, I'm wondering if (apply = (1 2 3)
is the right way to do it. I haven't found another way to force feed list of numbers to the =
function or break numbers out of the list.