Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
17
Task/Stack/XLISP/stack-1.xlisp
Normal file
17
Task/Stack/XLISP/stack-1.xlisp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(define-class stack
|
||||
(instance-variables vals))
|
||||
|
||||
(define-method (stack 'initialize)
|
||||
(setq vals '())
|
||||
self)
|
||||
|
||||
(define-method (stack 'push x)
|
||||
(setq vals (cons x vals)))
|
||||
|
||||
(define-method (stack 'pop)
|
||||
(define tos (car vals))
|
||||
(setq vals (cdr vals))
|
||||
tos)
|
||||
|
||||
(define-method (stack 'emptyp)
|
||||
(null vals))
|
||||
23
Task/Stack/XLISP/stack-2.xlisp
Normal file
23
Task/Stack/XLISP/stack-2.xlisp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
; Loading 'stack.lsp'
|
||||
[1] (define st (stack 'new))
|
||||
|
||||
ST
|
||||
[2] (st 'push 1)
|
||||
|
||||
(1)
|
||||
[3] (st 'push 2)
|
||||
|
||||
(2 1)
|
||||
[4] (st 'emptyp)
|
||||
|
||||
()
|
||||
[5] (st 'pop)
|
||||
|
||||
2
|
||||
[6] (st 'pop)
|
||||
|
||||
1
|
||||
[7] (st 'emptyp)
|
||||
|
||||
#T
|
||||
[8]
|
||||
Loading…
Add table
Add a link
Reference in a new issue