From: Ken Tilton
Subject: Re: Another From the Trenches Kenny Gotta Be a Better Way Challenge
Date: 
Message-ID: <47e4cdb4$0$25060$607ed4bc@cv.net>
D Herring wrote:
> Barry Margolin wrote:
> 
>> In article 
>> <····································@d45g2000hsc.googlegroups.com>,
>>  Kaz Kylheku <········@gmail.com> wrote:
>>
>>> On Mar 21, 2:58 pm, Ken Tilton <···········@optonline.net> wrote:
>>>
>>>> This is somewhat distorted, but the labeled fn show-one is what I 
>>>> really
>>>> have to do: given a mask and a list of numbers some of whom have 
>>>> already
>>>> been "used" indicated by (= 1 (bit mask <that number>)), pick a number
>>>> at random from those still unused. Without consing.
>>>
>>> Here is what I would do.  I would forget about the silly bitvector. I
>>> would randomize all of these numbers by randomly scrambling the list
>>> (without consing, using destructive manipulation).
>>
>>
>> This sounds like homework, in which case changing the parameters may 
>> not be an acceptable solution.
> 
> 
> The OP was Kenny; do you really think he'd take a Lisp course and ask 
> about homework on this list?  Oh the trash talk that would bring.

It is a trivial part of a larger (discarded) approach to a larger (sort 
of) homework problem, and it was OK to help because I had a fine working 
solution (Barry forgot that exception) and was sharing only because I 
like to share these GBABWs when I see a nicely contained yet interesting 
problem that noobs might enjoy batting around. Even with 90% of you in 
my killfile this allegedly Lisp NG has more longer stupid threads going 
on these days than anything else.

Of course it is in the nature of this group to put the meanest possible 
interpretation on any positive action, such as one clown getting upset 
that I am trying to make money with Lisp by sharing about Lisp and 
another circus act amazed that I am taking the CL message to the land of 
Arc, but I believe it is in Romans II:3-14 that we find "live by the 
savages, die by the savages" so sure.

I posted a test of my solution which happened to have integers in order 
and visited them all so I could at a glance confirm it worked and even 
at the edges where all and one were available and realized that would 
confuse things so added my disclaimer hoping to steer people away from 
misconstruing the spec which I then tried to state:

> given a mask and a list of numbers some of whom have already
> been "used" indicated by (= 1 (bit mask <that number>)), pick a number
> at random from those still unused. Without consing. 

I probably should have worked a while to produce a non-confusing snippet 
because even with instructions to ignore the pink hippopotamus in the 
corner it is bound to get a lot of attention but after all it was just 
an amusement for the noobs so I did not want to spend a lot of time on 
the effort.

kenny


-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Barry Margolin
Subject: Re: Another From the Trenches Kenny Gotta Be a Better Way Challenge
Date: 
Message-ID: <barmar-51824C.10490022032008@newsgroups.comcast.net>
In article <·························@cv.net>,
 Ken Tilton <···········@optonline.net> wrote:

> D Herring wrote:
> > Barry Margolin wrote:
> > 
> >> In article 
> >> <····································@d45g2000hsc.googlegroups.com>,
> >>  Kaz Kylheku <········@gmail.com> wrote:
> >>
> >>> On Mar 21, 2:58 pm, Ken Tilton <···········@optonline.net> wrote:
> >>>
> >>>> This is somewhat distorted, but the labeled fn show-one is what I 
> >>>> really
> >>>> have to do: given a mask and a list of numbers some of whom have 
> >>>> already
> >>>> been "used" indicated by (= 1 (bit mask <that number>)), pick a number
> >>>> at random from those still unused. Without consing.
> >>>
> >>> Here is what I would do.  I would forget about the silly bitvector. I
> >>> would randomize all of these numbers by randomly scrambling the list
> >>> (without consing, using destructive manipulation).
> >>
> >>
> >> This sounds like homework, in which case changing the parameters may 
> >> not be an acceptable solution.
> > 
> > 
> > The OP was Kenny; do you really think he'd take a Lisp course and ask 
> > about homework on this list?  Oh the trash talk that would bring.
> 
> It is a trivial part of a larger (discarded) approach to a larger (sort 
> of) homework problem, and it was OK to help because I had a fine working 
> solution (Barry forgot that exception)

I also didn't give you code, just described an approach in high-level 
terms.  You still have to write it up.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***