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/Queue-Definition/XLISP/queue-definition-1.xlisp
Normal file
17
Task/Queue-Definition/XLISP/queue-definition-1.xlisp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(define-class queue
|
||||
(instance-variables vals))
|
||||
|
||||
(define-method (queue 'initialize)
|
||||
(setq vals '())
|
||||
self)
|
||||
|
||||
(define-method (queue 'push x)
|
||||
(setq vals (nconc vals (cons x nil))))
|
||||
|
||||
(define-method (queue 'pop)
|
||||
(define val (car vals))
|
||||
(setq vals (cdr vals))
|
||||
val)
|
||||
|
||||
(define-method (queue 'emptyp)
|
||||
(null vals))
|
||||
24
Task/Queue-Definition/XLISP/queue-definition-2.xlisp
Normal file
24
Task/Queue-Definition/XLISP/queue-definition-2.xlisp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[1] (define my-queue (queue 'new))
|
||||
|
||||
MY-QUEUE
|
||||
[2] (my-queue 'push 1)
|
||||
|
||||
(1)
|
||||
[3] (my-queue 'push 2)
|
||||
|
||||
(1 2)
|
||||
[4] (my-queue 'emptyp)
|
||||
|
||||
()
|
||||
[5] (my-queue 'pop)
|
||||
|
||||
1
|
||||
[6] (my-queue 'pop)
|
||||
|
||||
2
|
||||
[7] (my-queue 'emptyp)
|
||||
|
||||
#T
|
||||
[8] (my-queue 'pop)
|
||||
|
||||
()
|
||||
Loading…
Add table
Add a link
Reference in a new issue