Code Monkey home page Code Monkey logo

nam's Introduction

NAM - language of Markov algorithm

NAM - language, based on Normal Markov Algorithm (NMA) and S-expressions.

The prototype is written in python, but after solving known problems it will be rewritten into a compiled language.

How to use

Now NAM has several keywords:

  • Quote - which returns the following expression not processed
    • and ~’~ (single quote) - ‘a -> (quote a), ‘(+ a b) -> (quote (+ a b))
  • Global - which creates a global rule available at any nesting level
  • Local - which creates a local rule that does not operate outside of the nested expression
  • Rule - creates a rule at the current nesting level
  • Filler - which creates a named placeholder. This allows you to pass arguments to the rules

(rule x 100)

x     -> 100
(x)   -> (100)
((x)) -> ((100))

(rule (123 321) 567)

(123 321)     -> 567
123 321       -> 123 321
(123 321 456) -> (123 321 456)
(rule x (- 10 5))        -> (rule x 5)
(rule y (quote (-10 5))) -> (rule y (- 10 5))

x             -> 5
y -> (- 10 5) -> 5

(rule (test (filler x)) (successfully x))

(test 123) -> (successfully 123)
(test abc) -> (successfully abc)

And a few mathematical functions in prefix notation, +, -, *, /, taking two arguments.

(+ 5 10)      -> 15
(+ 1 (+ 2 3)) -> 6
(- 5 3)       -> 2
(/ 10 2)      -> 5
(* 4 8)       -> 32

Known issues:

  • Inability to create loops
  • Only one expression can be evaluated at a time

nam's People

Contributors

naurim avatar

Watchers

 avatar

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.