Programming language notes, links
Time machine
Here is a post for years and years ago that was stuck in drafts. Some of it is still useful, but a lot is amusing to look back on. Oh, those were the days ...
General Programming
Lots of good multi-language examples at this site. It's nice for comparing how similar algorithms are implemented in different languages.http://en.literateprograms.org/
This is an awesome page, full of useful and interesting bit-twiddling tricks. In particular, with the trick to count set bits in a word, I've been able to reduce by a factor of 50 (!) the amount of time it takes to count bits in a range of memory.
http://graphics.stanford.edu/~seander/bithacks.html
Lots of information about regular expressions: http://swtch.com/~rsc/regexp/
Programming Challenges
Sites to keep you in shape:
Mathematics
The Haskell implementation of the Sieve of Eratosthenes is just cryptic. I'm not sure how a functional style of programming helps. It's much more complex that a straightforward implementation (like in Scala) would be.http://en.literateprograms.org/Sieve_of_Eratosthenes_(Haskell)
http://en.literateprograms.org/Sieve_of_Eratosthenes_(Scala)
This is a nice overview of various ways to calculate Fibonacci numbers:
http://atgcio.blogspot.ca/2013/01/computing-fibonacci.html
Go
Well worth a read if you're interested in the motivations behind Go.
Ruby
The ruby equivalent of Perl's Data::Dumper() is pp (pretty print):
require 'pp'
d = [6, 28, 496, 8192, {:a => 1}]
pp d
optparse - parsing of command line options
ostruct - creations of "structures" on the fly. It's really just a class layered on top of hashes, but with a convenient syntax for setting and getting attribute values.
To profile a Ruby app, no changes to your Ruby code are needed. And you'll discover the bottleneck isn't where you hoped it would be.
ruby -rprofile file.rb
C++
Google style guides:http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
Comments
Post a Comment