jagomart
digital resources
picture1_Jispdr Scala1


 181x       Filetype PDF       File size 1.65 MB       Source: coach.kis.p.lodz.pl


File: Jispdr Scala1
jzyki i rodowiska przetwarzania danych rozproszonych scala 1 szymon grabowski sgrabow kis p lodz pl based mostly on c horstmann scala for the impatient 2012 m odersky et al programming ...

icon picture PDF Filetype PDF | Posted on 05 Feb 2023 | 2 years ago
Partial capture of text on file.
                    Języki i środowiska 
                  przetwarzania danych 
                         rozproszonych 
                                          
                                   Scala 1 
                           Szymon Grabowski 
                               sgrabow@kis.p.lodz.pl  
            Based mostly on: 
            C. Horstmann, Scala for the Impatient, 2012 
            M. Odersky et al., Programming in Scala, 2nd Ed., 2010  
            and http://www.cs.columbia.edu/~bauer/cs3101-2/ 
                                    Łódź, 2016                           1 
                               Install 
     www.scala-lang.org/downloads 
     http://www.scala-sbt.org/download.html (SBT is a build tool) 
      
     scala -version     //  scala[.bat] – opens the REPL 
     compiler: scalac  
      
     scala> 12 * 11.9 
     res0: Double = 142.8 
     scala> :quit  // or :q 
      
     // ScriptDemo.scala 
     println("Hello, Scala!") 
      
     To execute a script: 
     scala ScriptDemo.scala                                   2 
                            val and var 
                      val (=value) is immutable 
                      var (=variable) is mutable 
               If possible, prefer values over variables! 
     val x = 5              Type inference: 
     // x = 2  // ERROR! 
     val x1, x2 = 20        from the init with e.g. 5 Scala ‘knows’ 
                            that our value is of type Int. 
     Or:                    Same with Double, String, Vector… 
     val x: Int = 5; val y: Double = -3.2; 
      
     val anotherDouble = -3.2 
     val text = "Hello"  // or: val text: String = "Hello" 
     var x = 3.5; x = -1                                      3 
                        Some more types 
                         Boolean: true | false 
                        val keyKnown = false 
                       val ok: Boolean = true 
                     Vector – a popular container 
                scala.collection.immutable.Vector[…] 
     val v = Vector(3, 2, 10, 5)    val r1 = Range(5, 8)  // 5, 6, 7 
     var v2 = v.sorted              val r2 = Range(5, 8).inclusive 
     println(v2)                                  //  5, 6, 7, 8 
     // v(0) = -1  // ERROR 
     v2 = v2.reverse  // it’s a method call! 
     println(v2) 
     val v3 = v updated(1, 99)  // Vector(3, 99, 10, 5)        4 
The words contained in this file might help you see if this file matches what you are looking for:

...Jzyki i rodowiska przetwarzania danych rozproszonych scala szymon grabowski sgrabow kis p lodz pl based mostly on c horstmann for the impatient m odersky et al programming in nd ed and http www cs columbia edu bauer od install lang org downloads sbt download html is a build tool version opens repl compiler scalac res double quit or q scriptdemo println hello to execute script val var value immutable variable mutable if possible prefer values over variables x type inference error from init with e g knows that our of int same string vector y anotherdouble text some more types boolean true false keyknown ok popular container collection v r range sorted inclusive reverse it s method call updated...

no reviews yet
Please Login to review.