markov-0.1: Simple interpreter for Markov's normal algorithms

Data.MarkovAlgo

Synopsis

Documentation

type Algo c = [Rule c]Source

Markov's algorithm itself

data Rule c Source

One rule in algorithm

Constructors

[c] :-> [c]

Non-terminating rule

[c] :->. [c]

Terminating rule

Instances

Eq c => Eq (Rule c) 
Show (Rule Char) 
Show (Rule (Var Char)) 

data Var α Source

Variable for rules

Constructors

L α

Literal char

V Int

Variable with given number

Instances

antecedent :: Rule c -> [c]Source

Get antecedent of rule

consequent :: Rule c -> [c]Source

Get consequent of rule

constructor :: Rule c -> [d] -> [d] -> Rule dSource

Get data constructor of Rule

expandSource

Arguments

:: Eq α 
=> [α]

Alphabet

-> Algo (Var α)

Algorithm with variables

-> Algo α 

Expand algorithm with variables into algorithm without variables

parseRuleSource

Arguments

:: Eq α 
=> [α]

Names of variables

-> Rule α

Concrete rule

-> Rule (Var α) 

Create generic Rule from concrete Rule

buildAlgoSource

Arguments

:: Eq α 
=> [α]

Alphabet

-> [α]

Names of variables

-> Algo α

Description of algorithm

-> Algo α 

Build concrete algo from simple text description with variables

runMarkovSource

Arguments

:: Eq α 
=> Algo α

Algorithm itself

-> [α]

Start string

-> [α] 

Run concrete (without variables) Markov's algorithm