Well, 2 things: first, I meant "currying". second, I found the answer: no. Under dynamic typing, the reduction steps are:
(\a -> \b -> a) 1 2 (\b -> a) 2 -- the substitution don't occur right away (that would be lexical scope) a ?? "a" is not in the environment!! Sorry for the noise. PS: In a meta interpreter, lexical scope seems to be actually easier to implement than dynamic scope. 2009/4/26 Loup Vaillant <[email protected]>: > Hi, can this code > > (\a -> \b -> a) 1 2 > > eval to normal form in a strict language with dynamic scope? > > Thanks, > Loup > > > PS: some context: > > I am currently implementing a toy language. The AST is this one: > > data whnf = -- Weak Head Normal Form > | Unit > | Int of int > | Bool of bool > | Prim of (whnf -> whnf) -- curried > | Fun of string * expr -- curried > > data expr = > | Whnf of whnf > | Var of string > | App of expr * expr > | If of expr * expr * expr > > Dynamic typing, dynamic scope, and, as you can see, functions have to > be curried. I plan to implement lexical scope. > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
