◙ /prog/ Challenge [Vol. λfx.f (f x)] ◙
1
Name:
Anonymous
2011-03-27 4:19
THE CHALLENGE : Write a program that outputs the name of the programming language it is executed/compiled in.
HOWEVER : You program must be a polyglot in as much languages as possible: for example, when run as a C program it prints "C", as a Python script it prints "Python", etc.
The deadline is 04/04/2011 00:00 UTC. The winner is the program valid in the most programming languages .
(When programs tie, their lengths in bytes decide who wins.)
2
Name:
Anonymous
2011-03-27 4:22
(To get you started, here's an example Python/Ruby program.)
"#{puts 'Ruby';exit}"; print 'Python'
3
Name:
Anonymous
2011-03-27 4:47
main = putStrLn "Haskell"
4
Name:
Anonymous
2011-03-27 4:51
'lisp
5
Name:
Anonymous
2011-03-27 4:56
This depends on how different the comment (and compile-time conditional expression) syntax of various languages is.
6
Name:
Anonymous
2011-03-27 4:59
#define trash..........v
// v"befunge"<
// v:,_@
// > ^
int main()
{
puts("SEE");
return 0;
}
7
Name:
Anonymous
2011-03-27 5:01
Missed a space.
8
Name:
Anonymous
2011-03-27 5:35
#<html> <p> HTML</p> </html>
<!-- print 'python' -->
9
Name:
Anonymous
2011-03-27 8:13
++++++++++[>+++++++>+++++++++++>++++++++++>+<<<<-]>----.>++++.>---.++++++++.+++++.--------.<+++.>---.++++++++.>.
10
Name:
ed
2011-03-27 9:18
>>8
Allow me to expand on your solution. Corrected the bugs and now works in
THREE LANGUAGES.
#<html><?php die('PHP'); ?>HTML</html>
#<!--;
print 'python'
#--!>
11
Name:
Anonymous
2011-03-27 9:50
programming language
HTML
user your brain, not your ANUS
12
Name:
Anonymous
2011-03-27 11:59
HTM L
MARKUP
NOT PROGRAMMING
Well, at least we have
>>10
13
Name:
Anonymous
2011-03-27 12:07
>>10
Make it start with
#.(progn (print 'lisp) (loop))
and you have Common Lisp working too. Define some reader macros if you have #< to work too (just have it eat all input) without causing an error (the loop is there to avoid that piece of code being compiled, assuming you're running in an interpreter).
14
Name:
Anonymous
2011-03-27 12:09
There's no need to do anything for Perl, as everything is VALID PERL CODE .
15
Name:
Anonymous
2011-03-27 14:04
>>4
Valid Lisp, Scheme, Racket, Arc, Croma Lisp, MacLisp and Clojure code.
16
Name:
Anonymous
2011-03-27 17:00
>>15
You forgot to list every source revision in each of those branches.
17
Name:
Anonymous
2011-03-28 2:42
BAMPV
18
Name:
Anonymous
2011-03-28 5:09
; x() {-0;} main(){ puts("C"); } /*
; -} =0;main = putStrLn "Haskell" {-
(println "Clojure")
; -} -- */
19
Name:
Anonymous
2011-03-28 5:47
21
Name:
Anonymous
2011-03-28 7:12
// #|[
#include <stdio.h>
#define heha() int main(int argc,char **argv) { puts("C++"); } /*
def heha
puts 'RUBY'
end
#]++++++++[->++++++++<]>+[->+>+<<]>+.++++++++++++++++.>.++++++++.+++++.--------.<+++.>---.++++++++.[-][ */
heha()
//#]|#(print 'LISP)
22
Name:
Anonymous
2011-03-28 7:51
23
Name:
Anonymous
2011-03-28 7:56
>>12
HTML stands for Hypertext
ML .
24
Name:
Anonymous
2011-03-28 8:35
OCAML ISN'T A PROGRAMMING LANGUAGE
25
Name:
Anonymous
2011-03-28 12:26
26
Name:
Anonymous
2011-03-28 20:54
#define bf ">++++++++[<++++++++>-]<++.>+++++++[<+++++++>-]<-.>++++[<---->-]<-.>+++[<+++>-]<-.>++[<++>-]<+.>+++[<--->-]<+.>++++[<++++>-]<-.>++++[<---->-]<--.>+++[<+++>-]<->"
#include <stdio.h>
#ifdef notdefined
'''
#endif
int main(){
printf("C");
#ifdef __cplusplus
printf("++");
#endif
return 0;
}
#ifdef notdefined
'''
print("Python")
#endif
27
Name:
Anonymous
2011-03-28 20:55
>>26
#if 0
[expert]OMG OPTIMIBRIZRIVED[/sppert]
28
Name:
1
2011-03-29 8:00
Great submissions so far! Let's tally up the scores so far.
>>21 :
4 (C++, Ruby, Brainfuck, Lisp)
>>26 :
4 (Brainfuck, C, C++, Python)
>>18 :
3 (C, Haskell, Clojure)
>>6 :
2 (C, Befunge)
>>10 :
2 (PHP, Python)
>>3 :
1 (Haskell)
Some others were
disqualified :
'lisp relies on the REPL, and is not a full program. HTML isn't a programming language, you dolts.
Oh, and a hint: you can easily embed Befunge code into any polyglot. See
>>6 .
29
Name:
Anonymous
2011-03-29 8:14
30
Name:
Anonymous
2011-03-29 8:30
>>28
What
is a full Lisp program? Almost everyone uses stuff from the REPL. Very few Lisp programs actually run by a default
main function, and it's actually non-standard functionality to provide such a thing (even though all real implementations do).
31
Name:
Anonymous
2011-03-29 9:07
>>28
well if it is not cheating
#ifdef v
''' >"egnufeB":v
[v:,_@]
> ^
'''
#endif
#define bf ">++++++++[<++++++++>-]<++.>+++++++[<+++++++>-]<-.>++++[<---->-]<-.>+++[<+++>-]<-.>++[<++>-]<+.>+++[<--->-]<+.>++++[<++++>-]<-.>++++[<---->-]<--.>+++[<+++>-]<->"
#include <stdio.h>
#ifdef notdefined
'''
#endif
int main(){
printf("C");
#ifdef __cplusplus
printf("++");
#endif
return 0;
}
#ifdef notdefined
'''
print("Python")
#endif
32
Name:
Anonymous
2011-03-29 9:36
>>31
actually let's combine bf and defunge together for further lulz
#ifdef v
'''>+++>"egnufeB":v<++++
+[<++++++++>-][v:,_@]<++
.>+++++++[<++++> ^<+++>
-]<-.>++++[<---->-]<-.>+
++[<+++>-]<-.>++[<++>-]<
+.>+++[<--->-]<+.>++++[<
++++>-]<-.>++++[<---->-]
<--.>+++[<+++>-]<->'''
#endif
#include <stdio.h>
#if 0
'''
#endif
int main(){
printf("C");
#ifdef __cplusplus
printf("++");
#endif
return 0;
}
#if 0
'''
print("Python")
#endif
33
Name:
Anonymous
2011-03-29 9:46
>>32
You can also add ruby by using
>>2
"#{puts 'Ruby';exit}"; print 'Python'
34
Name:
Anonymous
2011-03-29 11:57
>>32
Easy with the lulz there, progrider.
35
Name:
Anonymous
2011-03-29 13:24
>>34
Why, do you think lulz isn't a cromulent word to use on this board, faggot?
36
Name:
Anonymous
2011-03-29 13:33
>>35
Cromulent considered not cromulent.
37
Name:
Anonymous
2011-03-29 13:42
Xarn uses Cromulent Linux.
38
Name:
Anonymous
2011-03-29 13:51
39
Name:
Anonymous
2011-03-29 15:10
>>37
Xarn despises "the simpsons" and all other plebeian comedy.
40
Name:
Anonymous
2011-03-29 15:33
Newer Posts