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
module Simpson where | |
data Value = Value | |
{ minRange :: Double | |
, maxRange :: Double | |
, dof :: Int | |
, expectedValue :: Double | |
} deriving (Eq) | |
type Error = Double |
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 it.lm; | |
public class Main { | |
public static void main(String[] args) { | |
B b = new B(); | |
A<B> a = new A<B>(b); | |
C<A<B>> c = new C<A<B>>(a); | |
} |
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
public class CategoryTheory { | |
public static <T> Function<T, T> id() { | |
return new Function<T, T>() { | |
@Override | |
public T apply(T arg) { | |
return arg; | |
} | |
}; | |
} |
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
public class CategoryTheory { | |
public static <T> Function<T, T> id() { | |
return new Function<T, T>() { | |
@Override | |
public T apply(T arg) { | |
return arg; | |
} | |
}; | |
} |
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
http://www.codewars.com/kata/51c8991dee245d7ddf00000e/solutions/javascript | |
"Complete the solution so that it reverses all of the words within the string passed in." | |
function reverseWords(str){ | |
//split it into words, store in array | |
var words = str.split(" ") | |
var output = ""; | |
//reverse the array and concat each word with space | |
for(var i = words.length-1; i >= 0; i--){ |
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
Exception in thread "main" java.lang.VerifyError: Bad local variable type | |
Exception Details: | |
Location: | |
Prova$.main([Ljava/lang/String;)V @0: aload_2 | |
Reason: | |
Type top (current frame, locals[2]) is not assignable to reference type | |
Current Frame: | |
bci: @0 | |
flags: { } | |
locals: { 'Prova$', '[Ljava/lang/String;' } |
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
[17:06:42] volothamp: simple question: why does this expression evalute to null? | |
[17:06:44] volothamp: scala> val x: Integer = if (0 != 1) x else 42 | |
[17:06:44] volothamp: x: Integer = null | |
[17:06:58] darkfrog: hehe | |
[17:07:14] darkfrog: volothamp: you're declaring x and assigning it x dude | |
[17:07:59] darkfrog: volothamp: I have no idea what you're trying to do, but you're doing it wrong. :-p | |
[17:08:10] volothamp: darkfrog: it's an edge case :p | |
[17:08:17] arjen-jonathan: I think that the compiler is telling you: | |
[17:08:30] darkfrog: volothamp: it's not an edge case, it's bad code | |
[17:08:44] TKH ([email protected]) joined the channel |
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
Try(jsValue.as[T]).getOrElse(throw BadRequestException("invalid.json") |
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
Try(jsValue.as[T]).getOrElse(throw BadRequestException("invalid.json") |
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
case class User(name: String, homepageUrl: Option[String]) | |
case class UserProfile(userName: String, profile: String) | |
def findUser = Future.successful(User("Bob", Some("http://bob.com"))) | |
def downloadProfile(url: String): Future[String] = Future.successful("Profile from the interwebs...") | |
def profile(user: User): Future[Iterable[String]] = Future.sequence(user.homepageUrl.map(downloadProfile)) | |
OlderNewer