From d31af30ec310dc2161b652d05fd26729ad0c1ab3 Mon Sep 17 00:00:00 2001 From: gnat Date: Fri, 25 Oct 2024 00:50:30 -0700 Subject: [PATCH] fix formatting error in last thought --- html/thoughts/dollcode | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/html/thoughts/dollcode b/html/thoughts/dollcode index a7d189d..c05383b 100644 --- a/html/thoughts/dollcode +++ b/html/thoughts/dollcode @@ -18,11 +18,11 @@ below, one may find a very good and reasonable dollcode translator tool. one may d(int(''.join(map(lambda x: str(hex(ord(x))[2::]), args[-1])), 16)) if '-a' in args else ud(args[-1]) if '-dn' in args else (lambda h: ''.join(map(lambda i: chr(int(h[i:i+2], 16)), range(0, len(h), 2))))(hex(ud(args[-1]))[2::]) if '-da' in args else - "0x6e6174\'s dollcode conversion tool\n" - "\t-n: encode decimal number as dollcode\n" - "\t-a: encode ascii string as dollcode\n" - "\t-dn: decode dollcode as decimal\n" - "\t-da: decode dollcode as ascii string" + "0x6e6174\'s dollcode conversion tool\\n" + "\\t-n: encode decimal number as dollcode\\n" + "\\t-a: encode ascii string as dollcode\\n" + "\\t-dn: decode dollcode as decimal\\n" + "\\t-da: decode dollcode as ascii string" )(lambda n: ''.join(map(lambda n: ''.join(['▖','▘','▌'][int(n)]), (lambda f: (lambda x: f(lambda y: x(x)(y))) (lambda x: f(lambda y: x(x)(y))))(lambda f: lambda n: (lambda x, y: str(f(x)) + str(y))(*divmod(n-1, 3)) if n else '')(n))), lambda d: __import__('functools').reduce(lambda a, d: a * 3 + d, map(lambda x: {'▖': 1, '▘': 2, '▌': 3}[x], d), 0), __import__('sys').argv) @@ -32,7 +32,7 @@ also, it can be written in one line (ignoring the shebang):
 ~/src/dollcode λ cat $(which dollcode)
 #!/usr/bin/env -S bash -c 'python3 -c "__import__(\"sys\").setrecursionlimit(2**31-1); exec(open(\"$(which dollcode)\").read())" "$@"' _ 
-print((lambda d,ud,args:d(int(args[-1]))if'-n'in args else d(int(''.join(map(lambda x:str(hex(ord(x))[2::]),args[-1])),16))if'-a'in args else ud(args[-1])if'-dn'in args else(lambda h:''.join(map(lambda i:chr(int(h[i:i+2],16)),range(0,len(h),2))))(hex(ud(args[-1]))[2::])if'-da'in args else"0x6e6174\'s dollcode conversion tool\n\t-n: encode decimal number as dollcode\n\t-a: encode ascii string as dollcode\n\t-dn: decode dollcode as decimal\n\t-da:decode dollcode as ascii string")(lambda n:''.join(map(lambda n:''.join(['▖','▘','▌'][int(n)]),(lambda f:(lambda x:f(lambda y:x(x)(y)))(lambda x:f(lambda y:x(x)(y))))(lambda f:lambda n:(lambda x,y:str(f(x))+str(y))(*divmod(n-1,3))if n else'')(n))),lambda d:__import__('functools').reduce(lambda a,d:a*3+d,map(lambda x:{'▖':1,'▘':2,'▌':3}[x],d),0),__import__('sys').argv))
+print((lambda d,ud,args:d(int(args[-1]))if'-n'in args else d(int(''.join(map(lambda x:str(hex(ord(x))[2::]),args[-1])),16))if'-a'in args else ud(args[-1])if'-dn'in args else(lambda h:''.join(map(lambda i:chr(int(h[i:i+2],16)),range(0,len(h),2))))(hex(ud(args[-1]))[2::])if'-da'in args else"0x6e6174\'s dollcode conversion tool\\n\\t-n: encode decimal number as dollcode\\n\\t-a: encode ascii string as dollcode\\n\\t-dn: decode dollcode as decimal\\n\\t-da:decode dollcode as ascii string")(lambda n:''.join(map(lambda n:''.join(['▖','▘','▌'][int(n)]),(lambda f:(lambda x:f(lambda y:x(x)(y)))(lambda x:f(lambda y:x(x)(y))))(lambda f:lambda n:(lambda x,y:str(f(x))+str(y))(*divmod(n-1,3))if n else'')(n))),lambda d:__import__('functools').reduce(lambda a,d:a*3+d,map(lambda x:{'▖':1,'▘':2,'▌':3}[x],d),0),__import__('sys').argv))
 
python is a very good language. this is observable in that it allows integers to have arbitrarily$[make-footnote "up to a value that the user can change at runtime"] many digits. it isn't really sure why python allows this, but it is glad it does, because it is funny. @@ -94,5 +94,7 @@ it is very efficient: ~ λ time dollcode -a "$(for i in {0..65536}; do echo -ne a; done)" >/dev/null dollcode -a "$(for i in {0..65536}; do echo -ne a; done)" > /dev/null 13.35s user 4.77s system 99% cpu 18.168 total $[make-footnote 'one must not worry, it is only like that for large inputs. this one is pretty sure there is some exponential time (and memory) complexity in there somewhere'] +running this command on input strings longer than 32768 bytes opens steam. it has absolutely no idea why this is, but it is consistent.
$[put-footnotes] +