commit
b64b17fc51
@ -1,11 +1,203 @@
|
||||
*~
|
||||
bin
|
||||
classes
|
||||
lib
|
||||
releases
|
||||
target
|
||||
*.jar
|
||||
|
||||
# Created by https://www.gitignore.io/api/clojure,osx,linux,windows,leiningen,intellij,eclipse,sublimetext
|
||||
|
||||
### Clojure ###
|
||||
pom.xml
|
||||
pom.xml.asc
|
||||
*jar
|
||||
/lib/
|
||||
/classes/
|
||||
/target/
|
||||
/checkouts/
|
||||
.lein-deps-sum
|
||||
.lein-repl-history
|
||||
.lein-plugins/
|
||||
.lein-failures
|
||||
.nrepl-port
|
||||
|
||||
|
||||
### OSX ###
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
|
||||
### Windows ###
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
|
||||
### Leiningen ###
|
||||
pom.xml
|
||||
pom.xml.asc
|
||||
*jar
|
||||
/lib/
|
||||
/classes/
|
||||
/target/
|
||||
/checkouts/
|
||||
.lein-deps-sum
|
||||
.lein-plugins
|
||||
.lein-repl-history
|
||||
.lein-plugins/
|
||||
.lein-failures
|
||||
.nrepl-port
|
||||
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
|
||||
### SublimeText ###
|
||||
# cache files for sublime text
|
||||
*.tmlanguage.cache
|
||||
*.tmPreferences.cache
|
||||
*.stTheme.cache
|
||||
|
||||
# workspace files are user-specific
|
||||
*.sublime-workspace
|
||||
|
||||
# project files should be checked into the repository, unless a significant
|
||||
# proportion of contributors will probably not be using SublimeText
|
||||
# *.sublime-project
|
||||
|
||||
# sftp configuration file
|
||||
sftp-config.json
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
(ns koans.02-strings
|
||||
(:require [koan-engine.core :refer :all]
|
||||
[clojure.string :as string]))
|
||||
|
||||
(meditations
|
||||
"A string is nothing more than text surrounded by double quotes"
|
||||
(= __ "hello")
|
||||
|
||||
"But double quotes are just magic on top of something deeper"
|
||||
(= __ (str 'world))
|
||||
|
||||
"You can do more than create strings, you can put them together"
|
||||
(= "Cool right?" (str __ __))
|
||||
|
||||
"You can even get certain characters"
|
||||
(= \C (get "Characters" __))
|
||||
|
||||
"Or even count the characters"
|
||||
(= __ (count "Hello World"))
|
||||
|
||||
"But strings and characters are not the same"
|
||||
(= __ (= \c "c"))
|
||||
|
||||
"What if you only wanted to get part of a string?"
|
||||
(= "World" (subs "Hello World" __ __))
|
||||
|
||||
"How about joining together elements in a list?"
|
||||
(= __ (string/join '(1 2 3)))
|
||||
|
||||
"What if you wanted to separate them out?"
|
||||
(= "1, 2, 3" (string/join __ '(1 2 3)))
|
||||
|
||||
"Maybe you want to separate out all your lines"
|
||||
(= [__ __ __] (string/split-lines "1\n2\n3"))
|
||||
|
||||
"You may want to make sure your words are backwards"
|
||||
(= __ (string/reverse "hello"))
|
||||
|
||||
"Maybe you want to find the index of the first occurence of a substring"
|
||||
(= 0 (.indexOf "hello world" __))
|
||||
|
||||
"Or maybe the last index of the same"
|
||||
(= __ (.lastIndexOf "hello world, hello" "hello"))
|
||||
|
||||
"But when something doesn't exist, it turns up negative"
|
||||
(= __ (.indexOf "hello world" "bob"))
|
||||
|
||||
"Sometimes you don't want whitespace cluttering the front and back"
|
||||
(= __ (string/trim " \nhello world \t \n"))
|
||||
|
||||
"You can check if something is a char"
|
||||
(= __ (char? \c))
|
||||
|
||||
"But it may not be"
|
||||
(= __ (char? "a"))
|
||||
|
||||
"But chars aren't strings"
|
||||
(= __ (string? \b))
|
||||
|
||||
"Strings are strings"
|
||||
(= true (string? __))
|
||||
|
||||
"Some strings may be blank"
|
||||
(= __ (string/blank? ""))
|
||||
|
||||
"Even if at first glance they aren't"
|
||||
(= __ (string/blank? " \n \t "))
|
||||
|
||||
"However, most strings aren't blank"
|
||||
(= __ (string/blank? "hello?\nare you out there?")))
|
@ -1,4 +1,4 @@
|
||||
(ns koans.03-vectors
|
||||
(ns koans.04-vectors
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.04-sets
|
||||
(ns koans.05-sets
|
||||
(:require [koan-engine.core :refer :all]
|
||||
[clojure.set :as set]))
|
||||
|
@ -1,4 +1,4 @@
|
||||
(ns koans.05-maps
|
||||
(ns koans.06-maps
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.06-functions
|
||||
(ns koans.07-functions
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn multiply-by-ten [n]
|
@ -1,4 +1,4 @@
|
||||
(ns koans.07-conditionals
|
||||
(ns koans.08-conditionals
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn explain-exercise-velocity [exercise-term]
|
@ -1,4 +1,4 @@
|
||||
(ns koans.08-higher-order-functions
|
||||
(ns koans.09-higher-order-functions
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.09-runtime-polymorphism
|
||||
(ns koans.10-runtime-polymorphism
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn hello
|
@ -1,4 +1,4 @@
|
||||
(ns koans.10-lazy-sequences
|
||||
(ns koans.11-lazy-sequences
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.11-sequence-comprehensions
|
||||
(ns koans.12-sequence-comprehensions
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.12-creating-functions
|
||||
(ns koans.13-creating-functions
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn square [x] (* x x))
|
@ -1,4 +1,4 @@
|
||||
(ns koans.13-recursion
|
||||
(ns koans.14-recursion
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn is-even? [n]
|
@ -1,4 +1,4 @@
|
||||
(ns koans.14-destructuring
|
||||
(ns koans.15-destructuring
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(def test-address
|
@ -1,4 +1,4 @@
|
||||
(ns koans.15-refs
|
||||
(ns koans.16-refs
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(def the-world (ref "hello"))
|
@ -1,4 +1,4 @@
|
||||
(ns koans.16-atoms
|
||||
(ns koans.17-atoms
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(def atomic-clock (atom 0))
|
@ -1,4 +1,4 @@
|
||||
(ns koans.17-macros
|
||||
(ns koans.18-macros
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defmacro hello [x]
|
@ -1,4 +1,4 @@
|
||||
(ns koans.18-datatypes
|
||||
(ns koans.19-datatypes
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defrecord Nobel [prize])
|
@ -1,4 +1,4 @@
|
||||
(ns koans.19-java-interop
|
||||
(ns koans.20-java-interop
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.20-partition
|
||||
(ns koans.21-partition
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(meditations
|
@ -1,4 +1,4 @@
|
||||
(ns koans.21-group-by
|
||||
(ns koans.22-group-by
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(defn get-odds-and-evens [coll]
|
@ -1,4 +1,4 @@
|
||||
(ns koans.22-meta
|
||||
(ns koans.23-meta
|
||||
(:require [koan-engine.core :refer :all]))
|
||||
|
||||
(def giants
|
Loading…
Reference in New Issue