Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 3

Haskell Introduction

CNG 242 Programming Language Concepts


Lecture - 1
Introduction (1)

• Prelude> 2+17 
• Prelude> (True && False) ||  False && (False||True)
• Functions are usually prefix
– Prelude> min 5 30
–  Prelude> min(max(min 5 30) 3) 4    
First functions
• Use any text editor.
• Functions always start with lowercase letters
– square x = x*x
– square2 x y= square x + square y
– squareSmall x y= (if x >y then square y else square x)

• Write a function which returns the cube of the smallest of 3 numbers. (assume the inputs
are not equal)

You might also like