GithubHelp home page GithubHelp logo

viskri / learn-scala-worksheets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnmurray/learn-scala-worksheets

0.0 1.0 0.0 35.54 MB

Some simple worksheets for walking through some basic Scala principals

Scala 97.54% Shell 0.18% SuperCollider 2.28%

learn-scala-worksheets's Introduction

Scala - Learning Worksheets

This project contains some worksheets to walk you through the introductory principles in Scala. The worksheets were written using the facilities available within IntelliJ, but they should work just as well with eclipse.

General Setup

  • Ensure that you have Java avaialble on your machine (java -version). Version 1.7 is preferred, but 1.6 will work as well. If you would like to upgrade to 1.7, you can download it from Oracle here.
  • Install SBT
    • SBT (Scala Build Tool) is very easily installed with brew. If you do not have brew installed, I recommend you do or install SBT manually.
    • brew install sbt
    • Already installed? brew upgrade sbt

Setup with IntelliJ

  • Download IntelliJ if needed (version 13 Community Edition recommended)
  • Install scala plugin (Preferences -> Plugins -> Browse Repositories -> install Scala)
  • Install Scala & SBT support
    • Add Repository: (Preferences -> Plugins -> Browse Repositories -> Manage Repositories)
      • http://www.jetbrains.com/idea/plugins/scala-nightly-cardea.xml
    • Install Plugin: (Preferences -> Plugins -> Browse Repositories -> install scala-intellij-bin)
  • git clone git://github.com/JohnMurray/learn-scala-worksheets.git $CHECKOUT_DIR
  • Import Project from $CHECKOUT_DIR
  • Select Import from External Model and SBT project as your import options
  • Check Use auto-import

Depending on if you have setup IntelliJ for scala development before, you may need to specify a JDK for your project. Once you have the project open, you can do this buy:

  • Open your project preferences
    • Mac: Command + ;
    • Windows: ctrl + shift + alt + s
  • Go to 'Project' and ensure that you have a 'Project SDK' defined
  • If not, create a new one and select the JDK directory (should open up there by default)
  • Go to 'Modules' and ensure that all modules have a JDK defined under the 'Dependencies' tab
  • If not, set to same one as project settings
  • Click 'Apply' and 'OK'
  • Try to run worksheet again

Setup with Eclipse

When you import worksheets into Eclipse, it doesn't seem to recognize them as worksheets. You'll notice that, with eclipse, when you create a new worksheet it creates a copy in the .worksheet directory containing a modified source. I'm not certain how to convince Eclipse to generate this folder on import. If you know a way, please send a pull-request.

Running the Worksheets

Once you open up your project, you should be able to open a worksheet (eg. src/main/scala/worksheet/0_0_Basics.sc) and click the green play button directly above the file-window (not the same as the play/run button for the project).

Running the Future / Akka Examples

If you make it to the end of the worksheets, you'll notice that there is a seperate directory containing examples of Scala Futures and Akka Actors. These cannot (or more likely should not) be run within the context of the worksheets. That being said, you can easily run these by using the run command in the root directory (./run) or by entering the sbt console and issuing the run command:

$learn-scala-worksheets $> sbt

# starting sbt console . . . 
sbt > run

Using the run script in the root directory will invoke SBT which has a pretty decent start-up-time. To avoid that, you are better off using the sbt command to enter into the interactive console. Note that when you are in the interactive console, you don't need to issue any type of recompile command as SBT will already see that files have changed and re-compile when you type run.

learn-scala-worksheets's People

Contributors

johnmurray avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.