4 ms·
But how do you type the Σ? You simply define a keyboard shortcut. For very common primitives, a special character can work nicely. We use λ in our Common Lisp
by gruseom 17y ago
But how do you type the Σ?
You simply define a keyboard shortcut.
For very common primitives, a special character can work nicely. We use λ in our Common Lisp code instead of typing lambda. Actually, our λ is a macro that does a couple of things besides expanding into lambda; if it were just the latter we probably wouldn't have gone there. Once we did, though, I was surprised at the improvement in readability.
- Tichy 17y agoInteresting. But I hope you put something in the comments of your code on how to create that keyboard shortcut and the unicode for λ.
- jasonkester 17y agoUgh. If anybody ever has to maintain your code, they'll copy/paste the symbol like Tichy described while cursing your name. Personally, I'd copy/paste it into the global find/replace dialog the first time I came across it. I mean, sure, if it was my job to deal with your unicode code every day from here on out, I'd bother to learn how to map screwy symbols to keyboard shortcuts. But really, why would you do this to your code in the first place? It certainly doesn't make things more readable. Exactly the opposite.
- gruseom 17y agoPersonally, I'd copy/paste it into the global find/replace dialog the first time I came across it. Without bothering to understand why it was done that way or discussing it with the team? That wouldn't be a good way to last very long. why would you do this to your code in the first place? I was careful to include a phrase which explains this: for very common primitives. Perhaps your code doesn't have those; ours does. It certainly doesn't make things more readable. Considering that I just finished saying it did, that's quite the claim. screwy symbols Most programmers I've observed are closed-minded about deviations from their comfort zone. Faced with something that doesn't conform to the way they always do things (a.k.a. the Right Way), they reflexively condemn. Your comment is remarkable insofar as every single one of its sentences suggests this mentality. I hope that's just my mistaken impression.
- jasonkester 17y agoSingle letter procedure names are a bad idea in themself, and wouldn't make it past a code review in any shop I've ever been associated with. Single letter procedure names that you can't even read or type are an order of magnitude worse. So yeah, I don't think I'm alone in not wanting to dig through your code if it's written this way. I don't want to see code like: for (int [left-curly-single-quote] = 1; '<10; '++) Meaningful variable and procedure names were one of the big steps forward in the 70's. And while I'm sure the math textbook pictogram for summation is meaningful to you, it certainly isn't a good idea to use it in your code.
- gruseom 17y agoUh, right. Because l-a-m-b-d-a says so much more than λ.