DOC PREVIEW
TRINITY CSCI 1320 - Collection Methods

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Collection Methods10-3-2011Opening DiscussionDo you have any questions about the quiz?Minute essay comments:How long do you have to correct assignments?There will be a study guide. The test covers everything we have done.I did write the spreadsheet and the quiz average is dropping the lowest.Looking back and moving forward.2-D arrays = Array[Array[???]]Use zip to work on two things at once.MoreEverything we are doing works on both Lists and Arrays.Examples at the end of class today.Standard MethodsThere are lots of methods on collections. The API can help us see all of them.Part of collections: drop, init, last, slice, splitAt, take, takeRightBoolean tests: contains, endsWith, isEmpty, nonEmpty, startsWithSearching: indexOf, lastIndexOfOther: mkString, reverse, zip, zipWithIndexOther MethodsIf the elements in a list support addition or multiplication, you can use the sum and product methods.If they are ordered you can do min and max.Having sum and length makes averages really easy.With min you can even drop a grade easily.Higher Order MethodsThe most powerful methods are ones you can pass functions into.exists, forall – Boolean checks like for math.filter, partition – separate collection based on Boolean.map – apply function to all the elements.reduceLeft – apply function moving through collectionfoldLeft – apply function moving through, but allows initial value so it can return a different type. This is curried.Let's Put These Into ActionI want to spend the rest of the class time playing with these methods and seeing what we can do with them.A String is a collection so you can do these things with a String as well.String also has a method called split.BLS dataftp://ftp.bls.gov/pub/time.series/la/Minute EssayWhat questions do you have?Getting your head around the higher-order methods can take time. Practice is your best


View Full Document

TRINITY CSCI 1320 - Collection Methods

Documents in this Course
Functions

Functions

10 pages

Functions

Functions

10 pages

Graphics

Graphics

10 pages

Graphics

Graphics

11 pages

Loops

Loops

4 pages

Loops

Loops

3 pages

Strings

Strings

9 pages

Functions

Functions

10 pages

Loops

Loops

11 pages

Graphics

Graphics

11 pages

Graphics

Graphics

12 pages

Sorting

Sorting

11 pages

Sorting

Sorting

10 pages

Arrays

Arrays

10 pages

Loops

Loops

18 pages

Load more
Download Collection Methods
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Collection Methods and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Collection Methods 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?