Simplee.Goa
1.0.1
Lambda calculus implementation using FSharp.
See the version list below for details.
InstallPackage Simplee.Goa Version 1.0.1
dotnet add package Simplee.Goa version 1.0.1
<PackageReference Include="Simplee.Goa" Version="1.0.1" />
paket add Simplee.Goa version 1.0.1
simplee > goa
Project which implements lambda calculus parser, and interpreter.
goa > AST
Contains the definitions of the lambda calculus grammar. Here is an example of the lambda terms:
type GIdentifier = string
type GExpression =
 GVar of GIdentifier
 GApp of GExpression * GExpression
 GLambda of GIdentifier * GExpression
goa > ofstr
Parses strings and converts them to lambda expressions. The implementation is using the FParse library.
Here are several examples of valid strings which are parsed into lambda expressions.
In the following example, we get a lambda expression from a given string.
"""\x > (x y)""" > gexpr
"""\a b > b""" > gexpr
The results of parsing these strings are equivalent to the following lambda expressions built using the provided infix operators:
"x" .>> ("x" .<<. "y")
"a" .>> ("b" .>> ("b" > gvar))
goa > combinators
The library provides the standard lambda combinators: S, K, I, M, KI, C, B, Th, B1, V
goa > eval
The library implements normalization function for lambda expression using beta reduction.
let lam = "x" > gvar > glambda "x"
let body = "y" > gvar
let term = gapp lam body
let fail' a =
fail
nm
(sprintf "The app /w lambda failed. s=[%s] e=[%s] a=[%s]" (term > gte2str) (body > gte2str) (a > gte2str))
match term > eval (fun _ > None) with
 t when t = ("y" > gvar) >
pass nm
 t >
fail' t
goa > bool
The library defines Boolean algebra (GTrue, GFalse, GNot, GOr, GAnd, GBeq)
GNot << GTrue
> norm (fun _ > None)
> gte2str
> function
 s when s = "λa b.b" > Ok ()
 s > s > sprintf "The not True is not GFalse [%s]" > Error
GAnd << GTrue << GFalse
> norm (fun _ > None)
> gte2str
> function
 s when s = "λb x.x" > Ok ()
 s > s > sprintf "The AND True False is not GFalse [%s]" > Error
simplee > goa
Project which implements lambda calculus parser, and interpreter.
goa > AST
Contains the definitions of the lambda calculus grammar. Here is an example of the lambda terms:
type GIdentifier = string
type GExpression =
 GVar of GIdentifier
 GApp of GExpression * GExpression
 GLambda of GIdentifier * GExpression
goa > ofstr
Parses strings and converts them to lambda expressions. The implementation is using the FParse library.
Here are several examples of valid strings which are parsed into lambda expressions.
In the following example, we get a lambda expression from a given string.
"""\x > (x y)""" > gexpr
"""\a b > b""" > gexpr
The results of parsing these strings are equivalent to the following lambda expressions built using the provided infix operators:
"x" .>> ("x" .<<. "y")
"a" .>> ("b" .>> ("b" > gvar))
goa > combinators
The library provides the standard lambda combinators: S, K, I, M, KI, C, B, Th, B1, V
goa > eval
The library implements normalization function for lambda expression using beta reduction.
let lam = "x" > gvar > glambda "x"
let body = "y" > gvar
let term = gapp lam body
let fail' a =
fail
nm
(sprintf "The app /w lambda failed. s=[%s] e=[%s] a=[%s]" (term > gte2str) (body > gte2str) (a > gte2str))
match term > eval (fun _ > None) with
 t when t = ("y" > gvar) >
pass nm
 t >
fail' t
goa > bool
The library defines Boolean algebra (GTrue, GFalse, GNot, GOr, GAnd, GBeq)
GNot << GTrue
> norm (fun _ > None)
> gte2str
> function
 s when s = "λa b.b" > Ok ()
 s > s > sprintf "The not True is not GFalse [%s]" > Error
GAnd << GTrue << GFalse
> norm (fun _ > None)
> gte2str
> function
 s when s = "λb x.x" > Ok ()
 s > s > sprintf "The AND True False is not GFalse [%s]" > Error
Release Notes
Added more combinators: S, K, I, M, KI, C, B, Th, V, B1. Added more infix operators for building lambda expressions.
Dependencies

.NETCoreApp 2.0
 FParsec (>= 1.0.3)
 FSharp.Core (>= 4.3.2)
 Simplee.Common (>= 1.0.2)
GitHub Usage
This package is not used by any popular GitHub repositories.