Skip to content

Commit

Permalink
Merge pull request ClojureBridge#8 from ClojureBridge/master
Browse files Browse the repository at this point in the history
Bring curriculum up to date from main ClojureBridge repo
  • Loading branch information
seancorfield committed Sep 26, 2014
2 parents c90b347 + 20dfd90 commit 73a0eeb
Show file tree
Hide file tree
Showing 124 changed files with 2,374 additions and 5,517 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
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.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Outline
* [More Functions](outline/functions2.md)
* [More Data Structures](outline/data_structures2.md)
* [Flow Control](outline/flow_control.md)
* [Making Your First Program](outline/first-program.md)
* [Making Your Own Web Application](outline/app.md)
* [Putting Your Application Online](outline/deploy.md)

* [Capstone App #1](https://github.com/ClojureBridge/drawing/blob/master/README.md)
* [Capstone App #2](https://github.com/ClojureBridge/global-growth/blob/master/README.md)


License
Expand Down
108 changes: 0 additions & 108 deletions outline/app.md

This file was deleted.

123 changes: 123 additions & 0 deletions outline/cheatsheet.md
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`
```


Loading

0 comments on commit 73a0eeb

Please sign in to comment.