From a7d7542dc646a5fd124ef71e71ce260889f1701b Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 2 Feb 2016 19:24:50 +0100 Subject: Moved to 1415 directory --- 1415/fp2/week3/camil/StdDynSet.dcl | 24 ++ 1415/fp2/week3/camil/StdDynSet.icl | 62 ++++ 1415/fp2/week3/camil/StdDynSet.prj | 569 +++++++++++++++++++++++++++++++++++++ 1415/fp2/week3/camil/StdDynSet.prp | 217 ++++++++++++++ 4 files changed, 872 insertions(+) create mode 100644 1415/fp2/week3/camil/StdDynSet.dcl create mode 100644 1415/fp2/week3/camil/StdDynSet.icl create mode 100644 1415/fp2/week3/camil/StdDynSet.prj create mode 100644 1415/fp2/week3/camil/StdDynSet.prp (limited to '1415/fp2/week3/camil') diff --git a/1415/fp2/week3/camil/StdDynSet.dcl b/1415/fp2/week3/camil/StdDynSet.dcl new file mode 100644 index 0000000..160af6c --- /dev/null +++ b/1415/fp2/week3/camil/StdDynSet.dcl @@ -0,0 +1,24 @@ +definition module StdDynSet + +import StdOverloaded + +class Set a | TC, ==, toString a + +:: Set + +instance zero Set +instance toString Set +instance == Set + +toSet :: a -> Set | Set a + +nrOfElts :: Set -> Int +isEmptySet :: Set -> Bool + +memberOfSet :: a Set -> Bool | Set a +isSubset :: Set Set -> Bool +isStrictSubset :: Set Set -> Bool + +union :: Set Set -> Set +intersection :: Set Set -> Set +without :: Set Set -> Set diff --git a/1415/fp2/week3/camil/StdDynSet.icl b/1415/fp2/week3/camil/StdDynSet.icl new file mode 100644 index 0000000..576bec9 --- /dev/null +++ b/1415/fp2/week3/camil/StdDynSet.icl @@ -0,0 +1,62 @@ +// Mart Lubbers s4109503, Camil Staps s4498062 + +implementation module StdDynSet + +import StdEnv +import StdMaybe +import StdDynamic + +isEqual:: Dynamic t -> Bool | Set t +isEqual (x :: t^) a = x == a +isEqual _ _ = False + +class Set a | TC, ==, toString a + +:: Set = Set [(Dynamic, Dynamic -> Bool, String)] + +instance zero Set +where zero = Set [] + +instance toString Set +where toString (Set [(_,_,a):as]) = "{" +++ a +++ (foldl (+++) "" ["," +++ s \\ (_,_,s) <- as]) +++ "}" + +instance == Set +where == a b = nrOfElts a == nrOfElts b && isSubset a b + +toSet :: a -> Set | Set a +toSet e = Set [(dynamic e, \x = isEqual x e, toString e)] + +nrOfElts :: Set -> Int +nrOfElts (Set a) = length a + +isEmptySet :: Set -> Bool +isEmptySet a = (nrOfElts a) == 0 + +memberOfSet :: a Set -> Bool | Set a +memberOfSet _ (Set []) = False +memberOfSet x (Set [(y,_,_):ys]) = isEqual y x || memberOfSet x (Set ys) + +dynMemberOfSet :: Dynamic Set -> Bool +dynMemberOfSet _ (Set []) = False +dynMemberOfSet x (Set [(_,eq,_):ys]) = eq x || dynMemberOfSet x (Set ys) + +isSubset :: Set Set -> Bool +isSubset a b = (nrOfElts a) == (nrOfElts (intersection a b)) + +isStrictSubset :: Set Set -> Bool +isStrictSubset a b = isSubset a b && nrOfElts a < nrOfElts b + +union :: Set Set -> Set +union (Set a) (Set b) = Set (a ++ (fromSet (without (Set b) (Set a)))) +where + fromSet :: Set -> [(Dynamic, Dynamic -> Bool, String)] + fromSet (Set x) = x + +intersection :: Set Set -> Set +intersection as (Set []) = as +intersection (Set as) (Set bs) = Set [(a,eq,ts) \\ (a,eq,ts) <- as | dynMemberOfSet a (Set bs)] + +without :: Set Set -> Set +without (Set as) (Set bs) = Set [(a,eq,ts) \\ (a,eq,ts) <- as | not (dynMemberOfSet a (Set bs))] + +Start = toString (union (toSet 1) (toSet 2)) diff --git a/1415/fp2/week3/camil/StdDynSet.prj b/1415/fp2/week3/camil/StdDynSet.prj new file mode 100644 index 0000000..4328042 --- /dev/null +++ b/1415/fp2/week3/camil/StdDynSet.prj @@ -0,0 +1,569 @@ +Version: 1.4 +Global + ProjectRoot: . + Built: True + Target: Experimental + Exec: {Project}\StdDynSet.exe + CodeGen + CheckStacks: False + CheckIndexes: True + Application + HeapSize: 2097152 + StackSize: 512000 + ExtraMemory: 81920 + IntialHeapSize: 204800 + HeapSizeMultiplier: 4096 + ShowExecutionTime: False + ShowGC: False + ShowStackSize: False + MarkingCollector: False + StandardRuntimeEnv: True + Profile + Memory: False + MemoryMinimumHeapSize: 0 + Time: False + Stack: False + Output + Output: ShowConstructors + Font: Courier + FontSize: 9 + WriteStdErr: False + Link + LinkMethod: Static + GenerateRelocations: False + GenerateLinkMap: False + LinkResources: False + ResourceSource: + GenerateDLL: False + ExportedNames: + Paths + Path: {Project} + Precompile: + Postlink: +MainModule + Name: StdDynSet + Dir: {Project} + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False +OtherModules + Module + Name: StdCleanTypes + Dir: {Application}\Libraries\Dynamics + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdDynamic + Dir: {Application}\Libraries\Dynamics + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: BitSet + Dir: {Application}\Libraries\Dynamics\general + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: DefaultElem + Dir: {Application}\Libraries\Dynamics\general + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: EnDecode + Dir: {Application}\Libraries\Dynamics\general + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: DynIDMacros + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: DynamicUtilities + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdDynamicLowLevelInterface + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdDynamicTypes + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdDynamicVersion + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemDynamic + Dir: {Application}\Libraries\Dynamics\implementation + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: DynamicGraphConversion + Dir: {Application}\Libraries\Dynamics\implementation\windows + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: DynamicLinkerInterface + Dir: {Application}\Libraries\Dynamics\implementation\windows + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + NeededObjFiles + ObjectFile: read_function.obj + Module + Name: memory + Dir: {Application}\Libraries\Dynamics\implementation\windows + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + NeededObjFiles + ObjectFile: mem.obj + Module + Name: memory_mapped_files + Dir: {Application}\Libraries\Dynamics\implementation\windows + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + NeededObjFiles + ObjectFile: low.obj + NeededLibraries + Library: StdDynamic_kernel32_library + Module + Name: shared_buffer + Dir: {Application}\Libraries\Dynamics\implementation\windows + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdArray + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdBool + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdChar + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdCharList + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdClass + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdEnum + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdEnv + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdFile + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdFunc + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdInt + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdList + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdMisc + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdOrdList + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdOverloaded + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdReal + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdString + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdTuple + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemArray + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: _SystemEnum + Dir: {Application}\Libraries\StdEnv + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False + Module + Name: StdMaybe + Dir: {Application}\Libraries\StdLib + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False diff --git a/1415/fp2/week3/camil/StdDynSet.prp b/1415/fp2/week3/camil/StdDynSet.prp new file mode 100644 index 0000000..87899a5 --- /dev/null +++ b/1415/fp2/week3/camil/StdDynSet.prp @@ -0,0 +1,217 @@ +Version: 1.4 +MainModule + Name: StdDynSet + Dir: {Project} + Dcl + WindowPosition + X: 65 + Y: 47 + SizeX: 800 + SizeY: 640 + DclOpen: False + Icl + WindowPosition + X: 10 + Y: 10 + SizeX: 800 + SizeY: 600 + IclOpen: False +OtherModules + Module + Name: StdCleanTypes + Dir: {Application}\Libraries\Dynamics + Dcl + WindowPosition + X: 10 + Y: 10 + SizeX: 800 + SizeY: 600 + DclOpen: False + IclOpen: False + Module + Name: StdDynamic + Dir: {Application}\Libraries\Dynamics + Dcl + WindowPosition + X: 276 + Y: 168 + SizeX: 800 + SizeY: 600 + DclOpen: False + IclOpen: False + Module + Name: BitSet + Dir: {Application}\Libraries\Dynamics\general + DclOpen: False + IclOpen: False + Module + Name: DefaultElem + Dir: {Application}\Libraries\Dynamics\general + DclOpen: False + IclOpen: False + Module + Name: EnDecode + Dir: {Application}\Libraries\Dynamics\general + DclOpen: False + IclOpen: False + Module + Name: DynIDMacros + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: DynamicUtilities + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: StdDynamicLowLevelInterface + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: StdDynamicTypes + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: StdDynamicVersion + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: _SystemDynamic + Dir: {Application}\Libraries\Dynamics\implementation + DclOpen: False + IclOpen: False + Module + Name: DynamicGraphConversion + Dir: {Application}\Libraries\Dynamics\implementation\windows + DclOpen: False + IclOpen: False + Module + Name: DynamicLinkerInterface + Dir: {Application}\Libraries\Dynamics\implementation\windows + DclOpen: False + IclOpen: False + Module + Name: memory + Dir: {Application}\Libraries\Dynamics\implementation\windows + DclOpen: False + IclOpen: False + Module + Name: memory_mapped_files + Dir: {Application}\Libraries\Dynamics\implementation\windows + DclOpen: False + IclOpen: False + Module + Name: shared_buffer + Dir: {Application}\Libraries\Dynamics\implementation\windows + DclOpen: False + IclOpen: False + Module + Name: StdArray + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdBool + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdChar + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdCharList + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdClass + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdEnum + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdEnv + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdFile + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdFunc + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdInt + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdList + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdMisc + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdOrdList + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdOverloaded + Dir: {Application}\Libraries\StdEnv + Dcl + WindowPosition + X: 10 + Y: 10 + SizeX: 800 + SizeY: 600 + DclOpen: False + IclOpen: False + Module + Name: StdReal + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdString + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdTuple + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: _SystemArray + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: _SystemEnum + Dir: {Application}\Libraries\StdEnv + DclOpen: False + IclOpen: False + Module + Name: StdMaybe + Dir: {Application}\Libraries\StdLib + DclOpen: False + IclOpen: False -- cgit v1.2.3