Skip to content

Commit

Permalink
[explicit-substitution] doAp
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Mar 20, 2024
1 parent 860a0da commit 47ac562
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/langs/explicit-substitution/reduce/doAp.cic
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Exp } from "../exp/index.cic"
import { Mod } from "../mod/Mod.cic"
import { reduce } from "./reduce.cic"

export function doAp(mod: Mod, target: Exp, arg: Exp): Exp {
match (target) {
case Exp::Fn(name, ret) =>
reduce(mod, Exp::Let([new Binding(name, arg)], ret))

case _ => Exp::Ap(target, arg)
}
}

0 comments on commit 47ac562

Please sign in to comment.