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
object cliffHanger extends App{ | |
val man = List(" 0\n","-","-","-\n"," |\n"," /","\\\n") | |
def drawState(tries:Int,word:String,letters:List[Char]) = { | |
println("\n\n\n") | |
println(man.dropRight(tries).mkString) | |
word.toList.foreach(c => if (letters.exists(c == _)) print(c) else print("_")) | |
println() | |
} |
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
/** | |
* This is from community accepted conventions and feel free to judge upon them. | |
* | |
* Upon Method Invocation chaining, one can prefer the 'fooIndent' method over 'fooNotIndent' | |
* (as well as barIndent over barNotIndent), | |
* Not only it improves readibility upon reading (by gradually grasping the functionality) but also it does not consume | |
* the whole screen (thus not making you scroll). | |
* | |
* The use of '.' upon invocation is debatable. | |
* Some argue that the leading '.' should be removed [2] |
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
import scalaz._ | |
import Scalaz._ | |
scala> val a = (_:List[Int]).partition(_ > 5) | |
a: List[Int] => (List[Int], List[Int]) = <function1> | |
scala> val b = (_:List[Int]).partition(_ > 10) | |
b: List[Int] => (List[Int], List[Int]) = <function1> | |
scala> val c = (_:List[Int]).map(_ + 1) |
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
object ListToTupleImplicit { | |
class ListToTuple[A](xs:List[A]){ | |
def toTuple2 = (xs(0),xs(1)) | |
def toTuple3 = (xs(0),xs(1),xs(2)) | |
def toTuple4 = (xs(0),xs(1),xs(2),xs(3)) | |
} | |
implicit def listToTuple[A](xs:List[A]):ListToTuple[A] = new ListToTuple(xs) | |
} | |
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
// This code fragment exists in two separate files: | |
// 1- neo/game/script/Script_Interpreter.cpp | |
// 2- neo/d3xp/script/Script_Interpreter.cpp | |
// | |
while( !doneProcessing && !threadDying ) { | |
instructionPointer++; | |
if ( !--runaway ) { | |
Error( "runaway loop error" ); | |
} |
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
// Most numerous clone group | |
// code fragment: | |
UpdateData( FALSE ); | |
UpdateFile(); | |
*pResult = 0; | |
// files: | |
//neo/tools/af/DialogAFConstraintSlider.cpp 288:290 | |
//neo/tools/af/DialogAFConstraintSlider.cpp 310:312 |
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
bar |