Fork me on GitHub
Danny Almeida04:08:38

i'm a bit confused with walkable and pathom...what's the difference between these two libraries and where do they fit in the overall web app scene ?


EQL is a declarative data-oriented query language to query graphs of data inspired by Datomic Pull. pathom is a library that can be used to parse EQL, and connect various data sources to satisfy the queries. pathom has an abstraction called resolver (akin to graphql resolvers) which are used to tell pathom how to query for stuff. walkable is a library that makes plugging SQL-based sources into pathom easily. You can think of walkable as pathom-sql. Watch this to understand more about pathom: And this talk has more demos and how pathom is used in combination with fulcro, a UI library to build "full stack" applications:

Ahmed Hassan05:08:10

Pathom is heavily used in Fulcro apps, but can be used generically for parsing EQL or mapping data sources.

βž• 4
Danny Almeida21:08:41

@U883WCP5Z Thank you. Will go through the links you posted.

Danny Almeida21:08:12

@UCMNZLJ93 yes ..that's why I am interested as I'm going through fulcro docs to understand how to do full stack using fulcro

Danny Almeida21:08:30

Since walkable is only for queries do you propagate mutations back as sql updates/inserts ?

Ahmed Hassan02:08:01

@ULL659VU6 walkable don't support update/insert.

Ahmed Hassan02:08:20

I think you'll have to use Pathom mutations for it.

Danny Almeida03:08:56

@UCMNZLJ93 yeah.. that's the feeling i got skimming through the docs

Ahmed Hassan05:08:56

Pathom is library used for EQL parsing.

βœ”οΈ 4
Ahmed Hassan05:08:31

Walkable is built on the top of Pathom for querying and fetching SQL databases.


Hello, has anyone run into

Error building classpath. connector is not available:  
com.jcraft.jsch.agentproxy.AgentProxyException: connector is not available:  
I'm getting it on my CI when I try to clone a private git repo using SSH ( ). My guess is that there's a a dependency I'm not installing because I don't get that error on my personal linux box.

Alex Miller (Clojure team)13:08:05

are you running ssh-agent?


Ahhh, I didn't start that. Let me do that in my script. Thanks!

πŸš€ 4

Hmmm, so I ran ssh-agent in my CI script and it seems to have successfully run however I'm still getting that same error. I'll try to come up with a minimal reproducible example.

Alex Miller (Clojure team)13:08:24

do you have an identity registered in the agent?

Alex Miller (Clojure team)13:08:25

if not, you need to add your key to the agent with ssh-add


I added the ssh files manually but that could be the step I'm missing. Thanks for the help again!

Alex Miller (Clojure team)13:08:55

ssh-add tells your agent about your identity (the ssh key files)

Alex Miller (Clojure team)13:08:18

and clj is using jsch to talk to the agent (not to look at your files)

πŸ‘ 4

does anyone know of a good tutorial for both server and client auth setup with clojure/clojurescript? so far I've only found back-end stuff, but not sure how to proceed on the client


If you are talking about form based authentication that's pretty simple - just add an html form and submit it to the login route + handle potential auth errors


yeah, I'm building a fairly simple SPA but want to implement all the fundamental stuff, like being able to log in. I'm super new to clojure so I'm not even sure how to approach what you suggest. Would appreciate if you could point me towards some centralised source of info on how to do it with clojure and in some idiomatic fashion


On mobile so don't have access to any links right now. But if you're able to implement any other UI component then login form should be pretty easy. For server side we use friend library - that's IMHO easier to use than buddy.


cool, thanks for the tips


just had a kind of "ah ha!" moment when I saw someone use (repeatedly 5 #(rand-nth [:x :y :z])). Seeing no % in an anon function made me double take. I hadn't thought to make an anonymous function out of an expression that takes no other arguments to use as the function parameter of something creating lazy seqs and such. I don't really have a question I guess, but what do you think of this approach? Any pitfalls I should know? I kind of want to start throwing # in front of stuff now and see what design patterns that leads me through if that makes sense. Still looking for a deeper understanding of concepts like laziness and composing functions.


There are not a lot of functions that don't have a parameter like that, but there is nothing wrong with the expression you show. I wouldn't recommend just randomly throwing # in front of other expressions, unless it is in very isolated experiments at the REPL, when you are curious what will happen. Most expressions that do something useful would likely be changed into a non-working expression by such a change.


You can make a binary etc with #(print %1 %2). It's just shorthand for fn. Sometimes partial is easier.

Alex Miller (Clojure team)18:08:33

if you see # without a %, you're basically looking at a thunk that can delay calculation. Clojure also provides delay which is a bit more elaborate.

πŸ‘ 4
Alex Miller (Clojure team)18:08:40

namely, delays cache their result (include exceptions thrown)

Ahmed Hassan18:08:37

What are good resources for finite state machines in Clojure?


finite state machines are an extremely broad topic and there are many applications and many different approaches

πŸ‘ 4
hiredman18:08:29 is the only library I know of that deals in sort of classical fsm's from automata theory, but even there its approach isn't universal (I like fsm's a lot and try to use them everywhere, but have never ended up using automata)

πŸ‘ 8

outside of automata theory when programmers talk about finite state machines they often mean a loop around a switch statement, or something vaguely actor like, which core.async can fit in well with

πŸ‘ 4

and core.async's go transformation can be seen as turning clojure code in to a fsm

Ahmed Hassan19:08:15

Can you elaborate that?


core.async's go macro rewrite's clojure code to make it possible to suspend and resume execution of the code at various points(for channel operations), this rewrite is often described as turning turning the code in to a state machine, and has the effect of turing the code in to a loop and a case (switch)


coming from the programming view of fsm's as loops around switch statements erlang has its own notions of finite state machines built on actors (gen_fsm, which I don't know a lot about) so there are a few different erlang inspired clojure libraries that deal in that sort of thing

πŸ‘ 4

my favorite fsm reference (not really clojure specific) is the wikipedia page, which talks about classical finite state machines as relations on sets, which is super useful for modeling fsm as data you can inspect and do neat things with, which you cannot do with the loop around a switch

πŸ‘ 4

Is there a tidier way of including values into your strings like python's f'This is a string with a {my_named_value} in it.'?


there's str, format, and clojure.pprint/cl-format


Or do I have to do (str "This is a string with a " mynamedvalue " in it?")


no syntax for it though, those are all functions


there are also templating libs (usually used for html or sql) which accept a similar substitution syntax, but take the substitutions as a hash map, not named locals


Yeah, the (str) function is what I want here, I just really liked python's f-strings for their tidiness and easy reading.


Can anyone please tell me how I can shade dependencies when building an uberjar with lein?


Thanks, I will see if this works for me. Much appreciated.


@alexmiller I am reading through mrandersons README and I can't quite make out whether it can solve my problem, which I would describe as being equivalent to , would you mind taking a quick look at the post and giving a yes/no response as to whether I should pursue mranderson as the solution to this problem. If you don't have the time it's no worry. πŸ™‚

Alex Miller (Clojure team)20:08:03

I’ve never used it but people use it for the same purpose as maven shade


Cool, I will do some further research tomorrow.


Hi total noob here. I'm wondering how to do branching on a map expression. To explain what I mean: I'm working on the rna-transcription exercise on (sry, I don't know how to get a public link to the exercise). Part of the requirements is to throw an assertion error on invalid input. This works:

(ns rna-transcription
   [clojure.string :as s]))

(def dna-to-rna-map {\G \C \C \G \T \A \A \U})

(defn- dna-to-rna-char
  (or (dna-to-rna-map c) (assert false)))

(defn to-rna
  (s/join (map dna-to-rna-char dna)))
(to-rna "AGX")
;; => throws
I'd prefer to do throw on the outmost fn, in this case to-rna. But I can't just (s/join (or (map dna-to-rna-char dna) (assert false))) there. My guess is map in this case returns the entire seq at once, so the or is always true. And I don't want to iterate over the seq more than once, just to check if it contains any nil value. I hacked together a solution with a custom transducer just for throwing, but I'm sure there is a better way. So, is there a good way to do side effects or branching in a chain of reducers or a in a transducer? Sorry if I don't make sense, happy to explain ...


What about not throwing, and just returning a nil?


I like to keep exceptions for exceptional circumstances. Having an X in a fasta file is pretty common, isn't it?


@argo when map finds an invalid codon, that means one element in its list is nil


clojure considers a list with a nil in it to be "truthy", so the assertion can't fire


the right place for the assertion is the position you have - the place where the input is found invalid


assertions and exception throwing are not functional or value oriented, there's no need to pretend they are functional


@noisesmith Yes,that's what I thought, thank you. It was part of the exercise to throw, I would prefer not to in my own code. But is there a way to do branching in a transducer? It would be nice if I could process the elements of a seq one after the other and, dependig on the value of the element, choose different paths how to go on.


what I mean is it doesn't matter where in the stack you throw


nothing above it catches, so the throw happens as needed


also what transducer are you talking about?


Yes, it's just an example from the exercise. About the transducer: There is no transducer in the code, I'm just wondering how to do branching in a transducer. But never mind, thank you for the info πŸ™‚


we use if or cond or case for branching, but I am not sure what kind of branching you are talking about, why you are looking to a transducer so it's hard to answer


Another solution to the task I came up with is this:

(ns rna-transcription)

(defn- throw-on-nil [xf]
    ([] (xf))
    ([result] (xf result))
    ([result input]
       (nil? input) (assert false)
       :else (xf result input)))))

(defn to-rna [dna]
  (let [s (transduce (comp
                      (map #(get (hash-map \G \C \C \G \T \A \A \U) %))
    (clojure.string/join s)))
In this case, I just want to stop processing the elements of the seq as soon as I get a nil and, because of the requirements, throw. Another possibility would be to stop processing and just return nil. But as I'm just starting with clojure, I guess I might better stay with the fundamentals

Alex Miller (Clojure team)23:08:48

If you’re throwing, that will stop the reduce. But if you want to just end and throw later you can use reduced to signal early termination


Ah okay, I'll have a look at reduced. Thank you.