Fork me on GitHub
#beginners
<
2020-05-14
>
localghost02:05:57

Is there a de-facto library to interact with AWS APIs? I need to talk to EC2, IAM, STS, Lambda, RDS, DynamoDB, CloudWatch and several others. Any suggestions will be greatly appreciated.

potetm02:05:46

I recommend either: • The official Java API • https://github.com/cognitect-labs/aws-api

potetm02:05:18

the latter is very nice from clojure, but it’s been around a lot shorter than the official API (like a year or so)

localghost02:05:56

thank you, @U07S8JGF7! i’ll take a look.

localghost02:05:51

that cognitect-labs library looks great! now i need to figure out how to use a custom profile with this and it’ll be fun 🙂 thanks again!

potetm12:05:04

I do not recommend amazonica.

Ben Sless14:05:26

@U07S8JGF7 why not?

potetm17:05:11

It wraps the official java lib, exposes renamed methods via reflection, and does so in a way that doesn't allow access to the underlying client object.

potetm17:05:51

In addition, all interactions with it are variadic named args, meaning that it doesn't even expose a good data-oriented API.

potetm17:05:18

IOW - it takes away some value (exposing the client is useful!) and the only value it adds is renaming args and using keywords. IMO it's basically a vanity lib ("I want to type what I want to type.")

Ben Sless08:05:48

Good reasons. Thanks for the explanation

localghost13:05:14

i had seen Amazonica but as a noob it was difficult to get started with compared to Cognitect’s aws-api (which has been a lot of fun to play with.)

David Pham11:05:38

In Clojure Spec, is it possible to instrument a function and set its specs on the fly? More precisely, suppose a fspec is defined as following (s/def ::f (s/fspec :args integer? :ret zero?)). How can apply ::f to several functions and use generator to check if the arguments follows this specs?

alexmiller12:05:41

You have to use s/fdef for check to work

alexmiller12:05:24

But you can use s/fdef to set multiple functions with that f

Joshua13:05:05

Are there any limitations with keywords? If I have a REST API that accepts JSON and I have a library that parses the keys into keywords, is this safe for general user input? Or am I mixing things up with Erlang where there's a limit to the number of atoms so you don't provide untrusted access to atom creation?

jakubl13:05:15

Likewise a beginner myself - but I think having a function that transforms {"firstname" "Joe"} to {:firstname "Joe"} - is not the worst thing provided you check that - "Joe" is indeed a string - I think validating any user input is a good place to use spec

pmonks17:05:37

On that note, I use this little fn to “clojurise” JSON keys: https://github.com/pmonks/fake-tweets/blob/master/src/fake_tweets/core.clj#L17-L26 It can be used directly with Cheshire (JSON parsing lib) like this: https://github.com/pmonks/fake-tweets/blob/master/src/fake_tweets/core.clj#L77-L78 One thing to note is that it doesn’t handle conflicts e.g. a JSON object with keys “firstName” and “first_name” (which is arguably poor JSON schema design, albeit technically possible).

noisesmith16:05:51

keywords are kept in a weak hash for interning (so that two keywords that are equal are the same object), before it was a weak hash there was a memory problem with making large numbers of keywords

ghadi13:05:49

the limits are probably higher but the principles are the same

ghadi13:05:38

I try not to keywordize until after basic validation, but that is not a common position

ghadi13:05:14

there are no hard limits on keywords besides the total memory in a JVM. Keywords are interned into a table

Joshua13:05:57

Would the JVM garbage collect them eventually?

Joshua13:05:28

That's the problem with Erlang, they're never dropped so they needed to be bounded (okay, a few million, but it was a potential dos)

ghadi13:05:04

eventually yes

Joshua13:05:23

Okay so should be fine. It's the default for the middleware in https://github.com/metosin/muuntaja and the API is internal

Joshua13:05:26

Thank you!

jakubl13:05:58

just for my own curiosity - (keyword "foo") - will create new keyword only once (in the same namespace) - no matter how many times I call it - i.e. the memory is allocated the first time - and rest of the time it's a lookup?

delaguardo13:05:12

it does not even matter in which namespace you calling it

Frances He14:05:32

Hi Guys, I just started to learn Clojure and found this community

Frances He14:05:30

And I am following the tutorial [Learning Clojure from ground up](https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome)

Frances He14:05:19

And get stuck after trying to launch repl...

Frances He14:05:24

➜  scratch lein repl

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
nREPL server started on port 52012 on host 127.0.0.1 - 
^Z
[2]  + 71305 suspended  lein repl

Frances He14:05:48

And google search try to find any solution, no luck...

Frances He14:05:56

Wonder anyone runs into the same problem?

dpsutton14:05:06

what problem did you run into? not entirely sure what's going on

jkxyz14:05:14

@hesiyun1996 Not sure if you meant to, but looks like you hit Ctrl-Z which is a bash shortcut to suspend the process. I bet if you run lein repl again and wait a few seconds you'll see the user=> prompt

Frances He14:05:38

nREPL server started on port 52012 on host 127.0.0.1 - 

dpsutton14:05:45

/tmp/whatever 
 ✔  lein repl
nREPL server started on port 54745 on host 127.0.0.1 - 
REPL-y 0.4.4, nREPL 0.6.0
Clojure 1.10.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_202-b08
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=>

dpsutton14:05:53

do you not get something like this eventually?

dpsutton14:05:02

(I also have the nprel server stuff)

Frances He14:05:06

hi, I got something like:

Frances He14:05:15

➜  scratch lein repl

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
nREPL server started on port 54972 on host 127.0.0.1 - 
Tried to use insecure HTTP repository without TLS:
 sona: 
 slingshot/slingshot/0.10.3/slingshot-0.10.3.jar

This is almost certainly a mistake; for details see

Frances He14:05:45

Reading the faq.md ING.

Frances He14:05:40

And just updated project.clj file as instructed in FAQ.md.

Frances He14:05:55

It's just like taking forever for the script to continue...always stuck on on the line of launching server.

dpsutton14:05:35

can you try this in a temp folder without a project.clj file?

dpsutton14:05:51

mkdir /tmp/foo && cd /tmp/foo && lein repl

Frances He14:05:01

Now my zsh complains..Maybe something wrong with my lein setup, I'll double check it

Frances He14:05:13

zsh: command not found: lein

Frances He14:05:25

@dpsutton Thanks for your patience lol

dpsutton14:05:42

weird. how did your path break

dpsutton14:05:44

lol. no worries

Frances He14:05:46

Last time I did not follow lein's official page for install instruction, just borrow the quick set up from tutorial [Learning Clojure from ground up](https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome)

Frances He15:05:22

Now I'll just try to follow the homebrew way

dpsutton15:05:37

yeah just install lein so that its on your path. brew or the official instructions

Frances He15:05:29

Is it normal to take such long time to use user=> prompt?

Frances He15:05:49

➜  foo lein repl
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
nREPL server started on port 56115 on host 127.0.0.1 - 

Frances He15:05:08

somehow still stuck on the sever prompt after brew it

dpsutton15:05:10

it should be quite speedy

dpsutton15:05:16

what is lein --version

dpsutton15:05:19

and java -version

Frances He15:05:40

[1]  + 75363 suspended  lein repl
➜  foo java --version
java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
➜  foo lein --version
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Leiningen 2.9.3 on Java 14.0.1 Java HotSpot(TM) 64-Bit Server VM
➜  foo

dpsutton15:05:40

java 14 might not be the best

dpsutton15:05:48

you could try java 13

dpsutton15:05:52

or alternatively try brew install clojure/tools/clojure

dpsutton15:05:01

which will install the clj and clojure cli tools

Frances He15:05:35

Looks like i already got clojure installed before lein

Frances He15:05:37

➜  foo which clojure
/usr/local/bin/clojure
➜  foo brew install clojure/tools/clojure
Updating Homebrew...
Warning: clojure/tools/clojure 1.10.1.536 is already installed and up-to-date
To reinstall 1.10.1.536, run `brew reinstall clojure
`

Frances He15:05:02

So my only option left is either downgrade java14 to 13 or have multiple version of java?

dpsutton15:05:07

i don't know

dpsutton15:05:25

i'm not sure if lein is compatible with java 14

Frances He15:05:03

What's your setup for running lein environment?

Frances He15:05:36

The official doc of lein said : OpenJDK version 8 is recommended at this time.

Frances He15:05:45

I'll try that

dpsutton15:05:05

i think i use java 8 or 11 or 13 depending on computer

Frances He15:05:21

@dpsutton Thank you so much sutton! You've being really helpful 🙂

seancorfield15:05:53

I run everything on OpenJDK 14 locally, including lein

seancorfield15:05:00

(I was on lein 2.9.1, updating to 2.9.3 to double-check)

dpsutton15:05:28

oh interesting. thanks for confirming sean. no idea what's going on here then

seancorfield15:05:50

Updated to 2.9.3 and everything still works on OpenJDK 14

(! 547)-> java --version
openjdk 14 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

Thu May 14 08:37:06
(sean)-(jobs:0)-(~/cfml)
(! 548)-> mkdir /tmp/foo && cd /tmp/foo && lein repl
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
nREPL server started on port 62294 on host 127.0.0.1 - 
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 14+36-1461
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> Bye for now!

Thu May 14 08:37:30
(sean)-(jobs:0)-(/tmp/foo)
(! 549)-> lein version
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Leiningen 2.9.1 on Java 14 OpenJDK 64-Bit Server VM

Thu May 14 08:37:34
(sean)-(jobs:0)-(/tmp/foo)
(! 550)-> lein upgrade
The script at /Users/sean/bin/lein will be upgraded to the latest stable version.
Do you want to continue [Y/n]? 

Upgrading...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   137  100   137    0     0    321      0 --:--:-- --:--:-- --:--:--   321
100 13413  100 13413    0     0   7649      0  0:00:01  0:00:01 --:--:-- 57566
Downloading Leiningen to /Users/sean/.lein/self-installs/leiningen-2.9.3-standalone.jar now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   637  100   637    0     0   1529      0 --:--:-- --:--:-- --:--:--  1527
100 13.9M  100 13.9M    0     0  2448k      0  0:00:05  0:00:05 --:--:-- 3074k
/Users/sean/.lein/self-installs/leiningen-2.9.3-standalone.jar.pending: OK
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Leiningen 2.9.3 on Java 14 OpenJDK 64-Bit Server VM

Thu May 14 08:37:50
(sean)-(jobs:0)-(/tmp/foo)
(! 551)-> lein repl
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
:repositories detected in user-level profiles! [:clojars] 
See 
nREPL server started on port 62326 on host 127.0.0.1 - 
REPL-y 0.4.4, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 14+36-1461
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> 

seancorfield15:05:33

Maybe IP6 vs IP4? Or maybe something bad in ~/.lein/profiles.clj ?

seancorfield15:05:03

@hesiyun1996 What's in your ~/.lein folder?

seancorfield15:05:25

Particularly, what's in your ~/.lein/profiles.clj file? That's often what breaks Leiningen (and why I wish more tutorials would recommend the official Clojure CLI tools instead of a) Leiningen and b) adding weird stuff to the profiles.clj file 😞 )

Frances He10:05:12

@U04V70XH6 Thanks for the follow up

Frances He10:05:54

@U04V70XH6 Looks like I don't have ~/.lein/profiles.clj file

Frances He10:05:23

➜  foo cat ~/.lein/
repl-port       self-installs/

Frances He09:05:03

@U04V70XH6 @dpsutton I finally resolved the issue...I am using emacs as my editor. And magically after i set up [cider:The Clojure Interactive Development Environment that Rocks for Emacs]( https://github.com/clojure-emacs/cider), the lein repl command works as it should be

Frances He09:05:57

@U04V70XH6 @dpsutton My best guess is that somehow the emacs-clojure library solves the issue of clojure in emacs env setup? But, thanks you guys helping along the way 🙂

Frances He09:05:41

finally worked lol

dpsutton13:05:34

That sounds unlikely. CIDER just invokes lein as seen by the “startup command” in your repl. I see there’s an “x” at the beginning of your project.clj form. Is that an errant typo?

omendozar16:05:15

Hi, I would like to format a number like 49780 in #Selmer template to show 49,780 using number-format but I don’t know how to do it. {{ratings-count|number-format:????}} . How can I format my number to show thousand separator?

seancorfield16:05:42

user=> (require '[selmer.parser :as html])
nil
user=> (html/render "{{n|number-format:\"%,d\"}}" {:n 49780})
"49,780"
user=> 

seancorfield16:05:31

Maybe someone can add an example of that to http://clojuredocs.org/clojure.core/format

omendozar16:05:19

Perfect! Thank you @U04V70XH6

Charles H16:05:56

If I'm already a JavaScript pro and I learn me some Clojure, will picking up ClojureScript be easy peasy? Basically, I'm wondering if I should go and read a book on ClojureScript or not..

Charles H16:05:34

I do love some good technical reading so I might either way 😆

chrisulloa16:05:38

You should! Easy peasy depends on the person, but I’m sure you’ll enjoy it @charleshu

Charles H16:05:20

👍 any suggestions @christian.gonzalez?

fbeline17:05:52

What is the idiomatic way to get a file attribute, e.g, "creationTime" in clojure?

alexmiller17:05:37

The java.nio facilities are the best option

fbeline17:05:01

Hi Alex, thanks for your answer. I was just wondering if there was an idiomatic way to get the attributes.

(.toInstant (Files/getAttribute (.toPath f)
                                "creationTime"
                                (into-array LinkOption [LinkOption/NOFOLLOW_LINKS]))
It would be nice if the Clojure API provided a way to get the file attributes in a native data structure, e.g. maps. But thanks anyway!

alexmiller17:05:59

Yep, Clojure’s io ns predates a lot of Java 7 apis and could use some updates for sure

pmonks17:05:45

Especially now that v1.10 is JDK 8+ only. I assume it’s just a matter of time & priorities for this to happen? If Cognitect were to sketch out the desired interface (albeit the hard part), would they accept implementations from the community?

alexmiller17:05:08

given that that's not the hard part, not sure that's a likely sequence of events

alexmiller17:05:45

I've been doing a ton of file interop lately so starting to form some opinions but not likely to be an area we work on "soon"

alexmiller17:05:45

I think we'd probably want to take a light touch to anything in core (you can always augment with libs) so figuring out what's even in scope is problem 0

pmonks18:05:25

Right. And it would be ideal if the interface was at least somewhat portable to other runtimes (CLJS, Joker, etc.).

pmonks18:05:39

And FWIW by “hard part” I meant that public interfaces are hard because of politics / stylistic / future-proofness / portability considerations, not because they’re technically hard to write down…

alexmiller18:05:48

I got that :)

alexmiller18:05:26

fyi, the http://clojure.java.XYZ namespaces are not designed to be portable (that's why they say "java")

alexmiller18:05:13

Java's historical legacy wrt File and Path is a huge pain and is probably the biggest complicating factor

pmonks18:05:23

Oh I know - I’ve been doing Java since 1997. 😉

pmonks18:05:42

Well I did - I no longer consider myself a Java guy since switching to Clojure. 😉

alexmiller18:05:36

there are so many nice things buried in the Paths and Files stuff now, it's irritating how often you have to change between those contexts

seancorfield18:05:49

@U0MDMDYR3 and don't forget that the first step in contributing is to sign the CA and get yourself on this list https://clojure.org/dev/contributors 🙂

pmonks18:05:26

A task comes first, then a patch for that task that I think’s worth submitting, then the CLA. 😉

seancorfield18:05:34

(I know that's not really the first step and not all types of contributions actually require a signed CA but 🙂 )

pmonks18:05:46

And there’s no way I’d go near this with a 40' barge pole without an interface definition that’s blessed by Cognitect. Too much risk of it being a complete waste of time…

alexmiller18:05:56

there actually is a jira for adding Path support already

alexmiller18:05:27

specifically for jio/file but that part at least is in the tracker

pmonks18:05:31

(that’s not a slam on Cognitect btw - I wouldn’t be happy for randos to define supported public interfaces for my code either)

pmonks18:05:40

@alexmiller I’ll check it out, and if there’s an interface definition (however draft it might be) might have a crack at an impl too.

pmonks18:05:08

I’ve been doing some scripting type work, and not having portability between Joker and, say, Planck has been a bit of an annoyance.

pmonks18:05:40

Plus my Clojure knowledge is 99.97% based on CLJ, so figuring out translations from CLJ API to Joker or Planck or whatever is also a friction point.

alexmiller18:05:46

I haven't looked at the ticket, I just know it exists

pmonks18:05:07

I’ll see if I can find it.

pmonks18:05:03

And it already has a patch. 😉

alexmiller18:05:29

yeah, really just the tip of the iceberg

Joshua19:05:13

I have a simple Clojure script:

[pomelo ~] cat test 
#! /usr/bin/clojure
(println "hello world")
[pomelo ~] time ./test 
hello world

real	0m0.739s
user	0m1.511s
sys	0m0.045s
Is there any way to dramatically improve the (startup) time?

nate19:05:46

@U0121PUL58W there sure is, I've been using babashka for these sorts of things

nate19:05:16

there's a #babashka channel for people who use it

nate19:05:33

it's a quick clojure interpreter that's built for scripting

krzyz19:05:16

Use ClojureScript (requires node runtime), babashka, or compile to native using GraalVM. Basically don't use the JVM, otherwise you will be dependent on JVM startup time as well as Clojure classloading time.

Joshua19:05:07

babashka looks very cool

nate19:05:11

you're welcome

Mr Bubbles19:05:18

Hello! I was wondering what the landscape was like for SSR + hydration in CLJS (esp Reagent). Most of the examples I've seen on GH just render static markup. What I would really like to do is use Machiatto or even plain node to optionally fetch some data, instantiate a store, inline it as EDN and have my main entry point parse the EDN, sync it to client, and do ReactDOM.hydrate on the root Reagent component

Mr Bubbles19:05:55

This is a pretty common use case in JS world, so the fact that there weren't any cljs examples got me wondering if I was missing something here

Dennis Tel19:05:04

Hi! I’m just getting started and I was wondering: How do you document what kind of arguments your function expects (for more complex functions other than adding numbers etc)? Is this what spec is for?

seancorfield20:05:06

Mostly, folks describe that in a docstring. Spec can be used for that but the recommendation is not to spec "everything" -- just boundaries and "important" functions. Clojure is not a statically typed language and you shouldn't try to pretend it is.

seancorfield20:05:16

Another option is :pre (& :post) to provide predicates on arguments (and return values) that will cause AssertionError if the arguments (or result) is not as expected. But those aren't in common use.

seancorfield20:05:06

Does that help @dennistel90, or does it add more questions? (and "welcome to Clojure!")

Dennis Tel20:05:40

Oh no that helps! Was just wondering if Clojure had something like Elixir’s https://elixir-lang.org/getting-started/typespecs-and-behaviours.html#types-and-specs, which are purely for documenting functions and its arguments. Just wondering how you know with what to call a Clojure function. Or is this less of a requirement when working in Clojure?

Lennart Buit20:05:08

yeah you can use a (clojure.spec) s/fdef for that. That said, usually its pretty obvious what a function works on, for example by convension (`m` as a name of a map k as a name of a key …), or because in Clojure, most functions just work on all sorts of things, so map , for example, just works on sets, lists, vectors, etc.

Lennart Buit20:05:41

There is this famous saying in clojure, that its better to create 1 function operating on n things than n functions operating on 1 thing.

alexmiller21:05:11

"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." - Alan Perlis

Mr Bubbles21:05:19

Another question 🙂 is it possible to stream EDN patches corresponding to the changes to one of the immutable collections? Or even observe what they are without manually creating a separate atom for each thing you want to keep track of?

andy.fingerhut21:05:55

I'm not sure if this is what you are asking, but with Clojure's built-in collections like maps, sets, vectors, etc., there are no changes to them, so no changes to track.

andy.fingerhut21:05:13

There is only creating new collections from existing collections.

andy.fingerhut21:05:55

If you create a place like an atom, then it makes sense to say "what is the difference between the value contained within the atom at time X, versus the value it contained at time X+1?"

andy.fingerhut21:05:30

There are other 'places' one can create besides atoms, of course. There are multiple implementations around of CRDTs (Conflict-free Replicated Data Types) where the goal is to maintain a sequence of updating values for such collections over time, in a distributed system. Not sure if that might be in the neighborhood of what you are asking about.

Mr Bubbles21:05:39

Oh, good to know, thanks! Yeah, I worded that like a dope. Good to know there's a name for it, I think will give this a go https://github.com/aredington/schism

vinnyataide22:05:54

hello folks, just deleted .m2 folder by mistake and now clojure can't find class clojure.main

andy.fingerhut22:05:13

If you are using the Clojure CLI tools, e.g. clj and/or clojurecommands with a deps.edn file, it has its own separate cache of precomputed classpaths that often cache file name paths to files inside your .m2 directory. Using the -Sforce option should force it to recompute those paths.

andy.fingerhut22:05:40

Installing the Clojure CLI tools does not install anything in your .m2 directory.

andy.fingerhut22:05:27

In case it clarifies my earlier statement: Running clj or clojure commands can cause files to be added to your .m2, but installing the Clojure CLI tools by itself does not.

alexmiller22:05:22

clj -Sforce will force a re-download of libs

vinnyataide22:05:01

how can I remend that

pmonks22:05:23

If you’re on macOS, brew reinstall clojure is worth a shot.

vinnyataide22:05:30

I'm on windows

vinnyataide22:05:47

the command iwr ... didn't fix

pmonks22:05:47

(I don’t think that’ll resurrect .m2, btw, but at least it’ll get clj and clojure back for you)

vinnyataide22:05:05

I don't want to ressurrect my deps, it's okay, just fixing clj command

pmonks22:05:37

Not sure how best to reinstall Clojure CLI on Windows - sorry!

pmonks22:05:56

Been a looooooong time since I used Win. 😉

evanriley22:05:45

Hey there! Just starting and off to a bit of a rough start. If I create a new project with lein new figwheel sampleProject -- --reagent and then cd into the new directory and run lein figwheel I get:

Failed to compile build :dev from ["src"] in 0.798 seconds.
----  Could not Analyze  resources/public/js/compiled/out/reagent/impl/component.cljs  ----

  No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react"

----  Analysis Error : Please see resources/public/js/compiled/out/reagent/impl/component.cljs  ----
Figwheel: initial compile failed - outputting temporary helper application to resources/public/js/compiled/out/index.js
I’ve run lein clean as well as deleting my ~/.m2 folder, also re-installed clojure. Any tips to help fix this?

vinnyataide22:05:14

is there any package.json in your folder?

vinnyataide22:05:32

then run npm i

vinnyataide22:05:35

or npm install

vinnyataide22:05:52

and try again

evanriley22:05:50

That was it, thank you

dpsutton22:05:29

interesting. i thought that figwheel started supporting the bundle target literally today lol. this template already is using bundle and a clojurescript 764 which is a newer version than 1.10.758 which http://clojurescript.org says is current lol

dpsutton22:05:48

you picked a heck of a day to start a new project 🙂

vinnyataide22:05:54

I didn't know about that lol, just used my sherlock holmes approach

dpsutton22:05:07

and i forgot that @bhauman made that template which is why its hot off the presses. and there's already a new step to start up in the documentation for you @vinnyataide https://github.com/bhauman/figwheel-template#usage-1

bhauman22:05:08

it also prints out instructions when you run lein new figwheel example 😉

bhauman22:05:27

but I didn’t update the readme for lein-figwheel yet

dpsutton22:05:38

my eyes flew right over it 🙂 i'm a terrible user

vinnyataide22:05:48

@dpsutton it's our friend @me1079 that needs it

vinnyataide22:05:04

someday I'll need it too but for now I'm using shadow-cljs

dpsutton22:05:05

oops. sorry

alexmiller22:05:01

in about 45 minutes I'm doing an online talk at the Gateway Java User Group about Clojure for new Clojurists, particularly those coming from Java, in case anyone is interested. If you already know Clojure, probably not too useful. RSVP for info. https://www.meetup.com/GatewayJUG/events/266496097/

vinnyataide22:05:14

ok just got it working on windows again

vinnyataide22:05:25

I've download leiningen and ran a self-install script

vinnyataide22:05:32

that reinstalled my clojure in .m2 folder

vinnyataide22:05:37

now clj is fixed

dpsutton22:05:04

confusing to me that deleting the .m2 directory would do anything destructive. its just a cache

vinnyataide22:05:56

it's a windows only gotcha

alexmiller22:05:04

it's not, but you need clj -Sforce to tell clj it's classpath is stale

alexmiller23:05:03

clj does not currently re-verify that the jars on the cached classpath actually exist. that's possible, but messy.

pmonks23:05:34

@alexmiller so to clarify, the install scripts do indeed put some “core” JARs needed for the correct functioning of clj/ clojure in ~/.m2?

alexmiller23:05:02

Not for clj itself

pmonks23:05:03

(if so that’s a good thing to know, as I tend to whack ~/.m2 fairly regularly)

pmonks23:05:14

Ah ok cool. I wouldn’t have expected it to do that.

alexmiller23:05:29

But to run clojure.main, you need Clojure, which is on the classpath

andy.fingerhut23:05:40

I can double check, but I thought that merely installing clj / clojure commands can complete with no .m2 being created.

alexmiller23:05:56

That’s correct

alexmiller23:05:20

The install is an uberjar

pmonks23:05:33

Cool. Means I can continue whacking ~/.m2 with impunity (aside from ISP charges…).

andy.fingerhut23:05:13

As mentioned earlier, you may find that unless you use -Sforce on later clj /`clojure` commands, you may get errors about missing classes. This can happen if the later clj / clojurecommand uses a cached classpath stored in a file inside the .cpcache directory that gives a full path to a file that was recently removed from .m2

pmonks23:05:23

Right. Or I just whack .cpcache too

andy.fingerhut23:05:04

that also does it

andy.fingerhut23:05:13

Although for a single user account there is one .m2directory, but there can be any number of .cpcachefiles strewn all over the place.

pmonks23:05:46

Right, though I happen to have a well defined root directory for all of my development, and I could just run something like find $DEV_ROOT_DIR -type d -name .cpcache -exec rm -r '{}' \; to clear things.

pmonks23:05:06

But very good to know that .cpcache has references into .m2.