This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-30
Channels
- # admin-announcements (42)
- # alda (8)
- # aws (10)
- # beginners (22)
- # boot (165)
- # bristol-clojurians (1)
- # cider (6)
- # clara (21)
- # cljs-dev (23)
- # clojure (74)
- # clojure-dev (8)
- # clojure-russia (41)
- # clojurescript (180)
- # core-async (11)
- # cursive (26)
- # datascript (2)
- # datavis (7)
- # datomic (29)
- # editors (1)
- # hoplon (7)
- # jobs (3)
- # ldnclj (4)
- # lein-figwheel (47)
- # leiningen (2)
- # mount (26)
- # off-topic (3)
- # om (163)
- # onyx (56)
- # proton (4)
- # reagent (6)
- # remote-jobs (1)
- # ring-swagger (4)
- # spacemacs (9)
@kopasetik Eliminating the ampersand in [first & rest] gets rid of the error you started with, but creates another error. Also, the line (into rest [first first]) isn’t going to rebind rest, so even if your code didn’t have other errors it would not work as written.
@kopasetik To do this problem, you might want to consider looking at this: https://clojuredocs.org/clojure.core/iterate.
im poking around with google closure in the repl--not sure if theres a straight forward way to add logging, debugging calling into java code. anyone have any cooool tips? im using cider/emacs
hmm, I have a weird error in lein: unable to resolve symbol ... in namespace
. I'm pretty sure that the namespace is correct. After evaluating the namespace that has the sympol which was unable to resolve, then thing works. What is the problem here ?
nxqd i often find a lein check
will reveal issues
its easy to get into an incompilable state in the repl - lein check will sanity check that for you
in Clojure, if I define a function like this: (defn f [s] (let [r #".*"] (re-matches r s)), is the regular expression r compiled at every call, or is there some extra cleverness going on? With literal hashmap this isn't the case, they are constructed only once I believe.
http://clojure.org/reader#The%20Reader--Macro%20characters says as much: > A regex pattern is read and compiled at read time.
ok cool. I was asking because of the comment I got here: http://codereview.stackexchange.com/questions/113719/solution-to-part-1-of-day-7-advent-of-code-in-scala/115384#115384 - I'm not sure if he is correct there if Scala is as clever as Clojure in this
Hey guys! … Two questions for you: 1) Which library do you use for error handling?, 2) How do you structure your "handling error” code to keep it separated from your main code?… I found a library named Dire, which encourages the separation between this two worlds, however, is not clear to me how to accomplish this in the real world (I am thinking at folder/files level).
@rcanepa: I haven't used it myself yet, but I'm pretty interested in this approach for error handling: http://docs.caudate.me/hara/hara-event.html
Why is (some empty? '('() '(1) '(1 2)))
nil
, but (some empty? [[] [1] [1 2]])
is true
? (Can replace some
with map
and also be confused…)
@jeff.terrell: Nice, added to my reading list!
I just want to delay the creation of a string that's coming from this function: (fn [coll] (string/join " " (apply concat coll)))
My only option is to supply something instead of the string to a library that is going to do (str v)
on whatever v
I give it.
(let [fn (fn [coll] (string/join " " (apply concat coll)))]
(reify clojure.lang.IFn (toString [_] (fn))))
yeah, was just looking at the examples in the reify docstring - I haven't used reify before so didn't even think to look there
This is great - now my code looks like this:
formatted-normal-list (reify Object
(toString [_]
(list-format face-normals)))
Gotta love the X3D file format - basically the entire polygon mesh gets represented in 6 huge strings.
And how the heck am I supposed to write this darn file in any kind of lazy way so I don't run out of memory?
Yeah, so in that case, I think you need something more low level. Writing in chunks with a writer.
data.xml does a "flatten" on each element and turns it into an event that it processes and it calls (str v)
on the value of attributes so I'm hoping that since I have three elements with attributes that delaying the creation of those strings will take off some of the memory pressure.
at some point, yeah, I'll have to have a custom writer instead of using data.xml, but as a stopgap...
Ryan Senior (one of the data.xml leads) and myself have used data.xml for emitting xml streams larger than memory in the past, so that's certainly intended to work
but that may not be true for every possible use case, don't remember enough to be sure
@alexmiller: the problem is really the X3D spec because a large polygon mesh gets represented as one object - so I'm trying to stuff a couple of million points into a handful of attributes on effectively one element.
It's pretty ridiculous, isn't it? Just looking at an example file you can see where the problem is: http://www.web3d.org/x3d/content/examples/Basic/AdditiveManufacturing/_pages/page01.html
contents (xml/sexp-as-element
[:X3D {:version "3.3" :profile "Immersive"}
(when (or (seq units) (seq meta))
[:head
(for [unit units]
[:unit unit])
(for [[k v] meta]
[:meta {:name (name k) :content (str v)}])])
[:Scene
[:Shape
[:IndexedFaceSet {:solid "true"
:ccw "true"
:colorPerVertex "false"
:convex "true"
:creaseAngle "0"
:normalPerVertex "false"
:coordIndex formatted-vertex-index
:colorIndex formatted-color-index
:normalIndex formatted-normal-index}
[:Coordinate {:point formatted-vertex-list}]
[:ColorRGBA {:color formatted-color-list}]
[:Normal {:vector formatted-normal-list}]
]]]])
if the non-point stuff is just boilerplate, why even use data.xml?
just create a stream and write to it
@alexmiller: yes, well, live and learn, right? 😉
just can't beat a stream of ascii numbers in xml for data
and the only reason I'm using X3D is that it is supported by Shapeways for full-color polygon meshes.
if only there were some more efficient representation of numbers