[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: [newbie] Help with loop, progn

William James

2/23/2016 3:00:00 PM

Matthew Danish wrote:

> (defun write-dna-seq (seq-size &optional (stream *standard-output*))
> "Writes a DNA sequence of length seq-size to the given stream. DNA
> sequence consists of characters chosen from (A T G C)"
> (loop repeat seq-size do
> (princ (aref #(A G T C) (random 4))
> stream)
> ;; Return value not important
> (values)))

MatzLisp (Ruby):

def make_dna size
Array.new(size){'acgt'[rand 4]}.join
end

make_dna 64
==>"tctttcctcacaataggaacttaggggagacggtctgttacatcggaatgacgacaatctgata"

--
[A]n unholy alliance of leftists, capitalists, and Zionist supremacists has
schemed to promote immigration and miscegenation with the deliberate aim of
breeding us out of existence in our own homelands.... [T]he real aim stays the
same: the biggest genocide in human history.... --- Nick Griffin
(https://www.youtube.com/watch?v=K...)