Assignment 1
And the assignment 1 in clojure is here finally :), it has been quite hard to convert it.
As said the assignment instructions you have to write a good number of properties check to make all test pass.
If you launch "lein test" in the directory of git you will see there are 5 test that fail.
They will pass when you will write the properties that check the fault in the 5 bogus implementation.
I'll post the solution after the hard date, in this way I'll not not give any hint.
The Heap implementations are made with protocols, actually I think it his quite a bad implementation, probably made for educational purpouse, if I have time I'll make a better implementation with multi methods.
Let me know what do you think, I'm new also to clojure, so I'll appreciate any tip/hint you can gave me :)
For any question feel free to comment I'll reply as soon as possible.
Again, the repository is here https://github.com/marcomanzi/reactiveclojure, you will find the quick_check_properties.clj where you have to write the functions to solve the assignment.
NB: I'm working on it, there are some problems but I'll fix it soon!! :)....
02:33--> Assignment is ready, you can solve it :), have fun
I have rewritten the heap without doing any change in the design to make the same questions that are in the scala's assigment.
Actually the properties have to be done as functions.
The properties function are in the file quick_check_properties.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns week1.assignment.quick-check-properties | |
(:use [clojure.test] | |
[week1.assignment.heap-def]) | |
(:require [common.clojurecheck :as cc])) | |
;Add more function of properties to make all test pass, launch lein test | |
;when all 3 test pass then you have completed the properties needed to complete the assigment | |
;remember to create the function for each property, i-gen is a random integer, while heap-impl is | |
;the implementation of the heap under test | |
(defn find-min-inserted-in-empty-heap | |
"This test if a element inserted in a empty heap is returned by find-min" | |
[heap-impl i-gen] | |
(= (find-min heap-impl | |
(insert heap-impl i-gen nil)) | |
i-gen)) | |
(def properties | |
[find-min-inserted-in-empty-heap]) |
As said the assignment instructions you have to write a good number of properties check to make all test pass.
If you launch "lein test" in the directory of git you will see there are 5 test that fail.
They will pass when you will write the properties that check the fault in the 5 bogus implementation.
I'll post the solution after the hard date, in this way I'll not not give any hint.
The Heap implementations are made with protocols, actually I think it his quite a bad implementation, probably made for educational purpouse, if I have time I'll make a better implementation with multi methods.
Let me know what do you think, I'm new also to clojure, so I'll appreciate any tip/hint you can gave me :)
For any question feel free to comment I'll reply as soon as possible.
Again, the repository is here https://github.com/marcomanzi/reactiveclojure, you will find the quick_check_properties.clj where you have to write the functions to solve the assignment.
NB: I'm working on it, there are some problems but I'll fix it soon!! :)....
02:33--> Assignment is ready, you can solve it :), have fun
Thanks Marco
ReplyDeleteI'm doing the Scala course myself, but my heart is in Clojure :)
Looking forward for your solution!
I have already solved it in Clojure, it has been easier for me.
DeleteUnfortunately clojurecheck is not advanced as ScalaCheck and I have given to methods called for tests only a integer generated. Each method is called n time with a different integer each time.
To solve the assignment I have implemented a HeapGenerator like the assignment suggest, but It's a little easier to use it in Scala, because it is given as parameter in input once you have implemented it. Instead in Clojure you have to call it but it's not a bit problem :)
Only a little point for ScalaCheck that is better implemented for this kind of assignment i think.