Jump to content

Programming challenges - Project Euler


Humodour

Recommended Posts

For the programmers and mathematicians out there, it's worth taking a crack at Project Euler to polish your skills and try some new things.

 

http://projecteuler.net/problems

 

I'm personally using it to master multiple languages - I'm going through all the problems in each language I'm interested in learning (Haskell, Java, Python, C++ at the moment).

 

Trying the problems in Haskell has obviously been the most eye-opening since every programme is a mathematical proof and there are no side effects.

 

You guys know of any other cool things like this?

Link to comment
Share on other sites

Or Lisp. For some that's the very definition of cool. :)

Thanks for the reminder >_

 

Remembering many a late night programming LISP for EMacs. List Processing my butt, it stands for Lots of Idiotic Single Parentheses.

 

For a nice challenge (and if you love old HP calculators), try Forth. First commercial programming language I purchased for my C64 way back (came in a nice cartridge).

“He who joyfully marches to music in rank and file has already earned my contempt. He has been given a large brain by mistake, since for him the spinal cord would surely suffice.” - Albert Einstein

Link to comment
Share on other sites

Nothing like spending more time checking parentheses in an exam than actually solving a problem. I enjoyed Prolog, recursion in that is sort of weird but cool at the same time

Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - Edsger Wybe Dijkstra

Link to comment
Share on other sites

Try a HDL like Verilog.

 

I think we touch on it in class. There are a few chapters on it in my textbook and I'll be doing chip design in later year subjects so I may as well give it a go now.

 

Or Lisp. For some that's the very definition of cool. :)

Thanks for the reminder >_<

 

Remembering many a late night programming LISP for EMacs. List Processing my butt, it stands for Lots of Idiotic Single Parentheses.

 

For a nice challenge (and if you love old HP calculators), try Forth. First commercial programming language I purchased for my C64 way back (came in a nice cartridge).

 

Haskell is so much better in that sense. All the power of LISP and more, without the parentheses.

 

Here is an example of quick sort in Haskell:

 

quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = (quicksort lesser) ++ [x] ++ (quicksort greater)
 where
   lesser = filter (< x) xs
   greater = filter (>= x) xs

 

Or with list comprehensions instead:

quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = quicksort [y | y <- xs, y <= x] ++ [x] ++ quicksort [y | y <- xs, y > x]

 

I enjoyed Prolog, recursion in that is sort of weird but cool at the same time

 

Will have to try it one day when I'm not overloaded. I've heard good things about it.

Link to comment
Share on other sites

I always had the impression that when you're combining too many strings for your eval() that's when you want to use lisp. Don't know if it's true, but I never understood the need for the weird syntax anyway.

 

Nowadays I just stick with python, sometimes it's hard to believe that it's both good and popular (meaning more libraries).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...