# CS 465 Lab 1: Some Simple Haskell functions

This lab is intended to give you a quick start with using the Haskell programming language, i.e., making sure you have access to a language system and editor and can write some straightforward function definitions. (The actual content of the functions is intended to be trivial: expressing them in Haskell is the goal.)

You might use this lab as an excuse to set up a Haskell system on your own computer ... but we also want you to be familiar with how to access it on the lab computers. Haskell systems should be available on the Mac systems in Ford 202 as well as on the Windows systems in the lab in Ford 224 where we will meet. On the Macs in 202 you will need to launch the Terminal program (probably in `Applications/Utilities`) to get to the Hugs system.

1. Write a function in Haskell (call it `same3`) which compares three different values to see if they are all the same. In other words, when applied to the numbers 2, 3 and 4, it should return `False`, but when applied to 4, (2+2) and (2*2), it should return `True`.
2. Write a function `poly` which evaluates the polynomial given by 5x2 + 3x + 2. In other words, a function which, when applied to a number, will return the value of the formula above for that value of x.
3. Write a function of two Boolean (`Bool`) arguments called `nor`, which returns `True` when neither of its arguments ("neither one nor the other") is `True`; in all other cases it should return `False`.
4. Write a function `vowels` which will take a `String` as an argument and return `True` if all the characters in it are vowels, i.e., letters amongst `"aeiou"` (to heck with `'y'`!)
5. Write another function `vowels'` which will take a `String` as an argument and return `True` if all the letter characters in it are vowels. In other words, it may have non-letter characters in it, but any characters that are alphabetic letters must also be vowels (as in the last problem).
6. Write a function `substrs` which will return all non-empty substrings of its argument; you are allowed to repeat substrings in the result. In other words, given a `Strong`, your function should return a list of all `String`s such that they occur consecutively (in order with no gaps) in the original argument. For example, `"o"`, `"oo"` and `"ooba` all occur as sub-strings of `"foobar"`. (You are allowed to return duplicate substrings because, for example, `"o"` occurs twice as a substring inside `"foobar"`.)

Can you predict, based on the length of the argument, what the length of the result (as a list) will be?