[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: MAP (and variants) vs LOOP - Popular opinion observation?

William James

11/3/2015 11:13:00 PM

Nathan Baum wrote:

> Suppose you have
>
> (loop for x in (get-list)
> do (format t "~A~%" x))
>
> and then it turns out you need to print a numeric index. You can do
>
> (loop for x in (get-list)
> for i from 0
> do (format t "~A - ~A~%" i x))
>
> If you start with
>
> (mapc (lambda (x) (format t "~A~%" x)) (get-list))
>
> it seems (to me) that it'd be harder to modify it as needed,
>
> (let ((list (get-list)))
> (mapc (lambda (i x) (format t "~A - ~A" i x))
> (range 0 (length list))
> list))
>
> (I'm assuming the toolkit includes a RANGE utility, or something similar.)

Gauche Scheme:

(for-each (cut print <> " - " <>) (lrange 0) '(a b c))

0 - a
1 - b
2 - c

Ruby:

%w(a b c).each_with_index{|x,i| puts "#{i} - #{x}"}

0 - a
1 - b
2 - c

--
[V]ersions of the false flag attack have been used ... to direct the force of
the people toward whatever end the ruling class may be seeking.... that end
may be war, or it may be the curtailing of domestic civil liberties and basic
human rights. www.alt-market.com/articles/1808-11-signs-of-a-false-flag
5 Answers

RamRod Sword of Baal

6/15/2011 5:45:00 PM

0



"Doc Dice" wrote in message
news:f83d6212-0df9-4643-96fa-76315e19af77@36g2000yqj.googlegroups.com...

ram...@truthonly.com wrote:

>> So, this priest says all are welcome at his church and you call him a
>> bastard, somehow I do not think that will give you a free pass into
>> heaven.

> Queers burn in Hell. Denouncing Queers and their supporters is no
> different than denouncing Rapists and Paedophiles. You Fags will
> molest a boy in a New York minute so there is really no difference
> between you and your cousins the Queer Paedophiles.


>> From my knowledge of the Christian religion, Jesus welcomed all, the
>> sick,
>> maimed, prostitutes, all.

> But no ass tappers or they would be mentioned prominently in the
> Bible.

>
>> But poor bigoted Boob cannot accept that, because it conflicts with his
>> bigoted ideas of hated.

> You cry just like the Paedophiles. You're actually lower than the
> Niggers.

> Doc Dice


Spoken like a true brainless bigot.


Mr. V

6/16/2011 2:55:00 PM

0

On Jun 16, 4:59 am, "Don in Vegas and Memphis!" <dstre...@gmail.com>
wrote:

> Being Catholic also means not judging others, being the best we can be
> and minding our own damned business, IMHO of course. :)
>
> Don

Being a Catholic priest means never having to say you're sorry.

Jose Gomboni

6/19/2011 2:02:00 AM

0

On Sat, 18 Jun 2011 15:36:51 -0700 (PDT), "Don in Vegas and Memphis!"
<dstrevel@gmail.com> wrote:

>ok, cool by me if you want to feel that way. I just will not converse
>on that and do not like to interact with others that enjoy this
>subject enough to erupt it.
>
>Don


I suggest you read the headers and note how
"alt.vacation.las-vegas" stands out like a diamond
in a pig's ass. You would be better informed if you stuck to
"alt.I.want.someone.to.take.all.my.money or alt.don't.buy.a.home.here.
Judging from your post that have popped up in the newsgroup I'm
reading you are way too naive to venture far from your favorite casino
lounge.





...
Responding to some people's posts
is a lot like swatting flies.

Mr. V

6/19/2011 2:14:00 AM

0

On Jun 18, 7:01 pm, Jose Gomboni <jos...@nycbronx.gym> wrote:

> Judging from your post that have popped up in the newsgroup I'm
> reading you are way too naive to venture far from your favorite casino
> lounge.
>
Hell, not only has Don never been in a Las Vegas casino, he's never
been in Las Vegas.

He's mentally ill: kind of like a hoarder, but without a house to
hoard in or a window to throw it out of.

William James

5/9/2016 6:20:00 AM

0

WJ wrote:

> Nathan Baum wrote:
>
> > Suppose you have
> >
> > (loop for x in (get-list)
> > do (format t "~A~%" x))
> >
> > and then it turns out you need to print a numeric index. You can do
> >
> > (loop for x in (get-list)
> > for i from 0
> > do (format t "~A - ~A~%" i x))
> >
> > If you start with
> >
> > (mapc (lambda (x) (format t "~A~%" x)) (get-list))
> >
> > it seems (to me) that it'd be harder to modify it as needed,
> >
> > (let ((list (get-list)))
> > (mapc (lambda (i x) (format t "~A - ~A" i x))
> > (range 0 (length list))
> > list))
> >
> > (I'm assuming the toolkit includes a RANGE utility, or something similar.)
>
> Gauche Scheme:
>
> (for-each (cut print <> " - " <>) (lrange 0) '(a b c))
>
> 0 - a
> 1 - b
> 2 - c
>
> Ruby:
>
> %w(a b c).each_with_index{|x,i| puts "#{i} - #{x}"}
>
> 0 - a
> 1 - b
> 2 - c

OCaml:

List.iteri
(Printf.printf "%d - %s\n")
["a"; "b"; "c"] ;;

0 - a
1 - b
2 - c

--
They agitate for "equality" to facilitate the imposition of their own
immeasurable superiority, and for "economic justice" to mask their conviction
that all the property in the world justly belongs to them.... They denounce
"racism" and agitate for "human rights," with the secret reservation that they
are the only race that is human. --- R. P. Oliver