Akhil Sharma has Published 634 Articles

Haskell Program to Check Palindrome

Akhil Sharma

Akhil Sharma

Updated on 24-Apr-2023 11:34:26

2K+ Views

This tutorial will help us in checking if any number is palindrome number or not using user-defined function and boolean functions in haskell. A palindrome number is a number that remains the same when its digits are reversed. The following example will give you a clear idea about Palindrome number. ... Read More

Haskell Program to create Complex numbers from given imaginary parts

Akhil Sharma

Akhil Sharma

Updated on 24-Apr-2023 11:33:39

401 Views

In this article we are going to use the internal function of Haskell like Data.complex and Prelude to create a complex number from a given imaginary parts. This tutorial will help us in creating the complex number from the given imaginary part. The imaginary part of a complex number is ... Read More

Haskell Program to convert double type variables to string

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:03:54

825 Views

In Haskell, we will convert double type variables into string by using user-defined function, doubleToString along with show function and Text.Printf and Data.Text module. In the first example, we are going to use ( let valueString = show input) and in the second example, we are going to ... Read More

Haskell Program to convert string variables to double

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:03:17

1K+ Views

In Haskell, we will convert string type variables into double by using user-defined function, stringToDouble along with read annotation, readMaybe and double functions. In the first example, we are going to use ( let value = read input :: Double) and in the second example, we are going ... Read More

Haskell Program to convert double type variables to int

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:02:45

1K+ Views

In Haskell, we will convert double type variables into int by using user-defined function, doubleToInt along with floor, round and ceiling functions. In the first example, we are going to use (doubleToInt d = floor d) function and in the second example, we are going to use (doubleToInt d ... Read More

Haskell Program to convert int type variables to double

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:02:13

2K+ Views

In Haskell, we will convert int type variables into double by using user-defined function, intToDouble along with fromIntegral, realToFrac and realPart functions. In the first example, we are going to use (intToDouble n = fromIntegral n) function and in the second example, we are going to use (intToDouble n ... Read More

Haskell Program to convert int type variables to String

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:01:17

4K+ Views

In Haskell, we will convert int type variables into string by using user-defined function, intToString along with show, map and printf functions. In the first example, we are going to use (intToString n = show n) function and in the second example, we are going to use (intToString n ... Read More

Haskell Program to convert string type variables into int

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:00:41

1K+ Views

In Haskell, we will convert string type variables into integer by using user-defined function, stringToInt along with read and readMaybe functions. This can also be implemented using pattern matching and recursion. In the first example, we are going to use (stringToInt str = readMaybe str) function and in the second ... Read More

Haskell Program to convert string type variables into boolean

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 12:00:01

662 Views

In Haskell, we will convert string type variables into boolean by using user-defined function, stringToBool along with Maybe Bool, toLower and readMaybe functions. In the first example, we are going to use (stringToBool :: String -> Maybe Bool) function and in the second example, we are going to use (stringToBool ... Read More

Haskell Program to Print Reverse Pyramid Star Pattern

Akhil Sharma

Akhil Sharma

Updated on 20-Apr-2023 11:58:49

260 Views

Haskell has internal functions like mapM and ForM functions to print a revered Pyramid pattern star. A reverse pyramid star pattern is a pattern of asterisks (stars) arranged in the shape of an inverted pyramid. Algorithm Step 1 − Program execution will be started from main function. The main() ... Read More

Advertisements