August 2007

Functional Programming Frenzy

My journey into the world of Erlang is progressing nicely. I’m really excited by the possibilities the language offers.

Haskell: the Craft of Functional Programming

I wanted to get more perspective on functional programming by learning another functional language as well. Since my forays into LISP over the years never amounted to much, I decided to try out Haskell. I’ve been concerned about the buzz surrounding Erlang — buzz always seems to mask why something really is good or useful, because some are clamoring that it’s good and useful for everything.

So, I ordered a copy of “Haskell: the Craft of Functional Programming” — I mean heck, how do you spend your Fridays?

erlang
functional programming
haskell

Comments (0)

Permalink

Terminal.app v. erlang and Latin-1 characters

On pages 29-30 of “Programming Erlang” by Joe Armstrong, the author goes over character strings. Erlang uses Latin-1 as it’s character set. At first, Terminal.app wasn’t showing the non-US / ASCII characters.

There’s a two-step process to solve this:

  1. Terminal->Window Settings…->Display->”Character Set Encoding” set to “Western (ISO Latin 1)”
  2. Set the environment variable LC_ALL to “en_US” before you run erl. Also, see the next paragraph for explanations.

Terminal.app Erlang Latin 1Terminal.app Latin 1 Settings

The above steps are for U.S. English — something similar is available for most locales, but I don’t know the specifics. Of note, is the 2nd step; firstly, LC_CTYPE is the specific value to set, but LC_ALL sets LC_* to the assigned value, so one usually wants LC_ALL, unless you have a very unique locale configuration. Secondly, I’m using Gentoo Prefix Portage environment on OSX, so while I feel that these directions are applicable to most OSX installs, my setup is slightly different, so your mileage may vary. Thirdly, for those that need UTF-8, they can set LC_ALL to “en_US.UTF-8″, and then they only have to toggle Terminal.app’s character set encoding. Why en_US.UTF-8 works, I do not know — Latin 1 is not a subset of UTF-8, so I’ll leave that to more inquiring minds.

After you find settings that you are happy with, consider adding export LC_ALL="en_US.UTF-8" to your ~/.bash_profile if you’d like it to load with every terminal window that opens. My ~/.bash_profile sources my ~/.bashrc, because ~/.bashrc is supposed to be safe for scripts that run as your user, but non-interactively; so, ~/.bash_profile tends to get a lot of my environment look and feel code.

OSX
erlang

Comments (0)

Permalink

Wha-wha-what?! You can make your own control structures?

programaticprogammer-programmingerlang.jpg
I’m working through the Programming Erlang book that my friend zuzu recommended to me. Forty-six pages in, and so far, so good.

I did, however, just have my mind blown. I was going through an example for creating a for-loop-like function, because erlang doesn’t have a for-loop. “Well,” I thought, “that’s interesting that you have to create your own control structures.” But then the book spelled it out straightly: you can create any control structure you want — you are not limited by the control structures that the language offers.

Result? Mind is blown.

erlang

Comments (0)

Permalink

T-Mobile Dash, OS X, and Internet Sharing

UPDATE: everyone at my workplace knows that I love to iPhone-hate, but I would just like to compare the annoying but simple PAN tethering steps for OSX to Dash with the steps described here. Suffice to say, you need to hack the iPhone’s OS — a terrible only-option, in my opinion, but a well documented one. I used to hack on homebrew software for my PSP, so I can appreciate these efforts, but I also don’t take having to use homebrew seriously, especially for high-end phones. Laughable.

I recently upgraded my aging Treo 650. I really do like the Palm OS — I’ve been using it for years and years — but the phone was starting to drop calls frequently after one too many drops straight on it’s antenna. *whoops*

So, I got a T-Mobile Dash. As a phone, I like it. As a OSX user that likes having internet connectivity, as well as a business person that likes syncing my calender, tasks, etceteras, I knew I was going to be in for some fun.

Say what you will about how awesome the iPhone is, but for feature-set and “bang for buck,” the Dash is a clear winner. Considering I work for a media-centric company, not being able to record videos on the iPhone made it a non-option almost immediately.

I installed the Windows Mobile 6 upgrade (link). You’re going to have to do this from a Windows box, or from within Parallels or VMware. I didn’t use WM5 for long, but WM6 is stable, and honestly, a lot more pretty.

I’m using Mark/Space Missing Sync for Windows Mobile 4.0 (link). The pre-lease worked pretty well, but I’ve been having some issues with the current release. I have a good feeling from the Mark/Space people, however, so I think that it will be resolved soon.

There is some really good news, as well. Since 10.4.9, OSX supports PAN bluetooth profile, so I can use my Dash as a modem! On the Dash, you can turn this feature on by going to Start->Accessories->Internet Sharing, then make sure “PC Connection” is “Bluetooth PAN”, “Network Connection” is “T-Mobile Data”, and click “Connect”. On the OSX side, if the Bluetooth menu is in your menubar, just click on it, and select “Join Network on XXXX,” where XXXX is your device name.

MacBook Pro
OSX
Windows Mobile
bluetooth

Comments (4)

Permalink