Akhil Sharma has Published 634 Articles

Haskell Program to create a simple recursive function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:06:59

2K+ Views

In this article, we are going to understand how to create a simple function in Haskell using user-defined function. Here, the user-defined recursive functions are defined that will contain base case and recursive case. Then, these functions are being called recursively by passing the argument to it. In all the ... Read More

Haskell Program to return multiple values from the function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:06:28

2K+ Views

In Haskell, we can return multiple values from the function by using user-defined function along with tuple, custom data type and Maybe data type. In the first example, we are going to use (myFunction = ("Hello, World!", 42)) and in the second example, we are going to use (data MyData ... Read More

Haskell Program to return a string from the function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:05:22

1K+ Views

In this article, we are going to learn how to return a string from a function using user-defined function along with record syntax and let binding. In the first example, we are going to use (myFunction = "Hello, World!") function and in the second example, we are going to use ... Read More

Haskell Program to pass a string to the function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:04:31

581 Views

This article will help us learn how to pass a string to the function in Haskell with identity function and lambda expression. In the first example, we are going to use (myFunction inputString = inputString) function and in the second example, we are going to use (myFunction = id). And ... Read More

Haskell Program to return an array from the function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:03:40

653 Views

This article will help us learn how to return an array from the function in haskell using user-defined function along with list comprehension and recursion. In the first example, we are going to use (show (getArray)) function and in the second example, we are going to use (getArray n = ... Read More

Haskell Program to pass an array to the function

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:02:11

825 Views

In Haskell, we will pass an array to the function by using user-defined functions. In all the examples, we are going to pass an array to the user-defined functions to perform the certain tasks. These functions can be sumArray, maxArray, minArray, countEvens, etc. In this method, the user-defined functions are ... Read More

Haskell Program to create a function with arguments and a return value

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 11:00:58

844 Views

In this article, we are going to understand how to create a function with argument and a return value in Haskell using a user-defined function. The user-defined functions are defined that will contain the function definition with some returning value and is being called by passing desired arguments to it. ... Read More

Haskell Program to create a function without argument but return a value

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 10:59:35

446 Views

We are going to learn how to create a function without argument but return a value using user-defined function. In this article, the user-defined functions are defined that will contain the function definition with some returning value and is being called without passing any arguments to it. In ... Read More

Haskell Program to create a function with arguments but without a return value

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 10:58:36

358 Views

In Haskell, we will create a function with arguments but without a return value by using user-defined functions. In this article, the user-defined functions are defined that will contain the function definition without returning any value and is being called by passing some desired arguments to it. In all ... Read More

Haskell Program to create a function without argument and without a return value

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 10:57:16

555 Views

In Haskell, we can create a function without argument and without a return value by using user-defined functions. In all the examples, we are going to define user-defined functions to perform the certain tasks that don’t return any value and are passed without argument like, printGreeting, printMultipleLines, printSquares functions. Algorithm ... Read More

Advertisements