More stories from hell (retail) today I was ringing up this lady and she goes oh I want to do part of this on a gift card and the rest on normal card and I go ok and then she hands me a folded piece of paper. I think oh OK it must be folded around the gift card, right? Wrong. It is a folded sheet of 8×11 printer paper with "$40" written on the inside in ballpoint pen. I go what is this. She says a gift card. I say this is not a gift card. She says yes it is. I say this is a piece of paper with "$40" written on it. She says "well it's a gift card." I say it absolutely is not. I am grinding my teeth. She says well I want to use it. I say you physically cannot do that bc it is a piece of paper. I cannot scan or swipe it. I apologize, as if this is my fault, and not because she is completely insane. I hate it here
Hello tumblr i have made the fucking python program ever
it is a recursive descent parser written in a single expression. i didn’t use any tricks or tools or ai to write it, i just wrote the whole thing by hand because there’s something wrong with me.
fun facts:
- it is 2473 characters long
- part of it involves a dictionary whose keys and values are both lambda functions
- that part also involves a lambda function that takes a lambda function as a parameter and returns another lambda function
- the word lambda is used 31 separate times
- there is a lambda function with 10 different parameters (all of which are lambda functions)
- i really like lambda functions :)
(lambda factor, term, simpleExpression, expression, selector, designator, assignment, writeStatement, statement, statementSequence: print("Invalid" if (s:="".join(__import__("sys").stdin.readlines()).split())[-1] == ";" or statementSequence(s)!=[] else "Correct!"))((lambda _isident: (lambda ts: False if len(ts) == 0 else next(filter(lambda v: v is not None, map(lambda kv: kv[1]() if kv[0](ts[0]) else None ,{ (isfullint:=lambda _isint: lambda tMaybePlus: _isint(tMaybePlus[1:]) if tMaybePlus[0] in "+-" else _isint(tMaybePlus))((isint:=lambda t: len(t) >= 1 and all(map(lambda c: c in "0123456789", t)))): lambda: (ts[1:]), (lambda t: len(sp:=t.split("."))==2 and isfullint(sp[0]) and isint(sp[1])): lambda: ts[1:], (lambda t: len(t) >= 2 and t[0]=='"' and t[-1]=='"' and all(map(lambda c: c not in '" \t\n"', t[1:-1]))): lambda: ts[1:], _isident: lambda: (ts[1:]), (lambda t: t == "("): lambda: (False if len(ts) < 3 or (p:=expression(ts[1:])) == False or p[0] != ")" else p[1:]), (lambda t: t == "~"): lambda: (False if len(ts) < 2 or (p:=factor(ts[1:])) == False else p), }.items())), False)))(isident:=lambda t: len(t)>=1 and t[0] in (alphabet:="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") and all(map(lambda c: c in alphabet or c in "0123456789", t[1:])) and t != "WRITE"), (lambda ts: False if (p:=factor(ts)) == False else term(p[1:]) if len(p) >= 2 and p[0] in ["*", "/", "AND"] else p), (lambda ts: False if (p:=term(ts)) == False else simpleExpression(p[1:]) if len(p) >= 2 and p[0] in ["+", "-", "OR", "&"] else p), (lambda ts: False if (p:=simpleExpression(ts)) == False else simpleExpression(p[1:]) if len(p) >= 2 and p[0] in["<", ">", "=", "#"] else p), (lambda ts: selector(ts[2:]) if len(ts) > 2 and ts[0] == "." and isident(ts[1]) else selector(p[1:]) if len(ts) >= 3 and ts[0] == "[" and (p:=expression(ts[1:])) and p[0] == "]" else ts), (lambda ts: False if len(ts) < 1 or not isident(ts[0]) else selector(ts[1:])), (lambda ts: False if len(ts) < 3 or (p:=designator(ts)) == False or len(p) < 2 or p[0] != ":=" or (p2:=expression(p[1:])) == False else p2), (lambda ts: False if len(ts) < 4 or ts[0] != "WRITE" or ts[1] != "(" or (p:=expression(ts[2:])) == False or p[0] != ")" else p[1:]), (lambda ts: False if len(ts) < 3 else writeStatement(ts) if ts[0] == "WRITE" else assignment(ts)), (lambda ts: [] if len(ts) == 0 or ts == [";"] else False if (p:=statement(ts)) == False or (len(p) > 0 and p[0] != ";") else statementSequence(p[1:])))
5 notes ·
View notes
Statistics
We looked inside some of the posts by
track-maniac
and here's what we found interesting.