One-line Quine anyone?
[1/11] from: sunandadh::aol::com at: 24-Nov-2002 5:23
Hey Gabriele.....Re: [REBOL] How dynamic can we be?
That's super-cool!!
And it's not far off being a quine -- a program that outputs a copy of
itself.
Rebol is currently lacking a quine on the main quine collection site:
http://www.nyx.net/~gthompso/quine.htm
There is a quine in the Rebol script library:
http://www.reboltech.com/library/html/quine.html
(Though it doesn't *quite* work as the script librarian has added standard
headings).
So, combining two recent threads, a one-line quine would be neat, as would a
quine that displays its source in a pop-up window. My attempts have been a
little pathetic -- so I'm not even going to list them. But I know lots of
people on this list can do better.
Sunanda
[2/11] from: nitsch-lists:netcologne at: 24-Nov-2002 12:41
[SunandaDH--aol--com] wrote:
>Hey Gabriele.....Re: [REBOL] How dynamic can we be?
>That's super-cool!!
<<quoted lines omitted: 10>>
>little pathetic -- so I'm not even going to list them. But I know lots of
>people on this list can do better.
rebol has quines inbuild. save as script:
rebol [content: true]
s: system/script/header/content
view layout [area s text join "#" length? s]
[3/11] from: anton:lexicon at: 24-Nov-2002 23:34
There was a thread on this before,
so check that out on escribe.
There should be a distinction between
console and file quines.
Here's my one line console quine:
do s: {print rejoin ["do s: {" s "}"]}
A file quine can muck about with
system/script/header/file to find its filename,
and a console quine can maybe muck around with
system/console/history, but maybe these ways are
impure
. :)
I tried to make both a console and file quine
in one, but made an infinite loop...
Anton.
[4/11] from: rotenca:telvia:it at: 24-Nov-2002 13:45
Hi Sunanda
1) Line which reproduces itself as result:
>>1
==1
test:
>> q2: do q1: 1 q1 = q2
== true
2) string line which reproduce iself as result:
1.2.8
mold/only compose/only a: [mold/only compose/only a: (a)]
1.2.1
mold/only compose/deep a: [mold/only compose/deep a: [(a)]]
---
Ciao
Romano
[5/11] from: g:santilli:tiscalinet:it at: 24-Nov-2002 16:11
Hi SunandaDH,
On Sunday, November 24, 2002, 11:23:22 AM, you wrote:
Sac> So, combining two recent threads, a one-line quine would be neat, as would a
Sac> quine that displays its source in a pop-up window. My attempts have been a
Sac> little pathetic -- so I'm not even going to list them. But I know lots of
Sac> people on this list can do better.
This is not one-line, but takes the suggestion from Volker...
You can edit it, update it, and save it... not only the GUI, but
the whole script, with the GUI being updated in real time.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
REBOL [
Title: "Evolving Script"
Date: 24-Nov-2002/16:07:40+1:00
Name: none
Version: 1.6.0
File: %evoscript.r
Home: none
Author: "Gabriele Santilli"
Owner: none
Rights: none
Needs: [view 1.2.8]
Tabs: none
Usage: none
Purpose: "To make the definitive quine!"
Comment: "This can be addictive. You have been warned."
History: [not yet implemented]
Language: "English"
Type: 'Script
Content: true
Layout: [
Do [trebuchet: [name: "Trebuchet MS" size: 14]]
Style Button Btn font trebuchet font-size 16 bold -1x28
Banner center 600 font trebuchet font-size 38 bold yellow "The REBOL evolving script"
Text right 600 font trebuchet font-size 16 "by Gabriele Santilli"
Pad -10 Text right 600 font trebuchet italic "(original idea by Baron R.K. Von Wolfsheild)"
Text 600 font trebuchet
{Maybe I'm just crazy, but this is so much fun! It is amazing to see how easy I can be
amazed by these short things... I wonder if any other language could do this in so few
lines of code, and with this readability...}
Across
a: Area para [] font trebuchet 583x300 system/script/header/content
Pad -8 Scroller 17x300 [
tsize: size-text a
a/para/scroll/y: 280 - tsize/y * face/data
show a
]
Return
Button "Update Layout" 255.200.50 [
attempt [
attempt [
set reduce [in system/script 'header 'content] load/header/next a/text
system/script/header/date: now
system/script/header/version: system/script/header/version + 0.1.0
system/script/header/content: join "REBOL " [
find mold make system/script/header [content: true] "["
content
]
]
lay2: system/words/layout system/script/header/layout
lay/pane: lay2/pane
lay/size: lay2/size
show lay
lay/text: system/script/header/title
lay/changes: 'text
show lay
]
]
Button "Copy Script" [
write clipboard:// system/script/header/content
]
Button "Save Script" 50.240.100 [
write system/script/header/file system/script/header/content
]
]
]
system/view/window-feel/detect: func [face event] [
if event/type = 'scroll-line [
a/para/scroll/y: event/offset/y * -15 + a/para/scroll/y
show a
]
event
]
view lay: layout system/script/header/layout
[6/11] from: carl:cybercraft at: 25-Nov-2002 19:12
On 24-Nov-02, [SunandaDH--aol--com] wrote:
> Hey Gabriele.....Re: [REBOL] How dynamic can we be?
> That's super-cool!!
<<quoted lines omitted: 12>>
> list them. But I know lots of people on this list can do better.
> Sunanda
How about this...
REBOL[] do a: {view layout[field 500 rejoin["REBOL[] do a: {" a "}"]]}
70 characters, complete with header and source in a popup window! do
is a very powerful word... (:
--
Carl Read
[7/11] from: gerardcote:sympatico:ca at: 25-Nov-2002 12:54
Hi Carl,
what another great job you did !
It really wide opens my eyes for what REBOL can pack in so little space ...
and this is valid for all the "stuff" coming from other contenders too !
Keep up everybody,
Gerard
P.S. May be I'll try to submit something by myself one of these days ...
[8/11] from: ammon:rcslv at: 25-Nov-2002 16:49
Hi,
Sorry, but I couldn't help myself:
REBOL[] do a: {view layout[t: field 500 rejoin["REBOL[] do a: {" a "}"] btn
do
[do do t/text]]}
I know, I know, 97 Characters, but it actually "evolves" or executes what is
in the text box. You will notice different results depending on where you
edit the code though. I found that the best result was to add code directly
before 'view. ;-) Oh, and you need the newest beta or Link to execute it,
to make it execute on other systems:
do replace {REBOL[] do a: {view layout[t: field 500 rejoin["REBOL[] do a: {"
a "}"] btn "do" [do t/text]]}} 'btn 'button
It will add four characters, but if you shave all of the whitspace you can
then it will balance out. ;-)
Enjoy!!
Ammon Johnson --- CIO
Addept ------------------ (www.addept.ws)
435-616-2322 -------- ([ammon--addept--ws])
[9/11] from: g:santilli:tiscalinet:it at: 26-Nov-2002 10:42
Hi Ammon,
On Tuesday, November 26, 2002, 12:49:57 AM, you wrote:
AJ> REBOL[] do a: {view layout[t: field 500 rejoin["REBOL[] do a: {" a "}"] btn
AJ> "do" [do do t/text]]}
Hey, be careful: EVOScript started with something like that, and
then look at it now! It's a monster! I'm starting to think it will
eat me someday. ;-)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[10/11] from: ammon:rcslv at: 26-Nov-2002 3:30
Hi,
One problem, you control its growth, once you have it growing on its own
I will be scared. ;-)
Enjoy!!
Ammon Johnson --- CIO
Addept ------------------ (www.addept.ws)
435-616-2322 -------- ([ammon--addept--ws])
----- Original Message -----
From: "Gabriele Santilli" <[g--santilli--tiscalinet--it]>
To: "Ammon Johnson" <[rebol-list--rebol--com]>
Sent: Tuesday, November 26, 2002 2:42 AM
Subject: [REBOL] Re: One-line Quine anyone?
> Hi Ammon,
>
> On Tuesday, November 26, 2002, 12:49:57 AM, you wrote:
>
> AJ> REBOL[] do a: {view layout[t: field 500 rejoin["REBOL[] do a: {" a
}
] btn
[11/11] from: g:santilli:tiscalinet:it at: 26-Nov-2002 13:24
Hi Ammon,
On Tuesday, November 26, 2002, 11:30:14 AM, you wrote:
AJ> One problem, you control its growth, once you have it growing on its own
AJ> I will be scared. ;-)
Yeah, I thought that too, at first...
;-)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted