Initial commit - fix problems & refactor code
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from typing import Any
|
||||
|
||||
from core.exceptions import syntaxError
|
||||
# from core.printer import Representation
|
||||
|
||||
class LinkedList:
|
||||
value = None
|
||||
nxt = None
|
||||
|
||||
def __init__(self, value_, nxt_):
|
||||
self.value = value_
|
||||
self.nxt = nxt_
|
||||
|
||||
def car(lst):
|
||||
return lst.value
|
||||
|
||||
def cdr(lst):
|
||||
return lst.nxt
|
||||
|
||||
def cons(val, lst):
|
||||
return LinkedList(val, lst)
|
||||
|
||||
def isList(val):
|
||||
return isinstance(val, LinkedList)
|
||||
|
||||
NIL = cons(None, None)
|
||||
Reference in New Issue
Block a user