This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-21
Channels
- # aws (2)
- # aws-lambda (1)
- # beginners (62)
- # cider (31)
- # cljs-dev (16)
- # cljsrn (8)
- # clojure (115)
- # clojure-greece (3)
- # clojure-israel (2)
- # clojure-italy (13)
- # clojure-nl (8)
- # clojure-russia (5)
- # clojure-spec (3)
- # clojure-uk (146)
- # clojurescript (108)
- # clojutre (5)
- # code-reviews (3)
- # cursive (48)
- # datomic (22)
- # editors (20)
- # emacs (7)
- # fulcro (16)
- # graphql (10)
- # mount (2)
- # off-topic (47)
- # onyx (22)
- # re-frame (100)
- # reagent (5)
- # reitit (7)
- # ring-swagger (6)
- # rum (5)
- # shadow-cljs (51)
- # specter (2)
- # tools-deps (95)
- # vim (10)
- # yada (7)
Mornin'
Good morning all
Morning all
månmån
Wow, hi there @danieleneal 😉
good morning everyone and HELLO DANIELNEAL!
I'm so sorry @lady3janepl
I'm not though. I have no taste in puns whatsoever and I have a degree in English Lit.
given I have a mental auto-ignore on Trump and Brexit news, today’s big story is… summer solstice?
WITH CAPS IS FINE!
@jasonbell yeah, but your dawn is later you southwesterner you
have you tried one of those lamps?
@seancorfield thanks for your comments on the uberjar stuff the other day, it was exactly what I needed :thumbsup:
Hello All… I’ve put some feelers out in #react-native already, but do any of you lot have any experience with ReactNative under Clojurescript? We are starting to talk about device-based apps and I am tempted to push hard on ReactNative as a way of keeping our tech-stack Clojure-based and uncluttered…
I shouldn’t be surprised, but - the git graph for linux is crazy. My parser doesn’t like 3-way merges - which are pretty rare elsewhere - but not in the linux kernel:
18-06-21 10:43:41 Crobuzon.local WARN [git-cd-log.core:132] - Can't diff commit with more than 2 parents: 790844941ae2d0ccde5892140cc499982800dd46 - Merge branches 'for-4.16/hid-quirks-cleanup/asus', 'for-4.16/hid-quirks-cleanup/elecom', 'for-4.16/hid-quirks-cleanup/ish', 'for-4.16/hid-quirks-cleanup/multitouch', 'for-4.16/hid-quirks-cleanup/pixart', 'for-4.16/hid-quirks-cleanup/rmi', 'for-4.16/hid-quirks-cleanup/sony' and 'for-4.16/hid-quirks-cleanup/toshiba' into for-linus
That is awesome! Also I love how much hackery they can do with the command-line git tools, and how much easier it is than my code using jgit
🙂
@maleghast #cljsrn
@danieleneal has been doing cljs rn stuff iirc @maleghast
yeah @maleghast I've been doing a fair amount of react native stuff
is that why you are so angry @danieleneal?
hahaha
my process is (cycle [:react-native-red-screen-of-death :problem-with-npm :argh-android])
@maleghast I'm using expo - which is imo a decent trade off. It's a lot easier to get started and integrate CI but you can't drop down into native
I'm actually starting to get the hang of it now but the learning curve was pretty steep
I think @olivergeorge recently put a guide together getting up and running, covering lots of the questions that come up as you begin development
ah yes, this is the one: https://confluence.condense.com.au/pages/viewpage.action?pageId=28082685
Bore da
@danieleneal - Thanks for the feedback, I did rather have the fear that it might be a lot to take in…
@maleghast you can try expo by doing lein new expo
see https://github.com/seantempesta/expo-cljs-template
expo is like a curated react native experience that bundles some common native libraries and means you only ever write js (or cljs) code, not native code.
Does that mean there is a “water’s edge” of can do / can’t do though? For example can you access the device camera and / or mapping capabilities and GPS, for example?
Yes there is definitely a "water's edge" of can do/ can't do but the can do functionality is quite broad. You can access device camera and mapping I think. I think their aim is to provide sensible js apis around the native features that aren't necessarily part of core react native
that's ok . I'm in and out all the time
If I have passed a class into a function as a var (e.g. (defn foo [klass] ...)
, how can I instantiate an instance of that class?
Is there a way to return the "middle" items in a vector without them being wrapped in a lazy-sequence? I mean drop-last returns a lazy-seq, but if I had a vector that looked like this:
[:order :order-id "order-1" "Order"]
and I wanted to pass :order-id and "order-1" into a function call as parameters...?(klass ...)
also doesn't work, because Java interop expects the dot and it's also looking for a class called klass
(in the above I would do (drop-last (rest coll)) to get the "middle" items as a lazy-seq))
@maleghast so you want the middle item, or the middle items?
There’s already a function called some-fn
!
@carr0t I looked for the java implementation of what you’re talking about - https://stackoverflow.com/questions/4872978/how-do-i-pass-a-class-as-a-parameter-in-java
Does (.newInstance klass)
work?
Basically I am (for...)-ing over a vector of vectors. I want to use the contents of the vector as parameters to a bidi call:
(bd/path-for routes (first coll) (drop-last (rest coll)))
but the above ^ will eval to this:
(bd/path-for [[vec of routes]] :order `(:order-id "order-1"))
and that won't work as the bidi/path-for (bd/path-for) expects the params for the URL / route definition to be parameters, like this:
(bd/path-for [[vec of routes]] :order :order-id "order-1")
(long story short, I am trying to create a re-usable Reagent component for our breadcrumb trail and some links can only be "built" by Bidi if I pass in the extra params)
@maleghast that’s what apply is for
That's not a dumb idea, but for URLs that don't have extra params that would not work too well and some have more params and some less
so apply will turn any collections into their constituent parts and then eval the function call..?
Wow! That's so cool - I'd never really had to think about this ever before so I've been wondering what apply is for, if I am honest...
@bronsa - I am assuming that if the result of (drop-last (rest coll)) was nil / an empty sequence that would still be ok?
my next album
So would you do something like this then? (apply bd/path-for routes (butlast coll))
@maleghast
Thanks so much guys - your assistance has allowed me to turn another part of the app (reagent spa) into a reusable component and reduce the line count on the app by another 320 lines.
I am in refactor MODE - have dropped the overall line count by nearly 1300 lines since I started.
(though some of that drop is not a true drop, just moving functions that didn’t need to be in the main app namespace into another namespace / file and requiring them in) Still the main Clojurescript file is now a LOT smaller and easier to navigate around as a result. I reckon I can make it even smaller over the next couple of days too.
explain why this works
Clojure 1.10.0-master-SNAPSHOT
user=> (deftype T [x])
user.T
user=> (defn f [^T t] (.-x t))
#'user/f
user=> (deftype T [x])
user.T
user=> (f (T. 1))
1
but this throws a ClassCastException
Clojure 1.10.0-master-SNAPSHOT
user=> (deftype T2 [x])
user.T2
user=> (defn f2 [^T2 t] (.-x t))
#'user/f2
user=> (f2 nil)
NullPointerException user/f2 (NO_SOURCE_FILE:6)
user=> (deftype T2 [x])
user.T2
user=> (f2 (T2. 1))
ClassCastException user.T2 cannot be cast to user.T2 user/f2 (NO_SOURCE_FILE:6)
so if the function is called before the type is re-defined the type-hint borks when called with an instance of the re-defined type, but if the function isn't called before the type is re-defined there is no borkage ?
well i don't have time to dig into it properly, but i'll guess that the type hint targets are resolved lazily via the var ?
i get the feeling you just gave me a massive hint and i'm not seeing the elephant in front of me 😬
linkage happens at class load time, since 1.8.0 clojure doesn't force loading of a class upon import, but just on first use
ah, i didn't know clj had changed class-load-time in 1.8.0 neat!
Does anyone know when on Friday the Clojure eXchange deadline for submissions is?