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
puppet lcode class main::sub { | |
puppet lcode include substuff | |
puppet lcode } |
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
puppet lcode import "classes/*.pp" | |
puppet lcode import "definitions/*.pp" |
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
class main::sub { | |
include substuff | |
} |
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 "classes/*.pp" | |
import "definitions/*.pp" |
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
scala> class Tester[R <: ResourceManager#Resource] { | |
| def apply(r: R) = assert(r.hash == "9e47088d", "Expected: 9e47088d, Found: "+r.hash) | |
| } | |
defined class Tester | |
scala> def testHash[RM <: ResourceManager](rm: RM) = new Tester[rm.Resource] | |
testHash: [RM <: ResourceManager](rm: RM)Tester[rm.Resource] |
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
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
import java.io._ | |
if (args.length != 2) | |
sys.error("Please pass input and output files as parameters") | |
val inputFile = new File(args(0)) | |
val outputFile = new File(args(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
Answers http://stackoverflow.com/questions/10373318/mixing-in-a-trait-dynamically. | |
Compile as follows: | |
scalac Common_1.scala Macros_2.scala | |
scalac Common_1.scala Test_3.scala -cp <path to the result of the previous compilation> | |
Tested in 2.10.0-M3, will most likely not compile by the time 2.10.0 final is released, because we're actively rehashing the API. | |
However the principles will remain the same in the final release, so the concept itself is okay. | |
upd. Code updated for 2.10.0-M7. |
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
scala> -0.0 == 0.0 | |
res0: Boolean = true | |
scala> -0.0 < 0.0 | |
res1: Boolean = false | |
scala> -0.0 > 0.0 | |
res2: Boolean = false | |
scala> -0.0 compareTo 0.0 |
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 ListZipper[+A](lefts: List[A], x: A, rights: List[A]) { | |
def map[B](f: A => B): ListZipper[B] = | |
sys.error("todo") | |
// map with zipper context | |
def coFlatMap[B](f: ListZipper[A] => B): ListZipper[B] = | |
sys.error("todo") | |
def findRight(p: A => Boolean): Option[ListZipper[A]] = | |
sys.error("todo") |
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
[repositories] | |
local | |
my-maven-repo: http://artifactory.ebc/artifactory/repo/ | |
my-ivy-artifacts: http://artifactory.ebc/artifactory/repo/, [organization]/[module]/[revision]/[type]s/[type].[ext], [organization]/[module]/[revision]/[type]s/[module].[ext] | |
my-ivy-classifiers: http://artifactory.ebc/artifactory/repo/, [organization]/[module]/[revision]/[type]s/[type].[ext], [organization]/[module]/[revision]/[type]s/[module]-[classifier].[ext] |