Inside LLEval

by @dankogai

Inside LLEval

by @dankogai

use LLEval;

by @dankogai

For Inside LLEval, see

http://www.dan.co.jp/~dankogai/shibuya-pm-11/lleval.html

プログラムをしよう。

Allow me to write you a code.

あれは36万…いや1万4000行前だったか

It took place 360,000…no 14,000 lines ago.

まあいい。

But what is a language anyway?

私にとってはつい昨日の出来心だったが…

To me it seems like yesterday.

君たちにとっては多分…あさっての出来事だ

For you, it might be the day after tomorrow.

彼には23通りの言語があるから

Known by 23 different languages.

なんと呼べばいいのか…

I'm not sure which to call him by…

たしか最初にやった時には…

When I first hack him…

LLEval

よしわかった。説明しよう。

Alright, pay attention now.

これは、iPadだ。

This is an iPad.

Jobsが創り出した知恵の一つ。いや、武器か。

It's one of Steve Job's Wisdom - a weapon
that transcends the scope of human technology…

昔HTML5で起きた大きな抗争の時にな。
あのときは、本当、まいったよ。

…granted to us during the time of the Great Rebellion
in HTML5. What a nightmare that was.

さ、まずは広げてみるか。

Let's open her up.

フ。見ての通り、
Perlすらない、美しいフォルムだろ。

She's a work of art Not a perl on her!

Perlすらない!?

Jobs:Stay Foolish

Stay Foolish = No language except for
Objective-C and JavaScript

そんな言語で大丈夫か?

You sure that's enough language?

大丈夫だ、問題ない

No problem. Everything's fine.

RMS in perl 5

sub rms
{
        my $r = 0;
        $r += $_**2 for @_;
        return sqrt( $r/@_ );
}
 
my @ints = (1..10);
print rms(@ints), "\n";

http://j.mp/lleval

神は言っている。ここで死ぬ運命ではないと。

This is not your appointed time to die.

死ぬのは一秒後death!

One second later, that is.

1 while 1

そんな言語で大丈夫か?

You sure that's enough language?

一番いいのを頼む

I'll take the best you have.

RMS in perl 6

sub rms(*@nums) {
    sqrt( ([+] @nums X** 2) / +@nums );
}

say rms(1..10);

一番時間がかかるので、4秒ルール

Takes the longest time so Perl 6 has 4 seconds.

赤ちゃん語は長い

Baby talks take longer.

神は言っている。全てを実行せよと

The lord commands you to save languages.

そんな言語で大丈夫か?

You sure that's enough language?

一番純粋なのを頼む

I'll take the purest you have.

RMS in Haskell

import Data.List (genericLength)
import Control.Monad (zipWithM_)
 
mean :: Double -> [Double] -> Double
mean 0 xs =
  product xs ** (1 / genericLength xs)
mean p xs = 
  (1 / genericLength xs 
    * sum (map (** p) xs)) ** (1/p)
main = print $ mean 2 [1 .. 10]

そんな言語で大丈夫か?

You sure that's enough language?

一番ありふれたのを頼む

I'll take the most available you have.

RMS in JavaScript

function root_mean_square(ary) {
    var sum_of_squares = ary.reduce(
        function(s,x) {return (s + x*x)}, 0
    );
    return Math.sqrt(
        sum_of_squares / ary.length
    );
}
 
print( root_mean_square(
    [1,2,3,4,5,6,7,8,9,10]
) );

ああ、今回もだめだったよ

Not again…

そんな言語で大丈夫か?

You sure that's enough language?

一番反対なのを頼む

I'll take the most reverse you have.

RMS in PostScript

/findrms{
/x exch def
/sum 0 def
/i 0 def
x length 0 eq{}
{
x length{
/sum x i get 2 exp sum add def
/i i 1 add def
}repeat
/sum sum x length div sqrt def
}ifelse
sum ==
}def
 
[1 2 3 4 5 6 7 8 9 10] findrms

そんな言語で大丈夫か?

You sure that's enough language?

一つしかやり方がないのをを頼む

I'll take the only way you have.

RMS in Python

from __future__ import division
from math import sqrt
def qmean(num):
  return sqrt(
    sum(n*n for n in num)/len(num)
  )
numbers = range(1,11) # 1..10
print qmean(numbers)

君たちにとっては多分…明日の出来事だ

For pythonistas, it might be tomorrow.

ところでMathematicaドコー

BTW. Where's Mathematica?.

そんな文字コードで大丈夫か?

You sure that's enough characters?

大丈夫だ、問題ない

No problem. Everything's fine.

Hello world in BF

++++++++++[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.<<+++++++++++++++.
>.+++.------.--------.>+.>.

そんな文字コードで大丈夫か?

You sure that's enough characters?

一番少ないのをのを頼む

I'll take the fewest you have.

Hi in iota

**i*i*ii***i*i*i*ii***i*i*i*ii*ii**i*i*i
i***i*i*i*ii**i*i*ii****i*i*i*ii*ii*ii**
*i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*
i*ii*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*
i*i*ii*i*i*ii***i*i*i*ii***i*i*i*ii**i*i
*ii*i*i*i*ii*i*i*ii****i*i*i*ii***i*i*i*
ii*ii*ii*ii***i*i*i*ii***i*i*i*ii**i*i*i
i*i*i*i*ii*i*i*ii*ii**i*i*ii***i*i*i*ii*
**i*i*i*ii*ii**i*i*ii***i*i*i*ii***i*i*i
*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii**
i*i*ii****i*i*i*ii*ii*ii***i*i*i*ii***i*
i*i*ii**i*i*ii*i*i*i*ii*i*i*ii*ii***i*i*
i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii*
***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*
i*i*ii*ii***i*i*i*ii***i*i*i*ii**i*i*ii*
i*i*i*ii*i*i*ii****i*i*i*ii*ii*ii***i*i*
i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii*
ii**i*i*ii***i*i*i*ii***i*i*i*ii*ii**i*i
*ii***i*i*i*ii**i*i*ii***i*i*i*ii***i*i*
i*ii**i*i*ii*i*i*i*ii*i*i*ii*ii***i*i*i*
ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***
*i*i*i*ii*ii*ii***i*i*i*ii***i*i*i*ii**i
*i*ii*i*i*i*ii*i*i*ii*ii**i*i*ii**i*i*ii
****i*i*i*ii*ii*ii****i*i*i*ii*ii*ii***i
*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*
ii*ii

あいつもよく実行してくれているよ

So far, so good.

いや、君の頼みは断れないよ

You know I could never say no to you.

だが断る

maybe not.

fork while 1

鯖は絶対だからね

After all - you are the Lord…

人が持つ唯一絶対の力。
それは自らの意志で使うべき
言語を選択することだ。

Humans have a unique gift. The power of choice

そうだな、次はこれを見ている奴にも
つきあってもらうよ

Well. next time we'll have to get help…

MA6

おまけ:

そんな景品で大丈夫か?

You sure that's enough prize?

おまけ:

一番いいのを頼む

I'll take the best you have.

To be continued…

.answer for @questions;