24 game/Solve: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 4,608:
 
{{trans|Python Succinct}}
{{works with|Nim Compiler|0.19.4}}
 
<lang nim>import algorithm, sequtils, strformat
Line 4,620 ⟶ 4,621:
const Ops = @[opAdd, opSub, opMul, opDiv]
 
procfunc opr(o: Operation, a, b: float): float =
case o
of opAdd: a + b
Line 4,627 ⟶ 4,628:
of opDiv: a / b
 
procfunc solve(nums: array[4, int]): string =
func `~=`(a, b: float): bool =
abs(a - b) <= 1e-5
Anonymous user