Other articles


  1. Prolog exercise: Min and Max of a list

    As a fun exercise I implemented a predicate to calculate the minimum and maximum element of a list.

    min_and_max([A], A, A).
    min_and_max([H|R], N, X):-
        min_and_max(R, RN, RX),
        N is min(H, RN),
        X is max(H, RX).
    

    Next I wrote a version with last-call optimization.

    min_and_max_2 …
    read more
  2. One thing I miss from Mercury

    It's been a year since I've written any Mercury (the purely logic/functional programming language), but there's one feature I miss. It's nothing fancy, and certainly one of the less interesting features Mercury has to offer.

    The Problem

    To understand this particular feature let's look at where other languages fail …

    read more
  3. My Experience with Xonsh

    Since January I've been using Xonsh as my main shell on both my work and personal machines. In this post I will describe what I liked and what I didn't. TLDR; I liked that I found myself scripting more under Xonsh, but it can be slow and inconvenient as a …

    read more
  4. Constructing tests for legacy code

    Every company has legacy code sitting somewhere that isn't well understood. Maybe it was written long ago and the original authors have moved on. Here's a high ROI approach to getting that code tested.

    The code I have in mind was written in a time when priorities were different, the …

    read more
  5. Using Goatcounter on NearlyFreeSpeech.net

    Here's some quick and dirty notes on setting up GoatCounter on Nearly Free Speech dot net. There are some rather opaque hoops you need to jump through in order to setup the service. I make no claim that this tutorial is perfect, but hopefully it helps someone else who is …

    read more
  6. Hunting for a Link

    There you are, browsing the web, maybe using a popular search engine. You enter your query and scan the results for a title that answers your question. There it is! You see it, the third result. You move your mouse to click.

    And what's that? what's happening? You've clicked on …

    read more
  7. Python string concatenation

    I spent a little bit of time looking into Python string concatenation times. I learned that newer versions of Python implement an optimzation for the plus equals operator. In the future I'd like to know what this optimization is. It seemed simple enough to escape by introducing an intermediate variable …

    read more
  8. Page 1 / 4 »

social