Live data from Hacker News

Using Clojure for Web Apps

github.com

61–70 of 122 posts

Re: Using Clojure for Web Apps

#61

Some of my favorite Clojure libraries in this space: - instaparse: takes EBNF (and other formats) as a string and gives you a parser instantly (!!!) https://github.com/Engelberg/instaparse - re-frame: React-Redux alternative that IMO is much easier to work with https://github.com/day8/re-frame - reagent: React wrapper https://reagent-project.github.io/ - ring https://github.com/ring-clojure/ring - fulcro https://gith…

> desirable in most CS curricula. most of the alogrithms and datastructures that you learn in CS were developed using mutability. I am not sure that we can even develop immutable equivalents for most of them with similar time/space complexities.

Sure, and we could argue about whether mutable code is necessary at systems layers. But at application layers (i.e., the ones most developers work at), cost of development is almost always going to come before performance, and I think it's clear by now that OOP, at least insofar as it has been instantiated by Java, C#, and friends, has not delivered on its promise to simplify application development.

Re: Using Clojure for Web Apps

#62
post #47

Earlier quoted context omitted.

Python has too few parentheses, Clojure has to many. There’s just no winning. Ultimately, these complaints are superficial and serve only to justify one’s laziness.

Clojure has the same number of parens as Javascript, C/C++, Java, and similar languages have parens+squiggle-brackets. (print "foo") vs print("foo"). same same. There's so much more to it than this. I can say without reservation that people who do not take a couple/few weeks to learn a Lisp just do not know what they are missing, and their arguments against it are viewed as children who lack enough experience to know…

>(print "foo") vs print("foo"). same same.

If you look at things other than function calls, it starts to look different:

    let x = 5,
        y = 10
    foo(x,y)
vs

    (let [x 5 
          y 10]
      (foo x y))
I actually like Lisps and think the S expression syntax is one of their best features, but I'm not going to pretend there are the same number of brackets in Lisps as there are in C family languages.

Re: Using Clojure for Web Apps

#64
post #8

Navigating that slide deck was surprisingly frustrating. Clicking forward 10 times to get through a single slide must have been really annoying to present, too.

arrow keys seem to work ok.

Not on my tablet, trying to skim it at lunch.

Future consideration...

Re: Using Clojure for Web Apps

#65
post #23

I've been slowly learning Lisp to hack on Emacs, org-mode and org-babel. Main goal being to turn AWS JSON data into org-mode headings and org-babel data to do further work on. Very much a side project and I'm a bear of very little brain, so it's taking me a long long time. Seeing Clojure and other Lisp stuff in the wild gives me hope that I can lean on enough people's documentation and source that I can eventually le…

> I know some folks sneer a little at Lisp I wonder why. Some developers I know and hold in high regard have almost venerated Lisp, so I've always thought there must be something to it. I just thought it wasn't something you could actually use IRL, but I was wrong. I found this out when I was recently motivated to learn Clojure, and now I am starting to grok their admiration.

I think the ideas spelled out in rationale are really what sets Clojure apart from all the other lisps.

For decades, I got excited every time a new idea around lisp or functional programming and I'd play with them for weeks. Eventually, I'd get to the big question, how do I bring this idea into development environment that solves the hundreds of other ugly real-world problems I have to deal with to make a usable application? Clojure solves that by being hosted.

Immutable data structures are great, but when it's the default, it's a huge win in cognitive-overhead. Maybe that feature isn't unique to Clojure but it's certainly not a prerequisite to being called a lips or a functional language.

Singly-linked lists are cool, but almost every other type of list is cooler, being able to read, eval and print those as well is really cool.

Re: Using Clojure for Web Apps

#66
post #56

Earlier quoted context omitted.

Python has too few parentheses, Clojure has to many. There’s just no winning. Ultimately, these complaints are superficial and serve only to justify one’s laziness.

There's a huge difference. The parens in lisps are significantly detrimental to its first impression, and 3rd, 4th ... I have literally never met a developer I can show a lisp code sample to whose reaction isn't "what the hell is that?" It looks totally alien compared to C-style langs, which is what most people learn. With Python, that is not the case at all, basic Python can be interchanged with pseudo-code for the…

The claimed problem that exists however is... lame. It really boils to "if it doesn't look like C, I'm not learning it", which is a fairly pathetic argument, and not one that can actually be bested with any targeted marketing or discussion.

Most developers only learn a new language because they're forced to: at work, or joining an existing project as part of their hobby, or because the library they need requires it, or because its the only option available to them. At the point, the fact that it looks like C, or doesn't, won't matter. And they'll get over it. No one claims Nginx/Apache DSL is great, or terribly C-like. Or even really claim that its un-C-like. But I'll reluctantly learn it (to a minimum need) because I want my damned site up. Most languages are learned like that.

Developers who learn a new language for the sake of learning a new language will likely not be drawn in by it being C-like syntax, or not. At least, most who've gone around that rodeo a few times will quickly realize that the superficial syntax isn't that interesting -- It takes 20 minutes to learn the syntax (maybe not APL). You're in it for the different semantics.

What you need for mass lisp adoption is to get a hype cycle going, and pathetic justifications for parenthesis isn't going to get you there. Babbling about how hyper-parameterized cooperatively consistent parenthesized datastructures will change the world is likely more effective.

Re: Using Clojure for Web Apps

#67
post #47

Earlier quoted context omitted.

Clojure has the same number of parens as Javascript, C/C++, Java, and similar languages have parens+squiggle-brackets. (print "foo") vs print("foo"). same same. There's so much more to it than this. I can say without reservation that people who do not take a couple/few weeks to learn a Lisp just do not know what they are missing, and their arguments against it are viewed as children who lack enough experience to know…

>(print "foo") vs print("foo"). same same. If you look at things other than function calls, it starts to look different: let x = 5, y = 10 foo(x,y) vs (let [x 5 y 10] (foo x y)) I actually like Lisps and think the S expression syntax is one of their best features, but I'm not going to pretend there are the same number of brackets in Lisps as there are in C family languages.

The first example is missing the scope brackets likely enclosing the expressions, and there should probably be a few semi-colons.

Re: Using Clojure for Web Apps

#68
post #18

We use pedestal+fulcro3+pathom om.next was before that, but it seems to be almost abandoned, also fulcro author have solved a lot of depressing pain points of om.next. Those three work like a perfect Lego.

What made you choose pedestal over compojure/compojure-api or other alternatives? Similarly, why fulcro3 over something like reagent/re-frame. I have used the latter choices and am considering switching for the my next project.

Re: Using Clojure for Web Apps

#69
post #67

Earlier quoted context omitted.

>(print "foo") vs print("foo"). same same. If you look at things other than function calls, it starts to look different: let x = 5, y = 10 foo(x,y) vs (let [x 5 y 10] (foo x y)) I actually like Lisps and think the S expression syntax is one of their best features, but I'm not going to pretend there are the same number of brackets in Lisps as there are in C family languages.

The first example is missing the scope brackets likely enclosing the expressions, and there should probably be a few semi-colons.

>The first example is missing the scope brackets likely enclosing the expressions

Sure, but so is the Clojure one. So I guess it's more like:

    fun bar () {
      let x = 5,
          y = 10
      foo(x,y)
    }
vs

    (defn bar []
      (let [x 5 
            y 10]
        (foo x y)))

Re: Using Clojure for Web Apps

#70
post #56

Earlier quoted context omitted.

Python has too few parentheses, Clojure has to many. There’s just no winning. Ultimately, these complaints are superficial and serve only to justify one’s laziness.

There's a huge difference. The parens in lisps are significantly detrimental to its first impression, and 3rd, 4th ... I have literally never met a developer I can show a lisp code sample to whose reaction isn't "what the hell is that?" It looks totally alien compared to C-style langs, which is what most people learn. With Python, that is not the case at all, basic Python can be interchanged with pseudo-code for the…

> Pretending this problem doesn't exist

Young children tend to look with disgust upon many meals that adults find especially delicious. Is it a problem with the food, or is it a matter of experience and perspective?

I'm very tempted to give examples, but it's not worth it here. Suffice to say, this falls squarely in the category of "you don't know what you're missing".

In this long essay by Paul Graham - http://www.paulgraham.com/avg.html - if you're willing to search for and begin reading at "The Blub Paradox", you'll get a sense of what I mean.

And then if you want to really be enlightened, at least to concepts that really what matter regarding programming languages, go watch videos from Rich Hickey (Clojure).

Post reply on HN