aboutsummaryrefslogtreecommitdiff
path: root/example/turing/src/machine.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-03-14 22:43:12 +0100
committerAdrian Kummerlaender2015-03-14 22:43:12 +0100
commit73be8fb60adc4723421e73d38331f793f1d16886 (patch)
tree25d950e94f61dba21eac005329889467bc38288f /example/turing/src/machine.h
parentcb2a79cd818fbfa50e7bdebd090e681a0073f9d5 (diff)
downloadTypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar.gz
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar.bz2
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar.lz
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar.xz
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.tar.zst
TypeAsValue-73be8fb60adc4723421e73d38331f793f1d16886.zip
Implemented basic tape log printout in _Turing_ example
* `machine::simulate` now returns a list of all tape states and corresponding head positions * rewrote some of the actual print logic in terms _TypeAsValue_
Diffstat (limited to 'example/turing/src/machine.h')
-rw-r--r--example/turing/src/machine.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/example/turing/src/machine.h b/example/turing/src/machine.h
index a30c6e3..4a72d94 100644
--- a/example/turing/src/machine.h
+++ b/example/turing/src/machine.h
@@ -63,19 +63,22 @@ class simulate {
>::template get<Field>;
public:
- using type = tav::Eval<simulate<
- Transition,
- current_state<state::field::NEXT>,
- tape::writeSymbol<
- Position,
- current_state<state::field::WRITE>,
- Tape
- >,
- updatePosition<
- current_state<state::field::MOVE>,
- Position
- >
- >>;
+ using type = tav::Cons<
+ tav::Pair<Position, Tape>,
+ tav::Eval<simulate<
+ Transition,
+ current_state<state::field::NEXT>,
+ tape::writeSymbol<
+ Position,
+ current_state<state::field::WRITE>,
+ Tape
+ >,
+ updatePosition<
+ current_state<state::field::MOVE>,
+ Position
+ >
+ >>
+ >;
};
template <
@@ -84,7 +87,10 @@ template <
typename Position
>
struct simulate<Transition, void, Tape, Position> {
- typedef Tape type;
+ using type = tav::Cons<
+ tav::Pair<Position, Tape>,
+ void
+ >;
};
// (define (run program state tape position)