Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created November 5, 2012 01:38
Show Gist options
  • Save dyoo/4014787 to your computer and use it in GitHub Desktop.
Save dyoo/4014787 to your computer and use it in GitHub Desktop.
right triangle example from jdc
#lang racket
(for*/list ([x (in-range 11)]
[y (in-range 11)]
[z (in-range 11)]
#:when (and (= (+ (* x x) (* y y)) (* z z)) (= (+ x y z) 24)))
(list x y z))
(for*/list ([x (in-range 11)]
[y (in-range 11)]
#:when (= 24 (+ x y (sqrt (+ (* x x) (* y y))))))
(list x y (sqrt (+ (* x x) (* y y)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment