20090420

When using map in a vim script...

I was struggling with editing this script when calling the map function. What I was missing was that in the expression following the list (l:block in the example below), it's necessary to surround your function call in single quotes, like this:
  • call map(l:block,'Vicle_strip_birds(v:val)')
That's because even though it's a function call, it's a string as far as the map function is concerned. That's kind of weird for me.

*Shrug*

At least the script works now.

20090417

interacting with a REPL from vim

This is a really good starting point for using vim with a REPL (Wikipedia says calling it an "interpreter" is wrong). Mr. Martinez has done a nice job.

http://www.vim.org/scripts/script.php?script_id=2551

I've wanted something this simple for a while. Being used to scvim for SuperCollider, I wanted the same thing when using other interpreted languages, like Octave, Scheme, and now Haskell. I tried other similar scripts, but they were too complex. This is almost right. I'm modifying it to suit me, and then I'll post it.

20090323

Using Glade and Gtk2Hs with Haskell on Debian Sid

I wanted to try this tutorial:

http://haskell.org/gtk2hs/docs/tutorial/glade/

For me, there were many difficulties. Actually, it seems that the problems were user error on my part, discovered after trying to repeat the process on a second computer. You need to install the dependencies:

apt-get install gtk2hs-doc libghc6-cairo-dev libghc6-gconf-dev libghc6-glade-dev libghc6-glib-dev libghc6-gnomevfs-dev libghc6-gstreamer-dev libghc6-gtk-dev libghc6-gtkglext-dev libghc6-soegtk-dev libghc6-sourceview-dev libghc6-svgcairo-dev

All of this works, except for:

E: Couldn't find package libghc6-sourceview-dev

Then I had to adjust my .hs file to match the contents of the XML file generated by Glade. For instance, I changed line 9 to read:

window <- xmlGetWidget xml castToWindow "HelloGTK2hs"

CORRECTION: This was my mistake. I typed "HelloGTK2hs" in the "name" field rather than the "window title" field. Be careful!

A note to myself: it might be wise to try a process a second time on another computer before writing a blog post!