← Home ← Back to /g/

Thread 105740574

30 posts 6 images /g/
Anonymous No.105740574 [Report] >>105740589 >>105740765 >>105742366 >>105742669 >>105742954 >>105743083 >>105743415 >>105743663 >>105743970
how autistic am i
i wanted to write poetry in python so i turned 460,000 english words into lambda functions. see picrel

now(i(can(write(like(this)))))
Anonymous No.105740589 [Report]
>>105740574 (OP)
whoops those aren't lambda functions lmao my bad

i knew that
Anonymous No.105740685 [Report] >>105740694 >>105740777
Why would you do this?
OS MASTER !JORDAN./os No.105740694 [Report] >>105743453 >>105743569
>>105740685
why(not(that(is(the(power(of(lambda))))))))
Anonymous No.105740722 [Report]
>how autistic am i
>still uses vscode
>still uses python
nah, m8, you're fine, there are much worse cases.
Anonymous No.105740729 [Report] >>105740842
You're not autistic, you're just retarded.
Anonymous No.105740756 [Report] >>105740832
not only that you would stilll need to pass an arg to the function that gets evaluated first.
Anonymous No.105740765 [Report]
>>105740574 (OP)
not very much desu. if you want to be peak autism you would do it in assembly
Anonymous No.105740777 [Report] >>105741894
>>105740685
Brion Gysin made poetry with programming. So why not OP? He could do it all again in Haskell, mess around with `flip`, $, and . and thus generate novel permutations
Anonymous No.105740832 [Report]
>>105740756
oh i just use a blank string for the last argument
Anonymous No.105740842 [Report]
>>105740729
because(poetry(is_(cool(''))))
Anonymous No.105741894 [Report] >>105742311
>>105740777
>poetry
>random assortment of words
Anonymous No.105742311 [Report]
>>105741894
what? you've never been kicked by a habit that you're trying to kick?
https://www.youtube.com/watch?v=rL-jdlTvRkk
Anonymous No.105742366 [Report]
>>105740574 (OP)
why don't you just write in lisp instead?
Anonymous No.105742669 [Report]
>>105740574 (OP)
Neat but why not use lisp?
Anonymous No.105742954 [Report] >>105743006
>>105740574 (OP)
anon you know you can you dynamically define a function for each word at runtime, instead of actually writing each definition in a file
Anonymous No.105743006 [Report] >>105743037 >>105743434
>>105742954
This

```python
import __main__

with open('/usr/share/dict/words') as f:
words = f.read().split('\n')

print_ = print

for w in words:
__main__.__dict__[w] = (
lambda w = w:
lambda s = '': f'{w} {s}'
)(w)

print_(hello(world(good(bye()))))
```
Anonymous No.105743037 [Report]
>>105743006
Woops

import __main__

with open('/usr/share/dict/words') as f:
words = f.read().split('\n')

print_ = print

for w in words:
__main__.__dict__[w] = (
lambda w = w:
lambda s = '': f'{w} {s}'
)(w)

print_(hello(world(good(bye()))))
Anonymous No.105743083 [Report]
>>105740574 (OP)
>he didn't use lisp for this
sigh.
Anonymous No.105743415 [Report] >>105743434
>>105740574 (OP)

The brackets are ugly.

```
class PoetryWriter(object):

def __init__(self):
self.all_words = []

def __getattr__(self, item):
if '_' in item:
item = item.replace('_', '')
self.all_words.append(item)
return self

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
print(' '.join(self.all_words))

poetry_writer = PoetryWriter()

with poetry_writer as _:
_.in_.the.garden.of.error.you.prune.the.right.flowers.yet.plant.the.wrong.seeds._. \
In.the.ballet.of.folly.you.pirouette.with_.grace.but.always.step.on.your.partners.toes
```

in the garden of error you prune the right flowers yet plant the wrong seeds In the ballet of folly you pirouette with grace but always step on your partners toes
Anonymous No.105743434 [Report] >>105743467
>>105743006
>>105743415

Someone tell me how to do code blocks i am retarded in a different way.
Anonymous No.105743453 [Report]
>>105740694
how do you handle "()" in text then?
Anonymous No.105743467 [Report]
>>105743434
Ctrl+W
Anonymous No.105743519 [Report] >>105743555
kill yourselves you wastes of oxygen
Anonymous No.105743555 [Report]
>>105743519
shut up fagget
Anonymous No.105743569 [Report]
>>105740694
Just learn Scala. You would be able to write like this:

why not that is the power of lambda
Anonymous No.105743663 [Report]
>>105740574 (OP)
A smarter impl would have some sort of meta-function that, on occurrence of an undefined function, defines a generic function that concatenates the function name with its input.
But cool idea anyway. I think.

Lua can do this easily (not pictured: workaround for already defined globals/keywords).
setmetatable(_G, { __index = function(_, k)
return function(s)
return k .. " " .. (s or "")
end
end })

print(now(you(can(write(like(this(too())))))))
Anonymous No.105743928 [Report] >>105746947
Why would you use poetry when it's been deprecated by uv, which is written in rust
Anonymous No.105743970 [Report]
>>105740574 (OP)
that's embarrassing. you could have just used reflection.
Anonymous No.105746947 [Report]
>>105743928
It would only save me an average of one second a month at most (it made no difference in CI according to my tests, but YMMV). That's worth it to not have the Rust "community" opinions infesting the system.