Older blog entries for SyntaxPolice (starting at number 25)

  • I saw Rilo Kiley last night with my gf and her sister. This is one of her sister's favorite bands.

  • Still really want a laptop linux machine.

  • Brian took some action shots from indoor rock climbing recently. Sorry they're big. I'll resize them eventually. It features my gf trying very hard to get over an edge, me cimbing both freestyle, on a rope, and with ice climbing equipment, lots of silly faces from Brian, and quite a number of random people, some of whom found the camera and created their own art.
  • Have an initial version of the Haskell Control.Monad.State documentation. I'm mulling over who to ask to double check it.
  • kwoo: No problem. Of course now I am obliged to point out how awesome Haskell is :)

  • Subversion is being bratty lately. All my commits leave the repo in a bad state and I have to run svn recover. Commiting gives me no error, though!
  • 4 Mar 2003 (updated 4 Mar 2003 at 21:20 UTC) »
  • Pretty busy at work lately
  • Working on some documentation. Converted most of the Alex documentation to docbook.
  • Working on documenting the Control.Monad.State module a bit.
  • I finally got my own climbing shoes.
  • Tried climbing w/ the ice-climbing tools the other day (may have pictures soon) which was fun, but I cut myself a little.
  • kwoo should note that there is an entire book on O'Caml being translated to English. Perhaps this is what he was referring to?
  • Spent some time over the weekend with my friend Phil working on Category Theory. He was nice enough to study a book for me and speant Sunday afternoon teaching me. I really enjoy abstract stuff like graph theory, but I hear that you have to get really good at the less abstract stuff like calculus in order to really learn the other stuff.

  • Ohio State was closed yesterday due to lots of snow. Though I graduated in june, when it was announced, I headed over to the oval, along with hundreds of other students, for a massive snowball fight. There were also streakers (all male), but we didn't flip over any cars :(

  • I've discovered that more often than not, you can ignore things that say "click here" since they're usually popups or something. I think nytimes.com always opens up a popup window like that, but since I use Galeon with popups in tabs, I don't know what they say.

  • Hacked w/ walters on Apt last night, which was cool. We're getting together again on wednesday.

  • Upgraded the gf's computer (she uses Debian, of course) the other day and we were both a little annoyed to see that Abiword had altered its layout, and the letter she was writing no longer fit on one page. We needed to print it and since she was out of ink, we reformatted, saved as MS Word and tried to print it on her roomate's computer. To my delight, the formatting was almost identical to how it looked in Abiword. Hurray for them!

  • For valentines day, I took my gf to a Trio Voronezh performance. They're really cool.
  • Happy Valentine's day.

  • This morning I was pleasently surprised by how easy it was to convert an example from "The Craft of Functional Programming" to using the Control.Monad.State module instead of building the state monad by hand. The example from the book can be found on page 409. I won't post it here because I can't decide if that would be rude, but here is my version using the state monad (some of the functionality implemented in the book is built into the State monad):

    data Tree a = Nil | Node a (Tree a) (Tree a) deriving (Show, Eq)
    type Table a = [a]
    nNode::  (Eq a) => a -> Table a -> (Table a, Int)
    nNode x table
        = case (findIndex (== x) table) of
          Nothing -> (table ++ [x], length table)
          Just i  -> (table, i)
    
    

    numTree' t = fst (runState (numberTree' t) []) where numberTree' :: Eq a => Tree a -> State (Table a) (Tree Int) numberTree' Nil = return Nil numberTree' (Node x t1 t2) = do num <- numberNode' x nt1 <- numberTree' t1 nt2 <- numberTree' t2 return (Node num nt1 nt2) numberNode' x = do table <- get (newTable, newPos) <- return (nNode x table) put newTable return newPos

    Which reminds me that I want to point out my favorite example of the use of the Maybe monad so far. This may be obvious, but it was eye opening to me when I first saw it:

    addM'' :: Maybe Int -> Maybe Int -> Maybe Int
    addM'' x y
        = do
          a <- x
          b <- y
          return (a + b)
    
    You could put all that on one line using ';' also. Here's the same code but without the use of the monad:
    addM' :: Maybe Int -> Maybe Int -> Maybe Int
    addM' x y
     = if (isNothing x) || (isNothing y)
       then Nothing
       else Just ((fromJust x) + (fromJust y))
    

    In general, I'm deep into the mode of hacking on State monads. I built a large function with them today and I'm deciding if I like the implementation or not. I definitely like the above example. I want to do some more exercises w/ state monads to get more intuition about when they're useful and when they're not useful.

  • Sorry for the HTML errors in the last post, all I can say is that advogato was too slow for preview.

  • I improved my web page.

  • I find myself disappointed today that Haskell's List.delteBy function is less useful than it could be. For one thing, its annoying type sig is:

    deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]

    When it could easily be

    deleteBy :: (a -> Bool) -> [a] -> [a]

    where that test element is curried. This makes it more general.

    The second annoying thing about it is that I actually want the element it found to be returned to me also. I could do a two-pass version of this by combining several library functions, but I want a function like:

    findAndDeleteBy :: (a->Bool) -> [a] -> (Maybe a, [a]) --or
    findAndDeleteBy :: (a->Bool) -> [a] -> Maybe (a,[a])

    Here's my function:

    -- |This function is like deleteBy, but also returns the element, if
    -- any. This is useful for locating an element in a list which fits a
    -- certain proporty, /f/, altering that element, and sticking it back
    -- into the remaining list.
    findAndDeleteBy :: (a -> Bool)    -- ^An equality function, /f/
    		-> [a]            -- ^A list to check out
    		-> (Maybe a, [a]) -- ^Found elem, rest of the list
    
    

    findAndDeleteBy f (h:t) = if f h -- Test the expression then (Just h, t) -- Found it else let (e, l) = findAndDeleteBy f t -- Try the rest in (e, h:l) -- Put it back together

    findAndDeleteBy f [] = (Nothing, []) -- Base case

  • Very happy to find that the bug in ghc is fixed and I can get back to hacking.

  • Shapr from #haskell has set up a nice cvs repository for Haskell libraries on a href="http://sourceforge.net/projects/haskell-libs/">sourceforge</a>
  • Several pieces of good news this morning:

  • The HTk authors happily agreed to use my simple Go board as an example program.

  • The GHC authors tell me that they have probably fixed a bug that has been causing me problems.

    In other news:

  • Last week I got permission from the Hugs Debian maintainer to do an NMU since the package is out of date and won't work on several platforms. But the update is a little harder than expected. I sent a message upstream.

  • I went snowboarding w/ walters on saturday. I got a free lesson too, which was great.
  • Good weekend. On friday I saw Adaptation. Saturday I hacked with Colin on Apt and then prepared for the Hackathon which went really well. Sunday I skipped church then made brunch for some of my friends who said that I made the most beautiful omlets ever seen or eaten. Then I went climbing with Brian and finally rounded the day out with a lengthy game of Diplomacy which is sort of like Risk. Yesterday was MLK Jr. Day and I slept in then read for a while, then did some writing and thats really about it.
  • 16 older entries...

    New Advogato Features

    New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

    Keep up with the latest Advogato features by reading the Advogato status blog.

    If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!