RosettaCodeData/Task/Amb/Smalltalk/amb-5.st

10 lines
328 B
Smalltalk
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
result :=
Amb allSolutions:[
Amb try:(1 to:11) in:[:x |
Amb try:(1 to:11) in:[:y |
y <= x ifTrue:[
Amb try:(1 to:11) in:[:z |
(x squared + y squared = z squared) ifTrue:[
{x . y . z} ]]]]]].
Transcript showCR: e'all rectangles: {result}'.