Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Important Algorithm Finally Ported.

Reply
Thread Tools

Important Algorithm Finally Ported.

 
 
Hampton
Guest
Posts: n/a
 
      01-12-2006
After months of work, gruelling hours, and a nice cup of coffee, the
world's most famous (and infamous) algorithm has been ported to the
ruby language!

{applause}

Thank you, thank you.

The Slim Shady algorithm is a deceptively simple algorithm which finds
use in many many aerospace and bio-informatics systems. Therefore, Ruby
may now stand proud as.... a..... ummm.... language to do those things.

Here is the algorithm...

def slim_shady_finder homies
homies.each do |some_guy|
return some_guy if (some_guy.name.eql? "Slim Shady")
end
return nil
end

Thank you, I know you all can tell how many hours of work have gone
into this conversion. For more information on the SSA and to see where
our implementation has been added... go to the Uncyclopedia.

http://uncyclopedia.org/wiki/Slim_Sh...mplementations

 
Reply With Quote
 
 
 
 
dblack@wobblini.net
Guest
Posts: n/a
 
      01-12-2006
Hi --

On Fri, 13 Jan 2006, Hampton wrote:

> After months of work, gruelling hours, and a nice cup of coffee, the
> world's most famous (and infamous) algorithm has been ported to the
> ruby language!
>
> {applause}
>
> Thank you, thank you.
>
> The Slim Shady algorithm is a deceptively simple algorithm which finds
> use in many many aerospace and bio-informatics systems. Therefore, Ruby
> may now stand proud as.... a..... ummm.... language to do those things.
>
> Here is the algorithm...
>
> def slim_shady_finder homies
> homies.each do |some_guy|
> return some_guy if (some_guy.name.eql? "Slim Shady")
> end
> return nil
> end


I have no idea what you're talking about, but you've triggered my
code-massaging compulsion

def slim_shady_finder(homies)
homies.find {|h| h.name.eql?("Slim Shady") }
end


David

--
David A. Black


"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black


 
Reply With Quote
 
 
 
 
Chad Perrin
Guest
Posts: n/a
 
      01-12-2006
On Fri, Jan 13, 2006 at 02:08:07AM +0900, Hampton wrote:
> After months of work, gruelling hours, and a nice cup of coffee, the
> world's most famous (and infamous) algorithm has been ported to the
> ruby language!
>
> {applause}
>
> Thank you, thank you.
>
> The Slim Shady algorithm is a deceptively simple algorithm which finds
> use in many many aerospace and bio-informatics systems. Therefore, Ruby
> may now stand proud as.... a..... ummm.... language to do those things.
>
> Here is the algorithm...
>
> def slim_shady_finder homies
> homies.each do |some_guy|
> return some_guy if (some_guy.name.eql? "Slim Shady")
> end
> return nil
> end
>
> Thank you, I know you all can tell how many hours of work have gone
> into this conversion. For more information on the SSA and to see where
> our implementation has been added... go to the Uncyclopedia.


Oh, thank goodness. I can finally write that plzstandup.rb program.

--
Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ]

unix virus: If you're using a unixlike OS, please forward
this to 20 others and erase your system partition.


 
Reply With Quote
 
Hampton
Guest
Posts: n/a
 
      01-12-2006
David, I'm sorry to say that there is no way to ever improve upon the
code I write.

For, you see, I am the Savior of Ruby. Actually, I'm just kidding. I'm
really the King of Ruby.

Well, I was trying to use the do and no () to make it as ruby-esque as
possible. But, I do like your use of find... so feel free to change it
on that wiki.

 
Reply With Quote
 
dblack@wobblini.net
Guest
Posts: n/a
 
      01-12-2006
Hi --

On Fri, 13 Jan 2006, Hampton wrote:

> David, I'm sorry to say that there is no way to ever improve upon the
> code I write.
>
> For, you see, I am the Savior of Ruby. Actually, I'm just kidding. I'm
> really the King of Ruby.
>
> Well, I was trying to use the do and no () to make it as ruby-esque as
> possible. But, I do like your use of find... so feel free to change it
> on that wiki.


There's nothing Ruby-esque about leaving off the parens, except when
they're empty, at which point there is Nor is do/end more
Ruby-esque than {}.

I specialize in nice-looking, short-but-readable code that runs really
slowly (I didn't benchmark the two versions but if mine's slower,
it wouldn't be the first time.)


David

--
David A. Black


"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black


 
Reply With Quote
 
Phrogz
Guest
Posts: n/a
 
      01-12-2006
I think you missed a bit:

def slim_shady_finder( homies )
homies.find{ |some_guy| some_guy.name.eql?( "Slim Shady" ) and not
some_guy.imitating? }
end

 
Reply With Quote
 
Ross Bamford
Guest
Posts: n/a
 
      01-12-2006
On Thu, 12 Jan 2006 19:26:40 -0000, Phrogz <> wrote:

> I think you missed a bit:
>
> def slim_shady_finder( homies )
> homies.find{ |some_guy| some_guy.name.eql?( "Slim Shady" ) and not
> some_guy.imitating? }
> end
>


This is so important, I think we should do it *really* slowly and
carefully.

def find_slim(homies)
if (real_slim = homies.select do |guy|
guy.name.eql?('Slim Shady')
end.reject do |guy|
guy.respond_to?(:imitate_shady)
end.each do |guy|
guy.send(lease_stand_up, Time.now)
end).length == 1
real_slim.first
else
homies.shady_missing(:real_slim)
end
end

--
Ross Bamford -
 
Reply With Quote
 
Sam Gentle
Guest
Posts: n/a
 
      01-12-2006
On 1/13/06, Phrogz <> wrote:
> I think you missed a bit:
>
> def slim_shady_finder( homies )
> homies.find{ |some_guy| some_guy.name.eql?( "Slim Shady" ) and not
> some_guy.imitating? }
> end


But surely you can't just know if a slim shady is just imitating
without first asking them to stand up.

Perhaps:

slim_shadies.find { |slim_shady| slim_shady.stand_up_unless {
slim_shady.imitating? } }

Of course, that has problems - for one, it messes up the shadies'
persistent 'standing' state. This could cause serious problems with
false negatives if they were asked to "please stand up" twice in a
row. It might be possible to subsequently make them sit again, but the
whole thing loses thread safety easily (what if two programs
simultaneously need to find the real slim shady?).

To top it all off, there are potential accessibility issues for
disabled slim shadies who are unable to stand. I consider this
particularly likely to become a problem if every person is a slim
shady lurking. I think the only real solution here is to accept that
there is a slim shady in all of us and make slim_shady_finder simply
return nil.

Sam


 
Reply With Quote
 
Hampton
Guest
Posts: n/a
 
      01-13-2006
And this is why its such an important algorithm for so many sciences.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Try...Catch...Finally not firing finally? David Lozzi ASP .Net 12 05-11-2007 12:41 AM
Filtered Back Projection Algorithm (FBP Algorithm) Bapaiah Katepalli VHDL 1 06-23-2006 04:50 PM
How important is WEP? =?Utf-8?B?RGVhbm9pZA==?= Wireless Networking 13 11-22-2004 05:20 AM
Longhorn Wireless Diagnostics: What's important to you? Eddy Malik [MSFT] Wireless Networking 9 11-03-2004 05:53 PM
Key generation algorithm and Cipher algorithm Ahmed Moustafa Java 0 11-15-2003 06:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57