Prev: Anybody mind to translate this Felleisen quote from German to English
Next: Macros and anonymous functions
From: refun on 3 Mar 2010 03:03 In article <rNOSPAMon-5BA109.08521402032010(a)news.albasani.net>, rNOSPAMon(a)flownet.com says... > I have already conceded that Common Lisp sucks. But even Common Lisp is > less sucky than other languages in this regard because it is always > possible to use READ-FROM-STRING, GET-MACRO-CHARACTER, and MACROEXPAND > to get an explanation of what is going on in terms of something that you > can type into a search engine or do a meta-point on. (Except format > strings of course. Format strings are irredeemably sucky.) Actually, format strings can be as transparent/lispy as normal macros and reader macros in implementations that support compiled format strings (SBCL is one example). Here's how you inspect them: CL-USER> (format t "~&I wonder, how does ~s format string work?~%" 'this) I wonder, how does THIS format string work? NIL CL-USER> (formatter "~&I wonder, how does ~s format string work?~%") #<FUNCTION (LAMBDA (STREAM &OPTIONAL (#:FORMAT-ARG0 #) ...)) {24924055}> CL-USER> (macroexpand '(formatter "~&I wonder, how does ~s format string work? ~%")) #'(LAMBDA (STREAM &OPTIONAL (#:FORMAT-ARG888 (ERROR 'SB-FORMAT:FORMAT-ERROR :COMPLAINT "required argument missing" :CONTROL-STRING "~&I wonder, how does ~s format string work?~%" :OFFSET 22)) &REST SB-FORMAT::ARGS) (DECLARE (IGNORABLE STREAM)) (BLOCK NIL (FRESH-LINE STREAM) (WRITE-STRING "I wonder, how does " STREAM) (PRIN1 #:FORMAT-ARG888 STREAM) (WRITE-STRING " format string work?" STREAM) (TERPRI STREAM)) SB-FORMAT::ARGS) T The standard allows implementing FORMATTER as a simple FORMAT call, so it's not reliable to do this in all implementations, but those that implement a real FORMATTER allow you to get useful information about the workings of format strings.
From: Nicolas Neuss on 3 Mar 2010 03:37 Tamas K Papp <tkpapp(a)gmail.com> writes: > On Tue, 02 Mar 2010 16:01:37 +0000, Tim Bradshaw wrote: > >> In another newsgroup, someone is complaining fiercely that >> "SPOTTED-DOG-P" does not subtract "P" and "DOG" from "SPOTTED". > > A somewhat tangential question: lately I am gravitating towards > SPOTTED-DOG? instead of SPOTTED-DOG-P. Is that "bad style" in CL? Looks > so much nicer, and appears more intuitive to me. An argument in favor of -p is that you can speak about it more easily. Nicolas
From: Marcus Breiing on 3 Mar 2010 05:17 * Tamas K Papp > A somewhat tangential question: lately I am gravitating towards > SPOTTED-DOG? instead of SPOTTED-DOG-P. Is that "bad style" in CL? > Looks so much nicer, and appears more intuitive to me. I often find the Scheme scheme jarring, because from a mathematical/functional perspective, a predicate application is not a question at all. It represents the answer. The predicate object itself doesn't represent a question either, it represents all the answers. The question mark convention only makes sense to me in the context of Scheme's ancient "actor model" heritage: A "question message" is sent to some actor that is expected to send back an answer. (My personal choice would be between SPOTTED-DOG-P and IS-SPOTTED-DOG.)
From: Norbert_Paul on 3 Mar 2010 07:20 Java heathens unite!! Marcus Breiing wrote: > (My personal choice would be between SPOTTED-DOG-P and > IS-SPOTTED-DOG.)
From: Ron Garret on 3 Mar 2010 11:26
In article <hml542$4mq$1(a)news.eternal-september.org>, refun <refun(a)nospam.gmx.com> wrote: > In article <rNOSPAMon-5BA109.08521402032010(a)news.albasani.net>, > rNOSPAMon(a)flownet.com says... > > > I have already conceded that Common Lisp sucks. But even Common Lisp is > > less sucky than other languages in this regard because it is always > > possible to use READ-FROM-STRING, GET-MACRO-CHARACTER, and MACROEXPAND > > to get an explanation of what is going on in terms of something that you > > can type into a search engine or do a meta-point on. (Except format > > strings of course. Format strings are irredeemably sucky.) > > Actually, format strings can be as transparent/lispy as normal macros and > reader macros in implementations that support compiled format strings (SBCL > is > one example). > Here's how you inspect them: > > CL-USER> (format t "~&I wonder, how does ~s format string work?~%" 'this) > I wonder, how does THIS format string work? > NIL > CL-USER> (formatter "~&I wonder, how does ~s format string work?~%") > #<FUNCTION (LAMBDA (STREAM &OPTIONAL (#:FORMAT-ARG0 #) ...)) {24924055}> > CL-USER> (macroexpand '(formatter "~&I wonder, how does ~s format string > work? > ~%")) > #'(LAMBDA > (STREAM > &OPTIONAL > (#:FORMAT-ARG888 > (ERROR 'SB-FORMAT:FORMAT-ERROR :COMPLAINT > "required argument missing" :CONTROL-STRING > "~&I wonder, how does ~s format string work?~%" :OFFSET > 22)) > &REST SB-FORMAT::ARGS) > (DECLARE (IGNORABLE STREAM)) > (BLOCK NIL > (FRESH-LINE STREAM) > (WRITE-STRING "I wonder, how does " STREAM) > (PRIN1 #:FORMAT-ARG888 STREAM) > (WRITE-STRING " format string work?" STREAM) > (TERPRI STREAM)) > SB-FORMAT::ARGS) > T > > > The standard allows implementing FORMATTER as a simple FORMAT call, so it's > not > reliable to do this in all implementations, but those that implement a real > FORMATTER allow you to get useful information about the workings of format > strings. There are other ways to lose as well. For example if your implementation compiles everything: Welcome to Clozure Common Lisp Version 1.5-dev-r13442M-trunk (DarwinX8664)! ? (formatter "~A") #<Anonymous Function #x3020014AC60F> ? (function-lambda-expression *) NIL NIL NIL ? rg |