clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Marc Rios 2020-12-21T12:16:56.433600Z

Hello, I have never been able to get Clojurescript examples to work properly when I try them. The defaults seem to be broken. For example, I tried following the instructions here (https://clojurescript.org/guides/quick-start) and the first repl page is broken. The error I get is goog.require could not find: cljs.pprint. The webpage just says "Item1". What am I missing?

Marc Rios 2020-12-21T12:19:20.434Z

The main Clojurescript repl page appears for a short moment, then disappears.

Marc Rios 2020-12-21T12:19:50.434500Z

The problem is replicated whenever I reload the page. I am using Firefox on the most recent version of Mint Linux.

p-himik 2020-12-21T12:38:06.434600Z

Where does Item1 come from?

Marc Rios 2020-12-21T12:45:17.434800Z

I'm not sure. It's not in any of my source files.

Marc Rios 2020-12-21T12:48:40.435Z

I think Clojurescript is using files from a completely different directory.

p-himik 2020-12-21T12:54:37.435400Z

If you follow all the directions up to the point of executing the first clj command - does it work correctly?

Marc Rios 2020-12-21T12:55:32.435600Z

Curiously, it flashes the screen that I'm supposed to see for a fraction of a second, and then it switches to something else.

Marc Rios 2020-12-21T12:56:16.435800Z

I think that clojurescript is executing an old clojurescript file from a completely different project.

Marc Rios 2020-12-21T12:56:30.436Z

That's some very bizarre hidden state.

p-himik 2020-12-21T12:59:14.436200Z

I don't think your setup is correct. Try creating a project from the ground up. Just in case, make sure there's nothing in ~/.clojure/. Clear the browser cache.

Marc Rios 2020-12-21T13:01:39.436400Z

that's curious because this project was from the ground up. I'll check the cache.

Marc Rios 2020-12-21T13:03:34.436600Z

I'm going to delete the old project and try again.

Marc Rios 2020-12-21T13:08:25.436800Z

Deleting the old project solved the problem.

Marc Rios 2020-12-21T13:22:53.437Z

thank you!

👍 1
Otis van Duijnen Montijn 2020-12-21T14:09:48.438500Z

Hi all! I am currently writing tests for some cljs functions used in a Fulcro app. The result of a certain function is: ({:id :app.client/buttonchange1, :states (:initial :state/state1 :state/state2), :active-state :state/button1} {:id :app.client/buttonchange2, :states (:initial :state/button1 :state/button2), :active-state :initial})

Otis van Duijnen Montijn 2020-12-21T14:10:32.439300Z

How should I define an expected result in this case?

Otis van Duijnen Montijn 2020-12-21T14:11:55.440200Z

Just making a def and pasting this result doesn't work as the :states won't show using ()

p-himik 2020-12-27T21:24:01.481300Z

@dmaltbie Did you mean to ask in this particular thread or in #clojurescript?

Dan Maltbie 2020-12-27T21:43:15.481500Z

yes. i miss-placed it. I'll move it over. thanks.

p-himik 2020-12-21T14:13:26.440300Z

Are you using just () or '()?

p-himik 2020-12-21T14:14:34.440500Z

Using it without quoting is the same as (get {...} {...}).

p-himik 2020-12-21T14:14:54.440700Z

Also note that in Clojure (= [...] '(...)) if both ... are the same.

Otis van Duijnen Montijn 2020-12-21T14:21:14.440900Z

This helps, Thanks! Pretty new to cljs 🙂

👍 1
p-himik 2020-12-21T14:33:56.441200Z

Just to make my second statement clear - it's only like that for maps and keywords. Because they're both callable via implementing IFn and their invoke implementations work like get. (something ...) just invokes something on ... when evaluated. something can be anything, not just a symbol.

✅ 1
popeye 2020-12-21T19:48:59.442700Z

Team, (re-matches #"^[a-z\-]+$" "abc--") will give us the result, But if i send 2 hypen it should return nil, How can I achieve this

p-himik 2020-12-21T20:03:17.442800Z

What exactly do you mean? Just --? Or two consecutive hyphens anywhere in a larger string? Or just two hyphens anywhere in the string? I.e. what strings from these should not be matched? --, a--, a-b-.