silentbicycle
searching PlanetScale…
- 1.▲
- 2.▲
- 3.▲
- 4.▲
- 5.▲
- 6.▲
257 ms·
- 2191.▲
- 2192.▲
- 2193.▲
- 2194.▲
- 2195.▲
- 2196.▲
- 2197.▲
- 2198.▲
- 2199.▲
- 2200.▲
- 2201.▲
- 2202.▲
- 2203.▲
- 2204.▲
- 2205.▲
- 2206.▲
- 2207.▲
- 2208.▲
Type systems have their uses, but just pattern matching is sufficient here. In Prolog: eval(const(X), X).
eval(add(L, R), S) :- eval(L, LV), eval(R, RV), S is LV + RV.
eval(mul(L, R), P) :- eval(L, LV), eval(R, RV), P is LV * RV. - 2209.▲
- 2210.▲
- 2211.▲
- 2212.▲
- 2213.▲
- 2214.▲
- 2215.▲
- 2216.▲
- 2217.▲
- 2218.▲
- 2219.▲
- 2220.▲
More ›