[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

[QUIZ] Quine (#207

Daniel Moore

5/29/2009 3:55:00 PM

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The three rules of Ruby Quiz:

1. Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent.

2. Support Ruby Quiz by submitting ideas and responses
as often as you can!
Visit: http://rubyquiz.../s...

3. Enjoy!

Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby Talk follow the discussion. Please reply to
the original quiz message, if you can.

RSS Feed: http://rubyquiz.../q...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

## Quine (#207)

Ahn nyeong Rubyists,

This week's quiz is to create a quine[1], that is: a program which
receives no input and produces a copy of its own source code as its
only output.


[1]: http://en.wikipedia.org/w...(computing)

Have Fun!
--
-Daniel
http://rubyquiz...

37 Answers

Bill Kelly

5/29/2009 10:59:00 PM

0


From: "Dana Merrick" <dmerrick@ics.com>
>
> Daniel Moore wrote:
> > This week's quiz is to create a quine[1], that is: a program which
> > receives no input and produces a copy of its own source code as its
> > only output.
>
> I have mine down to down to one line (29 characters), though I
> suspect everyone will agree I'm cheating.

I have 30 characters, w/out cheating. It does output a warning
on 1.8.6, but not 1.8.7 or 1.9.1. (And since the warning is on
stderr, it doesn't affect the quine output really, I guess.)


Regards,

Bill



Sebastian Hungerecker

5/30/2009 12:18:00 AM

0

Am Samstag 30 Mai 2009 00:17:21 schrieb Dana Merrick:
> I have mine down to down to one line (29 characters), though I suspect
> everyone will agree I'm cheating.

I have 19 characters with cheating. 14 if it only needs to run on unixoid-
systems.

Sebastian Hungerecker

5/30/2009 12:31:00 AM

0

Am Samstag 30 Mai 2009 02:17:54 schrieb Sebastian Hungerecker:
> 14 if it only needs to run on unixoid-systems.

Well, 15 if it needs to work correctly ;-)

pjb

5/30/2009 1:21:00 AM

0

Sebastian Hungerecker <sepp2k@googlemail.com> writes:

> Am Samstag 30 Mai 2009 02:17:54 schrieb Sebastian Hungerecker:
>> 14 if it only needs to run on unixoid-systems.
>
> Well, 15 if it needs to work correctly ;-)

I've got one that is more than 40 characters, but it's _readable_!

--
__Pascal Bourguignon__

Bill Kelly

5/30/2009 1:42:00 AM

0


From: "Pascal J. Bourguignon" <pjb@informatimago.com>
>
> I've got one that is more than 40 characters, but it's _readable_!

Did you mean: ((I've got (one)) (that is more than ((40) characters)), ((but) (it's _readable_!)) ?


;)



pjb

5/30/2009 2:29:00 AM

0

Bill Kelly <billk@cts.com> writes:

> From: "Pascal J. Bourguignon" <pjb@informatimago.com>
>>
>> I've got one that is more than 40 characters, but it's _readable_!
>
> Did you mean: ((I've got (one)) (that is more than ((40) characters)), ((but) (it's _readable_!)) ?
>
>
> ;)

Well I could have done something like that, yes, but I restrained myself this time :-)


Too bad we've got only oneliners, a subsidiary questions would have
been to produce a reversed quine, a quine that outputs the source
lines in the reverse order. (In C it's funny).

--
__Pascal Bourguignon__

Joel VanderWerf

5/30/2009 3:22:00 AM

0

Bill Kelly wrote:
>
> From: "Pascal J. Bourguignon" <pjb@informatimago.com>
>>
>> I've got one that is more than 40 characters, but it's _readable_!
>
> Did you mean: ((I've got (one)) (that is more than ((40) characters)),
> ((but) (it's _readable_!)) ?
>
>
> ;)

There is only one way to respond to that mess of redundant )

(
(I've got
(one
(that is more than
(
(40
characters,
(
(but
(it's _readable_!

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

Matthew Williams

5/30/2009 3:44:00 AM

0

I've got one that's 197 characters, but it:

+ is readable and formatted nicely
+ uses gems
+ uses a class
+ shows the inheritence of said class
+ has more than one instance of "end"
+ took me less than 5 minutes to write

;-)

Now to try for brevity....

Matt
--
"... if you do follow your bliss you put yourself on a kind of
track that has been there all the while, waiting for you, and the life
that you ought to be living is the one you are living. When you can
see that, you begin to meet people who are in your field of bliss, and
they open doors to you. I say, follow your bliss and don't be afraid,
and doors will open where you didn't know they were going to be." --
Joseph Campbell


On Sat, 30 May 2009, Pascal J. Bourguignon wrote:

> Sebastian Hungerecker <sepp2k@googlemail.com> writes:
>
>> Am Samstag 30 Mai 2009 02:17:54 schrieb Sebastian Hungerecker:
>>> 14 if it only needs to run on unixoid-systems.
>>
>> Well, 15 if it needs to work correctly ;-)
>
> I've got one that is more than 40 characters, but it's _readable_!
>
> --
> __Pascal Bourguignon__
>
>

Matthew Williams

5/30/2009 4:42:00 AM

0

Ok, I'm at 17 if I ***cheat*** & assume *NIX.
and 28 if I don't cheat.

Still kinda fun, though.... the one at 28 bytes is not anything I'd use
in real life, however. Definitely not maintainable.

Matt

--
"... if you do follow your bliss you put yourself on a kind of
track that has been there all the while, waiting for you, and the life
that you ought to be living is the one you are living. When you can
see that, you begin to meet people who are in your field of bliss, and
they open doors to you. I say, follow your bliss and don't be afraid,
and doors will open where you didn't know they were going to be." --
Joseph Campbell


On Sat, 30 May 2009, Matthew K. Williams wrote:

> I've got one that's 197 characters, but it:
>
> + is readable and formatted nicely
> + uses gems
> + uses a class
> + shows the inheritence of said class
> + has more than one instance of "end"
> + took me less than 5 minutes to write
>
> ;-)
>
> Now to try for brevity....
>
> Matt
> --
> "... if you do follow your bliss you put yourself on a kind of
> track that has been there all the while, waiting for you, and the life
> that you ought to be living is the one you are living. When you can
> see that, you begin to meet people who are in your field of bliss, and
> they open doors to you. I say, follow your bliss and don't be afraid,
> and doors will open where you didn't know they were going to be." --
> Joseph Campbell
>
>
> On Sat, 30 May 2009, Pascal J. Bourguignon wrote:
>
>> Sebastian Hungerecker <sepp2k@googlemail.com> writes:
>>
>>> Am Samstag 30 Mai 2009 02:17:54 schrieb Sebastian Hungerecker:
>>>> 14 if it only needs to run on unixoid-systems.
>>>
>>> Well, 15 if it needs to work correctly ;-)
>>
>> I've got one that is more than 40 characters, but it's _readable_!
>>
>> --
>> __Pascal Bourguignon__
>>
>>
>
>

Joshua Ballanco

5/30/2009 5:15:00 AM

0

I'm always up for some golf!

12 bytes if *NIX and cheating...HA!

-Josh