Fork me on GitHub
#beginners
<
2017-10-29
>
Kishu15:10:23

starter-kit for universal clojure app?

mingp15:10:40

@srachamim Do you mean, a web app template with Clojure on backend and ClojureScript on frontend?

Kishu15:10:18

I mean, client only

mingp15:10:46

Hm... Sorry, that I am less familiar with.

Kishu15:10:42

I mean, some repository with some examples pages that I can see how can I integerage clojurescirpt with react-native and a recommended project structure for developing for iOS & Android & Web with same logic

athomasoriginal15:10:00

@srachamim do you come from the JS world?

Kishu15:10:56

I come from JS, and I consider using clojurescript for my next project, which I need an iOS and Android app

athomasoriginal15:10:44

Okay. That's what I figured. The answer is that ClojureScript, to my knowledge, does not have exactly what you are looking for as we see in the JS world that is. To clarify, it is my understanding that you are looking for something like one of these https://habd.as/awesome-react-boilerplates/

athomasoriginal15:10:30

Where it provides a nice little starting point, basic tooling and a "run these 3 commands and you can start coding" approach

athomasoriginal15:10:55

Having said this, there are some open source projects that can give you a little bit of a starting point - like these https://clojurescript.org/guides/project-templates. Of interest would be - jamal and saapas

athomasoriginal15:10:54

Further, if you are interested in seeing a new open source project to get some inspiration, Clojure Academy open sourced their code base - https://github.com/clojurecademy/clojurecademy

athomasoriginal15:10:17

With the above in mind, I imagine your looking for something like a React Native starterkit - in this case I might loo to https://github.com/drapanjanas/re-natal.

athomasoriginal15:10:00

If this is a personal project and not a freelance project with business stakeholders which are dictating technologies, then I would recommend looking into PWA - which means you could write in any of the React like CLJS frameworks

lovuikeng18:10:05

@srachamim re-frame is great choice for react, client-side, ClojureScript Web app development, with quick-starter template https://github.com/Day8/re-frame-template , and playground https://day8.github.io/re-playground/

Pontus18:10:32

I have this: (def cc {:new-messages-in-other-chat '(1 1 2 3)}) and I'm trying to do (update-in cc [:new-messages-in-other-chat] remove #{1}) to filter out the 'ones', but it's throwing an error saying: ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.IFn clojure.core/complement/fn--4611 (core.clj:1392) I don't really understand this error, couldn't anyone give me a hint?

phronmophobic18:10:03

remove takes a collection as the last argument, so you would need to do something like (update-in cc [:new-messages-in-other-chat] #(remove #{1} %))

genmeblog23:10:33

How to get element from java array of objects? aget doesn't work here...

phronmophobic23:10:54

do you have a code example? seems like aget should work

genmeblog23:10:49

ahhh... my mistake, I tried to perform aget on (sort (object-array ...))

genmeblog23:10:03

but sort returns ArraySeq

phronmophobic23:10:13

a lot of times you can just just use the clojure seq functions

phronmophobic23:10:30

and then you don’t to worry about what the underlying type is

phronmophobic23:10:41

like nth , first, etc

genmeblog23:10:52

yep... (here sort sorts in place as I've just learnt)

phronmophobic23:10:07

i didn’t know that either

phronmophobic23:10:19

guess i’ve never tried calling sort on a java array

genmeblog23:10:02

from docs: If coll is a Java array, it will be modified. To avoid this, sort a copy of the array.

genmeblog23:10:33

probably it just calls Arrays.sort() java fn

seancorfield23:10:59

(source sort) shows that it converts the collection to an array then sorts that using java.util.Arrays/sort then calls seq on the result.

seancorfield23:10:04

And the conversion to-array is part of clojure.lang.RT so I expect there's an optimization that if you pass in a Java array, it just hands it back as-is. Hence the sort-in-place behavior.