diff --git a/egison.cabal b/egison.cabal
--- a/egison.cabal
+++ b/egison.cabal
@@ -1,5 +1,5 @@
 Name:                egison
-Version:             2.4.3
+Version:             2.4.4
 Synopsis:            An Interpreter and Compiler for the Programming Language Egison
 Description:         An interpreter and compiler for the programming language Egison.
                      A feature of Egison is the strong pattern match facility.
@@ -17,7 +17,7 @@
 Cabal-version:       >=1.8
 
 Data-files:          lib/core/base.egi lib/core/number.egi lib/core/collection.egi lib/core/array.egi lib/core/pattern.egi
-                     lib/graph.egi lib/poker-hands.egi
+                     lib/graph.egi lib/poker-hands.egi lib/coc.egi lib/tree.egi
                      sample/number-test.egi sample/collection-test.egi sample/array-test.egi sample/graph-test.egi
                      sample/poker-hands-test.egi
                      sample/io/argv-test.egi sample/io/cat.egi sample/io/copy.egi sample/io/char-test.egi sample/io/hello.egi sample/io/read-write-test.egi
@@ -28,7 +28,7 @@
                      etc/template-for-test.hs
 
 Library
-  Build-Depends:   base >= 4.0 && < 5, array, containers, haskeline, transformers, mtl, parsec >= 3.0, directory, ghc, ghc-paths, strict-io
+  Build-Depends:   base >= 4.0 && < 5, array, containers, haskeline >= 0.7.0.3, transformers, mtl, parsec >= 3.0, directory, ghc, ghc-paths, strict-io
   Hs-Source-Dirs:  hs-src
   Exposed-Modules: Language.Egison.Core
                    Language.Egison.Types
@@ -42,7 +42,7 @@
 
 Executable egison
   Main-is:             egisoni.hs
-  Build-depends:       egison, base >= 4.0 && < 5, array, containers, haskeline, transformers, mtl, parsec >= 3.0, directory, ghc, ghc-paths, regex-posix, strict-io
+  Build-depends:       egison, base >= 4.0 && < 5, array, containers, haskeline >= 0.7.0.3, transformers, mtl, parsec >= 3.0, directory, ghc, ghc-paths, regex-posix, strict-io
   Other-modules:       Paths_egison
   Hs-Source-Dirs:      hs-src/Interpreter
   
diff --git a/lib/coc.egi b/lib/coc.egi
new file mode 100644
--- /dev/null
+++ b/lib/coc.egi
@@ -0,0 +1,55 @@
+(define $product
+  (letrec 
+    {[$subproduct (lambda [$xs $ys]
+                    (match xs (List Something)
+                      {[<nil> {}]
+                       [<cons $z $zs> {@(map (lambda [$y] {z @y}) ys) @(subproduct zs ys)}]}))]}
+    (lambda [$xs]
+      (match xs (List Something)
+        {[<nil> {}]
+         [<cons $y <nil>> (map (lambda [$z] {z}) y)]
+         [<cons $y $ys> (subproduct y (product ys))]}))))
+
+(define $COC
+  (lambda [$a $b] ;; a : collection-type   b : contents-type   see. an example below
+    (type
+      {[,$val []
+        {[$tgt (match tgt (List (a b))
+                 {[,val {[]}]
+                  [_ {}]})]}]
+       [<nil> [] ;; nil when some contents is nil
+        {[$tgt (letrec
+                 {[$helper (lambda [$xs]
+                             (match xs (List Something)
+                               {[<nil> {}]
+                                [<cons $y $ys> (match y [(a b)]
+                                                 {[<nil> {[]}]
+                                                  [_ (helper ys)]})]}))]}
+                 (helper tgt))]}]
+       [<cons ,$xs _> [(COC a b)]
+        {[$tgt (letrec
+                 {[$helper (lambda [$xs $ys]
+                             (match [xs ys] [(List Something) (List Something)]
+                               {[[<nil> <nil>] {}]
+                                [[<cons $x $xs> <cons $y $ys>] {(match-all y [(a b)] [<cons ,x $xs> xs]) @(helper xs ys)}]}))]}
+                 (product (helper xs tgt)))]}]
+       [<cons _ _> [(List b) (COC a b)]
+        {[$tgt (letrec
+                 {[$helper (lambda [$xs]
+                             (match xs (List Something)
+                               {[<nil> {}]
+                                [<cons $y $ys> {(match-all y [(a b)] [<cons $z $zs> [z zs]]) @(helper ys)}]}))]
+                  [$lt2tl (lambda [$xs]
+                            (match xs (List [Something Something])
+                              {[<nil> [{} {}]]
+                               [<cons [$y $z] $ys> (let {[[$p $q] (lt2tl ys)]} [{y @p} {z @q}])]}))]}
+                 (map lt2tl (product (helper tgt))))]}]
+       [_ [Something]
+        {[$tgt {tgt}]}]})))
+
+
+;; (define $n-queen
+;;   (lambda [$n]
+;;    (match-all {(between 1 n) (between 2 (* 2 n)) (between (- 1 n) (- n 1))} (COC Multiset Integer)
+;;      [(loop $l $i (between 1 n) <cons <cons $a_i ,{(+ a_i i) (- a_i i)}> l> <nil>)
+;;       (loop $l $i (between 1 n) {a_i @l} {})])))
diff --git a/lib/core/pattern.egi b/lib/core/pattern.egi
--- a/lib/core/pattern.egi
+++ b/lib/core/pattern.egi
@@ -2,6 +2,10 @@
 ;; Pattern.egi
 ;;
 
+(define $n-cons
+  (macro [$n $v]
+    (loop $l $i (between 1 n) <cons $`v_i l> _)))
+
 (define $comb
   (macro [$n $v]
     (loop $l $i (between 1 n) <join _ <cons $`v_i l>> _)))
diff --git a/lib/tree.egi b/lib/tree.egi
new file mode 100644
--- /dev/null
+++ b/lib/tree.egi
@@ -0,0 +1,16 @@
+(define $Tree
+  (lambda [$a]
+    (type
+      {[,$val []
+      {[$tgt (match [tgt val] [(Tree a) (Tree a)]
+               {[[<node $n1 $n2> <node ,n1 ,n2>] {[]}]
+                [[<leaf $x> <leaf ,x>] {[]}]
+                [[_ _] {}]})]}]
+     [<node _ _> [(Tree a) (Tree a)]
+      {[<node $n1 $n2> {[n1 n2]}]}]
+     [<leaf _> [a]
+      {[<leaf $x> {[x]}]}]
+     [_ [Something]
+      {[$tgt {tgt}]}]
+     }))
+
