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

training day #2002

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
/checkouts
/.lein-deps-sum
/.lein-plugins
.DS_Store
.lein-repl-history
36 changes: 33 additions & 3 deletions src/training_day.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
(ns training-day)

(def answer ":(")
(def answer 42)

(def hai "O HAI!")

(defn square [x]
":(")
(* x x))

(defn average [a b]
":(")
(/ (+ a b) 2))

answer
hai
(square 3)
(average 10 20)

; ===============================

(+ 4 (* 2 3))
(+ 3 4 5 6)
(get "Clojure" 2)
(get "abrakadabra" 0)

((fn [who] (str "Hello, " who "!")) "Jani")

((fn [name] (str "Welcome to Rivendell mr " name)) "Toni")

; (def hello (fn [who] (str "Hello, " who "!")))
(defn ; Start a function definition:
hello ; name
"Gives out personalized greetings." ; a optional docstring
[who] ; parameters inside brackets
(str "Hello, " who "!")) ; body

(hello "beautiful")
(hello "handsome")

(use 'clojure.repl)
(doc hello)

2 changes: 2 additions & 0 deletions test/training_day_test.clj
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
(ns training-day-test
(:use iloveponies.tests.training-day))

(require 'iloveponies.tests.training-day :reload)