Fork me on GitHub
#beginners
<
2019-06-27
>
andy.fingerhut00:06:48

The getting started pages for Clojure are kind of a balancing act between different ways of doing it. Can you build your own JAR and run that? Sure, and there might be a few projects that do so. I expect it is rare to go that path, though.

PaulGureghian00:06:59

Is copying and pasting from the editor to the term the standard way of using Clojure ?

seancorfield00:06:24

No. That's why you want REPL integration with your editor.

seancorfield00:06:51

Then you can just press some key combination and the expression at the cursor is evaluated into the REPL that you have connected to your editor.

PaulGureghian00:06:27

Or use code runner extension in VSC ?

seancorfield00:06:44

Calva is the preferred extension for Clojure in VS Code.

PaulGureghian00:06:18

So, Atom outputs to the terminal and VSC to its own console ?

seancorfield00:06:40

Atom with Chlorine displays evaluation results inline inside the editor (and in the "Console" panel that is opened when you connect to a Socket REPL).

seancorfield00:06:10

(Atom with ProtoREPL also displays results inline and in the REPL panel)

seancorfield00:06:59

Looking at Calva's GitHub repo, it also shows evaluation results inline in the editor.

PaulGureghian00:06:11

And the only way to run clj code in terminal is either interactively or copy / paste ?

seancorfield00:06:00

clj can run Clojure programs -- not sure if that's what you're asking?

PaulGureghian00:06:39

I am used to navigating to the file location and running the source file

andy.fingerhut00:06:40

If you start a REPL in a terminal, one that is outside of any editor/IDE environment, then you can either type into it, or copy/paste, are the main options I know of.

andy.fingerhut00:06:11

Which can be done, but is often not preferred, because of the inconvenience for interactive development.

PaulGureghian00:06:11

I see : Calva Clojure Formatter , better than tomorrow. I think this is the new one

andy.fingerhut00:06:02

You can also start programs that were written in Clojure, programs that you do not interact with using a REPL at all, just like a "normal" running program in C or Java.

seancorfield00:06:18

Example of creating a clj project and running the -main program:

(! 584)-> clj -Sdeps '{:deps {seancorfield/clj-new {:mvn/version "RELEASE"}}}' -m clj-new.create app paul.gureghian
Generating a project called paul.gureghian based on the 'app' template.

Wed Jun 26 17:15:26
(sean)-(jobs:0)-(~/clojure)
(! 585)-> cd paul.gureghian/

Wed Jun 26 17:15:37
(sean)-(jobs:0)-(~/clojure/paul.gureghian)
(! 586)-> clj -m paul.gureghian
Hello, World!

Wed Jun 26 17:15:59
(sean)-(jobs:0)-(~/clojure/paul.gureghian)
(! 587)-> cat deps.edn
{:paths ["resources" "src"]
 :deps {org.clojure/clojure {:mvn/version "RELEASE"}}
 :aliases
 {:test {:extra-paths ["test"]
         :extra-deps {org.clojure/test.check {:mvn/version "RELEASE"}}}
  :runner
  {:extra-deps {com.cognitect/test-runner
                {:git/url ""
                 :sha "76568540e7f40268ad2b646110f237a60295fa3c"}}
   :main-opts ["-m" "cognitect.test-runner"
               "-d" "test"]}}}

Wed Jun 26 17:16:03
(sean)-(jobs:0)-(~/clojure/paul.gureghian)
(! 588)-> 

seancorfield00:06:35

(! 588)-> cat src/paul/gureghian.clj 
(ns paul.gureghian
  (:gen-class))

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println "Hello, World!"))

andy.fingerhut00:06:48

If you run a Clojure program that way, then you are limited in how you can interact with it and debug it to traditional methods, like printing or logging intermediate results to see what the program is doing.

PaulGureghian00:06:59

Here is my Github repo. going to add some Clojure code soon. https://github.com/paulgureghian

andy.fingerhut00:06:21

At the risk of burying you with too many possibilities, sometimes people take advantage of starting a Clojure program on a computer somewhere, and give it command line options so that the program is "listening" on one or more TCP ports for incoming connections. Some other client program that connects via those TCP ports can then get a REPL session to send Clojure expressions and evaluate them inside of that program.

PaulGureghian00:06:51

I have a good idea on my next steps

PaulGureghian00:06:04

I have picked up some good tips in this Slack group

PaulGureghian00:06:49

Any thoughts on the Nightcode editor ? thumbs up or thumbs down ?

seancorfield01:06:01

I think it's good for learning/getting started. I think people "grow out of it" fairly quickly tho'

johnj01:06:24

BTW, read that guide, its really good - https://clojure.org/guides/repl/introduction

PaulGureghian01:06:10

How to run this clj file ?

dpsutton01:06:25

You’ll get a null pointer when you do. You’re invoking the return of a println which is nil

jaihindhreddy09:06:32

Please do not follow this or the video on YT titled "Clojure Tutorial" from Derek Banas. Nothing against any of the above, they're not idiomatic at all. Recommend reading the stuff on http://clojure.org instead and watching Rich's talks, solving problems on http://4clojure.com and reading books. Can wholeheartedly recommend Clojure for the brave and true, Programming Clojure, Joy of Clojure and Clojure Applied. Last but not the least, you can always come here for help and/or banter πŸ˜€

andy.fingerhut02:06:36

the parentheses in that file don't completely match up. Having an editor that immediately shows you, e.g. via highlighting, which parenthesis in the file matches the one your cursor is next to, or colors them with different colors for matching pairs, are very useful when editing Clojure programs.

seancorfield02:06:22

Wow, there are so many things wrong with that tutorialspoint stuff 😞

jaihindhreddy09:06:08

I was completely astonished a while ago when I saw that. Event posted in off-topic. Seems like someone just tried to mimic a similar tutorial in an imperative lang without knowing anything about Clojure.

jaihindhreddy09:06:09

Sorry for the unsolicited noise. A realise a simple "+1" would have sufficed.

seancorfield02:06:45

@paulgureghian I would stop trying to follow that tutorial. Lots of problems with.

PaulGureghian02:06:36

Do you have terminal in your Atom on Mac ?

seancorfield02:06:53

The code is full of errors and very bad practices and the text is just plain wrong in many places.

seancorfield02:06:30

@paulgureghian I'm not sure what you're asking.

PaulGureghian02:06:37

In Atom on Windows there is a terminal menu option. do you have a terminal in your Atom on Mac ?

seancorfield02:06:26

My Atom on Windows does not have a terminal menu option.

seancorfield02:06:40

Perhaps it's because of a package you installed?

seancorfield02:06:21

Atom on Windows

PaulGureghian02:06:30

Does your Atom on Mac have a term ?

Edward Hughes20:06:46

proto-repl is a more powerful tool purpose built for working with Clojure code, but if you wanted an integrated general purpose terminal for Atom, this is what I use: https://atom.io/packages/platformio-ide-terminal

PaulGureghian20:06:11

yup. thats what I have now. do you have a console for your atom on mac ?

Edward Hughes21:06:06

Like, an Emacs console? Because I do now, lol. https://atom.io/packages/atom-console

PaulGureghian22:06:10

yup. thats the one I just installed. I dont know if its what I want. atom is not an ide so i dont know if atom will output data from the running of the source code. i guess we use an external console for that

Edward Hughes22:06:56

If you're talking about Clojure specifically, you can do that from either proto-REPL or by starting a Clojure/Lein/Boot REPL in the terminal itself. If you use a build tool to run a project using the terminal, it will output data from the program and function as a REPL in its own right. proto-REPL can be opened in a particular project namespace, and imports all the definitions from it.

Edward Hughes22:06:44

If you wanted an out of the box IDE though, there's this: https://cursive-ide.com/

Edward Hughes22:06:21

Funnily enough I had more trouble getting that working than I did throwing together a bunch of Atom packages and using it as an interface for all the command-line Clojure tooling.

Edward Hughes22:06:59

Found this as well, if you want something to help you get comfortable with using proto-REPL. https://github.com/jasongilman/proto-repl-demo

seancorfield02:06:07

I'm not at my Mac to check. I don't remember seeing a terminal menu option tho'.

PaulGureghian02:06:36

How to use the repl integration in Atom now ?

seancorfield02:06:57

Did you look at the Chlorine package I suggested?

PaulGureghian02:06:07

I installed it

seancorfield02:06:49

OK, so you start up a Clojure REPL -- or any other Clojure-based process -- with the option that starts a Socket REPL and then you ask Chlorine to connect to that Socket REPL. Then you can evaluate the code in the editor into the connected REPL.

seancorfield02:06:31

The page I linked you to for Chlorine shows you how to start Clojure processes with a Socket REPL.

seancorfield02:06:20

The keymap listed on that Chlorine page is a useful starting point -- but you can customize Atom any way you want for binding keys to commands.

seancorfield02:06:52

@paulgureghian If you want to see some of what my workflow looks like with Atom and Chlorine: https://www.youtube.com/channel/UC8GD-smsEvNyRd3EZ8oeSrA

PaulGureghian02:06:08

You just got a new subscriber

seancorfield02:06:29

I use REBL as well, but the basic mechanics are the same. I use clj to start processes with a Socket REPL running, I connect Atom/Chlorine to that Socket REPL, I evaluate code in the editor and it is evaluated in the REPL -- you see the results inline in the editor (as well as the Console panel in Atom), and also in REBL πŸ™‚

PaulGureghian02:06:52

Ill take a look tomorrow

seancorfield02:06:17

You're on the same TZ as me, BTW, so I'll be here all night as they say πŸ™‚

seancorfield02:06:36

(but I'm about to go feed cats and probably pop to the liquor store for some beer)

dog03:06:22

clojure
; Kinda dumb question
; I noticed there are quite a few interfaces w/ single function
; that look like the one below
;
; method :: 'a -> 'b

(defn reify-consumer
  [func]
  (reify Consumer ; macro out this
    (accept ; macro out this
      [this thing]
      (func thing))))


; So im trying to write a Macro that does this
(defmacro reify-basic
  [interface method]
  `(fn
     [impl]
     (reify ~interface
       (~method
         [this arg]
         (impl arg)))))

(macroexpand (reify-basic Consumer accept))

dog03:06:02

im runnin into some errors with trying to implement this macro, the error messages are kind of incomperhensible to me

dog03:06:14

can somebody pro please tell me if im am missing an escape

dog03:06:41

sorry if this is a dumb question

dog03:06:47

spent a long time on it

seancorfield03:06:58

It's not a dumb question. Macros are hard.

seancorfield03:06:38

First off, macros will expand simple symbols to qualified names by default -- which is fine for references to core functions etc, but isn't what you want you want for "local" symbols within the generated code, such as function arguments.

seancorfield03:06:19

For local symbols, you need what's called "gensym" -- in this case impl and arg both need to be impl# and arg#

seancorfield03:06:32

Since you're not using this in the reified function you can use _# for that -- if you actually needed it to expand to the literal this symbol, you'd need ~'this I think (I'd have to try that out)

dog03:06:10

oh thank you so much sean

dog03:06:13

you are so helpful!

dog03:06:24

hope you have a great night, you just save me a lot of time!

seancorfield03:06:52

Happy to help. I'm just hanging out, watching AGT, with my wife, my cats... and my laptop πŸ™‚

ashnur03:06:39

Care to give an opinion on this, if you have a minute? πŸ™‚ https://github.com/typeetfunc/datascript-mori/issues/8

ashnur03:06:58

The last comment is the question

seancorfield03:06:52

Not sure why you think I'd have an opinion on it...? I don't do cljs, I don't use JS or NPM...

seancorfield03:06:50

There's a really obvious response to the question: it has no tests, how can anyone tell whether it works?

seancorfield03:06:10

But the "answer" to that is: send in a PR with tests...

seancorfield04:06:30

@U0VQ4N5EE So... do I win a prize? πŸ™‚

ashnur04:06:16

well, i thought cljs and clj are much the same, plus the issue is about building it which is even closer

ashnur04:06:02

and also, the question is what to test, if I could have some pointers on where to start, I could pick it up, but you just gave a name to it, that only made it referrable not solvable so far. next time I ask someone I will also ask what they think what tests one could write for it... So I guess for an opinion that counts as one, even more than one πŸ™‚ thanks!

seancorfield04:06:23

The cljs tooling is completely different and the interface with npm is another whole thing. It bothers me a lot that there are no tests here. When I've worked with projects that are cross-platform, getting the cljs stuff tested properly is always a big deal. It's very hard to maintain a project without automated tests.

seancorfield04:06:01

I have no idea where to start -- I have no idea about datascript or mori, whatever that is.

seancorfield04:06:55

I maintain Expectations which is cross-platform but the cljs side doesn't have automated tests yet (only manual tests). HoneySQL is better -- it has automated cljs tests. So take a look at that from an infrastructure point of view.

seancorfield04:06:37

It can be really hard to add tests after the fact...

ashnur04:06:13

"completely different" - sometimes I feel that's true for every clojure project

ashnur04:06:33

even in this case it seems you are saying easier to start from scratch than build on something that already exists...

seancorfield04:06:17

It depends. I know nothing about mori and very little about datascript so I can't just how potentially useful the library is.

ashnur04:06:48

mori is just the persistent data structures of clojure in clojurescript

ashnur04:06:58

and exported with js usable interface

ashnur04:06:30

datascript compiled together with mori means that it's really fast, even though immutable, even if I use it through javascript

seancorfield04:06:33

Wait, WAT? This is just 68 lines of exports? What on earth even is that?

ashnur04:06:43

a connector

seancorfield04:06:43

How is it a library? I don't get it...

ashnur04:06:50

I am trying to explain

ashnur04:06:18

while if I build mori and datascript separately, then from javascript the two will not work together because google closure will use different minimized names

seancorfield04:06:23

It makes no sense to me at all.

ashnur04:06:29

so the gains will be lost

ashnur04:06:52

so a connector library was made to allow google closure to export the same methods

seancorfield04:06:56

Isn't this already a solved problem in cljs? With stuff like cljsjs or whatever the library system is called?

ashnur04:06:15

I don't think so, I don't think this is a solveable problem

ashnur04:06:36

cljsjs was just a collection of libraries that were ported

seancorfield04:06:53

I have no idea what to even think about this...

seancorfield04:06:12

This is so alien to me as a Clojure developer on the JVM.

ashnur04:06:16

I don't want to bother you with it

seancorfield04:06:38

But yet, you did πŸ™‚

ashnur04:06:39

I am sorry about it. I had the wrong assumptions about how easy it should be someone who can read the code and know the ecosystem to switch between contexts. In javascript it doesn't matter what the runtime is, the language is the same, everything is the same.

seancorfield04:06:08

But there is no code in that library.

seancorfield04:06:27

It's literally a bunch of weird defs. It makes no sense.

ashnur04:06:44

all the code should do is to connect mori to datascript so google closure doesn't create two different builds.

seancorfield04:06:58

I've no idea whether this is an artifact of Google Closure or cljs or what...

ashnur04:06:18

me neither, it's not my ecosystem 😞

ashnur04:06:33

for 6 years I tried, I am still trying πŸ˜„

seancorfield04:06:42

This is why, after trying cljs in 2014-2015, I haven't touched it since...

seancorfield04:06:03

I just started trying to look at it again this past weekend.

ashnur04:06:18

It's really cool. So many good stuff. Especially datascript

seancorfield04:06:35

Meh, what's so exciting about that?

ashnur04:06:03

i used it in 2015-2016, I just gave a simple scheme to it and random JSON and it parsed it into a database with entities and queries and whatnot. But can't use it without the connector 😞

ashnur04:06:42

most of js development that's boring but error prone is data mangling to take backend data and make it shaped for presentation

ashnur04:06:07

datascript makes it so that it's basically 2 steps, writing the schema, and writing the query.

Crispin05:06:31

mori and datascript will link together as long as they are both passed in as inputs to the compilation process, producing a set of output artifacts (normally one) in the same compilation process

Crispin05:06:56

otherwise you will need to specify 'exports'

Crispin05:06:34

for example, I have cljsjs deps, other cljs deps, and they all get compiled, linked together, and minified as one

Crispin06:06:12

one other option is to not use advanced compilation.

ashnur07:06:52

@UKH2HDSQH thanks for chiming in, may I ask you to elaborate on this a bit more? Or if you just point out what docs are to be read, because on my own I usually get lost 😞

ashnur07:06:17

My end goal is to be able to use latest datascript with mori all the time

Crispin07:06:48

do you have an existing project.clj for the project? is both datascript and mori in the dependencies?

ashnur08:06:23

seems like both datascript and mori are in it, just that mori is in the git-dependencies

Crispin11:06:20

Yeah I would think that should work, as you've included the mori src path in your source-files.

Crispin11:06:43

your extern may not be needed if you are only calling mori from js.

Crispin11:06:01

are you also calling datascript from js?

Crispin11:06:02

one thing I would try in your situation is changing :optimizations to :whitespace and rebuilding the artifact release-js/datascript-mori.bare.js

Crispin11:06:47

then open that in an editor. check everything is there. is the mori namespace in there? just text search for it. what about datascript, is it in there? Then check that this artifact works

Crispin11:06:13

if that artifact works as intended then you are going to need to look into why advanced optimizations wrecks it

Crispin11:06:03

thats an artform in itself. maybe start with trying to see if :whitespace optimization gets you cleany exported namespaces to the js that works

ashnur17:06:25

@UKH2HDSQH none of the code written there is done by me, I just want to use it

ashnur17:06:11

I would use datascript from js, exported through the datascript-mori package that I want to update

ashnur17:06:47

I will try to change the optimizations. What I think is missing is to write the new exports for the new datascript api

ashnur17:06:59

and I don't know how to find docs on this

Crispin17:06:27

you shouldn't need to write exports with :whitespace

Crispin17:06:53

Ill get you a link on exports...

ashnur17:06:29

much appreciated.

ashnur05:06:33

@UKH2HDSQH that's almost a 10 year old post πŸ™‚. Even if it's relevant information, nothing is the same anymore, not sure it's translateable

ashnur05:06:08

oh, you maybe sent it for the whitespace explanation

ashnur05:06:31

in any case, I am not ungrateful ;D just seemed a bit weird.

Crispin05:06:08

which post

seancorfield05:06:25

The 2011 post from Luke.

Crispin05:06:29

the first one is a description of the google closure compilers advanced compilation mode, and what it effects.

seancorfield05:06:33

Eight years old.

Crispin05:06:42

the second one talks about the ^:export metadata

Crispin05:06:49

which is as true as ever

seancorfield05:06:10

Clojure is very stable. Old code still runs, mostly.

ashnur05:06:20

yeah, at some point old stuff is actually the better stuff, no question about it

ashnur05:06:24

lindy effect and whatnot

ashnur05:06:46

but old code != old blogposts. anyway. as I said, I got it eventually, just had to read more from it

seancorfield05:06:56

We went to production in 2011 on Clojure 1.3 (alpha 7 or 8?) and very few things have caused our code to change over those eight years.

Crispin05:06:08

latest clojure still runs clojure 1.0 code unchanged

ashnur05:06:09

don't have much time to try it out but between other stuff I come here and read

Crispin05:06:19

or so Ive heard

ashnur05:06:34

@UKH2HDSQH but that's different, i don't want to run old code

Crispin05:06:51

then don't run it

ashnur05:06:09

i am sure people like @U04V70XH6 who have old code in production appreciate it though πŸ™‚

seancorfield05:06:12

@UKH2HDSQH Well, the compiler is a bit more strict now (with Spec) and there are more built-in fns which might clash with old code but, yeah, basically old Clojure still runs πŸ™‚

Crispin05:06:27

but if your whitespace optimized code works, and :advanced doesn't, then you need to dig into what munging advanced is doing

Crispin05:06:30

and prevent that

Crispin05:06:51

its an attitude of immutability

Crispin05:06:57

we deal with change by acretion

seancorfield05:06:59

@U0VQ4N5EE Our code is bleeding edge. We update the very latest alpha/beta Clojure versions as soon as they appear and we use all the new functionality.

Crispin05:06:03

and the API is the same

seancorfield05:06:11

That's a far cry from running "old code".

ashnur05:06:15

@UKH2HDSQH the problem is not that the code doesn't run, is that the code runs with older version of datascript, not with the new one, and I will have to export stuff from datascript into datascript-mori

ashnur05:06:27

and make sure all interfaces are ok, and so on

ashnur05:06:33

run some tests if I can

seancorfield05:06:56

@U0VQ4N5EE You need to take this to #clojurescript to be honest.

ashnur05:06:12

I don't even know where to start. You gave me helpful pointers of stuff that's necessary for this, but not quite what I have most problems with this

Crispin05:06:14

@U0VQ4N5EE oh ok. I didnt realise the issue was an older datascript

ashnur05:06:48

@U04V70XH6 you assume I have not asked dozens of people already, several from there too. I only dared to ask here because you were watching TV πŸ˜„

Crispin05:06:51

and when you update the dep and rebuild the artifact? it doesn't compile?

ashnur05:06:19

@UKH2HDSQH I don't remember, it was a long time (months) when I last had enough time to try it

seancorfield05:06:24

@U0VQ4N5EE dropping this giant thread on a completely unrelated comment I made is just rude.

ashnur05:06:36

i keep telling clojure people that I don't have hours every day like y'all

ashnur05:06:41

everyone just ignores it

seancorfield05:06:44

Seriously, take it to #clojurescript

ashnur05:06:10

@U04V70XH6 I didn't dropped it, we developed it together 😞

ashnur05:06:23

I asked if you had time, you had all the option to ignore it

ashnur05:06:40

@UKH2HDSQH only got here after it got big πŸ˜„

seancorfield05:06:54

Stop posting to this thread. Please.

Crispin05:06:06

well I have no problem with a long thread. I lurk and just pick out things I can help with. Better a thread than the mainline. It is beyond beginner stuff. I think you have to be clearer about your problem. I've been trying to help with a name exporting problem in advanced compilation combining mori and datascript, only to find out the problem is actually an old datascript version being a problem somehow, and you haven't touched in in months.

dpsutton03:06:06

What’s AGT?

dog03:06:19

AgentOfGreaterTronto

dog03:06:41

*just kidding, no idea

seancorfield03:06:35

America's Got Talent. Don't judge me πŸ™‚

dpsutton04:06:55

Haha own it. We’re watching dark on Netflix. Super good

seancorfield04:06:36

Dark is amazing! We started S2 the other night and got 3 eps in.

seancorfield04:06:55

(and we should probably take this to #off-topic πŸ™‚ )

Javier Gonzalez-Compte16:06:38

hey is there ways to improve jdbc inserts i'm using insert-multi! while using async/thread to create parallelization of inserting data into postgres which each batch is about 1000 running in a 16 cpu core

Javier Gonzalez-Compte16:06:00

since its taking 10-15 min to insert about 1.3 million records

Nate Sutton16:06:14

is the slowness in postgres?

Nate Sutton16:06:36

what's the speed if you batch insert using psql?

seancorfield16:06:58

@javiergonzalez7 Have you added the Postgres-specific flag that makes that JDBC driver behave properly with insert-multi!?

seancorfield16:06:50

Unfortunately the auto-generated docs are not running at the moment so the 0.7.9 release is not reflected on http://clojure.github.io

seancorfield16:06:37

(and it's in the very long docstring for insert-multi!)

alexmiller18:06:01

bumped on clojure site - lmk if that looks better

seancorfield18:06:26

Thanks @alexmiller! Yup the 0.7.9 release, with the improved docstring, is showing up now!

seancorfield18:06:53

Including the specs -- nice! -- first time I've seen it show those, which is interesting because they're in a separate, optional namespace.

alexmiller18:06:50

if only there were spec docs :)

Nate Sutton19:06:24

oooh the specs in there are super nice!

Javier Gonzalez-Compte19:06:51

how does async/threads behave with hikari connection pool

Javier Gonzalez-Compte19:06:07

do all threads share the same connection pool or each one creates each

Javier Gonzalez-Compte19:06:15

since i'm using mount for the connection pool database

seancorfield19:06:53

@javiergonzalez7 My understanding is that Mount uses global Vars for state so they are singletons shared across all threads.

johnj21:06:48

What would be a solution for (defn [uuid] [:foo #uuid uuid]) ?

johnj21:06:51

That's not par-sable, going to call read-string

hiredman21:06:58

that is not how reader literals like #uuid owrk

hiredman21:06:04

don't do that

hiredman21:06:32

use java.util.UUID/fromString

hiredman21:06:57

#uuid is a tag for literlas, you do not have a literal

johnj21:06:29

ah, thanks

Ian Fernandez21:06:47

Guys, how can I add a String to a java.util.ArrayList in clojure? Like this?

Lists.newArrayList("Aaaa")

seancorfield21:06:50

@d.ian.b Is that using Guava?

andy.fingerhut21:06:50

user=> (def l1 (java.util.ArrayList.))
#'user/l1
user=> l1
[]
user=> (.add l1 5)
true
user=> l1
[5]

andy.fingerhut21:06:58

Sorry, you asked about a string, not an integer. But take that example and replace the 5 with "Aaaa"

seancorfield21:06:50

@d.ian.b You can create an ArrayList from a Clojure collection, if that helps:

user=> (java.util.ArrayList. ["Aaaa" "Bbbb"])
["Aaaa" "Bbbb"]
user=> 

Ian Fernandez21:06:26

yeah! It helped me. Thanks!

noisesmith21:06:30

also, often you don't need an ArrayList specifically, and the API can use any List - and clojure's [] already is a java.util.List

kaneko23:06:08

Hey guys I have a slight problem, when I try run lein repl in my project it keeps saying this: Error loading cider.piggieback: Could not locate cider/piggieback__init.class, cider/piggieback.clj or cider/piggieback.cljc on classpath. Any idea how to get around this? I've tried running lein deps but that doesn't seem to do anything

hiredman23:06:12

my guess is a bad nrepl-middleware setting in .lein/profiles.clj

hiredman23:06:46

basically you set things up to always try and run cider.piggieback middleware for all projects without setting it up as a dependency

noisesmith23:06:46

if you actually want piggieback (it provides a cljs repl over nrepl) it should probably be coming in via a plugin

noisesmith23:06:59

if you don't, I agree with @hiredman above

kaneko23:06:28

I've had to switch computers recently... it used to be working before. I did a clean install of Leiningen and Emacs In Emacs when I launch cider-jack-in-cljs I get strange behaviour - hot reloading and everything works but if I try switch to REPL it says no cljs REPLs found

kaneko23:06:12

No cljs REPLs in current session "proj-name:localhost:43894" to be exact

noisesmith23:06:16

OK, so it sounds like you do want piggieback middleware and that's a missing dep

dpsutton23:06:54

Look in your buffers list for the clojurescript repl. The connection is kinda dumb and only sees the last one.

kaneko23:06:09

I have :repl-options to include the piggieback middleware like so {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]} But when I check my buffers I only see a clj buffer and not a cljs one

noisesmith23:06:59

well the error you started with is explicitly telling you why you aren't getting a cljs repl - it can't find piggieback and afaik you can't have a cljs nrepl without it

dpsutton23:06:48

Cider should inject piggieback for you if you’re on a recent version. Can you come to #cider. I can help in 10 minutes if you don’t figure it out beforehand

kaneko23:06:01

Yeah sure, I'm still trying to figure it out T_T

dpsutton23:06:57

Do you see a repl buffer? Maybe one that says pending?

kaneko23:06:35

I can't see one

dpsutton23:06:52

Ok. Look in Messages buffer and you should see a message from CIDER showing it’s startup command. Can you see that?

kaneko23:06:49

yeah I can see things in the messages buffer, the latest one says Direct connection to localhost established