forked from clj-syd/curriculum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClojureBridge#8 from ClojureBridge/master
Bring curriculum up to date from main ClojureBridge repo
- Loading branch information
Showing
124 changed files
with
2,374 additions
and
5,517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# How to contribute | ||
|
||
Updates to the ClojureBridge curriculum are welcome and encouraged. We would not have anything without the input from the volunteers who put on workshops. | ||
|
||
Also feel free to make forks of the curriculum and not contribute back. Make different curricula, too. These contribution guidelines are simply meant to provide guidance for the management of the main ClojureBridge curriculum. | ||
|
||
|
||
## Getting Started | ||
* Make sure you have a [GitHub account](https://github.com/signup/free) | ||
* Fork the repository on GitHub | ||
|
||
## Making Changes | ||
* (Probably need some stuff in here about keeping slides in sync with narrative, etc) | ||
* Commit changes | ||
* (Add more git guidance?) | ||
|
||
## Submitting Changes | ||
* Push your committed changes to your local fork of the repository | ||
* Create a pull request | ||
* Submit a pull request (PR) to the ClojureBridge/curriculum repository | ||
* The ClojureBridge curriculum team will review and discuss the pull requestin comments on the PR. | ||
* Two curriculum team members must give a thumbs up, then the PR will be accepted. | ||
|
||
|
||
# Curriculum Team | ||
* Wait, why does the curriculum team get to say which PRs get accepted?? I'm glad you asked! If you contribute more than two patches, you, too, will become part of the curriculum team. | ||
* Curriculum team members are given commit rights to the curriculum. | ||
* Commit rights are meant for approving PRs, not for making direct commits. | ||
* There is also a [ClojureBridge curriculum group](https://groups.google.com/forum/#!forum/clojurebridge-curriculum) for discussing curriculum direction. | ||
|
||
|
||
# Workshop/Chapter curriculum forks | ||
* Workshops or chapters that are using the main ClojureBridge curriculum should fork the curriculum in their chapter's github (a la [https://github.com/clojurebridge-sf/curriculum](https://github.com/clojurebridge-sf/curriculum)) | ||
* Give teachers commit rights to the chapter's fork of the curriculum | ||
* The submit pull requests to the main curriculum, if you would like to contribute the changes back. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
## Data Structures - Vector | ||
|
||
### Creating a vector | ||
|
||
```clj | ||
(vector 5 10 15) | ||
[1 2 3 4 5] | ||
[56.9 60.2 61.8 63.1 54.3 66.4 66.5 68.1 70.2 69.2 63.1 57.1] | ||
[] | ||
``` | ||
|
||
#### Functions for vectors | ||
|
||
```clj | ||
(vector? [5 10 15]) | ||
;=> true | ||
|
||
(vector 5 10 15) | ||
;=> [5 10 15] | ||
|
||
(conj [5 10] 15) | ||
;=> [5 10 15] | ||
|
||
(count [5 10 15]) | ||
;=> 3 | ||
|
||
(nth [5 10 15] 1) | ||
;=> 10 | ||
|
||
(first [5 10 15]) | ||
;=> 5 | ||
``` | ||
|
||
## Data Structures2 - Keyword, Maps | ||
|
||
#### Creating a map | ||
|
||
```clj | ||
{:first "Sally" :last "Brown"} | ||
{:a 1 :b "two"} | ||
{} | ||
``` | ||
|
||
|
||
#### Functions for Maps | ||
|
||
```clj | ||
; determine if value is a map | ||
(map? {:first "Sally" :last "Brown"}) | ||
;=> true | ||
|
||
; using keyword :first get the value | ||
(get {:first "Sally" :last "Brown"} :first) | ||
;=> "Sally" | ||
|
||
; using keyword :first get the value and return :MISS if key doesn't exist in map | ||
(get {:first "Sally"} :last :MISS) | ||
;=> :MISS | ||
|
||
; add a key/value to the map | ||
(assoc {:first "Sally"} :last "Brown") | ||
;=> {:first "Sally", :last "Brown"} | ||
|
||
; remove (disassociate) the key/value of :last | ||
(dissoc {:first "Sally" :last "Brown"} :last) | ||
;=> {:first "Sally"} | ||
|
||
; merge two maps | ||
(merge {:first "Sally"} {:last "Brown"}) | ||
;=> {:first "Sally", :last "Brown"} | ||
|
||
; get number of key/value pairs in this map | ||
(count {:first "Sally" :last "Brown"}) | ||
;=> 2 | ||
|
||
; get all the keys in this map | ||
(keys {:first "Sally" :last "Brown"}) | ||
;=> (:first :last) | ||
|
||
; get all the values in this map | ||
(vals {:first "Sally" :last "Brown"}) | ||
;=> ("Sally" "Brown") | ||
``` | ||
|
||
## Defining Functions | ||
|
||
```clj | ||
(defn function-name | ||
"description of function, optional" | ||
[param1 param2] | ||
((function-body))) | ||
``` | ||
|
||
* Functions that return true or false--called predicates--usually end in ? | ||
* map and reduce - Functions that take other functions | ||
|
||
## Flow Control | ||
|
||
```clj | ||
(if conditional-expression | ||
expression-to-evaluate-when-true | ||
expression-to-evaluate-when-false) | ||
``` | ||
|
||
## Boolean logic with and, or and not | ||
|
||
| x | y | (and x y) | (or x y) | (not x) | (not y) | | ||
| ----- | ----- | --------- | -------- | ------- | ------- | | ||
| false | false | false | false | true | true | | ||
| true | false | false | true | false | true | | ||
| true | true | true | true | false | false | | ||
| false | true | false | true | true | false | | ||
|
||
## let | ||
Assigning names to values inside of functions | ||
|
||
```clj | ||
(let [first-name (:first-name user) ; assign to `first-name` | ||
message (str "Hello, " first-name "!")] ; assign to `message` | ||
(println message)) ; do something with `message` | ||
``` | ||
|
||
|
Oops, something went wrong.