9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] The first annual "Hello, World" challenge
@ 2009-08-18 17:26 ron minnich
  2009-08-18 17:53 ` John Floren
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: ron minnich @ 2009-08-18 17:26 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

See this: http://www.wxwidgets.org/docs/tutorials/hworld2.txt

Well, they just seem to keep getting longer.

Your goal: hello, world in one line. Language of your choice. Linking
in a 512 MB library is a violation of the spirit of this contest.

Additional rules:
- line length is not defined but let's be reasonable
- if you can fit it in a standard Hollerith card format (72 chars plus
8 chars of comment) that's a plus

Redirection of stdout is allowed.

ron
ron



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 17:26 [9fans] The first annual "Hello, World" challenge ron minnich
@ 2009-08-18 17:53 ` John Floren
  2009-08-18 18:53   ` andrey mirtchovski
  2009-08-18 17:54 ` erik quanstrom
  2009-08-19  0:25 ` Abhishek Kulkarni
  2 siblings, 1 reply; 9+ messages in thread
From: John Floren @ 2009-08-18 17:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

In rc:
% window 'echo hello world; sleep 5'

It's probably against the spirit, but hey, it fits on a Hollerith
card! Technically.

In C, the quickest thing I came up with using draw is:
#include <u.h>
#include <libc.h>
#include <draw.h>

void
main(void)
{
	initdraw(0, 0, "hello");

	string(screen, addpt(Pt(40,40), screen->r.min), display->black, ZP,
display->defaultfont, "hello world");
	flushimage(display, 1);
	sleep(5000);
}

If you throw in libpanel, it's only a little bigger (mostly libpanel
maintenance things) plus you get a button to quit:

#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
#include <panel.h>

Panel *root;

void
done(Panel *p, int buttons) {
	USED(p, buttons);
	exits(0);
}

void eresized(int new)
{
	Rectangle r;

	if(new && getwindow(display, Refnone) == -1) {
		fprint(2, "getwindow: %r\n");
		exits("getwindow");
	}
	r = screen->r;
	plpack(root, r);
	draw(screen, r, display->white, 0, ZP);
	pldraw(root, screen);
}

void
main(void)
{
	Event e;

	initdraw(0, 0, "hello");
	einit(Emouse);
	plinit(screen->depth);
	root=plframe(0, EXPAND);
		pllabel(root, PACKN|FILLX, "Hello world!");
		plbutton(root, PACKN, "Done", done);

	eresized(0);

	for (;;) {
		switch(event(&e)){
		case Emouse:
			plmouse(root, e.mouse);
			break;
		}
	}
}




On Tue, Aug 18, 2009 at 10:26 AM, ron minnich<rminnich@gmail.com> wrote:
> See this: http://www.wxwidgets.org/docs/tutorials/hworld2.txt
>
> Well, they just seem to keep getting longer.
>
> Your goal: hello, world in one line. Language of your choice. Linking
> in a 512 MB library is a violation of the spirit of this contest.
>
> Additional rules:
> - line length is not defined but let's be reasonable
> - if you can fit it in a standard Hollerith card format (72 chars plus
> 8 chars of comment) that's a plus
>
> Redirection of stdout is allowed.
>
> ron
> ron
>
>



--
"Object-oriented design is the roman numerals of computing" -- Rob Pike



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 17:26 [9fans] The first annual "Hello, World" challenge ron minnich
  2009-08-18 17:53 ` John Floren
@ 2009-08-18 17:54 ` erik quanstrom
  2009-08-19  0:25 ` Abhishek Kulkarni
  2 siblings, 0 replies; 9+ messages in thread
From: erik quanstrom @ 2009-08-18 17:54 UTC (permalink / raw)
  To: 9fans

> Your goal: hello, world in one line. Language of your choice. Linking
> in a 512 MB library is a violation of the spirit of this contest.
>
> Additional rules:
> - line length is not defined but let's be reasonable
> - if you can fit it in a standard Hollerith card format (72 chars plus
> 8 chars of comment) that's a plus

would troff be cheating?  it's a language.
	hello, world
if it is, how about in rc
	echo hello, world
sed
	s/^/hello, world/g
dc
	[hello, world]p
awk
	BEGIN{print "hello, world"; exit}
acid
	print("hello, world");

that's 1/512th of your size limit, if you count all scripts
and all executables.

- erik



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 17:53 ` John Floren
@ 2009-08-18 18:53   ` andrey mirtchovski
  2009-08-18 23:18     ` James Tomaschke
  2009-08-19 10:32     ` Uriel
  0 siblings, 2 replies; 9+ messages in thread
From: andrey mirtchovski @ 2009-08-18 18:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

i have some variations on a theme:

linux, i386: main() { syscall(4, 1, "hello world\n", 12); } (~6KB
dynamically linked)
linux, x86: main() { syscall(1, 1, "hello world\n", 12); } (~6KB, 4KB
stripped; 2.4megs statically linked, 400KB statically linked and
stripped)

p9, shell: % syscall write 1 'hello world' 11
p9, c: void main(){_write(1, "hello world\n", 12);} (link with libc
manually, 3.3KB)

also, i discovered something new today:

"... decided to link everything dynamically. To enforce this (allmost)
all static libraries are removed (or not even build)..."

$ gcc t.c -static
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 18:53   ` andrey mirtchovski
@ 2009-08-18 23:18     ` James Tomaschke
  2009-08-19 10:32     ` Uriel
  1 sibling, 0 replies; 9+ messages in thread
From: James Tomaschke @ 2009-08-18 23:18 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

andrey mirtchovski wrote:
> i have some variations on a theme:
>
> linux, i386: main() { syscall(4, 1, "hello world\n", 12); } (~6KB
> dynamically linked)
> linux, x86: main() { syscall(1, 1, "hello world\n", 12); } (~6KB, 4KB
> stripped; 2.4megs statically linked, 400KB statically linked and
> stripped)
You can also use some alternative libcs for a reduced footprint, or
eliminate libc altogether with some simple inline assembly.  GNU is
really bloated.

I'm not sure where one draws the line though, theres also is a lot of
code and memory behind that syscall before anything is seen on the
screen, which could be considered part of the "linked" code.

One could always poke data into video memory and avoid all that, but
that does not get us the "Are you sure?" dialog box or status bars that
go from 0 to 100% over and over again.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqLNrUACgkQl3JZTBu3/9naawCdF9Hlx2niYJJpnbT52tLobmU6
btEAmQGuBC629h7Xx7fu6FKD8NE5yRr7
=JBrq
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 17:26 [9fans] The first annual "Hello, World" challenge ron minnich
  2009-08-18 17:53 ` John Floren
  2009-08-18 17:54 ` erik quanstrom
@ 2009-08-19  0:25 ` Abhishek Kulkarni
  2009-08-19  2:06   ` LiteStar numnums
  2 siblings, 1 reply; 9+ messages in thread
From: Abhishek Kulkarni @ 2009-08-19  0:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

On Tue, Aug 18, 2009 at 11:26 AM, ron minnich <rminnich@gmail.com> wrote:

> See this: http://www.wxwidgets.org/docs/tutorials/hworld2.txt
>
> Well, they just seem to keep getting longer.
>
> Your goal: hello, world in one line. Language of your choice. Linking
> in a 512 MB library is a violation of the spirit of this contest.
>
> Additional rules:
> - line length is not defined but let's be reasonable
> - if you can fit it in a standard Hollerith card format (72 chars plus
> 8 chars of comment) that's a plus
>
> Redirection of stdout is allowed.
>
> ron
> ron
>
>
and if you want something more cryptic (which was a whole lot fun to do):

_prog_:= prog() {_prog_:="";len _prog_;};prog_:=prog(_prog:prog()) of
prog(){print_:=print(_prog);_print_:=(len
print_-184)/17;print(print_[2*_print_+17],print_[7*_print_+63],print_[11*_print_+114],print_[11*_print_+114],print_[4],print_[6]);begin
prog(_char:char){print(_char);}(119);print(print_[4],print_[3],print_[11*_print_+114],print_[4*_print_+40]);become
_prog;}(_prog_);

[-- Attachment #2: Type: text/html, Size: 1494 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-19  0:25 ` Abhishek Kulkarni
@ 2009-08-19  2:06   ` LiteStar numnums
  0 siblings, 0 replies; 9+ messages in thread
From: LiteStar numnums @ 2009-08-19  2:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]

What, no HQ9+?

H

Having "Hello, world!" as a semantic & syntactic element in the language
serves as the ridiculous part...

On Tue, Aug 18, 2009 at 8:25 PM, Abhishek Kulkarni <abbyzcool@gmail.com>wrote:

>
>
> On Tue, Aug 18, 2009 at 11:26 AM, ron minnich <rminnich@gmail.com> wrote:
>
>> See this: http://www.wxwidgets.org/docs/tutorials/hworld2.txt
>>
>> Well, they just seem to keep getting longer.
>>
>> Your goal: hello, world in one line. Language of your choice. Linking
>> in a 512 MB library is a violation of the spirit of this contest.
>>
>> Additional rules:
>> - line length is not defined but let's be reasonable
>> - if you can fit it in a standard Hollerith card format (72 chars plus
>> 8 chars of comment) that's a plus
>>
>> Redirection of stdout is allowed.
>>
>> ron
>> ron
>>
>>
> and if you want something more cryptic (which was a whole lot fun to do):
>
> _prog_:= prog() {_prog_:="";len _prog_;};prog_:=prog(_prog:prog()) of
> prog(){print_:=print(_prog);_print_:=(len
> print_-184)/17;print(print_[2*_print_+17],print_[7*_print_+63],print_[11*_print_+114],print_[11*_print_+114],print_[4],print_[6]);begin
> prog(_char:char){print(_char);}(119);print(print_[4],print_[3],print_[11*_print_+114],print_[4*_print_+40]);become
> _prog;}(_prog_);
>
>
>


--
And in the "Only Prolog programmers will find this funny" department:

Q: How many Prolog programmers does it take to change a lightbulb?

A: No.
 -- Ovid

   "By cosmic rule, as day yields night, so winter summer, war peace, plenty
famine. All things change. Air penetrates the lump of myrrh, until the
joining bodies die and rise again in smoke called incense."

   "Men do not know how that which is drawn in different directions
harmonises with itself. The harmonious structure of the world depends upon
opposite tension like that of the bow and the lyre."

   "This universe, which is the same for all, has not been made by any god
or man, but it always has been, is, and will be an ever-living fire,
kindling itself by regular measures and going out by regular measures"
-- Heraclitus

[-- Attachment #2: Type: text/html, Size: 2959 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-18 18:53   ` andrey mirtchovski
  2009-08-18 23:18     ` James Tomaschke
@ 2009-08-19 10:32     ` Uriel
  2009-08-19 13:52       ` andrey mirtchovski
  1 sibling, 1 reply; 9+ messages in thread
From: Uriel @ 2009-08-19 10:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, Aug 18, 2009 at 8:53 PM, andrey
mirtchovski<mirtchovski@gmail.com> wrote:
> also, i discovered something new today:
>
> "... decided to link everything dynamically. To enforce this (allmost)
> all static libraries are removed (or not even build)..."
>
> $ gcc t.c -static
> /usr/bin/ld: cannot find -lc
> collect2: ld returned 1 exit status


What the Fuck?!?! What kind of lunix did that?

uriel



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] The first annual "Hello, World" challenge
  2009-08-19 10:32     ` Uriel
@ 2009-08-19 13:52       ` andrey mirtchovski
  0 siblings, 0 replies; 9+ messages in thread
From: andrey mirtchovski @ 2009-08-19 13:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> What the Fuck?!?! What kind of lunix did that?

Fedora 11



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-19 13:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-18 17:26 [9fans] The first annual "Hello, World" challenge ron minnich
2009-08-18 17:53 ` John Floren
2009-08-18 18:53   ` andrey mirtchovski
2009-08-18 23:18     ` James Tomaschke
2009-08-19 10:32     ` Uriel
2009-08-19 13:52       ` andrey mirtchovski
2009-08-18 17:54 ` erik quanstrom
2009-08-19  0:25 ` Abhishek Kulkarni
2009-08-19  2:06   ` LiteStar numnums

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).