TRINITY CSCI 2323 - Introduction to Scala

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Introduction to Scala4-19-2010Opening Discussion●Your presentations!–Pick a topics–Pick a dayLanguage Basics●Scala is a purely object-oriented, functional language–All values are objects–Functions are first-class values●Main implementation compiles to the JVM and allows seamless calls to Java libraries. Also have .NET implementation.●Compiler puts in primitives when possible for efficiency.REPL Stuff●If we run scala without arguments it drops us into the REPL.●In this mode we can interact much the same way we did with Matlab.●Let's play with this just a bit.–val, var, defSyntactic Sugar●Semicolon inference●Local type inference●Methods as operators–Optional dot–Optional parenthesesScripting●Run scala on a .scala file and it is run as a script.●You can even put in the #! at the top.Classes and Objects●You can also code Scala the way you would Java writing classes in files.●There are no static elements in Scala.●However, you can declare Objects that serve that purpose and more.Functional Aspects●The recommended style in Scala is functional.–val–Function literals–Pattern matching●Collections have normal functional methods on them.–Map, Filter, Reduce, Fold●Control structures all expressions except while.Regular Expressions●Strings have a method called r that produces a regular expression.●Triple quote strings make backslashes nicer.So Much More●Scala stands for scalable language.–Traits–Implicit conversions–Actor parallelism–Parsers–Partial functions–Pass-by-name–Lazy evaluationClosing Remarks●Next time we will hear from one of


View Full Document

TRINITY CSCI 2323 - Introduction to Scala

Documents in this Course
Load more
Download Introduction to Scala
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to Scala and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Scala 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?