# Generating perfect portmanteaus

A quick programming post, since it’s been a while, inspired by this video:

I’m not going to go quite as far as that, but I thought it would be interesting to write up some quick code to generate portmanteaus1.

read more...

# Number words

Today’s five minute post brought to you via Programming Praxis / Career Cup:

Given a positive integer, return all the ways that the integer can be represented by letters using the mapping 1 -> A, 2 -> B, …, 26 -> Z. For instance, the number 1234 can be represented by the words ABCD, AWD and LCD.

read more...

# Dis/re-emvowelification

So far this week we’ve had a pair of related posts at the DailyProgrammer subreddit1:

Basically, if you’re given a string with vowels, take them out. If you’re given one without vowels, put them back in. One of the two is certainly easier than the other2. :)

read more...

# NPR Sunday Puzzle

Yesterday’s puzzle from Programming Praxis asks us to solve a Sunday Puzzle from NPR:

Think of two familiar, unhyphenated, eight-letter words that contain the letters A, B, C, D, E and F, plus two others, in any order. What words are these?

It’s another in a long history of word games, my favorite sort of puzzle.

read more...

# Numbers as words in arbitrary bases

Today’s intermediate challenge on Reddit’s /r/dailyprogrammer intrigued me somewhat, so I decided to take a crack at it. The basic idea is if you are given a number, try converting it to all bases from 2 to 64 (with a special encoding). Print out any of those that are words.

For example, if you interpret the number 44,269 as a base 16 (Hexadecimal) number, you get the word “aced”. So just how many of these words are there out there?

read more...

# Chopping words

One more challenge from Programming Praxis’ Word Games today (there are only a few left!). This time we have the challenge of cutting off bits of words, one letter at a time, such that each step is still a word.

The example given in their post is planet → plane → plan → pan → an → a, although surely many such examples exist.

read more...

# Dodgson’s Doublets

Today we have doublets source code, dictionary source code, queue source code. Using the same source code as the previous two posts (here and here, described originally here) for the dictionary, the code is a pretty straight forward case of using recursion to do backtracking. Basically, try all of the possible next words one letter different. Whenever you find a dead end, back up and try a different path. Something like this:

read more...

# Squaring the Bishop

Okay, this one was just neat. Based on word-squares source. I’ve only tested it in Racket 5.3+, but newer versions should work as well. Racket 5.2 won’t work without some tweaking as (at the very least) it’s missing a definition for string-trim.