[rgrau] guys, I just learned a new idiom [rgrau] (@foo ||= []) << bar [michal] :) [rgrau] It's not crystal clear, but I like it [rgrau] my perl background damaged my brain beyond repair [jakub] rgrau: idiom or idiot? [rgrau] you pick [jakub] ok, done [rgrau] I know which one you picked [jakub] u r smart [rgrau] u idiom [rgrau] that log goes to my blog inside ruby section
jueves, 29 de noviembre de 2012
a neat ruby idiom
sábado, 24 de noviembre de 2012
'symbols, :symbols and ':symbols
The other day, hacking a kind of project manager for emacs (YES. Another one) which I will explain in a future post, I bumped in a couple of wtfs, that turned out to be my own mental fuckup, not an elisp wtf.
Let's dissect plist-get with different kinds of atoms as keys, and try to explain why they work or they don't. Little schemer style.
Why? The whole plist is is quoted, being a literal list, so if there's no need to re-quote it again.
Why? We built the list with the list constructor, so we have to quote the symbol directory. because we want a simbol.
Why? :directory is a different symbol from 'directory, and the whole thing is quoted.
Why? the plist is not a literal, but again. :directory and 'directory are different things
You see?
And this is again correct. Makes sense, no?
Then, the relation between :foo and 'foo is none, but (eq :foo ':foo) is t.
Let's dissect plist-get with different kinds of atoms as keys, and try to explain why they work or they don't. Little schemer style.
(plist-get '('directory ":fdsa" 'irc "channel") 'directory) ; nil
Why? The whole plist is is quoted, being a literal list, so if there's no need to re-quote it again.
(plist-get (list 'directory ":fdsa" 'irc "channel") 'directory) ; ":fdsa"
Why? We built the list with the list constructor, so we have to quote the symbol directory. because we want a simbol.
(plist-get '(:directory ":fdsa" 'irc "channel") 'directory) ; nil
Why? :directory is a different symbol from 'directory, and the whole thing is quoted.
(plist-get (list :directory ":fdsa" 'irc "channel") 'directory) ; nil
Why? the plist is not a literal, but again. :directory and 'directory are different things
(plist-get (list :directory ":fdsa" 'irc "channel") :directory) ; ":fdsa"
You see?
(plist-get '(:directory ":fdsa" 'irc "channel") :directory) ; ":fdsa"
And this is again correct. Makes sense, no?
Then, the relation between :foo and 'foo is none, but (eq :foo ':foo) is t.
jueves, 22 de noviembre de 2012
emacs taking to much memory?
[p1] my emacs takes up more memory than firefox, hm
[rgrau] open more firefox tabs
[p3] install more extensions
I love #emacs help style :)
domingo, 18 de noviembre de 2012
If you are planning to change jobs in the programmers' world,
make sure you read some of these articles.
They all have very good points about what the authors think you should
consider when looking for your _next_ job.
If you're not looking for a job, I'd recommend skim through them also.
They make a lot of good points IMHO, but I'll let you read them by yourself.
If you're not looking for a job, I'd recommend skim through them also.
They make a lot of good points IMHO, but I'll let you read them by yourself.
Suscribirse a:
Entradas (Atom)