Fork me on GitHub

greetings! Something looks terribly wrong to me with my environment. I ran lein new compojure-app httpbis and I can't seem to get anything worthy out of the REPL. By that I mean, when I (in-ns 'httpbis.repl) then (start-server), I get a CompilerException java.lang.RuntimeException: Unable to resolve symbol: start-server in this context, compiling:(/tmp/form-init9088880558428708437.clj:1:1)


the common issue here is that you have no :init-ns defined, or there was a startup compilation error you missed. when in-ns is run, it doesn’t require the namespace or ensure it’s valid, if the ns specified doesn’t exist (for any reason) it creates a new one but makes none of the default bindings (eg. putting clojure.core into scope with refer-clojure which ns does implicitly)


the solution is two part: you can use (clojure.core/in-ns 'user) to get back to a sane place, then (require 'httpbis.repl :reload) and then switch to the ns but only if there are no errors on the require


Thank you for your detailed reply 🙂 Much appreciated


I also tried with the Cursive NREPL - same results. Also tried with Emacs' CIDER (jacked in, moved to NS using a fancy elisp fn, didnt work either)


I can see the code. I can cat it. It is there. How to troubleshoot this ?

Lucas Barbosa13:09:24

I’m also experiencing that… can’t use docs, for instance, on my proto-repl on Atom


if by docs you mean doc AKA clojure.repl/doc this is only available if you use clojure.repl which is done by default by clojure for your first namespace, but can be done by hand in other namespaces later (use 'clojure.repl)

Lucas Barbosa17:09:45

Got it! Thanks


@lvbarbosa is your project using ring as well ?

Lucas Barbosa13:09:01

Yes, same thing


mmh. I suspect this has to do with either the generated project.clj being wonky or it's the lein-ring plugin's fault


so you are making do without a REPL ? do you run lein ring server and hope it reloads code correctly ?

Lucas Barbosa13:09:17

Well, the only thing I can’t access is those handy functions like docs

Lucas Barbosa13:09:33

I can load my namespace and test the functions I am writting

Lucas Barbosa13:09:42

Let me show you


with pleasure


apparently you editor sent your (defn ..) form to the REPL


but there's no evidence your file was loaded before that


when you lein repl, can you just invoke code from your project ? I can't believe this is not working for me 😒

Lucas Barbosa13:09:26

I can’t but it works if I require the .clj module

Lucas Barbosa13:09:36

like (require 'tasks-api.core)

Lucas Barbosa13:09:48

should this be automagic?


I would think so, was hoping so, what was I thinking

Lucas Barbosa13:09:54

maybe there’s a quicker way to setup the project.clj


for your case, have you tried (use 'clojure.repl) ?

Lucas Barbosa13:09:32

I mean, maybe there’s a way to setup the project.clj file in order to make it automatically import our namespaces

Lucas Barbosa13:09:46

I didn’t try that yet. Giving it a try soon


ok I got it


when editing my files, I introduced some errors, compilation errors


so my 'httpbis.repl namespace couldn't be required correctly


but they wouldn't show up until I did the (require ... - which is why I wasn't suspecting this at all


now with regards to my project fiels being magically required when I start the REPL ... well I probably got spoiled


or ... in my previous clojure endeavors there was a main


that was eventually requiring most of my code, one way or another


in this case I notice the repl starts in home NS, where presumably nothing is loaded by default


gotta leave for ~20mn, feel free to either PM me or use slack threads


@lvbarbosa I found :repl-options {:init-ns httpbis.repl} in project.clj - that helps a lot with regards to requiring my stuff when REPL starts


An alternative is providing a :main namespace, which the REPL should home in


Hello there. Anyone using spectrum?


I was hooked by it after using ocaml for awhile. Only need to know how to use it automatically without having to type 'check ns fn everytime

noisesmith16:09:01 - I hadn’t heard of it, but it looks very promising - I think I’ll use it when I start using spec


where can I discuss and ask questions about datomic?


There's a #datomic channel


Great thanks


Hi... is netty better than java socket?


I suspect that's one of those "It Depends" questions... better for what? Better in which way?


I'm playing with clojure.. making online games (backend).. and to comunicate between client <-> server I will use TCP/UDP of course, but I'm not sure which should I use


Or a backend server like "mainframe", all connect to it...


So you're going to be communicating server to server, rather than web browser client to server @rcustodio ?


I'm new in clojure and java libs..


There is server to server (the mainframe like)... and there is client to server (game like)

Ben Redden19:09:50

Howdy ClojureFolks. Ive been inspired to check out Clojure from a blog article about Functional Programming in JavaScript being an anti-pattern.. they recommended ClojureScript.. and then someone recommended Clojure instead of that, to begin with. Any good “hello world” resources I have to check out?


Not sure what I'd suggest for that. If you were building a web app game, the obvious answer would be "use web sockets" and I'd probably point you at Sente which uses core.async to provide channels that communicate back and forth between web client and server in a really nice way.


I'd probably avoid direct server-to-server comms if possible -- and use a message queue instead...


@bengineer the most popular introductory clojure book is free online, it's called "Clojure for the Brave and True"


I see... but I dunno if the game will be browser.. The "front" developer says he prefer to use scala to make for mobile


Like RabbitMQ?


clojure vs clojurescript is really a "what do you want to do?" question


@bengineer Getting up and running with Clojure on the JVM is a lot easier than ClojureScript in the browser -- so I'd "learn Clojure" on the back end first, so you can avoid a lot of the tooling complexity.

Ben Redden19:09:29

i’m already liking it 👍


@bengineer I agree with @seancorfield, I think you should get used with clojure before, FP


@rcustodio Ah... so he'll be writing Scala for the client and connecting to your Clojure backend over the Internet. Hmm, not sure what I'd recommend then, sorry.


That is the reason I'm choosing TCP/UDP


@bengineer Brave/True is a good place to start. I hear really good things about Carin Meier's "Living Clojure" book too. The website is a great way to practice your understanding of Clojure/FP once you're through Brave/True, if you like programming puzzles.