[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: Lisp io performance.

William James

5/14/2015 12:43:00 PM

Erik Naggum wrote:

> (defconstant disk-block-size 8192)
>
> (defun copy-file (from to)
> (with-open-file (in from :direction :input)
> (with-open-file (out to :direction :output :if-exists :supersde)
> (let ((buffer (make-array disk-block-size
> :element-type (stream-element-type in))))
> (loop for read = (read-sequence buffer in) until (zerop read) do
> (write-sequence buffer out :end read))))))

That won't run.

:supersde is wrong.

He didn't test it even once. And he was highly regarded
as a CL (COBOL-Like) guru.


Gauche Scheme:

(use gauche.uvector)

(define-constant disk-block-size 8192)

(define (copy-file from to)
(call-with-input-file from (lambda (in)
(call-with-output-file to
(lambda (out)
(let1 buffer (make-u8vector disk-block-size 0)
(generator-for-each
(pa$ write-uvector buffer out 0)
(cut read-uvector! buffer in))))
:if-exists :supersede))))

--
In 1998 he was prosecuted, along with his publisher ... for "denying" the gas
chambers and the six million figure. In July 1998 a Swiss court sentenced him
to 15 months imprisonment, and to pay a large fine, because of his writings.
Rather than serve the sentence, in August 2000 Graf went into exile. In 2001 he
married a Russian historian in Moscow.
http://www.revisionists.com/revisionists...