NaNoGenMo / 2020

National Novel Generation Month, 2020 edition.
76 stars 0 forks source link

K. is lazy: Der Process (durch Epizeuxis) #50

Open hornc opened 3 years ago

hornc commented 3 years ago

A Kafkaesque, esoteric, Nano NaNoGenMo, Meow inspired epizeuxical "lengthy work of fiction" attempt in Lazy-K.

It may not be possible to bring the final code length under 256 characters of SKI combinators to make this 'Nano', but I'll try.

This began as an attempt to understand SKI combinator calculus by programming "something practical" using it.

An initial version of the code that produces the exactly 50K word long text comes in at 1276 bytes (not nano :( ) is:

K(IS(SI(K(S(K(S(S(KS)K)(S(S(KS)K)I)))(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I)))))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)I(S(S(KS)K)(S(S(KS)K)I)))))))(K(S(SI(K(S(K(S(S(KS)K)I))(S(SII)I(S(S(KS)K)I)))))(K(S(SI(K(S(S(KS)K)(S(K(SII(S(S(KS)K)I)))(S(S(KS)K)(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I)))))))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)(S(S(KS)K)I))))))))))(K(S(S(KS)K)(S(S(KS)K)I)(S(S(KS)K)(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)(S(K(S(S(S(KS)K))(SII)(S(S(KS)K)I)))(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)I)))))(S(K(S(K(S(SI(K(S(K(S(S(KS)K)I))(S(SII)I(S(S(KS)K)I)))))))K))(S(K(S(K(S(SI(K(S(K(SII(S(S(KS)K)I)))(SII(S(S(KS)K)(S(S(KS)K)I))))))))K))(S(K(S(K(S(SI(K(S(SII)I(S(S(KS)K)I)(S(S(KS)K))(S(SII)(S(S(KS)K))(S(S(KS)K)I)))))))K))(S(K(S(K(S(SI(K(S(S(KS)K)(S(S(KS)K)I(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)I)))))))))))K))(S(K(S(K(S(SI(K(S(S(KS)K)I(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)I))))))))))K))(S(K(S(SI(K(S(S(KS)K)(S(SII)I(S(S(KS)K)I))(S(S(KS)K))(SII(S(S(KS)K)(S(S(KS)K)I))))))))K))))))))(S(SI(K(S(S(KS)K)(S(S(KS)K)I)(S(S(KS)K)I))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)I(S(S(KS)K)(S(S(KS)K)I)))))))(K(K(SII(SII(S(S(KS)K)I)))))))))))))))))))

Plan:

Inspirational quote:

"A short while later, K. was lying in his bed. He very soon went to sleep, but before he did he thought a little while about his behaviour, he was satisfied with it but felt some surprise that he was not more satisfied."

Important note on pronunciation: For the purposes of this project, 'K.' refers to Franz Kafka's fictional character Josef K., and is to be pronounced as the German letter: 'kah'.

hornc commented 3 years ago

at 1376 bytes, the hardcoded German translation (or original?):

K(S(SI(K(S(K(S(S(KS)K)(S(S(KS)K)I)))(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I)))))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)I(S(S(KS)K)(S(S(KS)K)I)))))))(K(S(SI(K(S(K(S(S(KS)K)I))(S(SII)I(S(S(KS)K)I)))))(K(S(SI(K(S(S(KS)K)(S(K(SII(S(S(KS)K)I)))(S(S(KS)K)(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I)))))))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)(S(S(KS)K)I))))))))))(K(S(SI(K(S(K(SII(S(S(KS)K)I)))(S(S(KS)K)(S(S(KS)K)(SII(S(S(KS)K)(S(S(KS)K)I))))))))(K(S(S(KS)K)(S(S(KS)K)I)(S(S(KS)K)(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)(S(K(S(S(S(KS)K))(SII)(S(S(KS)K)I)))(S(K(S(S(KS)K)I))(S(S(KS)K)(SII(S(S(KS)K)I)))))(S(K(S(K(S(SI(K(S(K(S(S(KS)K)I))(S(SII)I(S(S(KS)K)I)))))))K))(S(K(S(K(S(SI(K(S(K(S(K(S(S(KS)K)I))(S(S(KS)K)(S(S(KS)K)I))))(S(S(KS)K)(S(SII)I(S(S(KS)K)I))))))))K))(S(K(S(K(S(SI(K(S(SII)I(S(S(KS)K)I)(S(S(KS)K))(S(SII)(S(S(KS)K))(S(S(KS)K)I)))))))K))(S(K(S(K(S(SI(K(S(S(KS)K)(S(K(SII(S(S(KS)K)I)))(S(S(KS)K)(S(S(KS)K)(SII(S(S(KS)K)(S(S(KS)K)I)))))))))))K))(S(K(S(K(S(SI(K(S(K(SII(S(S(KS)K)I)))(SII(S(S(KS)K)(S(S(KS)K)I))))))))K))(S(K(S(SI(K(S(S(KS)K)(S(SII)I(S(S(KS)K)I))(S(S(KS)K))(SII(S(S(KS)K)(S(S(KS)K)I))))))))K))))))))(S(SI(K(S(S(KS)K)(S(S(KS)K)I)(S(S(KS)K)I))))(K(S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)I(S(S(KS)K)(S(S(KS)K)I)))))))(K(K(SII(SII(S(S(KS)K)I)))))))))))))))))))))
hornc commented 3 years ago

repo is live here: https://github.com/hornc/K-IS

samples and documentation to come soon...

hornc commented 3 years ago

Some sample (truncated) output:

K-IS_en.lazy:

K. is lazy, lazy, lazy, lazy, lazy, lazy, ... lazy, lazy, lazy, lazy, lazy, lazy, lazy.

K-IS_la.lazy:

K. piger, piger, piger, piger, piger, pige ... r, piger, piger, piger, piger, piger est.

K-IS_de.lazy:

K. ist faul, faul, faul, faul, faul, faul, ... faul, faul, faul, faul, faul, faul, faul.

and coming soon:

K-IS_existential_oulipo.lazy:

K. is, is, is, is, is, is, is, is, is, is, ... , is, is, is, is, is, is, is, is, is, is.

hornc commented 3 years ago

I noticed the original code K(S(SI(K... could be modified to K(IS(SI(K... without changing the functionality, which suggests a further (Oulipian?) version of the novel, where "K. is sick, sick, sick ..." is the novel, produced from combinators which begin the same way.

The existential Oulipian (in that the novel only contains letters present in the lazy K source, i.e. S, K, and I) text above is probably my best chance at making a 'nano' version.

Unfortunately producing the protagonist's one-letter-one-punctuation-symbol name takes 188 bytes in Lazy-K:

S(K(
  S(K(
  S(SI(K(S(K(S(S(KS)K)(S(S(KS)K)I)))(S(S(KS)K)I(S(S(KS)K)(SII(S(S(KS)K)I)))))))))
K))(
  S(K(
  S(SI(K(S(S(KS)K)(S(K(S(S(KS)K)(SII(S(S(KS)K)I))))(S(S(KS)K)I(S(S(KS)K)(S(S(KS)K)I)))))))))
K)

I tried optimising the string output to use a 'function' to try and compress commonalities in the characters, and succeeded in increasing the size to about 300 bytes. That was interesting, but not very helpful. There isn't much to compress over two characters, the function may be able to save something over longer strings, but there's no way to get anything much happening in this language in under 256 characters.

Since the Unlambda notation of Lazy-K has only four symbols each could be encoded in 2 bits: ` 00 I 01 K 10 S 11

Dividing the byte-size of the Unlambda representation of a Lazy-K source file (which tends to be smaller than the combination bracketed version) by 4 is a way to get something down to a theoretical byte size. The existential_oulipo version is a candidate for a minimalism there.

hornc commented 3 years ago

November is running out, I have a bunch of versions as PDF output: https://github.com/hornc/K-IS/tree/master/output

I'm struggling to write everything up in a way that makes sense, which is the problem I had last year.

The 'nano' attempt 'K.`s I: an Existential Oulipean Trial by Epizeuxis' is not an unqualified success -- I managed to produce a reduced scope 50k word novel in exactly 1024 bytes of Unlambda syntax Lazy-K . Lazy-K is NOT a golfing language, that is about as small as any program that produces output can get.

Using the information-bit-compression trick mentioned above it can be compressed down to 256 bytes if we accept that each source-symbol represents 2-bits of information. I did manage to golf down the Scheme code used to generate that to 256 bytes, which I was pleased about. Combined, that feels like it counts for something.

Die Krankheit is a kind of phonetic pattern poem of Lazy-K source code, which generates a thematically related 50k word novel. This one I wrote directly in Lazy-K after figuring out the basic structure using the previous Scheme Lazy-K generator. It has lots of redundant Identity combinators and whitespace to creatively emphasise the theme.

There is a bunch of other languages there and a few other variations I am planning to complete. Please feel free to correct any of my grammar or translations. I used Google translate cross references with other sources, but have probably made mistakes. The same qualities that made this 'novel' easy to code in something as awkward as Lazy-K also made it (theoretically) easy to translate into many languages, so once I had established the limits of Lazy-K, this project became more of an excercise in comparative linguistics.

The base version is very simple, but hopefully the range of translations make it more interesting. I'm most pleased with the Hittite version, and would love someone to proofread it for me to let me know how close I got to what I was attempting.

If there is anything to say about 2020, at least I can say I generated a fifty-thousand word novel in Hittite using combinator calculus... Thanks @dariusk and @hugovk for hosting again!

repo again: https://github.com/hornc/K-IS