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
def isSorted[A](as: List[A], gt: (A, A) => Boolean): Boolean = as match { | |
case a :: b :: tail => { | |
if (!gt(a, b)) return false | |
isSorted(b :: tail, gt) | |
} | |
case _ => true | |
} |
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
package pl.edu.agh.openshop | |
import pl.edu.agh.openshop.utils.fastfor | |
package object utils { | |
def fastfor(limit: Int)(f: Int => Unit) { | |
var i = 0 | |
while (i < limit) { | |
f(i) |
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
function _extend(object, source) { | |
for (var key in source) { | |
if (source.hasOwnProperty(key)) { | |
object[key] = source[key]; | |
} | |
} | |
return object; | |
} | |
function _with() { |
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
var mtv = (function (mtv) { | |
'use strict'; | |
mtv.TraitA = function (self) { | |
self.functionA = function () { | |
console.log('[start]: TraitA.functionA'); | |
console.log(self.getModel()); | |
console.log('[end]: TraitA.functionA'); | |
}; | |
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
def foo: String = ??? | |
def bar(): String = ??? |
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
1 + 3 == (1).+(3) | |
!true == true.unary_! |
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
case class User(name: String, lastname: String) | |
User(name = "Michal", lastname = "Kowol") == User(lastname = "Kowol", name = "Michal") // true |
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
package com.michal | |
class A { | |
private def defaultPrivate = ??? | |
private [this] def superPrivate(other: A) { | |
//other.superPrivate(this) // error | |
other.defaultPrivate | |
superPrivate(other) | |
} | |
private [michal] def publicInPackage = ??? |
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
case class User(name: String, age: Int) | |
User(name = "Bob", age = 10).copy(age = 40) // User(Bob, 40) |
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
val s = Array(1 ,2, 3) // s: Array[Int] = Array(1, 2, 3) | |
def testCase(s: Seq[Int]) = s // testCase: TestCase[](val s: Seq[Int]) => Seq[Int] | |
testCase(s) // res0: Seq[Int] = WrappedArray(1, 2, 3) | |
s(0) = 7 // res1: Unit = () | |
testCase(s) // res2: Seq[Int] = WrappedArray(7, 2, 3) |
OlderNewer