This file contains hidden or 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 learningclojure.clojureoids.models) | |
(def box-width 640) | |
(def box-heigth 480) | |
(defrecord position [x y]) | |
(defrecord ) |
This file contains hidden or 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
/** | |
* Developed with pleasure :)<br> | |
* User: HoD<br> | |
* Date: 02.12.11<br> | |
* Time: 19:48<br> | |
*/ | |
object TrickOfMind { | |
def main(args: Array[String]) { | |
val range = 1 to 15 |
This file contains hidden or 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
object ImplicitResolution { | |
object CompanionObject { | |
implicit def convert(co: CompanionObject) = "o: co/p: co" | |
implicit def convert(co: CompanionObject2) = "o: co/p: co2" | |
implicit def convert(from:String) = new CompanionObject | |
} | |
class CompanionObject | |
object CompanionObject2 { | |
implicit def convert(s: CompanionObject) = "o: co2/p: co" |
This file contains hidden or 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
object FindX { | |
def main(args: Array[String]) { | |
val lowest = 0.to(Integer.MAX_VALUE, 13) find { | |
e => { | |
2 to 12 forall {e % _ == 1} | |
} | |
} | |
println(lowest) | |
} | |
} |
This file contains hidden or 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
private def lub(t1: ScType, t2: ScType, depth : Int, checkWeak: Boolean)(implicit stopAddingUpperBound: Boolean): ScType = { | |
if (t1.conforms(t2, checkWeak)) t2 | |
else if (t2.conforms(t1, checkWeak)) t1 | |
else { | |
def lubWithExpandedAliases(t1: ScType, t2: ScType): ScType = { | |
(t1, t2) match { | |
case (fun@ScFunctionType(rt1, p1), ScFunctionType(rt2, p2)) if p1.length == p2.length => | |
new ScFunctionType(lub(rt1, rt2, 0, checkWeak), | |
collection.immutable.Seq(p1.toSeq.zip(p2.toSeq).map({ | |
case (t1, t2) => glb(t1, t2, checkWeak) |
This file contains hidden or 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
package phonecode | |
import tools.nsc.io.File | |
/* | |
// original "2 hours! yay!"-code without fine tuning: 50 lines | |
object PhoneCode { | |
def main(args: Array[String]) { | |
val evilChars = Set('-', '"', '/') | |
val cleanString = (s: String) => s.filterNot(evilChars) |
This file contains hidden or 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
102000564,102006162,102006801,102006882,102054402,102054483,102402324,102408642,102450645,102456243,102456963,102804165,102804804,102804885,102852405,102852486,102858003,102858084,102858723,105204402,105204483,105252003,105252084,105252723 | |
105258321,105600645,105606243,105606963,105654564,108000243,108000963,108006561,108054162,108054801,108054882,108402003,108402084,108402723,108408321,108450324,108456642,108804564,108852165,108852804,108852885,108858402,108858483,120000321 | |
120006648,120054240,120054249,120054960,120054969,120402162,120402801,120402882,120408408,120408480,120408489,120450402,120450483,120456000,120456009,120456081,120456720,120456729,120804642,120852243,120852963,120858561,123204240,123204249 | |
123204960,123204969,123252561,123258168,123258807,123258888,123600402,123600483,123606000,123606009,123606081,123606720,123606729,123654321,126000000,126000009,126000081,126000720,126000729,126006327,126054648,126402561,126408168,126408807 | |
126408888,126450162,126450801,126450882,126456408,126456480,1264 |
This file contains hidden or 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
package fromtheafricanwoman | |
import collection.immutable.BitSet | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 15.10.12 | |
* Time: 22:29 | |
*/ |
This file contains hidden or 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
checking product 12. | |
possible solutions to get sum 8 are | |
Vector(List(2, 6), List(3, 5), List(4, 4)), having the products Vector(12, 15, 16) | |
--- | |
possible solutions to get sum 7 are | |
Vector(List(2, 5), List(3, 4)), having the products Vector(10, 12) | |
--- | |
checking product 16. | |
possible solutions to get sum 10 are |
This file contains hidden or 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
package euler | |
import collection.immutable.TreeMap | |
import collection.mutable | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 03.10.12 | |
* Time: 22:01 |
OlderNewer