作者Schelfaniel (Schelfaniel)
看板PLT
標題[閒聊] 以下六個分別是什咩語言?
時間Thu Jul 2 09:26:09 2009
取自 PragProg Magazine 2009 7 月號
以下六個分別是什麼語言呢?
1.
Process Class Creator;
Begin
While true do begin
Activate New Consumer(Time);
Hold(Uniform(5, 15, 1));
End While;
End of Creator;
2.
<Any T, Any U> T first((T,U) tuple) {
(T t, U u) = tuple;
return t;
}
3.
PROC null.farm(CHAN OF ADDR.TASK.STREAM from.farm,
CHAN OF ADDR.RESULT.STREAM to.farm )
PAR
from.farm ? CASE no.more.task.packets
to.farm ! no.more.result.packets
:
4.
LET start() = VALOF
$( FOR i = 1 TO 5 DO writef("%n! = %i4*n", i, fact(i))
RESULTIS 0
$)
AND fact(n) = n=0 -> 1, n*fact(n-1)
5.
PROCEDURE speak*( VAR bird : Birds.Bird );
BEGIN
WITH bird : Cuckoos.Cuckoo DO
bird.sound := "Cuckoo!";
| bird : Ducks.Duck DO
bird.sound := "Quack!";
ELSE bird.sound := "Tweet!";
END;
END setSound;
6.
HAI
CAN HAS STDIO?
IM IN YR LOOP UPPIN YR NUM TIL BOTHSAEM NUM AN 10
VISIBLE SUM OF NUM AN 1
IM OUTTA YR LOOP
KTHXBYE
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.29.29.137
1F:推 PsMonkey:[亂入] 沒有 Java...... XDXD 07/02 09:42
2F:推 godfat:我只覺得 2 有點眼熟,其他都完全不認得 @@ 07/02 09:48
3F:→ Schelfaniel:答案它下一個月才會公佈,據說把這六個答案出來之後 07/02 09:57
4F:→ Schelfaniel:名稱連起來還會再得到第七個語言 07/02 09:57
5F:→ Schelfaniel:2 有點像 Scala 但不太對的是沒 def val var 等字 07/02 09:59
6F:推 PsMonkey:第一個很像 Pascal.... @_@ 07/02 10:49
7F:→ noctem:Pascal 應該不是用 "End While". 07/02 11:23
8F:推 legendmtg:5像Ada可是應該又不是XD 07/02 12:45