I keep getting drawn to Haskell’s simplicity, consistency, structural elegance, and perfect typing system, even though it still causes me a great deal of mental strain to understand it. And I found that after being away from it for several months, even the simplest concepts have to be re-learned.
The second thing I did is to give “Programming Praxis” a try. In the past I used Project Euler, but having solved 108+ problems, I’m getting tired of the same old, same old. I’m sure I’ll get to the same point with Praxis, but for now its giving me a change.
Praxis 1 – Create a RPN calculator:
Loved my HP 48sx+ calculator in Engineering. Sad day when it kak’d. Still have trouble using regular algebraic calculators. So this one was is right up my alley. Lots of sample code online, but I started noticing that most code used function composition, rather than using variables. Up until now I always avoided function composition, but it really does make things clearer.
import Data.List solveRPN :: String -> Float solveRPN = head . foldl calcme  . words where calcme (x:y:ys) "*" = (x * y):ys calcme (x:y:ys) "+" = (x + y):ys calcme (x:y:ys) "-" = (y - x):ys calcme (x:y:ys) "/" = (y / x):ys calcme xs numStr = read numStr:xs main = do putStrLn "Enter calculation: " input <- getLine putStrLn $ "Result = " ++ (show $ solveRPN input)
Purely as a proof-of-concept, I whipped up a web application using only cloud development tools and PaaS deployment. The concept of web-based Cubbyholes for text might seem overly simplistic, but all coding was done in the cloud using Exo IDE (now called Codenvy) which provides Python code to be directly deployed to Google’s AppEngine PaaS.
Follow up: Trying to mix JQuery Mobile framework for iPhone with Google AppEngine. Trickier than I thought because of the python handler…
Building Project-2-Factor to be a customizable and mobile (iPhone web app) version of PasswordCard. Bit of a headache.