This is a simple strategy for confirming that some values are shared between requests. There must be a more 'correct' way to inspect values in concurrent requests, but I was unable to find it. I normally use a debugger to set breakpoints, but there was no way to set a …
read moreOther articles
Prolog Exercise: A Min and Max predicate in CLPFD
Yesterday I implemented a predicate to compute the min and max of a list. Today I'm doing the same, but now with constraints.
The code looks pretty much the same thanks to the handy
min
andmax
constraints.read more:- use_module(library(clpfd)). min_and_max([V], A, B) :- V #= A, V #= B. min_and_max …
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.
read moremin_and_max_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 moreMy 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 moreConstructing 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 moreUsing 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 moreHunting 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 …
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
Page 1 / 4 »