C vs Perl

2389
points
points
Original Fox Trot Comic using C code.

Standard Perl Statement

Perl one-liner

http://perl.hacker.freeservers.com/
* 언어 논쟁이야기가 절대~!!! 아님니다. 그냥 웃자고요 ^^
»
- idlock의 블로그
- 인쇄에 적합한 버전
- Login or register to post comments
- 15395번 읽힘

points
:D 만화 내용을 이해 못했었는데 짜여진 코드를 보고 이해를 했습니다.
:D 만화 내용을 이해 못했었는데 짜여진 코드를 보고 이해를 했습니다. :)
반성문을 저런식으로 처리해버리니... 대단한 유머감각이 아닐 수 없겠네요...
그나저나 저정도 어린아이가 저렇게 어려운(?) 코드를 작성한다는 것 자체가 두려울
따름입니다. 아~~~ 내자리가 위태로워보이는군요... :oops:
P.S. : 언어논쟁은 저도 싫어합니다. 웃을 수 있는 그림을 올려주셔서 고맙네요...
points
ㅋㅋㅋ애교 * 500 ^^ <어떠한 역경에도 굴하지
ㅋㅋㅋ
애교 * 500 ^^
<어떠한 역경에도 굴하지 않는 '하양 지훈'>
첫번째 C 코드에는 \n 이 빠져있네요.실행해 보면 버그를 발견하려나
첫번째 C 코드에는 \n 이 빠져있네요.
실행해 보면 버그를 발견하려나.. :)
points
개행문자는 없어도 되지않나요?>
K.J.Lee
points
멋지군요....
print "good job -_-)=b \n"x500;
points
[b]#!/usr/bin/perl [/b]이 빠진거 아닌가요?(절
#!/usr/bin/perl 이 빠진거 아닌가요?
(절대 꼬투리 잡는거 아닙니다.
혹시 제가 모르는 #!/usr/bin/perl 을 안쓰고 사용할 수 있는 방법이 있나 해서요?)
points
[quote="santana"][b]#!/usr/bin/perl [/b]
뭐 잘 아시겠지만...
혹시나 해서 적습니다.
$ perl test.perl
<어떠한 역경에도 굴하지 않는 '하양 지훈'>
points
using python
Using Java
public class Main { public static void main(String[] args) { for ( int i = 0; i<500; i++) System.out.println("I will not throw paper airplanes in class"); } }Standard Python Statement
Python one-liner
print "I will not throw paper airplanes in class\n" * 500points
지금 보니...
수많은 소스들에서 마침표 '.'가 빠져 있네요~
points
[b]Using Tcl[/b][code:1]for{set i
Using Tcl
for{set i 0}{$i < 500}{incr i} { puts "I will not throw paper airplanes in class\n" }points
[quote="santana"][b]#!/usr/bin/perl [/b]
oneliner 이니까 전체 구문을 다 살리면.... 이렇게 했겠지요.
perl -e 'print "...snip..."x500';
points
혹시나 했는데 역시나.. 언어별로 하나둘 올라오기 시작하는 군요
혹시나 했는데 역시나..
언어별로 하나둘 올라오기 시작하는 군요 ^^;
points
저도 이걸 노렸죠 -.-
저도 이렇게 리플리 달리길 바랫답니다. -.-..
[이럼 않올라올라나 :twisted: ]
누가 C++ 버전 리플을 달았네요. -.- 대단하다..
#include <iostream> struct C { C() { std::cout << "I will not throw paper airplanes in class\n"; } } c[500]; int main() { return 0; }points
ruby[code:1]500.times { pu
ruby
500.times { puts "I will not throw paper airplanes in class\n" }points
아.. 저 그림에 나오는 꼬마,,과연 몇살일까나..난 저나이때 믈
아.. 저 그림에 나오는 꼬마,,
과연 몇살일까나..
난 저나이때 믈 했는지..
부러버,, 우엉~
points
흔히 perl 을 말할 때[quote]TMTOWTDI, or `the
흔히 perl 을 말할 때
이라고 하는데, 가끔은 이런 생각이 들 때도 있습니다.
아. 물론 CIALAMAYW 이건 없는 말이지만요. :)
points
SH Script
SH Script
for i in `seq 500`; do echo "I will not throw paper airplanes in class"; donepoints
php[code:1]$ php -r 'while ($i++
php
$ php -r 'while ($i++ <= 500) echo "I will not throw paper airplanes in class\n";'points
[quote="seearomi"]첫번째 C 코드에는 \n 이 빠져있네요.
개행문자 패치
--- for_3.c.orig Fri Dec 5 15:20:06 2003 +++ for_3.c Fri Dec 5 15:23:12 2003 @@ -5,7 +5,7 @@ int count; for(count=1;count<=500;count++) - printf("I will not..."); + printf("I will not...\n"); return 0; }썰렁~
points
확장자를 pl로 하셨다면..
echo ":PERL:E::pl::/usr/bin/perl:" > /proc/sys/fs/binfmt_misc/register하심 되겠죠.. 물론mount -t binfmt_misc none /proc/sys/fs/binfmt_misc해 주시고..points
php 두번째-_-[code:1]#!/usr/local/php
php 두번째-_-
#!/usr/local/php/bin/php -q <? echo str_repeat("I will not throw paper airplanes in class\n",500); ?>points
[code:1]$ yes "I will not throw p
이건 좀 너무하죠...
points
ㅋㅋㅋ
CTRL + C 만 잘누르면..
points
[quote="yamainu"][code:1]$ yes "I
이렇게 고치면 되죠. :)
yes "I will not throw paper airplanes in class" | head -500points
[quote="yamainu"][code:1]$ yes "I
yOU wIN!
-_-;;;;;;;
points
[quote="cdpark"][quote="yamainu"][code:1
머찌다는 말 이외에 더 좋은 말이 안떠오르네요.. -_-
points
[quote="yamainu"][code:1]$ yes "I
ㅋㅋㅋ
반항한다구 선생님한테 맞을거에요
points
[quote="yamainu"][code:1]$ yes "I
아... yes는 이렇게 쓰는 거군요. 오늘 첨 알았다는.. -_-;;
points
yes............ 무섭군요......직접 해보고 나서야 이
yes............ 무섭군요......
직접 해보고 나서야 이해했다는......;;
암생각없이 yes 만 달랑 쳤더니만 =_=;;;;;;
points
[quote="cdpark"][quote="yamainu"][code:1
역시 hacker 레벨이 되면 이런 멋진 코드가 나오는 군요.
나를 감동시킨 코드에 등록하겠습니다. ^^
저는 실은 크론에다 echo걸어놓고 500일 기다릴라구 했습니다만, 그랬다간 선생님한테 혼나겠군요. 다른 이유로 .... ^^
(하긴 꼭 하루에 한번 돌게 하지 않아도 되겠습니다만 ^^)
points
[quote="h2h1995"][b]Using Tcl[/b][code
뒤의 \n 은 빼야하지 않을까요? ^^
points
패치 만드신 분, 원츄 -_-)b정말 웃겼습니다.이 쓰레드
패치 만드신 분, 원츄 -_-)b
정말 웃겼습니다.
이 쓰레드는 KLDP 명예의 전당 같은 곳에 올려야 하지 않을까 생각되네요 ㅋㅋ
points
반성문이니까.. 콘솔보다는.. 웹 페이지에 띠우는게 보기 좋을 듯 싶네요
반성문이니까.. 콘솔보다는.. 웹 페이지에 띠우는게 보기 좋을 듯 싶네요.. ^^
CGI
#include <stdio.h> int main() { int i; printf("Content-Type: text/html\r\n\r\n"); for (i = 0; i < 500; i++) printf("I will not throw paper airplanes in class<BR>"); return 0; }points
JavaScript:[code:1]<SCRIPT type=&qu
JavaScript:
<SCRIPT type="text/javascript" language="JavaScript"> <!-- for (var i=0; i < 500; i++) alert("I will not throw paper airplanes in class."); //--> </SCRIPT>이렇게 하면 엔터를 500번 눌러야 하므로
반성문 검사 하시는 분을 골탕먹이는 게 될 수도 있겠네요.
전혀 반성하는 자의 자세라고 볼 수 없는...
points
그냥 재미로..Makefile and echo:[code:1]al
그냥 재미로..
Makefile and echo:
all: @echo "I will not throw paper airplanes in class." 1>&2 @if test $$MAKELEVEL -lt 500; then make 1>/dev/null; fiMakefile인관계로 두번째 세번째 줄은 맨 앞이 tab이어야..
points
[quote="nohmad"]JavaScript:[code:1]<
<script> for(var i=0; i<500; i++) document.write("I will not throw paper airplanes in class.\n"); </script>이렇게 하면 안 혼나려나?
points
이 thread를 명예의 전당에!
:shock:
올려 보존하심이 좋을 줄로 아뢰오.
points
으음... 안 올라온 것을 하려고 하니... 윈도밖에 할게 없는듯..
앞뒤에 @echo 를 안 넣는 방법은 없을지... :twisted:
points
[code:1]500iI will not throw paper airpl
:evil:
points
굳이 윈도라고 한다면...
#include <windows.h> int main( void ) { int i ; for ( i = 0 ; i < 500 ; i ++ ) MessageBox( 0, "I will not throw paper airplanes in class", "", MB_OK ) ; return 0 ; }이정도면 선생님이 용서해주실지도 모르겠는데...
#include <windows.h> #include <processs.h> void thread_proc( void *ptr ) { MessageBox( 0, "I will not throw paper airplanes in class", "", MB_OK ) ; } int main( void ) { int i ; for ( i = 0 ; i < 500 ; i ++ ) _beignthread( thread_proc, 0, 0 ) ; return 0 ; }컴파일 될라나... -.-;;
[/code]
points
다른건 예상을 했는데..yes 를 이용한건 전혀 예상못했습니다
다른건 예상을 했는데..
yes 를 이용한건 전혀 예상못했습니다 :o
정말 멋지고, 강력합니다
points
Re: 으음... 안 올라온 것을 하려고 하니... 윈도밖에 할게 없는
@for /l %i in (1,1,500) do @echo I will not throw paper airplanes in classXP에서 테스트 했습니다. 그 이전버전은 어떻게 될지 모르겠네요. :)
points
아시는 분은, 아래 언어 버전을 만들어 보심이..(n)ML, Ha
아시는 분은, 아래 언어 버전을 만들어 보심이..
(n)ML, Haskel, c#, FORTRAN, COBOL,
LISP, Prolog, Pascal, Smalltalk, Scheme ...
points
fortran90 버전;;히힛~ :D [code:1]pr
fortran90 버전;;
히힛~ :D
points
어셈
str db "I will not throw paper airplanes in class",0ah, 0ch, 0
les esi, str
mov al, 02h
mov ecx, sizeof str
LABEL
push eax
mov dl, [esi]
int 21h
pop eax
loop LABEL
아.. 역시 어셈은 아무리 해도 폼이 안나요... cry
도스 인터럽트를 썼다고 뭐라하기 없기에요~ oops
points
nasm 버전
str db "I will not throw paper airplanes in class",0ah, 0ch, 0
les esi, str
mov ecx, 500
LABEL
push esi
call printf
pop eax
loop LABEL
리눅스 시스템 콜을 써보니까 좀더 간단해 지네요..
points
commonlisp...
points
기억 나는대로..
10분 공부한 ALGOL
BEGIN INTEGER i; FILE F (KIND=REMOTE); EBCDIC ARRAY E [0:41]; REPLACE E BY "I will not throw paper airplanes in class"; FOR i:=1 STEP 1 UNTIL 500 DO BEGIN WHILE TRUE DO BEGIN WRITE (F, *, E); END; END; END.BASIC
Clipper(DBASE 류)
points
윈도우를 쓰시는 선생님을 위해
메모장에 띄우기...
WSH Version
Set WshShell=WScript.CreateObject("Wscript.Shell") WshShell.Run "notepad" WScript.sleep 500 For i=0 To 499 WshShell.SendKeys "I will not throw paper airplanes in class" WScript.sleep 20 WshShell.SendKeys "{Enter}" WScript.sleep 20 Next WScript.sleep 3000 WshShell.SendKeys "%{F4}" WScript.sleep 100 WshShell.SendKeys "N" WScript.sleep 100 Set WshShell = Nothingpoints
Pascal 버전
Pascal:
하도 오래되서 맞는지 모르겟지만 -.-
Unit PrintBlackborad; var I:Integer; begin for I := 1 to 500 do writeln("I will not throw paper airplanes in class"); end.points
Cobol[code:1]PERFORM VARYING II FROM
Cobol
없길래.. :)
points
-_-;;
$ wget -qO - "http://some.host.org/tmp/test.php"
points
C++에서 template metaprogramming 사용하는 버전
일반적인 C++ 소스는 앞에 나와 있어서,
저는 템플릿 메타프로그래밍을 사용하는 버전을 만들었습니다.
쓸데 없이(?) 복잡하지만, 이런 것도 가능하다는 것도 알아두시길... 8)
#include <iostream> template<int i> struct loop{ static void body(){ loop<i-1>::body(); loop<0>::body(); } }; struct loop<0>{ static void body(){ std::cout << "I will not throw paper airplanes in class\n"; } }; int main() { loop<500>::body(); return 0; }loop<499>가 맞을 것 같군요.
loop<1>이 2번 출력하기 때문에...
points
[b]Clean[/b] 간단히 Start함수식의 평가를 이용해서[
Clean
간단히 Start함수식의 평가를 이용해서
Start :: {#Char} Start = abort (fun 1) // 인용부호의 출력을 막기위해 abort ^^; where fun :: Int -> {#Char} fun n | n <= 500 = "I will not throw paper airplanes in class.\n" +++ fun (n+1) = ""Ada95
with Ada.Text_IO; use Ada.Text_IO; procedure Fun is begin for I in 1..500 loop Put_Line("I will not throw paper airplanes in class."); end loop; end Fun;points
내친 김에... C++ STL 버전
//--------------------------------------------------------------------------- #include <iostream> #include <string> #include <vector> #include <iterator> #include <algorithm> //--------------------------------------------------------------------------- using namespace std; int main() { vector<string> messages(500, "I will not throw paper airplanes in class."); copy(messages.begin(), messages.end(), ostream_iterator<string>(cout, "\n")); return 0; } //---------------------------------------------------------------------------metaprogramming 버전보다는 확실히 느리군요.
위의 메타프로그래밍을 사용한 버전은 스크롤 속도를 느낄 수 없을 정도로
순간적으로 표시됩니다.
points
emacs lisp[code:1](defun reflect
emacs lisp
(defun reflection () (let ((i 0)) (while (< i 500) (princ "I will not throw paper airplanes in class.\n") (setq i (1+ i))))) (reflection)실행은
emacs -batch -l 파일이름.el
또는
*scratch* buffer에서 (defun ...) 입력후 C-j, (reflection) 입력 후 C-j
points
Scheme (for guile)[code:1]#!/usr/bin
Scheme (for guile)
#!/usr/bin/guile !# (define reflection (lambda () (let ((i 0)) (while (< (i 500) (display "I will not throw paper airplanes in class.\n") (set! i (1+ i)))))) (reflection)points
nML버전
nML
points
반성문을 엄청 많이(한.. 수십억정도??) 적으라고 한다면 저는 asm
반성문을 엄청 많이(한.. 수십억정도??) 적으라고 한다면 저는 asm 버전으로 작성하겠습니다. 그래야 일찍 집에 갈것 아니겠어요? ^^;
points
이거 혹시...
이거 혹시...
여러가지 언어로 반성문 쓰는게 idlock님과 ktaekin님의 숙제 아니었을까요?
:lol:
points
[quote="최종호"][quote="h2h1995"][b]Using T
오메~.. 이런 실수가..
가끔 Tcl로 프로그래밍시.. C에서 하던 버릇댐시.. 넣곤합니다..
안넣어도 newline 자동으로 되는데.. ^^
points
Using Smalltalk
http://squeak.org/
Using Squeak (Smalltalk-80 implementation)
points
Using 국회의원
Using 국회의원
김비서 'I will not throw paper airplanes in class' 500줄 찍어오게.ps.
Using 일부 국회의원
김비서 청와대 가서 'I will not throw paper airplanes in class' 500줄 찍어오게. 안그럼 단식이야.points
악플러 or 도배맨:[code:1]I will not throw pa
악플러 or 도배맨:
I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class............ (중략) ............... I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class.points
[quote]★(광고)반성문을 무료로 써드립니다★반성문 쓰느라 많
points
또다른 Scheme 버전입니다. 재귀적으로 구현해야 아무래도 scheme
또다른 Scheme 버전입니다. 재귀적으로 구현해야 아무래도 scheme 분위기가... :)
(letrec ((reflection (lambda (msg n) (if (> n 0) (begin (display msg) (reflection msg (- n 1))))))) (reflection "I will not throw paper airplanes in class.\n" 500))points
Re: Pascal 버전
writeln('I will not throw paper airplanes in class');
가 되어야 하지 않을까요. 파스칼에서는 작은 따옴표로 스트링을 나타내는 것 같았던.... ;; ( 가물가물 )
points
전에 나온 C++ 버전들에게서 영감을 얻어 하나..[code:1]
전에 나온 C++ 버전들에게서 영감을 얻어 하나..
#include <iostream> int main() { return 0; } template<int i> struct C : C<i-1> { C() { std::cout << "I will not throw paper airplanes in class\n"; } }; template<> struct C<0> {}; C<500> c;points
awk
아직도 안나온거 같애서...
awk:
$ awk 'BEGIN { for( i=0; i<500; i++ ) print "I will not throw paper airplanes in class" }'points
pre-ansi c
pre-ansi C:
main(_) { _ <= 500 && printf("I will not throw paper airplanes in class\n", _ ) && main (_+1); }재미로....
points
Re: nML버전
ML코드를 보니 반갑네요...
예전에 시험문제에..
둘 사이의 차이점에 대해 쓰라던 기억이... ㅎㅎ
points
어디 까지 갈까요 ㅡㅡaI will not throw paper
어디 까지 갈까요 ㅡㅡa
I will not throw paper airplanes in class\n
블럭지정후 ctrl+c -> ctrl+v
다음은 선생이 되따거 할때까지? ㅡㅡa
리눅스는
블럭지정후 shift + insert ㅡㅡa
원츄~!
points
Re: Pascal 버전
맞네요 헉.. 그리고 Unit 이나고 program인데 -.-;.. 자꾸 보니깐 조금씩 생각이 나는군요.
program PrintBlackborad; var I:Integer; begin for I := 1 to 500 do writeln('I will not throw paper airplanes in class'); end.Re: Pascal 버전
pacal 정확하게는 Delphi에서 실행가능한 형태입니다.^^;
program Project1;{$APPTYPE CONSOLE}
var i : integer;
begin
for i := 1 to 500 do
writeln ('I will not throw paper airplanes in class')
end.
위에서 {$APPTYPE CONSOLE}을 빼시면 에러가 나죠 ^^;
points
KLDP 아이디가 없는 제 동생이 먼 땅에서 prolog 코드를 제보해주
KLDP 아이디가 없는 제 동생이 먼 땅에서 prolog 코드를 제보해주었습니다. :D
sorry :- sorry(500).
sorry(0).
sorry(N) :-
write('I will not throw paper airplanes in class'), nl,
N2 is N-1,
sorry(N2).
points
Haskell로는 대략 이렇게...sorry :: Int ->
Haskell로는 대략 이렇게...
sorry :: Int -> IO()
sorry count = if count >=0
then do putStrLn "I will not throw paper airplanes in class"
let count2 = count -1;
int do sorry count2
앗 indentation 문제는 그냥 넘어가주시길