what is an anonymous function Scala?

0 votes
Can anyone explain what anonymous function in Scala?
Jul 29, 2019 in Apache Spark by Ritika
76 views

1 answer to this question.

0 votes

Hi,

An anonymous function in Scala is a function literal. At runtime, Scala instantiates into a function value. Since this is a way to create a function using just one line of code, we can call it lightweight.

 Here’s an example:

scala> val mul=(a:Int,b:Int)=>a*b

mul: (Int, Int) => Int = $$Lambda$1541/400146874@3aca06a3

scala> mul(3,4)
answered Jul 29, 2019 by Gitika
• 26,310 points

Related Questions In Apache Spark

0 votes
1 answer

What is “Unit” and “()” in Scala?

Hey, Unit is a subtype of scala.anyval and ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 26,310 points
78 views
0 votes
1 answer

What is the advantage of having immutability in design for Scala programming language?

Hi, Scala uses immutability by default in most ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 26,310 points
62 views
0 votes
1 answer

What is ofDim in Scala?

Hey, ofDim() is a method in Scala that ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 26,310 points
334 views
0 votes
1 answer

What is exception propagation in Scala?

Hi, When a function experiences an exception, it ...READ MORE

answered Jul 25, 2019 in Apache Spark by Gitika
• 26,310 points
47 views
+1 vote
1 answer
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,870 points
4,550 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,870 points
647 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
25,837 views
0 votes
1 answer

What is recursion in Scala function? How does it works?

Hey, A Scala function involves recursion when it ...READ MORE

answered Jul 25, 2019 in Apache Spark by Gitika
• 26,310 points
45 views
0 votes
1 answer

What is function currying in Scala?

Hi, With Scala Currying, we can take a ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 26,310 points
75 views