New writing project

I haven’t been writing much here recently. Partly due to starting a new job (after busy day I just want to relax) and partly due to playing lots and lots of Crusader Kings 2 (not quite sure if this is that relaxing game though). But I have been tinkering with some code and other stuff on my spare time still.

One of those other stuff – projects is Hy Files. As far as I know, there hasn’t been an attempt to write a book about Hy before. Initially I wanted this to be a neatly laid out pdf or even physical book, but quickly realized that by the time I would get around finishing it, the Hy would be really different language. So I decided to publish what little I had gotten written and make it a living book. Sources are available at GitHub and I plan to keep on chipping this on my spare time.

Hy and Boolean algebra

Recently I started wondering how Boolean algebra actually worked in Hy. I knew that we followed usual Python conventions and was sort of aware of them, but decided to dig into deeper and see how things actually are.

Granted, Boolean algebra maybe doesn’t sound the most exciting subject, but I found the results interesting. This post looks into things if Python 3.4 and 0.12.1 development version of Hy are used.

Continue reading

Hy 0.12.0

It’s been a long journey, full of both joy and humbling moments. Working on Hy has given me chance to learn from people who are not only bright, but extremely kind and friendly too. The journey continues, but now it’s moment to relax and celebrate what has been achieved as Hy 0.12.0 has been released.

 

Some hylarious macro shenanigans

Just a word of warning: what I’m about to describe here makes even less sense than what I usually write. It’s probably very bad idea for various reasons and definitely shouldn’t be used in production code. However, it might come handy in some limited situations and offer short term gains that justify the bad things. Use your own judgement.

As you might know, Hy is gearing towards the next release and there will be some major, code breaking changes. Things like let and defclass will have changed syntax and some aliases will be dropped (true doesn’t work anymore, only True). After talking with various people, I started thinking “what kind of system could help me to port old code to new one?”. And of course I turned for macros. So, here I’m going to show basic implementation for a macro that takes Hy code written in old syntax and transforms it for the new syntax. One can then wrap all existing code in that macro, update Hy and things hopefully work right out of box. Then it’s just matter of manually fixing things on the new syntax, while having test suite to check that there has not been any errors in process. Sounds easy enough, right?

Continue reading

Mathematical patterns with Hy

I recently read a blog posting that among other things touched patterns in mathematics, how they seem to be obvious to some people while others strugle and if there would be something that schools should do differently in teaching mathematics. Those of you who know me, can guess that this is close to my heart (after all, I keep bringing up Lockhart’s Lament often in day to day discussions). So I dug out my trusty Hy REPL and started playing with sequences just to see what one could do with them.

Continue reading