ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Experimenting with Other Programming Languages

**mouser**:

I've spent most of my life coding C++, and dabbling in other languages (most recently Python).

But the list of programming languages that I've never written a line of code in is starting to get big, and I think it's time I put an end to that.

So I've decided I'm going to try to do a little experimenting with other programming languages, and wanted other coders here to join me, and post your updates here.

For my first stop on the tour, I spent today coding in Go.

I was inspired to write a program to solve a homework assignment given to the daughter of one of our fellow DC members.

The assignment is as follows:

"Given a set of numbers, and a target value, find an expression using + - * / and which uses each of the numbers exactly once, which reaches the target."

For example, given the numbers [2, 3, 6, 15] find a mathematical expression that uses all of the numbers and reaches the target value of 7.

Answer: 2+(15/(6-3))

Note that there may be multiple expressions that reach a given target value. Rather than find a specific solution to a specific problem -- I was more interested in writing a program that would find ALL possible expressions given a set of n numbers, and then looking for particular targets which have few possible solutions, reasoning that these would be nice and hard puzzles to solve.

I started out by trying to calculate a formula for the # of possible expressions of n numbers. That turned out to be a very fun mathematical journey, and I encourage the mathematically inclined among you to give it a try. I'll share my formula later so as not to spoil the problem.

Anyway, so today I coded this program in Go. Looks like about 400 lines of code, and definitely a non-trivial and interesting project.

Speed and memory seemed quite reasonable, no complaints there. Error messages were reasonable.

I'll post the source code soon after I give anyone else a chance to have some fun.

However, I can't say I really enjoy Go after my day with it. Some parts of it are ugly and unpleasant, and I don't approve of many of the language design decisions.

In fairness, this wasn't really something that made use of the real strengths of Go, so perhaps it wasn't the fairest of tests.

Here's a test for you if you decide to try coding this program. I will give out a prize of a free DC mug for anyone who can solve this by writing their own version of this program before I post my source code at the end of the month.

Given the numbers [2 3 4 5 6 7 8], find TWO good, and fundamentally different, solutions that yield the target value of "2741"

Go source code for eqsolver attached.

**Ath**:

Wel, there is a section in this forum called Programming School... :tellme: ;D :Thmbsup:

**TaoPhoenix**:

Hehe well as long as Mouser is doing wild "non-trivial" things in random languages, I'll remark that while I had fun on my recent LD cruise, I wasn't as captivated as that puzzle-game from the last bunch, Undermined. I was saying there was enough there for a stats class essay paper there!

Meanwhile, assuming you're skipping the silly ones like Malbolge, what about VB.net?

**Tuxman**:

Why not LISP?

I'm beginning to experiment with C#, just to see how it has evolved during the past few years. I wonder if it would make sense to reimplement "my" C++ applications.

**mouser**:

Up next is Java programming for Android..

I highly recommend this set of tutorials, which I thoroughly enjoyed:

http://www.i-programmer.info/programming/android/5887-android-adventures-getting-started-with-android-studio.html

Navigation

[0] Message Index

[#] Next page

Go to full version