def pow2

bend-collections@1.0.0.0 · src/containers/dynamic_array.bend:35

import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as DynamicArray
import Base

35# 2^d (structural doubling; Base Nat.pow is avoided, see docs/VALIDATION.md).
36def pow2(d: Nat) -> Nat:
37  match d:
38    case 0n:
39      1n
40    case 1n+p:
41      Nat.double(pow2(p))

Uses (2)

Used by (2)