Re: Reading pipe from *standard-input*?

Jean Louis <[email protected]> Thu, 23 Mar 2017 19:15:42 +0300
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
On Thu, Mar 23, 2017 at 12:11:19PM -0400, Sam Steingold wrote:
> Computer programming transcends geography.
> Coding styles helps people understand each other's code.
> If you want people to look at your code, you should follow the accepted
> coding style, including indentation &c.

Indentation is just automatic in Emacs, I click TAB, it indents in
SLIME. When transmitted by email maybe it changes.

> Tomato is a fruit. Will you put it in a fruit salad? :-)

That is European world maybe, I put vegetables and fruits together
like today, and I eat sweet banana with rice. I am used to how people
eat here. We may eat here mango which is sweet with dishes which are
salty.

Let me now study what you wrote, and try to implement it correctly.

Jean

> >> >   (let ((input (with-open-stream (str *standard-input*)
> >> >                (alexandria.0.dev:read-stream-content-into-string str))))
> >> 
> >> why not just read from *standard-input* ?
> >
> >   (let ((input (with-open-stream (str *standard-input*)
> 
> why create the stream STR which you are not using?
> 
> >                  (loop :for line = (read-line *standard-input* nil nil)
> >                     :while line
> >                     :do (format t "~A~%" line))))) ;;; I guess this
> 
> note that the LOOP returns NIL.
> 
> > ;;   one here  is not correct
> >     (with-open-file (stream tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
> >       (format stream input))
> 
> You should not pass NIL as the format control string.
> Please see http://clhs.lisp.se/Body/f_format.htm
> 
> >     (shell (format nil "emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el "~a" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
> >     (format t (with-open-file (stream tmp-md :direction :input)
> >                 (loop :for line = (read-line *standard-input* nil nil)
> >                     :while line
> >                     :do (format t "~A~%" line))))
> 
> again you are passing NIL to FORMAT as the control string.
> 
> >> it's a very bad idea to pass a string to format as the format string.
> >> you will get an error if your (alexandria...) returns a string
> >> containing "~".
> >
> > Yes, I see, I had this error once back.
> 
> So how come you are still making the same error?

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list