🇵🇸
Highlights
- Pro
Pinned Loading
-
-
SylteA/Discord-Bot
SylteA/Discord-Bot PublicDiscord bot for Tech With Tim's discord server. Join here: https://discord.gg/pr2k55t
-
just a normal one liner linked list
just a normal one liner linked list 1Node = type("Node",(),{'__init__': lambda self, data, _next=None: setattr(self, "data", data) or setattr(self, "next", _next),'__repr__': lambda self: f"Node<{self.data.__repr__()}>",'__gt__': lambda self, other: self.data > other.data if other.__class__ == Node else self.data > other});LinkedList = type("LinkedList",(),{'__init__': lambda self, data=None:setattr(self, "head", None) or setattr(self, "last", None)or setattr(self, "len", 0) or data is not None and self.extend(data) or None,'_ci': lambda self, index: index if index >= 0 else self.len + index,'append': lambda self, obj:(last := Node(obj))and (self.head is not None or not setattr(self, "head", last))and (self.last is None or not setattr(self.last, "next", last))and not setattr(self, "last", last) and setattr(self, "len", self.len + 1),'index': lambda self, obj, start=0, stop=None:(stop := self.len if stop is None else stop) * 0 or(start := self._ci(start), stop := self._ci(stop)) and( __loop := lambda index, item:None if item is None or index >= stop else index if item.data == obj and start <= index else __loop(index + 1, item.next))(0, self.head),'get_node': lambda self, index:(index := self._ci(index)) * 0 or IndexError("Index out of range") if not 0 <= index <= self.len else(__loop := lambda counter, item:item if index == counter else __loop(counter + 1, item.next))(0, self.head),'get': lambda self, index: self.get_node(index).data,'insert': lambda self, index, obj:(index := self._ci(index)) * 0 or(self.append(obj) if index >= self.len else (setattr(self, "head", Node(obj, self.head)) if index <= 0 else(old := self.get_node(index-1)) and setattr(old, "next", Node(obj, old.next))) or setattr(self, "len", self.len + 1)),'count': lambda self, obj:(__loop := lambda counter, item:counter if item is None else __loop(counter + (item.data == obj), item.next))(0, self.head),'clear': lambda self: setattr(self, "head", None) or setattr(self, "len", 0),'copy': lambda self: LinkedList(self.__iter__()),'extend': lambda self, iterable:((iterable := iterable.copy()),setattr(self.last, "next", iterable.head) if self.len else setattr(self, "head", iterable.head)) and setattr(self, "last", iterable.last)or setattr(self, "len", self.len + iterable.len) if iterable.__class__ == LinkedList else [self.append(x) for x in iterable].clear() and None,'remove': lambda self, obj:setattr(self, "head", self.head.next) or setattr(self, "len", self.len - 1) if self.head.data == obj else (__loop := lambda item: item.next and (setattr(item, "next", item.next.next) or setattr(self, "len", self.len - 1) if item.next.data == obj else __loop(item.next)))(self.head),'pop': lambda self, index=-1:(index := self._ci(index))*0 or setattr(self, "len", self.len - 1) or(IndexError("Its empty you can't pop it :l") if self.head is None else IndexError("pop index out of range") if index >= self.len + 1 else(setattr(self, "head", (item := self.head).next) if index == 0 else setattr(self.get_node(index - 1), "next", (item := self.get_node(index)).next)) or item.data),'reverse': lambda self:(new := LinkedList()) or (__loop := lambda item: new if item is None else new.insert(0, item.data) or __loop(item.next))(self.head) and setattr(self, "head", new.head),'sort': lambda self, *, key=None, reverse=False:setattr(self, "head", LinkedList(sorted(self, key=key, reverse=reverse)).head),'__len__': lambda self: self.len,'__bool__': lambda self: self.head is not None,'__iter__': lambda self: ((item := item.next if i else self.head).data for i in range(self.len)), '__repr__': lambda self: 'LL[' + ', '.join(f'{x!r}' for x in self) + ']','__add__': lambda self, other: (new := self.copy()).extend(other) or new,'__mul__': lambda self, n: (new := LinkedList()) or [new.extend(self.copy()) for _ in range(n)],'__reversed__': lambda self: self.reverse() or self,'__eq__': lambda self, other: hasattr(other, "__len__") and self.len == len(other)and all(x == y for x, y in zip(self, other)),'__ne__': lambda self, other: not self == other,'__gt__': lambda self, other:bool(self) and self.head and (__loop := lambda index, item:item and (True if index >= len(other) else item.data > other[index] if item.data != other[index]else __loop(index + 1, item.next)))(0, self.head) or False,'__ge__': lambda self, other: self == other or self > other,'__lt__': lambda self, other: not (self == other or self > other),'__le__': lambda self, other: not self > other,'__getitem__': lambda self, item:self.get(item) if item.__class__ == int else LinkedList(self.get(i) for i in range(*item)),'__setitem__': lambda self, item, value: setattr(self.get(item), "value", value),'__delitem__': lambda self, item: self.pop(item)})
-
-
BrainFu*k interpreter in nasm
BrainFu*k interpreter in nasm 1; $ nasm -f elf64 brainf.asm && ld brainf.o
2; $ ./a.out
34BUFF equ 32*1024
5
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.