Execute Brain****/Standard ML: Difference between revisions
Content added Content deleted
(translated from haskell) |
m (Categorization now in master page) |
||
Line 1: | Line 1: | ||
{{implementation|Brainf***}}{{collection|RCBF}} |
{{implementation|Brainf***}}{{collection|RCBF}} |
||
Quick implementation of a [[Brainfuck]] interpreter in Standard ML. |
Quick implementation of a [[Brainfuck]] interpreter in [[Standard ML]]. |
||
Like the Haskell version but without the lazy lists: |
Like the [[Haskell]] [[RCBF/Haskell|version]] but without the lazy lists: |
||
Pairs of lists are used to implement both the two-side infinite band of cells, and the program storage. |
Pairs of lists are used to implement both the two-side infinite band of cells, and the program storage. |
||
Line 43: | Line 43: | ||
| exec (p as (_, #"]"::_), d ) = exec (matchLeft (moveLeft p), d) |
| exec (p as (_, #"]"::_), d ) = exec (matchLeft (moveLeft p), d) |
||
fun run s = exec (([], s), ([0], [0])) |
fun run s = exec (([], s), ([0], [0]))</lang> |
||
</lang> |
|||
Example output: |
Example output: |