martes, 15 de mayo de 2012
We all heard stories about lisp machines (genera), and eventually read some article or seen some talk about how awesome it's lisp to debug.. but for me it was not so straightforward.
I'm using SBCL for all my experimentation in CL, so the examples here are going to be all sbcl related. First of all, some reasons on why there's not an easy mapping between your debugger on the language next door and lisp when debugging:
- Lisp normally compiles the source code to native code. Doing so, it runs lots of optimizations on your source, so the code executed has no direct mapping to your written code.
- Lisp is not line oriented, so the order of execution of code is not so easily mappable to the typical next-line, next-line... debugging.
- On the other side, you have 'trace' that lets you track all executions of a function, with params, and so. It's not so live, but with all the instrumentation that sbcl and slime provide, you can track down a fair amount of bugs just with trace.
To instrument a method to be debuggable more easily, my advice is to add this declarations.
(declare (optimize (speed 0) (space 1) (compilation-speed 0) (debug
That'll keep sbcl out from doing optimizations that can make variables 'disappear' in runtime.
A little more info in:
and obviously, in your nearest implementation manual http://www.sbcl.org/manual/Debugger.html
lunes, 14 de mayo de 2012
The other day I tried to install a newer version to work with geiser (and because I had been reading some nice things related to new versions on Wingo's blog), but the installing process wasn't as simple as ./configure && make install. Mostly my fault, because I just needed many *-dev packages that were not present in my box. But after installing gmp and some other easy-to-find libs, I got stuck into "No package 'bdw-gc' found". As jao put in a mail in guile maillist,
"You can tell configure where BDW is located by setting the above mentioned environment variables. With libgc-dev installed from a deb, i routinely do (in a bash prompt): $ BDW_GC_CFLAGS=-L/usr/lib BDW_GC_LIBS=-lgc ./configure "
domingo, 13 de mayo de 2012
And you love the way vim allowed you to do crazy stuff inside a map. But now you're in emacs, so let's see how we can scratch your itch.
My concrete case was inserting strings like (?* ?x) where x is a parameter.
- Skeletons. Skeletons can do that and much more. it's a classical template inserter. For example, you can setup a skeleton of the desired output and interleave str symbol, that will be replaced for the input you'enter.
Skeleton can do more sophisticated things, like inserting multiple lines while user keeps entering data. I can imagine myself using this when entering lots of data with some desired format.
- Yasnippets. Yasnippets are skeletons on steroids. Sad thing is that there's no direct way to bypass the file used to define snippets. I guess you can open a new buffer, put it into yasnippet-mode, and c-c c-c to activate the binding for just this session, but maybe it's too much of a hassle.
- defun+insert. The dumb way to do it, but the most straightforward if you tend to forget rarely used functionalities like skeletons. Just define an interactive function that inserts your shit there, and call it at will. That's the option I go when I don't wanna spend a minute looking for skeleton docs.
I'd love to hear other solutions on that same issue. Any suggestions?
sábado, 12 de mayo de 2012
BIG BIG respect.
From programming techniques, to creativity. Raymatching, compressing, and music. Everything pushed to its limits. There's been a recent thread in HN, with a quite a few links to tutorials, videos.
And here's the freaking amazing demo that started the hn thread. Prepared to shit bricks? All that thing fits in 4096 bytes.
jueves, 3 de mayo de 2012
Here there are a couple of videos of the same talk "Simple, made easy", by Rich Hickey. I love Rich's talks, and I think it's even enlightening seeing the same talk twice, fine tuned for different audiences.
First one is from RailsConf 2012 Keynote. Done with a ruby audience in mind.
Second one is from StrangeLoop 2011. much more hilarious and punchy IMHO, and maybe a little less serious tone, but equally enlightening.Here it is. bye!