Law of cosines - triples: Difference between revisions
m
→Python - Dictionaries
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Even less elegant, but reasonable run-time) |
|||
Line 565:
===Dictionaries===
A variant Python draft based on dictionaries (and returning a count of 18394 for the 'extra credit' calculation).
<lang python>def f90(dct):
return lambda x2, ab, a, b: dct.get(x2, None)
Line 608 ⟶ 607:
unlines(
zipWith(
lambda
lambda ks=triangles(f, 13): (
str(len(ks)) + ' solutions for ' +
Line 615 ⟶ 614:
)
)()
)([
([
) + '\n\n' +
'60 degrees - uneven triangles of maximum side 10000. Total:\n' +
|