Scala Functional Programming

Scala Functional Programming

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

SBT Directory Structure

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (13)

Section 1

(13 cards)

SBT Directory Structure

Front

src/ main/ resources/ <files to include in main jar here> scala/ <main Scala sources> java/ <main Java sources> test/ resources <files to include in test jar here> scala/ <test Scala sources> java/ <test Java sources> Other directories in src/ will be ignored. Additionally, all hidden directories will be ignored.

Back

alternative

Front

A branch of a match expression. It has the form "case pattern => expression." Another name for alternative is case.

Back

Parallel Programming

Front

Execute programs fater ib parallel hardware

Back

Does Scala overload operator?

Front

No. Instead, Scala has characters such as +, -, *, and / can be used in method names

Back

Parameterize arrays with types

Front

When you instantiate an object in Scala, you can parameterize it with values and types.Parameterization means "configuring" an instance when you create it. Example: val big = new java.math.BigInteger("12345")

Back

The Challenge/Scala

Front

Back

Moore's Law

Front

the observation that computing power roughly doubles every two years.

Back

Scala

Front

Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative-programming and functional-programming styles. Its key features are: Static typing Advanced type system with type inference and declaration-site variance Function types (including anonymous) which support lexical closures Pattern-matching Implicit parameters and conversions which support the typeclass and enrich-my-library patterns Mixin composition Full interoperability with Java Powerful concurrency constructs Advanced language constructs such as delimited continuations and an experimental macro system steps, stairs, ladder

Back

The Root of Problem in Parallel Processing

Front

Back

Concurrent Programming

Front

a programming technique that allows a single processor to simultaneously execute multiple sets of instructions

Back

Space(functional/parallel) vc Time(Imperative/concurrent )

Front

Back

Use of lists

Front

Immutable sequence of objects that share the same type you canuse Scala's List class Example: val oneTwo = List(1, 2) val threeFour = List(3, 4) val oneTwoThreeFour = oneTwo ::: threeFour println(oneTwo + " and " + threeFour + " were not mutated.") println("Thus, " + oneTwoThreeFour + " is a new list.")

Back

Running/Testing your Code

Front

> run Multiple main classes detected, select one to run: > test [info] ListsSuite: .......

Back