If I had to average a list of numbers, I would probably do it like this: averagelist(List, Avg) :- length(List, N), sumlist(List, Sum), Avg is Sum / N. This resembles the actual mathematical definition. Then you could just make a list of numbers and average that. @lurker is right, this is a terrible way to go, but it would work: average(N, Avg) :- findall(I, between(1, N, I), Is), averagelist(Is, Avg). »

Daniel K Lyons

Natural Semantic Metalanguage is a theory that claims there is a common set of semantics underlying all natural languages. This is a descriptive theory, but we can also use it to evaluate constructed languages and perhaps use it prescriptively to help us create effective constructed languages (or at least let us restrict them consciously rather than accidentally). I’ve taken the chart of NSM semantic primes from 2016 and written the Toki Pona equivalent of each prime in it, and crossed it off a list of Toki Pona words. »

Daniel K Lyons

I want you to close your eyes for a second and picture your biggest hero. Here’s mine. The man you see pictured here is Buckaroo Banzai. According to the highly informative documentary The Adventures of Buckaroo Banzai Across the 8th Dimension, Buckaroo is both a physicist and neurosurgeon while heading a rock band as well as running the fan club. One gets the sense these are just a few of the salient features of a fairly rich backstory. »

Daniel K Lyons

Here’s a philosophical question about the “White Elephant” game: is it more likely that everyone will leave with a gift they like or that at least a few people will be miserable? If you don’t know the game, the basic rules are these: every person brings one present to the game. An order is determined for players to take turns. On each turn, you may either open a present or steal a present from someone else. »

Daniel K Lyons

About the only social media achievement I am proud of in my life is that I am currently in the top ten of answerers on the Prolog tag of Stack Overflow. I’m especially proud of this because it’s something I’ve achieved by passion alone. I am not an especially talented Prolog programmer. Nor am I a particularly active Stack Overflow user. I don’t use Prolog professionally… in fact I tend to follow a “mama’s cooking” philosophy to it which is probably less than it deserves. »

Daniel K Lyons

In case you missed it, the Go guys announced an official font today. Fonts and typography are like a weird little undercurrent in programming. Knuth famously took about a decade off from his massive Art of Computer Programming project to invent TeX and METAFONT. He did this because he found the second edition printing much uglier than the first and decided he needed to fix this problem. Knuth spent a decade mastering typesetting and typography. »

Daniel K Lyons

Ho lee shit. I’ve been burning with anticipation for this album since they released “It’s Just Us Now” a couple months ago. You heard it right? This is an amazing song. At just the moment when it should go nuts, they draw back and create more room for Alexis to sing. Wow! And the video manages to reinforce it somehow. I’ve been listening to this song every other day since it came out, and generally pestering my friends about it. »

Daniel K Lyons

A response to What’s an Engineer to Do? To fritter away a huge lead in the race. That’s what Apple’s doing. And Apple’s fans, like me, are so upset about it because we see the trajectory. Apple in 2002 was facing an uphill battle, but they were going against idiotic PC manufacturers that didn’t care about build quality or design aesthetics, and OS vendors that didn’t care much about developers or power users. »

Daniel K Lyons

I’ve been worried about flour more than programming (outside work, anyway). Here’s everything I’ve discovered. Bread This has been my interest lately. The fundamental thing to know is that you’re after a certain ratio of about 5:3 flour to liquid. Beyond that you need some salt (about 1⁄2 tsp per cup, or more) and some yeast. The amount of yeast is mostly a function of when you want to bake; if you can let it rise for a day, you can use 1⁄4 or 1⁄2 tsp. »

Daniel K Lyons

I have a project of 140,000 lines of Java + 3000 lines of JS in an Angular application. I have Maven build about 20 separate Java modules and then exec Grunt to build the Angular front-end. The build takes 2 minutes on a warm machine that has run the build before. One minute of that is Grunt. Fully half of my build time is taken up by the 2% of my codebase in Javascript. »

Daniel K Lyons