Fork me on GitHub

Is there a time complexity table somewhere for clojure structures?


not a table, but in the book “Clojure Standard Library” for every discussed function there is a performance considerations paragraph:

Steve Smith09:07:39

Hey all, I've been listening to Rich Hickey's talks and I've been convinced. I want to make a web app with a clojure back end and a clojurescript front end.

Steve Smith09:07:25

I want to have user authentication/authorization and I'd prefer to use a document store like mongodb.

Steve Smith09:07:43

Will compojure work for me?


Compojure will likely be part of your app, since it's widely used and you'll find lots of people who know it well enough to answer questions about it. Compojure is just the piece that connects /some/app/url to the code that's supposed to respond to that URL, so you'll need more than just Compojure.

👍 2

@lee.justin.m “I’d like to maintain the “looks imperative” style.” Aha! I have been trying to get a Clojurian to admit threading is imperative/procedural! You will be cited in many footnotes to come. 🙂


We’re gonna need a bigger bibliography…


i feel that way about lengthy lets


@hiskennyness well undoubtedly someone will tell me i’m using the word “imperative” wrong. but when my internal model is “do this then that” I want the code to look that way. i think this is why sql of any complexity is very hard to understand.


Yeah, a die-hard Clojurian swore to me that do-this-do-that threading was functional, so yer in trouble. 🙂


I use CTEs in SQL so I do not lose my mind.


there's nothing not-functional about it


the problem is in what is meant by these words. threading still gives you referential transparency (which is functional), but the code is time-ordered (which is imperative, in my mind).


any synchronous code is time-ordered. by that logic do or when or even defn are imperative because you can have multiple sequential statements?

👍 1

imo threading is just syntax sugar for regular clojure code, syntax sugar can't be imperative or functional, as it does nothing by itself

👍 6

yes this is exactly how i thought the conversation would go. 🙂


I agree, but I think let (as opposed to threading) is a bit more than just syntactic sugar for regular code. let lets you get away with writing very imperative-styled code though


Y’all need to read Paul Graham’s On Lisp. Syntax is semantics.


Right, Paul Graham wanted an imaginary tax on let.


@vale yes, i do think they are imperative in a sense. any def is imperative since it mutates the global state 🙂


I’m talking about style, really.


def is definitely imperative to me, as well as ns


who cares?

😂 6
💯 3
👍 2
🎉 1
✌️ 1

these are unimportant labels


just solve problems

🎆 2

Threading’s excuse is that no new “places” in the sense of named state are introduced. Not buying it, ->>! 🙂


in my case, I don’t care. but in my original question from yesterday i was trying to use some word to communicate what problem i was trying to solve


Who cares about code readability? Me, anyway.


maybe I’ll say “time-ordered code” next time because the word “imperative” always draws sharp reactions


i think it’s downright funny that people emoji’d up the “who cares” above because people clearly do care! it always draws a reaction


I don't really get what you mean time-ordered, but I get what you mean by imperative. It's not like every top-level form executes asynchronously


I guess as-> helps a little. Me, I can never keep straight where the imaginary “place” is in threaded code. No, ,,, was not the answer. 🙂


I mean “first add this thing, then add that thing, then do that”


and the code is in that order


I mean, who cares that def is imperative (creating side effects), if it doesn't create problems for you/your program (in contrast with general data structure mutability)


Funny seeing the incredibly conformist Clojure crowd suddenly cheering “Who cares?”


I do not see the Clojure crowd as conformist :)


@joelsanchez That’s fine, but if I put a closing parens on its own line I get tarred and feathered. 🙂

cparen 4

well, that’s just wrong ;)

parens 1

Have you ever read a Clojure style guide?


I also believe that's poor style but I don't see the connection to the current discussion


Love the closing parens emoji!! On its own line! Twenty pushups for both of you.


Paul Graham illustrates functional code as flowing down and to the right. Lispers “get it”. Clojurians turn it into a thread of steps, losing (to a Lisper) the true functional flow.


OK, back to beating my head against RN.


doesn't CL lack immutability by default, anyway?


let over lambda's author (the book that builds on On Lisp) strongly argues that lisp is not functional (at least common lisp)


so how can we be less functional?


Could someone explain to me the situation with Java licensing? Should I try and get openjdk? Currently I'm talking about my laptop/home computer.


CL is a big ball of mud. We do what we want. If we are smart, we code functionally. It is better. But no one collapses in a heap if a SETF comes in handy.


“Who cares?“, as some wise soul noted.

🙂 1

I vote for threading being functional 😎

😤 1

@joelsanchez I would distinguish between functional and immutability. With threading we start with x then create f(x) which becomes x for the next f(x) etc. Each f(x) leaves its x unmutated, but in effect a “temp” var is being created and then re-written at each step. as-> is explicit about that. Functionally we say “The dog that chased the car that ran the red light”, beginning with the semantic outcome (the dog) then revealing recursively its derivation from inputs. In threading we have, “There was this red light. A car ran it. A dog chased that.” Imperative, step-wise evolution of the semantics.


I look a functional programming as a pipeline anyway though


threadings dont create temp vars, try macroexpanding it to see it...I guess its more of a "mental concept" problem you're talking about


they are also very dumb in the sensw that they dont care what you are threading, as others have noted before


I'd argue against the "rewritten" part regardless - even when you reuse a binding name in let, there's no rewrite in the sequence of operations


shadowing maybe, no mutation


@clojurians-slack yep, threading is a functional pipeline, but it is necessarily of functions with one parameter, the result of the prior step. My functional mind works with functions of N parameters, so threads look like strait jackets.


@hiskennyness I guess we need a thread-fork -< 😉


Yeah, it can get messy quick


@avovsya openjdk can't hurt. That's always been the first thing I install on a Linux box.


While you all are on this topic. I've been asking around lately... Do you think learning common lisp along with clojure would be confusing. I'm a hobbyists programmer and I've taken a liken to lisp so there are a lot of older texts that I want to go through. I have Paul graham's ansi common lisp and paip. Ive heard good things about LoL but that seems to be a book I need more under my belt for.


I'd say learning scheme and ml would contribute more directly to appreciating clojure


@noisesmith :thinking_face: OK. I've skimmed through sicp. I also wanted to go through the osaki book at some point so I'd expect to have to take a look at ocaml. But why do you say ML over common lisp? Just to experience a purely functional environment?


in terms of the functions used and idiomatic coding style


there's a lot of things that are normal in common lisp that aren't really normal clojure things


and normal ml things that clojure also shares


So I just switched to Spacemacs. I used Emacs for like a week a few years ago, so I am pretty new to the whole Emacs/Spacemacs thing. I have it installed and set up with the clojure layer. However, when it comes to the rest of how to use the editor, I'm pretty lost. Any recommendations/links to good tutorials, things to go through? Trying to get up to speed on Spacemacs as fast as I can so I can get back to learning Clojure 🙂 (I also posted this in the #spacemacs channel)


I’m going through this myself really and these have been fairly helpful. But mostly, it’s been pick things up as I need them.


I use lispy/evil-lispy. It kind of adds another mode on top of evil to navigate similar to the built in lispy mode. I use lisp state for certain things but am starting to get used to lispy/evil-lispy


@ryan.russell011 Recommendations? Stop sounding so cheerful and optimistic, you are crossing the River Styx and the boatman does not like you. Abandon most hope. A wise soul once said “It is easier for a good programmer to learn a new language than a new editor,” and Emacs is a lost-in-the-sixties joke. Spacemacs only make it worse with all its opinionation. Get IntelliJ and spend your next night of drinking on Cursive instead. If however you are an RMS-bred Communist refusing to pay for anything other than beer just go with raw Emacs and Cider and paredit. You’ll be fine in a month. hth!

😬 1

hahaha... well that was an entertaining response. I am wanting to learn Spacemacs for my own personal enjoyment. tbh.. I don't really feel like using IntelliJ for the moment, kind of burned out on it for now. I was using VSCode, but it is still missing things.... and I use Vim for everyday quick editing of config files and such... so figured wth.. might as well learn Spacemacs 🙂 And I am cheerful... I enjoy such things. When I used Emacs for like a week (or two)... I spent like 3 solid days customizing it to what I wanted... started using it for stuff, and ended up in Java where I needed IntelliJ.