[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Love poem in code for a Grooms Cake

Jen Switalski

3/21/2009 3:30:00 PM

Hi all,

I am engaged to a programmer. I, however, know very little about code
other than to always comment! Was hoping to have a surprise grooms cake
for our wedding with maybe a simple love poem in code written on it. He
likes writing in Ruby, Perl, etc. (He is a fan of object-oriented and
also of open source). He also has to write in C or C++ for his job.

Anyway, I was wondering if anyone who sees this post would know of any
"love poems" in a language like one of these. Like love in a forever
loop? Ha, does that even make any sense?

I suppose if I can't find this, I can just get a cake in the shape of
Tux.

I apologize if this is not using the forum appropriately, but don't
really know where else to ask.

Thanks!

P.S. Please no VB. :)
--
Posted via http://www.ruby-....

15 Answers

James Coglan

3/21/2009 3:43:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

2009/3/21 Jen Switalski <jaswitalski@gmail.com>

> Hi all,
>
> I am engaged to a programmer. I, however, know very little about code
> other than to always comment! Was hoping to have a surprise grooms cake
> for our wedding with maybe a simple love poem in code written on it. He
> likes writing in Ruby, Perl, etc. (He is a fan of object-oriented and
> also of open source). He also has to write in C or C++ for his job.
>
> Anyway, I was wondering if anyone who sees this post would know of any
> "love poems" in a language like one of these. Like love in a forever
> loop? Ha, does that even make any sense?
>
> I suppose if I can't find this, I can just get a cake in the shape of
> Tux.
>
> I apologize if this is not using the forum appropriately, but don't
> really know where else to ask.



Well I'm no poet but this is valid Ruby code:

i do
promise_to_love you until death.parts us
end

Codeblogger

3/21/2009 3:57:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Hi Jen, what do you think of:

while(true) I.love(you)
end

Nicolai

Jen Switalski

3/21/2009 4:06:00 PM

0

Nicolai Reuschling wrote:
> Hi Jen, what do you think of:
>
> while(true) I.love(you)
> end
>
> Nicolai

Hi Nicolai and everyone.

Thanks for the ideas, but since I don't actually know code, could you
include a short description of what the code says/means? The two posted
are nice and short, I just honestly don't quite know what they mean. Or
if they are simply rhyming in code that is not actually executable,
that's okay too. Thanks!!
--
Posted via http://www.ruby-....

Daniel Berger

3/21/2009 4:17:00 PM

0

Codeblogger wrote:
> Hi Jen, what do you think of:
>
> while(true) I.love(you)
> end

Let's make it a one-liner.

I.love(you) while true

Another idea:

I.love(you) until death do |us|
part
end

Regards,

Dan



Ian Trudel

3/21/2009 5:15:00 PM

0

Jen Switalski wrote:
> Anyway, I was wondering if anyone who sees this post would know of any
> "love poems" in a language like one of these. Like love in a forever
> loop? Ha, does that even make any sense?

Weird! :P


loop do
p ["Jen", "YourFiancéName"].inject{ |i, you| i + " loves " + you }
end


Replace YourFiancéName accordingly. This small piece of code forever
injects loves between your fiancé and you. ;) As a bonus, it would
output to screen "Jen loves YourFiancéName". A touch of subtlety is
always nice.

Best wishes for your marriage.

Regards,
Ian
--
Posted via http://www.ruby-....

Daniel Berger

3/21/2009 6:11:00 PM

0



On Mar 21, 10:16=A0am, Daniel Berger <djber...@gmail.com> wrote:
> Codeblogger wrote:
> > Hi Jen, what do you think of:
>
> > while(true) =A0I.love(you)
> > end
>
> Let's make it a one-liner.
>
> I.love(you) while true
>
> Another idea:
>
> I.love(you) until death do |us|
> =A0 =A0 part
> end

BTW, this isn't "real" code, though it's legal syntax.

Regards,

Dan

Codeblogger

3/22/2009 12:04:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

Hi Jen,
I didn't even notice the rhyme.
Even better I think. :-)

while(true)
>
I.love(you)
> end
>

It's basically an infinite loop and it's simply two objects ("I" and "you")
combined by the verb/method "love".
And: Yes, it's actual code.

Glad to be of help!

Nicolai

Joel VanderWerf

3/22/2009 12:16:00 AM

0


There is the shell option:

$ yes "I love you"
I love you
I love you
...

(and so on)

It's not ruby, but most ruby people know some shell commands.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

pjb

3/22/2009 2:33:00 AM

0

Codeblogger <codeblogger@gmail.com> writes:

> [Note: parts of this message were removed to make it a legal post.]
>
> Hi Jen,
> I didn't even notice the rhyme.
> Even better I think. :-)
>
> while(true)
> I.love(you)
> end
>>
>
> It's basically an infinite loop and it's simply two objects ("I" and "you")
> combined by the verb/method "love".
> And: Yes, it's actual code.

Not really:

irb(main):208:0> while(true)
I.love(you)
end
NameError: uninitialized constant I
from (irb):210
from .:0


Rather try:

class Person
attr_accessor :name
def initialize(name)
@name=name
end
def love(otherPerson)
puts self.name+" loves "+otherPerson.name+"\n"
end
end

I=Person.new("Jen Switalski")
you=Person.new("a programmer")
while true
I.love(you)
end

-->
Jen Switalski loves a programmer
Jen Switalski loves a programmer
Jen Switalski loves a programmer
Jen Switalski loves a programmer
Jen Switalski loves a programmer
Jen Switalski loves a programmer
Jen Switalski loves a programmer
...

--
__Pascal Bourguignon__

Phrogz

3/22/2009 3:29:00 AM

0

On Mar 21, 8:33 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
>     class Person
>       attr_accessor :name
>       def initialize(name)
>          @name=name
>       end
>       def love(otherPerson)
>          puts self.name+" loves "+otherPerson.name+"\n"
>       end
>     end
>
>     I=Person.new("Jen Switalski")
>     you=Person.new("a programmer")
>     while true
>       I.love(you)
>     end

Let's tighten that up a bit, and remove the non-rubyesque camel
casing.

Person = Struct.new( :name ) do
def love( other )
puts "#{self.name} loves #{other.name}"
end
end
I = Person.new("Jen Switalski")
you = Person.new("Bob")
while true
I.love(you)
end

Dunno if that'll fit on the cake, but it gets closer.