This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-22
Channels
- # admin-announcements (4)
- # bangalore-clj (1)
- # beginners (28)
- # boot (16)
- # clara (4)
- # cljs-dev (28)
- # cljsrn (63)
- # clojure (136)
- # clojure-berlin (7)
- # clojure-gamedev (1)
- # clojure-nl (4)
- # clojure-russia (47)
- # clojure-sg (8)
- # clojure-spec (39)
- # clojure-uk (132)
- # clojurescript (66)
- # clojurex (5)
- # clojutre (2)
- # code-reviews (14)
- # core-logic (1)
- # cursive (13)
- # datavis (1)
- # datomic (35)
- # dirac (1)
- # editors (1)
- # hoplon (46)
- # jobs (1)
- # lambdaisland (5)
- # lein-figwheel (1)
- # mount (10)
- # off-topic (3)
- # om (67)
- # onyx (54)
- # planck (7)
- # proton (15)
- # protorepl (1)
- # re-frame (174)
- # ring (4)
- # ring-swagger (3)
- # specter (14)
- # untangled (15)
Does anybody know if there is an arcadia channel?
Just trying to get started with it and having issues with getting the repl started...
@underplank: do you mean arcadia-unity/Arcadia https://gitter.im/arcadia-unity/Arcadia
Huh. There's no way to differentiate between a vector and a map pair using clojure.walk/postwalk
?
@tom I've used Lambada quite a lot. It works ok. Here is a link to a demo project I have used in few Clojure meetups: https://github.com/mhjort/lambda-demo
You should check that the namespace containing the function is AOT compiled. That's a common mistake I've done multiple times. AWS Lambda env cannot find the function if it is not compiled already
@zane try (instance? clojure.lang.MapEntry item)
> (clojure.walk/postwalk (fn [x] (prn (type x)) x) {:a 1})
clojure.lang.Keyword
java.lang.Long
clojure.lang.PersistentVector
clojure.lang.PersistentArrayMap
map-entry?
Clojure 1.8+
2-element vectors are considered to be valid map entries
@yogthos in clj-pdf I’m looking for the ability to set rowspan on a table cell and not seeing it, am i missing something?
hrmm… wasn’t looking hard enough, i see it in the docs further down… doesn’t seem to be working though (I had inferred it and asked when it didn’t seem to work). Maybe I made an error using it.
beyond one doesn’t have rowspan
I’m wondering how to decide when i should use one over the other
yeah, unfortunately table seems to be missing rowspan which, of course, i need damnit 🙂
hrmm… in pdf-table the widths vector it’s not clear what that’s measured in, the example sums to 45
if i wanted to read a bit more about how all this stuff fits together is there anything you’d point to. I tried visiting the iText site to see if I could find a guide but it was terribly confusing
I tend to poke through their java docs https://ymasory.github.io/iText-4.2.0/
yeah having the svg is handy as i can take my spider diagram code from the reagent front end and repurpose it 🙂
Is there any way to get more info when you get a cljpdf.text.DocumentException? I’m getting an NPE but it’s not clear why
It seems like I frequently have a case where I want to side-effect (rather than record) the output of xforms. I've seen code use #(map (fn [x] (log x) x))
, and I've made a reducing function for transduce
that just returns nil and ignores result
. Am I doing it wrong?
@alexmiller Also, I think the docs on transduce
need tweaking. It doesn't mention that f
must have a zero arity.
@yogthos it looks like you can’t set a border
on a pdf-table
. Looking at the source it’s not there, is that an oversight?
@yogthos looking at the source for Cell it looks like it should support rowspan
as well
anyone here use the carmine library before to work with Redis? How have you handled atomically modifying a key?
I see that there's a swap
function but the docstring just says "experimental", there's also an atomic
function but there is a disclaimer that it's in alpha. I was wondering if people have simply implemented something like swap
themselves
@mhjort ok thanks! Do you know how that works with putting the jar in the zip by chance? I am reading mixed docs. Some say to put the uberjar in the root of the zip, others say to put it in /lib.
Not sure. I have always uploaded the uberjar. That works well. If you happen to use Leiningen I also maintain a plugin that can be used for installing/updating Clojure based Lambdas https://github.com/mhjort/lein-clj-lambda
is there a logging formatter/viewer for clojure (backend) that is similar to binaryage/devtools in that you can log a list that when viewed in a browser allows you to collapse lists etc...
@eraserhd run!
is helpful for some sequence cases (run! println (map inc (range 10)))
@eraserhd as you suggest, you can supply a custom f that side effects and returns nil if you want to transduce. Alternately, you could create a new kind of transducible process that does not retain the outputs, just invokes a side effect fn.
@eraserhd you could create a wrapper to do this for you with just:
(defn dotrans [xform f coll]
(transduce xform (completing #(f %2)) nil coll))
and use it like (dotrans (map inc) println (range 10))
If ./myapp/project.clj
has :java-source-paths ["src/java"]
, then what file do I put class Foo{}
in, and what should its package
be, in order to call (Foo.)
from Clojure?
@alexmiller Isn't true though, that f
from transduce needs a 0-arity and completing
doesn't supply it?
Oh, I see. I probably didn't supply init to transduce
when I tried that. Although there would have always been at least one element in coll. Hrmm.
Transduce invokes f for the init if it's not supplied (it's not the same as reduce)
run! with eduction is fine too
I'm encountering a strange error. When I run tests, I get a "No implementation of method: X of protocol: Y found for class: Z" error. But when them again, all tests pass. After a "lein clean", they break again, but only the first time. What could be causing this?
@creese if you’re using protocol/records or something similar, you’re probably only mentioning it in the import
part of the NS (or just directly mentioning it without any mention in the NS) and not also putting the necessary namespace in require
? That would cause this kind of behavior, where the protocol/record isn’t found the first time because nothing has told clojure to use that namespace, which actually actually creates the protocol/record, but a later test compiles it, which makes it findable because the .class
is now available in targets
this can also happen if you’re extending an existing interface with the same scenario, where you’re not actually requiring the class that does the extending in the namespace you’re testing
@tanzoniteblack I'm requiring the namespace where the record is. I don't have anything in the import. Does the record need to be imported also?
No, when I removed aot compiliation, the error went away. I do "lein clean && lein test"
aot all was loading all the files, when you removed it, now only the files needed by your tests are being loaded
it is kind of hard to say, if you aren't getting an error, who knows. But I am suspicious
the errors you are seeing don't happen to be about the Query type in yesql, are they?
I vaguely recall helping someone with a similar issue, which turned out to be something like what tanzoniteblack suggested
there was a namespace somewhere that was importing a record type, and not requiring the namespace, so if namespaces weren't loaded in a particular order, it would break
and the problem the guy I was helping had was his combination of os + jdk + lein was loading test namespaces in a different orderer than whoever wrote the project, which causes the source namespaces to be loaded in a different order, which broken things
With compojure-api, is there a way to just accept any body in a POST? I might accept a variety of different messages, so validation/coercion isn't really necessary.
I had an issue open with the yesql project because they import types and don't require the namespace the type is created in. The guy I was helping was working on a pr for yesql. I tried to lookup the issue and found out that apparently the yesql repo has issues disabled now
@alexmiller: Right. The problem I'm having is that now when traversing with clojure.walk/postwalk
and friends there's no way for the f
passed in to know whether a 2-element vector it receives is a map entry or a vector.
tools.nrepl is active but is for the most part stable and moves slowly. The bug tracker is here - http://dev.clojure.org/jira/browse/NREPL
Is there a function in Clojure that can take two lists/vecs and return a boolean if one of them contains all elements in the other? Ex: if we have [1 2 3 4 5] and [2 3 4], it returns true because the second vector is part of the first. It has to be something trivial I am just having a brainfart.
Haven’t tested this, and I’m new to Clojure, but you could take the intersection
of the two then check if the intersection is empty?
or not
intersection requires sets, and if you are going to use sets, you can just use subset?
clojure.set/superset?
and clojure.set/subset?
do that for sets, don’t think there’s a built in function that does this for any other data type