Wishful Coding

Didn't you ever wish your
computer understood you?

The Prolog Cook

brain dump alert

I had read this article on core.logic a few days back, and while making myself a dinner, I came up with this analogy.

At first, I was confused about disjunction and conjunction, so let’s start with the Prolog cook.

The prolog cook cooks depth-first. The cook has several recipes and steps to produce them. The first recipe on the list is an egg with ham and cheese.

The cook bakes the egg on top of the ham, adds some salt, finds out there is no cheese, throws everything away and moves on to the next recipe.

The next recipe is is a simple pasta. The cook checks if there is pasta, herbs, tomato, and finally checks to see how much water is in the tap.

Next up is the miniKanren cook. This cook has fair disjunction, but unfair conjunction.

So the cook looks at her recipes, picks the egg recipe, checks if there is an egg. Then, picks another recipe, like a pasta, checks if there is any pasta.

The cook keeps going over the recipes, discarding ones that can’t be made. But at some point this cook will also check how much water is in the tap. And keep checking until there is no more water.

Finally, the fair cook, with fair conjunction.

This cook goes over his recipes the same way the miniKanren cook does, but upon checking for water, this cook opens the tap and continues cooking while keeping an eye on the tap.

Maybe the recipe can be adjusted not to check for all the water. Even the fair cook is wasting a lot of water while doing other stuff, but at least she does other stuff in the meantime.

There have been very successful Prolog cooks, but not all recipes can be adjusted to work for the Prolog cook.

Philips 162 Post-Mortem

You read that right, I used my phone untill it died. This is not a review or even a preview, but a postview.

I wish there was a gadget website of which the authors are not too happy about ditching their almost-new phone. – some tweep lost in history

The upside of a post-mortem about a phone is that I used it for years, so I know all the details and annoyances. The downside is that Philips no longer makes the phone, but no matter, I wouldn’t recommend you buy it anyway.

It’s a practical phone. It lies confortably in your hand, it’s super sturdy, even after years, it lasts a week on a charge, and it even has a few games on it.

It doesn’t have a camera, wifi, bluetooth or pretty mutch anything else, but it’s great for calling and texting. The T9 feature works good, but always uses the interface language and does not allow adding words.

My number one annoyiance with the phone is that in the phonebook the screen displays only 8 of the 10 digits of a phone number in a hard to follow sliding motion.

Speaking of the phone book, I recently discovered that copying contacts to the SIM card is hard.

The menu of the phone is easy to use, but there is hardly any reason to. On a daily basis, I tend to use the directional pad to get to the most frequently used functions. This does mean it is fairly easy to do stuff accidentally if you forget to lock it.

One thing to keep in mind is that it doesn’t warn you when the inbox is full. It just doesn’t receive anymore text messages. Once in a while, when people stop replying to my messages, I need to check if it’s me or my phone.

Overall, this phone served me well. R.I.P. phone…

Pure CSS Gauge

I got nerdsniped

So I had to make this gauge using CSS animation.

I used two nested divs with round borders. The outer one does the quadrants with a top/left/bottom/right border. The inner one has only a top border, and slides over the bottom one.

Note that halfway through, the inner border changes from sliding out, to sliding in. Otherwise you’d get in trouble during the last quadrant.

A good way to see how it works is removing the negative margin, or change the inner border colour.