Introducing Clochure: a better Clojure
clochure.org
clochure.org
> You don't need to hold the shift key to type [] therefore you can code faster.
That's true only for a standard US-qwerty keyboard layout. My [] are located at altGr + (). These guys clearly haven't though i18n through. And if there are such blatant omissions on their front page, who knows what's lurking in the code ?
(It is not so bad to hit both shift keys to get back åäö.)
Edit: mpyne -- good thought, but we international users have our national keyboards in the fingertips, it is imho generally easier to switch layouts.
Edit 2: dkersten -- my productivity-porn time wasting is used up by browsing Emacs packages. :-) I'll check it out if I get wrist problems.
It's really sad when I have to use someone else's computer, but then I remember that my emails were never longer than a tweet when I first started with Colemak.
For [], I have to move my hand to the right, away from home position.
There probably are bugs but not because they're unaware of every keyboard layout. It's far easier to accommodate different languages, currencies, number formats, etc than it is to accommodate every keyboard layout.
English and US keyboard layouts (or its close relatives), for better or worse, dominate the programming world.
I don't think the conclusion you've drawn, that there must be issues with the code because your local keyboard layout hasn't been thought of, is logical. That's like saying that because the language keywords and standard library aren't in your native language, there must be dragons lurking in the code.
Having said all this, Clochure does appear to be a nice little April 1st joke and should be flagged with prejudice!
Edit: note that there might be a small tradeoff in readability.
[1]: http://img2.generation-nt.com/xbox-360-pedalier_090320025800...
Just enclose j and k in parentheses on those rare occasions. Problem solved.
Clojure is a language I absolutely love, but have abandoned for practical reasons. (Debugging Clojure is an absolute nightmare, and the tooling doesn't quite agree with me. The JVM is the biggest hurdle in making Clojure useful for me: it causes slow startups times, a bloated environment, and makes it hard to deploy in our production environment.)
So my immediate though when I read "a better Clojure" was: somebody wrote an LLVM front-end for Clojure and turned it into a fast language compiled to native code.
It is also interesting to note the reasons why Mathematica's syntax, which shares some similarities to Lisp, uses square brackets instead of parenthesis, specifically to avoid ambiguity when using parenthesis to denote grouping terms. [2]
[1]: http://en.wikipedia.org/wiki/M-expression [2]: http://reference.wolfram.com/mathematica/tutorial/GettingUse...
(Also, maybe I'm insane, but I think I do find the square brackets a bit easier to read...)
Something about vertical lines being easier to "separate out", while parentheses, being curved, blend in more with the letters. Who'd have thought?
Map the end key to (, and the left arrow to ), and you're hitting both characters with your thumbs.
Then maybe map brackets to PageDown and the down arrow, and braces to PageUp and up arrow for an easy reach with the ring finger. Or those big delete/backspace keys in the middle could be useful.
No self-respecting vim user needs any of these keys.
fdef x 6j
-> #'user/x
fdef y 36j
-> #'user/y
f+ x yj
-> 42 「「MyObject alloc」init」
For the vacillating, have the best of both worlds: 〔〔MyObject alloc〕init〕 (cond ((...) (...))
((...) (...))
(else ...))
you get (cond [(...) (...)]
[(...) (...)]
[else ...])
which seems to me to be more readable. See here for an example http://docs.racket-lang.org/reference/if.html?q=cond#%28form...Really? So now... in place of "lots of irritating superfluous parentheses" you get "lots of irritating superfluous square brackets"?
meh
The same goes for every other syntax problem out there. Python and choosing between tabs, spaces, and smart tabs. The C family and choosing between where the damn braces go. Different keyword symbols (to support different languages!). Different symbol naming styles. All at the whim of personal preference.
We have the technology and (computer) science (more the mathematics really) to build such systems, why don't we!?
/rant
P.S. This is actually what I am working on... When I'm not busy... which is never.
> why are languages so damn stuck on syntax.
> Why can't it be a one line change for person A to
> have () and person B to have [] (and person C have <>,
> or {}), and then have tools which automatically
> translate between them.
Aren't languages stuck on syntax because syntax is what's standard? It's the terms in which a language is defined and it's what we must agree upon before we can even start building our own abstractions or swappable gylphs for the parts we don't like.Fortunately you can use technology to compile your personalized syntax to the standard syntax.
We already do that. In fact, entire communities are built around custom syntax layers.
I imagine someone would only map "()" to "[]" because "()" is either unfamiliar or harder to type.
The superior solution is to learn "()" so that it becomes familiar or map "[]" to "()" respectively.
In both solutions you have an end result that does not distance the source code in the editor from the source code you're pushing to your repository, and that's the kind of thing we seem to optimize for as developers.
Obviously I have no idea what you actually had in mind, this is just what came to mind when I read that bit.
Why not use some other delimiter than parentheses?
We tried various possibilities. Square and curly brackets lose because they are less directional than parens (left and right differ in fewer pixels); < and > lose because they don't wrap around enough to enclose expressions longer than tokens.
"So on the eve of April 1st we sat down in a brainstorm session with a team of PLT experts."
> It compiles faster, since the compiler don't need to differentiate Java parentheses from Clojure ones.
so... maybe it will be a project that has legs, after the holiday has passed!
(+ (power 2 30) 2)
and this + power 2 30 2
both work and mean absolutely the same. so if parens are the problem ... 30 2 power 2 +
(a constant gets pushed onto the stack. functions like "power" and "+" operate on the stack)So this also works:
2 30 2 power +
Although I don't really use it anymore, my calculator (an HP scientific calculator) also uses reverse polish notation, so you can keep intermediate values on the stack, and do complex calculations without using parentheses at all. This is also good for keeping people from asking to borrow your calculator in math class. :)What is the syntax that you posted? It looks just like RPN in reverse. Ok, that was a stupid question. I just figured out that is just "polish notation." It must keep a stack of operations that don't have their operands yet.