diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 18:43:51 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-18 18:43:51 +0100 |
commit | e650a80856edc1d1df1f163c3f84082455717fa0 (patch) | |
tree | 4848ad975d95f5765980980d0e10ed0752e553f9 /data/stack.scm | |
parent | Assorted comments and cleanup. (diff) | |
download | scheme-monad-e650a80856edc1d1df1f163c3f84082455717fa0.tar.gz scheme-monad-e650a80856edc1d1df1f163c3f84082455717fa0.tar.xz |
Compleately redid file structure.
Diffstat (limited to 'data/stack.scm')
-rw-r--r-- | data/stack.scm | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/data/stack.scm b/data/stack.scm deleted file mode 100644 index d470394..0000000 --- a/data/stack.scm +++ /dev/null @@ -1,24 +0,0 @@ -(define-module (data stack) - #:export (pop peek push) - #:use-module (control monad) - #:use-module (control monad state)) - -;;; Simple stateful stack module for showing the state monad -;;; in action. These functions assume that they are in a -;;; (state list) monad. But dynamic types! - -;;; TODO test these for empty stack - -(define (pop) - (do st <- (get) - let top = (car st) - (put (cdr st)) - (return-state top))) - -(define (peek) - (do st <- (get) - (return-state (car st)))) - -(define (push v) - (do st <- (get) - (put (cons v st)))) |