erlang

erlang

For some reason, the Gentoo install of erlang put the man pages into man sections that ended in “erl”. For example, instead a directory named man3 for the 3rd man page section, it’s man3erl.

I wrote a quick alias erlman that only searches these erlang man page sections.

~/.bashrc

Code (bash)
  1.  
  2. alias erlman="man -S 1erl:3erl:4erl:6erl"
  3.  

Gentoo
cli apps
erlang

Comments (0)

Permalink

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

erlang TextMate Bundle

I found this post containing a script that svn checkouts a fairly functional erlang TextMate bundle. Neat-o!

I edited the bundle to allow it to update itself, using a slightly modified form of the original script.

  • Bundles->Bundle Editor->Show Bundle Editor
  • Click on the menu entry text “erlang”
  • Drag a new separator to the bottom of the erlang bundle menu structure
  • Expand the erlang bundle menu
  • Use the drop-down + to create a new command
    • Save: Nothing
    • Command(s):

      Code (bash)
      1. #!/bin/bash
      2.          
      3. if [ -z "${TM_SVN}" ]; then
      4.   echo "You must define the location of your svn client in the variable TM_SVN."
      5.   exit 1
      6. fi
      7.  
      8. echo "Changing to Bundles directory…"
      9. mkdir -p /Library/Application\ Support/TextMate/Bundles
      10. cd /Library/Application\ Support/TextMate/Bundles
      11.  
      12. if [ -d /Library/Application\ Support/TextMate/Bundles/Erlang.tmbundle ]; then
      13.   echo Erlang bundle already exists - updating…
      14.   $TM_SVN up Erlang.tmbundle
      15. else
      16.   echo Checking out Erlang bundle…
      17.   $TM_SVN –username anon –password anon co http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle/
      18. fi
      19.  
      20. echo "Reloading bundles in TextMate…"
      21. osascript -e ‘tell app "TextMate" to reload bundles’
      22.  
      23. exit 0

      as downloadble file

    • Input: None
    • Output: Show as Tool Tip

Now you can update the bundle from it’s own menu option!

TextMate
erlang

Comments (1)

Permalink

erlang

I believe erlang is quickly becoming that “language I always should’ve learned” language — and all this time, I thought that language was LISP.

erlang
general

Comments (1)

Permalink