Akhil Sharma has Published 671 Articles

Haskell Program to calculate the sum of all even numbers

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 14:36:52

365 Views

This tutorial will help us in calculating the sum of all even numbers. Haskell uses a functional programming paradigm, which means that it uses functions to transform data, rather than using loops and variables to keep track of state changes. There are different ways to calculate the sum of all ... Read More

Haskell Program to check whether a variable is defined or not

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 14:33:38

383 Views

This tutorial will help us in checking whether a variable is defined or not. In Haskell, a variable is considered defined if it has a value assigned to it. The value can be of any type, including a special type called Maybe that is used to represent values that may ... Read More

Haskell Program to Check the birthday and print Happy Birthday message

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 14:30:26

217 Views

In Haskell, this program will help us in checking the current date against a specified birthday and prints a "Happy Birthday" message if it is a match otherwise, it will print “Not your birthday yet”. Haskell provides function to fetch the current date and also to specify a date. This ... Read More

Haskell Program to Iterate over enum

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 14:26:22

1K+ Views

In Haskell, an enumeration (or "enum") is a type that has a finite set of values. The values are called constructors, and are usually defined using the data keyword. Here's an example of an enumeration type that represents the four seasons − data Season = Spring | Summer | Fall ... Read More

Haskell Program to Implement multiple inheritance

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 14:01:11

343 Views

Haskell is a functional programming language and does not have a concept of inheritance. Instead, it uses type classes to achieve similar functionality. This tutorial will help us in implementing the same in Haskell. Method 1: Implement a type class that simulates multiple inheritances. This method uses type class to ... Read More

Haskell Program to initialize and print a complex number

Akhil Sharma

Akhil Sharma

Updated on 19-Jan-2023 13:37:01

165 Views

This tutorial will help us in initializing and printing a complex number. In Haskell, the Data.Complex library provides a Complex type to represent complex numbers. Method 1: Using Complex data type This method defines a Complex data type that holds the real and imaginary parts of a complex number, and ... Read More

Golang program to search an element in the slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 13:08:47

2K+ Views

In this tutorial, we will grasp how to search an element in slice using different set of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed ... Read More

Golang program to remove all elements from an array

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:35:42

3K+ Views

In this tutorial, we will execute the program of removing all the elements of array using different set of examples. An array is a well-defined collection of elements stored at contiguous memory locations. The output is printed in the screen using fmt.Println() function. Let’s see few examples to get a ... Read More

Golang program to get the first and last element from a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:32:32

934 Views

In this tutorial, we will discuss how to obtain the first and last element from a slice. A slice is a dynamic-sequence that stores elements of a similar type. It is similar to array but it can be resized whereas an array is of fixed range. Let’s understand the concept ... Read More

Golang program to compare elements in two slices

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:29:33

3K+ Views

In this tutorial, we will learn how to compare elements in two slices. In slices a simple equality comparison is not possible so the slices are compared with their lengths and the elements present in the loop. The output will be printed in the form of Boolean value on the ... Read More

Advertisements