Git Product home page Git Product logo

tryclojure's Introduction

tryclojure

TryClojure is a online Clojure REPL written using Noir and Chris Done's jquery console (you're awesome, Chris).

Usage

http://tryclj.com

To run it locally, use lein ring server.

Credits

apgwoz: Design

License

Licensed under the same thing Clojure is licensed under: the EPL, of which you can find a copy at the root of this directory.

tryclojure's People

Contributors

amalloy avatar apg avatar datadebrief avatar dellis23 avatar devth avatar fogus avatar glenjamin avatar licenser avatar mefesto avatar mkopinsky avatar mpenet avatar nusco avatar raynes avatar technomancy avatar zemanel 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

tryclojure's Issues

Code examples not clickable

The code examples in the tutorial need to have a class of "expr" so the user can click them to insert into the console.

The JavaScript to enable this behavior already exists, as you're probably aware, and it is easier than copying and pasting.

def* doesn't work

All functions that define anything have been disabled due to a general high-memory usage problem. It's too easy to break. Heinz is working on a way to mend this in clj-sandbox.

def'd square function fails

Browser is Safari Version 8.0.2 (10600.2.5) Mac OS/X Yosemite 10.10.1

> (def square (fn [x] (* x x)))
#'sandbox32479/square
> (square 10)
java.lang.IllegalStateException: Attempting to call unbound fn: #'sandbox32479/square

error

#'sandbox7895/square
> (square 10)
java.lang.IllegalStateException: Attempting to call unbound fn: #'sandbox7895/square

Upgrade everything to 1.2

Everything is running on 1.1. There are a couple of libraries that I don't own that tryclojure relies on that don't run on 1.2. Upgrading them to 1.2 should be trivial, and they can be uploaded to clojars under a non-canonical groupId until the original authors push their own updated version.

Problem with tryclj.com

Hi, I have a problem with examples on tryclj.com. Here my output:

(defn square [x](* x x))

'sandbox6120/square

(square 10)
java.lang.IllegalStateException: Attempting to call unbound fn: #'sandbox6120/square

Tutorial, define fn without defn - Unable to resolve symbol: x

Proceeding through the tutorial results in the following error:

> (def square (fn [x] (* x x)))
java.lang.RuntimeException: Unable to resolve symbol: x in this context

On the step:

If you want, you can create a named functions without using defn: type

Wrong casting of key map

(def keymap {:a 1, :b 3}) should be casted as clojure.lang.PersistentArrayMap , but it casts as clojure.lang.Var$Unbound
(def keymap {:a 1, :b 3})
(class keymap)

defrecord not supported ?

I tried the following in the REPL :

Give me some Clojure:
> (defrecord Person [fname lname address])
java.lang.ClassNotFoundException: clojure.core.Person

(doc ...) triggers SecurityException

It seems that even dereferencing Vars that have security implications already sets the sandbox's alarm bells off:

Clojure> (doc slurp)
java.lang.SecurityException: Code did not pass sandbox guidelines:
(#'clojure.core/slurp)

Clojure> slurp
java.lang.SecurityException: ...

I would have expected that the crucial part is actually calling .invoke(). Is it possible to only forbid that? Meanwhile I'm going to use clojuredocs.org to look up online documentation :-)

Gary's evil code breaks

@fredericksgary posted some crazy code that behaves differently in tryclj.com vs. a local REPL (w/ every version of clojure I could get my hands on)

In tryclj.com:

(let [let 'let let' let] (let let' let))
;=> java.lang.IllegalArgumentException: let requires a vector for its binding in clojure.core:

In local REPL:

(let [let 'let let' let] (let let' let))
;=> let

No idea how tryclj.com works, but thought you guys might like to know in case this isn't desired behavior.

New Closure tips and good practices and more

Hi,

your tryclj.com is awesome!
It's very fast and interesting. I'd like to see more tips and good practices on Closure.

I mostly work with Python now, and studying Closure is very refreshing.

Internet Explorer 9 no CSS

At my work, we're forced into using IE9, I sometimes fire up the online REPL but it looks so bad at IE9, there's not a single styled element. Any reason for that? Or compatibility issues?

Automatic scrolling to the bottom of the output div.

This doesn't quite work correctly since syntax highlighting was added. It scrolls almost to the bottom, but not all the way down, which can be annoying. Also, I'm not entirely certain that the current method of scrolling works reliably in Chrome. Don't know, because it hardly works at all right now.

Working on mending this.

Typoe

On the main page "they're results" should be "the results" or possibly "their results"

Problem with tryclj.com

Hi, I have a problem with examples on tryclj.com. Here my output:

> (defn square [x] (* x x))
#'sandbox6120/square
> (square 10)
java.lang.IllegalStateException: Attempting to call unbound fn: #'sandbox6120/square

PermGen space

Currently, every single command leads to a PermGen space error message.

10/3 = 3.3333333333333335

I was following the instructions and found Clojure returned the result in the title. But it is wrong. It should be all 3 after the decimal point. Even ceilinging should give a 4 at the end instead of 5.

Transcripts

Feature idea: what if Try Clojure stored a transcript of each user's REPL session? Then, when the session expires, it could mail the transcript to the contributors, or store it somewhere.

This would be very useful for editing the steps. For example, if many users make the same syntactic mistake, you might change the text to warn against it; if many users drop out at the same step, then you could scrap that step or make it easier; and so on. Instead of guessing what works and what doesn't, you could just see it happen.

Make tutorial window $("#changer") preserve height between tutorial pages

There is enough time between page loads where the copyright notice at the bottom is re-flowed to just below the jquery console, and then jumps back once the tutorial content for the next step is re-inserted into the DOM. The window should preserve it's height between transitions too prevent the copyright notice from jumping around.

Improved sandboxing

The sandbox needs to be updated be more like sexpbot's sandbox. This also requires my latest snapshot of clj-sandbox, which is 1.2 only. This has to come after the 1.2 upgrade.

Add newline capabilities

Sometimes I'd like to work out a function or loop that extends beyond the window, but I can't for the life of me figure out if there's a way to drop to another line. It'd be nice to have something like shift + enter for multi-line capabilities.

"Vectors and lists" - wording in tutorial

At one point in the tutorial, it states "Vectors and lists are sequential and ordered collections" - but the preceding example does not show anything called "lists", just vectors, maps and sets.

Maybe vectors and lists are the same thing? I don't know Clojure yet.

Escape problems

It seems the code is escaped twice: try executing ">" for example.

"Vision"

Raynes, I don't know what you want to accomplish with TryClojure, but I see three obvious use cases:

1 - an online REPL for Clojure programmers;
2 - a quick teaser for people getting into Clojure;
3 - a basic Clojure tutorial.

1 doesn't seem either very useful or particularly easy to do (we'd need multi-line input at least). 2 and 3 can kinda coexist, and Try Clojure seems to want to address both - but I think that 3 is a lot of work. I believe that 2 is both the most realistic and useful target. It's also the use case I personally care for, because it brings people to Clojure, and I'm just starting to learn Clojure myself, so I'm all about evangelizing. 😃

So, if you agree we should focus on 2, then maybe we can review what we have and put in some constraints. I imagine the person coming to the site as an OOP programmer exploring something different - the teaser should captivate her and convince her that Clojure is exceptionally cool and useful.

This teaser should be fun, very fast (like, 5 to 15 minutes), and it should show the most mind-blowing features of Clojure, to pique people's curiosity. It's not a problem if the teaser doesn't explain the features in enough detail for the user to understand everything, as long as they make him eager to learn more.

For example, a tutorial-like description of Clojure's types is probably not very compelling for a teaser. On the other hand, showing macros and hinting at their power (cool), or showing people how easily they can use existing Java libraries (useful) - that would work. This means dropping a few pages from the current Try Clojure and introducing a few new ones, and I'm not sure I'd have time to do this myself - but it can be a good guideline for future contributors.

Sorry, this was really long. And BTW, the existing Try Clojure is great already, so I'll be happy even if you have a different vision for this thing.

Ability to increase REPL area

My lein REPL broke, and so I've been doing a fair bit of Clojure exploration in the tryclj REPL today, and while it's great, it's been annoying not being able to resize the textarea the REPL is in.

Is it possible to add this option?

Thanks.

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.