Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VAR

VAR extends IF with variable expressions:

x

A variable has a name, but its value comes from the environment in which it is evaluated.

VAR starts with this environment:

x ↦ VNumber 10
v ↦ VNumber 5
i ↦ VNumber 1

Variables can also appear anywhere an expression is expected:

if zero?(-(5, v)) then i else v

VAR lets programs refer to predefined names, but they cannot introduce new names themselves yet.

For a closer look, read VAR: Variables and Environments.

To try it, you'll need Nix with flakes enabled.

nix develop
elm repl

Then:

import VAR.Interpreter as I

I.run "x"
-- Ok (VNumber 10)

I.run "y"
-- Err (RuntimeError (IdentifierNotFound "y"))

I.run "if zero?(-(5, v)) then i else v"
-- Ok (VNumber 1)

About

VAR extends IF with variable expressions and environments, allowing programs to refer to values by name.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages