[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: Please help

William James

1/23/2016 11:12:00 PM

> > (defun duplic8 (the-list element)
> > (loop for x in the-list
> > if (eql x element)
> > append (list x x)
> > else
> > append (list x)))
>
> If you like loop, I like this better:
>
> (defun duplic8 (the-list element)
> (loop for x in the-list
> collect x
> when (eql x element) collect x))

MatzLisp (Ruby):

def duplic8 array, item
array.flat_map{|x| x==item ? [x,x] : x}
end

duplic8 [2,3,4], 3
==>[2, 3, 3, 4]

--
When I was a Revolutionary Marxist, we were all in favour of as much
immigration as possible. It wasn't because we liked immigrants, but because we
didn't like Britain.
dailymail.co.uk/news/article-2301743/How-invasion-immigrants-corner-England-mockery-PMs-promise-close-door.html

1 Answer

The Peeler

6/7/2013 1:11:00 PM

0

On Fri, 7 Jun 2013 14:56:51 +0200, The Peeler
<finishingoff@themoronicRevd.invalid> wrote:

>On Fri, 07 Jun 2013 05:48:48 -0700, The Rectum, the resident psychopath of
>sci and scj, FAKING his time zone again and IMPERSONATING his master, The
>Peeler, wrote:
>
>>>One may wonder: why did the Jewish people make the golden calf,
>>>or some of them.
>>
>> May, one Jos? Why? Care, to explain? <GB>
>
>Trying to "impress" him with my idiocy, The Rectum? I guess, you've
>succeeded ...again! LOL

I guess, I have Grik anus! Again innit! LOL