From: Rob Warnock on 31 Oct 2009 08:07 Madhu <enometh(a)meer.net> wrote: +--------------- | * Rob Warnock wrote: | | Thomas A. Russ <tar(a)sevak.isi.edu> wrote: | | +--------------- | | | You mean like | | | (format t "one ~a~%~:*two ~a~%~:*three ~a~%" x) | | +--------------- | | | | *ROTFLMAO!!* I immediately thought of Lily Tomlin's character Ernestine: | | | | (let* ((x (format nil "r~a-~:*d~a..." "ingy"))) | | (format t "one ~a~%~:*two ~a~%~:*three ~a~%" x)) | | I missed the cultural reference, so I do not understand what you are | trying to demonstrate here... +--------------- See: http://en.wikipedia.org/wiki/Lily_Tomlin ... Career In 1969, Tomlin joined the sketch comedy show Laugh-In. Some characters from the show have been associated with her throughout her career, including the wisecracking, snorting telephone operator, Ernestine; ... Ernestine was known for placing telephone calls to victims\\\\\ customers and, while waiting for the call to be answeredr, saying the output from the above FORMAT out loud, to wit: one ringy-dingy... two ringy-dingy... three ringy-dingy... +--------------- | (which also has advantage of avoiding a style warning for LET*!) +--------------- Sorry 'bout that. An earlier version looked like this: (let* ((s "ingy") (x (format nil "r~a-d~a..." s s))) (format t "one ~a~%~:*two ~a~%~:*three ~a~%" x)) but I realized I could use the backup trick to avoid duplicating the string arg and so got rid of the temporary variable S, but then didn't change the LET* to a LET. Happens a lot in exploratory code. [Note that none of CMUCL, CLISP, nor SBCL (at least, not the versions to which I have access) give the annoying, overprotective "style warning" for a LET* with only one binding that your implementation apparently does.] -Rob ----- Rob Warnock <rpw3(a)rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607
From: Madhu on 31 Oct 2009 10:04 * (Rob Warnock) <e6WdnbQQ5sPutXHXnZ2dnUVZ_qKdnZ2d(a)speakeasy.net> : Wrote on Sat, 31 Oct 2009 07:07:15 -0500: | [Note that none of CMUCL, CLISP, nor SBCL (at least, not the versions to | which I have access) give the annoying, overprotective "style warning" for | a LET* with only one binding that your implementation apparently does.] No I don't think I've used an implementation that spat this warning either, but I'd bet SBCL did it at some point. [Note I _had_ to avoid a smiley at all costs. I was afraid this sentence might have given it away.] -- Madhu
From: Vassil Nikolov on 31 Oct 2009 15:34 On Fri, 30 Oct 2009 21:34:29 -0500, rpw3(a)rpw3.org (Rob Warnock) said: > Thomas A. Russ <tar(a)sevak.isi.edu> wrote: > +--------------- > | xach(a)unnamed.xach.com writes: > | > When possible, I prefer obfuscation through FORMAT. > | > | You mean like > | (format t "one ~a~%~:*two ~a~%~:*three ~a~%" x) > +--------------- > *ROTFLMAO!!* I immediately thought of Lily Tomlin's character Ernestine: > (let* ((x (format nil "r~a-~:*d~a..." "ingy"))) > (format t "one ~a~%~:*two ~a~%~:*three ~a~%" x)) To paraphrase a friend of mine, if we shall obfuscate, then let us obfuscate: * (format t "~3@{~'R/++/ ~@?~%~@*~}" '#:ernestine "r~A-~:*d~A..." "ingy") one ringy-dingy... two ringy-dingy... three ringy-dingy... NIL where (shadow '++) (let ((counters (make-hash-table))) (defun reset-counter (counter &optional (value 0)) (setf (gethash counter counters) value)) (defun ++ (stream counter colonp atsignp &rest parameters) (destructuring-bind (&optional number-format) parameters (let ((format-string (format nil "~~~A~A~A" (if colonp ":" "") (if atsignp "@" "") (or number-format #\D)))) (format stream format-string (incf (gethash counter counters 0)))))) (values 'reset-counter '++)) (and I don't claim to have exhausted all possibilities). ---Vassil. -- "Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Vassil Nikolov on 31 Oct 2009 17:15 Oh, and another way to obfuscate ^W do the ringy-dingy count is: (let ((counter 0)) (format t "~3@{~'R/$/ r~A-~:*d~A...~%~@*~}" (by-name (incf counter)) "ingy")) or, if you are that way inclined, (let ((n 0)) (symbol-macrolet ((counter #'(lambda () (incf n)))) (format t "~3@{~'R/$/ r~A-~:*d~A...~%~@*~}" counter "ingy"))) where (defun $ (stream argument colonp atsignp &rest parameters) ;; do we want to signal an error if we are supplied too many parameters? (destructuring-bind (&optional directive) parameters (let ((format-string (format nil "~~~A~A~A" (if colonp ":" "") (if atsignp "@" "") (or directive #\S)))) (format stream format-string (funcall argument))))) (defmacro by-name (form) `#'(lambda () ,form)) ---Vassil. -- "Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Robert Uhl on 1 Nov 2009 21:17
Tamas K Papp <tkpapp(a)gmail.com> writes: > > I am still not sure that the OP is a troll. He could be coming from > another language, and be under the impression that people start > learning CL from the Hyperspec. That was a _huge_ stumbiling block back in 2000 or 2001 when I first gave Lisp a try. Back then there were basically no free tutorials and the HyperSpec was about all that was available. I think I got to reading about PROGN, PROGV and friends before running away screaming. Then Practical Common Lisp came out and life was good. Thanks Peter! -- That's what I say when people ask me 'aren't you scared of the traffic?' 'Why? The cars are all stopped.' And they look sheepish and agree that commuting on a bicycle in peak hour isn't that much of a problem. --Zebee Johnstone |