Skip to content

Commit

Permalink
+test/QuickSort.hs working!
Browse files Browse the repository at this point in the history
Ignore-this: 3eece9acb53c4e1a02039dfd809fa297

darcs-hash:20100223023712-09b00-109842a8c3d73fb1c1875bf1bf55ec82283ba0e2
  • Loading branch information
xy-kasumi committed Feb 23, 2010
1 parent 069aa2a commit 93727be
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions Front.hs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ instance WeakDesugar HsDecl where
wds (HsTypeSig loc ns ty)=HsTypeSig loc ns ty
wds (HsDataDecl loc [] n vs cdecls [])=HsDataDecl loc [] n vs cdecls []
wds (HsDataDecl _ _ _ _ _ _)=error "WeakDesugar: HsDataDecl: context/deriving is not supported"
wds (HsInfixDecl loc assoc lv ops)=HsInfixDecl loc assoc lv ops

instance WeakDesugar HsExp where
wds (HsApp e0 e1)=HsApp (wds e0) (wds e1)
Expand Down
2 changes: 1 addition & 1 deletion auto-test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and test_bf test/LocalFun.hs
and test_bf test/Lambda.hs
and test_bf test/Arithmetic.hs
and test_bf test/ShowList.hs
# and test_bf test/QuickSort.hs
and test_bf test/QuickSort.hs
# and test_bf test/TypeClass.hs
# and test_bf test/ConstPattern.hs
# and test_bf test/
10 changes: 10 additions & 0 deletions test/Prelude.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

infixr 0 $
f $ x=f x

f $! x=x `seq` (f x)

data Bool
Expand Down Expand Up @@ -99,8 +101,16 @@ filter f (x:xs)
|n `eqByte` 0 = x
|otherwise = xs !! (n `subByte` 1)

{- I don't know why, but this code doesn't work!
[]++ys=ys
(x:xs)++ys=x:(xs++ys)
-}

xs ++ ys=
case xs of
[] -> ys
x:xs -> x:(xs++ys)


length []=0
length (x:xs)=1 `addByte` (length xs)
Expand Down
9 changes: 9 additions & 0 deletions test/QuickSort.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

main=outputStr Halt (qsort "etsb")

qsort []=[]
qsort (x:xs)=qsort (filter (gtByte x) xs)++[x]++qsort (filter (leByte x) xs)

outputStr k []=k
outputStr k (x:xs)=Output x (outputStr k xs)

2 changes: 1 addition & 1 deletion test/ShowList.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


main=outputStr Halt (map showByte1 [1,2,3,4])
main=outputStr Halt ((map showByte1 [1,2,3])++"\n")

showByte1 x=addByte '0' x

Expand Down

0 comments on commit 93727be

Please sign in to comment.