Skip to content
the poor coder

Home / Topics / #methods

#Methods

11 posts
2020

Hackerrank Lazy Evaluation Solution

Lazy evaluation is an evaluation strategy that delays the assessment of an expression until its value is needed. Ruby introduced a lazy enumeration feature. Lazy evaluation increases performance by avoiding needless…

2020

Hackerrank Currying Solution

Currying is a technique in which a function accepts parameters and turns it into a sequence of functions, each of them take 1 parameter. Example :- In the above example, lambda take two parameters , and return the…

2020

Hackerrank Closures Solution

Closure is a function/method that: ► Can be passed around like an object. It can be treated like a variable, which can be assigned to another variable, passed as an argument to a method. ► Remembers the value of…

2020

Hackerrank Lambdas Solution

Lambdas are anonymous functions. Lambdas in Ruby are objects of the class Proc. They are useful in most of the situations where you would use a proc. The simplest lambda takes no argument and returns nothing as shown…

2020

Hackerrank Procs Solution

Passing blocks is one way to pass functions as arguments to other functions. Blocks are one of the very few exceptions to the "everything is an object" rule in Ruby. Blocks are not objects, and they can't be saved to…

2020

Hackerrank Blocks Solution

Higher order functions are one of the key components of functional programming. A higher order function is a tool that takes other functions as parameters or returns them as a result. Blocks are nameless methods that…

ESC