#clojure logs

2016-02-21

09:59justin_smithpython476: you can use jstack to get the stack traces of all the running threads while its in that state (if you can find the pid that's using 100% pid, then 'jstack <PID>'), if you share that in a paste we can probably figure out what's going on
10:06python476hi justi
10:06python476n_smith
10:06python476thanks (as usual), didn't know about jstack, gonna test
10:11python476here it is http://lpaste.net/152994
10:12justin_smithpython476: I wonder what rewrite-clj is doing...
10:13justin_smithpython476: as far as I can see from that stack trace, rewrite-clj is in the process of parsing / analyzing your code
10:13python476lots of 'waiting' threads
10:14justin_smithand I guess maybe it's stuck in a loop, or doing some kind of intense calculation?
10:14justin_smithpython476: right, you can pretty much disregard the ones that say "parking"
10:14justin_smithbut notice the one starting at line 159
10:14python476note that I launched the lein repl and didn't do anything
10:14justin_smithI bet that is the one consuming your CPU
10:15justin_smithpython476: yeah, cider invokes a bunch of stuff, including apperently the rewrite-clj process
10:15python476yes that's the only busy stack
10:15justin_smithwell you can be busy without being deep, but the two often go together :)
10:16python476indeed, I expected the thin stacks beind idle-busy
10:16python476not stacking-mad-busy
10:16justin_smithfor example there's another runnable at refactornrepl220SNAPSHOT.org.httpkit.client.HttpClient.run(HttpClient.java:365)
10:16justin_smith(like 122)
10:17justin_smithshort stack trace but could be consuming CPU
10:17python476I thought FUTEX_WAIT indicated a socket issue for some reason
10:18justin_smithwhre do you see futex? (other than the title of the paste)
10:19python476htop / strace
10:19python476the only 100% cpu java thread strace shows one line with FUTEX_WAIT
10:22justin_smithahh OK it's an OS thing not a JVM thing http://man7.org/linux/man-pages/man2/futex.2.html
10:23python476oh you thought it was a pure code + infinite loop ?
10:23justin_smithpython476: is this in a vm?
10:23python476yes
10:23justin_smithpython476: https://nofluffjuststuff.com/blog/pratik_patel/2010/01/solution_futex_wait_hangs_java_on_linux__ubuntu_in_vmware_or_virtual_box
10:24python476ah no, not VM, I meant JVM
10:24justin_smithknown futex issue in vms?
10:24justin_smithoh, OK
10:24python476unfortunate abbreviation
10:24justin_smithso yeah this probably has nothing to do with the futex thing, that's just a jvm implementation detail and the bug is not likely there
10:25python476standalone `lein repl` doesn't exhibit the problem
10:25python476so it's between emacs cider nrepl lein
10:25python476and PEBCAK
10:25python476probably PEBCAK
10:25justin_smiththere's likely something pathological about refactor-nrepl with your specific project / codebase
10:26justin_smithrefactor-nrepl is likely where the issue is, based on those stacks
10:26python476ah, refactor is just above rewrite-clj
10:26justin_smithpython476: this is a total shot in the dark but you could try running lein eastwood and changing things it warns about
10:27justin_smith - things that eastwood warns about are likely to be things that would trip up a project that auto-parses code like that
10:27justin_smithor maybe more like things that would trip up refactor nrepl are also things eastwood would warn about
10:29python476but there's no trace of refactor-nrepl in that project
10:30justin_smithpython476: cider pulls in refactor-nrepl
10:31python476oh ok
10:31python476cider is drunk
10:32justin_smithpython476: cider is something people like because the devs prioritize features. It's also something people dislike because the devs prioritize features.
10:33justin_smithpython476: by using cider you are (by default at least) pulling in all the features unless you opt out, and you're using a tool with a less than stellar stability history
10:33python476you don't use it ?
10:33justin_smithpython476: I got tired of all the things breaking, stopped using it.
10:33python476I tried using inf-clojure-mode to avoid big dependencies
10:34python476but I have to admit cider makes the UX very nice
10:34justin_smithpython476: I think I have an unusual philosophy of UX, in that I prefer "things not breaking" as a higher priority than "having nifty features"
10:34python476that was my goal too
10:34justin_smithbut that's OK, we can each make those decisions for ourselves as users
10:34python476but so far I need a middle ground
10:35python476let's see what eastwood say
10:35justin_smithpython476: as an interim there's also disabling the refactor-nrepl plugin, I bet there's a way to do that either globally or just for that project
10:36python476surely, it seems cider often leaves control to the user
10:38TimMcjustin_smith: That's why I'm on Debian stable. :-P
10:38TimMcactually, oldstable at the moment, need to do the upgrade
10:38justin_smithTimMc: kudos, that's a typical choice of mine as well, but my current box came with ubuntu pre-installed, so I am on an ubuntu LTS
10:53python476btw, what's the meaning of WARNING!!! version ranges found for: [tikkba "0.5.0"] -> [org.clojure/clojure "[1.2.0,]"]
10:54TimMcpython476: tikkba of that version declares a dependency on any version of clojure from 1.2.0 on up.
10:54TimMcThat's a version range, and they're generally terrible.
10:54python476oh so the warning is on the lib, not project.clj
10:54TimMcyeah
10:55TimMcIf you depend on a version range, or against something else that does, it means your build can break randomly at some future point. THey're very annoying to debug, as well. That's why lein recommends excluding the transitive dependency and putting in your own explicit dependency if necessary, to pin it down.
10:57python476aight
10:57python476I'm trying cider-jack-in with an empty src folder..
10:58python476it does burn cpu but for one minute only
11:18justin_smithpython476: if it does that even for an empty directory, that might be worth a bug report
11:19python476maybe that's just ... slow machine leading to long init times
11:19python476also maybe I didn't realize it was burning cpu for a minute because one minute doesnt make a laptop hot
11:20python476but before coming here today it was running for 10+ minutes
11:20python476I'll keep bisecting my project to avoid disturbing others more
11:20python476where do you drop a bug report ? github issues ? a ML?
11:21justin_smithfor most clojure projects a github issue would probably be best, I'd imagine refactor-nrepl would be one of those
11:24python476aight, thanks
11:39python476it's getting weirder and weirder. made a new lein project, copying just the deps, local repo and a fake main, now no more repl
11:39python476unless ran twice
11:40python476enough bug hunt, time to read some fogus book
11:53python476cider, cider, cider
12:30TimMcOh no, they said "cider" three times in a mirro!
12:30TimMc*mirror
12:52justin_smithone of the unknown hazards of using the codemirror editor
13:33CStormwhat is the best way/lib to use when i want to fire a function every, say, hour?
13:34lumathere's Quartzite http://clojurequartz.info/
13:35justin_smithCStorm: it's not super hard to just use a java.util.concurrent.ScheduledThreadPoolExecutor directly, but there's also at-at as a nice wrapper
13:36justin_smithhttps://github.com/overtone/at-at
13:37justin_smithif you don't need a huge thing like quartzite that is
13:46banana`Hey guys, I have a quick question. I am trying to do an element wise or between two list. So if I have a L1 : '(false true) and L2 : '(true false) I want to do L1 or L2 and get '(true true) back since that would be element one from both L1 and L2 ored together and then element two from both ored together. Any ideas?
13:46justin_smithbanana`: bitwise-or?
13:46justin_smithoh no, boolean or
13:47banana`Yes a boolean or
13:47justin_smith,(map #(or % %2) [false true false] [true false false]) ; banana`
13:47clojurebot(true true false)
13:47justin_smithsadly you can't just map or, since it's a macro
13:47banana`Ya I tried that
13:48banana`I think mine didn't work since I did the same thing you did but used #(or %1 %2)
13:48banana`Any reason why you used % instead of %1?
13:48justin_smith,(map #(or %1 %2) [false true false] [true false false]) ; banana`
13:48clojurebot(true true false)
13:48justin_smithbanana`: no reason at all
13:48CStormthank you justin_smith
13:48justin_smithI don't actually use %1 very often, maybe it's a bad habit
13:48TMAbanana`: it is one character shorte
13:48justin_smithhaha
13:49justin_smithTimMc: by that logic you could replace identity with #(do %)
13:49justin_smitherr
13:49justin_smithTMA: ^ - sorry of the misstag
13:49banana`Okay thanks! Turns out I was using apply or reduce when I tried using a macro for or
13:50justin_smithbanana`: oh yeah, you don't need that, map handles multiple args just fine
13:50justin_smithbanana`: but also there's for
13:50TMA,do
13:50clojurebot#error {\n :cause "Unable to resolve symbol: do in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: do in this context"...
13:50justin_smith,(#(do %) 1)
13:50clojurebot1
13:50TMA,(do 1)
13:50clojurebot1
13:50ridcully,(source do)
13:50clojurebotSource not found\n
13:50banana`Okay cool thanks for the help justin_smith
13:51TMA,(map do [foo 1 2 3 true])
13:51clojurebot#error {\n :cause "Unable to resolve symbol: do in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: do in this context"...
13:51TMA,(map #(do %) [foo 1 2 3 true])
13:51clojurebot#error {\n :cause "Unable to resolve symbol: foo in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: foo in this conte...
13:51TMA,(map #(do %) ['foo 1 2 3 true])
13:51clojurebot(foo 1 2 3 true)
13:51justin_smithTMA: please don't use #(do %) instead of identity, it is equivalent but it is terrible :P
13:51justin_smithjust saying less chars isn't strictly always better
13:52TMAjustin_smith: I won't.
13:53TMAtoo bad do is a macro too
13:53justin_smithhaha
14:20pilneso, i'm just getting around to watching the 2013 keynote by paul phillips about just how much is wrong with the compiler side of scala LMAO
14:20pilnegod that's scary
14:20justin_smithoh, that's a good talk, but it's about a sad thing
14:21pilne4.2billion states for int testing???
14:21pilneyeah, it is sad, but lord, is that what building a language to run on the jvm entails?
14:24CStormdo you have a link?
14:24pilnehttps://www.youtube.com/watch?v=TS1lpKBMkgg
14:25justin_smithpilne: no, not at all. They had some design goals that were a poor fit for the vm.
14:25pilneso ambition lead to... dirty magiks that are having a ripple effect now?
14:28justin_smithpilne: that was my impression.
14:29pilneso TLDR: if you are using something else as a host, conform to it's limitations if you can't achieve what you want sanely?
14:40justin_smithpilne: right, but the hard part is truly understanding the limitations, I think
14:45pilnetrue... until you hit them, they aren't really waving their hands by a bonfire...
17:21bitsynthesishello! when writing a plugin which supports multiple versions of clojure, how should the clojure dependency be defined? i gather that leiningen supports version ranges but recommends / warns against using them. is there an alternative?
17:22rhg135depend on the earliest you have tested against and document it is what I'd do
17:23bitsynthesisthat will always pull in that specific version of clojure if the project uses a different one
17:24bitsynthesisso if you're going to specify a version you may as well specify the newest version of clojure it supports, right? since it's going to pull down what it wants regardless
17:24rhg135will it? I guess you can also do that
17:25bitsynthesisideally i would like it to use whatever version the project already specifies, if supported
17:25rhg135you can always use exclusions
17:26rhg135I always thought lein used any explicit deps over those required by dependencies
17:27TimMcIf you depend on the earliest version that works for you, you give more flexibility to people who depend on your lib.
17:27rhg135oh, plugin you said
17:27rhg135It'll use lein's version which is 1.8 right now iirc
17:27TimMcoops, didn't see that
17:29bitsynthesisif you specify clojure 1.6 it will use that, not lein's version or the project's version
17:29rhg135wouldn't that break lein though?
17:32TimMc"Plugins need not declare a dependency on Clojure itself; in fact all of Leiningen's own dependencies will be available."
17:32TimMchttps://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md
17:32rhg135that's what I was thinking
17:33bitsynthesisTimMc: aha. ok thanks guys. so maybe it is just downloading the version because it's specified, but not using it
17:33rhg135you can always check at runtime
17:33rhg135,*clojure-version*
17:33clojurebot{:major 1, :minor 8, :incremental 0, :qualifier nil}
17:57rhg135it's so quiet these days
17:57rhg135~slack
17:57clojurebotCool story bro.
17:57rhg135hmm
18:10ridcullyrhg135: younger generation is taking over the web
18:12rhg135ridcully: not sure if I'd say 'younger' but that is certainly possible
18:15ridcullyor maybe its just sunday and this channel is most active on eu/us working hours
18:15rhg135that sounds very likely
18:16ridcullyor the justin_smith wake hours?!
18:16rhg135I heard a rumor that he does not sleep lol
18:17rhg135he only clojures
18:30CStormi setup a profiles.clj with some env vars: {:dev {:env {:secret "secret"}}} – i can get them just fine in my code when i run lein ring server. but after a uberjar i guess its not in "dev" anymore. Where should i add them then?
18:32rhg135usually you run on a different environment so I think usually you set it in the environment
18:33CStormbut if i just want to use the same secret i use in dev?
18:34rhg135lein doesn't usually exist in production, I'm not sure how'd you do that
18:35CStormi am running my project with java -jar file.jar
18:36CStormso im not using lein.
18:36CStormits just that im unsure where to put my prod enviroment variables :)
18:36rhg135exactly so it won't use anything from profiles.clj
18:37rhg135you set them in the environment, but I'm unsure how to reuse the dev key
18:38rhg135as in env SECRET="secret" java -jar file.jar
18:38CStormOk
18:38CStormWill look that up.
18:38CStormTy.
18:38rhg135np
18:47newcljHey, where do I put my java interface if I want to implement it in clojure? I have it in :gen-class :implements <interface>, but I'm assuming I have to put the .java file somewhere in my clojure proj?
18:51rhg135it has to be a .class on the classpath
18:52rhg135in lein :jvm-opts is a vector of a java source tree which will be compiled before launching the repl
18:53newclj@rhg135 Thanks, I'll have a look into it
18:53rhg135clojure in general is great at interop
19:02newcljso I added a :java-source-paths [<path to .javas>] in my defproject and it seems to pick up the interface in IntelliJ, but I still get a class not found exception when running lein uberjar?
19:03rhg135yes, sorry :java-source-paths. my brain is jumbled today
19:04rhg135what is the contents of that dir?
19:05newclja java interface and 3 .java files the interface depends on
19:06rhg135in subfolders? remember java also requires a certain structure and corrent naming
19:07newcljhm no, just on all together in the one dir
19:09rhg135for instance: com/rhg135/Test.java containing package com.rhg135; interface Test { public Object doStuff(); }
19:09newcljall the files are within the same package in java
19:11rhg135but I'm not sure as I don't do java in my lein projects
19:11rhg135or at all manually
19:15newcljrhg135: Fair enough, it's definitely picked up in IntelliJ now though :) so thanks for the progress
19:15rhg135np
19:25newcljrhg135: Just had to specifiy package name in my :implements, working perfectly now :D thanks agian
20:12rhg135ah ok. glad it worked
20:34oichis clojuresque the only clojure gradle plugin or clojure using gradle approach?
20:38edannenbeoich, unless gradle is a requirement, did you try boot yet? it's pretty much the gradle of clojure
20:39bendavisncsay hey guys, is there any way to have something similar to a javascript object in clojure, by that, i mean some hash map with an idea of "this"
20:40justin_smithbendavisnc: for "this" to be useful you need methods
20:40justin_smithbendavisnc: perhaps you want defrecord
20:41bendavisncok yeah probably
20:41bendavisncall i want is some namespace to define values and methods and maybe / probably abstract methods / values as well
20:41justin_smithdefrecord can implement methods from interfaces or protocols, and each one gets a "this" arg
20:42justin_smithbendavisnc: wait, namespace?
20:42bendavisncare things like that completely discouraged in lisp land?
20:42bendavisncyeah, like just a scope level of values
20:42justin_smithbendavisnc: I mean we have defrecord but we also have namespaces and their usages don't overlap
20:43oichedannenbe I have barely looked at boot so far. I've gotten further with leiningen. But, yes the project needs to be able to be used by people other than me and so, not boot or leinengen
20:43bendavisnceh ok. i think i'm just using the word more liberally
20:43justin_smithnamespaces are first class though, if that's what you actually want
20:44sineerHi! I use core.async thread to fill up a channel and a go block to empty it. How do I wait for the thread to finish and channel to empty before main exit?
20:44bendavisncok. i think i need to rethink what i'm doing. maybe i don't need this
20:45sineerI've been trying to find good examples but did not find any, probably just not looking for the right thing
20:45justin_smithsineer: core.async/thread returns a channel, if you try to read that channel you won't get a value until the thread exits
20:45sineerjustin_smith: ok, thanks!
20:45justin_smithso if your primary thread reads from that channel, that primary thread won't exit until the thread does (of course)
20:46sineerwhat about the go blocks? I doseq lots of them to empty the channel..
20:46justin_smiththey also each return a channel
20:47sineeroh yeah and now I don't doseq lots of them anymore just one go block and doseq is in my thread.. neat, thanks again!
20:51bendavisncwould it be a bad idea / is it possible to have a hashmap as like a base template, and have a hashmap value be lazy but a throw exception if accessed without merging first?
20:52bendavisncdoes that make sense?
20:52justin_smiththere are no lazy hashmaps
20:52bendavisncok but are there lazy hash map values?
20:52justin_smiththe only thing that is lazy is a lazy-seq
20:53bendavisnclike a key has an expression that's not evaluated until accessed?
20:53rhg135justin_smith: does not datomic do it for entities?
20:53justin_smithno, that does not exist
20:53bendavisncvalue*
20:53justin_smithrhg135: OK, there are no lazy hash-maps in clojure.core
20:54bendavisnci think i may be able to use delay for what i'm thinking
20:54rhg135delay is a good compromise
20:55rhg135I once thought of writing a facade over maps with delayed keys
20:55justin_smithbendavisnc: what does "hash map as like a base template" mean?
20:56bendavisnclike i'm basically trying to make an abstract class
20:56bendavisncwhich maybe just isn't clojureish at all
20:56justin_smithbendavisnc: just use a hash map. They are immutable, so your function can just assoc something to it.
20:56bendavisncbut i want something with base values that gets extended
20:57justin_smithbendavisnc: that's what assoc does
20:57justin_smithbendavisnc: the map is immutable, assoc returns a new one with your associations performed
20:57justin_smithso you don't need a special template, you just need a hash map, and assoc
20:57bendavisncok but how do i say, like, this value will be in this map. or an extension of this map?
20:58justin_smithwhat is an extension?
20:58bendavisnca merge call i think
20:58rhg135schema, yo
20:58bendavisncyeah probably
20:58bendavisncbase template = schema = abstract class
20:58justin_smithyeah, sounds like you want prismaticschema, this is not a thing in the language itself
20:58justin_smithbendavisnc: no he is talking about a specific library called schema
20:59bendavisncah ok thanks for the heads up
20:59justin_smithbendavisnc: abstract classes are abstract classes, this is the jvm so we have them too but they are not useful
20:59rhg135well, asserts exist
20:59rhg135,(assert (string? (:x {})))
20:59clojurebot#error {\n :cause "Assert failed: (string? (:x {}))"\n :via\n [{:type java.lang.AssertionError\n :message "Assert failed: (string? (:x {}))"\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6927]\n [clojure.lang.Compiler eval "Compi...
20:59bendavisncright ok
20:59justin_smithrhg135: asserts are a supertype of type asserts
20:59bendavisnci'm super new to thinking in functional terms
20:59justin_smith*superset
20:59bendavisnclet me ask this though:
21:00rhg135ah right!
21:00bendavisncsay i have a situation, where basically i'm calling / mapping all of these functions
21:00bendavisncand in all of these functions, i'm always passing the same variable as like an extra parameter that basically represents a context of information
21:01bendavisnclike the program is always the same, but these are our global variables
21:01rhg135partial, yo
21:01bendavisnchmmmm
21:01justin_smithbendavisnc: again with the wording, vars (the things created with def) are all globally accessible but in namespace scope
21:02justin_smithbut yes, if you want to provide some extra data in function calls partial is very helpful
21:02justin_smithif it's like a boilerplate everything gets this arg thing in particular
21:02rhg135(def contextify (partial partial))
21:03justin_smithbendavisnc: and yes, an argument passed to every function you call is equal in power computationally to a global
21:03justin_smithrhg135: lol
21:03bendavisncjustin_smith: i get that, but what i was wondering was a. is it frowned upon? b. is there a pretty straight forward default approach to an alternative?
21:04rhg135,(((partial partial) + 1) 2 3)
21:04clojurebot6
21:04justin_smithbendavisnc: haskell has monads for this :)
21:04justin_smithyou can get monads from a lib but they are weird and don't perform well and are not part of the core language
21:04bendavisncjustin_smith: omg, i've been trying so hard to learn that word in scala land
21:05rhg135monads are great just not when you need them
21:05bendavisncwhat i'm doing is, i basically have this program that renders an image, and i have render parameters
21:05bendavisncstuff like width height etc
21:06bendavisnci have files that could be like json files
21:06bendavisncrender parameter files
21:06bendavisncand i'm just trying to figure out what to do with these files / how to incorporate the data
21:07bendavisncso basically i have these hashmaps
21:07bendavisncthat should be an interface in java / scala land
21:07justin_smithinterfaces do not contain data though
21:07justin_smiththey describe methods you can call
21:07bendavisncbut the data fits a common interface
21:07bendavisncthere's always a width, etc
21:08justin_smithinterfaces are for executable methods not data
21:08bendavisncdude that's just wrong
21:08rhg135a protocol can be backed by a map
21:08bendavisncan interface of course can define a value
21:08justin_smithbendavisnc: this is the jvm, "interfaces" are a specific thing that describe methods not fields
21:08bendavisncin java i guess it's a little weird, and it's actually a hard coded getter
21:08bendavisncbut in scala it's straight forward with traits
21:09bendavisncso i guess yeah java would have to be an abstract class
21:09bendavisncsorry i shouldn't say interface
21:10rhg135,(do (defprotocol A (get-a [me])) (extend-protocol A clojure.lang.PersistentMap (get-a [me] (:a me))) (get-a {:a 1}))
21:10clojurebot#error {\n :cause "clojure.lang.PersistentMap"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassNotFoundException: clojure.lang.PersistentMap, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.ClassNotFoundException\n :message "clojure.lang.PersistentMap"\n :at [java.net.URLClassLoader$1 run "U...
21:10justin_smithbendavisnc: anyway, in clojure world the best thing that does the things you describe is prismatic/schema
21:11bendavisncok so yeah actually maybe this helps pin point what i wanna do?
21:11bendavisncin java, this would be an interface
21:11bendavisnccould be*
21:11rhg135that's a lot of wrapping around a map
21:11justin_smithprismatic/schema describes layout of immutable data
21:11bendavisncand the method promise would be like public int getWidth()
21:11justin_smithan interface or protocol in clojure describes methods you can execute
21:12justin_smithwhat is a method promise?
21:12bendavisnca signature declaration
21:13justin_smithbendavisnc: when you have immutable data, getters are just annoying boilerplate
21:13justin_smithif you need data use data, if you need methods use methods, and if you really really want to be mutable yeah use deftype or something and use getters and private things and yadda yadda
21:14justin_smithbut the premise in clojure is we almost never need mutation, and when we do we just use a simple mutable box that only holds one value
21:14justin_smith(unless we need to do otherwise for compatibility reasons)
21:14bendavisncjustin_smith: i'm not talking mutation
21:15justin_smithbendavisnc: why the hell do you want getters then?
21:15justin_smithmy point is forget about getters and interfaces, make a data declaration with prismatic/schema and just use that data
21:16rhg135in java they usually used to hide the actual structure of the data, justin_smith
21:16justin_smithand most of the time you only need prismatic schema at system boundaries where very different systems try to interact within one program
21:16bendavisncso i want to define methods that works on data
21:16bendavisncimmutable data
21:16justin_smithrhg135: I know this is usual, it's also not how we do things in clojure
21:16justin_smithbendavisnc: OK, define methods in a protocol
21:16justin_smithor just make functions instead or use methods later when you realize you actually need that (usually you do not)
21:17rhg135I mean, mutability and encapsulation are complected into getters
21:17bendavisncrhg135: sorry, are what into getters?
21:17justin_smithbendavisnc: complected means "made complicated" by joining
21:17rhg135in to rather
21:18justin_smithbendavisnc: complecting is the opposite of that thing where you separate things that have nothing to do with each other and suddenly everything is simpler (aka simplification)
21:18rhg135but yes the idea to use a function is the approach I'd take
21:19justin_smithrhg135: I'd assert that mutation makes getters neccessary though, so it's not neccessarily a complex
21:19bendavisncthanks a ton guys for bearing with me
21:19rhg135that way you only have to change it if you change the structure
21:19bendavisncidk, scala made me think differently about the division between function and value
21:19justin_smithnp, hope I don't seem impatient or overly vehement here, I get absurdly excited about these issues :)
21:20justin_smithscala does lots and lots of complecting
21:20rhg135justin_smith: only in some cases. Most getters I've seen just do `return this.x`
21:20bendavisncit made me want to program more in a way where i'm talking about values that don't exist yet
21:21justin_smithlazy-seqs, promises, and delays make some of this possible, but not in the haskell "everything is lazy" way of course
21:21bendavisnci sorta wish i knew how to write this code in clojure
21:22bendavisncdef getWidth(): Int = {throw new Exception(getWidth not overriden)}
21:22bendavisnci thought a delay does that but now i don't
21:22mgaarebendavisnc: you can't just "flatmap that shit"
21:22rhg135,(do (def data {:a (delay 1)}) (defn get-a [m] @(:a m)) (get-a data))
21:22clojurebot1
21:22mgaarebendavisnc: Clojure takes a stand against concrete derivation, which it sounds like you're trying to do
21:23bendavisncmgaare: i don't know what you mean by can't flatmap, but i wish i did
21:24mgaarebendavisnc: sorry, just little scala joke.
21:24bendavisncmgaare: ah ok
21:24bendavisncman i like so much about both languages
21:24mgaareI briefly worked at a Scala place, and some coworkers suggested that should be the official motto of the language
21:24bendavisnci was sorta hoping i could treat clojure like a dynamic clojure where i could type class only when i wanted
21:25bendavisncmaybe that's dumb
21:25justin_smithclojure is a dynamic clojure, so that's a start
21:25justin_smithbut we don't mess with types much (for better and also for worse)
21:25bendavisnchaha sorry, treat clojure like a dynamic scala
21:26rhg135I take the python approach were a class is just a bunch of obfuscated data
21:26justin_smithif you want strong typing and compile time proofs as your top priority, you probably want scala not clojure
21:26mgaarebendavisnc: there are a few tricks you can do here. so you have your `width` function, and you're saying you don't want that to work unless some specific type is implementing it, right?
21:26rhg135and on the jvm classes are mostly immutable
21:26rhg135objects though...
21:26bendavisncmgaare: you understand my sould
21:26bendavisncsoul*
21:27mgaarebendavisnc: so you could define a protocol, say, like this: (defprotocol Dimensions (width [this]) (height [this]))
21:28mgaareso if you try to call that width function on something that doesn't implement it, you'll get an exception already.
21:28mgaareBut perhaps you want a more specific exception? Or what?
21:29bendavisncmgaare: ok yeah that is what i want
21:29bendavisncthanks for getting that, i don't need a compile time exception really
21:29bendavisnci basically just don't want to define a value
21:29rhg135mgaare: technically, if you used straight maps you'd still get an exception anyway, but it'd probably be a NPE then
21:29bendavisncat a time a define it
21:29bendavisncsay
21:29bendavisnc(def width 0)
21:30bendavisncand worry that my width is ever zero
21:30bendavisnci should say that's not my only intention
21:30bendavisnci also just want to express that there's a scope of execution with a width value
21:30mgaarewhere you're kind of going off the rails of idiomatic Clojure a bit is thinking about it in terms of some kind of abstract class that you'll subclass for implementations of this.
21:31bendavisncok yeah
21:31bendavisncthanks
21:31rhg135{:pre [(not (zero? n))]}
21:31justin_smithbendavisnc: def only creates vars, which are global mutable values inside a namespaced global scope, and our data is immutable, you can't have invalid partial state in an immutable data structure
21:32bendavisncok
21:32bendavisncyeah
21:32bendavisnci'm sorta a scala guy
21:32justin_smithbendavisnc: immutability is our cure for partial state (you might want runtime checks for other sources of invalid state of course)
21:32bendavisncbut i'm also just sorta a javascript guy
21:33bendavisnci want something that in jquery land i would merge
21:33bendavisncand then i could call a function inside it, which would have access to everything inside the called object
21:33justin_smithbendavisnc: "inside it"
21:33bendavisncand theoretically, you could call this existing method on a template that hasn't been extended or provided values, so the method should tell you it failed
21:34mgaarebendavisnc: good old javascript emulated modules
21:34bendavisncand that method can be getWidth for example
21:34bendavisncand i guess that's just bad clojure code?
21:34mgaareSo this way of thinking about Javascript's object model is a good fit for Clojure in some ways and a bad fit in others.
21:35bendavisnci wanna write something close to
21:35bendavisncmyCrazyArtThing.withWidth(100).render()
21:35justin_smithbendavisnc: I think you will find that compared to what you are used to, clojure is not a flexible language for programming styles. But the "one true way" clojure strongly encourages with its design does actually work out pretty well.
21:35justin_smithbendavisnc: (render (assoc crazy-ar-thing :width 100))
21:36rhg135,(do (defn call [m k & args] (apply (get m k) m args)) (call {}))
21:36clojurebot#error {\n :cause "Wrong number of args (1) passed to: sandbox/call"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: sandbox/call"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.RestFn invoke "RestFn.java" 412]\n [sandbox$eval26 invokeStatic "NO_SOURCE_FILE" 0]\n [sand...
21:36rhg135eh, something like that would work
21:36mgaareClojure's object model is really nothing like this, so thinking about templates and prototypes isn't helpful. However, Clojure records give you a lot of what you want, in that when you implement a protocol in a record, all the fields of the record are available in the scope of the function
21:37rhg135the point is the passing in of the this is explicit
21:37bendavisncjustin_smith: that's a really interesting thing to say
21:37amalloydefining a protocol and a record just for scoping reasons should make you pretty sad
21:37bendavisncso when ppl say clojure is flexible, they sorta need to be careful what they mean
21:37bendavisncit sounds like anyways
21:38justin_smithbendavisnc: for example at every turn clojure makes concrete extension (inheritence) arbitrarily difficult to do. Because the language designers think it's a bad idea to use it.
21:38justin_smithbendavisnc: yeah, I would never call clojure flexible
21:38rhg135clojure is very flexible, but flexibility has a cost
21:38justin_smithhmm...
21:38rhg135usually it's a lot of buggy code to write
21:39mgaarebendavisnc: it's not flexible in the sense that javascript is flexible, which is where you can write in almost any kind of style you want but then someone writes a book called "Javascript: The Good Parts" and it's 50 pages long
21:39bendavisnchahaha yeah i see what you guys are saying sorta
21:39bendavisncis it a similar style philosophy to python?
21:40mgaareI think so, yes
21:40bendavisnclike i sorta feel like clojure / python are the right wingers of the programming language world
21:40rhg135actually python's methods are implemented by essentially partialling the instance when you access them via an instance
21:40justin_smiththere's a few languages I would count as opinionated, including python yeah and also ml and C even
21:41mgaarerhg135: I think he meant python and clojure are similar in the sense that both of them have strong opinions about the correct way to write code in the language
21:41justin_smithbendavisnc: if you are looking for a flexible, relatively unopinionated lang, once again scala's probably your guy (but I'm here because I agree with clojure's opinions generally)
21:41rhg135yeah, I'm just pointing out objects are essentially a map with partial functions
21:42amalloy"partial functions" means something specific and quite different from partially-applied functions
21:42bendavisncyeah
21:42bendavisnci've been thinking a lot about this lately
21:42rhg135yeah I meant partially applied
21:43bendavisnci love lisps "data is code" mantra
21:43rhg135lexicon failure
21:43bendavisncand i was thinking about what type of language would be if you could extend json
21:43bendavisncand im thinking that's basically, lisp, right?
21:43justin_smithlisp with some extra data types sure
21:44justin_smithclojure is that plus default immutability in many ways
21:44bendavisncbut yeah, i'm just saying it's a 1000 x closer that lisp's schema than to scalas
21:44rhg135isn't that what xml was plus a bunch of cruft?
21:44bendavisncand then another few magnitudes of lines, i guess we get to java
21:45bendavisnci mean an executable json
21:45bendavisnca self referential json
21:45justin_smithjava doesn't have the data literals though
21:45justin_smithand doesn't do self reference nicely at all
21:45justin_smith(in my experience)
21:45bendavisnclike if i could write this code:
21:46bendavisnc{crazyArtProject: {width: 0, height: 0, size: this.width * this.height}}
21:46bendavisncwhich yeah... i guess that's literally javascript
21:47rhg135{"function": "add", "args": [1 2 3]}
21:47rhg135indeed, json requires string keys too
21:47bendavisncidk. javascript doesn't seem data first but i hoenstly don't know how to articulate that
21:48bendavisncmaybe i'm looking for an eager evaluation javascript
21:48rhg135js is eager...
21:50bendavisncshit sorry
21:50bendavisnci was thinking how in js
21:50bendavisnc[1, 2, 3] is sorta equal to '(1 2 3)
21:51justin_smith,(= [1 2 3] '(1 2 3))
21:51clojurebottrue
21:51bendavisncthat's weird
21:51bendavisncor not
21:51justin_smithbendavisnc: structural equality
21:51bendavisncsorry i'm use to java
21:51rhg135not really
21:52justin_smithbendavisnc: if two values are immutable, and have the same effective shape, clojure typically considers them equal
21:52rhg135if you use the seq interface '(1) is as good as [1]
21:52bendavisncgotcha. yeah i like that
21:52bendavisncso you literally never have situations of something like toList?
21:53rhg135list* is sometimes used
21:53amalloylist* is not like toList at all
21:53amalloyseq kinda is
21:54rhg135well I don't know scala so I only guess
21:54rhg135into maybe
22:03bendavisncthanks again guys for your time and insights
22:03bendavisncnight
22:38solatisok, so, in clojure idiomatic code, what does one do when someone calls a 'find' operator which has no result? return nil?
22:39amalloy,(find {} {})
22:39clojurebotnil
22:39amalloygood thing to take inspiration from
22:39solatisah that's great
22:42TEttingerhm, any Cursive experts around? I'm having an odd issue where at the command line lein can see deps just fine, but in IntelliJ with Cursive, none of the deps seem to be on the classpath and aren't even visible.
22:43TEttingerso no suggestions for deps, errors on anything defined in a def...
22:43TEttinger*dep
22:43TEttingerhowdy cfleming :)
22:46TEttingerI've tried re-synchronizing the project.clj, I don't see any analogue to `lein deps`
22:47TEttingeron intellij 15.0.2 if it matters
22:49TEttingerappears to be cursive 1.1.0-15
22:49amalloyTEttinger: try invalidating caches and restarting
22:49TEttingerwill do
22:49amalloythat's often fixed intellij issues for me
22:52TEttingernope, initially it opened up and there was no context on -main , like it was plain text. I closed core.clj with that in it, reopened, and highlighting came back saying dep can't be found, etc.
22:52solatisis there any way to force lein to re-download a specific directory when i know for sure that, even though the version is the same, the .jar has been modified?
22:52solatisthis is about a 'internal-lib-0.1.0-SNAPSHOT'-style library
22:52solatisit's hosted in a private s3 repo
22:52TEttingerthere's some flag to pass to lein deps, I think it miiiight be -U
22:52TEttingerI'd check the lein docs
22:53solatisyeah but that doesn't seem to work :/
22:53TEttingerthere's also the deleting-the-directory-in-.m2 approach
22:54solatisyeah, that second one is the one i didn't want to use
22:54solatiswell, sucks, guess i have to do the delete-.m2 approach anyway
22:55TEttingernot the whole thing though
22:55solatisyeah i know
22:55TEttingeryou can just delete the directory that's old oh ok
22:55solatisthe thing is, i want to set up an agile environment where every dev always has the most up-to-date checkout of this private library
22:55TEttingerha, that's exactly what I'm trying to do using jitpack.io
22:56TEttingerbut that's more for public libs
22:56solatisso i am now using our continuous deploy strategy to continuously deploy to S3
22:56solatisand have our devs use that as a dependency
22:56solatiswhich works great, until you update it with the same version number...
22:56solatisso guess we should stop doing that
22:57TEttingerhm, I know maven treats SNAPSHOT versions differently
22:57solatishmm
22:57solatisthats interesting
22:58solatisi know in other language environments, you're able to 'symlink' to a local dependency
22:58solatisso do a git checkout, and then tell the build tool to use that local checkout for a certain dependency, rather than a public repo
22:58TEttingeryeah, you can in lein, I think. `lein install`
22:58solatisaha
22:58solatisaha!
22:58solatisthat would solve all my problems
22:58TEttingerthough that installs whatever the project.clj has for a version
22:58solatisyeah sure
22:59TEttingeralso I am super rusty
22:59solatisbut it's more of a situation where dev A fixed a bug in internal library, and dev B needs to be able to use that fix
23:00TEttingerhttps://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#snapshot-versions
23:00solatis\o/
23:01solatisthanks
23:01solatisdidn't know there was that kind of logic
23:01TEttingeralso checkout deps
23:01TEttingerthat's a feature I haven't seen before in lein
23:03TEttingersolatis: it looks like checkout deps may solve more features than I thought
23:04TEttingersince if everyone can just get an updated copy of the source, then they'll automatically see the source changes when the code changes
23:04TEttingerit looks like repls will pick up on the change without restarting too
23:04clojurebotCool story bro.
23:05TEttingerclassic
23:05solatisnice, nice
23:05solatisnow, where do i find a good clojure dev to hire...
23:06solatisi think there was a slack channel for that
23:07TEttingeris it a local thing? I think that may affect your hiring choices significantly
23:07TEttingerclojure devs in topeka kansas vs. the bay area... uh...
23:09hiredmanif you are hiring, I am looking
23:09mgaaresolatis: me also
23:09TEttingerbut your name says "hired"
23:10solatislol
23:11TEttingermgaare: do you have any open source projects out there? one of hiredman's open source contributions just said "Cool story bro."
23:11solatisyeah, being around the office is required, sadly
23:11solatisbut, I'm introducing Clojure big time on our organization
23:11TEttingergreat!
23:11solatis(it's in Amsterdam)
23:12TEttingerthat is not a bad place to live at all.
23:12solatisexactly, we sponsor visas
23:12TEttingerwhat's the english-speaker ratio like? if someone didn't speak dutch
23:12solatiswe speak english exclusively at the office
23:12TEttingerthen again dutch is about as close to english as it gets
23:13solatiswe have several international team members already
23:13solatisand well, dutch people are insanely good at speaking English, on average
23:13TEttingerI'd expect it, the vocabulary is so close
23:14TEttingereven word order is similar, and english doesn't often share that
23:14solatiswell it's rather because we're a small country, which depends a lot on other countries for trade, doing business, etc
23:14hiredmanhttps://twitter.com/justincampbell/status/575447532865609728
23:14solatisand we don't dub our movies, we subtitle them
23:14solatisetc
23:14solatishiredman: hehe i know
23:15solatishiredman: it's a difficult decision
23:15solatisi'm CTO, so i *can* make the call
23:15solatisbut i do want people to be around the office 1 or 2 days a week _at least_
23:15solatisbut yeah, you're severely limiting your choices
23:15TEttingerI have a bunch of random generators that imitate an existing language, and if you don't stick in way more english-only markers (-ought, -augh) than should probably be there, fake english looks more like fake dutch
23:16hiredmanthere was some microsoft studies just making the rounds
23:16solatisTEttinger haha
23:16hiredmanhttp://research.microsoft.com/apps/mobile/news.aspx?post=/en-us/news/features/nagappan-100609.aspx
23:16solatishiredman: well, i worked from a low-cost country as a freelancer for 2 years, and it's definitely very much possible
23:16hiredman"Geographical Distance Doesn’t Matter— Much."
23:17solatisthe problem with remote work is that it only works with really good, and independent developers
23:17hiredmaneveryone claims to hire the best
23:17hiredmanso, everyone should have no problem with it
23:17solatishaha
23:17solatisif only that were true! sometimes you just need to expand the team and hire developers that are 'good enough'
23:18solatisbut in general i agree with you
23:18solatisi can get a lot more done when i'm not at the office
23:20TEttingerseeing as I don't have an office, my productivity often depends on whether my cat has decided my chair is now his chair
23:20TEttingerso I don't have an office but I do have a boss
23:20solatisyes, cats can be quite dominant bosses
23:20solatisespecially when it concerns food
23:24TEttingerheh, satchmo (younger cat) isn't demanding about much at all. my other cat (eddie) is very demanding about some very specific things, like his tent. we have turned a guest bed into a full-time tent for eddie, pulling the covers up over the headboard so he has a place to stay. when my brother actually needed that bed... eddie would pester him until the bed became a tent again
23:25TEttingerthese cats are the bosses
23:26solatislol
23:26solatisso, you actually have given your whole cat a bed
23:27solatisnever cave to a cat's demands!
23:27justin_smithas opposed to people who give part of their cat a bed
23:27solatisyou give him a pillow, and he takes the whole bed!
23:27solatislol justin_smith ... it's early in the morning here, give me a break
23:27TEttingeryeah, eddie is pretty darn happy with that tent
23:28TEttingerhe purrs in there constantly
23:28solatismy cats have to sleep outside
23:28solatisfuck them
23:28solatismy house
23:28TEttingeryou don't have coyotes or coywolves in amsterdam
23:28solatiswell i'm in cambodia now actually
23:28justin_smithTEttinger: kitty purr indicator is one of the few KPIs that aren't complet bs
23:28solatisyou have things like snakes
23:28TEttingermm
23:29solatisbut my cats are vicious
23:29solatisthey eat poisonous snakes for breakfast
23:30justin_smith"between the tuna plan, and the tent, and the blind flightless bird program, our KPI numbers look excellent this quarter"
23:30TEttingercoywolves are terrifying though. coyotes don't have any fear of humans. wolves can bring down larger animals than people and do so regularly. mix the two and you end up with the property of all wolf hybrids where they don't have the behavioral cues of either parent
23:31solatissounds like something out of a zombie movie
23:31TEttingerapparently because wolf numbers have dwindled so much in the northeast US and nearby canada, wolves breed with the newly introduced coyotes out of necessity, and produce much more effective offspring
23:31TEttingerwe just have plain coyotes here in so cal
23:31TEttingerbut they are loud
23:32TEttingerall night, yipping furiously
23:33TEttingerthey think coywolves are so effective because the whitetail deer hasn't had any common predators since people nearly wiped out wolves, so you have inexperienced deer and suddenly a predator that's just big enough to bring one down and works in groups
23:33TEttingerand coyotes can't bring down deer normally
23:38TEttingeralso, if you want zombie movie, there are fish that I believe are common in cambodia and are now invasive in parts of the US. https://en.wikipedia.org/wiki/Snakehead_(fish)
23:38TEttingeryep, They are one of the most common staple food fish in Thailand, Cambodia, Vietnam, and other South East Asian countries, where they are extensively cultured.
23:58solatisTEttinger3: haha yes i am fully aware of that. fucking monkeys can be lethal over here