Simplee.Goa
1.0.5
See the version list below for details.
dotnet add package Simplee.Goa --version 1.0.5
NuGet\Install-Package Simplee.Goa -Version 1.0.5
<PackageReference Include="Simplee.Goa" Version="1.0.5" />
paket add Simplee.Goa --version 1.0.5
#r "nuget: Simplee.Goa, 1.0.5"
// Install Simplee.Goa as a Cake Addin #addin nuget:?package=Simplee.Goa&version=1.0.5 // Install Simplee.Goa as a Cake Tool #tool nuget:?package=Simplee.Goa&version=1.0.5
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. There are several convenience variations for such evaluation function where you can pass a logging function, the depth of the evaluation, and a lookup function to replace variables.
// Function with complete list of arguments: logger, depth, lookup
GAnd << GTrue << GTrue |> evalLR logr 100 (fun _ -> None)
// Slim function where the logger is skipped and the depth is set by default to 1000.
// In this example the lookup will replace the 'myID' variable with the ID combinator.
GAnd << GTrue << GTrue |> evald0 (fun s -> if s = "myID" then I |> Some else None)
goa |> bool
The library defines Boolean algebra (GTrue, GFalse, GNot, GOr, GAnd, GBeq)
GNot << GTrue
|> eval (fun _ -> None)
|> g2str
|> function
| s when s = "λa b.b" -> Ok ()
| s -> s |> sprintf "The not True is not GFalse [%s]" |> Error
GAnd << GTrue << GFalse
|> eval (fun _ -> None)
|> g2str
|> function
| s when s = "λb x.x" -> Ok ()
| s -> s |> sprintf "The AND True False is not GFalse [%s]" |> Error
goa |> numerals
The library defines NUmerals algebra (G0, G1, ..., GSucc, GMul, GPow, GIs0)
let g3 = GAdd << G1 << G2 |> evald0
let g8 = GPow << G2 << G3 |> evald0
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- FParsec (>= 1.0.3)
- FSharp.Core (>= 4.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added boolean (true, false, not, and, or, beq) and numerals (0, 1, 2, succ, add, mul, pow, is0) algebras.