Created
March 6, 2017 21:50
-
-
Save anonymous/fb0017072f0608a7f818e3022ec07774 to your computer and use it in GitHub Desktop.
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/DesignWeek1.iml" filepath="$PROJECT_DIR$/DesignWeek1.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
<orderEntry type="library" name="scala-sdk-2.11.8" level="application" /> | |
</component> | |
</module> |
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 Book(title: String, authors: List[String]) | |
val books: List[Book] = List( | |
Book(title = "Structure and Interpretation of Computer Programs", | |
authors = List("Abelson, Harald", "Sussman, Gerald J.")), | |
Book(title = "Introduction to Functional Programming", | |
authors = List("Bird, Richard", "Wadler, Phil")), | |
Book(title = "Effective Java", | |
authors = List("Bloch, Joshua")), | |
Book(title = "Java Puzzlers", | |
authors = List("Bloch, Joshua", "Gafter, Neal")), | |
Book(title = "Programming in Scala", | |
authors = List("Odersky, Martin", "Spoon, Lex", "Venners, Bill"))) | |
for (b <- books; a <- b.authors if a startsWith "Bird,") | |
yield b.title | |
for (b <- books if b.title.indexOf("Program") >= 0) | |
yield b.title | |
for (b <- books if (b.title indexOf "Program") >= 0) | |
yield b.title | |
{ for { | |
b1 <- books | |
b2 <- books | |
if b1 != b2 | |
a1 <- b1.authors | |
a2 <- b2.authors | |
if a1 == a2 | |
} yield a1 }.distinct | |
val bookSet = books.toSet | |
for { | |
b1 <- bookSet | |
b2 <- bookSet | |
if b1 != b2 | |
a1 <- b1.authors | |
a2 <- b2.authors | |
if a1 == a2 | |
} yield a1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment