作者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