Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52950

:Re: value not reinitialized on subsequent function calls

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject :Re: value not reinitialized on subsequent function calls
Date 2016-11-29 09:49 +0000
Organization Aioe.org NNTP Server
Message-ID <o1jiva$m6a$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Kenneth Tilton wrote:

> > You need to have some sort of list copy on base-counts
> > to protect the data from the destructive modification.
> >
> > e.g.,
> > (let ((base-counts (list (list 'a 0) (list 'c 0) (list 'g 0) (list t 0)))
> 
> or:
> 
>    (let ((base-counts (loop for base in '(a c g tee)
>                             collecting (list base 0))))...
> 
> Not that 't is not a nice symbol. I don't know, maybe there would be no
> ill consequences. Well, if you forget to quote the other three there
> would likely be a compiler warning, but t would not.
> 
> btw, if loop seems too advanced:
> 
>       (mapcar (lambda (base) (list base 0))
>           '(a c g tee))

Ruby:

[:a,:c,:g,:t].zip([0].cycle)
 ===>
[[:a, 0], [:c, 0], [:g, 0], [:t, 0]]


In Forth?


-- 
When the Israeli bombers and torpedo-planes were sent to attack and destroy the
ship, the Jewish commander, seeing that it was an American vessel, had
misgivings and reported to the High Command, which simply repeated the orders
to attack and sink the Liberty. www.revilo-oliver.com/rpo/Bit_of_Good_News.html

Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread


Thread

:Re: value not reinitialized on subsequent function calls "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-29 09:49 +0000

csiph-web