Giter VIP home page Giter VIP logo

clojurescript-koans's Introduction

ClojureScript Koans Online

http://clojurescriptkoans.com

The ClojureScript Koans are a fun and easy way to get started with ClojureScript. No experience with Clojure or ClojureScript is assumed or required, and since they're run in-browser they don't require a functioning Clojure development environment.

They are adapted from the Clojure Koans, with some minor changes to accommodate the differences between Clojure and ClojureScript.

Development

You will need Leiningen.

If you wish to edit the project's stylesheets, you will need to have Sass and Compass installed. The project contains a Compass config.rb file.

Editing the Koans

The koans themselves live in the src/koans/meditations folder. For a given set, the koans variable should contain a sequence of description strings and their matching S-expressions. Within the S-expressions, any instances of :__ will be replaced by an input box. There are instances where ClojureScript's pr-str function will alter the displayed form of an expression (e.g. replacing quote characters with a (quote) expression); if this happens, you can quote the entire S-expression to have it displayed exactly as written.

If you need to define new functions for a section, add them to the fns vector. Like the koans, a function may either be a quoted S-expression or a string, and any instances of the symbol :__ will be replaced with an input field. If you wish to specify proper indentation, whitespace is maintained in the string form. In either case, syntax highlighting will automatically be applied.

If you want to create a new category of koans, you will also need to add your category to the structure in meditations.cljs.

Helper Scripts

The script folder contains a number of helpful scripts. All are designed to be run from the root project directory.

build: Does a clean recompile of the application code.

deploy: If you're hosting the site on GitHub Pages, this will deploy the latest version of your code. It merges your current branch into the gh-pages branch, generates a static copy with compiled JS/CSS, and then pushes the gh-pages branch to your default remote. See the script's source for caveats.

Related Projects

Contributing

Pull requests are encouraged!

License

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license.

clojurescript-koans's People

Contributors

gthb avatar honzabrecka avatar lazerwalker avatar mkremins avatar orthographic-pedant avatar sohocoke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clojurescript-koans's Issues

[Suggestion] Information missing for the atoms topic resolution

Greetings,

From #atoms/4 to #atoms/7 , the page runs (reset! atomic-clock 0) without informing the user.
The page should inform the user that this function was called, or the user could assume that the atom still has the previous value.
I had to consult the answers to be able to solve it.

Getting a false negative in the #destructuring/3 koan

This is returning true in the repl but fails in the koan:

(= "Rich Hickey aka The Clojurer aka Go Time aka Macro Killah" (let [[first-name last-name & aliases] (list "Rich" "Hickey" "The Clojurer" "Go Time" "Macro Killah")] 
(clojure.string/join " " (reduce conj [first-name last-name "aka"] (interpose "aka" aliases)))
))

Pressing Enter twice when correct breaks the interface

I accidentally hit Enter twice when submitting a correct answer, and the next two koans appeared on top of each other (see attached screenshot), and the submission stopped working for both koans.

Refreshing the page did fix the interface

ss
.

sequence comprehension #5 doesn't work on firefox

For some weird reason, even when entering the correct solution (tested successfully in Chromium and double checked with other users), i'm being told i haven't attained enlightenment yet when using Firefox 25 (Archlinux).

If I open the javascript console, here's what I have:

[13:25:55.199] "Evaluating  (= [[:top :left] [:top :middle] [:top :right] [:middle :left] [:middle :middle] [:middle :right] [:bottom :left] [:bottom :middle] [:bottom :right]] (for [row [:top :middle :bottom] column [:left :middle :right]]  [row column] ))"
[13:26:14.285] "#<InternalError: too much recursion> at line 1"

I am unable to run clojurescript koans in Firefox under Ubuntu 64bit

Actually I am using KXStudio with KDE on top which is based on Ubuntu 64bit.
Firefox version is 41.0.2
When I go to the first koan (http://clojurescriptkoans.com/#equality/1) all I can see is the koans logo image (painted circle).
"View source" shows exactly the came code as in Chrome.
The inspector in Chrome shows body with id="dummybodyid" and nested I can see the koan

 <div class="koan koan-0" style="display: block;">...</div>

all works fine.
In Firefox however, the id="dummybodyid" is missing from the body, and so is the koan.
The next div in chrome:

 <div class="category" style="display: block;">equality</div>

The same div in Firefox:

    <div class="category"></div>

...empty, nothing.
All looks as if clojurescript isn't running at all, yet all clojurescript files downloaded just fine.
FireBug shows this:

-> uncaught exception: Invalid match arg: /\(quote (.*?)\)/ <unknown>
-> This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1.[Learn More] connect.facebook.net
-> Use of getPreventDefault() is deprecated.  Use defaultPrevented instead. jquery.min.js:2:0

Any clue what's going on? Instinct tells me it's the uncaught exception's fault
cheers
Jared

Koans do not load in many browsers

The koans now seem completely nonfunctioning to me in Safari, both on OS X (10.11) and iOS (9.1).

Here's the stack trace for the error I get on any page:

screen shot 2015-11-27 at 11 29 44

This is likely related to #11. Although I could investigate this on its own, it might be worth waiting until #10 happens, both because the problem might fix itself and because dealing with outdated tooling might turn out to be a major pain.

clojurescriptkoans.com : Uncaught Invalid match arg: /\(quote (.*?)\)/

This exception is thrown whenever I try to begin the koans on the url

http://clojurescriptkoans.com/#equality/1

and also on other urls:

http://clojurescriptkoans.com/#equality/3

I had no problems last week where I looked at the koans.

Same error in chromium and firefox.

Here is a stacktrace from chromium:

replace (string.cljs:33)
expr_to_string (meditations.cljs:61)
expr_to_array (meditations.cljs:76)
koan_for_index (meditations.cljs:91)
render_current_koan (core.cljs:135)
(anonymous function) (core.cljs:173)
l (jquery.min.js:2)
c.fireWith (jquery.min.js:2)
v.extend.ready (jquery.min.js:2)
A (jquery.min.js:2)

Destructuring 7 wont pass

(def test-address
{:street-address "123 Test Lane"
:city "Testerville"
:state "TX"})

(= "Test Testerson, 123 Test Lane, Testerville, TX" (
#(apply str (apply str (interpose " " %1)) ", " (apply str (interpose ", " (map val %2))))
["Test" "Testerson"] test-address))

Creating Functions 3 doesn't let you through

it is here:
http://clojurescriptkoans.com/#creating-functions/3
doesn't let you through when the gap filled with

multiply-by-5 4

i.e.

(= 20 (let [multiply-by-5 (partial * 5)] (multiply-by-5 4)))

evaluates to true, but the koan doesn't let you through.

edit:
The next one
http://clojurescriptkoans.com/#creating-functions/4
also doesn't work. This one should actually work without input in the second field.
edit 2:
It didn't work when I simply refreshed the page, but when I did it with [shift + F5] suddenly it all worked. Weird stuff...

Switch to self-hosting cljs

When I build this, cljs wasn't self-hosted. As a result, it currently exists as a very fragile hack whereby there are two parallel cljs stacks existing in the browser at the same time: a modern (at the time) one, and a hacky, old, mostly-functioning self-hosted fork that existed purely to do in-browser execution of user code.

Now that CLJS is itself properly self-hosting, this can be simplified greatly.

Remember that a set is a *mathematical* set has a built in bug

Not sure if this is a real issue just realized this upon using clojurescriptkoans as a way to prep for my upcoming employment.

By definition in the REPL: a set #{ 1 1 2 3} logs an error about duplicate 1 keys, makes sense right?
screen shot 2016-01-21 at 1 46 08 pm

But the above koan seems to accept a set with duplicates as if it was correct. I wouldn't mind working in the fix myself, would love to be a contributor to such a cool technological way to educate people!

Travis CI build errors

See e.g. this error โ€“ not related to the commit itself but to an issue with how Travis CI is set up for the repo. I think they probably renamed lein2 to just lein.

UX Suggestion

When user hits return after entering correct answer, he's transferred to next page immediately.
Better leave him on the same page with some indication of correctness, to contemplate the correct answer.
This may seem unimportant, but it's not: such a change will improve learning significantly.
For more info, google principles of programmed instruction (PI).
I hope it's trivial to implement.

Reader macro #_ ("discard form") can be used to submit insignificant answers

Although issues #7 and #18 were fixed by commit 2d469c6, a similar issue remains with regard to the "discard form" reader macro. You can still "cheat" on koans of the form (= :__ the-answer) by submitting an answer like #_(), which will be read as the equivalent of an empty string.

There's a few different ways that we could handle this. Should we just discard inputs that contain the character sequence #_ as invalid? Should we disable the #_ reader macro entirely? Or should we do something more sophisticated, like completely replacing the current input validation method with a requirement that every input string has to contain at least one valid Clojure form? (This is the one I'm leaning towards.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.