aboutsummaryrefslogtreecommitdiff
path: root/example/turing/src/tape.h
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/tape.h
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/tape.h')
-rw-r--r--example/turing/src/tape.h16
1 files changed, 11 insertions, 5 deletions
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)