Thanh Dinh Khac

I am a software engineer with a passion for ProgrammingLanguage. I use CeePlusPlus and JavaLanguage in my daily work but my favorite is PythonLanguage. I have learnt the basic of RubyLanguage, HaskellLanguage and LispLanguage.

Hi Thanh. They say that the more languages you learn first, the more awesome SmalltalkLanguage will be when you get to it.

That's why you should try RubyLanguage. --PhlIp (currently besotted with PythonLanguage - please don't remind me of it!)

I learned RubyLanguage a few months back. I really liked BlocksInRuby.


My favorite quote is "Closures are poor man's objects and objects are poor man's closures" - ClosuresAndObjectsAreEquivalent. From Charming Python (http://gnosis.cx/publish/programming/charming_python_16.txt):

      #------- Smalltalk-style (Python) tax calculation -------#
      class TaxCalc?:
          def taxdue(self):
              return (self.income-self.deduct)*self.rate
          def setIncome(self,income):
              self.income = income
              return self
          def setDeduct(self,deduct):
              self.deduct = deduct
              return self
          def setRate(self,rate):
              self.rate = rate
              return self
      print "Smalltalk-style taxes due =",             
             TaxCalc?().setIncome(50000).setRate(0.30).setDeduct(10000).taxdue()
and
      #------- Python Functional-Style tax calculations -------#
      from functional import *

taxdue = lambda: (income-deduct)*rate incomeClosure = lambda income,taxdue: closure(taxdue) deductClosure = lambda deduct,taxdue: closure(taxdue) rateClosure = lambda rate,taxdue: closure(taxdue)

taxFP = taxdue taxFP = incomeClosure(50000,taxFP) taxFP = rateClosure(0.30,taxFP) taxFP = deductClosure(10000,taxFP) print "Functional taxes due =",taxFP()

print "Lisp-style taxes due =", incomeClosure(50000, rateClosure(0.30, deductClosure(10000, taxdue)))(


EditText of this page (last edited April 9, 2011) or FindPage with title or text search