Showing posts with label fun. Show all posts
Showing posts with label fun. Show all posts

2011-01-05

Announcement from the Unix kitchen staff

A restaurant called fork() has recently been opened in our office building. The name was suggested and chosen by engineers. I imagine what kind of e-mail announcements they would be sending if the kitchen was run by Unix engineers.

fork() will be close()d this week, but it will not be shutdown(), we'll open() it again, but you have to wait() a couple of days. In the meantime, our hard-working and prof()essional kitchen staff is not idle(): they are learning new Asian recipes. Please read() the signs before coming to check if fork() is open(). We hope you'll have a great time() eating Peking duck, a broad select()ion of sandwiches, and ricEAGAIN with nice(), un-break()able chopsticks, 5 times() a week. We have installed a new smoke extinguisher, which is splice()d to the oven, so it won't signal() the fire alarm() anymore unnecessarily. If you have feedback, please write() to us. Or fill our poll() from (see the new link() on the home page) to help us keep in sync() with the employees' taste. Your creat()ive ideas are also welcome to improve the furniture decoration – it can also be a clone() of a restaurant in popular culture, with some geek flavor added. Please note you don't have access() to the building from the exit() on the 3rd floor, so enter at the reception, but lock() your bike first outside, to one of the pipe()s. There is no need to pause() in break() 3 for coffee, there is a grinder in fork() now.

**environ-mentalist disclaimer: No silkworms were kill()ed for the outfit of our cooks.

2010-10-29

Multilingual programs in Haskell, Prolog, Perl and Python

This blog posts shows program source codes that work in multiple languages (including Haskell, Prolog, Perl, Perl and Python).

Here is a program which works in Haskell, Prolog and Perl:

$ cat >m1.prg <<'END'
foo( {-1/*_} ) if!'*/%'; print "Hello, Perl!\n" if<<'-- */'
}). :- write('Hello, Prolog!'), nl, halt.
/* -} x) = x
main = putStrLn "Hello, Haskell!"
-- */
END
$ perl m1.prg
Hello, Perl!
$ swipl -f m1.prg
Hello, Prolog!
$ cp m1.prg m1.hs
$ ghc m1.hs -o m1
$ ./m1
Hello, Haskell!

Here is a program which works in Haskell, Prolog and Python:

$ cat >m2.prg <<'END'
len( {-1%2:3} ); print "Hello, Python!"; """
}). :- write('Hello, Prolog!'), nl, halt.
/* -} x) = x
main = putStrLn "Hello, Haskell!"
-- """ # */
END
$ python m2.prg
Hello, Python!
$ swipl -f m2.prg
Hello, Prolog!
$ cp m2.prg m2.hs
$ ghc m2.hs -o m2
$ ./m2
Hello, Haskell!

It's possible to have polyglots of 8, 10 and even 22 programming languages, see them here.

2009-12-15

Sex, Unix style

My instruction sequence compilation of the traditional Unix sex theme:

date; touch; kiss; grep; strip; unzip; finger; mount; fsck; more; yes; uptime; gasp; umount; sleep