Fun exercise: Write a Haskell function `update :: Tree a → [a] → Maybe (Tree a)`, that updates the leaves of a Tree by those given in a list (if there are not enough, return Nothing). My attempt after CW 

pop :: Compose (State [a]) Maybe a
pop = Compose $ do
xs <- get
modify' (drop 1)
pure (listToMaybe xs)

update = evalState . getCompose . go
go (Node _ []) = pure <$> pop
go (Node x ts) = Node x <$> traverse go ts

Haskell is probably one of the few languages where you have to import a module to use a for loop

Me hice hace un tiempo una lista de ideas para TFG para mates/info y me la he vuelto a encontrar. Como a mí ya no me va a servir, voy a retocarla un momento y cederla al mundo. Si alguien se anima con algo de esto porfa que me escriba que me va a hacer ilusión y tengo bibliografía de casi todo por ahí. oh, Tikz export sounds like a great idea, thanks for the recommendation!

Does anyone have any recommendations on quantum programming languages? Preferably I'm looking for something that both has a simulator and can produce a circuit diagram

"I was quite surprised as well to not find this hierarchy in the literature, so I wrote my graduate thesis about it"

You, dumb: there are infinitely many primes.
The GAP System for Computational Discrete Algebra:

*pets a graph with no cycles* what a good boy. good dag.

How do I make base phi a meme? 

There are 10 types of people: 1 that is easily understood and the other 0.1 that's completely irrational

My metaheuristics course frustrates me a lot. There's not even a hint at any theoretical basis for any algorithm :( The gist of it seems to be "try random stuff and assume solutions that are close have similar quality"

Math puzzle 

The friends win if any of them writes down the number on their own forehead. If none of them manage to do so, then the demon wins.

To motivate them we may assume that if the friends win then they all receive a small prize such as cupcakes. Otherwise the demon will keep the cupcakes and the friends will not get any.

Under what circumstances can the friends win?

Show thread

Math puzzle 

I am inspired by a toot of @mx_psi to write down a puzzle I heard last year from a friend.

Three friends are standing around when a demon appears and writes a real number on each one's forehead (they have large foreheads). The demon then invites each of them to write down a finite list of real numbers on a piece of paper. The friends may see each other's foreheads, but must not communicate otherwise. All three simultaneously reveal their papers. (1/2)

@JordiGH weird things happen in axiomatic set theories where AC is true and where AC is false or doesn't hold. I think the problem is we don't have a good intuition about infinite sets in general.

Show older

Sparkles (Alola Form)'s choices:


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