Thursday, April 02, 2009

Write Yourself a Scheme - 1

Here are the solutions to ``Write Yourself a Scheme in 48 Hours'', "First steps: Compiling and running".

ex1.
main = do args <- getArgs
    putStrLn ("Hello, " ++ args !! 0 ++ ", " ++ args !! 1)

ex2.
main = do line <- getLine
    putStrLn("Hello, " ++ line)

ex3.
str2int s = read s :: Int
str2flt s = read s :: Float

main = do args <- getArgs
    putStrLn (show (str2int(args !! 0) + str2int(args !! 1)))

Labels: ,

Monday, March 30, 2009

metaSendsEscape

Occasionally we can found that the Bash key-binding such as M-f/M-b will not work in XTerm (this happened both in my laptop and desktop), to solve this problem, just press `Control' and left mouse and check the item `Meta Sends Escape' from the main options.

To turn it on permanently, add the following line to configure file '/etc/X11/app-defaults/XTerm':

*metaSendsEscape: true