GithubHelp home page GithubHelp logo

4clojure / 4clojure Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 227.0 3.38 MB

An interactive problem website for learning Clojure

Home Page: https://www.4clojure.com

License: Eclipse Public License 1.0

Shell 0.15% Clojure 75.40% JavaScript 5.60% Batchfile 0.10% CSS 18.75%

4clojure's Introduction

4clojure.com has been discontinued

Another site may take over the domain name at some point, but for now 4clojure.com is down on purpose. More details on the forum.

4Clojure

An interactive problem website for learning Clojure: https://www.4clojure.com.

Contributing

Anyone interested in contributing should check out the Issues page for ideas on what to work on.

Join us in #4clojure on freenode for help or discussion.

Setup instructions for running locally

  • Download and install leiningen.

  • Download and install mongodb.

  • The project uses clojail, which requires a security policy setup in your home directory (because Clojure's eval is unsafe if used improperly). Set up a file called .java.policy in your home directory. The contents should look vaguely like this:

      grant { permission java.security.AllPermission; };
    

    but see the readme of that project for more details.

  • cd to the 4clojure project directory and run lein deps.

  • Start up your mongodb, if you don't have autostart:

      mongod
    
  • For the first time use, you will need to load the problem data. Run the script load-data.sh:

      ./load-data.sh
    
  • Run lein ring server

  • To run the tests: lein test

Contributors

Problem sources:

License

The source code for 4clojure is available under the Eclipse Public License v 1.0. For more information, see LICENSE.html.

4clojure's People

Contributors

amalloy avatar amcnamara avatar arajek avatar bfontaine avatar citizen428 avatar ckirkendall avatar curious-attempt-bunny avatar darrenaustin avatar dbyrne avatar devn avatar doggo-bot avatar gfredericks avatar gigasquid avatar hans avatar marvinthepa avatar nbeloglazov avatar pet3ris avatar pronvis avatar raynes avatar smcgivern avatar tclamb avatar zephjc 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  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

4clojure's Issues

Golf leagues

It'd be cool if we automatically analyzed incoming solutions for length - number of non-whitespace chars maybe, or we could even automatically minify their code as a stretch goal - and speed (how long did it take to run your solution 2000 times). Then we could display this data to the user and let them see how they stack up.

I don't think we want this to be a mandatory feature, or even a default one: we want to encourage new users to get problems right, regardless of statistics. But if we had a Leagues page that you could opt into, I bet people would love it.

Problems with Ubuntu Firefox 3.6

http://i.imgur.com/mA4X6.png

The favicon doesn't display properly. This is also a problem in Firefox 4.

Also, there is a big black box around the 4clojure logo. My guess is this started happening when we made the logo a link, because I never noticed it before then.

I don't see either of these problems from other browsers.

Help users debug

When a user fails a test case it'd be nice if we could tell them what the problem was. A sort of expected/actual, like clojure.test gives.

Improved Code Box

Improve the aesthetics and function of the code box, instead of using a plain html text-area. Syntax highlighting would be nice.

Stackoverflow/xbox style achievements

I think it would be more satisfying if users had specific achievements to work towards. Some achievements could have "levels" associated with them as well. For example:

"Reinventing the wheel" - Solve problems which ask you to re-implement a function from clojure.core

  • Level 1: Solve 2 problems (2^1)
  • Level 2: Solve 4 problems (2^2)
  • Level 3: Solve 8 problems (2^3)
  • Level 4: Solve 16 problems (2^4)

Add "Reject" button to the problem approval page

Once we start allowing users to submit problems, we are going to get submissions we don't want to post on the site. Right now, the only way to remove them is to go into the database and delete them manually.

It would be nice to have a "Reject" button where we could delete the problem from the database, and optionally fill out a message to the user that gets sent automatically via email. This way we can quickly provide feedback as to why their question isn't being posted.

Fix CSS

The CSS containers are a bit weird. When the window is maximized the table has a significant amount of whitespace on the right hand side that shrinks as the window is made smaller.

There are currently two containers named #content that refer to different pieces of the site. Inspecting these boxes reveals the extra space on the right of the container which need not be there.

Solution Sharing

A way to store correct solutions and share them with other users.

More fine-grained use of flash messages

Having several lines of bright-red text contain everything we want to pass from one request to another within the session looks pretty ugly. We need to start having multiple ways to display flash messages, possibly with divs placed sensibly throughout some central template with blanks into which we can insert flash text if any exists.

Let advanced users submit their own problems

First off, we definitely need a formalized process for submitting problems ourselves.

Second, I think it would be beneficial to let users submit their own problems once they've progressed to a certain point on the site. Maybe the questions have to be validated by us before they are posted or something. We could separate them under a different tag and display them on a different page as well.

Add a readme

Github is right: we should have a readme, both for people who stumble onto the github page instead of the public site, and for anyone interested in forking.

Link to Clojure Docs on the Problems page

I was thinking that it would be nice to give beginners a link to some documentation to help them solve the problem.

Maybe a general link for Clojure Docs and the API page and perhaps a specific link to Clojure docs if it is a problem referencing a certain method.

Reset passwords via email

Migrating from email to github issues - might as well try out their new feature.

Original email from Dave:

One feature we really need to add to 4clojure is the ability to reset user passwords via email, and change them once a user has logged in. I should have done this earlier, but I didn't think the site would start gaining users so fast. I'll have to set up an SMTP server on EC2 as well.

"Top Users" sort order

Looks like the "top users" page is possibly sorting in ASCII order rather than numeric?

Register 4clojure.org?

Sean Corfield sent out a tweet directing his followers to 4clojure.org. A silly mistake, of course, and he's since fixed it, but perhaps we ought to register it anyway to reduce problems for users who misremember the domain and think of clojure.org.

Giving this to @dbyrne since he owns 4clojure.com; feel free to close the issue if you don't think registering another domain to compensate for stupid users is a good plan.

Tic-tac-toe problem(s)

A user suggested tic-tac-toe, which I think will be at least as much fun for users as Hanoi, and simpler to specify as well. Here's his email:

I have two tic-tac-toe challenges:

First a function to detect game end. A tic-tac-toe position is represented by a 2-d vector (:e for empty): [[:e :o :x][:o :e :x][:e :o :x]]. Write a function that takes a position and returns the winner (:o if :o has three in a row, :x if :x has three in a row, and :e if neither side is winning). In the example :x should be returned. The unit test should check for horizontal, vertical or diagonal matches.

The second challenge makes moves. Take a position and a side to move (:x or :o). return a position. If side to move has two in a row, play to make three in a row, else if other side has two in a row, play to block the three in a row, else if the center is open, play in the center, else play a random open position. The unit tests will only have positions with a single forced move (or perhaps two alternatives and check for both answers).

With these two functions and a little swing, we have a game…

Add statistics/demographics to database

With the recent spike in user joins, I find myself wishing we had a "joined date" for each user so that we could graph #users/time. I'm sure we could think of other interesting things to graph if we put some more tracking information into the database.

Google analytics

Get an Analytics account, and add the javascript to our pages.

RSS feed for new problems

I am sure our diehard users would appreciate an RSS feed that lets them know when new problems are posted.

More stable test/deployment strategy

Bringing down the site for several minutes with each deploy is sad, especially if we can't test the changes in a production-like environment. I don't know how all this EC2 stuff works, so maybe it's not really possible, but it would be nice to have a beta.4clojure.com or some such where candidate releases could be deployed.

Problem IDs appearing as floats

Some of the later problems render the href attributes incorrectly, such as http://4clojure.com/problem/30.0. Just fixing the link display text probably isn't good enough because we do things like (contains? foo 30.0), which I don't think will spot maps that have 30 as keys. I think we need to figure out why Mongo is giving up floating-point numbers and stop it at the source rather than applying a bunch of fixes to the data it gives us.

View and vote on solutions

It would be cool if, once a user has solved a problem, they could view the solutions of other users and vote up solutions they like. I know I've written some pretty kludgy solutions today and would love to see what other came up with (without having to monitor twitter). This could tie into the "badges" idea in issue 17.

Possible Bug in Problems 32 & 33

My solution for these problems is as follows:

;; Problem 32
(fn [s] (flatten (map #(replicate 2 %) s)))
;; Problem 33
(fn [s n] (flatten (map #(replicate n %) s)))

I've checked this repeatedly in the REPL and with a friend, and the code generates the correct results (that is, when run with the given samples, they all return "true").

However, when I submit these solutions, 4clojure.com says You failed the unit tests.

Since my solution seems to be correct, is this a bug in the testing code?

Mobile version of site

We should look into a streamline version of the site for mobile users. The new javascript text box doesn't work with all mobile phones, it would be nice to have a non-javascript minimal site for mobile.

Need a page to review user submitted problems

Should work just like the normal problem page. Should only show unapproved questions, should not keep track of who has solved it (but should let you test out various answers), and should have an option to mark it approved. Only users with an approver flag set to true should be allowed to view or approve problems.

RSS feed is not auto-detected

The head needs this metadata:

<link rel="alternate" type="application/atom+xml" title="Atom" href="http://4clojure.com/problems/rss" />   

Problem "Trails"

We've received a lot of feedback that it is confusing to figure out what order problems should be solved in.

One potential solution is to introduce the concept of a problem "trail". A trail would be an ordered list of problems covering a specific topic. Trails would be related to tags, but having a specific order would make them more meaningful than simply searching the problem page for a tag. For instance, there are a lot of elementary problems, and they haven't necessarily been added to the site in the order they should be solved in. A problem could belong to one trail, multiple trails, or no trails at all. Example trails:

  • Introduction to Clojure
  • Recursion
  • Core Functions
  • Higher Order Functions

What do people think? Is this a good idea or a bad idea?

OpenID

It would be good to use an OpenID solution rather than requiring users to create yet another username/password pair for our site. I haven't looked into how hard this is.

.toLowerCase broken-ness

From our nemesis Huacanacha:

fyi: seems like the forced lowercase name isn't working... allowed me to login again with Huacanacha as a distinct user, different to huacanacha but using same password. So the case checking/conversion seems to be on password check only, not for the actual login.

I'm going to mark this as a 0.1.0 showstopper - I don't think we can afford to have this kind of issue.

User search problem

Sorry, I don't have time to fix this myself ATM, but I noticed a small problem when searching for users:

http://twitpic.com/4sexpv

As you can see it seems to include the term "contributor" form the span in the filtering, which is probably not what we want.

Limit Top Users to Top N Users

As we get more and more users we need to consider limiting the page to be the N top users. The JQuery table is loading client side data - so eventually if we don't put in a limit, the page load time will increase

Feedback about which tests failed

@Chouser suggested that when you submit a solution, we fake up a little animation of a unit test framework running your code against the tests. Put up a little green light next to each one you pass, waiting say a quarter of a second in between, and a red light for ones you failed. I think this sounds awesome and we can do it with a pretty small change to the server and a smallish amount of jquery.

/about/version page

I'd like a dynamic page that lists the git SHA for whatever version is running. This would make it easier to debug and reproduce issues discovered on the live site.

Database performance

Especially since Raynes tweeted us, the user base took off a bit. We should add indexes to mongo, and fix any especially bad queries.

User Problem Submission Testcase Bug

Submitting a problem with testcases like this causes problems:

(= __ 1)

(= __
(- 2 1))

I think the best way to fix this would be to have users add one testcase at a time. Each time they click the button to add a new test case, it should show up above the text box using the syntax highlighter like it will once the problem is posted. Also, instead of using a plain text box for the test cases, it would be nice to use the ACE code box.

Syntax Highlighter hides __ blanks

Not sure if this is an artifact of my low-resolution browsing, but the highlighted code boxes have a pixel or two of vertical scroll room, and the __ blanks the user is supposed to fill in are hidden below the scroll area. I'm not really sure how to fix this issue; I've seen similar scrolling issues on other sites, but for any character other than _ it doesn't really hide anything of importance, so I've never much minded. For us, obviously, it's potentially a serious issue if more than a few users are seeing it.

Giving this to @daviddavis since he added SH support, but if someone (@gigasquid?) wants to take it away, feel free.

Clean up namespaces

We have a lot of unqualified (:use foo bar baz) in our namespace declarations. These are as gross as import foo.bar.* in java, and make it hard to tell without an IDE where a particular var comes from. These should be cleaned up into use...only and require...as.

Link to try-clojure.org

Users have been asking for a REPL. Integrating a REPL should be a pretty low priority since free online REPLs already exist, but it would be nice if we linked to try-clojure.org so they can try stuff out independently of our ugly code box.

Problem suggestion from user

Convert a sentence into a sorted list of words. Sort should ignore case.

“This is a nice day” => ‘(“a” “day” “is” “nice” “This”)

Send users someplace better after solving a problem

/problems is not a good "default page" now that we have too many problems to easily fit them all on one page. I think the best choice would be to leave the user at /problem/N after they solve problem N, with their code still displayed for further tweaking, or for sharing, as well as a link to the next unsolved problem.

Streamlining the UX like this would make it easier for users to solve lots of problems in a single sitting; on the other hand, one of the biggest motivators is that column of checkmarks getting filled in, and keeping users off the problems page would reduce that immediate feedback. Maybe we can find some way to display a limited subset of "nearby" checkboxes on the individual problem pages, in a sidebar? Eg, when you're solving any problem 1-10, you see the first ten checkboxes gradually being filled in; when you make it to problem 11 you get a new set.

So I think this needs some thinking and careful design to avoid ruining the positive feedback, but is a good idea once we figure it out.

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.