3 ms·
Building Setf
- sillysaurusx 5y agosetf is one of the most underrated Lisp powers. In Javascript, it'd look like this: // save current cursor position var x = point(); // set the cursor position point() = 42; // insert some text insert("Hi there") // reset cursor position point() = x; Notice you're assigning a value to a function call. Under the hood, point() = x; gets transformed to set_point(x); or whatever else you tell it to do -- it's programmable, and you have full access to the right hand side arguments. This might not seem too compelling. The key is that it composes. I was just getting to the good part, but our puppy is demanding my attention. Duty calls. Suffice to say, nested calls like point(find_buffer("foo.txt")) = 21 can be rewritten to prev_buffer = current_buffer(); set_buffer(find_buffer("foo.txt")); set_point(21); set_buffer(prev_buffer); automatically.
- danfritz 5y agoAn article on how to not break to new lines in the middle of a word, makes it hard to read. You can improve by running $('.content').style.hyphens = 'none'; flies away
- yakubin 5y agoI'm normally in favour of hyphenation, but apparently browsers can't do it well. LaTeX is still unrivalled.