Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: word puzzle

18 views
Skip to first unread message

WJ

unread,
Mar 27, 2015, 11:03:59 PM3/27/15
to
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
Pascal Bourguignon wrote:

> (setf lexicon
> (with-open-file (file "word.data")
> (let ((*read-eval* nil))
> (loop with lex = (make-array 0 :adjustable t)
> for word = (read file nil nil)
> while word
> do (vector-push-extend word lex)
> finally (return lex)))))

Evidently he is trying to read words from a file
and put them into a vector.

Let's see if that crap even runs.

Armed Bear Common Lisp 0.12.0:

Debugger invoked on condition of type TYPE-ERROR:
The value #() is not of type
(AND VECTOR (SATISFIES ARRAY-HAS-FILL-POINTER-P)).

SBCL:

debugger invoked on a SIMPLE-TYPE-ERROR:
#() is not an array with a fill pointer.


Worshippers of CL (COBOL-Like) are disasters.
They have no interest in correct programming or
efficient programming or elegant programming.

They only want to worship their CL god.


Gauche Scheme:

Contents of file:
one two
three


(use srfi-42) ; vector-ec

(call-with-input-file "word.data"
(lambda (port)
(vector-ec (: word port) word)))

===>
#(one two three)

WJ

unread,
Jan 14, 2016, 6:03:04 AM1/14/16
to
WJ wrote:

> Pascal Bourguignon wrote:
>
> > (setf lexicon
> > (with-open-file (file "word.data")
> > (let ((*read-eval* nil))
> > (loop with lex = (make-array 0 :adjustable t)
> > for word = (read file nil nil)
> > while word
> > do (vector-push-extend word lex)
> > finally (return lex)))))
>
> Evidently he is trying to read words from a file
> and put them into a vector.

MatzLisp (Ruby):

IO.read("input.txt").split

--
He has nothing but kind sentiments for those who would destroy his home and
family.... He is universally tolerant.... If he has any principles, he keeps
them well concealed.... He is, to the extent of his abilities, exactly like
the next citizen, who, he trusts, is trying to be exactly like him: a faceless,
characterless putty-man. --- Father Feeney; "Should Hate Be Outlawed?"
0 new messages