Composition Calculus

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Compute the normal form of "Composition Calculus".

'.' is the composition function:

.
== (lambda (f) (lambda (g) (lambda (x) (f (g x))))) # Lisp
== function (f) { return function (g) { return function(x) { return f(g(x)); }; }; } # JS
== (.) # Haskell

Expression like "x y" is function application. It is left associative:

f g h
== ((f g) h)
== ((f g) h) # Lisp
== (f(g))(h) # JS
== ((f g) h) # Haskell

Example:

. x y z
-> (x (y z))

. . . x y z w
-> (. . . x) y z w
-> (. (. x)) y z w
-> (. (. x) y z) w
-> ((. x) (y z)) w
-> (. x (y z) w)
-> (x ((y z) w))

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

. 1 2 3
. . x y z w
. . . a b c d
. . . . 4 5 6 7 8
. . . . . 1 2 3 4
. . . . . . a b c d e
. . . . . . . s t u v w
. . . . . . . . 2 3 4 5 6
. . . . . . . . . 1 2 3 4 5 6
. . . . . . . . . . a b c d e
. . . . . . . . . . . h i j k l
. . . . . . . . . . . . 2 3 4 5 6
. . . . . . . . 1 . 2 3 4 5
. . . . . . . . . . . 4 2 3 8 1 9 7
. . . b t e s p r u
. . . . . . . . . . . . . . . . . . . . . . o 0 i b g r j
. . . . . . . . . . . . . . . . . . . . . . . . . . . 1 w 5 4 z o d g
. . . y 4 9 s e n
. . . . . . . . . . . . . . . . . . . . . . . . . . 0 7 n x l p y
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 j t 2 0 4 y h
. 3 p t 9 4 5 d i
. . . . . . . . . . . o s g 5 0 y j
. . . . . . . . . . . . . . k 7 n f p r 1
. . . . . . h q a l x 9 f y
. . . . . . . . . . . . . . . . . . 9 u p t o h e 2
. 4 o s z a y w
1 l 9 h e 6 j
. . . . . . . . . . . . . . . . . . . . . . b g s n w y 2 j
. . . . . . . . . . . . x b g h t u o
. . . . . . . . . s 0 y 3 f e
. . . . . y 0 v e 8 1 x m
. . . . . . . . . . . . . . . . . o c 9 t p e 7
i n f u 1 m 3 q
. . . . y v 0 b 3 e
. . . . . . . . . . . . . f 0 b 5 w d
. . . . . . . . . . . . . . . . . . . n k 4 u s 9 g
. . 1 d p j q m v
. . . . . . . . . v 0 b j 1 y
. . . . . . . . . . . . . . . a 7 0 w 6 j 5 q
. . . . . . . x 0 s j k 8 9
. . . . . . . . . . . . . . . . . . . . . . l j 6 k x 9 m z
. . . . . . . . . . . . . . v f w e o 5
. . . . . . . . . . . . . . . . . . . 1 l t p k g f

Sample output:

(1 (2 3))
((x y) (z w))
(a ((b c) d))
(((4 5) 6) (7 8))
(1 (2 (3 4)))
((a (b c)) (d e))
((s t) ((u v) w))
(2 (((3 4) 5) 6))
((((1 2) 3) 4) (5 6))
((a (b c)) (d e))
((h i) ((j k) l))
(2 (((3 4) 5) 6))
((1 (2 (3 4))) 5)
((((4 2) ((3 8) 1)) 9) 7)
((((b ((t e) s)) p) r) u)
((((o (0 i)) (b g)) r) j)
(((((1 w) ((5 4) z)) o) d) g)
(((y ((4 9) s)) e) n)
((((0 (7 n)) (x l)) p) y)
((((((6 j) t) 2) (0 4)) y) h)
((((((3 (p t)) 9) 4) 5) d) i)
((((o s) ((g 5) 0)) y) j)
((((k (7 n)) (f p)) r) 1)
(((((h (q a)) (l x)) 9) f) y)
(((((9 (u p)) (t o)) h) e) 2)
(((((4 (o s)) z) a) y) w)
((((((1 l) 9) h) e) 6) j)
(((((b (g s)) (n w)) y) 2) j)
(((x (((b g) h) t)) u) o)
((((s 0) y) 3) (f e))
(((((y (0 (v e))) 8) 1) x) m)
(((((o c) 9) t) (p e)) 7)
(((((((i n) f) u) 1) m) 3) q)
((((y v) 0) (b 3)) e)
((((f 0) b) 5) (w d))
((((n k) ((4 u) s)) 9) g)
(((((1 d) (p j)) q) m) v)
((((v 0) b) j) (1 y))
(((((a 7) ((0 w) 6)) j) 5) q)
((((x 0) ((s j) k)) 8) 9)
(((((l (j 6)) (k x)) 9) m) z)
(((v (f w)) (e o)) 5)
((((1 l) ((t p) k)) g) f)

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1kik1000.01202010/05/03 11:20:440B / 42B / 54B

Perl _

RankUserSizeTimeDateStatistics
1tails860.01592020/01/31 17:29:030B / 23B / 56B

Python _

RankUserSizeTimeDateStatistics
1Defenestrator1300.00922010/05/05 10:55:210B / 77B / 43B
2recursive2180.00472010/05/06 01:02:320B / 98B / 99B

PHP _

RankUserSizeTimeDateStatistics
1o-cn2360.03892010/05/15 21:29:44104B / 72B / 58B
2TAKO/j0nKI10550.04932010/05/14 00:38:0842B / 275B / 464B

Common LISP _

RankUserSizeTimeDateStatistics
1youz2130.08222010/05/11 00:31:340B / 102B / 98B
2youz(kik)1530.11072010/05/19 23:09:300B / 93B / 50B

Arc _

RankUserSizeTimeDateStatistics
1youz1462.06832010/05/11 00:54:540B / 60B / 78B
2youz(kik)982.35292010/05/19 18:33:580B / 56B / 36B

Clojure _

RankUserSizeTimeDateStatistics
1youz(kik)1132.11662010/05/19 23:14:050B / 59B / 46B

C _

RankUserSizeTimeDateStatistics
1kik2100.00072010/05/08 05:09:440B / 91B / 119B
2tanakh3410.00062010/05/05 21:54:190B / 154B / 183B
3msk10740.00012010/05/03 22:01:370B / 326B / 516B
4tails2070.01122020/02/03 17:52:450B / 95B / 111B
5inaniwa(kik)2090.00072010/05/17 08:22:390B / 91B / 118B

Haskell _

RankUserSizeTimeDateStatistics
1rst761340.12912010/05/13 22:16:180B / 66B / 61B
2notogawa1420.00222010/05/09 23:58:220B / ?B / ?B
3koyama411420.00222010/05/11 02:39:350B / 71B / 59B
4hinoe1420.00232010/05/15 04:55:500B / 70B / 62B
5Defenestrator1640.00462010/05/05 11:18:580B / 81B / 66B
6tanakh1720.00152010/05/05 22:07:130B / 80B / 76B

sed _

RankUserSizeTimeDateStatistics
1tails1410.06452020/02/03 15:13:140B / 15B / 113B

wake _

RankUserSizeTimeDateStatistics
1hinoe1340.03952010/10/09 00:49:480B / 16B / 107B

m4 _

RankUserSizeTimeDateStatistics
1TAKO/j0nKI10550.00022010/05/14 00:33:5542B / ?B / ?B

Lazy-K _

RankUserSizeTimeDateStatistics
1tails15420.04652020/02/03 12:46:350B / 830B / 712B

Vim _

RankUserSizeTimeDateStatistics
1nn7230.08952010/05/18 13:55:073B / 316B / 385B

Language Ranking_

RankLangUserSizeScore
1Perltails8610000
2Arcyouz(kik)988775
3Rubykik1008600
4Clojureyouz(kik)1137610
5PythonDefenestrator1306615
6Haskellrst761346417
7wakehinoe1346417
8sedtails1416099
9Common LISPyouz(kik)1535620
10Ctails2074154
11PHPo-cn2363644
12Vimnn7231189
13m4TAKO/j0nKI1055815
14Lazy-Ktails1542557

return to the top page