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
// (c) 2016 Jörn Dinkla, www.dinkla.net | |
// usage groovy lhs2hs.groovy FILENAMES.lhs | |
// warning: existing files with .hs extension are overwritten | |
void transformBeginEndCode(StringBuilder sb, File f) { | |
boolean inCode = false | |
sb << "{-\n" | |
f.text.eachLine { line -> | |
if (line =~ /^\\begin\{code\}/) { | |
sb << "-}\n\n" | |
inCode = 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
/* | |
* The following example shows the use of lambdas on the device with CUDA 8.0. | |
* | |
* needs the nvcc compiler option --expt-extended-lambda to compile. | |
* | |
* (c) 2016 Joern Dinkla, www.dinkla.net | |
*/ | |
#include <thrust/device_vector.h> | |
#include <thrust/sequence.h> | |
#include <thrust/transform.h> |
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
// (c) 2015 Joern Dinkla, see http://www.dinkla.net/en/programming/scala-covariance-contravariance.html | |
abstract class Animal | |
class Cat extends Animal { | |
def meow() : Unit = println("meow") | |
} | |
class Dog extends Animal | |
def mkPair(a: Animal, b: Animal) = (a,b) | |
val ps = mkPair(new Cat, new Dog) |