Edited, memorised or added to reading list

on 11-Jan-2015 (Sun)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

#odersky-programming-in-scala-1ed #scala
You can't reassign vals
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

First Steps in Scala
rintln function prints the passed string to the standard output, similar to System.out.println in Java. Step 2. Define some variables [link] Scala has two kinds of variables, vals and vars. A val is similar to a final variable in Java. <span>Once initialized, a val can never be reassigned. A var, by contrast, is similar to a non-final variable in Java. A var can be reassigned throughout its lifetime. Here's a val definition: scala> val msg = "Hello, world!&quo




Flashcard 149661842

Tags
#odersky-programming-in-scala-1ed #scala
Question
You can't reassign [vars or vals]
Answer
vals

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
You can't reassign vals

Original toplevel document

First Steps in Scala
rintln function prints the passed string to the standard output, similar to System.out.println in Java. Step 2. Define some variables [link] Scala has two kinds of variables, vals and vars. A val is similar to a final variable in Java. <span>Once initialized, a val can never be reassigned. A var, by contrast, is similar to a non-final variable in Java. A var can be reassigned throughout its lifetime. Here's a val definition: scala> val msg = "Hello, world!&quo







#odersky-programming-in-scala-1ed #scala
the first element in a Scala array named steps is steps(0) , not steps[0] , as in Java.
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

First Steps in Scala
nother greeting: Hello, world, from a script! Command line arguments to a Scala script are available via a Scala array named args. In Scala, arrays are zero based, and you access an element by specifying an index in parentheses. So <span>the first element in a Scala array named steps is steps(0), not steps[0], as in Java. To try this out, type the following into a new file named helloarg.scala: // Say hello to the first argument println("Hello, "+ args(0) +"!") then run:




Flashcard 149661879

Tags
#odersky-programming-in-scala-1ed #scala
Question
What does to stand for in this example?

for (i <- 0 to 2)
  print(greetStrings(i))
Answer
a method call (0).to(2)
if a method takes only one parameter, you can call it without a dot or parentheses.

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Next Steps in Scala
t reassign greetStrings to a different array; greetStrings will always point to the same Array[String] instance with which it was initialized. But you can change the elements of that Array[String] over time, so the array itself is mutable. <span>The final two lines in Listing 3.1 contain a for expression that prints out each greetStrings array element in turn: for (i <- 0 to 2) print(greetStrings(i)) The first line of code in this for expression illustrates another general rule of Scala: if a method takes only one parameter, you can call it without a dot or parentheses. The to in this example is actually a method that takes one Int argument. The code 0 to 2 is transformed into the method call (0).to(2).[1] Note that this syntax only works if you explicitly specify the receiver of the method call. You cannot write "println 10", but you can write "Console println 10&quot







#odersky-programming-in-scala-1ed #scala
You cannot write " println 10 ", but you can write " Console println 10 ".
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Next Steps in Scala
rentheses. The to in this example is actually a method that takes one Int argument. The code 0 to 2 is transformed into the method call (0).to(2).[1] Note that this syntax only works if you explicitly specify the receiver of the method call. <span>You cannot write "println 10", but you can write "Console println 10". Scala doesn't technically have operator overloading, because it doesn't actually have operators in the traditional sense. Instead, characters such as +, -, *, and / can be used in method




Flashcard 149661893

Tags
#odersky-programming-in-scala-1ed #scala
Question
What does + really stand for in 2 + 3?
Answer
it is a method call: (2).+(3)
method is named "+"

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Next Steps in Scala
n write "Console println 10". Scala doesn't technically have operator overloading, because it doesn't actually have operators in the traditional sense. Instead, characters such as +, -, *, and / can be used in method names. Thus, <span>when you typed 1 + 2 into the Scala interpreter in Step 1, you were actually invoking a method named + on the Int object 1, passing in 2 as a parameter. As illustrated in Figure 3.1, you could alternatively have written 1 + 2 using traditional method invocation syntax, (1).+(2). Figure 3.1 - All operations are method calls in Scala. Another important idea illustrated by this example will give you insight into why arrays are accessed with parentheses in Scala







#odersky-programming-in-scala-1ed #scala
So greetStrings(i) gets transformed into greetStrings.apply(i) .
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Next Steps in Scala
an Java. Arrays are simply instances of classes like any other class in Scala. When you apply parentheses surrounding one or more values to a variable, Scala will transform the code into an invocation of a method named apply on that variable. <span>So greetStrings(i) gets transformed into greetStrings.apply(i). Thus accessing an element of an array in Scala is simply a method call like any other. This principle is not restricted to arrays: any application of an object to some arguments in paren




Flashcard 149661919

Tags
#odersky-programming-in-scala-1ed #scala
Question
So greetStrings(i) gets transformed into [...] .
Answer
greetStrings.apply(i)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
So greetStrings(i) gets transformed into greetStrings.apply(i) .

Original toplevel document

Next Steps in Scala
an Java. Arrays are simply instances of classes like any other class in Scala. When you apply parentheses surrounding one or more values to a variable, Scala will transform the code into an invocation of a method named apply on that variable. <span>So greetStrings(i) gets transformed into greetStrings.apply(i). Thus accessing an element of an array in Scala is simply a method call like any other. This principle is not restricted to arrays: any application of an object to some arguments in paren







#odersky-programming-in-scala-1ed #scala
accessing an element of an array in Scala is simply a method call like any other. This principle is not restricted to arrays: any application of an object to some arguments in parentheses will be transformed to an apply method call. Of course this will compile only if that type of object actually defines an apply method.
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Next Steps in Scala
in Scala. When you apply parentheses surrounding one or more values to a variable, Scala will transform the code into an invocation of a method named apply on that variable. So greetStrings(i) gets transformed into greetStrings.apply(i). Thus <span>accessing an element of an array in Scala is simply a method call like any other. This principle is not restricted to arrays: any application of an object to some arguments in parentheses will be transformed to an apply method call. Of course this will compile only if that type of object actually defines an apply method. So it's not a special case; it's a general rule. Similarly, when an assignment is made to a variable to which parentheses and one or more arguments have been applied, the compiler wil




#odersky-programming-in-scala-1ed #scala
Similarly, when an assignment is made to a variable to which parentheses and one or more arguments have been applied, the compiler will transform that into an invocation of an update method that takes the arguments in parentheses as well as the object to the right of the equals sign.
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Next Steps in Scala
plication of an object to some arguments in parentheses will be transformed to an apply method call. Of course this will compile only if that type of object actually defines an apply method. So it's not a special case; it's a general rule. <span>Similarly, when an assignment is made to a variable to which parentheses and one or more arguments have been applied, the compiler will transform that into an invocation of an update method that takes the arguments in parentheses as well as the object to the right of the equals sign. For example: greetStrings(0) = "Hello" will be transformed into: greetStrings.update(0, "Hello") Thus, the following is semantically equivalent t




#odersky-programming-in-scala-1ed #scala
greetStrings( 0 ) = "Hello" 

will be transformed into:

 greetStrings.update( 0 , "Hello" )
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Next Steps in Scala
parentheses and one or more arguments have been applied, the compiler will transform that into an invocation of an update method that takes the arguments in parentheses as well as the object to the right of the equals sign. For example: <span>greetStrings(0) = "Hello" will be transformed into: greetStrings.update(0, "Hello") Thus, the following is semantically equivalent to the code in Listing 3.1: val greetStrings = new Array[String](3) greetStrings.update(0, "Hello") greetStrings.updat




Flashcard 149661939

Tags
#odersky-programming-in-scala-1ed #scala
Question
greetStrings( 0 ) = "Hello" 

will be transformed into:

 [...]
Answer
greetStrings.update( 0 , "Hello" )

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
greetStrings( 0 ) = "Hello" will be transformed into: greetStrings.update( 0 , "Hello" )

Original toplevel document

Next Steps in Scala
parentheses and one or more arguments have been applied, the compiler will transform that into an invocation of an update method that takes the arguments in parentheses as well as the object to the right of the equals sign. For example: <span>greetStrings(0) = "Hello" will be transformed into: greetStrings.update(0, "Hello") Thus, the following is semantically equivalent to the code in Listing 3.1: val greetStrings = new Array[String](3) greetStrings.update(0, "Hello") greetStrings.updat







Flashcard 149661944

Tags
#odersky-programming-in-scala-1ed #scala
Question
What method are you calling here and where is it defined?
val numNames = Array("zero", "one", "two")
Answer
a factory method apply which takes variable number of argumetns and is defined on Array companion object
the code gets transformed to
val numNames2 = Array.apply("zero", "one", "two")

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Next Steps in Scala
his code creates a new array of length three, initialized to the passed strings, "zero", "one", and "two". The compiler infers the type of the array to be Array[String], because you passed strings to it. <span>val numNames = Array("zero", "one", "two") Listing 3.2 - Creating and initializing an array. What you're actually doing in Listing 3.2 is calling a factory method, named apply, which creates and returns the new array. This apply method takes a variable number of arguments[2] and is defined on the Array companion object. You'll learn more about companion objects in Section 4.3. If you're a Java programmer, you can think of this as calling a static method named apply on class Array. A more verbose way to call the same apply method is: val numNames2 = Array.apply("zero", "one", "two") Step 8. Use lists [link] One of the big ideas of the functional style of programming is that methods should not have side effects. A method's only act should be to compute and return







Flashcard 149661953

Tags
#odersky-programming-in-scala-1ed #scala
Question
What does the cons expression, e.g. 1::twoThree, gets translated to (in terms of method calls)?
What rule is used?
Answer
twoThree.::(1)
if a method's name used in operator notation ends with colon, it is called on the right operand

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Next Steps in Scala
s with the associativity of the :: method, but it is actually a simple rule to remember: If a method is used in operator notation, such as a * b, the method is invoked on the left operand, as in a.*(b)—unless the method name ends in a colon. <span>If the method name ends in a colon, the method is invoked on the right operand. Therefore, in 1 :: twoThree, the :: method is invoked on twoThree, passing in 1, like this: twoThree.::(1). Operator associativity will be described in more detail in Section 5.8.







First, the complex nature of the information absolutely requires a thorough understanding at bare minimum. I believe that using a journey method, loci, or linking, will add a kind of "retrieval cue" which would otherwise have been vague at best if I had to retrieve the information from the dark-vast universe of my mind. So there certainly is a benefit to structuring the information in a logical manner and arranging it in an intimate visual-spatial setting in my mind. Second, drawing on the complex nature of the material, again, I believe using a mind map that is intimately linked to the retrieval image (which is placed in each loci) will help consolidate space.
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Beginner...would like to use techniques for medical school - Memory Forum | Mnemotechnics
s for medical school Ok, I've been thinking about how to convert med school information (i.e., First Aid for the USMLE) into a format that can easily be retrieved and have come up with a few options...I'll keep it short and to the point. <span>First, the complex nature of the information absolutely requires a thorough understanding at bare minimum. I believe that using a journey method, loci, or linking, will add a kind of "retrieval cue" which would otherwise have been vague at best if I had to retrieve the information from the dark-vast universe of my mind. So there certainly is a benefit to structuring the information in a logical manner and arranging it in an intimate visual-spatial setting in my mind. Second, drawing on the complex nature of the material, again, I believe using a mind map that is intimately linked to the retrieval image (which is placed in each loci) will help consolidate space. I'm not absolutely certain if this is the most efficient way to memorize this type of info, but it's the best I can come up with thus far. I'll post updates to my progress once I begin t




A non-optimal method that you use is going to be infinitely better than an optimal system you do not use.
statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

Beginner...would like to use techniques for medical school - Memory Forum | Mnemotechnics
Re: Beginner...would like to use techniques for medical school moca83 wrote: I'm not absolutely certain if this is the most efficient way to memorize this type of info, but it's the best I can come up with thus far. <span>A non-optimal method that you use is going to be infinitely better than an optimal system you do not use. Looking forward to hearing about your progress and what you discover along the way. Top Login or register to post comments April 30, 2012 - 2:24pm #9