Search results for: daily programmer

A daily programmer – nuts and bolts

I’ve mentioned r/dailyprogrammer in previous posts, since I think they are fun little problems to solve when I have time on my hands. They’re also great problem sets to do when learning a new language.

This time around I decided to do an easy one with haskell.

Nuts and bolts problem description

The goal is stated as:

You have just been hired at a local home improvement store to help compute the proper costs of inventory. The current prices are out of date and wrong; you have to figure out which items need to be re-labeled with the correct price.

You will be first given a list of item-names and their current price. You will then be given another list of the same item-names but with the correct price. You must then print a list of items that have changed, and by how much.

The formal inputs and outputs:… Read more

Implementing the game “Arithmetic”

There is a subreddit on reddit called /r/dailyprogrammer and while they don’t actually post exercises daily, they do sometimes post neat questions that are fun to solve. About a week ago, they posted a problem that I solved with F# that I wanted to share. For the impatient, my full source is available at this fssnip.

The description is as follows:

Unix[2] , the famous multitasking and multi-user operating system, has several standards that defines Unix commands, system calls, subroutines, files, etc. Specifically within Version 7[3] (though this is included in many other Unix standards), there is a game called “arithmetic”. To quote the Man Page[4] :

Arithmetic types out simple arithmetic problems, and waits for an answer to be typed in. If the answer
is correct, it types back “Right!”, and a new problem. If the answer is wrong, it replies “What?”, and
waits for another answer. Every

Read more