File: BubbleSortDet.curry

package info (click to toggle)
curry-tools 1.0.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,492 kB
  • ctags: 121
  • sloc: makefile: 470; sh: 421
file content (15 lines) | stat: -rw-r--r-- 356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}

import Test.EasyCheck

-- Bubble sort formulation with default rule as deterministic function

sort :: [Int] -> DET [Int]
sort (xs++[x,y]++ys) |  x>y = sort (xs++[y,x]++ys)
sort'default xs = xs

main = sort [7,1,6,3,5,4,2]

bsort7 = sort [7,1,6,3,5,4,2] -=- [1..7]

mainN n = sort [n,n-1 .. 1]