Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gary Forbis  
View profile  
 More options Aug 16 2012, 9:04 am
Newsgroups: comp.ai.philosophy
From: Gary Forbis <forbisga...@msn.com>
Date: Thu, 16 Aug 2012 06:04:48 -0700 (PDT)
Local: Thurs, Aug 16 2012 9:04 am
Subject: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
-- this sql program produces its own text.
declare @x varchar(max);
declare @i int;
declare @q varchar(1);
set @x = '''|-- this sql program produces its own text.
declare @x varchar(max);
declare @i int;
declare @q varchar(1);
set @x = |;
set @q = LEFT(@x,1);
set @i = CHARINDEX(substring(@x,2,1),@x,3);
print substring(@x,3,@i-3) + @q + @q + @x + @q + right(@x,len(@x)-@i);';
set @q = LEFT(@x,1);
set @i = CHARINDEX(substring(@x,2,1),@x,3);
print substring(@x,3,@i-3) + @q + @q + @x + @q + right(@x,len(@x)-@i);

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Curt Welch  
View profile  
 More options Aug 16 2012, 2:48 pm
Newsgroups: comp.ai.philosophy
From: c...@kcwc.com (Curt Welch)
Date: 16 Aug 2012 18:48:07 GMT
Local: Thurs, Aug 16 2012 2:48 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text

:)

--
Curt Welch                                            http://CurtWelch.Com/
c...@kcwc.com                                        http://NewsReader.Com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Forbis  
View profile  
 More options Aug 18 2012, 2:33 pm
Newsgroups: comp.ai.philosophy
From: Gary Forbis <forbisga...@msn.com>
Date: Sat, 18 Aug 2012 11:33:35 -0700 (PDT)
Local: Sat, Aug 18 2012 2:33 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
-- Since Comp.ai.philosophy is still dead
-- I thought I would introduce a more random
-- version.  Unfortunately, while I thought I
-- owned a developers edition of sql server
-- my home version does not work so this
-- code is untested.
declare @x varchar(max);
declare @x2 varchar(max);
declare @i int;
declare @q varchar(1);
declare @l int;
declare @r int;

-- I use @x to store the program
set @x = '''-- Since Comp.ai.philosophy is still dead
-- I thought I would introduce a more random
-- version.  Unfortunately, while I thought I
-- owned a developers edition of sql server
-- my home version does not work so this
-- code is untested.
declare @x varchar(max);
declare @x2 varchar(max);
declare @i int;
declare @q varchar(1);
declare @l int;
declare @r int;

-- I use @x to store the program
set @x = ;

-- @q is the quote character
set @q = LEFT(@x,1);

-- the second caracter is the pipe character
-- @i is set to the second instance of the pipe caracter
set @i = CHARINDEX(substring(@x,2,1),@x,3);

-- slice and dice
set @l = round(rand()*(len(@x)-2),0);
set @r = round(rand()*(len(@x)-2),0);
set @x2 = substring(@x,3,@l) + @q + @q + @x + @q + right(@x,@r);

-- does the new string execute
begin try
  exec(left(@x2,len(@x)-10)
end try
begin catch
  set @x2 = substring(@x,3,@i-3) + @q + @q + @x + @q + right(@x,len(@x)-@i);
end catch;

-- now print the random string if it executes
-- otherwise print the known string;
print @x2;';

-- @q is the quote character
set @q = LEFT(@x,1);

-- the second caracter is the pipe character
-- @i is set to the second instance of the pipe caracter
set @i = CHARINDEX(substring(@x,2,1),@x,3);

-- slice and dice
set @l = round(rand()*(len(@x)-2),0);
set @r = round(rand()*(len(@x)-2),0);
set @x2 = substring(@x,3,@l) + @q + @q + @x + @q + right(@x,@r);

-- does the new string execute
begin try
  exec(left(@x2,len(@x)-10)
end try
begin catch
  set @x2 = substring(@x,3,@i-3) + @q + @q + @x + @q + right(@x,len(@x)-@i);
end catch;

-- now print the random string if it executes
-- otherwise print the known string;
print @x2;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
donstockba...@hotmail.com  
View profile  
 More options Aug 18 2012, 3:54 pm
Newsgroups: comp.ai.philosophy
From: donstockba...@hotmail.com
Date: Sat, 18 Aug 2012 12:54:25 -0700 (PDT)
Local: Sat, Aug 18 2012 3:54 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
Since this forum is dead, the following is my take on the purpose of existence:

5  DEBATE  GOTO 5


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dissitra  
View profile  
 More options Aug 18 2012, 4:32 pm
Newsgroups: comp.ai.philosophy
From: Dissitra <dissy...@gmail.com>
Date: Sat, 18 Aug 2012 13:32:25 -0700 (PDT)
Local: Sat, Aug 18 2012 4:32 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
On Aug 18, 7:54 pm, donstockba...@hotmail.com wrote:

> Since this forum is dead, the following is my take on the purpose of existence:

> 5  DEBATE  GOTO 5

halting problems?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Forbis  
View profile  
 More options Aug 18 2012, 5:22 pm
Newsgroups: comp.ai.philosophy
From: Gary Forbis <forbisga...@msn.com>
Date: Sat, 18 Aug 2012 14:22:09 -0700 (PDT)
Local: Sat, Aug 18 2012 5:22 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text

> halting problems?

while (nothing_better_to_do)
  debate_nothing

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Curt Welch  
View profile  
 More options Aug 18 2012, 5:33 pm
Newsgroups: comp.ai.philosophy
From: c...@kcwc.com (Curt Welch)
Date: 18 Aug 2012 21:33:23 GMT
Local: Sat, Aug 18 2012 5:33 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text

Gary Forbis <forbisga...@msn.com> wrote:
> > halting problems?

> while (nothing_better_to_do)
>   debate_nothing

while (nothing_better_to_do)
  debate_everything

--
Curt Welch                                            http://CurtWelch.Com/
c...@kcwc.com                                        http://NewsReader.Com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Hume  
View profile  
 More options Aug 18 2012, 5:38 pm
Newsgroups: comp.ai.philosophy
From: David Hume <david.h...@example.com>
Date: Sat, 18 Aug 2012 22:38:22 +0100
Local: Sat, Aug 18 2012 5:38 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
On 18/08/12 22:33, Curt Welch wrote:

> Gary Forbis <forbisga...@msn.com> wrote:
>>> halting problems?

>> while (nothing_better_to_do)
>>    debate_nothing

> while (nothing_better_to_do)
>    debate_everything

define function passtime
   if nothing to do then passtime

My program is recursive and therefore more beautiful. I must find a way
to put a lambda in it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Stockbauer  
View profile  
 More options Aug 18 2012, 11:24 pm
Newsgroups: comp.ai.philosophy
From: Don Stockbauer <donstockba...@hotmail.com>
Date: Sat, 18 Aug 2012 20:24:58 -0700 (PDT)
Local: Sat, Aug 18 2012 11:24 pm
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
On Aug 18, 3:32 pm, Dissitra <dissy...@gmail.com> wrote:

> On Aug 18, 7:54 pm, donstockba...@hotmail.com wrote:

> > Since this forum is dead, the following is my take on the purpose of existence:

> > 5  DEBATE  GOTO 5

> halting problems?

No halt, that's the point.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Forbis  
View profile  
 More options Aug 19 2012, 12:58 am
Newsgroups: comp.ai.philosophy
From: Gary Forbis <forbisga...@msn.com>
Date: Sat, 18 Aug 2012 21:58:39 -0700 (PDT)
Local: Sun, Aug 19 2012 12:58 am
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
My random version didn't work.  
I gave up and tried it on a machine where I had sqlserver installed.
While playing around with it I came up with this more direct version
of the earlier program:

declare @q varchar(1);
declare @p varchar(1);
declare @x varchar(max);
set @q='''';
set @p='|';
set @x='declare @q varchar(1);
declare @p varchar(1);
declare @x varchar(max);
set @q='''''''';
set @p=''|'';
set @x=''||'';
print REPLACE(@x,@p+@p,REPLACE(@x,@q,@q+@q));';
print REPLACE(@x,@p+@p,REPLACE(@x,@q,@q+@q));

I got a somewhat random version to work but it broke
on the fourth recursion.  I needed to make sure @q
was set or the routine failed.  This routine would
be quite brittle.  It turns out exec() doesn't allow
a function, at least on the version I'm running.
The easiest way to handle the try/catch was like
this except first setting @x2 to the randomized
version rather than the non-random version.

set @pr = '
print @x2+@pr;';
set @x2=REPLACE(@x,@p+@p,REPLACE(@x,@q,@q+@q));
begin try
  exec(@x2);
  print '--new routine';
end try
begin catch
  print '--old routine';
  set @x2=REPLACE(@x,@p+@p,REPLACE(@x,@q,@q+@q));
end catch
print @x2+@pr;

a less brittle routine would need to do some basic
checking for health such as replacing duplicate declares
with new names and making sure quotes were paired.

Maybe sql madlibs would be easier.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Forbis  
View profile  
 More options Aug 20 2012, 9:34 am
Newsgroups: comp.ai.philosophy
From: Gary Forbis <forbisga...@msn.com>
Date: Mon, 20 Aug 2012 06:34:51 -0700 (PDT)
Local: Mon, Aug 20 2012 9:34 am
Subject: Re: Since this forum has gone dead I thought you might like this sql version of a program that produces its own text
I guess I'll have to get a developers edition of sqlserver 2012.
I realized I can't manually handle the generations.  While the
4th generation broke I didn't allow the routines that didn't
break to reproduce.  It seems to me that I need to encapsulate
the routine and save off the generations.  The simplest approach
would be to run the whole thing from within an exec.  I don't
know if exec can be nested.  I'll need to find out.  If so
then I know temp tables survive a dynamic sql call.

  create table #a {child varchar(max)};
  ...
  insert into #a
  select @x3;

while

  select @x3 into #a;

would be shorter, it would make hopeful monsters less likely
to be able to produce multiple children.  Letting the routine
create the temp table would also allow for the possibility
of creating two unique tables.  It seems unlikely the routine
would ever write to multiple unique tables who knows.

I think the simplest selection algorithm would be number
of unique children within a certain number of offspring
with population control starting at some point.  

In my first random reproducer the fourth generation produced
an empty string.  During development I found several cases
where it duplicated some of the set commands.  Most of the
cases just appended to comment lines.  I specifically included
lots of comment lines so this would be more probable.  I
think I need to have the routine inject new characters so
the pool isn't limited to the one's in the original routine.

It may take awhile for me to get my hands on a developer's
edition of sqlserver.  You won't hear again until I get
some results, positive or negative.  
Some milestones would be:
  surviving generations 10, 100, 1000, etc.  
  producing multiple offspring in a single run.
  creating multiple tables.
  creating a permanent table.

While I could make the production of multiple offsring
more likely by adding lots of comments just before and
after the insert statement I don't think my originator
will be that generous, at least to start.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »