Saturday, July 18, 2015

Pluto, Haskell, and Star Trek

1) There are mountains on Pluto. Mountains of ice. Young ones. Where did they come from? We still have much to learn.

2) How to code in Haskell! Ok, not really -- I'd actually read a bunch on Haskell over the years, and even coded up a few snippets. Today, though, I put together a Haskell program that's actually useful for something useful. Not very useful, mind you, but at 100-ish lines it's by far the most I've done in Haskell (and 100 Haskell lines does more than you'd think it would). Haskell is an unusual language... I once asked a friend of mine why he'd done a project in Haskell, and his answer was "It's fairly difficult to write a program in Haskell that will compile and still not do what you want." The flip side to this is that it's one of the more difficult languages in which to get things to compile. It's quite common to get errors like:

"Couldn't match expected type ‘Color -> [(Card, Int)] -> b’
                with actual type ‘[Char]’
    Relevant bindings include
      output :: [b] (bound at process_cube.hs:28:9)
    The function ‘unlines’ is applied to three arguments,
    but its type ‘[String] -> String’ has only one
    In the expression: unlines list_cards_with_color c merged_cards
    In the first argument of ‘map’, namely
      ‘(\ c -> unlines list_cards_with_color c merged_cards)’"

*sigh*. Not the most helpful, eh? One thing I've discovered is that a heck of a lot of errors in Haskell are because either a) the order of operations somewhere isn't what you expect, or b) you tried to treat a list of Foo as thought it were a Foo, or a Foo as though it were a list of Foo.

Another tip for Haskell programming, at least for beginners -- forget efficiency. It will just hold you back. Let Haskell handle the "efficiency" stuff and it will work out fine.

3) ...about Star Trek: Axanar. It's a studio-independent, crowd-funded Star Trek movie of much higher quality than most. It's a monologue-driven (fictional) historical documentary about the Four-Years War, an early conflict between the Federation and the Klingon Empire. It's got some real talent in its cast, including Richard Hatch and Kate Vernon from Battlestar Galactica (Tom Zarek and Ellen Tigh, respectively), and J. G. Hertzler (Martok from Star Trek: DS9). Axanar is still in production, but there's a 20-minute short prelude up on Youtube, which I encourage any Star Trek fans out there to go check out (https://www.youtube.com/watch?t=1112&v=1W1_8IV8uhA). 

No comments:

Post a Comment