Mostrar mensagens com a etiqueta lisp. Mostrar todas as mensagens
Mostrar mensagens com a etiqueta lisp. Mostrar todas as mensagens

2007-09-23

Practical Common Lisp

Just recently, I have finally bought Peter Seibel's book Practical Common Lisp.

I had already read most of it on the web. The chapters on CLOS and LOOP were particularly useful for me since the previous Lisp book I had read, Paul Graham's ANSI Common Lisp, largely neglects these important features.

What can I say? It's a great common lisp tutorial.

Update: as someone kindly mentioned in the comments, Seibel's book has a chapter dealing with CL's condition system, aptly named “Beyond Exception Handling: Conditions and Restarts”. This very important feature is also neglected by pretty much every other book about Lisp.

2007-08-31

Dia do Blogue / BlogTago / BlogDay

Blog Day 2007

[pt] Esta entrada trilingue comemora o 3.º Dia do Blogue divulgando alguns dos meus blogues preferidos.

[eo] Per la jena trilingva blogaĵo mi celebras la 3-an BlogTagon diskonigante kelkajn blogojn kiuj plej plaĉas al mi.

[en] This trilingual post celebrates the 3rd BlogDay by promoting some of my favourite blogs.

Que Treta! (pt)

[pt] Este blogue português da autoria de Ludwig Krippahl é impecável. Trata temas que vão da biologia à política passando pela religião e a ciência. Faz pensar, e o cérebro agradece. É a minha recomendação #1.

[eo] Tiun ĉi blogon verkas portugale Ludwig Krippahl, kaj ĝi bonegas. Ĝi pritraktas temojn kiel biologio, politiko kaj religio. Pensigas, kaj la cerbo dankas. Mia rekomendo #1.

[en] This portuguese blog by Ludwig Krippahl is most excellent. It approaches subjects ranging from biology and science to politics and religion. Lots of food for thought here. My #1 recommendation.

E-planedo (eo)

[pt] Aqui são agregados vários blogues espalhados um pouco por todo o mundo, cujos autores escrevem em esperanto, uma língua auxiliar internacional.

[eo] Vi certe jam konas E-planedon. :-)

[en] This page aggregates various blogs spread all over the world, whose authors write in Esperanto, an international auxiliary language.

Planet Lisp (en)

[pt] Outro agregador de blogues. O tema deste é a minha linguagem de programação preferida, o Common Lisp.

[eo] Alia blogaro. Ties temo esta la programlinvgo kiun mi plej ŝatas, Common Lisp.

[en] Another blog aggregator. This one's about Common Lisp, my favourite programming language.

Schneier on Security (en)

[pt] A segurança, nomeadamente no que diz respeito ao terrorismo, é um tópico quente nos dias que correm. Schneier sabe do que fala e não tem papas na língua para criticar as más práticas de segurança, mentiras, mitos, etc.

[eo] Sekureco, nome rilate al terorismo, estas grava temo hodiaŭe. Schneier spertas pri tiu temo kaj ne hezitas kritiki malbonajn sekurec-praktikojn, mensogojn, mitojn, ktp.

[en] Security, namely terrorism-related issues, is a hot topic these days. Schneier is a security expert who doesn't hesitate to criticize bad security practices, lies, myths, etc.

TED Blog (en)

[pt] TED significa tecnologia, entertenimento e design. São esses os temas desta conferência anual onde participam pessoas como James Watson, Richard Dawkins ou Bill Cliton só para mencionar alguns nomes proeminentes. Entre outras coisas, neste blogue são divulgados regularmente vídeos com apresentações extremamente interessantes de conferências passadas.

[eo] TED signifas teknologion, amuziĝon kaj dezejnon. Pri tio temas tiu ĉi ĉiujara konferenco kiun partoprenas homoj kiel James Watson, Richard Dawkins aŭ Bill Cliton nur menciante kelkajn elstarajn nomojn. Interalie, tiu ĉi blogo ofte disponigas videojn kun ege interesaj prezentoj de pasintaj konferencoj. TED ja ne tedas.

[en] TED stands for technology, entertainment, and design. Those are the subjects of this yearly conference that features participations from people like James Watson, Richard Dawkins or Bill Clinton just to mention a few prominent names. Among other things, this blog regularly makes available extremely interesting video presentations from past conferences.

[pt] Dado que não participei nas duas edições anteriores deste evento, aqui ficam mais dez blogues que me agradam:

[eo] Pro tio ke mi ne partoprenis la du antaŭajn eldonojn de tiu ĉi evento, jen pliaj dek blogoj kiujn mi ŝatas:

[en] Since I didn't participate in the previous two editions of this event, here are ten more blogs I like:

2007-08-28

trivial-features 0.1

Google's Summer of Code 2007 is over so, over the next few weeks I'll be releasing the various stuff I worked on this summer.

First up is trivial-features which ensures consistent *FEATURES* across multiple Common Lisp implementations. Well, it tries to; patches for exotic Lisps, operating systems, and CPUs are welcome. Comments and suggestions are welcome too. Consult its cliki page for more details.

While we're on the subject of features, “Maintaining Portable Lisp Programs” is an interesting paper by Christophe Rhodes that discusses common pitfalls when using read-time feature conditionals and suggests some good practices.

2007-08-06

My blog got comments

Whoo hoo! My last few posts got some interesting comments, one of which mentions darcsum.el which is a nice Darcs mode for Emacs. My first impression with M-x darcsum-whatsnew is that it's not as nice as git-citool in one important way: it doesn't let me easily write my changelog while simultaneously picking what changes should be recorded. But it has some advantages too: its convenient keyboard shortcuts don't make me have to reach for the mouse and, hey, it's an Emacs mode. Still, no gitk-like repository browsing functionality.

Apparently, I'm not a Star Wars geek since I completely missed the “elegant weapons” reference in that xkcd comic about Lisp. Some people were upset about that.

Finally, it appears that dots in package or system names are generally disliked though it seems that's not something most people feel very strongly about. I don't like them.

2007-08-04

Quick opinion poll regarding style

Do you like dots in package or ASDF system names?

  1. I do like them. (Please explain why.)
  2. I hate them. They break the pleasant symmetries formed by parentheses, dashes, and colons. E.g., (foo-bar-quux:frob-baz-now) vs. (foo.bar-quux:frob-baz-now)
  3. I don't care.

Please leave your answer in the comment form. Thank you.

2007-08-01

Lisp featured in xkcd, again

xkcd has mentioned Lisp before, but smug Lisp weenies will probably find this one funnier. As a bonus for Lispers who like to waste time playing Nethack — and there are quite a few, myself included — this comic includes a funny reference to the game, hah.

2007-07-31

All the cool kids are using Git

Yes, it used to be true that all the the cool kids were using darcs. Darcs is so 2005, though, so I've decided to take Git for a spin. Here's what I'm enjoying the most so far:

  • git-citool is a very cool GUI for picking what changes you want to commit, write the commit message, commit, push to a remote repository, and more. I love this little application. It lets me go through my changes in any order, go back to Emacs and fix any mistakes without losing my commit message or the list of changes I've already marked for commit. Love it.
  • gitk lets me visualize the repository history. All the patches, all the branches, all the diffs, all the commit logs, easily accessible within a few clicks. It's quite fast too.
  • Another useful feature git-citool has is a history browser that lets me browse my repository and see each file's history, which patches change which lines, navigate through the various past states of a file, etc.

And, of course, Git has all those great characteristics of a distributed VCS. I've missed some things from Darcs though:

  • For smaller changes I prefer darcs record over having to reach for the mouse with git-citool and git-add -i isn't as nice.
  • darcs revert allows me to revert individual hunks within a file, with a nice interface too.
  • darcs unpull and darcs unrecord allow me to get rid of patches without having to generate a reversion patch (which is what Git does if the patch you want to revert is not the very latest patch). Also, they keep any local changes untouched.
  • darcs pull lets me pull only the patches I want from another repository. I haven't found a way to do that in Git.
  • Darcs's no effort spontaneous branches are a joy. No need for explicit branch creation. You just create copies of your trees and move individual patches around whenever you feel like doing so. This way you can easily, say, merge only some of the changes from one branch into another, quickly discard a branch, etc.

Darcs has well-known performance issues, I've watched it sit forever trying to apply some patch. This hasn't been a great problem for me with the small projects I usually work on though, so I don't really regard that as a bit advantage of Git's.

For me, it's the tools. I have moved some of my stuff over to Git but I still like a lot of aspects of Darcs's workflow. Perhaps some more experience with Git will change my mind, or perhaps Darcs-Git will be the VCS really cool kids will be using in the future. We'll see.

If you're interested in trying Git out, have a look at Git For SBCL Hackers and Everyday GIT With 20 Commands Or So.

2007-07-25

#lisp tip of the day

Ever recompiled a function hoping to fix some bug only to find out nothing changed? Perhaps you passed #'some-function around and your live code is still dealing with the old definition? How to tell? Here's an example with SBCL:

* (values (symbol-function (defun foo ()))
          (symbol-function (defun foo ())))
STYLE-WARNING: redefining FOO in DEFUN

#<FUNCTION FOO {11E47CDD}>
#<FUNCTION FOO>
The old version is printed with its object identity (#x11e47cdd in this example), whereas the current global definition is printed without it allowing you to quickly tell which is which. This behaviour is not standard but, for example, OpenMCL provides similar information:
? (values (symbol-function (defun foo ()))
          (symbol-function (defun foo ())))
#<Compiled-function FOO (Non-Global)  #x85AE40E>
#<Compiled-function FOO #x85ADB06>
Your favourite Lisp might also do something along these lines. Great tip by Xof.

2007-04-24

On UTF-16 vs. UTF-32

It'd be more space-efficient [to use UTF-16] in most cases, and less time-efficient in all cases (either "somewhat so" or "grossly so".) Using UTF-16 internally is probably not nearly as far down the Bad Idea scale as... oh, Huffman-coded arrays would be. ("Newly created arrays are full of 0s! Why waste 31 or 63 extra bits? Of course, this makes (SETF AREF) hard, but you could have a bit somewhere!")

Gary Byers in openmcl-devel, discussing (here and here) why variable-length encodings are a bad idea for the internal representation of Lisp strings. An enlightening read, as usual.

2007-04-12

Sweet Summer of Lisp

Yay! I have been accepted into Google's Summer of Code 2007 thanks to LispNYC. The project I will be working on is IOLib and you can check out my proposal. Any suggestions you may have for this project are welcome!

If I had to pick the single most important event during my participation in the 2005 edition, it would have to be when Christophe Rhodes suggested I should have a look at James Bielman's then recent project CFFI. Hadn't he done that, I wouldn't have had the great pleasure of getting to know James, working with him, learning from his code, etc... So, please, send those great suggestions to luismbo at gmail dot com!

I had sent another proposal, “Metaobject Sealing for CLOS”, which was a very cool idea suggested by Christophe (again) and I was actually expecting that one would be picked instead. I already had some code and was avidly reading the AMOP, not to mention that I even printed out SBCL's PCL source code. Oh well. If nobody picks that idea up, I would love to work on that after the summer. <blink>Perhaps ITA or Clozure could fund that.</blink>

You can see the list of accepted Lisp projects here.

One last thought. While I realize that it's not easy for Google to work around this, I find it pretty sad that students from Iran, Syria, Cuba, Sudan, North Korea or Burma aren't allowed to participate in this program. I sure hate politics.

2007-04-07

XCL

Peter Graves, of ABCL fame, has been working on this new Common Lisp compiler for a while now. Here's how he describes it:

XCL is a new, native-code CL implementation that features a kernel written in a very restricted subset of C++ and an optimizing compiler, written in Lisp, with backends for x86 and x86-64. It runs on Linux and Windows [...]

XCL supports threads on both Linux and Windows, and in principle the compiler is re-entrant.

Recently, and this is the actual news, Peter made available a link to a source code snapshot in #lisp. I couldn't resist trying it out, so here are some superficial first impressions:

  • It has an interpreter written in C++ and it uses that to bootstrap itself. This is similar to what ABCL does, though it seems that, at this point, it doesn't actually compile (all of?) its own Lisp code. Also, Peter says he's working on getting it to bootstrap SBCL.

  • Friendly REPL similar to Allegro's.

  • It features a neat, readable disassembler.

    CL-USER(10): (disassemble (compile (defun inc (x) (1+ x))))
    ; Compiling INC
    ; Disassembly of #<FUNCTION INC {F84820}>
    ; Constants:
      NIL
    ; Code:
      E1BF50: 55                 push    %rbp
      E1BF51: 48 89 E5           mov     %rsp,%rbp
      E1BF54: 57                 push    %rdi
      E1BF55: 48 83 EC 08        sub     $0x8,%rsp
      E1BF59: 48 89 F8           mov     %rdi,%rax
      E1BF5C: 48 89 C7           mov     %rax,%rdi
      E1BF5F: A8 03              test    $0x3,%al
      E1BF61: 75 08              jne     L0
      E1BF63: 48 83 C0 04        add     $0x4,%rax
      E1BF67: 70 02              jo      L0
      E1BF69: C9                 leave
      E1BF6A: C3                 retq
    L0:
      E1BF6B: BE 04 00 00 00     mov     $0x4,%esi
      E1BF70: E8 AB 47 60 FF     callq   0x420720   ; SYSTEM:TWO-ARG-+
      E1BF75: C9                 leave
      E1BF76: C3                 retq
    ; 39 bytes
    NIL
  • Similarly to CLISP, its fasls are readable S-exps and pretty short too. They even start with -*- Mode: Lisp -*-, heh. The actual assembly code looks something like this:

    (COMPILER::GENERATE-CODE-VECTOR
     '((:BYTE 1 85)
       (:BYTES 3 (72 137 229))
       ...
       (:JMP-SHORT 2 (:NZ #$G7248))
       ...
       (:EXIT 2 (201 195))
       (:LABEL 0 (#$G7248))
       (:BYTE 1 190) ...)
  • It managed to load ASDF—though not yet compile it—and use that to load and compile a simple system such as split-sequence. Given that (lisp-implementation-version) returns "0.0.0", and comparing to some other lisps that crash so easily with ASDF, I find this very impressive.

Incidentally, this is my first post to Planet Lisp. Hello world! I'm sure I've screwed it up in some way or another. In case you're wondering, the rest of my blog is in Esperanto.

2007-02-23

OpenMCL release notes

No, OpenMCL 1.1 hasn't been released yet, but the ongoing release notes make for an interesting read already. Here's an example:

“The RDTSC instruction actually returns an unsigned 64-bit result; apparently, some Intel documentation claims that this value will not "wrap around" to 0 at contemporary clock rates for at least 10 years after the system was booted. (If you can keep an Intel system running for 9 years between reboots, you might consider telling Intel that the RDTSC counter wrapped around a year early; they might give you a refund. Or maybe not.)”

It's full of Gary Byers's (I think) detailed explanations. Recommended.

2007-02-21

Ediware

Last night, I hacked together this little program that'll run nightly on c-l.net. It grabs Edi Weitz's software and integrates changes into darcs trees.

I find it very useful for keeping track of changes without having to grab tarballs, unpack them, delete the old trees, etc... Also it makes it easier to work on changes for Edi's software across releases.

Nevertheless, here's hoping Edi will publish his own trees in the future.

Happy customer

Last night on #lisp, someone was asking for advice because retrieving data with CLSQL was “very slow”. I had seen this kind of problem before with CLSQL and SBCL or CMUCL. UFFI uses (sb-)alien directly without type declarations, and that can become very slow indeed.

So I suggested running CLSQL through CFFI's uffi-compat.

<vagif> wow!!! It works and it is instant!!

This kind of stuff makes my day. :)

2007-02-19

Pretty lambda

Interesting old hack by Luke Gorrie. Turns the keyword lambda into the greek letter λ through font-lock-mode. I doubt it will last, but I'll give it a try. Looks pretty.

2007-02-12

Testing, testing

So, I might be blogging a little bit about my Common Lisp projects now that Blogger supports labels and, more importantly, per-label feeds. Let's see how long it takes for Xach to find me.

Kategorioj