Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How I Learned About Quines

by rubasov (Friar)
on Apr 16, 2010 at 11:23 UTC ( #835074=note: print w/replies, xml ) Need Help??


in reply to How I Learned About Quines

As a side note to your nice explanation: You are free to choose the ordering of code and data (encoding). If you start from code+data (opposed to data+code), you'll get a functional programming style quine, like this:

sub{print qq[sub{print qq[$_[0]]}->(q[$_[0]])]}->(q[sub{print qq[$_[0] +]}->(q[$_[0]])])

In a digestible form (but this way it screws up the whitespaces):

sub { print qq[ sub { print qq[ $_[0] ] }->( q[ $_[0] ] ) ] }->( q[ sub { print qq[ $_[0] ] }->( q[ $_[0] ] ) ] )

Sorry for the parentheses haters.

Replies are listed 'Best First'.
Re^2: How I Learned About Quines
by mtve (Deacon) on Apr 16, 2010 at 13:34 UTC

    very nice! sorry, couldn't resist to shorten it:

    sub{print"@_->(q(@_))"}->(q(sub{print"@_->(q(@_))"}))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://835074]
help
Chatterbox?
[kcott]: marioroy, thanks also.
[marioroy]: kcott some time ago, somebody posted about slow logging. I forgot the post. I believed you had replied to it.
[marioroy]: ... among many workers. Somebody had ask how.
[marioroy]: It's not this thread Re^4: Mahalo - Thank you in Hawaii. Someone before had asked before about slow performance.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2017-08-18 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (297 votes). Check out past polls.

    Notices?