Example #1: Read from a list & write to a list
Java Way in Scala
Output: List(Java Programming, Scala Programming, Ruby Programming)
Scala Way in Scala: Using the “map”
…
Example #1: Read from a list & write to a list
Java Way in Scala
Output: List(Java Programming, Scala Programming, Ruby Programming)
Scala Way in Scala: Using the “map”
…
Assumes that Python3 is installed as described in Getting started with Python.
1. Iterators
Iterators don’t compute the value of each item when instantiated. They only compute it when you ask for it.
…
Q1. What is a pure function?
A1. A pure function is a function where the following conditions are met:
1) The Input solely determines the output.
…
This extends Coding Scala Way – Part 1 Can you write the following code written in Java the Scala way? Java coding question on recursion and generics Q. … Read...
Q. What is a comprehension?
A. Comprehensions are constructs that allow sequences to be built from other sequences. Python 2.0 introduced list comprehensions and Python 3.0 comes with dictionary,
…
This extends Scala Functional Programming basics – pure functions, referential transparency, side effects, etc.
Q1. What is a first-class function?
A1.
…
Q. Can you explain the concepts used in the below code? Output: A. The above code runs the function “(x:Int) =x + 2” … Read more ›...
Example #6: Lazy initialization & evaluation of code Scala support “views“, which are collections that can be lazily evaluated. One use for views is when you need to traverse a...
Q. What is a Python context manager?
A. The most common use of context managers is to properly manage resources. Context managers are a way of allocating and releasing some sort of resource exactly where you need it.
…
100+ FAQ Scala interview questions answered with code. Learn more about FP – 6 tips to transforming your thinking from OOP/imperative programming to functional programming (i.e. FP). … Read more...