; Naming lines: ; A (bottom) ; B C D (from left corner, excpt bottom) ; E F G (from right corner, excpt bottom) ; All triangles will start with non-bottom left-corner lines: (B C D) ; Second line: any right-corner non-bottom line: (E F G) ; Third line: Any line except the first and second. ; Collect triangle unless an equal triangle is already listed (let (all) (labels ((tri-eql (a b) (null (set-difference a b)))) (dolist (s1 '(b c d)) (dolist (s2 '(e f g)) (dolist (s3 '(a b c d e f g)) (let ((tri (list s1 s2 s3))) (unless (or (eq s1 s3) (eq s2 s3) (find tri all :test #'tri-eql)) (push tri all))))))) (print (length all)))