X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=gCons.icl;h=6e5aaa52d14b48efc5685f319005e369559605dc;hb=68e65ffa79b10fc6762a0f7989a268126fc20c1b;hp=b54c8e0a820a98a4ecde016e5fb5b0bf8c7f00c3;hpb=c816d5c0477f15631058928c9aad4fbd63d50156;p=mTask.git diff --git a/gCons.icl b/gCons.icl index b54c8e0..6e5aaa5 100644 --- a/gCons.icl +++ b/gCons.icl @@ -22,6 +22,7 @@ consName{|Int|} i = toString i consName{|Bool|} b = toString b consName{|Char|} c = toString c consName{|String|} s = s +consName{|[]|} _ _ = "[]" consName{|(->)|} f g x = g (x undef) generic consIndex a :: a -> Int @@ -35,11 +36,10 @@ consIndex{|Int|} i = i consIndex{|Bool|} b = if b 1 0 consIndex{|Char|} c = toInt c consIndex{|String|} _ = 0 - -import StdMisc, StdDebug +consIndex{|[]|} _ _ = 0 generic conses a :: [a] -conses{|CONS|} f = map CONS f +conses{|CONS|} f = [CONS (hd f)] conses{|UNIT|} = [UNIT] conses{|PAIR|} f g = [] conses{|EITHER|} f g = map LEFT f ++ map RIGHT g @@ -58,3 +58,4 @@ conses{|[!!]|} _ = [[!!]] conses{|{}|} _ = [{}] conses{|{!}|} _ = [{!}] conses{|()|} = [()] +conses{|(->)|} _ _ = [const undef]