Sha256: a2792157d41221eefa0ccdbd7f624b23360517b4b96df108d6348fa73a45e087

Contents?: true

Size: 674 Bytes

Versions: 17

Compression:

Stored size: 674 Bytes

Contents

(declare empty-stack [A --> [stack B]])

(declare push [A --> [stack A] --> [stack A]])

(declare top [[stack A] --> A])

(declare pop [[stack A] --> [stack A]])

(define empty-stack
   _ -> (/.  X (if (or (= X pop) (= X top))
                        (error "this stack is empty~%")
                        (error "~A is not an operation on stacks.~%" X))))
                        
(define push
   X S -> (/. Y (if (= Y pop) 
                    S 
                   (if (= Y top) 
                       X 
                       (error "~A is not an operation on stacks.~%" Y)))))

(define top
   S -> (S top))

(define pop
   S -> (S pop))


Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shen-ruby-0.15.1 shen/release/test_programs/stack.shen
shen-ruby-0.15.0 shen/release/test_programs/stack.shen
shen-ruby-0.14.0 shen/release/test_programs/stack.shen
shen-ruby-0.13.0 shen/release/test_programs/stack.shen
shen-ruby-0.10.0 shen/release/test_programs/stack.shen
shen-ruby-0.9.0 shen/release/test_programs/stack.shen
shen-ruby-0.8.1 shen/release/test_programs/stack.shen
shen-ruby-0.8.0 shen/release/test_programs/stack.shen
shen-ruby-0.7.0 shen/release/test_programs/stack.shen
shen-ruby-0.6.0 shen/release/test_programs/stack.shen
shen-ruby-0.5.0 shen/release/test_programs/stack.shen
shen-ruby-0.4.1 shen/release/test_programs/stack.shen
shen-ruby-0.4.0 shen/release/test_programs/stack.shen
shen-ruby-0.3.1 shen/release/test_programs/stack.shen
shen-ruby-0.3.0 shen/release/test_programs/stack.shen
shen-ruby-0.2.0 shen/release/test_programs/stack.shen
shen-ruby-0.1.0 shen/release/test_programs/stack.shen