Re: Question on new line behavior

Jean Louis <[email protected]>
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
Thank you, I am learning macros now. I have impnotes and HyperSpec
locally set, to read documentation.

And I could run basic.lisp from:
http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/basic/index.html

it was just coincidence that you wrote this email in the same time, I
was surprised.

Jean

On Mon, Nov 21, 2016 at 09:21:41PM +0100, Pascal Bourguignon wrote:
> 
> > On 21 Nov 2016, at 20:13, Jean Louis <[email protected]> wrote:
> > #!/usr/bin/clisp
> > (unless (cadr *args*)
> > (format t "~a~%" "No arguments specified.")
> > (exit 1))
> > 
> > (defvar link (car *args*))
> > (defvar article (string-trim '(#\Space #\Tab #\Newline) (cadr *args*)))
> > 
> > (format t "~a~a~a~a~a"
> > "<p>
> > <em>This article is licensed under the <a href=\"http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License\">Creative Commons Attribution-ShareAlike License</a>. It uses material from the <a href=\"" link "\">Wikipedia Article \"" article "\"</a>.</em>
> > </p>”)
> 
> Add (setf *print-pretty* nil) before printing.
> 
> 
> Otherwise, you’re using format wrong.  And defvar.  And special variables.  And unix executable must not have dot extension in their names.
> 
> 
> $ cat ./wiki-cl
> #!/usr/local/bin/clisp -q -norc
> ;; -*- mode:lisp -*-
> 
> (unless (cadr *args*)
>   (format t "~a~%" "No arguments specified.")
>   (exit 1))
> 
> (defparameter *link*         (car *args*))
> (defparameter *article*      (string-trim '(#\Space #\Tab #\Newline) (cadr *args*)))
> (defparameter *licence-url*  "http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License")
> (defparameter *licence-name* "Creative Commons Attribution-ShareAlike License")
> 
> (defmacro p (&body body)
>   `(progn (write-line "<p>")
>           ,@body
>           (write-line "</p>")))
> 
> (defmacro em (&body body)
>   `(progn (write-line "<em>")
>           ,@body
>           (write-line "</em>")))
> 
> (defun a (url title)
>   (format t "<a href=\"~A\">~A</a>" url title))
> 
> (defun pcdata (text)
>   (write-line text))
> 
> (p (em (pcdata "This article is licensed under the")
>      (a *licence-url* *licence-name*) (pcdata ".")
>      (pcdata "It uses material from the ")
>      (a *link* (format nil "Wikipedia Article \"~A\"" *article*)) (pcdata ".")))
> 
> 
> 
> $ ./wiki-cl https://en.wikipedia.org/wiki/CLISP CLISP  
> <p>
> <em>
> This article is licensed under the
> <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons Attribution-ShareAlike License</a>.
> It uses material from the 
> <a href="https://en.wikipedia.org/wiki/CLISP">Wikipedia Article "CLISP"</a>.
> </em>
> </p>
> [pjb@larissa :0.0 tmp]$ 
> -- 
> __Pascal J. Bourguignon__

------------------------------------------------------------------------------
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.