sábado, 12 de mayo de 2018

Lisp recent threads

Lately, some articles on Lisp appeared in my usual websites.

Here's a HN thread where you can see the usual lispers enlightening other people about why Common Lisp is a very special beast.  DR Christian Shafmeister (CLASP) gives masterclasses in every post. Don't miss any :). There's some mention to those charts, where lisp shows as one of the both fastest and cheapest languages (after the ones that are specifically built to be superfast or efficient, while being more flexible than both)

Beautiful Racket, another hn post about the book.

Cloe lang. Apparently a heavily concurrent lisp.

extramaze, is built with racket, and the post shows some tricks used there.

Some CL macros?

Insightful post about starting a project in CL (going from repl to a project). Specially cool comment on tooling.

And as a bonus, RMS talking about his story with lisps. Very nice read also

I think I miss CL ... (...said while installing sbcl....)

bitmasking basic readings

So lately I've been exposed to using bitmasking for several tasks, and it's a cool and niche enough topic so that I delved a bit into it.

Appart from datastructures that depend on bit indexing like persistent datastructures, bit trees, bloom/cuckoo filters or others,  there's the concept of "plain" bit masking to optimize bookkeeping of a set of numbers (they can be indices of an array) in one big number.

Here are some examples of them:

martes, 8 de mayo de 2018

an advanced jq slideshow

So I found this advanced slideshow about jq (a tool you wanna have in your toolbox), and felt like sharing it here.



domingo, 6 de mayo de 2018

TIL elisp has iterators

So I was reading the Gnu/Emacs mail list and saw this thread where there's some good discussion about destructively modifying a recursive structure (as every structure, right?) in elisp.

All proposed solutions have something worth reading and understanding, but there's one that caught my attention. It uses cl-loop and generators. Yep, like python's ones, but in elisp.

I didn't even know that elisp had this magic in loop (as CL doesn't have it, and you have to make iterators yourself as closures called in `for' clauses.

So yep, the code is (as usual) only elisp and ready to be explored (and be enlightened with).  pcase and CPS used in real world. Also, nice to see in the end of the file where it wrestles itself into elisp itself and into emacs (even it adds syntax highlight for it).

Very good Sunday afternoon read (I just don't understand everything on it yet...)

Thanks to Daniel Colascione again for providing inspiring gems one more time :)

lunes, 30 de abril de 2018

bootstrap your emacs lisp learning

So every now and then there's someone asking in /r/emacs about learning elisp. And I always answer with the same solution that I'm now posting here to avoid copypasting the whole thing every time.

In an attempt to give bootstrapped solution, t-shirt sized, and that is both a fish,  a fishing lesson and a fishing rod, this is what I came with.
 
  • Type c-h k c-h k and read.
  • Type c-h k c-h f and read.
  • With the previous tools, try to understand the following:
    (defun foo ()
      (interactive)
      (save-excursion
        (beginning-of-line)
        (insert ";")))
    
    (global-set-key (kbd "C-c ;") 'foo)
    
  • Select the whole snippet and type m-x eval-region.
  • Type c-c ; .
  • Try to understand what just happened.

jueves, 26 de abril de 2018

It's like copy-paste, but reversed

So browsing this reddit thread I felt again like when I discovered the "undo in selection".

So you can mark a point in an emacs buffer as the destination of all your future inserts, copys and pastes.  And of course, this comes by default, because why not :).