This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-08
Channels
- # admin-announcements (3)
- # beginners (284)
- # boot (179)
- # cider (15)
- # cljs-dev (6)
- # cljsrn (95)
- # clojure (105)
- # clojure-austria (4)
- # clojure-berlin (9)
- # clojure-germany (4)
- # clojure-japan (3)
- # clojure-russia (65)
- # clojurebridge (1)
- # clojurescript (109)
- # code-reviews (16)
- # cursive (27)
- # datavis (19)
- # datomic (68)
- # devcards (7)
- # funcool (31)
- # jobs (1)
- # ldnclj (2)
- # lein-figwheel (3)
- # leiningen (4)
- # off-topic (419)
- # om (255)
- # parinfer (39)
- # portland-or (2)
- # re-frame (28)
- # reagent (14)
- # slack-help (12)
- # spacemacs (1)
(defn skeletonize-test-01 []
(let [mesh (-> (cu/cuboid -5 10)
(op/seed->mesh))
original-faces (:faces mesh)
mesh (-> mesh
(op/skeletonize :thickness 5
:get-f-factor (fn [{:keys [faces]} face]
(when (= face (last faces)) 0.5)))
(op/skeletonize :thickness 3
:get-f-factor (fn [_ face]
(when (original-faces face) 0.25)))
(op/rep op/catmull-clark 4)
(g/tessellate)
(op/colorize))]
mesh))
Because I can: https://images3.sw-cdn.net/model/picture/625x465_4125821_13308823_1449540847.jpg
Wow, nice
@meow: What lib are you using?
@kurtlazarus: thanks. I'm using http://thi.ng for the mesh datastructure and then my own mesh operators and X3D output from here: https://github.com/pkobrien/cad
You can get a better feel for that last model using the 3D tool here: https://www.shapeways.com/model/3dtools/4125821/1/26?key=bc7a8e9cd83b2179a5b9aff42e3ca96b
Hi. How do I install projects via maven? E.g. JDBC MySQL driver?
Nevermind, I just had to add [mysql/mysql-connector-java "5.1.6"]
to my build.boot
file (and no manipulations with maven)
Recently came across this book — Quantum Physics and the Philosophy of Alfred North Whitehead. Since I only became interested in Whitehead after seeing “Are we there yet?” figured some people on this list might also appreciate https://muse.jhu.edu/books/9780823250219
someone a tip for this challenge : http://www.4clojure.com/problem/166
I understand that core.async/chan
takes a transducer optionally, but is there a function to map over the values of a channel and transform them? or apply a transducer ex post facto?
basically this code causes an error:
clojure
(let [ch (chan)]
(go (>! ch 100)
(close! ch))
(go (println (<! (async/map inc ch)))))
I see that map<
, map>
etc are deprecated: https://clojure.github.io/core.async/#clojure.core.async/map
ah you're correct, sorry my mistake. The pipeline variants are mostly to do with doing things in parallel so maybe map is fine in your case.
(let [ch (async/chan)]
(async/go (async/>! ch 100)
(async/close! ch))
(async/go (println (async/<! (async/map inc [ch])))))
@hoopes: maybe you find this also useful https://github.com/funcool/octet
yeah, @d-t-w mentioned it… it’s probably just nitpicking but I’m surprised its signature is not variadic like clojure.core/map
.
I don't know but seems that clojure.core.async/map does not corresponds to the default map semantics
its doc says that it applies the function to the first value of each channel in the collection of channels that you can provide...
@niwinz yeah, i was looking at octet and buffy, but couldn't find a "takes a byte array, returns a map based on the spec" function (unless i'm blind)
ha, all right then. i must have missed something awfully obvious - i'll keep working. thanks very much for the note!
(def spec (buf/spec :field1 (buf/int32)
:field2 (buf/int64)))
(buf/read buffer spec)
;; => {:field1 2 :field2 3}
buffer should be bytebuffer, and if you have byte array, you can create byte buffer from it just using (ByteBuffer/wrap yourbytearray)
@hoopes: let see that part of the doc: http://funcool.github.io/octet/latest/#_read_and_write_data
yeah, i could see how to put data in as map/vector, and read it back out, but the byte-array part was the hurdle i couldn't clear - just getting started, so i really appreciate your help (if there's a different channel for the embarrassingly simple questions, i'll happily go there instead)
this is a funcool project so you can join in #C093UFM4M channel and ask any question about any funcool project 😉
async/map is deprecated, regular 'ol map you'll have to pry from my cold, dead, hands
I suspect this is going to be a stupid question but... I have a vector of maps` [{:yada "foo" :name "bar"} {:yada "foz" :name "baz"}]` and I'd like to dissoc :name
from each map. Whats the best approach?
@crankyadmin: (map #(dissoc % :name) vecs)
thanks I just got the exact something on the repl.
@crankyadmin: 👍 repl is always good to work out this kind of stuff
in clojure, if someone has placed there implementation inside of a`lib.impl` and is exposing it through lib
, should the lib.impl
namespace be treated as private?
lib.impl and lib are not related to each other, any more than any other namespaces would be.
@derwolfe: I believe you are correct that it is a convention to treat the impl
namespace as sort of a private matter, though Clojure doesn't enforce any privacy.
By convention (from Java libraries anyway) you know you are doing the wrong thing if you are making a call to a lib.impl
function/method, but there is no actual way to make the namespace private.
in the future (Java 9) with modules, that may actually be possible. but that's a long, long way off for Clojure (if ever)
Here's a tip if you are relatively new to Clojure, like me. I do my "debugging" using (prn)
statements and was wondering how I might do them inside some threading and came up with something that works. Here is an example:
(->> (d/value-set :f vertices v)
((fn [x] (prn "Faces: " x) x))
(map fnormals)
((fn [x] (prn "N-all: " x) x))
(set)
((fn [x] (prn "N-set: " x) x))
(transduce identity g/+ v/V3)
(g/normalize)
((fn [x] (prn "Fnorm: " x) x))
(d/index! norms))
Anyone know if there is a way to simplify that or use a function literal thingie #()
instead?
@meow: I usually define a macro to do that.
(defmacro spy [x]
`(let [x# ~x]
(println '~x "=>" x#)
x#))
It would be really useful to be able to send stuff to a gist...I wonder if theres an alfred workflow for that
@meow: The advantage of using a macro for spy
is that you can print out the form rather than manually giving a name.
@dmitrig01: Great suggestion, thanks.
@exupero: I made it a bit more vertical for my situation, and it works great. Much appreciated.
(defmacro spy [x]
`(let [x# ~x]
(println "<=" '~x "=>")
(println x#)
x#))
I know this probably a dumb question, but do people keep ther eown little utils namespaces with these kind of tools?
there's also user.clj
@rantingbob: yes, I have a namespace that's pretty much required in every other namespace for every project i've worked on
and I tend to copy-paste from flatland/useful but I refuse to depend on that entire project
@meow @exupero spy
also exists in this handy toolkit of utils https://github.com/cloojure/tupelo
@simax99: I knew I had seen it somewhere long ago, but couldn’t find the repo. Thanks for digging it up for me.
I've avoided depending on one of these grab-bag libraries but I may have to revisit that, or create my own, like @gtrak and others do
@meow @exupero No problem, it was mentioned on the clojure gazette (http://www.clojuregazette.com/) recently.
Hi, I'd like to execute a query on Hive h
via JDBC. But I need to set autoCommit to false. I think I wo
* grrrr safari is bad.... I think I want execute! but can't work out how to use it with autoCommit set to false.
You need to specify the :transaction false option, IIRC
That throws a java.lang.Boolean cannot be cast to java.lang.String
exception.
(defn run-hive-query!
[file-path message]
(println message)
(let [q (string/split (slurp ( file-path)) #"\n")
db {:subprotocol "hive2"
:classname "org.apache.hive.jdbc.HiveDriver"
;; :subname "//host:10000"
:subname "//localhost:10000"
:user “username”
:password “password”}]
(j/db-do-commands db :transaction? false q)))
The q needs to be a vector, doesn’t it?
I can’t recall the semantics of db-do-commands offhand tho, pretty sure I used execute!
doesn't split return a vector?
donaldball: I'd say the set of things that truly need a vector is small enough that they are mostly either a) things that are specifically vector tools like subvec or b) mistakes that should have supported other sequential types
What’s the best way to have one or more example programs that exercise my library in my library’s project? Should they be full leiningen projects on their own?
I really wish there was a faster way to switch between active panels in Cursive...and a shortcut to jump to the repl window. I miss that from Sublime.
@rantingbob there’s a Cursive channel and @cfleming hangs out here. You can ask for that directly from him 😉
Oh....sweet
Sorry, I'm new to slack