[futurebasic] Re: [FB] Ken's Quine

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2009 : Group Archive : Group : All Groups

From: Jay Reeve <jayreeve@...>
Date: Sat, 24 Jan 2009 10:29:13 -0600
Since this is purely a programmers conceit, I thought it might be  
even more fun to play with the var names a bit. I also thought it  
needed some way to more easily distinguish the data lines from the  
functional lines, so here's a little perversion of my original code:

  : DATA " : DATA "
DIM a, q$,ui$,ne$
  : DATA "DIM a, q$,ui$,ne$"
READ q : ne = CHR$(34) : q += ne : PRINT q;q
  : DATA "READ q : ne = CHR$(34) : q += ne : PRINT q;q"
FOR a = 1 TO 3 : READ ui : PRINT ui : PRINT q;ui;ne : NEXT
  : DATA "FOR a = 1 TO 3 : READ ui : PRINT ui : PRINT q;ui;ne : NEXT"

As I pondered how Alain might come up with the ultimate 2-line  
solution, I decided I had to show it's possible, so here's my 2-line  
wonder as requested--though still without pointers. As I continued to  
compress it, I was amazed to find the lines reached < 80 chars, so  
might survive email!

// Two-line Quine //
DATA "DATA DIM a$,q$:q=CHR$(34):READ a:PRINT LEFT$(a,5);q;a;q:PRINT  
MID$(a,6)"
DIM a$,q$:q=CHR$(34):READ a:PRINT LEFT$(a,5);q;a;q:PRINT MID$(a,6)

I hope some of you (newbies in particular) will have some fun parsing  
what I've done here. Can you find any way to further compress? Holler  
if you have any questions--that's what this list is for.

   e-e
   =J= a  y
    "


On Jan 24, 2009, at 8:43 AM, Jay Reeve wrote:

> Quoting Ken Shmidheiser <kshmidheiser@...>:
>
>
>> Maybe we can even resurrect Jay Reeve and have him do it with  
>> pointers
>> in two lines.
>>
>
> Sorry--No pointers--No 2-line wonders--but here's my entry anyway.  
> To see the output, run in Console mode.
>
> DATA "DATA "
> DIM a$, d$, q$, i
> DATA "DIM a$, d$, q$, i"
> READ d : q = CHR$(34) : d += q : PRINT d;d
> DATA "READ d : q = CHR$(34) : d += q : PRINT d;d"
> FOR i = 1 TO 3 : READ a : PRINT a : PRINT d;a;q : NEXT
> DATA "FOR i = 1 TO 3 : READ a : PRINT a : PRINT d;a;q : NEXT"
>
>    e-e
>    =J= a  y
>     "
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>
>