Lisp golfTrackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
In other languages you'd do the iteration with list comprehension, I guess.
E.g. in Python you could do print "\n".join(["%s" % x for x in "foo|bar|baz".split("|")]) which is arguably more readable -- although I like lisp I find the loop constructs of format quite hard to grok.
Of course my version did have the anglebracket - "li" - angle bracket and anglebracket - "/li" - angle bracket text in it. Your blog software swallows that up for some reason.
I also agree on the near-impossibility to pass the CAPTCHA -- had to reload the page a few time to get an image that I could decipher.
Wrt. to the captchas: I experienced a lot of spam for some time, so I had strong captchas enabled. I've now reverted to the normal ones, I hope these are easier for humans to decipher.
If my Perl isn't too rusty, it't turns out something like this:
print "[li]$_[/li]\n" for split '|', "Whatever" The iteration is external to format's equivalent, but it's readable enough for me. PS: your spam prevention is too hard for my human eyes.
This is a very trivial thing for anyone who's used to scripting languages. Here's a natural Perl solution:
map "$_\n", split /|/, "foo|bar|baz"
I hope it displays properly this time:
map "[li]$_[/li]\n", split /\|/, "foo|bar|baz"
Thanks for reminding me of the existence of map in Perl. For some reason I've almost never used it -- Perl seems to be located in the imperative half of my brain.
Wrt. to disappearing elements: Serendipity probably tries to interpret the braces/brackets as HTML elements or as smileys.
This one doesn't count as it modifies the input. A similar approach is doable in CL with the same RE library (cl-ppcre) as in the blog post.
We've been persecuted long enough. I'm going to start a club for Lisp Users Who Actually Like Format And Loop Damnit!
Lisp Users Who Actually Like Format And Loop Damnit -- LUWALFALD. I like that. And if you add the C in front for Club, you actually get the usual CL- prefix.
BTW: It's not like I dislike format or loop. It's more a chicken and egg-problem: I don't use them regularly, so I sometimes find solutions that use them harder to understand than others involving, say, dolist, which I do use regularly. So my comment in the blog post says a lot more about me than about format/loop. Add Comment
|
QuicksearchBlog AdministrationKategorienTagsCalendar
Powered by |
|||||||||||||||||||||||||||||||||||||||||||||||||