Haskell Keywords

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
GameKnowt Play
New
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

5 Terms

1
New cards

Define a “recip” function which takes the reciprocal of a fractional type value.

recip :: Fractional a => a → a
recip n = 1/n

2
New cards

How would you write the guarded equation version of the function abs, which finds the absolute value of an Int, Integer, Float or Double?

abs n | n >= 0 = n
| otherwise = -n

3
New cards

What does the ‘otherwise’ keyword imply?

It is defined in the prelude as otherwise = True.

4
New cards

What is the “:” symbol?

Called “cons”, it constructs a list by prepending a new element to teh start of an existing list.

5
New cards

What does the “\” symbol indicate?

A lambda expression!

Explore top flashcards

Spanish 1: Mi casa
Updated 715d ago
flashcards Flashcards (36)
PHYSCIE
Updated 371d ago
flashcards Flashcards (170)
L: 2 Social Science
Updated 380d ago
flashcards Flashcards (24)
CHA101L Quiz 2
Updated 998d ago
flashcards Flashcards (63)
Korean Unit 1
Updated 625d ago
flashcards Flashcards (22)
Spanish 1: Mi casa
Updated 715d ago
flashcards Flashcards (36)
PHYSCIE
Updated 371d ago
flashcards Flashcards (170)
L: 2 Social Science
Updated 380d ago
flashcards Flashcards (24)
CHA101L Quiz 2
Updated 998d ago
flashcards Flashcards (63)
Korean Unit 1
Updated 625d ago
flashcards Flashcards (22)