- A modern, statically typed programming language built upon the Java ecosystem
- Elegant mix of object orientation and functional programming paradigms
- Designed to be used by real developers, solving real-world problems
- Runs on the JVM, providing full interoperability with Java APIs
- By Martin Odersky, author of the modern `javac` compiler
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> (1 to 4).map { i => "Happy Birthday " + (if (i == 3) "dear Simeon" else "to You") }.foreach { println } | |
Happy Birthday to You | |
Happy Birthday to You | |
Happy Birthday dear Simeon | |
Happy Birthday to You |
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 java.awt.BorderLayout; | |
import java.awt.GridLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.event.KeyEvent; | |
import java.io.File; | |
import javax.swing.*; | |
import javax.swing.filechooser.FileNameExtensionFilter; |
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
Process: java [98221] | |
Path: /usr/bin/java | |
Identifier: com.apple.javajdk16.cmd | |
Version: 1.0 (1.0) | |
Code Type: X86-64 (Native) | |
Parent Process: eclipse [8499] | |
User ID: 224742261 | |
PlugIn Path: /Users/USER/*/libvtkFiltering.5.10.dylib | |
PlugIn Identifier: libvtkFiltering.5.10.dylib |
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 the CMakeCache file. | |
# For build in directory: /CODE/VTK6.0.0 | |
# It was generated by CMake: /usr/local/Cellar/cmake/2.8.10.1/bin/cmake | |
# You can edit this file to change values found and used by cmake. | |
# If you do not want to change any of the values, simply exit the editor. | |
# If you do want to change a value, simply edit, save, and exit the editor. | |
# The syntax for the file is as follows: | |
# KEY:TYPE=VALUE | |
# KEY is the name of a variable in the cache. | |
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. |
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
JFX.devKit := { | |
System.getProperty("os.name").toLowerCase match { | |
case w if w.startsWith("win") => JFX.jdk("C:/Program Files/Java/jdk1.7.0_25") | |
case _ => JFX.jdk(javaHome.value.toString) | |
} | |
} |
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 scala.annotation.tailrec | |
object controls { | |
def repeat(body: => Unit) = new { | |
@tailrec | |
def until(condition: => Boolean) { | |
body | |
if (condition) () else until(condition) | |
} |
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
/** Utility command to convert in SBT a maven dependency fragment into SBT syntax. */ | |
def Pom2SbtCommand = "pom2sbt" | |
def Pom2SbtHelp = " <pom.xml>" | |
import complete.DefaultParsers._ | |
lazy val pomLibs2Sbt = Command(Pom2SbtCommand, | |
Help((Pom2SbtCommand, Pom2SbtHelp)))(_ ⇒ fileParser(new File("./"))) { (state, file) ⇒ | |
import scala.xml.XML |
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 g = TinkerFactory.createModern().asScala | |
val Age = Key[Vertex]("age") | |
val Lang = Key[Vertex]("lang") | |
val trav = g.V(4) | |
.union( | |
GremlinScala(__[Vertex]).in().value(Age), | |
GremlinScala(__[Vertex]).out().value(Lang) |
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
// Keys to have a submodule publish to a micro-repo. | |
val publishMicroRepo = taskKey[Unit]("Task to publish artifacts to a local brooklyn micro-repo") | |
val microRepoTargetDir = settingKey[File]("Directory where to save repository") | |
val microRepoPublishConfiguration = taskKey[sbt.PublishConfiguration]("Micro-repo publish task config") | |
val microRepoName = settingKey[String]("Unique sbt repository ID") | |
// ---------------------------------------------------------------------------- | |
// Support for publishing core libraries to project micro-repo | |
// ---------------------------------------------------------------------------- | |
lazy val publishSettings = Seq( |