Re: (case 'quote ('lambda 1) (otherwise 2))



On Jan 29, 11:57 pm, Pascal Bourguignon <p...@xxxxxxxxxxxxxxxxx>
wrote:
Now, when you try these read-from-string forms, you must be careful
not to be misled by your implementation printer, which usually process
specially lists such as (QUOTE X) and (FUNCTION X) and print them as
'X and #'X instead of printing them as normal lists. To be sure, you
can use your own list printing function:

Hmm, maybe I should use something similar when I want things to pretty-
print like (function ...) rather than #'.... (Say, in a quick 'n dirty
logfile thing, where #'... did once annoy me.)


;; Bind this to nil if you want sourcecode to be printed using a style
like
;; (function ...) rather than #'...
(defvar *print-code-fancily* t)

(defun length-2? (x) (= 2 (length x)))

;; Installs pretty-print dispatchers for FUNCTION and QUOTE forms.
(flet ((set-pprint-dispatch... (type original-dispatcher)
(set-pprint-dispatch
` (and (cons (eql ,type))
(satisfies length-2?))
(lambda (s list)
(if *print-code-fancily*
(funcall original-dispatcher s list)
(funcall (formatter "~:<~W ~_~W~:>") s list))))))
(set-pprint-dispatch... 'function
(pprint-dispatch '(function x)
(copy-pprint-dispatch
nil)))
(set-pprint-dispatch... 'quote
(pprint-dispatch '(quote x)
(copy-pprint-dispatch
nil))))


Keep in mind I've almost never messed with the pretty-printer before..


Tayssir
--

Anarchism and the Academy:
http://mbanna.radio4all.net/pub/archive5/mp3_4/200108-renew-acad-p.mp3
http://mbanna.radio4all.net/pub/archive5/mp3_4/200108-renew-acad-q.mp3

.



Relevant Pages

  • Re: newbie Q: opposite of quote
    ... (eval (quote a)) ... a first Common Lisp lesson. ... you can use lists as short as you want. ... symbols, set, setq, setf, psetq, psetf. ...
    (comp.lang.lisp)
  • Re: [opensuse] Re: Running a program as root from desktop panel
    ... poor that I can't remember what the thread is about I can always scroll ... On other mailing lists, the system always ... I use an official Mozilla extension called "Quick Quote". ... But doesn't this sort of defeat the purpose of bottom posting? ...
    (SuSE)
  • Re: [OT] Why do people detest top posting so much?
    ... messages before it at the bottom of your message. ... you must quote in order to make your reply clear, quote only the point to which ... Not to mention that the Tom Thumb example above is by far not the ... worst I have seen on this list and on a good number of other lists. ...
    (Ubuntu)
  • Re: Newbie - what does the apostrophe character do in Scheme?
    ... Did Scheme have a means to return the ASCII value of a character. ... I read quote and list seem to do much the same thing, ... Thorne an array is dimensional and can be variable. ... elements could themselves be lists or other objects. ...
    (comp.lang.scheme)
  • Review: AFIs 100 Years...100 Movie Quotes (2005) (TV)
    ... 100 Years, 100 Movie Quotes ... the AFI lapdanced on the Bogie/Bergman masterpiece and fawned all over the Rhett/Scarlett tripe. ... If the #1 spot on these AFI lists isn't occupied by 'Casablanca', you can bet your house it'll be taken by 'Gone With The Wind'. ... I'd give it a spot somewhere in the Top 10, fine, but that's not a line people quote very often anymore. ...
    (rec.arts.movies.reviews)