Skip to content
Advertisement

Tag: sicp

Ternary conditions to find expmod?

I am reading SICP in JS about a non-terminating example of ternary conditions: It explains that: This would make the function not just inefficient, but actually non-terminating! The problem is that the constant declaration appears outside the conditional expression, which means that it is executed even when the base case exp === 0 is met. I just cannot get its

Advertisement