diff options
Diffstat (limited to 'example/turing/src/tape.h')
-rw-r--r-- | example/turing/src/tape.h | 16 |
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) |