learning lisp
							parent
							
								
									d496e33cc1
								
							
						
					
					
						commit
						57eb8dab59
					
				|  | @ -0,0 +1,3 @@ | |||
| (defun range (min max) (loop for n from min below max by 1 collect n)) | ||||
| (defun sum (list) (apply '+ list)) | ||||
| (defun select (expr list) (remove-if-not expr list)) | ||||
|  | @ -0,0 +1,5 @@ | |||
| (load "euler.lisp") | ||||
| 
 | ||||
| (defun is_multiple_of_3_or_5 (n) (or (eq 0 (mod n 3)) (eq 0 (mod n 5)))) | ||||
| (defun multiples_of_3_or_5 (n) (select #'is_multiple_of_3_or_5 (range 1 n))) | ||||
| (defun result (n) (sum (multiples_of_3_or_5 n))) | ||||
		Loading…
	
		Reference in New Issue