Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update slides/curriculum for module2.html #133

Merged
merged 4 commits into from
Feb 8, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove 'does what you'd expect'
  • Loading branch information
k4y3ff committed Feb 7, 2015
commit 0dacf7366b2f9196876ee4eb5857f4dab10b2347
2 changes: 1 addition & 1 deletion outline/data_structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The next two functions are used to make new vectors. The `vector` function takes

If you've programmed in another language before, you might be wondering if `conj` changes the vector. It's important to note that it does not. All collections in Clojure are _immutable_--that is, unchangeable. When we say that a function "adds to" or "removes from" a collection, what we mean is that the function returns a new collection with an item added or removed.

Now, take a look at the last three functions. `count` does what you'd expect: it gives us a count of the number of items in a vector. `nth` gives us the nth item in the vector. Note that we start counting at 0, so in the example, calling `nth` with the number 1 gives us what we'd call the second element when we aren't programming. `first` returns the first item in the collection. Try not to think about that and `nth` at the same time or your brain will fry.
Now, take a look at the last three functions. `count` gives us a count of the number of items in a vector. `nth` gives us the nth item in the vector. Note that we start counting at 0, so in the example, calling `nth` with the number 1 gives us what we'd call the second element when we aren't programming. `first` returns the first item in the collection. Try not to think about that and `nth` at the same time or your brain will fry.


### EXERCISE: Make a vector
Expand Down