haskell,lambda-calculus,ghc-api

From the GHC module documentation in the ghc docs: compileToCoreModule :: GhcMonad m => FilePath -> m CoreModule This is the way to get access to the Core bindings corresponding to a module. compileToCore parses, typechecks, and desugars the module, then returns the resulting Core module (consisting of the module...

javascript,lambda-calculus,newlisp

(function () { function range(n){ var l = []; for(var i = 0; i < n; i++){ l.push(i); } return l; } function church_encode(n) { if(n < 1) return function(f, x) { return x; }; if(n === 1) return function(f, x) { return f(x); }; function succ (n) { return...

haskell,lambda-calculus,callbyname,call-by-value

I don't think proper call-by-name is possible with the original data definition. F (Value a -> Value a) has Value a as argument, so we have no choice but to pass in some already interpreted value, and it'll be call-by-need under Haskell reduction behaviour. We could modify the data definition:...

haskell,polymorphism,lambda-calculus,type-families

Terms indexed by types In the lambda cube this is parametric polymorphism. In System F, polymorphic terms look like functions that take types as arguments and return terms. id : ∀ a. a -> a id = Λa . λx : a . x -- Λ binds type args, λ...

parsing,lambda,lambda-calculus,rascal

I've used the following grammar, which removes the extra LAYOUTLIST and the dead right, but this should not make a difference. It seems to work as you want when I use the generic implode function : keyword Keywords= "if" | "then" | "else" | "end" | "fun"; lexical Ident =...

algorithm,search,functional-programming,enumeration,lambda-calculus

The Binary Lambda Calculus defines a binary encoding for any closed term in the untyped lambda calculus, and also suggests a bijection between natural numbers and binary strings, but the former is not surjective. Still, the paper http://arxiv.org/abs/1401.0379 "Counting Terms in the Binary Lambda Calculus" might yield efficient ranking/unranking mappings.

To avoid confusion I would suggest to alpha-rename a bit more. So it would appear you have x and z in "scope" (they are not bound by any λ in your term), it is a good idea to make sure if you are referring to them or not. I would...

algorithm,lambda,functional-programming,computer-science,lambda-calculus

There are various approaches to evaluating lambda terms. Depending on whether type information is available or not, you can get more efficient and more secure evaluators (runtime checks are not needed as the programs are known to be well-behaved). I'm going to give a crude presentation of some techniques. Big...

Yes, by giving an encoding of any known Turing-complete language into CCS, you can establish its Turing completeness. The construction of such an encoding is a proof. This has been done (to my knowledge) in several contexts, but the most direct one is likely the encoding of the Pi calculus...

haskell,lambda-calculus,dependent-type

We need some kind of context to keep track of the lambda arguments. However, we don't necessarily need to instantiate them, since bound gives us de Bruijn indices, and we can use those indices to index into the context. Actually using the indices is a bit involved, though, because of...

haskell,compiler-construction,interpreter,parsec,lambda-calculus

In the definition of func, body <- term means the body can only consist of a simple term. To allow all expressions in a function body, change it to body <- expr.

haskell,functional-programming,lambda-calculus,algebraic-data-types,scott-encoding

If the Wikipedia article is correct, then data Tree a = Node (List (Tree a)) | Leaf a has Scott encoding node = λ a . λ node leaf . node a leaf = λ a . λ node leaf . leaf a It looks like the Scott encoding is...

logic,nlp,nltk,lambda-calculus

It is hard to say that an existential quantifier is the logical form of an imperative sentence. However, your question lies in another problem. It seems that you have an ambiguous grammar. Specially when you intrepret the x of y with in(x, y) function, it is imaginable to have similar...

haskell,lambda,functional-programming,lazy-evaluation,lambda-calculus

Call-by-name requires only a few changes: Not evaluating the body of a lambda abstraction: reduce (Lam body) = (Lam body). Not evaluating the argument of the application. Instead, we should substitute it as is: reduce (App left right) = case reduce left of Lam body -> reduce (substitute right body)...

function,lambda,functional-programming,theory,lambda-calculus

It is the De Bruijn index of the lambda calculus

javascript,haskell,currying,lambda-calculus,partial-application

The problem with your curry function (and for most curry functions that people write in JavaScript) is that it doesn't handle extra arguments correctly. What curry does Suppose f is a function and f.length is n. Let curry(f) be g. We call g with m arguments. What should happen? If...