Drawing Blanks

Premature Optimization is a Prerequisite for Success

LINQ to Quine

leave a comment »

Here’s a LINQ query that selects its own source code. Not that this is something cool, just for fun.

from s in new string[]{"select \"from s in new string[]{\\\"\" + 
s.Replace(@\"\\\", @\\\\\\).Replace(\"\\\"\", \"\\\\\\\"\") + \"\\\"} \" + s" }
select "from s in new string[]{\"" + s.Replace(@"\", @"\\")
.Replace("\"", "\\\"") + "\"} " + s;
 
(it all needs to be in one line)
 

I’d be curious to see a multiline LINQ query that enumerates its own lines, or a query that enumerates its own characters.

Advertisements

Written by bbzippo

02/17/2010 at 4:03 am

Posted in fun, programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: