June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,8 @@
abstract type AbstractNode{T} end
struct EmptyNode{T} <: AbstractNode{T} end
mutable struct Node{T} <: AbstractNode{T}
value::T
pred::AbstractNode{T}
succ::AbstractNode{T}
end

View file

@ -1,5 +1,11 @@
# 'cons' an element to a doubly-linked list
(de 2cons (X DLst)
(de 2tail (X DLst)
(let L (cdr DLst)
(con DLst (cons X L NIL))
(if L
(con (cdr L) (cdr DLst))
(set DLst (cdr DLst)) ) ) )
(de 2head (X DLst)
(let L (car DLst) # Get current data list
(set DLst (cons X NIL L)) # Prepend two new cons pairs
(if L # Unless DLst was empty
@ -7,4 +13,4 @@
(con DLst (car DLst)) ) ) ) # otherwise set 'end' link
# We prepend 'not' to the list in the previous example
(2cons 'not *DLst)
(2head 'not *DLst)