view src/parallel_execution/stack.agda @ 154:efef5d4df54f

Add normal level and agda code
author atton
date Tue, 15 Nov 2016 19:02:36 +0900
parents
children 19cc626943e4
line wrap: on
line source

module stack where

pushSingleLinkedStack : Stack -> Data -> (Code : Stack -> ?) -> ?
pushSingleLinkedStack stack data next = next stack1
  where
    element = record {next = top stack; data = data}
    stack1  = record {top = just element}


popSingleLinkedStack : Maybe ?? -> Data -> (Code : Stack -> (Maybe ??) -> ?) -> ?
popSingleLinkedStack stack data next with (top stack) =
  ... | nothing = next stack nothing
  ... | just a  = next stack1 data1
    where
      data1 = data a
      stack1 = record { top = (next a)}