Pinned toot

I made a regex to match all multiples of 7, but it was >10,000 characters so grep couldn't handle it.

Pinned toot

I wanted to write a prime generator, but all the popular languages already have optimised ones I can't compete with.

++[>++<[->>+>+<<<]>>>[-<<<+>>>]<<[->->+<<]>>[-<<+>>]<[[>[->+>+>+<<<]>>>[-<<<+>>>]<[<->[-<->]]<+[<<<[->>+>>+<<<<]>>>>[-<<<<+>>>>]<-]<<->-<]>[->+>+>+<<<]>>>[-<<<+>>>]<[<->[-<->]]<+[<<<[-]<[->+>+<<]>>[-<<+>>]<->>>>-<-]<[-]<<+<[->>+>+<<<]>>>[-<<<+>>>]<<[->->+<<]>>[-<<+>>]<]<[-]>>>>+[<<<<<.>>>>>-]<<<<<+]

commented version: gist.github.com/olligobber/044

I implemented zip :: [a] -> [b] -> [(a,b)] in iota and it was 10KB. Gave that to gzip and now it's 335B. That's almost 30x compression factor.

olligobber boosted

You, a coward: Python doesn't have a switch statement

Me, a modern-day Galileo:

I'm just surprised, as I'm pretty sure without recursive types or values it is impossible to define fix, but I didn't know recursive types could help.

Show thread

The usual definition of fix is `fix f = f (fix f)', which is not a combinator as it uses itself in its definition, but since my definition only uses abstraction and application it might count. The only small cheat is the newtype constructor and destructor, but after compiling those are just the identity function, so I think this counts.

Show thread

Huh, I managed to make `fix :: (a -> a) -> a' as a combinator in Haskell, I just needed to define the recursive type `newtype F a = F { unF :: (F a) -> a }' and I got `\f -> (\x -> unF x x) $ F $ \x -> f $ unF x x :: (a -> a) -> a'.

olligobber boosted
olligobber boosted

all language is made up and anyone saying "the rules say you can't" doesn't actually care what's correct, they just prefer the old version because it's more bigoted

Show thread

"Looking at millions of cat pictures would be a nice way to spend a lifetime" - blog.cy.md/2021/03/24/solving-

Well, arch worked. I now have a computer that shows an image and opens ssh on boot.

I have somehow had the thought "I should just install arch". God help me.

To be clear, I haven't actually proven they aren't equivalent, I'm just pretty sure they are.

Show thread
olligobber boosted

@olligobber mutation is an important property of every successful virus in nature

Well, I made infinitely many non-equivalent viruses. Yay.

Oh, I guess it doesn't always output the virus. For example, (\xy.yx)(Virus) = \y.y(Virus), which isn't equivalent to the "virus", but is somewhat infected.

Show thread

Well, it doesn't output exactly the virus, but something equivalent to the virus.

Show thread

Well, I made a "virus" in iota. Any function whose output depends on its input will output the virus when given the virus as input. And it's only ~100 characters long. ι(ι(ι(ιι)))(ιι)(ιι)(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ιι))))(ι(ι(ι(ιι)))(ιι)(ιι)))

olligobber boosted

my LaTeX \todo macro prints "Exercise to the reader" in a box

olligobber boosted

In case you're unaware, proof-of-work blockchain (like Bitcoin) is an ecological nightmare!

olligobber boosted

@olligobber every application, whether it knows it or not, draws a line of trust somewhere. With user input the line tends to be quite close to the concept of 'security' but there's no rule that says you can't choose to eat the distrust line like a piece of delicious abstract spaghetti and let everyone do whatever they like

Show older
Mathstodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!