This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-17
Channels
- # beginners (106)
- # cider (20)
- # cljs-dev (4)
- # cljsrn (1)
- # clojure (65)
- # clojure-austin (7)
- # clojure-canada (2)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (2)
- # clojurebridge (1)
- # clojurescript (32)
- # datomic (8)
- # docs (1)
- # emacs (27)
- # events (7)
- # fulcro (13)
- # garden (1)
- # hoplon (3)
- # leiningen (4)
- # luminus (2)
- # off-topic (32)
- # onyx (4)
- # parinfer (6)
- # pedestal (16)
- # re-frame (7)
- # reagent (5)
- # shadow-cljs (8)
- # spacemacs (2)
- # uncomplicate (4)
- # vim (3)
Just been learning about lazy sequences, https://clojuredocs.org/clojure.core/lazy-seq
is there any way to take 5 and keep the rest of the sequence? i.e. have both the first 5 items and the remaining sequence
@tbaldridge thanks, I gave it a go but it appears to eagerly evaluate the rest of the sequence 🙂 got an integer overflow
ah, of course, I was doing
(split-at 5 (fib))
but that must cause the repl to try and print the whole of the remaining sequencehey all, I'm having trouble adding the "matchbox" firebox library to my project. https://github.com/crisptrutski/matchbox
I added [matchbox "0.0.9"]
to my project.clj dependencies and then copied the smple code into my project
But all the matchbox methods, eg m/connect
, say "unable to resolve"
I ran lein deps already too
sorry, I don't know what you mean by tha
@lilactown I'm trying to use it for a aws lambda function which makes it tricky
here is the codebase for it
https://github.com/JimTheMan/Joke-Generator-Service/tree/master/joke-generator-firebase
I only have "serverless deploy" which builds it and deploys
but I was trying to call the functions locally
for example, with lumo and then (load-file core.cljs)
why would that work with lumo?
that's hw I've always done it
lumo doesn't use your leiningen dependencies unless you do something to ensure it sees them
lumo -c?
sorry, maybe I misunderstand - how are you letting lumo know where the dependencies are?
I'm not. I guess that is my problem
but what do they mean by "lein classpath"
leiningen is primarily a dependency managing tool
a classpath is a way of describing a bunch of a places where you can find dependencies
if you run lein classpath
that will output a classpath that java or lumo will know how to use
that filled my entire console window
so if you use lumo -c $(lein classpath)
that should start lumo in a way that it can use your dependencies
right, people make projects that use a lot of dependencies
ah ok
thanks
I'm getting an odd error though now when I try to load the file
(load-file "src/joke_generator_firebase/core.cljs")
Could not require cljsjs.firebase in file matchbox/registry.cljc
(new)
Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2539:92)
(NO_SOURCE_FILE <embedded>:5845:320)
Object.cljs.js.run_async_BANG_ (NO_SOURCE_FILE <embedded>:5823:122)
Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5823:185)
Object.cljs.js.process_libs_deps (NO_SOURCE_FILE <embedded>:5825:60)
(NO_SOURCE_FILE <embedded>:5843:474)
Object.cljs.js.run_async_BANG_ (NO_SOURCE_FILE <embedded>:5823:122)
Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5823:185)
Cannot read property 'navigator' of undefined
(evalmachine.<anonymous>:12:345)
(evalmachine.<anonymous>:277:278)
ContextifyScript.Script.runInThisContext (vm.cljs:44:33)
Object.runInThisContext (vm.cljs:116:38)
()
lumo.repl.caching_node_eval (NO_SOURCE_FILE <embedded>:6373:68)
(NO_SOURCE_FILE <embedded>:5844:410)
Object.cljs.js.run_async_BANG_ (NO_SOURCE_FILE <embedded>:5823:122)
Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5823:185)
Object.cljs.js.process_libs_deps (NO_SOURCE_FILE <embedded>:5825:60)
looks like an error inside cljsjs.firebase?
hmmmmmm
what do you suggest? use a different library? lol
I opened an issue on matchbox github
it looks like matchbox is using an old version https://github.com/crisptrutski/matchbox/blob/master/project.clj#L15
you could try explicitly asking for the version on the cljsjs github https://github.com/cljsjs/packages/tree/master/firebase
@derpocious also you can look at lein deps :tree
to see if there are any version conflicts that might be causing incompatible versions of libraries to be pulled in
ah ok. thanks!
when I run lein deps :tree I get this
[org.clojure/clojurescript "1.8.51"] -> [org.clojure/tools.reader "1.0.0-beta1"]
overrides
[io.nervous/cljs-lambda "0.3.5"] -> [org.clojure/core.async "0.2.395"] -> [org.clojure/tools.analyzer.jvm "0.6.10"] -> [org.clojure/tools.reader "1.0.0-beta2"]
Consider using these exclusions:
[io.nervous/cljs-lambda "0.3.5" :exclusions [org.clojure/tools.reader]]
[clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
[io.nervous/cljs-lambda "0.3.5"]
[camel-snake-kebab "0.4.0"]
[funcool/promesa "1.6.0"]
[io.nervous/cljs-nodejs-externs "0.2.0"]
[org.clojure/core.async "0.2.395"]
[org.clojure/tools.analyzer.jvm "0.6.10"]
[org.clojure/core.memoize "0.5.9"]
[org.clojure/core.cache "0.6.5"]
[org.clojure/data.priority-map "0.0.7"]
[org.clojure/tools.analyzer "0.6.9"]
[org.ow2.asm/asm-all "4.2"]
[org.clojure/tools.macro "0.1.2"]
[matchbox "0.0.9"]
[cljsjs/firebase "2.4.1-0"]
[com.firebase/firebase-client-jvm "2.5.2" :exclusions [[org.apache.httpcomponents/httpclient]]]
[com.fasterxml.jackson.core/jackson-databind "2.2.2"]
[com.fasterxml.jackson.core/jackson-annotations "2.2.2"]
[com.fasterxml.jackson.core/jackson-core "2.2.2"]
[com.firebase/tubesock "0.0.12"]
[org.apache.httpcomponents/httpclient "4.5.2"]
[commons-codec "1.9"]
[commons-logging "1.2"]
[org.apache.httpcomponents/httpcore "4.4.4"]
[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.8.51"]
[com.google.javascript/closure-compiler "v20160315"]
[args4j "2.0.26"]
[com.google.code.findbugs/jsr305 "1.3.9"]
[com.google.code.gson/gson "2.2.4"]
[com.google.guava/guava "19.0"]
[com.google.javascript/closure-compiler-externs "v20160315"]
[com.google.protobuf/protobuf-java "2.5.0"]
[org.clojure/data.json "0.2.6"]
[org.clojure/google-closure-library "0.0-20151016-61277aea"]
[org.clojure/google-closure-library-third-party "0.0-20151016-61277aea"]
[org.clojure/tools.reader "1.0.0-beta1"]
[org.mozilla/rhino "1.7R5"]
[org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
but it doesn't let me change the deps
you can add deps in project.clj - if they come before the one that pulls in the transitive dep, it will override
that dep conflict doesn't look suspicious, but you could try overriding the cljsjs/firebase dep
hello guys
I just have began with clojure
and I can't use clojure.set
user=> (:require clojure.set) CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:1:1)
I don't understand why
@d.ian.b that's not the valid syntax for require outside ns
(require 'clojure.set)
I'm using repl in terminal
it did wwent
sorry that is too noob
:require is a keyword, it's treated specially inside the ns macro
it's OK, this is the right channel for noob questions
thanks!
I'm urging to learn clojure hehe
I'm using the living clojure book
Could you recommend me some others on clojure for data stuff?
I don't have java background
clojure for brave and true is good beginner book
I'm pandas python/ bash guy
but @noisesmith what dep should I change? and how do I know what version?
@derpocious I was suggesting trying a newer version of cljsjs/firebase - I linked to it above
thanks guys
I'm going back to study here
I tried to add te latest, but that didn't work either
:dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.8.51"] [io.nervous/cljs-lambda "0.3.5"] [cljsjs/firebase "4.9.0-0"] [matchbox "0.0.9"]]
like this right?
oh, OK - if that doesn't help I'm not sure what to suggest next, other than to say the error looks like it's coming from matchbox
Alohha. I have a question … :
["^ ","~:action","login","~:value",["^ ","~:user_id","asdf"]]
I’m getting this as a Websocket message and I don’t quite get what kind of Datatype this is. I thought it should be json, it doesn’t look like json to me though and therefore a json/reader doesn’t work … what I’d love to get out of is a Map, so I can access the values of different keys. Help would be much appreciated ❤️@Henry that's transit in the :json encoding
it's actually valid json, but it turns into normal clojure data via transit
this is the library that handles transit https://github.com/cognitect/transit-clj
the Readme for that lib should have everything you need - also is this clj side or cljs side?
(def reader (transit/reader in :json))
(log/info "Message backend:" (transit/read reader msg))
shouldn’t this be working?depends how you defined in, but yes
also you can skip creating in if you already have an InputStream - if what you have is a String you can create in like in the Readme though
user=> (def in (java.io.ByteArrayInputStream. (.getBytes "[\"^ \",\"~:action\",\"login\",\"~:value\",[\"^ \",\"~:user_id\",\"asdf\"]]")))
#'user/in
user=> (require '[cognitect.transit :as t])
nil
user=> (def r (t/reader in :json))
#'user/r
user=> (t/read r)
{:action "login", :value {:user_id "asdf"}}
yes - in
isn't magic, it's just what the example called the input source