6 ms·
Introducing Clochure: a better Clojure
- finishingmove 14y agolmao
- deleted 14y ago[deleted]
- TylerE 14y agoThis actually makes a certain sense. Especially the whole "no need to use shift to type the single most common character in your code" thing.
- silentbicycle 14y agok and REBOL do this, actually.
- deleted 14y ago[deleted]
- DennisP 14y agoNow you've got me thinking. The brackets still require a pinky stretch. But suppose you start with a TrulyErgonomic keyboard: http://www.trulyergonomic.com/store/index.php?route=product/product&path=82&product_id=69 http://www.trulyergonomic.com/store/index.php?route=product/... 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.
- TylerE 14y agoEven with a standard keyboard you can use left and right ALT, which would be the same sort of thumb action.
- rmrfrmrf 14y agoReclaim thousands of lost microseconds with Clofjure: fdef x 6j -> #'user/x fdef y 36j -> #'user/y f+ x yj -> 42
- jonahss 14y agoFinally a language I can get behind. I was never able to get into closure, but couldn't put my finger on the reason why. If only more languages could redefine themselves to be more usable and admit they have been outdated for years.
- thejsjunky 14y agoI'll cop to it: this had me going for a couple hundred milliseconds.
- dilap 14y agoIt took me about 5 seconds. One of the few April fool's day web-jokes that's both plausible + hilarious. :) (Also, maybe I'm insane, but I think I do find the square brackets a bit easier to read...)
- crazygringo 14y agoI was actually totally surprised I find it waaay easier to read. I'd never have guessed. Something about vertical lines being easier to "separate out", while parentheses, being curved, blend in more with the letters. Who'd have thought?
- rbolkey 14y agoYeah ... I was caught too. "Why on Earth would .... ohhhh".
- minopret 14y agoYeah, good gracious, how many better Clojures do we need?
- facorreia 14y agoThis is an example of Poe's law in action. http://en.wikipedia.org/wiki/Poes_law http://en.wikipedia.org/wiki/Poes_law
- Wilya 14y ago> The [] keys are closer to the central row of your keyboard than the less comfortable (). > 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 ?
- berntb 14y agoWhy don't you give up and map your keyboard to US for programming, like all the rest of us? :-) (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.
- dkersten 14y agoPfft, why don't you give up and map your keyboard to Colemak for programming (and everything else), like.. well.. the few people like me.. ;-)
- krenoten 14y agoDid you completely lose your ability to use non-colemak layouts after switching, as I recently have?
- dkersten 14y agoI can use it, but I can't touchtype it, so I do feel a little stupid sometimes typing on qwerty and probably couldn't do it without at least glancing at my hands. Its worth it for me though because I spend so much more typing on my own colemak keyboard than I type on qwerty.
- reeses 14y agoThe standard recommendation is to type Sholes 5-10 minutes a day to maintain your ability to hurt your wrists. I haven't bothered to do that and it's a good thing I leave my keycaps alone for the few times I run a VM that is stuck in US layout. I've lost the rolls and fingerings as I've gained them with Colemak. 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.
- nollidge 14y agoEverybody check the calendar.
- swixmix 14y agoApril 2 in Japan. (Yet another i18n problem to consider.)
- alberich 14y ago> Easier to read, compare: (+ (expt 2 30) 2) with [+ [expt 2 30] 2]. Really? So now... in place of "lots of irritating superfluous parentheses" you get "lots of irritating superfluous square brackets"? meh
- muraiki 14y agoNote the date.
- weejud 14y ago[] is harder for me to read than ()
- pekk 14y agoThis is a fine self-parody
- therockhead 14y agoFirst of April is such a pain.
- pmelendez 14y agoFunny thing... is that the discussion is actually turning serious... so my new guilty pleasure is to read serious discussions about April fools' jokes
- columbo 14y agoIt's a great start, but I think <> would have been more appropriate, you could call it clomuretext.
- stefantalpalaru 14y agoThe next logical step is replacing all the square brackets with accolades (same time next year).
- tcdowney 14y agoThey totally had me with this. "So on the eve of April 1st we sat down in a brainstorm session with a team of PLT experts."
- michaelwww 14y agoI most comfortable programming in Morse code and this doesn't have anything that might tempt me to switch.
- asperous 14y agoI honestly think if they replaced the parenthesis with indentation they might actually be onto something
- prezjordan 14y agoHad me going for a while. In all seriousness, you can type clojure with square brackets, no? IIRC in Racket they are transferable.
- tomku 14y agoNo, square brackets in Clojure are vector literals. They are equivalent in Racket, though.
- addlepate 14y agoSeriously though, the problem isn't parentheses, the problem is prefix notation and the "inside-out" nature of composed function calls. The latter admittedly can happen in imperative code too, but is encouraged in functional programming. It just makes the code an immediate turn-off to try to read for me.
- rayiner 14y agoCheck out clojure source in the git repository...
- overloaded 14y agoFrom the logo I was expecting Japanese brackets: 「「MyObject alloc」init」 For the vacillating, have the best of both worlds: 〔〔MyObject alloc〕init〕
- fosap 14y agoI'd like to see a lisp that allows all the kinds of different brackets. ( 〖〗〘〙〚〛〈〉() [] <> and maybe more.) I think i can make the code easier to read. All we would need was a emacs script. When the cursor is on the closing bracket there could be a drop down menu. But aside from Haskell Language creators seem to be god dammed afraid of unicode in the language.
- callmecosmas 14y agoRacket allows for (), [] or {} in code and it seems that in practice [] is used to distinguish some syntactic forms that have nested parens from normal function calls such as the let and cond forms. So instead of (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._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._cond%29%29 http://docs.racket-lang.org/reference/if.html?q=cond#%28form...
- smrtinsert 14y agoAfter using TCL for several years and actually liking it, I have to admit the brackets look better. Plus lately I'm all about anti-rsi and shift parens is getting to be a major hassle.
- sergiotapia 14y agoWell `[]` _is_ easier to type than `()`.
- pmelendez 14y agoBeware fellows... This is the best discussion to tell who is a skimmer and who is a reader in HN :)
- middayc 14y agothere actually is a concrete language where this (from clochure ex.) (+ (power 2 30) 2) and this + power 2 30 2 both work and mean absolutely the same. so if parens are the problem ...
- drivers99 14y agoOr in forth, which uses reverse polish notation: 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.
- minopret 14y agoIndeed, Gregory Chaitin uses a Lisp without parentheses. It just requires that every function must have a predetermined and fixed arity.
- kailuowang 14y agoOne thing to add is that [] is much closer to the right pinky finger, which immensely boost the typing speed comparing to (). Now that's what I call a true re-thinking in code productivity. If we go another step further we might consider using ; ;+ 1;- 3 2;; I am liking it already.
- loumf 14y agoOf course, PG covered this in the Arc FAQ 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. http://www.paulgraham.com/arcfaq.html http://www.paulgraham.com/arcfaq.html
- ruttiger 14y agoApril Fool's ruins the internet for a day.
- richoffrails 14y agoIn before brogramming Clochure programmers are referred to as Brochures.
- djhworld 14y agoThis is one of the better pranks I've seen today, this bit especially made me chuckle > It compiles faster, since the compiler don't need to differentiate Java parentheses from Clojure ones.
- dannowatts 14y agoeven knowing it's April fools, I wanted to believe this. even with some of the crazy reasonings so... maybe it will be a project that has legs, after the holiday has passed!
- SolarNet 14y agoI know it's a joke, but 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. 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.
- danneu 14y ago> 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.
- desireco42 14y agoOK you got me with this :)
- jsgrahamus 14y agoApril Fool's?
- mseepgood 14y agoWhat a missed opportunity. Reverse polish notation doesn't need any parentheses and it works well for Forth. Why do all Lisps make the same mistake?
- nswanberg 14y agoThe post is meant to be a joke, and isn't a bad one as such things go, but its fun to note that square brackets and Lisp go back quite a ways, and were a feature of M-expression syntax. [1] 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 http://en.wikipedia.org/wiki/M-expression [2]: http://reference.wolfram.com/mathematica/tutorial/GettingUsedToMathematica.html http://reference.wolfram.com/mathematica/tutorial/GettingUse...
- SeoxyS 14y agoI got really excited for a second, and then I realized it was April 1st. 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.
- fictorial 14y agoI really just need to turn the computer off on April 1 every year. Argh!
- deleted 14y ago[deleted]