[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: Python syntax in Lisp and Scheme

William James

7/28/2015 6:28:00 AM

Paul Rubin wrote:

> > Scheme
> > (define vector-fill!
> > (lambda (v x)
> > (let ((n (vector-length v)))
> > (do ((i 0 (+ i 1)))
> > ((= i n))
> > (vector-set! v i x)))))
>
> I think you could write the scheme code like this:
>
> (define vector-fill! (v x)
> (let ((i 0))
> (while (< i (length v))
> (vector-set! v i x)
> (set! i (1+ i)))))

Gauche Scheme:

(let1 v #(0 0 0 0)
(vector-fill! v 88)
v)
===>
#(88 88 88 88)

Another way:

(let1 v #(0 0 0 0)
(vector-map! (^x 88) v)
v)

--
The struggle of our time is to concentrate, not to dissipate: to renew our
association with traditional wisdom: to re-establish a vital connection between
the individual and the race. It is, in a word, a struggle against Liberalism.
--- T. S. Elliot
2 Answers

William James

1/11/2016 12:13:00 AM

0

WJ wrote:

> Paul Rubin wrote:
>
> > > Scheme
> > > (define vector-fill!
> > > (lambda (v x)
> > > (let ((n (vector-length v)))
> > > (do ((i 0 (+ i 1)))
> > > ((= i n))
> > > (vector-set! v i x)))))
> >
> > I think you could write the scheme code like this:
> >
> > (define vector-fill! (v x)
> > (let ((i 0))
> > (while (< i (length v))
> > (vector-set! v i x)
> > (set! i (1+ i)))))
>
> Gauche Scheme:
>
> (let1 v #(0 0 0 0)
> (vector-fill! v 88)
> v)
> ===>
> #(88 88 88 88)
>
> Another way:
>
> (let1 v #(0 0 0 0)
> (vector-map! (^x 88) v)
> v)

MatzLisp (Ruby):

vector.fill 0

--
[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...)

William James

5/7/2016 9:17:00 PM

0

WJ wrote:

> Paul Rubin wrote:
>
> > > Scheme
> > > (define vector-fill!
> > > (lambda (v x)
> > > (let ((n (vector-length v)))
> > > (do ((i 0 (+ i 1)))
> > > ((= i n))
> > > (vector-set! v i x)))))
> >
> > I think you could write the scheme code like this:
> >
> > (define vector-fill! (v x)
> > (let ((i 0))
> > (while (< i (length v))
> > (vector-set! v i x)
> > (set! i (1+ i)))))
>
> Gauche Scheme:
>
> (let1 v #(0 0 0 0)
> (vector-fill! v 88)
> v)
> ===>
> #(88 88 88 88)
>
> Another way:
>
> (let1 v #(0 0 0 0)
> (vector-map! (^x 88) v)
> v)

OCaml:

let v = [|0;0;0;0;0;0;0;0|];;
Array.fill v 2 6 88 ;;
v ;;

===>
[|0; 0; 88; 88; 88; 88; 88; 88|]

--
I don't believe in western morality, i.e. don't kill civilians or children....
The only way to fight a moral war is the Jewish way: Destroy their holy sites.
Kill men, women and children (and cattle). --- Rabbi Manis Friedman
web.archive.org/web/20090605154706/http://www.momentmag.com/Exclusive/2009/2009-06/200906-Ask_R...
archive.org/download/DavidDukeVideo/TheZionistMatrixOfPowerddhd.ogv