2015-11-28
| 00:05 | justin_smith | the version that is exactly like lambda x:x is (fn [x] x) |
| 00:05 | clojurebot | Roger. |
| 00:05 | justin_smith | dork |
| 00:06 | justin_smith | ~the version that is exactly like lambda x:x |
| 00:06 | clojurebot | You don't have to tell me twice. |
| 00:06 | justin_smith | ~the version that |
| 00:06 | clojurebot | the version that is exactly like lambda x:x is (fn [x] x) |
| 00:06 | justin_smith | numbskull |
| 00:23 | pontiki | n00b question - is (identity x) different from (fn [x] x) ? |
| 00:25 | justin_smith | pontiki: it's not an identical object, but it does the same thing |
| 00:26 | pontiki | is the x returned in each case the same x as sent in? |
| 00:28 | justin_smith | yes |
| 00:28 | justin_smith | ,(let [o (Object.)] (= o (identity o) ((fn [x] x) o)) |
| 00:28 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 00:28 | justin_smith | ,(let [o (Object.)] (= o (identity o) ((fn [x] x) o))) |
| 00:28 | clojurebot | true |
| 00:28 | pontiki | good to know. background: in the bridge class, i wrote the latter form during an exercise, and the TA mentioned the identity function |
| 00:29 | justin_smith | yes, it's clever to come up with the identity function, it's a useful one, but clojure does have it built in |
| 00:29 | justin_smith | one more bit of info for the code above: |
| 00:29 | justin_smith | ,(= (Object.) (Object.)) |
| 00:29 | clojurebot | false |
| 00:29 | pontiki | yes, that i get |
| 00:30 | justin_smith | no two objects are the same, so we know o, (identity o) and ((fn [x] x) o) all return the same object |
| 00:30 | justin_smith | ,(= identity (fn [x] x)) ; clojure doesn't have value identity for functions |
| 00:30 | clojurebot | false |
| 01:12 | akkad | clojure compiles to java byte code? |
| 01:13 | akkad | pondering if a static java bytecode analysis tool for security would be of any use for a clojure jar |
| 01:15 | justin_smith | akkad: I doubt the analysis would be useful - consider the fact that you can't run clojure without the compiler, and at runtime a clojure program could easily eg. load a string of data from a client, compile it, and run it |
| 01:16 | justin_smith | and if that can happen, the static analyzer can't tell you anything useful... |
| 02:19 | beaky | hello |
| 02:21 | beaky | i am beaky |
| 02:21 | beaky | oops wrong channel |
| 03:08 | Seraf | Hello everyone, I'm new to clojure, coming from a python world. This langage is very nice but I've some difficulties about manipulating datastructures. I'm trying to create an om component which will draw a menu by exploring a map. Here is my "code snippet", the result I want and the data structure I have : http://pastebin.com/f0MDaLHF does someone can help me please ? |
| 03:09 | Seraf | If there's a way to avoid the double for and do this in a more elegant way, I take all advice :) |
| 03:30 | tomjack | Seraf: (for [[account playbooks] deployment playbook (:results playbooks)] ...) ? |
| 03:31 | tomjack | hmm, well, that will not have an <li> for accounts with no playbooks |
| 03:35 | Seraf | tomjack, "deployment playbook" => where it come from ? my structure is in (:deployment app) |
| 03:35 | tomjack | sorry, I meant (:deployment app) for deployment |
| 03:36 | tomjack | anyway, :results is a key in playbooks there, which is a map. so you are getting :results out of the wrong things |
| 03:37 | tomjack | I think if you used map destructuring like (for [[account {:keys [results]}] (:deployment app)] ...) you'd be a bit closer |
| 03:38 | tomjack | (or just use (:results playbooks)) |
| 03:40 | tomjack | it should be possible to avoid flatten. flatten is more useful when you don't know exactly how your data is nested. but your data's nesting is very known |
| 03:42 | Seraf | ok. Is there a problem to chain "for" ? I mean I need to iterate from accounts, then iterate from results. I tried what you gave me but it didn't handle my structure well. |
| 03:47 | tomjack | no problem. I guess you want (map :name (:results playbooks)) |
| 03:48 | tomjack | yeah, what I gave you was garbage :( |
| 03:56 | Seraf | thanks tomjack it worked :) |
| 03:57 | Seraf | also, I have a problem with the key. when I display "account", it returns me : cycloidcycloid21537751054096 and I don't know where it come from as my key is only "cycloid" |
| 04:00 | tomjack | when you do (for [[account playbooks] (:deployment app)] ...), you are iterating over the key/value pairs in the :deployment map |
| 04:01 | tomjack | not sure, but maybe what you're seeing is an artifact of the implementation of keywords in cljs |
| 04:01 | tomjack | because account is then a keyword like :cycloid or :customer |
| 04:02 | tomjack | you can convert a keyword to a string like (name :cycloid) |
| 04:02 | tomjack | assuming you don't care about the keyword's namespace, or that it doesn't have a namespace |
| 04:03 | Seraf | ok, thanks for the help :) |
| 04:12 | rmrfchik | Hi |
| 04:13 | rmrfchik | how can I pass java method as clojure function? like (my-func .getName) |
| 04:13 | ARM9 | you'll need to wrap it in a fn |
| 04:13 | ARM9 | (my-func #(.getname %)) |
| 04:13 | ARM9 | since java functions don't implement the interface clojure needs for higher order functions |
| 04:15 | rmrfchik | yep, came to the same |
| 04:15 | rmrfchik | thanks |
| 04:15 | ARM9 | I don't know if/how you can avoid reflection doing that |
| 04:15 | rmrfchik | wrap is ok |
| 04:15 | ARM9 | which sucks |
| 04:19 | scottj_ | ,((memfn floatValue) 1) |
| 04:19 | clojurebot | 1.0 |
| 04:25 | ARM9 | does memfn resolve all reflection? |
| 04:25 | ARM9 | or do I manually have to typehint all the things |
| 08:00 | rmrfchik | i want to log my lazy list like this: (log/info (format "files are: %s" (doall (map #(.getName %) flist)))) |
| 08:01 | rmrfchik | despite doall, i got 'files are: clojure.lang.LazySeq@13a11' |
| 08:01 | rmrfchik | what i miss here? |
| 08:07 | beaky | hello |
| 08:08 | beaky | does clojrue have sum types |
| 08:12 | ane | no |
| 08:12 | ane | typed clojure has them |
| 08:24 | rmrfchik | what about lazy map? |
| 08:24 | rmrfchik | drives me crazy |
| 08:32 | TEttinger | rmrfchik: like a lazy hash-map? |
| 08:32 | TEttinger | without order does that even make sense? |
| 08:37 | rmrfchik | TEttinger: it does |
| 08:37 | rmrfchik | just want to quick look to sequence |
| 08:37 | rmrfchik | mapv did the trick, but wtf... |
| 08:38 | TEttinger | I thought you meant you wanted an equivalent to lazyseqs that was associative by key |
| 08:40 | rmrfchik | TEttinger: I want to (format "%s" (map inc [1 2 3])) |
| 08:42 | TEttinger | ah. |
| 08:42 | TEttinger | yeah mapv is good for that |
| 08:42 | TEttinger | (format "%s" (pr-str (map inc [1 2 3]))) |
| 08:42 | TEttinger | ,(format "%s" (pr-str (map inc [1 2 3]))) |
| 08:43 | clojurebot | "(2 3 4)" |
| 08:46 | rmrfchik | i wonder why format didn't look into seq |
| 08:53 | TEttinger | ,(format "%s" (range)) |
| 08:53 | clojurebot | "(0 1 2 3 4 ...)" |
| 08:53 | TEttinger | it appears to here |
| 08:53 | TEttinger | ,(format "%s" (map inc [1 2 3])) |
| 08:53 | clojurebot | "clojure.lang.LazySeq@7c42" |
| 08:54 | TEttinger | hm |
| 08:54 | TEttinger | that's weird |
| 08:54 | TEttinger | ,(class (range)) |
| 08:54 | clojurebot | clojure.lang.Iterate |
| 08:54 | TEttinger | ,(class (map inc [1 2 3])) |
| 08:54 | clojurebot | clojure.lang.LazySeq |
| 08:54 | TEttinger | ah |
| 09:00 | rmrfchik | TEttinger: so, any ideas? |
| 09:00 | TEttinger | pr-str is my best shot |
| 09:01 | TEttinger | keep in mind though |
| 09:01 | TEttinger | ,(format "%s" (pr-str (range))) |
| 09:01 | clojurebot | "(0 1 2 3 4 ...)" |
| 09:01 | TEttinger | oh print-length is set |
| 09:02 | TEttinger | if it isn't that might try to print an infinite strinh |
| 09:05 | beaky | hello |
| 09:06 | beaky | how do i do dijskstras algorihtm in clojure |
| 09:15 | TEttinger | beaky: do you care about the performance of the algorithm much? dijkstra called on large graphs with a straightforward implementation can be rather slow |
| 09:15 | beaky | ah |
| 09:16 | beaky | probably wont matter its just for rogueliek :D |
| 09:16 | TEttinger | there are less straightforward versions of dijkstra that are faster |
| 09:17 | TEttinger | (my personal recommendation is to use squidlib, which is in java and has dijkstra and A* implemented already. but the next release should be rather soon) |
| 09:17 | douglarek | I opend lein repl not in some clojure project, and cider-connect it in Emacs, but how can I switch repl namespace to some specific project |
| 09:18 | TEttinger | (I'm the primary committer to squidlib) |
| 09:18 | beaky | wow ill try squidlib then |
| 09:18 | beaky | how do i include it in lein |
| 09:18 | TEttinger | https://github.com/SquidPony/SquidLib |
| 09:18 | TEttinger | maven deps are similar hang on |
| 09:19 | TEttinger | [com.squidpony/squidlib-util "3.0.0-b1"] |
| 09:22 | beaky | https://github.com/SquidPony/SquidLib/blob/master/squidlib-util/src/main/java/squidpony/squidai/DijkstraMap.java wow im glad i dont have to implement all this myself now :D |
| 09:22 | beaky | this is perfect |
| 09:23 | beaky | btw how does lein know where to pull your lib |
| 09:24 | TEttinger | I put it on maven central. lein pulls from there and clojars |
| 09:24 | beaky | ah |
| 09:24 | TEttinger | maven central is a pain to get going properly |
| 09:24 | TEttinger | clojars is...better |
| 09:25 | beaky | is maven like the npm of clojure |
| 09:25 | TEttinger | maven is like one of the NPMs for java |
| 09:25 | TEttinger | and clojure can use it |
| 09:25 | beaky | ah |
| 09:25 | TEttinger | lein is a nice way to use maven without uh |
| 09:25 | TEttinger | badness |
| 09:26 | beaky | never used maven (or java much) im guess im glad i've got lein then :D |
| 09:26 | TEttinger | you have these horrid pom.xml files https://github.com/SquidPony/SquidLib/blob/master/pom.xml |
| 09:27 | TEttinger | tell me if you hit any stumbling blocks for that dijkstra in clojure |
| 09:28 | TEttinger | 3.0.0 final should be fairly soon. api should be similar, i've added to dijkstramap but not removed and not changed anything |
| 09:28 | TEttinger | oh! |
| 09:29 | TEttinger | any Coord stuff you hit may be tricky. use (Coord/get 3 4) to get the point at x=3, y=4 . if there's a ... argument, it's really an array (this is true in java too) |
| 09:29 | beaky | ah |
| 09:30 | TEttinger | I'm trying to remember how to make a Coord array in clojure |
| 09:32 | TEttinger | (into-array [(Coord/get 1 2) (Coord/get 3 4)]) |
| 09:32 | beaky | I love the coord thing going on even supports 3d type of roguelike worlds |
| 09:32 | TEttinger | not as well |
| 09:32 | beaky | (wonder how dijkstra works in 3d tho :D) |
| 09:33 | TEttinger | Coord is really really much better with 2D. it is immutable, which plays nice with clojure |
| 09:33 | beaky | ye my game stick with 2d type coords for now |
| 09:33 | TEttinger | limited to the range from -3 to 255 for x and y IIRC |
| 09:33 | TEttinger | (efficiently) |
| 09:34 | TEttinger | there's a way to make bigger Coord caches if needed, but dijkstra is dog-slow on 1000x1000 maps |
| 09:37 | TEttinger | beaky: I'm most curious about how the dungeon gen algos are consumable from clojure, since I'll be doing the same soon |
| 09:37 | TEttinger | squidgrid.mapping sort of package/ns |
| 09:38 | beaky | right will try out squidlib dungeon gen too (my crappy game still uses static maps haha) |
| 09:38 | TEttinger | https://github.com/SquidPony/SquidLib/blob/v3.0.0-b1/squidlib-util/src/main/java/squidpony/squidgrid/mapping/DungeonGenerator.java |
| 09:39 | TEttinger | the problem as I see it is that amap and other clojure builtins like dealing with 1d arrays |
| 09:39 | TEttinger | and all of these use 2d char arrays |
| 09:39 | luxbock | beaky: sticking to the standard Clojure data structures is usually a good idea |
| 09:39 | TEttinger | for dijkstra? |
| 09:39 | TEttinger | I have a version that sticks with them |
| 09:40 | luxbock | I have never actually used dijkstra for anything, so I was just making a more general point |
| 09:43 | TEttinger | http://ideone.com/YnhoF3 lines 97 to 140 are a (unoptimized) dijkstra map using immutable clojure data structures |
| 09:43 | TEttinger | you get better performance with transients on clojure data or by using arrays |
| 09:45 | TEttinger | thid used both http://ideone.com/27YYx3 |
| 09:47 | TEttinger | beaky: sorry to recommend and run, but I have a plane back home to catch! |
| 10:30 | gfredericks | ,(reduce #(assoc %1 %2 %1) nil [:foo :bar :baz :bang :haloooo]) |
| 10:30 | clojurebot | {:foo nil, :bar {:foo nil}, :baz {:foo nil, :bar {:foo nil}}, :bang {:foo nil, :bar {:foo nil}, :baz {:foo nil, :bar {:foo nil}}}, :haloooo {:foo nil, :bar {:foo nil}, :baz {:foo nil, :bar {:foo nil}}, :bang {:foo nil, :bar {:foo nil}, :baz {:foo nil, :bar {:foo nil}}}}} |
| 10:30 | gfredericks | that turned out more interesting than I expected |
| 10:32 | justin_smith | ,(reduce #(assoc %1 %2 %1) nil "abcde") |
| 10:32 | clojurebot | {\a nil, \b {\a nil}, \c {\a nil, \b {\a nil}}, \d {\a nil, \b {\a nil}, \c {\a nil, \b {\a nil}}}, \e {\a nil, \b {\a nil}, \c {\a nil, \b {\a nil}}, \d {\a nil, \b {\a nil}, \c {\a nil, \b {\a nil}}}}} |
| 10:34 | gfredericks | ,(reduce #(assoc %1 %2 %1) nil (range 5)) |
| 10:34 | clojurebot | {0 nil, 1 {0 nil}, 2 {0 nil, 1 {0 nil}}, 3 {0 nil, 1 {0 nil}, 2 {0 nil, 1 {0 nil}}}, 4 {0 nil, 1 {0 nil}, 2 {0 nil, 1 {0 nil}}, 3 {0 nil, 1 {0 nil}, 2 {0 nil, 1 {0 nil}}}}} |
| 10:34 | gfredericks | it's a bit like the set-theoretic definition of an integer as the set of smaller integers |
| 10:35 | gfredericks | ,(defn set-int [n] (set (map set-int (range n)))) |
| 10:35 | clojurebot | #'sandbox/set-int |
| 10:35 | gfredericks | ,(set-int 5) |
| 10:35 | clojurebot | #{#{#{} #{#{} #{#{}}} #{#{}}} #{} #{#{#{} #{#{} #{#{}}} #{#{}}} #{} #{#{} #{#{}}} #{#{}}} #{#{} #{#{}}} #{#{}}} |
| 10:35 | gfredericks | s/integer/natural number/ |
| 10:39 | justin_smith | gfredericks: I always thought it would be a funny experiment to make Number act as IFn as in the peano numbers, so that (6 5) would return 30 |
| 10:39 | justin_smith | while we're doing overloads that hide common errors anyway, why not one more |
| 10:55 | gfredericks | church numerals |
| 10:58 | justin_smith | gfredericks: in that case (6 f) would be the equivalent of (nth (iterate f f) 6) right? |
| 10:59 | justin_smith | or would that be (apply comp (repeat 6 f)) |
| 11:00 | gfredericks | it's been a while since I church numerals |
| 11:04 | gfredericks | you could make a pretty simple interactive lambda calculus thing by just doing a thin mapping from ascii strings to "lists" of church numerals, for some suitable lambda calc implementation of a list |
| 11:05 | gfredericks | justin_smith: looks like it is nth+iterate: http://briancarper.net/blog/479.html |
| 11:07 | justin_smith | gfredericks: oh, nth + iterate, except the initial arg is not f, it's more like #(nth (iterate f %) N) |
| 11:09 | gfredericks | yeah |
| 11:25 | Glenjamin | ,(get {'get 123, :a 1} :a) |
| 11:25 | clojurebot | 1 |
| 11:25 | Glenjamin | ,('get {'get 123, :a 1} :a) |
| 11:25 | clojurebot | 123 |
| 11:25 | Glenjamin | on the subject of possibly error-hiding IFn implementations |
| 11:43 | Glenjamin | ,(let [get 'get] (get {a: 1} 2)) |
| 11:43 | clojurebot | #<RuntimeException java.lang.RuntimeException: Invalid token: a:> |
| 11:43 | Glenjamin | ,(let [get 'get] (get {:a 1} 2)) |
| 11:43 | clojurebot | 2 |
| 13:58 | hlolli | How can I get just (list + 2 2) out of... |
| 13:58 | hlolli | ,(eval `(let [a# 1 b# 2] (list + a# a#))) |
| 13:58 | clojurebot | (#object[clojure.core$_PLUS_ 0x1a145a4e "clojure.core$_PLUS_@1a145a4e"] 1 1) |
| 13:59 | hlolli | ,(eval `(let [a# 1 b# 2] '(list '+ ~a# ~a#))) |
| 13:59 | clojurebot | #error {\n :cause "Unable to resolve symbol: a# in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: a# in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: a# in this context"... |
| 14:00 | justin_smith | hlolli: eval doesn't use locals |
| 14:00 | nornagon | Is it just me or is there no transducer that produces a sliding-window over a collection a la (partition-all n 1 coll)? |
| 14:01 | nornagon | ,(partition-all 2 1 [1 2 3 4]) |
| 14:01 | clojurebot | ((1 2) (2 3) (3 4) (4)) |
| 14:01 | hlolli | ok, Im having a problem that Im in a macro and want to return unevaluated list, but it keeps evaluating. |
| 14:01 | hlolli | Of course I evaluate the macra since Im calling it. |
| 14:02 | justin_smith | hlolli: a macro should return the code it wants to be run - if you want to return the data unevaluated you should probably wrap the whole thing in quote |
| 14:03 | hlolli | ok, let me show you this macro.. wait |
| 14:03 | gfredericks | ,(defmacro put-this-code-in-a-list [& args] (list 'quote args)) |
| 14:03 | justin_smith | should be as simple as (cons 'quote current-body-of-your-macro) |
| 14:03 | clojurebot | #'sandbox/put-this-code-in-a-list |
| 14:03 | gfredericks | ,(put-this-code-in-a-list foo (inc 41)) |
| 14:03 | clojurebot | (foo (inc 41)) |
| 14:04 | justin_smith | oh yeah, list quote, not cons quote, right |
| 14:04 | hlolli | https://www.refheap.com/112165 |
| 14:04 | gfredericks | that macro is probably way too big |
| 14:04 | justin_smith | that macro is bad and you should feel bad |
| 14:05 | gfredericks | what is it that makes this need to be a macro? |
| 14:05 | hlolli | Well, I really need this to be a macro. |
| 14:05 | gfredericks | oh it's creating more macros |
| 14:05 | hlolli | I cant evaluate immeadiately. |
| 14:05 | gfredericks | but isn't it expanding to a bunch of defmacro calls? what's wrong with evaluating those immediately? |
| 14:05 | hlolli | It has to connect pieces togeather before a function inside this macro can be evaluated, works fine. |
| 14:05 | justin_smith | hlolli: as gfredericks was suggesting, if you changed that do to quote at the top, that would quote the whole damned thing |
| 14:06 | hlolli | Im a macro cowboy, sure :) |
| 14:06 | hlolli | ok, I try that. |
| 14:06 | justin_smith | or wait, wrap the do in (list 'quote ...) |
| 14:06 | justin_smith | because you have more than one thing in that do blcok, my bad |
| 14:07 | justin_smith | hlolli: if you look at core.async, they have a very nice way of making larger macros - instead of putting all of it in one macro, they make constituent parts, using functions that return lists |
| 14:07 | hlolli | ok, so to be more percise. Everywhere this macro works fine except in :load part of it, the only place ev-conc-ref# wants to evaluate prematurely |
| 14:07 | justin_smith | it makes something like that much more intelligible |
| 14:08 | hlolli | ok, I'll look into that. Originally this was suppose to be a small macro that I just got crazy on. |
| 14:09 | justin_smith | my rule of thumb is that macros are for defining a syntax, and the semantics (the logic implemented) is not the macros job and should be defined using functions |
| 14:09 | justin_smith | and, if the syntax part gets complex, you can use functions that do list transforms to decompose it |
| 14:10 | hlolli | yes that could ease this a alot, doing the logic elsewhere. |
| 14:14 | hlolli | but isn't it expanding to a bunch of defmacro calls? what's |
| 14:14 | hlolli | wrong with evaluating those immediately? ....... goodpoint gfredericks |
| 14:14 | hlolli | but one thing I was not able to debug was that by not having this as a macro (function) I was not able to define symbols outside on my namespace. |
| 14:16 | justin_smith | you can bind symbols to any namespace using intern |
| 14:17 | justin_smith | it will be a macro if it's a function and you add the metadata :macro true to the metadata of the symbol you bind |
| 14:17 | justin_smith | (and you need to insert two extra args at the beginning, that you will likely ignore) |
| 14:17 | clojurebot | I don't understand. |
| 14:18 | hlolli | ok, there's way too little info on interns on the clojure docs website |
| 14:18 | hlolli | or anywhere, I do use interns but slightly and not for macros. |
| 14:20 | jsabeaudry_ | When trying to setup datomic, I feel like a complete retard |
| 14:20 | justin_smith | hlolli: no, not ns-interns - that lists things |
| 14:20 | justin_smith | intern, that adds a binding |
| 14:20 | hlolli | yesyes, I mean that |
| 14:21 | hlolli | it's just a (intern ns symbol body) |
| 14:21 | justin_smith | ,(intern 'clojure.core 'foo "FOO") |
| 14:21 | clojurebot | #'clojure.core/foo |
| 14:21 | justin_smith | hlolli: yeah, that's all it is |
| 14:21 | justin_smith | ,foo |
| 14:21 | clojurebot | "FOO" |
| 14:21 | justin_smith | ,'foo |
| 14:21 | clojurebot | foo |
| 14:21 | justin_smith | ,#'foo |
| 14:21 | clojurebot | #'clojure.core/foo |
| 14:21 | justin_smith | see, I just defined something in clojure.core, easy |
| 14:21 | hlolli | but how can you tell the body to be a macro |
| 14:22 | justin_smith | ,(intern 'clojure.coo ' ^:macro bar (fn [nil nil x] x)) |
| 14:22 | clojurebot | #error {\n :cause "Unsupported binding form: "\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.Exception: Unsupported binding form: , compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.Exception\n :message "Unsupported binding form: "\n :at [clojure.core$destructure$pb__4924 invoke "core.clj" 429... |
| 14:22 | justin_smith | ergh |
| 14:22 | justin_smith | one moment :) |
| 14:22 | hlolli | ok I see where you are going with this |
| 14:24 | justin_smith | ,(intern 'clojure.core ' ^:macro bar (fn [_ _ x] x)) |
| 14:24 | clojurebot | #'clojure.core/bar |
| 14:24 | justin_smith | ,(refer-clojure) |
| 14:24 | clojurebot | nil |
| 14:24 | justin_smith | ,(bar 42) |
| 14:24 | clojurebot | 42 |
| 14:24 | justin_smith | ,#'bar |
| 14:24 | clojurebot | #'clojure.core/bar |
| 14:24 | justin_smith | see, working macro |
| 14:25 | justin_smith | a stupid macro, but it's a macro |
| 14:25 | hlolli | ok ok |
| 14:25 | hlolli | maybe this will do it |
| 14:25 | justin_smith | hlolli: that stuff is slightly weird, but I think it's simpler than macro generating macro generating macros |
| 14:26 | hlolli | yes, what I want is not really to solve this by solving it. As this is set up now, I only need to require one namespace and I can start to make music. Similar to overtone, I want to keep it that way. |
| 14:54 | hlolli | Ok, I just found out that the reason it evaluated is because the dosync returns the last item in the list.... so I guess I stick to this uglieness here and be wiser next time. |
| 15:07 | n3wb | I have a beginner question. When you use packages from others, how do you usually go about getting to know the available namespaces and functions? I often find myself trying to reverse engineer whatever map + special keys I need to pass, thinking there must be a better way... |
| 15:08 | justin_smith | n3wb: I usually end up reading the source. But there is also the doc function for seeing doc strings, and ns-publics for seeing all the functions in an ns |
| 15:09 | Frozenlock | n3wb: the function doc and the readme. |
| 15:10 | Frozenlock | Which makes me 'not liking' libraries without function docs. |
| 15:14 | jonathanj | can anyone recommend a logging library? |
| 15:19 | nornagon | i think clojurebot has something to say about java logging |
| 15:53 | codahale | jonathanj: clojure.tools.logging and then unilog to actually set things up |
| 15:55 | rhg135 | ~logging |
| 15:55 | clojurebot | excusez-moi |
| 15:55 | rhg135 | ~java |
| 15:55 | clojurebot | java is a mutable basket case |
| 15:55 | rhg135 | Ok |
| 16:17 | jonathanj | codahale: what's the opinion of timbre? |
| 16:17 | jonathanj | (it seems really complicated, at first glance) |
| 16:18 | codahale | jonathanj: I’d generally recommend against using things that don’t play nicely with SLF4J |
| 16:18 | codahale | Adding yet another logging backend into the mix seems unwise |
| 16:19 | jonathanj | codahale: why is that? |
| 16:19 | jonathanj | codahale: recommending against those things, i mean |
| 16:19 | codahale | It’s rare to work on a JVM-hosted project and not have a dependency which requires an SLF4J backend |
| 16:22 | kenrestivo | aye, the joy of silent failures. :compnent-will-mount doesn't execute. wonder why? :) |
| 16:24 | splunk | FWIW we've been on timbre in prod for two years, no problems. We also have Datomic (and possibly others) using SLF4J but at least with a little bit of fiddling it has not conflicted. |
| 16:26 | splunk | Although that being said we don't do a ton of work like, unifying logging settings / levels / whatever across the systems. It all just goes to stdout/stderr and then gets picked up by external processes. |
| 16:29 | jonathanj | splunk: i don't plan on doing anything complicated either, but using timbre seems more complicated than tools.logging (at least reading the examples) |
| 16:31 | splunk | timbre should only be (ns foo (:require [taoensso.timbre :as t])) (t/info "hello world") |
| 16:32 | splunk | + the add in project.clj |
| 16:32 | splunk | so...should be reasonably cheap to try out and see what you like |
| 16:44 | eseg | hi, does anyone know of clojure programming projects I can join? |
| 16:47 | justin_smith | kenrestivo: yeah, I've found if I want to reliably know what went wrong in starting components, I need to wrap the start method in a try/catch |
| 16:48 | justin_smith | splunk: the problem is that timbre is not compatible with any logging done by any java lib you might use, so then you have a minimum of two logging systems to configure and use |
| 16:48 | justin_smith | it would be different if I could make the java libs use timbre, but you can't |
| 16:58 | codahale | tools.logging + unilog also has the virtue of making it very easy to have a single, JSON-formatted log stream |
| 16:59 | eseg | i guess i should ust come up with my own project to work on |
| 16:59 | eseg | just* |
| 16:59 | codahale | And then puppetlabs/structured-logging makes it easy to log structured data which plays nicely with said log stream |
| 16:59 | justin_smith | eseg: leiningen has many issues marked as being contributions that should be easy for a newcomer |
| 19:59 | gfredericks | https://github.com/gfredericks/schema-bijections/blob/master/test/com/gfredericks/schema_bijections_test.clj |
| 20:57 | justin_smith | gfredericks: what does it mean to biject a schema? |
| 20:59 | amalloy | dang, i drop in for just a few minutes and apparently into the middle of a grand existential debate about schemas |
| 21:02 | amalloy | justin_smith: i would guess, given two compatible schemas, a way to convert from one to the other and back losslessly |
| 21:51 | blackdice | ever since I started growing a beard I've really liked programming a lot more for some reason |
| 21:53 | pontiki | ROFL |
| 22:03 | gfredericks | amalloy_: justin_smith: more or less yeah |
| 22:04 | gfredericks | though the idea in this case is to only have to write one schema, and other equivalent schemas get generated for you, along with conversion functions |
| 22:05 | justin_smith | gfredericks: so do you use prismatic/schema extensively at work? |
| 22:06 | gfredericks | lately yeah |
| 22:06 | justin_smith | I've become the annoying guy who won't shut up about how we would have a lot less of these problems if we had unit tests and used prismatic/schema at system boundaries |
| 22:07 | justin_smith | at work, that is |
| 22:07 | gfredericks | "these problems" ≟ the problems you have |
| 22:08 | justin_smith | gfredericks: "these problems" being rare bugs that only happen occasionally at runtime, with no leads toward what makes them happen, any significant change to the implementation involving a long session of tracking down everything you just broke through trial and error, and fixing it |
| 22:08 | justin_smith | people having to spend 10 minutes running the app through its paces before they are sure their change is good |
| 22:09 | gfredericks | oh manually? |
| 22:09 | justin_smith | right, manually |
| 22:09 | justin_smith | point and click |
| 22:10 | gfredericks | ~that is not how george washington meant for us to test software |
| 22:10 | clojurebot | Roger. |
| 22:10 | justin_smith | haha |
| 22:10 | gfredericks | ~that |
| 22:11 | clojurebot | that is http://images2.fanpop.com/images/photos/3000000/Arrowed-teen-girl-squad-3099521-570-420.jpg |
| 22:11 | gfredericks | clojurebot: that? |
| 22:12 | clojurebot | that is highly unlikely |
| 22:12 | gfredericks | quite the lag |
| 22:12 | justin_smith | gfredericks: little known fact, the "arrows" in that illustration are the category theory kind, that comic is about monads |
| 22:12 | gfredericks | I'm trying to make a homestarrunner joke out of this but I don't know how |
| 22:14 | justin_smith | "something something strongbad functor something" |
| 22:29 | kenrestivo | is there a library function that does basically (apply disj (-> new-map keys set) (keys old-map)) |
| 22:40 | justin_smith | kenrestivo: not quite - for some reason that vaguely reminds me of data.diff, but it looks at more than keys |
| 22:49 | kenrestivo | changed-keys, i named it. another item for the utilty library |
| 23:45 | virmundi | hello. Is the right place to discuss clojure/clojurescript related project design? |