| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e014a73 commit cf5340a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -391,13 +391,14 @@ name-of-new-string | |||
| 391 | 391 | ||
| 392 | 392 | (:use 'clojure.string) | |
| 393 | 393 | ||
| 394 | - (defn- letter->clack [letter] | ||
| 394 | + (defn- letter->clack [alphabet letter] | ||
| 395 | 395 | (get alphabet letter)) | |
| 396 | 396 | ||
| 397 | 397 | (def sentence "Codemotion Amsterdam") | |
| 398 | + (def alphabet {"a" [001001] ,,,}) | ||
| 398 | 399 | ||
| 399 | 400 | (let [words (clojure.string/upper-case sentence)] | |
| 400 | - (map letter->clack (map str words))) | ||
| 401 | + (map #(letter->clack alphabet %) (map str words) | ||
| 401 | 402 | ||
| 402 | 403 | ||
| 403 | 404 | ||
@@ -412,7 +413,7 @@ name-of-new-string | |||
| 412 | 413 | (defn twice [function-to-apply value] | |
| 413 | 414 | (function-to-apply (function-to-apply value))) | |
| 414 | 415 | ||
| 415 | - (twice #(+ % 3) 7) | ||
| 416 | + (twice #(+ % 3) 7))) | ||
| 416 | 417 | ||
| 417 | 418 | ||
| 418 | 419 | ||
@@ -435,12 +436,32 @@ name-of-new-string | |||
| 435 | 436 | ||
| 436 | 437 | (reduce + (range 1 10)) | |
| 437 | 438 | ||
| 438 | - (reduce + '(1 2 3 4 5 6 7 8 9)) | ||
| 439 | + (reduce + (quote (1 2 3 4 5 6 7 8 9))) | ||
| 439 | 440 | ||
| 440 | 441 | ;; (range) | |
| 441 | 442 | ||
| 442 | 443 | (take 10 (range)) | |
| 443 | 444 | ||
| 445 | + (def sybol-name "value") | ||
| 446 | + | ||
| 447 | + (defn function-name [] | ||
| 448 | + (str "I am a function")) | ||
| 449 | + | ||
| 450 | + (def function-name (fn [] (str "iaomdfiodjfod"))) | ||
| 451 | + | ||
| 452 | + (function-name) | ||
| 453 | + | ||
| 454 | + (map (fn [number] (* number number)) [1 2 3 4]) | ||
| 455 | + (map #(* %1 %2) [1 2 3 4] [3 4 5 6]) | ||
| 456 | + | ||
| 457 | + | ||
| 458 | + | ||
| 459 | + | ||
| 460 | + | ||
| 461 | + | ||
| 462 | + | ||
| 463 | + | ||
| 464 | + | ||
| 444 | 465 | ||
| 445 | 466 | ;;;;;;;;;;;;;;;;;; | |
| 446 | 467 | ;; Programming with functions | |
@@ -700,7 +721,7 @@ deref players | |||
| 700 | 721 | ;; reduces in depth | |
| 701 | 722 | ||
| 702 | 723 | ;; reduce takes 2 arguments, a function and a collections | |
| 703 | - ;; if val is supplied, returns the result of applying the function to the val and the first item in the collection, itterating through the colleciton | ||
| 724 | + ;; if val is supplied, returns the result of applying the function to the val and the first item in the collection, itterating through the collection | ||
| 704 | 725 | ||
| 705 | 726 | ||
| 706 | 727 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments