aboutsummaryrefslogtreecommitdiff
path: root/example/turing/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-23 19:03:16 +0100
committerAdrian Kummerlaender2015-02-23 19:03:16 +0100
commit0dde43edac6817c3f0a237d25c2054c0ee75926c (patch)
tree037d04fd230f5aa613b6e8b3030e93973f5566b9 /example/turing/src
parent41b63eff7f76e6574ef238f821dad0212a619c2a (diff)
downloadTypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar.gz
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar.bz2
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar.lz
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar.xz
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.tar.zst
TypeAsValue-0dde43edac6817c3f0a237d25c2054c0ee75926c.zip
Added binary incrementer state table to Turing machine example
* reintroduced `BLANK` as the _BLANK_ symbol * fixed implicit tape expansion in `tape::readSymbol`
Diffstat (limited to 'example/turing/src')
-rw-r--r--example/turing/src/state.h4
-rw-r--r--example/turing/src/tape.h16
2 files changed, 13 insertions, 7 deletions
diff --git a/example/turing/src/state.h b/example/turing/src/state.h
index 51fe347..fa3306b 100644
--- a/example/turing/src/state.h
+++ b/example/turing/src/state.h
@@ -42,8 +42,8 @@ template <
struct state_predicate {
template <typename State>
using function = tav::And<
- tav::IsEqualValue<Id, tav::Nth<field::ID, State>>,
- tav::IsEqualValue<Read, tav::Nth<field::READ, State>>
+ tav::IsEqual<Id, tav::Nth<field::ID, State>>,
+ tav::IsEqual<Read, tav::Nth<field::READ, State>>
>;
};
diff --git a/example/turing/src/tape.h b/example/turing/src/tape.h
index 39814d8..4f79bd9 100644
--- a/example/turing/src/tape.h
+++ b/example/turing/src/tape.h
@@ -10,6 +10,12 @@ namespace machine {
namespace tape {
+struct BLANK {
+ typedef BLANK type;
+
+ static constexpr char value{'\0'};
+};
+
// (define (readSymbol position tape)
// (if (= (length tape) position)
// '()
@@ -18,11 +24,11 @@ template <
typename Position,
typename Tape
>
-using readSymbol = tav::If<
- tav::IsEqualValue<tav::Length<Tape>, Position>,
- void,
- tav::Nth<Position, Tape>
->;
+using readSymbol = tav::Eval<tav::If<
+ tav::LowerThan<Position, tav::Length<Tape>>,
+ tav::utility::defer_eval<tav::Nth, Position, Tape>,
+ BLANK
+>>;
// (define (writeSymbol position symbol tape)
// (if (= (length tape) position)