Giter Site home page Giter Site logo

nomad's Introduction

Nomad

A CLI calculator application written in Haskell. This project is a continued version of https://github.com/dhansmair/nomad-calculator (university project). It's a learning project that explores functional programming in Haskell, but also other topics such as parsing, the lambda calculus and basic type inference.

Features of nomad:

  • evaluate common arithmetic expressions
  • Definition of variables and (mathematical) functions
  • Partial function application
  • higher-order functions
  • Builtin functions such as sin, cos, tan, log, exp etc.
  • Builtin derive, which returns the derivative of a function of type num -> num.

Features that would be nice (but will probably not come):

  • automatic simplification of terms and functions
  • boolean type
  • loading / executing code from file
  • useful type error messages

Setup

stack build                 // builds all executables
stack run cli               // runs cli executable

Syntax

x = expr                    // define global variable
f(x,y) = expr               // define function
f = \x,y -> expr            // equivalently, functions can be defined as abstractions
expr                        // evaluate expressions
(\x -> 2*x)(4)              // lambda application
f(1,2)                      // function application

expressions can be:

1                           // any number
x                           // a variable
1 + 2 / 3 etc               // binary operations
f(x)                        // function call
(\x,y->x*y)(5,3)            // application of an abstraction

Commands

:q                  close the cli
:t <expr>           show the type of an expression
:env                show the current environment (stored functions and variables)

nomad's People

Contributors

dhansmair avatar

Watchers

 avatar

nomad's Issues

try-rule monad

find concept for a monad in which it is possible to try out application of rules, and apply them if possible.
If not, the state should somehow express that the current tree hasn't been modified yet.

If no more modification is possible, the function should return the final result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.