sprint1.md
This commit is contained in:
commit
042bef2dcb
31 changed files with 837 additions and 0 deletions
5
.idea/codeStyles/codeStyleConfig.xml
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
9
.idea/hydra.xml
Normal file
9
.idea/hydra.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="HydraSettings">
|
||||
<option name="hydraStorePath" value="$PROJECT_DIR$/.hydra/idea" />
|
||||
<option name="noOfCores" value="2" />
|
||||
<option name="projectRoot" value="$PROJECT_DIR$" />
|
||||
<option name="sourcePartitioner" value="auto" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="sbt: org.scala-lang.modules:scala-xml_2.12:1.0.6:jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/srcs/scala-xml_2.12-1.0.6-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,20 @@
|
|||
<component name="libraryTable">
|
||||
<library name="sbt: org.scala-lang:scala-library:2.12.6:jar" type="Scala">
|
||||
<properties>
|
||||
<compiler-classpath>
|
||||
<root url="file://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/jline.jar" />
|
||||
<root url="file://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-compiler.jar" />
|
||||
<root url="file://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-library.jar" />
|
||||
<root url="file://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-reflect.jar" />
|
||||
<root url="file://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-xml_2.12.jar" />
|
||||
</compiler-classpath>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-library.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-library/srcs/scala-library-2.12.6-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="sbt: org.scala-lang:scala-reflect:2.12.6:jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-reflect.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-reflect/srcs/scala-reflect-2.12.6-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="sbt: org.scalactic:scalactic_2.12:3.0.5:jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scalactic/scalactic_2.12/bundles/scalactic_2.12-3.0.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scalactic/scalactic_2.12/srcs/scalactic_2.12-3.0.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="sbt: org.scalatest:scalatest_2.12:3.0.5:jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scalatest/scalatest_2.12/bundles/scalatest_2.12-3.0.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ivy2/cache/org.scalatest/scalatest_2.12/srcs/scalatest_2.12-3.0.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
78
.idea/markdown-navigator.xml
Normal file
78
.idea/markdown-navigator.xml
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MarkdownProjectSettings" wasCopied="false">
|
||||
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true" replaceUnicodeEmoji="false" lastLayoutSetsDefault="false">
|
||||
<PanelProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
|
||||
</PanelProvider>
|
||||
</PreviewSettings>
|
||||
<ParserSettings gitHubSyntaxChange="false" emojiShortcuts="1" emojiImages="0">
|
||||
<PegdownExtensions>
|
||||
<option name="ABBREVIATIONS" value="false" />
|
||||
<option name="ANCHORLINKS" value="true" />
|
||||
<option name="ASIDE" value="false" />
|
||||
<option name="ATXHEADERSPACE" value="true" />
|
||||
<option name="AUTOLINKS" value="true" />
|
||||
<option name="DEFINITIONS" value="false" />
|
||||
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
|
||||
<option name="FENCED_CODE_BLOCKS" value="true" />
|
||||
<option name="FOOTNOTES" value="false" />
|
||||
<option name="HARDWRAPS" value="false" />
|
||||
<option name="HTML_DEEP_PARSER" value="false" />
|
||||
<option name="INSERTED" value="false" />
|
||||
<option name="QUOTES" value="false" />
|
||||
<option name="RELAXEDHRULES" value="true" />
|
||||
<option name="SMARTS" value="false" />
|
||||
<option name="STRIKETHROUGH" value="true" />
|
||||
<option name="SUBSCRIPT" value="false" />
|
||||
<option name="SUPERSCRIPT" value="false" />
|
||||
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
|
||||
<option name="SUPPRESS_INLINE_HTML" value="false" />
|
||||
<option name="TABLES" value="true" />
|
||||
<option name="TASKLISTITEMS" value="true" />
|
||||
<option name="TOC" value="false" />
|
||||
<option name="WIKILINKS" value="true" />
|
||||
</PegdownExtensions>
|
||||
<ParserOptions>
|
||||
<option name="ADMONITION_EXT" value="false" />
|
||||
<option name="ATTRIBUTES_EXT" value="false" />
|
||||
<option name="COMMONMARK_LISTS" value="true" />
|
||||
<option name="DUMMY" value="false" />
|
||||
<option name="EMOJI_SHORTCUTS" value="true" />
|
||||
<option name="ENUMERATED_REFERENCES_EXT" value="false" />
|
||||
<option name="FLEXMARK_FRONT_MATTER" value="false" />
|
||||
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
|
||||
<option name="GFM_TABLE_RENDERING" value="true" />
|
||||
<option name="GITBOOK_URL_ENCODING" value="false" />
|
||||
<option name="GITHUB_LISTS" value="false" />
|
||||
<option name="GITHUB_WIKI_LINKS" value="true" />
|
||||
<option name="HEADER_ID_NO_DUPED_DASHES" value="false" />
|
||||
<option name="JEKYLL_FRONT_MATTER" value="false" />
|
||||
<option name="NO_TEXT_ATTRIBUTES" value="false" />
|
||||
<option name="PARSE_HTML_ANCHOR_ID" value="false" />
|
||||
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
|
||||
</ParserOptions>
|
||||
</ParserSettings>
|
||||
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false" imageUriSerials="false">
|
||||
<GeneratorProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
|
||||
</GeneratorProvider>
|
||||
<headerTop />
|
||||
<headerBottom />
|
||||
<bodyTop />
|
||||
<bodyBottom />
|
||||
</HtmlSettings>
|
||||
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="true" isCssTextEnabled="false" isDynamicPageWidth="true">
|
||||
<StylesheetProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
|
||||
</StylesheetProvider>
|
||||
<ScriptProviders />
|
||||
<cssText />
|
||||
<cssUriHistory />
|
||||
</CssSettings>
|
||||
<HtmlExportSettings updateOnSave="false" parentDir="" targetDir="" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
|
||||
<LinkMapSettings>
|
||||
<textMaps />
|
||||
</LinkMapSettings>
|
||||
</component>
|
||||
</project>
|
3
.idea/markdown-navigator/profiles_settings.xml
Normal file
3
.idea/markdown-navigator/profiles_settings.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<component name="MarkdownNavigator.ProfileManager">
|
||||
<settings default="" pdf-export="" />
|
||||
</component>
|
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
9
.idea/modules.xml
Normal file
9
.idea/modules.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/course.iml" filepath="$PROJECT_DIR$/.idea/modules/course.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/course-build.iml" filepath="$PROJECT_DIR$/.idea/modules/course-build.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
104
.idea/modules/course-build.iml
Normal file
104
.idea/modules/course-build.iml
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="course-build" external.linked.project.path="$MODULE_DIR$/../../project" external.root.project.path="$MODULE_DIR$/../.." external.system.id="SBT" sbt.imports="_root_.sbt.Keys._, _root_.sbt._, _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin, _root_.sbt.plugins.Giter8TemplatePlugin, _root_.scala.xml.{TopScope=>SUB:DOLLARscope}" sbt.resolvers="http://192.168.2.100:8082/artifactory/dripower/|maven|dripower-release, http://192.168.2.100:8082/artifactory/dripower-snapshot/|maven|dripower-snapshot, http://192.168.2.100:8082/artifactory/remote-repos/|maven|dripower-maven-proxy, /Users/rhyme/.ivy2/cache|ivy|Local cache" type="SBT_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/../../project/target/idea-classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../../project/target/idea-test-classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../project">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../project" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../project/project/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../project/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="sbt: sbt-and-plugins">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/jline.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-compiler.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-library.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-reflect.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/lib/scala-xml_2.12.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/actions_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/apple-file-events-1.3.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/caffeine-2.5.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/collections_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/command_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/compiler-interface-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/completion_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/config-1.2.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/core-macros_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/disruptor-3.3.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/fastparse-utils_2.12-0.4.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/fastparse_2.12-0.4.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/gigahorse-core_2.12-0.3.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/gigahorse-okhttp_2.12-0.3.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/io_2.12-1.1.10.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/ipcsocket-1.0.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/ivy-2.3.0-sbt-b18f59ea3bc914a297bb6f1a4f7fb0ace399e310.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/jawn-parser_2.12-0.10.4.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/jline-2.14.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/jna-4.5.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/jna-platform-4.5.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/jsch-0.1.54.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/launcher-interface-1.0.4.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/lenses_2.12-0.4.12.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/librarymanagement-core_2.12-1.1.5.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/librarymanagement-ivy_2.12-1.1.5.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/log4j-api-2.8.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/log4j-core-2.8.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/log4j-slf4j-impl-2.8.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/logic_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/main-settings_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/main_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/okhttp-3.7.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/okhttp-urlconnection-3.7.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/okio-1.12.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/protobuf-java-3.3.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/protocol_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/reactive-streams-1.0.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/run_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sbinary_2.12-0.4.4.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sbt-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scala-parser-combinators_2.12-1.0.5.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scala-reflect-2.12.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scala-xml_2.12-1.0.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scalacache-caffeine_2.12-0.20.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scalacache-core_2.12-0.20.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/scalapb-runtime_2.12-0.6.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/shaded-scalajson_2.12-1.0.0-M4.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sjson-new-core_2.12-0.8.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sjson-new-murmurhash_2.12-0.8.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sjson-new-scalajson_2.12-0.8.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/slf4j-api-1.7.25.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/sourcecode_2.12-0.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/ssl-config-core_2.12-0.2.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/task-system_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/tasks_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/template-resolver-0.1.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/test-agent-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/test-interface-1.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/testing_2.12-1.1.6.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-cache_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-control_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-interface-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-logging_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-position_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-relation_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/util-tracking_2.12-1.1.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-apiinfo_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-classfile_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-classpath_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-compile-core_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-compile_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-core_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-ivy-integration_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc-persist_2.12-1.1.7.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/zinc_2.12-1.1.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
22
.idea/modules/course.iml
Normal file
22
.idea/modules/course.iml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="course" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="SBT" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/../../target/scala-2.12/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../../target/scala-2.12/test-classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../..">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/scala" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/scala" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../target/scala-2.12/src_managed/main" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../target/scala-2.12/src_managed/test" isTestSource="true" generated="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="sbt: org.scala-lang:scala-library:2.12.6:jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="sbt: org.scalactic:scalactic_2.12:3.0.5:jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="sbt: org.scala-lang:scala-reflect:2.12.6:jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="sbt: org.scala-lang.modules:scala-xml_2.12:1.0.6:jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="sbt: org.scalatest:scalatest_2.12:3.0.5:jar" level="project" />
|
||||
</component>
|
||||
</module>
|
18
.idea/sbt.xml
Normal file
18
.idea/sbt.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ScalaSbtSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<SbtProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/project" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="sbtVersion" value="1.1.6" />
|
||||
<option name="useAutoImport" value="true" />
|
||||
</SbtProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
6
.idea/scala_compiler.xml
Normal file
6
.idea/scala_compiler.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ScalaCompilerConfiguration">
|
||||
<profile name="sbt 1" modules="course" />
|
||||
</component>
|
||||
</project>
|
7
.idea/scala_settings.xml
Normal file
7
.idea/scala_settings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WorksheetDefaultProjectSettings">
|
||||
<option name="compilerProfileName" value="Default" />
|
||||
<option name="moduleName" value="course" />
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
7
build.sbt
Normal file
7
build.sbt
Normal file
|
@ -0,0 +1,7 @@
|
|||
name := "course"
|
||||
|
||||
version := "0.1"
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.scalatest" % "scalatest_2.12" % "3.0.5" % "test"
|
1
project/build.properties
Normal file
1
project/build.properties
Normal file
|
@ -0,0 +1 @@
|
|||
sbt.version = 1.1.6
|
106
src/docs/sprint.md
Normal file
106
src/docs/sprint.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
## 1.列举Scala的主要特性
|
||||
|
||||
### 1. 伴生对象以及apply()方法
|
||||
### 2. 变长参数
|
||||
### 3. 柯里化函数与部分应用
|
||||
### 4. Option
|
||||
### 5. 函数组合子
|
||||
### 6. 偏函数
|
||||
### 7. 类型推断
|
||||
### 8. 函数是一等公民(函数和其他基本类型地位相等,可以做为参数传入,也可以作为返回值返回)
|
||||
|
||||
## 2.静态类型、动态类型、强类型、弱类型如何理解
|
||||
|
||||
### 静态类型
|
||||
>在编译时就能确定的类型
|
||||
### 动态类型
|
||||
>泛型与多态
|
||||
### 强类型
|
||||
>不容忍隐式类型转换
|
||||
### 弱类型
|
||||
>容忍隐式类型转换
|
||||
|
||||
## 3.什么是纯函数/引用透明性
|
||||
|
||||
纯函数值的是函数和外界沟通的方式只有参数和返回值
|
||||
|
||||
以下的foo函数不是纯函数
|
||||
|
||||
```scala
|
||||
class A {
|
||||
private var a = 0
|
||||
|
||||
def foo() = {
|
||||
a = a + 1
|
||||
0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 4.简述数学意义上集合、映射、函数、域和值域的概念,以及编程意义上函数与其对应关系
|
||||
|
||||
### 4.1 数学意义上
|
||||
|
||||
>集合:存放元素的容器
|
||||
|
||||
>映射:f(x) = y
|
||||
|
||||
>函数:f(x) = x^2
|
||||
|
||||
>域:定义域
|
||||
|
||||
>值域:函数的实际输出集合
|
||||
|
||||
### 4.2 编程意义上的函数意义
|
||||
|
||||
编程意义上的函数参数对应定义域,函数的返回值组成的集合对应数学中函数的值域
|
||||
|
||||
## 5. 简述函数式编程和指令式以及面向对象的关联、区别
|
||||
|
||||
### 5.1 函数式编程
|
||||
|
||||
>将运算过程定义为一系列嵌套的函数调用
|
||||
|
||||
#### 1. 函数是一等公民
|
||||
>函数和其他基本类型一样,地位是相等的,可以作为参数传入和返回
|
||||
#### 2. 只用表达式,不用语句
|
||||
>表达式是单纯的计算,总是有返回值,函数式编程要求只使用表达式,并可以得到每一步的返回值
|
||||
#### 3. 没有副作用
|
||||
>函数式编程强调纯函数,就是函数设计要独立,不能对外界造成影响
|
||||
#### 4. 不修改状态
|
||||
>函数不修改变量,变量负责保存状态
|
||||
#### 5. 依赖透明
|
||||
>函数的运行只与传入的参数相关,与外部不相关,相同的参数,应该得到相同的结果
|
||||
|
||||
#### 6. 函数式编程的好处
|
||||
|
||||
1. 代码简洁,开发迅速,代码重用度高
|
||||
2. 接近自然语言,利于理解
|
||||
3. 利于并发编程和热升级和代码管理(由于每一个函数都可以看做是一个独立的单元,因此也就能够很容易的执行管理)
|
||||
|
||||
## 6. 简述高阶函数,高阶类型,类型构造器
|
||||
|
||||
### 6.1 高阶函数
|
||||
>接受函数参数或返回一个函数的函数,简单来说就是能够操纵其他函数
|
||||
### 6.2 高阶类型
|
||||
>和高阶函数同理,高阶类型值的是接受其他类型构造出来的新类型,可以用于简化类型
|
||||
### 6.3 类型构造器
|
||||
>类型构造器原理和函数相似,只不过类型构造器处理的是类型,在函数中,我传入一个a,返回一个b,在类型构造器中,我传入一个类型,返回一个类型
|
||||
|
||||
## 7. 什么是non-strict/strict
|
||||
|
||||
### 7.1 strict
|
||||
|
||||
>在调用函数时,先对参数进行计算再传入,会对计算过的参数进行缓存
|
||||
|
||||
### 7.2 non-strict
|
||||
|
||||
>直接传入参数,在函数内部使用到参数时,再对参数进行计算,不会对计算过的参数进行缓存
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
47
src/main/scala/Chapter1-Basic.sc
Normal file
47
src/main/scala/Chapter1-Basic.sc
Normal file
|
@ -0,0 +1,47 @@
|
|||
//匿名函数
|
||||
val addOne = (i: Int) => i + 1
|
||||
addOne(1)
|
||||
def test2(i: Int): Int = {
|
||||
print("test")
|
||||
i + 1
|
||||
}
|
||||
test2(2)
|
||||
|
||||
//部分应用
|
||||
def add(m: Int, n: Int): Int = {
|
||||
m * n
|
||||
}
|
||||
|
||||
val add2 = add(3, _: Int)
|
||||
add2(3)
|
||||
|
||||
//柯里化函数
|
||||
def multiBy(m: Int)(n: Int): Int = {
|
||||
m * n
|
||||
}
|
||||
|
||||
multiBy(2)(3)
|
||||
|
||||
val first = multiBy(2) _
|
||||
first(3)
|
||||
|
||||
//可变长度参数
|
||||
|
||||
def testAll(args: String*): Seq[String] = {
|
||||
args map (arg => arg.toUpperCase())
|
||||
}
|
||||
|
||||
testAll(args = "string", "hello")
|
||||
|
||||
//类
|
||||
class Person {
|
||||
val name: String = "Rhyme"
|
||||
|
||||
def add(m: Int, n: Int): Int = {
|
||||
m + n
|
||||
}
|
||||
}
|
||||
|
||||
val person = new Person
|
||||
person.name
|
||||
|
73
src/main/scala/Chapter2-Basic-2.sc
Normal file
73
src/main/scala/Chapter2-Basic-2.sc
Normal file
|
@ -0,0 +1,73 @@
|
|||
//apply方法
|
||||
class Person {
|
||||
var name: String = "Hello"
|
||||
|
||||
def apply(str: String): Person = {
|
||||
new Person
|
||||
}
|
||||
}
|
||||
|
||||
val person = new Person
|
||||
person.name
|
||||
|
||||
//单例对象
|
||||
object Timer {
|
||||
var count = 0
|
||||
|
||||
def increase(): Int = {
|
||||
count += 1
|
||||
count
|
||||
}
|
||||
}
|
||||
|
||||
Timer.increase()
|
||||
Timer.increase()
|
||||
|
||||
class Student(_name: String) {
|
||||
var name = _name
|
||||
}
|
||||
|
||||
object Student {
|
||||
def apply(name: String): Student = new Student(name)
|
||||
}
|
||||
|
||||
val s = Student("Rhyme")
|
||||
s.name
|
||||
|
||||
//函数即是对象
|
||||
class addOne extends (Int => Int) {
|
||||
def apply(m: Int): Int = m + 1
|
||||
}
|
||||
|
||||
val a = new addOne
|
||||
a(1)
|
||||
|
||||
//模式匹配
|
||||
val times = 1
|
||||
times match {
|
||||
case 1 => "One"
|
||||
case 2 => "Two"
|
||||
case 3 => "Three"
|
||||
case _ => "Others"
|
||||
}
|
||||
|
||||
//带有守卫的模式匹配
|
||||
times match {
|
||||
case i if i == 1 => "One"
|
||||
case i if i == 2 => "Two"
|
||||
case _ => "Others"
|
||||
}
|
||||
|
||||
//模式匹配匹配类型
|
||||
|
||||
def matchType(o: Any): Any = {
|
||||
o match {
|
||||
case i: Int => i + " Int"
|
||||
case text: String => text + " String"
|
||||
case _ => "Other Types"
|
||||
}
|
||||
}
|
||||
|
||||
matchType(2)
|
||||
|
||||
|
15
src/main/scala/Chapter3-Basic-3.sc
Normal file
15
src/main/scala/Chapter3-Basic-3.sc
Normal file
|
@ -0,0 +1,15 @@
|
|||
//样本类
|
||||
case class Person(name: String, age: Int)
|
||||
|
||||
var person = Person("Rhyme", 30)
|
||||
person.name
|
||||
|
||||
//使用样本类进行模式匹配
|
||||
def matchPerson(person: Person): String = person match {
|
||||
case Person("Rhyme", 30) => "young boy"
|
||||
case Person("Rhyme", 10) => "Children"
|
||||
case _ => "Others"
|
||||
}
|
||||
|
||||
matchPerson(Person("Rhyme", 30))
|
||||
|
64
src/main/scala/Chapter4-Collection-1.sc
Normal file
64
src/main/scala/Chapter4-Collection-1.sc
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Array 可变 可以包含重复项
|
||||
val array = Array(1, 2, 3, 4)
|
||||
array(1) = 5
|
||||
array
|
||||
// Set 不可变 不包含重复项
|
||||
val set = Set(1, 2, 3, 4)
|
||||
//set(1) = 5
|
||||
|
||||
//Tuple元组
|
||||
val tuple = ("Rhyme", 20)
|
||||
tuple._1
|
||||
tuple._2
|
||||
|
||||
//元组很适合用在模式匹配上
|
||||
|
||||
val simple_tuple = 1 -> 2
|
||||
|
||||
//Option
|
||||
|
||||
val map = Map("Rhyme" -> 20, "Chiang" -> 30)
|
||||
val res = map.get("Rhyme")
|
||||
map.getOrElse("Rhyme", -1)
|
||||
|
||||
// Option类天然的适合模式匹配
|
||||
res match {
|
||||
case Some(n) => n
|
||||
case None => -1
|
||||
}
|
||||
|
||||
//函数组句子
|
||||
val list = List(1, 2, 3, 4)
|
||||
list map ((i: Int) => i * 2)
|
||||
|
||||
def timesTwo(i: Int): Int = {
|
||||
i * 2
|
||||
}
|
||||
|
||||
list map timesTwo
|
||||
|
||||
//foreach
|
||||
list foreach ((i: Int) => i * 2)
|
||||
|
||||
list
|
||||
|
||||
list filter ((i: Int) => i > 0)
|
||||
|
||||
//zip
|
||||
val a = List(1, 2, 3, 4)
|
||||
val c = List(5, 6, 7, 8)
|
||||
val b = List("a", "b", "c", "d")
|
||||
a.zip(b)
|
||||
|
||||
//partition
|
||||
list.partition(_ % 2 == 0)
|
||||
|
||||
//find
|
||||
list.find(_ % 2 == 0)
|
||||
|
||||
//flatten
|
||||
val f = List(a, b).flatten
|
||||
|
||||
//flatten map
|
||||
List(a, c).flatMap(x => x map (_ * 2))
|
||||
|
1
src/main/scala/Chapter5-matcher-function-compose.sc
Normal file
1
src/main/scala/Chapter5-matcher-function-compose.sc
Normal file
|
@ -0,0 +1 @@
|
|||
// 模式匹配和函数组合
|
5
src/main/scala/Test.scala
Normal file
5
src/main/scala/Test.scala
Normal file
|
@ -0,0 +1,5 @@
|
|||
object Test {
|
||||
def main(args: Array[String]): Unit = {
|
||||
println("pppp")
|
||||
}
|
||||
}
|
0
src/main/scala/test.md
Normal file
0
src/main/scala/test.md
Normal file
30
src/test.md
Normal file
30
src/test.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
## 列举Scala的主要特性
|
||||
|
||||
### 1. 伴生对象以及apply()方法
|
||||
### 2. 变长参数
|
||||
### 3. 柯里化函数与部分应用
|
||||
### 4. Option
|
||||
### 5. 函数组合子
|
||||
### 6. 偏函数
|
||||
### 7. 类型推断åå
|
||||
|
||||
## 静态类型、动态类型、强类型、弱类型如何理解
|
||||
|
||||
### 静态类型
|
||||
>在编译时就能确定的类型
|
||||
### 动态类型
|
||||
>泛型与多态
|
||||
### 强类型
|
||||
>不容忍隐式类型转换
|
||||
### 弱类型
|
||||
>容忍隐式类型转换
|
||||
|
||||
|
||||
## 什么是纯函数/引用透明性
|
||||
|
||||
纯函数值的是函数和外界沟通的方式只有参数和返回值
|
||||
|
||||
|
||||
|
||||
|
||||
|
21
src/test/scala/com/rhyme/MySpec.scala
Normal file
21
src/test/scala/com/rhyme/MySpec.scala
Normal file
|
@ -0,0 +1,21 @@
|
|||
package com.rhyme
|
||||
|
||||
import collection.mutable.Stack
|
||||
import org.scalatest._
|
||||
|
||||
class MySpec extends FlatSpec {
|
||||
"A Stack" should "pop values in last-in-first-out order" in {
|
||||
val stack = new Stack[Int]
|
||||
stack.push(1)
|
||||
stack.push(2)
|
||||
assert(stack.pop() === 2)
|
||||
assert(stack.pop() === 1)
|
||||
}
|
||||
|
||||
it should "throw NoSuchElementException if an empty stack is popped" in {
|
||||
val emptyStack = new Stack[String]
|
||||
assertThrows[NoSuchElementException] {
|
||||
emptyStack.pop()
|
||||
}
|
||||
}
|
||||
}
|
6
src/test/scala/com/rhyme/UnitSpec.scala
Normal file
6
src/test/scala/com/rhyme/UnitSpec.scala
Normal file
|
@ -0,0 +1,6 @@
|
|||
package com.rhyme
|
||||
|
||||
import org.scalatest._
|
||||
|
||||
abstract class UnitSpec extends FlatSpec with Matchers with
|
||||
OptionValues with Inside with Inspectors
|
Loading…
Reference in a new issue