Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (67 sloc) 4.231 kb
(ns foreclojure.static
(:use [foreclojure.utils]))
(def-page links-page []
[:li [:a {:href ""} " Getting Started"]]
[:li [:a {:href ""} " Cheatsheet"]]
[:li [:a {:href ""} ""]]
[:li [:a {:href ""} "Clojure Koans"]]
[:li [:a {:href ""}
" A Gentle Tutorial to Emacs/Swank/Paredit for Clojure"]]])
(def-page welcome-page []
[:h3 "What is 4Clojure?"]
"4Clojure is a resource to help fledgling clojurians learn the language through interactive problems. The first few problems are easy enough that even someone with no prior experience should find the learning curve forgiving. See 'Getting Started' for more information."]
[:h3 "Is this site written in Clojure?"]
"Absolutely! This site was created using a variety of open source Clojure (and Java) libraries. In fact, the "
[:a {:href ""} "code for this site"]
" is itself open source. Once you've mastered the language, feel free to contribute something back to the community."]
[:h3 "So wait, I can't buy cheap real estate here?"]
"At this time, does not provide information regarding the sale of foreclosed homes, and has no plans of doing so in the future."]])
(def-page getting-started-page []
"4Clojure challenges users to solve "
[:a {:href ""} "koan-style"]
" problems. This is a fancy way of saying you'll be asked to fill in the blanks. The \"blanks\" that you will be filling in are indicated by a double underscore: '__'. This is "
[:u "not"]
" part of the syntax of the language. Any code which makes the final form evaluate to 'true' will be considered a correct answer. Lets consider the first problem:"
[:div {:id "testcases"}
[:li {:class "testcase"} "(= __ true)"]]
"Any of the following would be considered correct answers:"
[:li "true"]
[:li "(= 1 1)"]
[:li "(nil? nil)"]
"Some problems will expect you to fill-in-the-blanks with a function. Here is a problem which asks you to provide a function to double a number:"
[:div {:id "testcases"}
[:li {:class "testcase"} "(= (__ 2) 4)"]
[:li {:class "testcase"} "(= (__ 3) 6)"]]
"Any of the following forms are valid solutions:"
[:li "(fn double [x] (* 2 x))"]
[:li "(fn [x] (* 2 x))"]
[:li "#(* 2 %)"]
[:li "(partial * 2)"]
"Keep in mind that problems which ask for a function might also check your code against secret test cases. This is to stop users from \"gaming\" the system by writing code which passes the test cases but is against the spirit of the problem."
"Some operations are prohibited for security reasons. For instance, you will not be able to use \"def\" or switch namespaces. In addition, some problems have special restrictions. For example, a function which is supposed to count the number of elements in a sequence will not be allowed to use the \"count\" function. Obviously, this would defeat the purpose. Any special restrictions will be listed on the problem page."
"Many of the easier problems on this site can be solved using only your browser. However at some point you will want to install Clojure, and use your favorite IDE or text editor to write your code. We prefer using Emacs, but its totally a matter of personal preference. Writing all your code directly on the site has a few disadvantages:"
[:li "4Clojure is not an IDE, and doesn't try to be"]
[:li "4Clojure won't save any of your code for later use"]
"Check out the official "
[:a {:href ""} "getting started"]
" page for help with installation."
"You should now be ready to start solving problems. Happy coding!"])
Jump to Line
Something went wrong with that request. Please try again.