File: BubbleSort.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 (21 lines) | stat: -rw-r--r-- 459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}

import Test.EasyCheck
import SetFunctions

-- Bubble sort formulation with default rule

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

-- Compute only one value of sort:
sortOne xs = selectValue (set1 sort xs)

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

-- Compute only first value:
main = sortOne [7,1,6,3,5,4,2]


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