#clojure logs

2014-07-16

00:31numbertenis there a good way of lazily reducing?
00:31numbertentrying to read a big file lazily and read values from it and store them in a vector via 'reduce'
00:33numberten(with-open [rdr (clojure.java.io/reader "file")] (reduce #(conj % %2) [] (line-seq rdr)))
00:33numbertensomething like that
00:34tbaldridgehow would you lazily store something?
00:34jeremyheilernumberten: i'm not sure what you mean by lazy reduce.
00:36numbertenmaybe that was the wrong wording
00:37numbertenI think something about that is holding onto the head of the seq?
00:38numbertenbecause the heap runs out of space
00:38numbertenbut I've been able to make vectors of that size before
00:39jeremyheilerhow big is your file?
00:40tomjacktry (reduce (constantly nil) ...) to test?
00:40numberten91M
00:42numbertenconstantly nil returns nil. what does that test?
00:42tomjackI don't think it holds the head
00:42numbertenhrm
00:44tomjackI guess it may be a chunked seq, but surely as long as you can fit every chunk of 32 lines, the reduce with (constantly nil) should work (I'd think)
00:44jeremyheilerdoes slurp cause the same problem?
00:47numbertenyeah it does
00:47tbaldridge"Well there's your problem...."
00:49technomancyhttp://twitterthecomic.tumblr.com/post/40956811679/ah-heres-your-problem-pulls-out-random-part
01:29danielcomptonWhat would be the way to turn {:a {:b :makes :c :takes} :b {:c :takes} :c {:a :makes}} into {:a [:b :c] :b [:c] :c [:a]}?
01:30danielcomptoni.e. get just the keys from a nested map
01:30jeremyheiler(update-in m [:a] keys) ?
01:31jeremyheilerso.. (-> m (update-in [:a] keys) (update-in [:b] keys) ...)
01:31danielcomptonThere could be an arbitrary number of keys
01:32danielcomptonWith arbitrary names
01:32TEttingerdanielcompton, there is almost certainly a way
01:33jeremyheilerso, (map #(update-in m [%] keys) (keys m)) ?
01:33danielcomptonTEttinger: It seems like one of those Clojure things that will be a blindingly obvious one liner
01:34jeremyheileroops.
01:34danielcomptonjeremyheiler: ?
01:34jeremyheilerreduce, not map
01:34jeremyheilersomething liek that
01:34jeremyheilerdo you see where i'm going tho?
01:35danielcomptonjeremyheiler: Sort of...
01:36jeremyheileryou know the keys because you can inspect the map
01:36TEttinger,(let [nest {:a {:b :makes :c :takes} :b {:c :takes} :c {:a :makes}}] (reduce #(conj %1 [(key %2) (keys (val %2))]) {} nest))
01:37clojurebot{:a (:c :b), :b (:c), :c (:a)}
01:37TEttingeryep, one-liner
01:37jeremyheilerhttps://gist.github.com/jeremyheiler/899dd9419d5a4ba4671f
01:39jeremyheiler,(let [m {:a {:b 2 :c 3} :b {:d 4 :e 5} :c {:f 6}}]
01:39jeremyheiler (reduce (fn [m k] (update-in m [k] keys)) m (keys m)))
01:39clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
01:39jeremyheilerugh.
01:40jeremyheiler,(let [m {:a {:b 2 :c 3} :b {:d 4 :e 5} :c {:f 6}}] (reduce (fn [m k] (update-in m [k] keys)) m (keys m)))
01:40clojurebot{:c (:f), :b (:e :d), :a (:c :b)}
01:40danielcompton(defn super-keys [m]
01:40danielcompton (zipmap (keys m) (map #(vec (keys %)) (vals m))))
01:42danielcomptonjeremyheiler: thanks!
01:43jeremyheilernp
01:58amalloyi like (into {} (for [[k v] m] [k (keys v)])), because i always like for-comprehension solutions
03:20magopianis there a functional database (like datomic) that is opensource and nice to use?
03:20magopian(that I can use with clojure ;)
03:28whodidthisno ;_;
03:57hhenkelGood morning all!
03:58hhenkelIn the past I used cheshire to parse and generate json data. Now I'm working with a third party client who gives me json data.
03:58magopianwhodidthis: ah, too bad :'( i'm not comfortable using something that isn't opensource
03:58hhenkelI fail to cast it into some clojure datatype with this error: java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to java.lang.String
03:59hhenkelWhat is the way to go? Is it possible to use cheshire here or do I need to use org.json.simple ?
04:01ivanif you wanted to read some xattrs, would you prefer listxattr + llistxattr (does not follow symlinks) matching the POSIX APIs, or an opts map {:follow-symlinks true}, or a (into-array [LinkOption/NOFOLLOW_LINKS]) to match NIO?
04:03hhenkelOkay, nevermind I looked at the javadoc of simplejson and found "toJSONString"
04:13nobodyzzzmagopian, there are a lot of db you can use with clojure, but none of them seems to be "functional" :)
04:18vijaykiranmagopian: the free/starter version works fine - if *free* is the requirement
04:30magopiannobodyzzz: haha ;)
04:31magopianvijaykiran: nope, free is not the only requirement ;)
04:31magopianwell, it's not a requirement, just... not comfortable
04:36ivanare there any Java APIs for opening/writing/listing filenames that are not valid UTF-8? (while staying in the UTF-8 locale)
04:44wagjoivan: most flexible is to use filechannel with java.nio.charset
04:47ivanwagjo: does that help with invalid filenames, though?
04:47ivanskimming the APIs it looks like it's for file contents?
04:48wagjoivan: yeah, its just for fole contents, for file names, look in java.nio.file.Paths
04:59wagjoivan: see http://stackoverflow.com/questions/22775758/java-io-file-accessing-files-with-invalid-filename-encodings
05:00ivanwagjo: do any of those solve the problem, though?
05:00ivanI probably don't want to take the Java process out of the UTF-8 locale to read some weird files
05:06vyorkinhi everyone! i've just started to learn clojure & now i'm trying to solve some simple problems to practice & become comfortable with it, for example http://pastebin.com/Q53Ctf91 could you give me some code review?
05:07vyorkinto merge the resulting hashes i've used deep-merge-with from deprecated clojure.contrib.map-utils, i think that it could be done better=simplier
05:08wagjoivan: if you set file.encoding to some non-0unicode one-byte charset, it will read any filename. However you will get garbled filenames if they were utf8.
05:09ivanwagjo: yeah, I think I either have to do that, or live with the limitations, or rewrite this in Rust ;)
05:09ivanthanks
05:09wagjoivan: another thing is to not use old java.io when encoding is changes, as e.g. FileReader uses this property. Use java.nio where you can set any charset you like for file contents
05:10wagjoivan: thing is that you cannot get filename as a byte array, only as a string, so this is the only workaroud I'm aware of
05:13ivanwagjo: yeah the -Dfile.encoding=iso-8859-1 workaround is no fun because it screws up a lot of things
05:13ivane.g. "hello \uCCCC" -> "hello ?" in my REPL
05:39kerneisvyorkin: it could be much simpler
05:41kerneisalso, are you sure your identifiers are restricted to a single letter?
05:47vyorkinkerneis: good to see you!
05:48AeroNotixis there something like filter / remove but returns the collection of items that are truthy as per predicate function?
05:48vyorkinkerneis: can you point me in the right direction? maybe some reading
05:48hyPiRionAeroNotix: keep?
05:48AeroNotixhyPiRion: /me looks
05:48AeroNotixThat does it!
05:48AeroNotix:)
05:48hyPiRion,(keep {:a 1 :b 2} [:b :c :a])
05:48AeroNotixcheers
05:48clojurebot(2 1)
05:48hyPiRionsweet
05:49vyorkinkernies: i've just started to read The joy of clojure
05:51kerneisvyorkin: have you looked at update-in and tried to re-write transform to use it as I suggested yesterday?
05:51kerneisyou could really get rid of deep-merge-with and do all the work in reduce transform {}, provided you use update-in in transform
05:52vyorkinkerneis: yep, i understand how update-in, but i really couldn't come up with anything
05:52vyorkinkerneis: i've tried to think about smth like (reduce (update-in ..)) as you've suggested yesterday
05:52vyorkinkerneis: but had no luck with it(
05:53vyorkinkerneis: don't know what to do with things like { :a { :b [1] } } { :a { :b [2] } }
05:53vyorkinkerneis: to get { :a { :b [1 2] } }
05:54Glenjaminhave you tried starting with a direct port of the rails logic?
05:55nobodyzzzvyorkin, maybe try to take a look at ring.util.codec/form-decode
05:56vyorkinGlemjamin: i think thats not fair (: i wanted to do it by myself, this solution works but code looks really ugly imho
05:56vyorkini mean my solution is ugly & too verbose
05:59ivanwagjo: -Dfile.encoding= was for file contents, -Dsun.jnu.encoding=iso-8859-1 lets me read invalid UTF-8
06:01nobodyzzz,(merge-with (partial merge-with concat) { :a { :b [1] } } { :a { :b [2] }})
06:01clojurebot{:a {:b (1 2)}}
06:06vyorkinnobodyzz: looks great, trying to understand it
06:06kerneisvyorkin: the key insight is that you need to treat your chain differently when the last element is "[]"
06:06kerneisso, in (nesting-chain), remove the "reverse"
06:06kerneis(it is more confusing than anything else)
06:07kerneisalso remove that last (apply deep-merge-with)
06:08kerneisand now, rewrite transform from scratch
06:08kerneisso it will still be (defn- transform [acc [chain value]]
06:08kerneisbut now, you have two cases:
06:08kerneisfirst case: (= (last chain) "[]")
06:08kerneissecond case: everything else
06:09kerneisin the first case, the "real" chain is everything execpt this "[]" (ie. drop-last chain)
06:10kerneisand you need to use update-in with some concat magic, as nobodyzzz suggested above
06:10kerneisin the second case, you use update-in again, this time with the whole chain
06:10kerneisor maybe just assoc-in in fact
06:10kerneisuse an if to glue both cases together, done!
06:12vyorkinkerneis: thank you!
06:13vyorkinkerneis: now i need some time to think (:
06:18kerneisvyorkin: I'll be away but if you still cannot solve it with those hints, the solution I just outlined is here http://pastebin.com/2enmLUSb (but try to look at it only when you have one by yourself!)
06:19razivyorkin: I found Programming Clojure far more enjoyable than Joy of Clojure, if it helps. :)
06:20razihttp://www.braveclojure.com/ is awesome as well, and http://aphyr.com/
06:23kerneiswhat, 106 views in 5 minutes? My little snippet does not deserve so much attention :-$
06:41ivankerneis: I think there are a lot of bots spidering pastebin to steal credentials
06:41vyorkinkerneis: looks awesome
06:45vyorkinmaybe someone can also suggest some set of problems to practice? something close to real life cases
06:53nobodyzzzhttp://www.4clojure.com/ but problems there not really close to real life cases =)
06:53nbeloglazovvyorkin: how real life? I always wanted to have some kind of web service which runs kibit (https://github.com/jonase/kibit) checks on arbitrary github clojure repo and presents a summary. Is it real life enough?
07:11vyorkinnbeloglazov: thats interesting!
07:15vyorkinnbeloglazov: ok, maybe i'll try to buld such a tool, that'll be a really good practice (:
07:16nbeloglazovvyorkin: yeah, it would require working with GitHub API and probably clojure AST, so should be quite fun
07:19nobodyzzzhttps://github.com/Raynes/tentacles hehe, funny name
07:59gfrederickshow do you debug a situation where defn returns #'user/foo and you can call that var just fine but (resolve 'user/foo) returns nil?
08:00gfredericksanswer: it was a typo of course
08:00gfredericksi.e., defn returned #'user/ofo and (resolve 'user/foo) returned nil to nobody's surprise
08:52hhenkelHi I'm stuck currently. Can someone please explain to me why "(doseq [server server-config] (pprint server))" executes the pprint and why the same thing with for is doing nothing?
08:52CookedGr1phonhhenkel: because for is lazily evaluated to produce a list
08:53CookedGr1phonwhereas doseq doesn't produce a value, it simply goes through performing side effects
08:54hhenkelCookedGr1phon: okay, so if I execute something within a for the execution happens when I try to get data from it, right?
08:54CookedGr1phonright
08:55hhenkelSo as long as I don't do anything with the returned data I won't see any trace output for example?
08:55CookedGr1phonexactly
08:55hhenkelCookedGr1phon: Okay, then it makes somehow sense... ;)
08:55hhenkelCookedGr1phon: Thanks! I guess I was to long siting in front of the code....
09:47nbeloglazovhhenkel: be aware though, that 'for' is not completely lazy, it will "calculate" elements in batches by 32 elements. So when you try to access first element you'll see 32 (pprint server) in repl.
09:48gfredericksthat's not for doing that
09:48gfredericksfor is just as lazy as anything else
09:49gfredericksthat's how chunked seqs behave
09:50gfredericks,(second (for [x (take 10 (iterate inc 0))] (print x)))
09:50clojurebot01
09:50gfredericks,(second (for [x (range 10)] (print x)))
09:50clojurebot0123456789
09:50ucbI get a warning about clojure-test-mode being deprecated and having to switch to cider-0.7+
09:51ucbhow does cider replace clojure-test-mode?
09:51ucbor at least, where can I read about this replacement?
09:55ssiderisucb: the functionality has been integrated into cider
09:55ssiderisucb: same default key bindings
09:55ucbyeah, now reading https://github.com/clojure-emacs/clojure-mode/issues/214
09:55ucbthanks!
09:56ssutch_what does #{:blah} construct, the repl just prints it back out at me and it's a tough one to google
09:57boxed#{} is a set, {} is a map
09:57Glenjaminit's a set
09:57ssutch_aye, thank you
09:57boxed,(type #{:blah})
09:57clojurebotclojure.lang.PersistentHashSet
09:57boxed<3 clojurebot
09:59TimMcssutch_: You'll want to look through this: http://clojure.org/reader
09:59ssutch_ah i did not know the "type" function
10:00ssutch_thanks TimMc ill give it a refresher (coming back to clojure after ~2yr)
10:00Glenjaminso, when discussing simple made easy with someone just now he gave a very good counterexample
10:01Glenjaminhis claim was that esperanto is simple, but it's foreign so therefore not easy.
10:01Glenjaminso should we all learn esperanto?
10:02Glenjamini didn't really have a good answer, i guess practicality is the third axis?
10:07ssiderisGlenjamin: I think the whole argument about simplicity is that it's more desirable than ease
10:07ssiderissimple!=easy
10:07ssiderisbut it's worth the extra effort
10:07Glenjaminwhich would imply we should learn esperanto :)
10:08ssideristhat's my understanding
10:08ssideris:-)
10:10GlenjaminOk, ebligas fari tion
10:11gfredericksyou're outside the domain of engineering at that point though
10:11gfredericksso there's different dynamics and different scales of concern
10:16latkI'm trying to enable sourcemaps in cljs, but when I change the project.clj I get an error I cannot decipher. Can anyone help? http://bpaste.net/show/RmYBXEuf8N3AE3XKHvbe/
10:17bob2== typo in your project.clj
10:17latkbob2: Ah, how can I work out where ?
10:17bob2by looking at the change you just made
10:20latkbob2: Sorry, my connection just died.
10:20bob2look at your diff
10:22gfrederickslatk: my guess is you somewhere have a map when cljsbuild is expecting a collection of maps
10:24latkRight. I just copy/pasted from the wiki and edited.. we shall see
10:32latkSo I've changed some stuff, and now I don't get an error - but it seems that the compiler is hanging.
10:32latkAs in, it's been "Compiling ClojureScript." for 5 minutes
10:34tbaldridgewhat's your JVM heap size? And what are you using to compile?
10:35latktbaldridge: I'm using lein. How can I check my JVM heap size?
10:37tbaldridgeWhat lein command are you using?
10:38latklein cljsbuild auto test-test-om
10:38latktest-test-om is the name of the project
10:48tbaldridgelatk: sometimes cljsbuild auto doesn't start compiling until a file is changed
10:48tbaldridgetry adding a space to a file and saving it, that should kick off the compilation
11:12cbpit says Compiling "foo.js" when it's actually compiling
11:13cbpif it just says compiling clojurescript then it has already compiled and it's waiting for changes
11:17mikerodWhen using tools.analyzer.jvm is there any good way to make it *not* throw exceptions when symbols cannot be resolved?
11:17mikerodI'm trying to parse out the clj AST from a form, however, I know there are some symbols that will not make sense in the form.
11:17mikerodWell, they won't make sense at the time of analysis.
11:18mikerodHowever, I do want to qualify all vars that *do* exists during analysis.
11:18kerneismikerod: naive idea, if you know them in advance, can't you wrap your form in (let [x nil y nil] ...)?
11:19mikerodThe goal is to emit a form that has all symbols fully-qualified, when they can be - however, I want to leave all binding symbols alone, and allow for shadowing to occur. This is why tools.analyzer approach looks like it could almost fit my needs.
11:19arrdemkerneis: then they'll be locals rather than vars and it won't work.
11:19arrdemmikerod: what are you really trying to do? what you're asking for doesn't make sense.
11:20mikerodarrdem: Making a DSL. I want to parse out some of the forms in it with everythign qualified, so that if I eval the forms later on, they will make sense regardless of the ns they are in.
11:20mikerodregardless of *ns* that is
11:21mikerodI have some "special" scoped symbols available during this. I don't want those to throw exceptions. They will be present later.
11:22mikerodSo essentially I wanted to do the :qualified-vars option and emit the form. I just wanted to not fail on the symbols that didn't make sense in the form. I may be able to "pretend" they are in scope though by passing some dummy-env or something like kerneis said about introducing them as locals at the top-level... hmm
11:22arrdemthat doesn't make sense from a Clojure semantics point of view. Either a def exists and a var can be resolved/qualified or no def exists and you have a forward declaration which is illegal. The only way you're going to be able to do this is as you say with a dummy env that provides such forward defs because otherwise this is meaningless.
11:23mikerodarrdem: That's fair and that's sort of what I thought given the perspective of this being an analyzer
11:23mikerodTo go along with this goal, does tools.analyzer.jvm have any way of fully-qualifying imported Java classes? I'm not seeing this option.
11:24mikerodSo I have a form with something like, List in it - that is really imported from java.util.List.
11:24arrdemthat stuff will already be fully qualified if a fully qualified class can be statically resolved.
11:25arrdemthere's no such thing as an "aliased" class in the JVM or TANAL
11:25arrdemAFAIK
11:25arrdemthe class "renaming" that Clojure and Java provide is a compile time lie that goes away quickly.
11:25mikerodarrdem: Oh, so I guess that means as long as the env has the `import`s in it
11:25arrdemyep.
11:25mikerodarrdem: cool, I'll keep that in mind for this then.
11:25arrdemI mean... Bronsa is the expert on this not me, but this is what I recall.
11:25mikerodThanks for the feedback.
11:25arrdemnp.
11:45gfredericksclojure and java provide class renaming??
11:45lazybotgfredericks: Definitely not.
11:46gfredericksor do we just mean using the unqualified class names?
11:46gfredericksin neither case can I decide I want to spell java.util.List as "FooBar" amirite?
11:46arrdemthe ability to use unqualified class names due to implicit as.
11:46arrdemright.
11:47gfredericksokay phew
11:55Digenisare there any other #clojure channels in freenode?
11:55arrdemthere's #clojure-offtopic, #leiningen, #clojurescript, #typed-clojure, #clojure-social (dead), #clojure-gsoc and some more
11:56mikerodgfredericks: One time I hacked the symbol table for a Namespace to map an arbitrary symbol to a Java class
11:56mikerodgfredericks: I don't think that really counts for what you're saying, but it can be done with the Namespace API
11:57technomancyoh, there's a gsoc channel now?
11:57technomancydoes that mean #clojure-offtopic is actually offtopic?
11:57arrdemI made one a while back, hasn't been used for anything so #clojure-offtopic is still gsoc :P
11:57technomancyoh
11:58mikerodgfredericks: What I was referring to was calling Namespace#importClass(Sym, Class) with a symbol of your choice
11:58DigenisI see, thank you
11:58gfredericks,*ns*
11:58clojurebot#<Namespace sandbox>
11:59gfredericks,(.importClass *ns* 'HooHa java.util.HashMap)
11:59clojurebotjava.util.HashMap
11:59gfredericks,(HooHa.)
11:59clojurebot{}
11:59gfredericks(inc mikerod)
11:59lazybot⇒ 2
11:59mikerodexactly
11:59mikerodI don't know that is a good thing/reliable thing to do.
11:59arrdem(inc mikerod) ;; well that's my wat for the day
11:59lazybot⇒ 3
11:59gfredericks,(type HooHa)
11:59clojurebotjava.lang.Class
11:59mikerod:)
12:00technomancynice
12:00mikerodSome (probably bad) isolated clj runtime classloader stuff I was messing with one day led me to wanting to do that
12:00technomancythat'd be cool for the RidiculouslyLongAndVerboseClassNamesWithLongNames you see in java land
12:01mikerodbut then I never followed through with it
12:01technomancyI mean, assuming you had egalitarian-ns =\
12:01mikerodtechnomancy: that's a good use case
12:01mikerodI hate long names
12:01mikerodLongNamesMakeMeAngryThatIs
12:01technomancy80 columns is where it's at
12:01mikerodI can't even read them. Just a wall of texts filling my eyes.
12:02mikerodYes, I don't mind the 80 cols
12:05Shayanjmmorning all
12:05vermawhat would you guys recommend for async code testing? can clojure.test do this?
12:24nbeloglazovverma: what kind of async code?
12:25vermanbeloglazov, clojure.async channels
12:27nbeloglazovI think you can do it in clojure.test. Java supports multithreading, so you can create some kind of latch which will block current thread until async operations are done. May be there is some specific libraries for testing core.async, don't know.
12:31johnwalkeri've been getting clojure-test-mode is deprecated messages every time i visit a clj file
12:31johnwalkeri'm on the latest versions of cider/clojure-mode
12:32johnwalkeris this normal?
12:36munderwoodHi all. Is there an inbuilt json serializer/deserializer? or failing that which one do most people use?
12:36arrdemclojure.data.json is a contrib library...
12:37munderwoodso thats packaged with clojure?
12:37arrdemno, that means it's separately available but still "official"ish
12:37Glenjaminhrm, what does having something in contrib tell you?
12:37puredangerNo, see here: https://github.com/clojure/data.json
12:38Glenjaminapart from it's harder to send PRs to :D
12:38technomancyGlenjamin: that's about it
12:38Glenjamini jest
12:38puredangerGlenjamin: it tells you that is is managed with the same license and contribution model as Clojure itself
12:38Glenjaminsomewhat
12:38puredangerand parts of it could be included or depended on from within Clojure
12:38technomancymunderwood: most people use cheshire
12:38puredangerfor example, Clojure uses data.generators and test.generative for testing itself
12:38Glenjaminright, i see
12:39puredanger(and hopefully will start using test.check in the near future)
12:39Glenjamini guess there's some sort of implicit fuzzy quality bar as well?
12:40puredangernot necessarily - contrib libs are at many stages of development and maturity, just like any other libs
12:40puredangerthere are some ideas around bars for a 1.0 release but I'm not sure how much that's actually important
12:41munderwoodtechnomancy: thanks! thats kind of what I was looking for. Although the info about contrib was useful. The distiction between contrib and the std lib is confusing for me (a clojure n00b). Coming from python where you have a lot of stuff built in and then everything else. Having a third group seems confusing.
12:41puredangerand contributors might be anyone that signed the CA
12:42puredangermunderwood: at times there has been a contemplation of having an "in the box" version of Clojure that would bundle certain libs
12:42gfrederickscount me -1 for that idea
12:42Glenjaminme also, dependencies are great!
12:42munderwoodwhy gfredericks ?
12:42puredangerit's mostly historical why certain things (like clojure.test, clojure.xml, etc) are in the std lib instead of in external libs
12:43gfredericksmunderwood: makes the ecosystem more complicated, and doesn't seem obviously useful; what sort of person has serious need for contrib libs but nothing else?
12:43puredangergfredericks: that seems to be largely the consensus
12:44puredangerit solves the "easy" at the expense of the "simple" :)
12:44johnwalkerit might make sense to create bundles of things though
12:44puredangerin some ways old contrib was this, right?
12:44johnwalkerlike a web bundle that would include reviewed versions of compojure, friend etc
12:44munderwoodhow does (and I admit this is a simple example) having a built in json serializer make the ecosystem more complicated vs three different libs that all do json serilazing?
12:44puredangerjohnwalker: you could do that now by creating a lib that merely had dependencies but no source and would pull things in transitively
12:45johnwalkeragreed
12:45puredangermunderwood: json is a good example - data.json is more official looking but cheshire is more used
12:45puredanger(I think mostly b/c it has an option to make maps with keywords?)
12:45munderwoodAhh I think we are talking about something different. Im talking about a stdlib rather than multiple bundles
12:45gfrederickspuredanger: it is rumored to be faster
12:45gfredericksI've never seen data on that
12:46technomancyjackson has been around since forever
12:46hiredmanpuredanger: https://github.com/dakrone/cheshire#speed
12:46hiredmaner
12:46hiredmangfredericks: https://github.com/dakrone/cheshire#speed
12:46munderwoodIm arguing that there is justification to have basic things built into the clojure std lib.
12:46hiredmanpuredanger: dakrone is super resposive for all the libraries he maintains
12:46gfrederickshiredman: thanks
12:47munderwoodI agree that having a bunch of seperate bundles would be more confusing.
12:47puredangerhiredman: agreed and I use cheshire more than data.json myself
12:47gfredericksmunderwood: that forces those things to have the same slow update cycle as clojure
12:47technomancymunderwood: it might make sense, but the core team has an attitude towards copyright assignment that makes that very impractical
12:47hiredmanmunderwood: clojure using maven repos has a much better dependency management story than python
12:48tbaldrid_munderwood: yeah, some may think that, but the nice thing with small libs is the response time
12:48hiredmangiven a better dependency management system, it makes more sense to break things up
12:48tbaldrid_better to have 100 mutexes instead of a GIL ;-)
12:49munderwoodI can see the logic. From a new user perspective its just hard to know which libs to use over others. Thats the downside. which makes adoption hard.
12:50puredangerI think most separable pieces in the std lib (test, xml, etc) would be better served outside the std lib
12:50technomancymunderwood: it's not that hard, you just ask on IRC and use that. =)
12:50tbaldrid_munderwood: because it requires a bit of research? And you still get that problem in other languages as well. I may not always want python's builtin json reader. So I should still do my research
12:50munderwoodtechnomancy: ha, I guess thats what I did :)
12:51Glenjaminbasically: the discovery problem is a better problem to have than slow moving core libs
12:51tbaldrid_(dotimes [x 100] (inc Glenjamin))
12:51hiredmanwell, it doesn't matter
12:52hiredmanwhich json library you use, unless it does
12:52Glenjaminheh
12:52philandstuffdid anyone mention clojure toolbox yet?
12:52hiredmanif it does matter, you'll have some hard requirements that drive you to a particular solution
12:52hiredmanif you don't have those requirements, it doesn't matter
12:52munderwoodtbaldrid_: Look I get doing reseach. And thats essentially what I did. reseach is a lot easier when your experienced at clojure, you know who/what to look for in the ecosystem. I think your underestimating the knowledge gap.
12:53philandstuffhttp://www.clojure-toolbox.com/
12:53philandstuff^ makes doing research much easier
12:53munderwoodI know about clojure toolbox. I found its list, there are three json libs. which one do I choose?
12:53technomancymunderwood: I would use http://www.clojuresphere.com/ instead
12:53technomancyit has some issues, but you can see which are the most widely-used
12:54philandstufftechnomancy: ooh ta, that looks useful too
12:54hiredmanthe best must be what is most widely used
12:54technomancyhiredman: well, assuming you can't ask on IRC for whatever reason
12:54hiredmanright? I mean, this is a meritocracy is it not?
12:54technomancysomeone really needs to add decay to that though. just ignore the swank-clojure entry =\
12:54tbaldridgemunderwood: that's the problem with any tech/library. You should almost always do one of two things: a) just grab one and run with it until it gives your problems. 2) read the README.md of every option weighing the pros/cons of each. If a given library does list it's design decisions move to another lib
12:54technomancyand the midje one
12:55tbaldridge*doesn't list
12:55tbaldridgeevery tech has a tradeoff, find that tradeoff and think about if you're comfortable with it, or if you really don't care, then just grab something
12:56hiredmanthe reality is, there are three json libraries, and you basically may as well pick one at random, you will in 85% of cases be just fine
12:56tbaldridgeIf cheshire is faster than data.json does it matter if you're parsing 400bytes of data?
12:56munderwoodIm really only bringing this up as I think this is probably something that the clojure community needs to have a think about. Getting up to speed on clojure can have some gaps IMHO. All these suggestions are welcome and I really love clojure.
12:56AeroNotixmunderwood: there are 10 JSON ruby libraries, I don't know ruby. Which do I use?
12:57technomancythere are like seventeen brands of cereal
12:57AeroNotixClojure doesn't *specifically* have this problem. Open sores isn't a bastion of pristine codebases or anything like that, it's a toilet filled with people throwing shit at the wall until a library falls out
12:57hiredmanI don't think the clojure community needs more people wringing their hands about the experience for people new to the language
12:57puredangermunderwood: if you want to drop me a line about gaps, I'm happy to hear stuff like that alex.miller@cognitect.com and hopefully improve things
12:57tbaldridge"Open sores" I am sooooo using that in the future
12:58AeroNotixasking the community to curate a list of packages so you don't have to do research is, frankly, quite a bit selfish and needy
12:58AeroNotixtbaldridge: /me bows
12:58technomancythis is why pagerank exists, innit?
12:58AeroNotixtechnomancy: (inc technomancy)
12:58AeroNotixdammit
12:58AeroNotix,(inc technomancy)
12:58TimMctechnomancy: Pagerank needs a decay boost when it comes to software.
12:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: technomancy in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:58AeroNotixWHATEVER
12:58TimMc(inc inc)
12:58lazybot⇒ 9
12:58technomancyTimMc: yeah, but it's a starting point at least
12:59TimMc(inc ()
12:59lazybot⇒ 1
12:59munderwoodpuredanger: sure no problems. I didnt want this to come across like this. I was just hoping to highlight some of the issues I have come up against. I'll have a think about some ways I can help out with this.
12:59TimMc$karma (
12:59lazybot( has karma 1.
12:59hiredmangiven that the people who wring their hands about the experience for new people are either new people that don't know clojure (well of course learning new things isn't as easy as just using stuff you already know) or people pushing their own pet theory of what a language should be in a backwards way
13:00AeroNotixhiredman: I wholeheartedly agree with that
13:00AeroNotixit's why we now have millions of idiots writing JavaScript and Node applications and shoving them in our faces
13:00TimMchiredman: ...and people who hang out in the IRC channel and see noobs beating their heads against the same problems over and over again.
13:01puredangerhiredman: I disagree. I'm interested in it and just want more people to be more successful with Clojure.
13:01TimMc(Some of which are basically inevitable, others of which should get fixed!)
13:01hiredmanTimMc: sure, that is why math teachers keep trying to change how math works, right?
13:01TimMcI don't know much about the history of math education.
13:01puredangerTimMc: not enough monads I hear
13:01tbaldridgeand I think there is much room for improvement in Clojure on the newbie front. Making design choices for users is not one of those
13:01TimMcI do know that it currently sucks.
13:02hiredmanI am not saying nothing needs changing, I am saying doing it for the newbs is poor justification, since we all are here and newbs are only passing through
13:02hiredman(either they stop being newbs at some point or they leave)
13:02technomancythat's a bit self-fulfilling
13:02technomancymaybe the newbs are only passing through because things suck so much
13:03hiredmantechnomancy: passing through meaning they cease to be newbs, not that they leave
13:03TimMcMaybe we only end up with people who really like editing their init.el file and similar experiences.
13:03allensbI'm a newb with Clojure. Shouldn't the Devs that have spent months more than me researching all this stuff give the newbs advice? If I need a library I don't necessarily want to spend 3 days of research to pick the right one. Don't always have time.
13:03TimMcallensb: I hear that, but there are more newbs than experts, and burnout sucks.
13:04allensbYeah, I can see that.
13:04TimMcIt doesn't help that some are Help Vampires. http://www.skidmore.edu/~pdwyer/e/eoc/help_vampire.htm
13:04technomancyTimMc: that seems a lot less common in here than some communities
13:04tbaldridgeallensb: pay me some money and I'll be more than glad to make all your research for you ;-)
13:05TimMcYeah, definitely not as bad here as in Java land.
13:05hiredmantbaldridge: haha, I was just debating hitting enter on that
13:06hiredmannewbiness is a state you pass through, it is not some fundamental defining use case to optimize for
13:06allensbtbaldridge: haha. As a newb I've found the best way to learn Clojure is to watch the million videos on it out there. We didn't have anything like that when I started my career 10 years ago.
13:06tbaldridgehiredman: I'll look like the jerk today, you can have a turn tomorrow
13:07hiredmanI was a newbie once, I like to think I have not been a newb for much longer than I was now
13:07technomancyjust gonna leave this here https://twitter.com/seriouspony/status/476453906554159104
13:07allensbSo basic rule, at least do some dang research first before asking a question.
13:08philandstuffhiredman: clojure is competing for people willing to learn it. if the dropout rate of newbs is too high, the community will not grow.
13:08puredangerthe community is clearly growing
13:08puredangerthere are (and likely always will be) more things we can do
13:08hiredmanit is just like a company who optimizes for getting new customers without taking care of existing customers
13:08technomancyphilandstuff: or worse, we'll self-select for people who like pain
13:08technomancylike erlang has
13:09allensbIt's growing. I'm a C# Dev and have been obsessed with Clojure the last 2 months.
13:09philandstuffpuredanger: agreed
13:09munderwoodIm fine with trying to learn an ecosystem. And actually I was trying to phrase my questions in a non-confrontational way (which I find is hard on IRC). My original questions were trying to understand the logic behind how things are packaged.
13:09technomancymunderwood: I don't think they were unreasonable questions. the contrib model is weird and political.
13:10hiredmanphilandstuff: if clojure needed a lot of work for newbies, I submit to you, that #clojure would not be constantly full of newbies learning clojure (who all put in their two cents about what it should be)
13:10puredangertechnomancy: that's a matter of opinion. although maybe that makes it political somehow. :)
13:10mdrogalisYeah, I always found contrib really odd. It elevates libs that sometimes don't merit that level of attention.
13:11ToxicFrogIf we're talking about "ways to make clojure more newbie-friendly",things like getting the compiler to not crash on syntax errors is higher priority than library organization, IMO.
13:11hiredmanobviously clojure already has appeal and manages to pull in lots of new "customers"
13:11munderwoodputting things inside a std lib to be available is a tradeoff. Putting things outside a stdlib is also a tradeoff. Obviously at the moment clojure has chosen one over the other. I mean that in the most neutral way possible
13:12puredangermdrogalis: i think perhaps the misunderstanding is that contrib == elevation whereas it really means "same license/contrib model"
13:12tbaldridgeWell I guess there's nothing stopping anyone from creating a project called [kitchen-sink "0.1.0"] that simply pulls in every single contrib library that would be about on par with Python.
13:12gfredericksI've heard contrib advertised as "guaranteed support"
13:12hiredmanpuredanger: which is amusing since the contrib model is what every hates about contrib :)
13:12technomancypuredanger: it doesn't though; it means "some subset of projects with the same license/contrib model"
13:12mdrogalispuredanger: Correct. Obvious to people who have been around for a while, completely blurry to someone new.
13:13hiredmanpuredanger: and by everyone I mean the vocal complainers in #clojure about jira and prs and etc
13:13puredangergfredericks: who/where?
13:13gfrederickspuredanger: abedra, talking to me
13:13philandstuffhiredman: I'm just saying that throwing newbs under a bus is a strategy that would have consequences. I don't think we are throwing them under a bus, I just don't want us to start.
13:14mikerodToxicFrog: I do not think that "clj doesn't design to please newbs" argument is a valid reason to have bad exception handling and messages. Good design should attempt to give good feedback for illegal conditions. e.g. I don't think class cast or null pointer exceptions are necessarily the way to go most of the time.
13:14mdrogalismikerod: So, to be fair, when Rich was building Clojure and had no attention on him, I'm sure he had many dark nights where errors messages weren't a priority.
13:15ToxicFrogmikerod: I entirely agree, and I don't think that this is just a "for the newbies" issue. But if we are talking about ways to make things more newbie-friendly, it's still a big issue.
13:15mikerodCompiler exceptions aside, the rest of the arguments about clj don't usually hold up in my opinion. There has to be a strong willingness to learn when trying to approach a new language that you intend to use professionally. I think your goal with a new language should be to become an expert.
13:15munderwoodThanks for all your help. When I have some more constructive things to add, i'll get in touch.
13:15munderwoodtime for lunch in Miami :)
13:15mdrogalismunderwood: Niiice.
13:16gfrederickswait crap am I supposed to be in Miami right now?
13:16mikerodmdrogalis: yes, I'm sure that the exceptions were put on the "back-burner" when trying to get the language up and running.
13:16mikerodWhich makes sense.
13:16gfredericksclojure-with-bad-error-reporting has the competitive advantage over clojure-with-good-error-reporting that it exists
13:17mikerodI cringe a bit nowadays when I read about some new language that starts of advertising how it "uses a similar syntax from the C-family that you're familiar with" - as if this is a good thing.
13:17technomancygfredericks: I think the ontological argument only works with deities last I checked.
13:17mikerodOr "you assign to a variable, just like you typically would in Java!" - yuck.
13:20arrdemis there an architecture note/history somewhere on why KeywordLookupSite exists?
13:20gfredericks(inc technomancy)
13:20lazybot⇒ 119
13:20gfredericksarrdem: that's defrecord related amirite?
13:21arrdemgfredericks: if I knew I wouldn't be asking
13:21gfredericksI have the hazy notion in my head that keyword lookup on defrecords is special-cased more than vanilla maps
13:21arrdemyeah it is. hum...
13:22gfredericksit's counterintuitive to me that you can somehow do better than a case statement inside the record's #get method
13:22tbaldridgearrdem: it's basically callsite caching
13:23Glenjaminthere's two types of people learning clojure, people who wanted to, and people who were told by the people who wanted to how good it was
13:23Glenjamini reckon the second group (which i just made up), could be better served
13:24technomancysome day we'll have people learning clojure because their bosses made them
13:24arrdemglod willing
13:25Glenjamini reckon clojure is pretty smooth after an initial bump
13:25hiredmanisn't KeywordCallSite dead code these days?
13:25Glenjaminlearning-curve-wise
13:25mikerodtechnomancy: I can't wait for such an exciting day
13:26hiredmanah, nope, just missed it
13:26Glenjaminmy boss suggested to me that we try should maybe try some clojurescript
13:26arrdemtbaldridge: hum... is this doing anything more than dynamically creating a .get specialization? it doesn't seem to be and that's only saving one cast and check.
13:26gfrederickstechnomancy: that already happens, just not sooper common
13:26bob2we have some people like that already at work
13:26Glenjaminbut i have no idea if you can cleanly mix clojurescript into an existing JS project without a horrible toolchain
13:26bob2since we vetoed scala
13:26gfredericksI learned clojure in 2010 or something because my boss told me to
13:27technomancymikerod: I dunno, it's kinda scary
13:28mikerodoh interesting
13:29Glenjaminwhere (geographically) are you based gfredericks ?
13:29mikerodWell, I guess I came into a job position where the project I am working on is in clj. So I was told to learn it I guess too... I just never thought of it that way. woops
13:29gfredericksGlenjamin: Chicago
13:29mikerodI just watched a bunch (all) of the Rich Hickey videos out there first.
13:30mikerodAt that point, I was onboard with being willing to learn things.
13:30gfredericksmikerod: yeah I guess some people look at "learn this thing" as an opportunity/excuse rather than a requirement
13:30bridgethillyerI’m confused about something. I don’t understand why anyone would not want to improve the beginner experience for Clojure.
13:30bridgethillyerIs it that there are scarce resources to apply, so if we choose to do that, we choose to not do something more important?
13:31mdrogalisbridgethillyer: It's mostly disagreement about how to accomplish that, I guess.
13:31mikerodgfredericks: Yes. I was excited to get to try something new.
13:32bridgethillyermdrogalis: ah, ok. That definitely makes sense. I’ve spent a lot of time thinking about it, and I still feel kinda clueless.
13:32mikerodbridgethillyer: I think documentation and better exceptions are very valid concerns. I think a lot of other arguments are just around the fact that the language embraces some concepts that are unfamiliar to the mainstream. Those concepts are by design and need to be understood, not worked around.
13:33puredangertechnomancy: (et al) sorry I dropped out of the conv above; was on a call
13:33mdrogalisbridgethillyer: There's also the "Well, I had to learn it this way, so you have to, too." mentality. But I don't see a lot of that around these parts.
13:33hiredmanbridgethillyer: well yes, time devoted to something is not devoted to something else, but also I object to it being the main motivating factor, newbiness is a temporary state that people pass through, so orienting the language around it means sure the langauge will grow a lot, but what good is it to the people who aren't newbies anymore
13:34Glenjamini think the focus needs to be on streamlining that journey
13:35Glenjaminbut even for non-newbies, the errors you get from a malformed (ns) are appalling
13:35hiredmanbasically, I think, my objection is "newbie" is not specific enough to be a real useful use case
13:35bridgethillyerhiredman: I think there is value to more senior people to have newbs around
13:35hiredmanbridgethillyer: sure
13:35mikerodWith Clojure, I've tended to always "try to get to the bottom" of whatever issue I'm having that I don't understand. This has often came down to reading the source code, digging through the Compiler etc. I think all of this investigation and reading has made me a lot more proficient at the language nowadays.
13:36mikerodSo maybe this is clj's secret way of teaching newbies. The lesson is in the digging.
13:36Glenjaminmikerod: i think that's a great way to learn, but that most people dont/wont want to do that
13:36hiredmanbridgethillyer: but to drive change in the language by worrying about the use experience of a poorly defined newbie group, that is a temporary phase people pass through
13:36allensbI would call the bump: Rich Hickey's Youtube Talks.
13:37hiredmanbridgethillyer: part of the value for senior people is it is rewarding watching newbs stop being newbs
13:37mdrogalislol
13:37mikerodGlenjamin: Yes, I think if all you do is a read a bunch of documentation and come away with the idea that "I'm not going to worry about how this works - its magic to me", you probably aren't going to get the most out of your tool.
13:37bridgethillyerhiredman: I think you’re exactly right that we need to define who we’re addressing.
13:37mikerodby tool I mean language*
13:38mikerodRich Hickeys' talks are great. And there are many others beyond that.
13:38technomancymikerod: except it is literally impossible to get anything done without doing that on some level
13:38Glenjamini think selling the philosophy isn't too hard, but i think there's a large set of people who aren't as conscious that they experience the problems that rich talks about
13:38mikerodtechnomancy: true, for some things. I'm not sure I feel that way at the level of the language you use though. Not the fundamental parts of the language at least.
13:38technomancyit's literally no longer humanly impossible to be a "full stack" expert
13:38technomancyeven if you cut it off at the hardware level
13:39allensbmikerod: Those talks are just the base. If someone started to look at Clojure that is the first thing I would tell them to do.
13:39hiredmanbridgethillyer: I don't think the language / community should be hostile to newbies, but we should get them to stop being newbies as soon as possible in a language that rewards expertise
13:39mikerodtechnomancy: yeah, there certainly has to be some lines of abstraction you draw as magic
13:39mikerodsome places
13:39bridgethillyerI’m totally comfortable with some people being turned off by Clojure (or whatever aspects of the ecosystem). I’m not a big fan of anything “for everybody”
13:39mikerodallensb: I agree
13:39Glenjaminif i never had to go read the clojure.lang java classes, that'd be nice
13:40technomancymikerod: maybe "I wish I could spend the time to understand this, but I am a human with a limited lifespan" is a good compromise. =)
13:40bridgethillyerMy concern is with people who would get a lot out of the language/ecosystem who are turned away for reasons that can be fixed
13:40mikerodtechnomancy: haha, maybe the real problem to solve then is the "limited lifespan" part
13:41Glenjaminlife is too short to really grok the details of the JVM's GC?
13:41technomancymikerod: on the other hand, there's something to be said for "isn't it great that there are these abstractions we can just rely on to work reliably without having to tear them apart and rebuild them in our heads from the ground up?"
13:42bridgethillyerhiredman: good point. Removing impediments to that would make sense then.
13:42mikerodtechnomancy: Yeah, I know what you're saying. I guess its just important to weigh the tradeoff when deciding whether or not the abstraction is worth understanding. I feel that I can use clj without having in depth understanding of how persistent data structures are implemented though.
13:42mikerodHowever, I think the compiler "lifecycle" should be understood pretty well.
13:42technomancymikerod: IMO the value of understanding how the abstraction works is proportional to the likelihood of it breaking down =)
13:43technomancyjust like with machines, the more likely it is to break, the more valuable the repair skill is.
13:43mikerodtechnomancy: sounds reasonable
13:43gfredericksI don't lose sleep at night worrying about the filesystem not working
13:43technomancywell, break or benefit from improvement in some way
13:44technomancylike... you pretty much have to understand way more about how browsers work, because the abstractions they use are crap
13:44{blake}Why are records NOT functions that accept their field names as parameters? i.e., why can you say "my-map :some-field" but not "my-record :some-field"?
13:44hiredmanbridgethillyer: hows clojurebridge going? (I heard the cognicast episode a while back)
13:44gfredericks{blake}: I don't know why, but I don't think it's bad
13:44bridgethillyerhiredman: There have been a number of workshops
13:45mdrogalistechnomancy: We should start ClojureBridge Seattle.
13:45gfredericks{blake}: I think clojure maps are roughly used in two different ways, and that records address one of those, while IFn addresses the other
13:45bridgethillyerhiredman: We have some issues with the curriculum. Mainly, it’s a two-day curriculum, but it’s only a one-day workshop.
13:45technomancymdrogalis: but then we'd have to find new meeting space for seajure =\
13:45bridgethillyerhiredman: so we’re working on that. More workshops coming together for the fall
13:45bridgethillyerhiredman: thanks for asking :)
13:45mikerod{blake}: wow, I didn't know that records weren't functions
13:45hiredmansure, I can imagine it is a lot to take in for one day
13:46mdrogalistechnomancy: We are the plebes of PNW :(
13:46hiredmanbridgethillyer: is the curriculum based on anything in particular?
13:46gfredericks,(defrecord Blake [a b] clojure.lang.IFn (invoke [this k] (get this k)))
13:46clojurebotsandbox.Blake
13:46gfredericks,((Blake. 1 2) :b)
13:46clojurebot2
13:46mikerodgfredericks: I'd have just expected that behavior hah, wonder why it was left off
13:46gfredericksmikerod: I speculated above
13:46mikerodoh
13:46bridgethillyerhiredman: the teaching/training experience of people who have taught Clojure before
13:47{blake}mikerod, Maybe flexibility? You wouldn't always want it?
13:47{blake}gfredericks, Thanks, I didn't know you could dothat.
13:47mikerodgfredericks: I see what you're saying. However, I thought when records were designed they were meant to be able to be a "drop in replacement" for the places you were using maps before.
13:47mikerodWhen you decided later a record was more appropriate that is.
13:47arrdembeing able to define a custom set of invoke implementations without defrecord checking for conflict/replacement
13:47gfredericksyeah there's a few other ways they're not
13:47jasoncofI just added ring.middleware.defaults to my app and now I'm getting this strange 'java.lang.IllegalAccessError: in-seconds does not exist, compiling:(ring/middleware/cookies.clj:1:1)' error. Any ideas?
13:48bridgethillyerhiredman: rather, the people who are teaching the workshops who have developed the curriculum
13:48mikerodI've never ran across this, meaning I've never tried to use a record as a fn. I've used a good amount of records before too. So this must not be a common usage for me anyways. :P
13:48gfredericksmikerod: yeah I think IFn makes more sense for homogeneous maps
13:50Glenjaminpresumably you can extend IFn to your own maps?
13:50hiredmanmake sense, I am not even sure where I would start, I've only really once written something expository at length about part of clojure and it is difficult to figure out where to draw lines and delineate concepts
13:50Glenjaminerm, own records
13:50gfredericksGlenjamin: I just did that above
13:50Glenjaminso you did
13:50Glenjaminmissed that one :)
13:56MC-EscherichiaI have a stupid question about records...how do I make something like a record in Java to trick my coworkers
13:56gfredericksO_O
13:56gfredericksMC-Escherichia: I think that is not quite specific enough
13:57MC-EscherichiaI want to say new Record("Name","field1","field2") and then be able to say new Name(1,"test")
13:59MC-Escherichiaand then be able to access the fields as fields, or keywords
13:59MC-Escherichiaand trhat'
13:59MC-Escherichias all the functionality I need
13:59hiredmanMC-Escherichia: I would look at https://github.com/boundary/fasttuple
14:00Bronsamikerod: I'm reading the backlog, do you still need help with t.a.j?
14:01MC-Escherichiahiredman: even better than what I was thinking
14:01MC-Escherichiathanks
14:05noprompt_is `prim-seq` intended to be public in clojurescript?
14:07hiredmandnolen_: why announce that something will be announced? wouldn't it make more sense to save the announcing until there is something to announce?
14:10cbpbut the hype train
14:11FrozenlockTsk tsk tsk. The real way to do it it to announce something will be announced, and THEN announce that something will really be announced. Announception
14:13gfredericksthe rhickey keynote description is interesting
14:13hiredmanto be fair, at least it isn't hyping a talk by rich where the subject is TBD, or "something big we've been working on at cognitect" there is actually an abstract with some detail, but does it need a pre-announcement?
14:14gfredericksmainly because it sounds exactly like how edn is advertised
14:15puredangerthe talk will be the announcement
14:15PigDudei find myslef making APIs where there is a multimethod that dispatches on *identity* of first argument
14:16PigDudei end up writing this function a lot: (defn identity-mm [o & _] o)
14:16PigDudeis this common?
14:16amalloyPigDude: that seems a little weird, but not outrageous
14:16PigDudeit's all over my code. the pattern is some-method :sym -> ProtocolImpl
14:16gfredericks(def identity-mm (comp first list))
14:16PigDudeand then the rest of the API is from the protocol or built on it
14:16puredangerPigDude: why not use "case" instead?
14:17PigDudepuredanger: multimethods are extensible? i don't understand what you are asking
14:17puredangerPigDude: that's a good answer (also would have accepted: custom hierarchies) :)
14:17amalloyPigDude: i don't understand your "pattern" some-method :sym -> ProtocolImpl
14:17amalloyit just looks like three symbols and a keyword, not related in any obvious way
14:18hiredmanPigDude: people will understand it better if you say it is an lisp interpreter dispatching on the first of a list
14:18PigDudeamalloy: (my-lib/make-thing :fluffy) => FluffyThing, (-> (my-lib/make-thing :fluffy) my-lib/proto-meth ...)
14:18PigDudeso user doesn't have to do (FluffyTHing.) directly
14:19hiredmanPigDude: defrecord creates factory functions
14:19amalloyyeah, just use a function
14:19mikerodBronsa: I think my questions were mostly cleared up. The first thing I requested was for a way to have t.a.j. "ignore" symbols that weren't in scope. - This seems to be a messy use-case and I probably just need to create/generate the appropriate environment first.
14:19PigDudehiredman: maybe is ruby experience but (f :thing) is easier to read than (->Thing) and end user doesn't have to know the name of Thing
14:20hiredmanPigDude: :thing is a name
14:20amalloythere's no reason to have one multimethod with N bodies instead of N functions
14:20mikerodBronsa: My second question was around if imported Java class symbols would be fully-qualified when emitted.
14:20hiredmanso you either need to know the name of a function or some random keyword
14:20mikerodBronsa: I think I was seeing that they weren't. However, I didn't have the :import decls in the env at that time. So I'm thinking I just need to ensure I have the appropriate env passed to analyze.
14:20PigDudealso w/ (f :thing) i can change implementation of f later and user never knows
14:20PigDudecan't do that w/ ->Thing
14:20mikerodThen I'm hoping that the Java class sym's will be analyzed in their fully-qualified representation.
14:20hiredmanPigDude: you can
14:21hiredman(defn ->Thing [& _] (launch-the-bombs))
14:21amalloyPigDude: or just (defn make-thing [] (Thing.)). the name of the function doesn't have to be ->Thing
14:21PigDudeok, i see what you're saying
14:21amalloybut it should be a function, not this weird multimethod with special keywords. at least your IDE can help you track down function implementations
14:21PigDudebut my library has a config api, and i like users to be able to say :serializer :json, not :serializer MyLibJsonSerializer
14:22PigDudeso :json is mapping to the multimethod
14:22PigDudewhat's the cleaner way to accom;ish this?
14:22PigDudesounds like there is one
14:22hiredmanany way, a common case for dispatching on identity is some kind of interpreter, which is what your factory thing is
14:22hiredmanPigDude: what users?
14:22PigDudehiredman: right now internal but there's a good chance this will be open sourced
14:22Bronsamikerod: re: 1, if you're interested in how to construct a "fake" environment, core.async does it you might want to look it up
14:22PigDudehiredman: generic log store
14:23puredangerwhy not mechanically convert the keyword to a constructor name and invoke it?
14:23PigDudei could, here's why i originally used mms
14:23mikerodBronsa: oh, awesome. I will definitely look at that.
14:23PigDudeclojure seems to encourage (defmethod foo :json ...) for this sort of extension, not adding :json => JsonSerialzier to some global map?
14:23puredangerPigDude: I mean in a way that does not require you to add a new case every time
14:23PigDudei don't know, what other means do i have?
14:24PigDudei want end users to be able to provide their own serialziers, etc
14:24hiredmanPigDude: I would either stick to namespaces, or move to something like component
14:24amalloyPigDude: you can also eval your config file, instead of just reading it. that makes things a lot more extensible for the user: they have the whole language available. and then they can just use a function there
14:24PigDudeso a case :a 1 :b 2 ... doesnt' cut it
14:24Bronsamikerod: re: you're right, emit-form doesn't actually qualify classes, I must have missed that
14:24hiredmanhttps://github.com/stuartsierra/component
14:24PigDudeit sounds like there's no firm way to do this
14:24PigDudeso mine is as good as any other
14:24PigDudeor am i wrong?
14:25Bronsamikerod: I'll change that in the next release, in the meantime if you need it you can just monkey-patch the emit-form multimethod
14:25PigDudecomponent looks like a framework framework
14:25PigDudeno thanks
14:25mikerodBronsa: ah, that's helpful. I was about to check it out in a bit. Yes, I was thinking if it didn't, I was going to try to alter one of the multimethods that were responsible
14:25hiredmanPigDude: well, what you are building is a DI system
14:25PigDudethat's fair
14:25hiredmanPigDude: but your multimethod lacks a way to specify dependencies
14:26PigDudeevery software that injects dependencies is a DI system?
14:26hiredmanPigDude: or let your users pass in an environment map
14:26PigDudei don't think i need turtles all the way down ..
14:27hiredman{:json-encode ... :json-decode ...}
14:27PigDudei just need a clean basic implementation, and right now the one alternative i have is an obscure library
14:27dogonthehorizonHey folks, I'm trying to be clever and format a sequence of strings into another string using the format form but I keep getting errors from the formatter. Here's the relevant snippet: https://gist.github.com/dogonthehorizon/c205387c4c5ade8147be . Is it because sequences are lazy and it's not being realized at the point that format is being called?
14:27hiredmanthe multimethod approach is gross because each multimethod lives in a single globally def'ed var
14:27hiredmanso you can only have one definition in a clojure runtime
14:27PigDudewhat does that mean to the library user?
14:27PigDudeone definition of what?
14:28amalloydogonthehorizon: you only gave it one thing to format, a sequence
14:28dogonthehorizonamalloy: So (seq args) will not expand the sequence?
14:28amalloyyou want (apply format ... args), to give it six things to format
14:28hiredmanPigDude: if I am building system A out of systems B and C, both of which use your library and provide their own (defmethod … :json …) I may be screwed
14:28PigDudei see what you're saying hiredman but i think you're focusing on corner cases
14:29dogonthehorizonamalloy: Oh, that makes a surprising amount of sense. Thanks!
14:29amalloydogonthehorizon: no function in clojure can return an "expand" view of its stuff, because a function can only return one thing
14:29PigDudehiredman: is there a standard clojure way to overcome this? or just using complex stuff like this component library?
14:29amalloyfor example, seq just returns a sequential view of its argument, or nil if it's empty
14:29PigDudehiredman: (this global mm definition limitation)
14:30gfredericksprotocols have the same problem
14:30PigDudeoh ok
14:30PigDudeso, a problem, but not really a problem
14:30PigDudea perceived problem
14:30hiredmanPigDude: the component library is a possible approach, and it is really not very complex, it is less than 200 lines of code
14:30amalloygfredericks: what? protocols don't have any such problem, because there's no dispatch values that can be overlapping
14:30hiredmanPigDude: is a real problem
14:30amalloythey share one var, but you can pass in arbitrary instances
14:30PigDudehiredman: maybe good to measure library complexity in terms of number of lines in README :)
14:30gfredericksamalloy: the different libraries extending a third library the same way problem
14:31PigDudegfredericks: i think node has a clean solution for this?
14:31puredangeramalloy: isn't that false due to Java hierarchies?
14:31hiredmanPigDude: another possible approach is making the environment an explicit parameter, so the user can choose what to pass in
14:31Bronsamikerod: https://github.com/clojure/tools.analyzer.jvm/commit/df55bf039f0eb9aa6c161c363bee3e53629477e6#diff-c5f5c869e9024d37ac35f3f9344df50fR43
14:31MrJones98anyone here have som experience with clara-rules?
14:31amalloypuredanger: huh?
14:31PigDudehiredman: yea, you mentioned that ... what is the environment? this was vague to me
14:31amalloy~anyone
14:31clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
14:32gfredericksPigDude: I'd be interested in what that is
14:32hiredmanPigDude: an environment in the cs sense, a map of names to things
14:32puredangeramalloy: I have a protocol extension for HashMap and one for Map - they overlap?
14:32amalloypuredanger: sure, and HashMap wins
14:32puredangeramalloy: there are cases where there is no winner though and then it's arbitrary
14:32PigDudehiredman: that would be the super-cusotmizable approach :)
14:32hiredmanPigDude: {:json SomeJsonCodecObject :transport SomeHttpThing}
14:32dogonthehorizonamalloy: Yeah, this also makes sense. Still getting used to "thinking in Clojure", so thanks for the explanation!
14:32amalloybut the problem i perceived hiredman to be talking about is two different consumers define something called :json, and they overlap just because they picked the same name
14:33hiredmanthe env map is nice and very direct, but you end up having to pass the map everywhere
14:33mikerodMrJones98: I may a little
14:33PigDudehiredman: i'll keep that in mind, i try to strike a balance between tweakbility and simplicity in config API
14:33amalloyand that doesn't happen with protocols, because there's no names to worry about, just the classes you define, which are namespaced and separate
14:33puredangeramalloy: yes, I digressed from original discussion
14:33gfredericksamalloy: he first mentioned globality, which I think is the heart of my gripe
14:33PigDudehiredman: maybe is good to bury this deep in the API for specific cases
14:33hiredmanPigDude: I would suggest the balance is to leave it out
14:33PigDudeyea
14:33hiredmanPigDude: just call functions like amalloy and I suggested instead of putting those multimethods everywhere
14:33PigDudeok, thanks for the advice everyone :)_
14:34PigDudehiredman: ok, so this is the kernel, what does that look like in code?
14:34PigDudehiredman: multimethods are functions after al
14:34hiredmaneither solve a problem or don't, don't include a half considered solution that doesn't solve anything
14:34radixare clojure records implemented as maps? (i.e. with a hamt and structure-sharing updates)
14:34hiredmanPigDude: have you needed this multimethod thing?
14:35MrJones98mikerod: i am trying to avoid using :fact-type-fn, and instead just wrapping my map with a field-less record
14:35PigDudehiredman: w/ current implemtnation, somebody extends the factory MM and the protocol if they wan tto provide a serializer implemtnation, etc.
14:35hiredmanradix: no, they are jvm classes with fields, you can add arbitrary fields to them which end up in a hamt, but the definied fields are fields
14:35PigDudesorry for the typos i'm over ssh and the internethere is awful, i'm going to go work from hiome now
14:35MrJones98mikerod: i.e. i’m doing (merge (->Rec) {:a :b}) and inserting that as a fact
14:36MrJones98mikerod: where Rec is (defrecord Rec [])
14:37hiredmanPigDude: do you have at least two distinct uses of the multimethod extension thing? not places where you are using it, but places where consumers have used it to extend things differently?
14:41arrdem&(/ 330.0 400)
14:41lazybot⇒ 0.825
14:42gfrederickshaha yay math
14:42gfrederickslove seeing those numbers do things
14:46mikerodMrJones98: ok, and you are having an issue with that?
14:46amalloycan we shame arrdem for not even simplifying it to (/ 33.0 40)? those wasted keystrokes are precious
14:46mikerodMrJones98: I guess your issue is that the field names are not "visible" to the rules engine
14:46Bronsaamalloy: but that's just (/ 3.3 4)
14:47arrdemheh
14:47amalloywhoa, Bronsa, let's not get crazy
14:47MrJones98mikerod: sorry…. i didn’t finish - i actually think that might be working and that the problem is my definition of rules in one namespace and records in another
14:47mikerodMrJones98: [Rec [(= ?a a)]] fails for you or something?
14:47amalloyyou can only cancel out the visible zeros - those invisible ones are too tricky
14:47MrJones98mikerod: have you tried defining rules/records in different namespaces and passing that to mk-session?
14:47mikerodMrJones98: That should be fine. As long as you have the appropriate require's and refer's if you are not qualifying things
14:48mikerodYes, I've tried it too. The test cases set up for clara-rules even does it that way.
14:48gfredericksBronsa: but that's just 0.825
14:48mikerodMrJones98: Perhaps if you are stuck on something with it, you could send a little example on a gist or something similar.
14:48gfredericks4 fewer characters
14:48Bronsagfredericks: I was waiting for someone to say that
14:48radixhiredman: ok, so if you assoc one of the declared members onto a record, it just copies the java instance and mutates that one value in the result?
14:49gfredericks,(rationalize 0.825)
14:49clojurebot33/40
14:49gfredericks^ I can never figure out how that works
14:49Bronsawuut
14:50whoadudeI just had to come post this
14:50mikerodBronsa: thanks for the commit link!
14:50mikerodBronsa: thanks for the quick feedback+commit on that too.
14:50whoadudeuser=> (defn reduces [coll & fns] (mapv #(reduce % coll) fns))
14:50whoadudeuser=> (reduces coll max min) [99 1]
14:50amalloygfredericks: it just multiplies everything by 10 until they're both integers, right? and then reduces?
14:51whoadude(the vector was the result)
14:51whoadudemy mind was blown... i feel like i've turned a corner
14:51amalloylike, ##(rationalize Math/PI) is going to be garbage
14:51lazybot⇒ 3141592653589793/1000000000000000
14:51gfredericksamalloy: there's only one number not two
14:51cbp825/1000
14:51amalloygfredericks: well. okay, yes. just one
14:51gfredericksthe denominator there is interesting though
14:53gfredericks,(defn amalloy ([num] (amalloy num 1)) ([num den] (if (= num (Math/floor num)) (/ num den) (recur (* num 10) (* den 10)))))
14:53clojurebot#'sandbox/amalloy
14:53gfredericks,(amalloy 0.825)
14:53clojurebot0.825
14:53gfrederickswhoops
14:53gfredericks,(defn amalloy ([num] (amalloy num 1)) ([num den] (if (= num (Math/floor num)) (/ (int num) den) (recur (* num 10) (* den 10)))))
14:53clojurebot#'sandbox/amalloy
14:53gfrederickswhoops
14:53gfrederickswhoops I didn't meant to repeat the whoops
14:53gfredericks,(amalloy 0.825)
14:53clojurebot33/40
14:53gfredericks,(amalloy Math/PI)
14:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 3141592653589794>
14:53gfredericksokay whatever
14:54gfredericksamalloy: that is an interesting theory.
14:54gfredericksamalloy: it's mainly the interplay between binary and base-10 that confuddles me
14:54gfrederickssince converting 33/40 to a float must lose information
14:54MrJones98mikerod: i think i might’ve figured it out…. i needed to import the record in the namespace with defrules as well as the one that calls mk-session
14:55amalloygfredericks: well it's not just a theory, it's actually how rationalize works
14:55_alejandroamalloy: gfredericks: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L303
14:55_alejandrowas looking at it while you were talking about it
14:56gfredericksHUH.
14:57gfredericksI swear I've seen that before and didn't think it was scrutable
14:58amalloygfredericks: also, i don't think 33/40 loses any information when converting to a float, does it?
14:59gfredericksit should
14:59gfredericks40 is not a power of 2
14:59gfredericksso it should be an infinite binary representation
14:59amalloyoh, i guess it does lose some
15:01gfredericks,(defn all-positive-ratios [] (iterate #(/ (- (* 2 (- % (rem % 1))) % -1)) 1))
15:01clojurebot#'sandbox/all-positive-ratios
15:02hyPiRionhuh, I thought it computed the continued fraction expansion
15:02gfredericks,(->> (all-positive-ratios) (remove #(-> % double rationalize (= %))) (first))
15:02clojurebot1/3
15:02gfredericks,(-> 1/3 double rationalize)
15:02clojurebot3333333333333333/10000000000000000
15:03gfredericks,(->> (all-positive-ratios) (remove #(-> % double rationalize (= %))))
15:03clojurebot(1/3 2/3 4/3 5/3 4/7 ...)
15:12mikerodMrJones98: yes, I'd imagine that mk-session needs to be aware of the environment you are bringing rules in from
15:12mikerodMrJones98: However, I'd be curious to know what sorts of failures you are seeing.
15:12mikerodMrJones98: And I'd be curious to see what wasn't working for you before this.
15:13MrJones98mikerod: i was getting a few classloader issues… but my issue before this was the rules just weren’t matching at all
15:13MrJones98mikerod: (defrule some-rule [Rec] => (println “found a rec”)) wasn’t giving me the expected output
15:14MrJones98mikerod: i’m basically just trying to adapt the main example in the readme
15:14MrJones98i’m starting to think there’s been a confluence of issues - classloader, re-def’ing records, namespaces not being loaded in the repl jvm
15:14mikerodMrJones98: so in one ns you made this defrule for some-rule with Rec being created via defrecord in the same ns?
15:15mikerodMrJones98: you definitely have to be careful for redef'ing any of your defrecords
15:16mikerode.g. if you are inserting instances of your class Rec, and a rule matching on Rec is not firing at all - there is a chance you're dealing with 2 versions of the class named Rec
15:24PigDudehiredman: you asked about people using MMs to extend two things differently, but i'm not sure what you mean
15:24PigDudehiredman: now i have internet :)
15:27arrdemBronsa: looking at -emit :keyword-invoke, this will neither arity exception nor fail to emit (:foo {} :bar :baz :quxx) it seems.
15:27arrdem&(:foo {} :bar :baz)
15:27lazybotjava.lang.IllegalArgumentException: Wrong number of args passed to keyword: :foo
15:27Bronsaarrdem: It should be implemented in t.a.j IIRC
15:27Bronsaarrdem: one sec
15:28Bronsaarrdem: https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/classify_invoke.clj#L44
15:29arrdemBronsa: ok cool.
15:29andyfgfredericks: The comer
15:30andyfgfredericks: The conversion of double to BigDecimal in rationalize probably approximates based on current settings in BigDecimal package
15:31teslanickLooking for a function that takes a list of keys and a map and returns a list containing the values the keys associate to. I have to think some function for that already exists but I'm not sure what it would be called.
15:31cbpselect-keys
15:32mikerodMrJones98: https://github.com/rbrush/clara-rules/issues/44#issuecomment-36637022 maybe relevant to something you were experiencing. Not sure though.
15:32teslanickOh. Duh. (vals (select-keys ...))
15:32gfredericksandyf: right
15:32gfredericksandyf: so I guess that's the real work
15:33mikerod(I'm mrrodriguez as well...)
15:33mikerodI'm still trying to figure out how to install more packages when I'm using emacs-live
15:34mikerodhttps://github.com/ardumont/emacs-live-packs is the best looking option I see
15:34technomancymikerod: the most annoying thing about emacs-live is how they reinvented emacs packaging for no reason =\
15:35andyfgfredericks: In particular see java docs for BigDecimal.valueOf(double) and BigDecimal(double) constructor
15:35technomancyapart from just, you know, being a starter kit in the first place
15:36gfredericksandyf: oh snap they're different
15:36gfredericks,(def andy (double 1/3))
15:36clojurebot#'sandbox/andy
15:36gfredericks,(rationalize (java.math.BigDecimal. andy))
15:36clojurebot6004799503160661/18014398509481984
15:36gfredericks,(rationalize (java.math.BigDecimal/valueOf andy))
15:36clojurebot3333333333333333/10000000000000000
15:37gfredericks(inc andyf)
15:37lazybot⇒ 4
15:37gfredericksso I guess rationalize uses the latter
15:37gfrederickswherein the work is now being done by Double#toString
15:38andyfNo guessing required :-)
15:38arrdembut what's the epsilon?
15:39arrdemhum...
15:39arrdemclearly we need an arbitrary length float package
15:39gfredericks,(Double/toHexString (double 1/3))
15:39clojurebot"0x1.5555555555555p-2"
15:39gfredericks^ wat
15:40gfredericks,(Double/toHexString (double 3/7))
15:40clojurebot"0x1.b6db6db6db6dcp-2"
15:42puredanger_why can't everyone just use integers
15:44aviauHello! My internet skills are bad today =(. I am looking for an example web server that just echoes posts it receives. Where can I learn doing this?
15:44arrdempuredanger: we have yet to invent a way to actually effect the world in exact integer quantities. works great for virtual worlds tho...
15:44nobodyzzzis there a tool to add dependency to project.clj? something like adddep clj-http 0.9.2 and puf required string is added to project.clj?
15:44andyfpuredanger: We do. We just don't always print them that way :-)
15:44technomancyaviau: (defn app [req] {:status 200 :headers {"content-type" "text/plain"} :body (slurp (:body req))})
15:45arrdem(inc technomancy)
15:45lazybot⇒ 120
15:45andyfarrdem: The difference between two consecutive double values, according to java docs for Double.toString(double)
15:45technomancyhm... maybe :body (pr-str (update-in body [:body] slurp)) instead if you want headers
15:46technomancyand a bunch of other stuff
15:46arrdemtechnomancy: with-out-str pprint
15:46technomancyoh yeah nice
15:47aviautechnomancy, Sorry. I don't want to echo it but print it.
15:47aviauAnh huh, That is a web server?
15:47aviauand*
15:47technomancyaviau: it's a ring-compliant hnadler
15:47technomancyhandler
15:47aviauoh. So it will work with aleph?
15:48technomancyyou'd pass it to ring.adapter.jetty/run-jetty
15:48technomancyor that, yeah
15:48ztellmanhaha
15:49arrdemtechnomancy: oh good you still have ops.
15:53arrdemandyf: sure, I was just curious if there was a non-0.0 epsilon between the two rationalize values.
15:59boxedparsing the clojure cheatsheet structure into a structure that looks like clojure and not some markup: 144 lines of core.match horror :P
16:00arrdemboxed: ... you realize that andyf generates that thing from clojure data right?
16:00andyfIt is the clojure data that horrifies him :-)
16:00boxedyea, what andyf said
16:00andyfI did some expedient things
16:01boxedit’s complected to hell with markup and page structure
16:01boxeda million expedient things :P
16:01arrdemfair
16:01boxedbut anyway, this has been a very useful little detour into core.match which is pretty rad I must say
16:02boxedand all this because I wanted to write a reagent search frontend to the cheatsheet :P
16:02andyfI didn't have time to do that many expedient things, or it wouldn't have been expedient :-)
16:02boxedheh
16:04boxedI have a few nuts and bolts left, like figuring out the namespaces to be able to get the proper links but I think that’s pretty easy
16:05mi6x3mhello, is there a way besides the reader to get a data structure out of source-fn ?
16:05gfredericksmi6x3m: I don't think so
16:06mi6x3mgfredericks: oh well :)
16:06technomancyclojurebot: serializable-fn?
16:06clojurebotserializable-fn is a hack for preserving source of a compiled function: https://github.com/technomancy/serializable-fn
16:06technomancymi6x3m: doesn't work with regular functions, but you could try that
16:07boxedis it just me that has the annoying problem that light table freezes up for a few seconds every once in a while?
16:07mi6x3mtechnomancy: it will not help me much for i need the source of dependent symbols, a list of which I get with flatten :/ my use case is simple: i show the source code to small examples of a seesaw component
16:08mi6x3mguess source-fn and the reader will have to do :)
16:08technomancysounds like it
16:11nobodyzzzI'm trying to parse a string which contains HTML with enlive, but calling (html-resource my_string) gives me NullPointerException net.cgrand.tagsoup/parser/fn--1254 (tagsoup.clj:31), 31 line in tagsoup is (with-open [^java.io.Closeable stream stream]. Any ideas why this is happening?
16:12mi6x3many more efficient way to group the elements of a sequence with their index than:
16:12aviautechnomancy, I Had a TCP server working. But I couldn't use your handler with an http server. Any ideas? This is what I have: http://pastebin.com/yLivSLMA
16:12technomancyaviau: I've never used aleph
16:12mi6x3mnobodyzzz: can you try to provide a minimal example
16:13aviautechnomancy, Okay, thanks anyways =)
16:15nobodyzzzhttp://pastebin.com/Yg9ZpMGx (just poking around in repl)
16:15nobodyzzzit seems enlive treat my string as path to a file...
16:16boxednot-any? existing but not any?… wtf
16:16amalloyaviau: you want to read through https://github.com/ztellman/aleph/wiki/HTTP, and there's an example that's very similar to technomancy's
16:17amalloy&(doc some) boxed
16:17lazybot⇒ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
16:18mi6x3mnobodyzzz: what is the doc saying about html-resource?
16:18boxedamalloy: ah.. blech, but ok
16:19nobodyzzzmi6x3m, not much :)
16:19nobodyzzznet.cgrand.enlive-html/html-resource
16:19nobodyzzz([resource] [resource options])
16:19nobodyzzz Loads an HTML resource, returns a seq of nodes.
16:20mi6x3mnobodyzzz: i am looking
16:23nobodyzzzwrapping test to (java.io.StringReader. test) help \o/
16:33aviautechnomancy, amalloy, I played with the example a little bit and I got it working. Thank you guys!
16:34mi6x3mnobodyzzz: it seems html-resource is using get-resource
16:34mi6x3mhttps://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj
16:36andyfCreating a completed data structure that suits the purposes it was created for: ~ 2 weeks. Updating it occasionally over 3 years: another 2 weeks. Getting boxed to learn that core.match is rad and earning 7 weeks in Clojure purgatory: priceless
16:36boxedheh
16:40augustlat what point does it become more efficient to create a set and union it with the original, rather than adding step-by-step in an iteration to a set?
16:41augustlabsolute and definitive answer expected! :)
16:42gfredericksaugustl: why not use transients?
16:42technomancydefinitive answer: http://images.cryhavok.org/d/11335-1/Dresden+Codak+-+I+Will+Do+Science.jpg
16:42hiredmanclojure.set is not very efficient
16:43hiredmaninto is most likely faster than set/union
16:43amalloythe only way i can think of it mattering, augustl, would be if you were adding the same value to a large set many times. like, (into (set (range 1e5)) (repeat 1e4 0))
16:43amalloyin that case, creating a set of (repeat 1e4 0) first would probably be faster; in any other case i can think of, you just want to dump stuff into the existing set one at a time
16:43augustlgfredericks: PersistentTreeSet doesn't seem to support transients
16:43gfredericksoooh the sorted set
16:44augustlPersistentHashSet can have transients?
16:44gfredericks,(transient #{})
16:44clojurebot#<TransientHashSet clojure.lang.PersistentHashSet$TransientHashSet@164c6c9>
16:45augustlI need a sorted set though, boo
16:45gfredericksclojure 1.7 will include transient Longs and Doubles
16:45augustlmakes sense that it doesn't support transients now that I think about it..
16:45gfredericksit does?
16:45Glenjaminaugustl: data.avl has transient sorted maps
16:45gfredericksI thought we were just being lazy with the fringe data types
16:46puredangergfredericks: and transient nil
16:46Glenjaminhttps://github.com/clojure/data.avl/
16:46gfredericks(inc puredanger)
16:46lazybot⇒ 5
16:46latkI've been trying to understand why my project.clj doesn't work when I attempt to enable source-maps for cljs (om). The file looks like this: http://bpaste.net/show/g6fayuRFcRhSMAFut6Q4/ and the error is http://bpaste.net/show/rdOW7blOiy5RHGW5rM4p/
16:47latkI don't really understand the error, which makes it pretty hard to debug :s
16:47mikerodtechnomancy: Sorry, I was away. I agree the packaging part of emacs-live is not making me too happy.
16:47mikerodI don't understand the motivation behind it.
16:51amalloythat error message doesn't look like it came from that project.clj, latk. the line that's failing is https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild/config.clj#L73, and it's failing because :builds is a single map instead of a list of maps
16:52hiredmanamalloy: it looks like it is a list of maps in the linked project.clj?
16:52amalloyhiredman: that's why i said the error message doesn't seem to match the project.clj
16:53amalloylike, looking at the stacktrace and the line of code i linked, how can it be anything other than :builds being a single map
16:54hiredmanmakes sense
16:54latkI'm pretty new to clojure - how can I go about fixing this ?
16:54latkI just copied the syntax from an example I found on the cljs wiki
16:56whodidthishttps://github.com/aamedina/cljs/blob/master/src/leiningen/new/om_cljs/project.clj
16:56gfrederickslatk: wrap that map in a vector?
16:56technomancylatk: from what I gather, learning cljs without a background in clojure is really difficult given the immaturity of the tooling.
16:56amalloygfredericks: but it's already wrapped in a vector! that's the weird thing. his error message does not match his code
16:56latktechnomancy: This is becoming apparant :P
16:57amalloythis morning i was thinking about learning cljs. you guys have now reminded me that i'd have to learn cljsbuild, and it sounds less fun now
16:57Frozenlocktechnomancy: I'd say learning cljs without JS background is also quite hard.
16:58latkYeah, I have some background in JS, but almost nothing in clojure. I was hoping to use cljs as a js replacement :s
16:59technomancyamalloy: yeah, I'm gonna just wait for this whole browser thing to blow over and get in early on the next fad: http://www.smbc-comics.com/index.php?db=comics&amp;id=760#comic
17:00amalloyhah. i've read most smbc, but only by hitting Random - i've never gone systematically through the archive - and that is a new one to me
17:00latkNo ideas for what I might do then? :s
17:00latkother than give up and learn clojure first
17:00whodidthislatk: https://github.com/aamedina/cljs try this to get started at least
17:01Frozenlocktechnomancy: Any ETA on the end-of-browsers? It can't come quickly enough...
17:01whodidthisTo create a new project type "lein new om-cljs project-name", then it will hook you up with a cool new (hopefully) working project
17:01augustlhmm, seems PersistentTreeSet.create(myComp, null) doesn't work when using Clojure's data structures from a Java project
17:01augustlI get "java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentList"
17:01gfrederickstechnomancy: chewin on skunks *in clojure*!
17:02technomancygfredericks: well now you have a name for your new browser-killer paradigm
17:02technomancyall that's left is to build it
17:02gfredericksand a logo
17:02gfredericksand a twitter account
17:02technomancythe rest is little more than an exercise for the reader
17:03gfredericksand a website in the .io TLD
17:03technomancyor possibly one of the other jovian moons
17:03gfredericksthanks icann!
17:04FrozenlockWhat you need to know to use cljs: JS, HTML, CSS, browser-compatibility, google compiler (munging, externs...), cljsbuild tweaks and Clojure... but not exactly because they don't allow the same thing.
17:04FrozenlockIt's like a tower of abstractions without abstractions.
17:05amalloya tower of agglomerations
17:06FrozenlockOh and if you want to use the new hot toys, learn React.js as well.
17:06Frozenlockamalloy: Blob?
17:06hiredmanall these tlds are yours(for a price) except .europa, attempt no whois lookups there
17:06gfredericksI'm pretty sure you can't do any serious front end web dev without a similarly sized toolbox
17:06latkthe question is though, is it worse than plain js ?
17:07latkI would be surprised if it were...
17:07technomancyhiredman: hehe
17:07Frozenlockgfredericks: Bring back the .html webpage!
17:08technomancylatk: probably difficult to get a balanced answer on that, and it undoubtedly depends on context
17:08gfredericksFrozenlock: that's not a webapp that's a document
17:08FrozenlockYou still have forms.
17:09FrozenlockWhat more do you want?
17:09gfredericksno more web browsers
17:10FrozenlockBy that you mean no more websites... or do you have an alternative?
17:10latktechnomancy: Well, in the near future I'm going to have to write a semi complex front end for some software I'm building.. I don't really want to do it in angular.js or similar
17:11Frozenlocklatk: do you intend to learn clojure for the backend?
17:11gfredericksFrozenlock: I'm just a curmudgeon so I don't mean anything in particular
17:12amalloygfredericks: do you mean to imply that all curmudgeons are pointless ramblers?
17:12latkFrozenlock: The backend is mostly written, in Haskell
17:12technomancywhat we need is an elaborate calculus of program maintainability to tooling overhead ratio, factoring in the expected rate of change of the program and the likelihood of needing to bring new programmers up to speed with the setup
17:12boxedlatk: http://yogthos.net/blog/54-Building+Single+Page+Apps+with+Reagent may be helpful
17:12Frozenlock /random-rants I want people to stop sending .doc forms and just use webforms instead.
17:12gfredericksamalloy: I didn't mean to imply anything in particular
17:13gfredericks(expressly because I'm a curmudgeon)
17:13technomancylatk: purescript? =)
17:13latkpurescript looks cool, but I wanted to learn a lisp :p
17:14latkAlso I was lead to belive cljs was more mature than purescript.. though that has not been my experince thus far
17:15radixlatk: I don't know much about purescript (though it does look very cool), but cljs is indeed pretty awesome. there's a #clojurescript channel specifically about it fwiw
17:16latkradix: I'm actually already in there, but it seems somewhat dead :s
17:16radixah :)
17:16gfrederickslatk: I used it a lot a couple years ago; my guess is that there's a pretty big initial hump to get over, but then it ensmoothens a lot and is nice for anything sufficiently complex
17:16latkgfredericks: Did you already know clojure at this time ?
17:16gfredericksoh right I forgot about that difference
17:16gfredericksabandon all hope
17:17latkHah :p
17:17gfredericksor rewrite your haskell in clojure first ;-)
17:17latkbut muh type saftey!
17:17technomancyfrom what I've seen about the browser, it seems like a place where the guarantees of the type system are *more* important than the server
17:17gfrederickslol
17:17dnolen_latk: cljs definitely more mature than purescript on pretty much every possible metric. But yes you need to know Clojure to be productive.
17:18technomancybecause the jvm will at least usually crash when you reach nonsense, and the browser will just keep going
17:18dnolen_technomancy: lol but likely for not the reasons you intended.
17:18latkdnolen_: Could you suggest a subset of clojure that would be sufficient ?
17:18dnolen_latk: no, we replicate the entire standard library outside of concurrency primitives.
17:19gfredericksan interesting use of defrecord with a custom IFn is as a serializable representation of a job
17:19dnolen_and that may change in the future if game companies have their way
17:19latkHmm, are there any "roadmaps to clojurescript" or the like ?
17:19latkOr do I just need to spend a week writing clojure first?
17:19radixdnolen_: what may change?
17:19gfredericksoh concurrency primitives I bet is what he meant
17:20dnolen_radix: Google is exploring shared memory parallelism in V8, locks and everything
17:20radixooohh. cool :)
17:20dnolen_and Brendan Eich has not written off the idea for ES7
17:20radixI mean...
17:20Frozenlocklatk: Spend a week writing clojure in a repl first.
17:20FrozenlockGetting a repl with clojurescript is yet another complication
17:21dnolen_https://www.youtube.com/watch?v=-xNZYr40QOk
17:21latkFrozenlock: I have been meaning to have a look at SICP - would this be the right sort of thing to be doing ?
17:21radixdnolen_: so, I'm no fan of threads+locks, but won't having shared memory parallelism actually be useful as a runtime for a functional language? since you'll be able to share memory without fear since your data structures are immutable
17:21dnolen_Nick Bray talk from JSConf 2014 talk on this ^
17:21dnolen_radix: yep
17:21dnolen_bring it on
17:21radixjust leave out the locks
17:21radixok, then that sounds great :)
17:22Frozenlocklatk: I'm not the right person to ask.. I only read half of it :-p
17:22Frozenlock(But I watched the lectures)
17:22latkFrozenlock: Hah, fair enough. Seemed easier than thinking of some toy projects, is all
17:22gfredericks(inc locks)
17:22lazybot⇒ 2
17:24amalloylatk: sicp is pretty great
17:24vermaI am having a hard time understanding this, I am writing cljs program sort of and need to use macros, I created a macros.clj right alongside my cljs but I cannot use it, what is needed to get some macros working for cljs? I seem to be able to import macros fine from external sources like clojure.match
17:25dnolen_verma: gist would help thanks
17:27vermadnolen_, sure
17:32vermadnolen_, https://gist.github.com/verma/3fb02dcad9a6bc3e972a
17:33kenrestivohi, i remember reading about a hack in lein to inject the version number of the project into the source somehow so it can be accessed from inside the project. but i forgot
17:33technomancykenrestivo: no more hacks needed; just read pom.properties
17:33technomancyit used to be only available at jar time, but no more
17:34FrozenlockI usually use this https://github.com/trptcolin/versioneer
17:34FrozenlockNot sure if it's still the right thing to do.
17:34kenrestivotechnomancy: thanx
17:34technomancyversioneer is the thing to use if you need compatibility with pre-2.4 lein
17:35gfredericksread pom.properties from where?
17:35gfredericksit's not on my classpath
17:35gfredericksnot at the root anyhow
17:35technomancyyeah it's nested or something
17:36gfredericksis it deep down under META-INF/classloader/JAVA/classes/com/gfredericks/POM-INFO/...
17:36technomancywhy do you have to ask such hard questions
17:37kenrestivotechnomancy: you mean META-INF/projectname/pom.properties ? what path would i use to slurp that from inside the project?
17:37technomancykenrestivo: should be the same path whether you're running from lein or an uberjar
17:37aperiodicverma: I don't see any reason why that macro needs to be a macro
17:38kenrestivo(slurp "pom.properties") comes up FileNotFoundException
17:38technomancyoh hey, I was thinking "that should be in the faq" and like magic I went to add it, and it was already there
17:38kenrestivo,(slurp "pom.properties")
17:38clojurebot#<SecurityException java.lang.SecurityException: denied>
17:38vermaaperiodic, the fn on line 11 is called every frame, I don't want it to change the random offsets every frame
17:38dnolen_verma: hmm, still not enough information for me to see the issue
17:38technomancy(doto (java.util.Properties.) (.load (io/reader (io/resource "META-INF/maven/group/artifact/pom.properties"))))
17:38aperiodicverma: but your error is not anything to do with cljs, it's because your macro is written incorrectly
17:38kenrestivotechnomancy: awesome, thanks
17:39vermaaperiodic, oh is it?
17:39technomancynp
17:39dnolen_verma: oh i see it
17:39dnolen_verma: the symbol by is not being unquoted
17:39dnolen_~by
17:39clojurebotIt's greek to me.
17:39aperiodicverma: is there no place you could generate the offsets once at the beginning and them pass them through to that fn?
17:40vermaaperiodic, but that won't be awesome :(
17:41technomancyI can't remember if I announced it or not, but I posted the lein survey results a while back https://lein-survey-2014.herokuapp.com/results
17:41technomancyhmm... maybe like ... a couple months ago.
17:41kenrestivooooh nifty, even shows the git commit? sweet.
17:41vermadnolen_, nice, that worked, I don't need the by unquoted though, I wanted the whole thing ~(- by (rand-int (* 2 by))) :) thanks
17:41mi6x3mi remember myself using ant
17:42mi6x3mwhen I recall the past
17:42Frozenlocktechnomancy: wow, so many Mac OS X
17:42mi6x3mlein and maven seem like... I don't know
17:43mi6x3mwhy are custom profiles so intensively used o_o
17:43mi6x3myeah startup times are a bit annoying
17:43dnolen_verma: that's symbol capture but ok, ~'by is what you want
17:44Frozenlock"Did you know if you have a single patch accepted you can ask for commit rights and a sticker?" I must have spent 20 seconds trying to understand what sticker meant.
17:44FrozenlockThen I realized it wasn't a technical term.
17:44mi6x3mFrozenlock: LOL
17:44mi6x3m:D
17:44mi6x3mI thought so too
17:45technomancyFrozenlock: we send someone to your house to poke you with a stick
17:45mi6x3mtechnomancy: can you show a template of the stickers?
17:45mi6x3mor they are different every time
17:45vermadnolen_, hmmm, ok, playing with it
17:45technomancymi6x3m: it's just the logo, but I got a big batch printed on transparent backgrounds by accident
17:45Frozenlock"Oddly enough, the number of 3+ answers this year was almost exactly the same as last year. However, all the other numbers have fallen, especially the 1 year bracket." Clojure losing steam?
17:46technomancyso I tend to include five or six stickers in there to make up for it because I feel bad
17:46mi6x3mtechnomancy: round or square?
17:46mi6x3msuitable for notebooks?
17:46technomancysquare
17:46technomancysure
17:46technomancyI mean, as long as you place them on a lighter surface
17:46mi6x3mI gotta say this is quite motivating
17:48aperiodicdnolen_, verma : i don't think expanding to something with 'by is desired; verma just wants to generate an offset at macro-expand time so that it's consistent every time fn is invoked (each frame). quoting the whole subtraction expression is sufficient for that.
17:48amalloyi wonder if i answered that lein survey
17:50vermaaperiodic, you're right, but the outcome of it was not really what I wanted, I think I was just confused, but at least the macros are working now so I can move forward :)
17:50vermathanks aperiodic, dnolen_
17:50aperiodicverma: also, small note: it's easier & more idiomatic to use (dec n) instead of (- n 1)
17:51vermaaperiodic, sure, learning new things everday :)
17:51verma(inc aperiodic)
17:51lazybot⇒ 7
17:51verma(inc dnolen_)
17:51lazybot⇒ 3
17:52amalloytechnomancy: from my sample size of 1, i conclude that the reason "how long have you been using lein" got fewer answers than previously is because fewer people knew about the survey
17:55kenrestivostuffed away where i won't have to remember how to do that anymore: https://github.com/kenrestivo/utilza/blob/master/src/utilza/java.clj#L101
17:56technomancyamalloy: seems likely
17:57gfredericksI don't know about a survey and I've been using lein for a long time.
17:57gfredericksI can't remember if I was using it right away.
17:57technomancymi6x3m: https://twitter.com/technomancy/status/162281090336305152
17:58mi6x3mtechnomancy: let the patch hunt begin, this is quite worthy :)
17:58mi6x3mgreat idea
17:59mi6x3mis this a heron on your twitter ?
17:59technomancymi6x3m: yeah, I like to work from parks
17:59technomancysometimes parks by lakes
17:59mi6x3mtechnomancy: great birds, herons
17:59technomancyoh?
18:00mi6x3mwell yes, quite beautiful
18:00technomancyoh yeah, and graceful
18:00amalloytechnomancy: i hadn't realized this, but apparently my only commits in lein are to markdown files
18:01amalloyplus that one joke pull request
18:01Frozenlockpfff, no birds come close to the Shoebill http://masspictures.net/shoebill-bird/
18:01technomancyamalloy: it was a good one
18:03amalloyFrozenlock: http://www.usnews.com/news/articles/2014/07/07/largest-ever-flying-bird-a-prehistoric-dragon-found-in-south-carolina
18:04elbenI want to convert HTML string, strip out tags and just get the raw text between tags. Something similar to beautifulsoup’s get_text (http://www.crummy.com/software/BeautifulSoup/bs4/doc/#get-text). Any ideas? Doesn’t seem to difficult to implement w/ enlive, clj-tagsoup, etc.
18:05mr-foobarcan clojure have the problem of memory leaks ?
18:05amalloy&(vec (repeatedly 1e6 #(object-array 1e4)))
18:06amalloyreally, no OOME, lazybot?
18:08amalloyi guess the wrong thread ate that OOME. poor guy
18:26gfredericks,(extend-protocol clojure.core.protocols/CollReduce Long (coll-reduce [n f] (reduce f (repeat n 1))))
18:26clojurebotnil
18:26gfredericks,(reduce str 42)
18:26clojurebot"111111111111111111111111111111111111111111"
18:26gfredericks^ protip
18:30cbp`=(
18:31amalloy,(reduce + 100) ;; proof that reduce==0
18:31clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
18:32cbp`:-D
18:32Frozenlock,(str (take 42 (repeat "1")))
18:32clojurebot"clojure.lang.LazySeq@643d5f61"
18:32Frozenlock,(apply str (take 42 (repeat "1")))
18:32clojurebot"111111111111111111111111111111111111111111"
18:39AeroNotix,(reduce str 42)
18:39clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
18:40gfrederickswhat should LazySeq#toString be changed to do?
18:42amalloygfredericks: (throw (Exception. "This never does what you want anyway, so why bother?"))
18:43gfrederickshaha oh geez
18:43gfrederickspeople would hate that pretty quick
18:43technomancy"It looks like you're trying to stringify a lazy seq. Did you mean ..."
18:46gfredericksreturning "#<LazySeq>" would be better than nothing
18:46gfredericksor similar
18:47gfredericksI don't see a big reason not to just do pr-str though
18:47technomancymaybe invoke whichever honors *print-length*?
18:47gfrederickshmm
18:48gfredericksI don't think the current behavior reliably saves anybody from anything
18:48gfrederickssince most repls don't even use it
18:48technomancysurely it's being called by accident on an infinite seq deep in some codebases somewhere
18:49amalloytechnomancy: that doesn't ever return
18:49gfredericksthat's true it would be backwards-dangerous
18:49amalloyso the current behavior is not much good anyway
18:49gfredericksoh right of course
18:49technomancyoh, really?
18:49technomancyI thought the whole point was to avoid realizing it
18:49gfredericksamalloy: okay so surely it's being called by accident on a large seq deep in a memory-strapped codebase somewhere
18:49gfrederickstechnomancy: that's the problem is it doesn't even do that
18:49technomancyok, yeah pretty lame
18:50amalloytechnomancy: i thought that too, but every so often i am reminded that this is not the case
18:50amalloy,(str (iterate inc 0))
18:50clojurebot"(0 1 2 3 4 ...)"
18:50gfrederickshaha wat
18:50gfredericks,(str (range))
18:50clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
18:50amalloywhaaaaaat
18:50gfrederickshiredman you weirdo did you special-case (str (iterate ...))
18:51hiredmandefinitely not
18:51technomancygeez, rude to ask
18:51amalloy&(str (iterate inc 0))
18:52lazybotjava.lang.OutOfMemoryError: Java heap space
18:52hiredman,(type (iterate inc 0))
18:52clojurebotclojure.lang.Cons
18:52hiredman,(type (range))
18:52clojurebotclojure.lang.LazySeq
18:52amalloyoh jeez. friggin iterate
18:52gfredericks,(type (rest (iterate inc 0)))
18:52clojurebotclojure.lang.LazySeq
18:53gfredericksstill confused
18:53hiredmanhaha
18:53hiredmanthe toString on ASeq calls RT.printString
18:53hiredmanCons extends ASeq
18:53amalloyyeah. i guess ASeq assumes that it will only be for finite, realized sequences?
18:53gfredericksand RT.printString somehow goes throw a clojurebot codepath?
18:53hiredmanno
18:53amalloygfredericks: no, not at all
18:54amalloyit prints it like the repl would
18:54gfrederickswith a *print-length*?
18:54hiredmanLazySeq doesn't implement ASeq
18:54hiredmangfredericks: yeah, printString must just call the pr var
18:54amalloygfredericks: clojurebot has *print-length* set all the time, probably
18:54hiredmanyep
18:54amalloynot just when attempting to print a result
18:54hiredmanoh clojure, you are the living end
18:55FrozenlockClojure is like a box of chocolates
18:55amalloy,(str (cons 'infinity (range)))
18:55clojurebot"(infinity 0 1 2 3 ...)"
18:55gfredericksI pretty much didn't know about print-length
18:56devngfredericks: award for best readme goes to you for qubits
18:56gfredericksdevn: w0000hthx
18:57devnspeaking of great readme/content in the same vein
18:57devnhttp://hoplon.discoursehosting.net/t/get-rich-with-hoplon-part-1/115
18:59gfredericksso not only does (str a-lazy-seq) not save the seq from getting realized, but infinite not-instances-of-LazySeq get treated differently
18:59devn"The idea is, while listening to the song, the user can tap their phone's screen and determine the tempo1 of the song. They can then blog or tumbleblog or retweet or whatever with this number because quantified self and social networking fitbits Ashton Kutcher South-by."
19:00technomancyimma get the high score on taptobmp.com and you can't stop me
19:01FrozenlockI don't like that everything is in the fragment in Hoplon :-(
19:01Frozenlockhttp://hoplon.io
19:02Frozenlock(Instead of a real URL that hits the server)
19:02FrozenlockBut maybe I'm just old fashioned.
19:29mthvedtanyone with any experience writing friend workflows?
19:37fifosineHow do I turn a lazy sequence of ints into a lazy sequence of keys?
19:38dnolen_fifosine: do you mean keywords?
19:38amalloyyou mean keywords like :1? why would you do that?
19:38fifosineYea, so that I can use zipmap
19:38hiredmanyou can use numbers as keys
19:38hiredman,{1 1}
19:38clojurebot{1 1}
19:39fifosine,(get 1 {1 1})
19:39clojurebotnil
19:39aperiodicthat's not how you use get
19:39amalloy,(get {1 1} 1)
19:39clojurebot1
19:39dnolen_,(zipmap (range 5) (repeat "foo"))
19:39clojurebot{4 "foo", 3 "foo", 2 "foo", 1 "foo", 0 "foo"}
19:39hiredman,(doc get)
19:39clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
19:41fifosinety
19:44gfredericks,(get get get get)
19:44clojurebot#<core$get clojure.core$get@7f6155>
19:44aperiodic(inc gfredericks)
19:44lazybot⇒ 76
19:45aperiodicthe Buffalo buffalo of clojure
19:45technomancyrelated: https://twitter.com/technomancy/status/327234371813781505
19:46gfredericksRT https://twitter.com/technomancy/status/327234371813781505
19:51vermaarrdem, the grimoire syntax theme was inspired by an existing colorscheme or is it your own?
19:52gfredericks,((juxt (juxt :a :b) (juxt :c :d)) {:a :a, :b :b, :c :c, :d :d})
19:52clojurebot[[:a :b] [:c :d]]
19:52gfredericks,(partial partial partial)
19:52clojurebot#<core$partial$fn__4228 clojure.core$partial$fn__4228@1e0799a>
19:52fifosineI'm trying to mask a function in my tests so that I can provide input like this: (with-redefs [read-line #("1")] (read-line))
19:53fifosineIs this a right way to go about it?
19:53gfredericks,((constantly constantly))
19:53clojurebot#<core$constantly clojure.core$constantly@b2f2d6>
19:53AWizzArdclojure.async: (dotimes [i 5] (put! chan i)) Is there a `foo` which will do (foo chan) => (0 1 2 3 4) ?
19:54gfredericksfifosine: ##(with-redefs [read-line (constantly "1")] (read-line))
19:54lazybotjava.lang.SecurityException: You tripped the alarm! with-redefs-fn is bad!
19:54gfredericksclojurebot: You |tripped| the alarm! with-redefs-fn is bad!
19:54clojurebot'Sea, mhuise.
19:55technomancy,((constantly constantly) constantly constantly constantly constantly constantly constantly constantly constantly) though
19:55clojurebot#<core$constantly clojure.core$constantly@b2f2d6>
19:55alandipert(reduce partial (repeat partial)) ; world's most partial function
19:55fifosinegfredericks: Are you not supposed to use with-redefs in tests?
19:55technomancy,(apply (constantly constantly) (repeat constantly))
19:56clojurebot#<core$constantly clojure.core$constantly@b2f2d6>
19:56vermaAWizzArd, you mean like <! ?
19:56technomancyhuh, that worked
19:56gfredericksfifosine: nope it's fine
19:57AWizzArdverma: yes, I want a <! which will read all elements from the channel and return them in a list
19:58vermaAWizzArd, may be (repeatedly #(<! chan)) ? but that's a lazy seq
19:59gfredericks,(-> + (partial 7) (partial 4) ())
19:59clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
19:59gfredericks,(-> + (partial 7) (partial 4) (deliver 9))
19:59clojurebot20
19:59fifosineAnyone know how to view stdout in lighttable?
19:59technomancyfuncall!
20:00hiredmanI think deliver is too powerful, it needs to be banned to keep things fun
20:01Frozenlockdeliver?
20:02TEttinger(doc deliver)
20:02clojurebot"([promise val]); Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will have no effect."
20:02gfredericks,(defn deliver? [x] (= x deliver))
20:02clojurebot#'sandbox/deliver?
20:02gfredericks,(deliver? 'hey)
20:02clojurebotfalse
20:02gfredericks,(deliver? deliver)
20:02clojurebottrue
20:02amalloyclojurebot: deliver is a version of funcall snuck into clojure by a lisp-1 fanatic
20:02clojurebotc'est bon!
20:02amalloyer, lisp-2. dangit
20:03gfrederickshaha you can't take it back now
20:03hiredmanthe implementation of deliver happens to be (fn [x y] (x y)) because of laziness in implementation of promises
20:03gfredericksclojurebot NEVER forgets
20:03amalloyclojurebot: forget deliver |is| a version of funcall snuck into clojure by a lisp-1 fanatic
20:03clojurebotI forgot that deliver is a version of funcall snuck into clojure by a lisp-1 fanatic
20:03amalloyclojurebot: deliver is a version of funcall snuck into clojure by a lisp-2 fanatic
20:03clojurebotRoger.
20:03amalloyhiredman: s/laziness/sloppiness, just because laziness is so overloaded in clojure
20:03TEttingerhello?
20:03clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline TEttinger
20:03Frozenlockclojurebot: Datomic is still not FOSS.
20:03clojurebotOk.
20:03Frozenlock:-D
20:04fifosine,datomic
20:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: datomic in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:04TEttinger...good ding dong diddly god, miss TEttinger?
20:04fifosinehow do you ask it facts
20:04TEttingerdatomic?
20:05FrozenlockIs it case sensitive?
20:05fifosineclojurebot: Is Datomic FOSS?
20:05technomancy,tias
20:05clojurebotNo entiendo
20:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tias in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:05amalloyclojurebot: is it case sensitive?
20:05clojurebotexcusez-moi
20:05TEttingerclojurebot: datomic |is| a money-making scheme
20:05clojurebotYou don't have to tell me twice.
20:05TEttingerdatomic?
20:05clojurebotdatomic is a money-making scheme
20:06fifosineah-ha
20:06TEttingerDatomic?
20:06FrozenlockDatomic?
20:06clojurebotDatomic is still not FOSS.
20:06clojurebotDatomic is still not FOSS.
20:06FrozenlockYeah, case sensitive
20:06fifosinescheme?
20:06clojurebotscheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.
20:07fifosineanyways, does anyone know how to view stdout in lighttable, e.g. see "5" when you exec (println "5")?
20:07TEttingerfifosine, run it in the repl?
20:07fifosineTEttinger: I'd have to copy-paste all my code
20:07TEttingerlight table I believe only shows you return values
20:07Frozenlockfifosine: Been a while since I used lighttable, but isn't it Shift+Ctrl+C to show the console?
20:08TEttingerhuh why?
20:08TEttingerjust import it
20:08TEttingerrequire, sorry
20:08fifosinefrozenlock: yes, thanks!
20:20gfrederickshey if you want to have a good time do a (shuffle 1000) and try to find the 0
20:20gfredericksbest way to spend your evening
20:20gfredericks(shuffle (range 1000)) I mean
20:20gfredericksif you figure that one out, then try to find the 1
20:21Frozenlock,(some #{0} (shuffle (range 1000)))
20:21clojurebot0
20:21FrozenlockIt's there!
20:21gfredericksif you get bored of that, mix things up -- bump it to 2000 and look for your birth year
20:21gfredericksget creative!
20:22gfredericksif you really want to challengeg yourself try (repeatedly 2500 #(rand-int 2)) and look for patterns
20:22amalloygfredericks: c'mon man, it's 2014 already. clojure surely has some programmers born after 2000
20:23gfredericksraynes would have told us about it
20:23amalloymaybe he did and you ignored him because you don't take youth seriously
20:27gfredericksyeah well maybe I took youth seriously and you ignored it because you don't take me seriously
20:28Frozenlocklol
20:29FrozenlockIs Clojure hip with the kids?
20:30platzno
20:30amalloy,hip
20:30clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hip in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:33technomancyFrozenlock: https://a248.e.akamai.net/media.pinterest.com.s3.amazonaws.com/736x/8a/76/60/8a7660926fd0668dfc5ae9aa39feff00.jpg
20:34FrozenlockWise man
20:34Frozenlocktechnomancy: Are you showing Clojure to your little ones yet?
20:45gfredericks,(defmethod print-method :print-fn [x pw] (.write pw ((-> x meta :print-fn) x)))
20:45clojurebot#<MultiFn clojure.lang.MultiFn@724356>
20:46gfredericks,(with-meta '(1 2 3) {:type :print-fn :print-fn #(str "#<I am a list with a " (first %) " >")})
20:46clojurebot#<I am a list with a 1 >
20:47gfredericksI think I've written that sort of thing a few times
20:49fifosine,(let [input "1"]
20:49fifosine (condp = input
20:49fifosine "0" "1"
20:49fifosine "1" "0"))
20:49clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
20:49fifosine,(let [input "1"] (condp = input "0" "1" "1" "0"))
20:49clojurebot"0"
20:49fifosineIs there a better way to write the above?
20:50fifosineSince there are only two possibilities, and they "switch"
20:50amalloyi mean, if this binary switching is a common pattern for you, you can make it into a function
20:50gfredericksfifosine: I always write that {"0" "1", "1" "0"}
20:51fifosinegfredericks: Just make a map, you mean?
20:51gfredericks,(def singleton-bitstring-flip {"0" "1", "1" "0"})
20:51clojurebot#'sandbox/singleton-bitstring-flip
20:51gfredericks,(let [input "1"] (singleton-bitstring-flip input))
20:51clojurebot"0"
20:53gfredericks,(def ? (fn [_] (rand-nth [true false])))
20:53clojurebot#'sandbox/?
20:55gfredericksapparently this is what I do when there's tedious code I need to write
20:55technomancyFrozenlock: no, sticking with racket and scratch so far
20:55technomancyclojure has too much incidental BS
20:55arrdemverma: nope that's existing. the last color scheme I built to look like emacs... "got replaced" with what is now used for my blog and Grimoire
20:56fifosine,(map {"0" "1" "1" "0"} "01")
20:56clojurebot(nil nil)
20:56fifosinemmm
20:57gfrederickschars
20:57fifosine,(map {\0 \1 \1 \0} "01")
20:57clojurebot(\1 \0)
20:58fifosinegredericks: So I string is really a list of chars?
20:58gfredericksno
20:59gfredericksa string gets turned into a list of chars if you pass it to a function that expects a seq
20:59hiredmangfredericks: I tend to start writing abstract machines to execute code in other languages that already do the tedious stuff before remembering I need to get this stuff through code review at some point
20:59Frozenlocktechnomancy: any chance of seeing racket used for 'real' stuff?
21:00technomancygfredericks: proof: https://twitter.com/hiredman_/status/423167878326530048
21:00gfredericks,(->> "01110101001" (map {\0 \1 \1 \0}) (apply str))
21:00clojurebot"10001010110"
21:00hiredmanI started writing a secd machine to execute ruby today using jruby's parser, which was a terrible idea since I don't really know ruby
21:00technomancyFrozenlock: by me specifically?
21:00FrozenlockNo, just in general.
21:01FrozenlockI tried it once and remember it was interesting, but nothing more...
21:01technomancyFrozenlock: sure, it's definitely the most practical of any scheme
21:01hiredmanand this gem is really just a wrapper around shelling out to a binary, which I should just do
21:01FrozenlockHmmm
21:01FrozenlockShould take another look.
21:01technomancyFrozenlock: the main downside is that all their web stuff goes on and on about how continuations are such a great model for web sessions
21:01technomancywhich is pretty annoying
21:01technomancybut apart from that it's really nice
21:02technomancylibs are weak compared to clojure, but getting better
21:03gfrederickshiredman: TIL SECD
21:03gfredericksyou wrote this in clojure?
21:03hiredmanI started to
21:04hiredmanto be honest it started as a CESK machine
21:05gfredericksthis is so hipster it doesn't even have its own wikipedia article
21:07gfredericksI wrote a lazy BF interpreter the other day
21:08gfredericksjust because somebody was in here talking about it
21:17hiredmanactually http://matt.might.net/articles/oo-cesk/ could run a lot of ruby off the bat I think
21:24fifosine,(map (partial take-nth 2) '("1122" "1122"))
21:24clojurebot((\1 \2) (\1 \2))
21:24fifosineIs a partial necessary here, or is there another way to write this without using a partial?
21:29amalloynaturally, fifosine, there are arbitrarily many ways to write it. for example, you could use #(), or a for-comprehension
21:29Frozenlockhttp://racket-lang.org/download/docs/6.0.1/html ---> > ((uncaught-exception-handler)
21:29FrozenlockWow, worse than Clojure docs! :-p
21:29amalloyon the less practical things, you could write a prolog interpreter and then write a prolog program that does what you want
21:29fifosineamalloy: Is what's written above idiomatic?
21:30amalloyperfectly reasonable. i probably would write instead (for [s ["1122" "1122"]] (take-nth 2 s)), but there's nothing wrong with yours
21:32dbaschI would write [[\1 \2] [\1 \2]] :)
21:33amalloy,(map list "11" "22")
21:33clojurebot((\1 \2) (\1 \2))
21:44gfredericks,(repeat 2 '(\1 \2))
21:44clojurebot((\1 \2) (\1 \2))
21:45gfredericks,(->> (repeat (range)) (map #(map str %)) (map #(map first)) (map rest) (map #(take 2 %)) (take 2))
21:45clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval51/fn--54>
21:45gfredericks,(->> (repeat (range)) (map #(map str %)) (map #(map first %)) (map rest) (map #(take 2 %)) (take 2))
21:45clojurebot((\1 \2) (\1 \2))
21:46gfredericks^ if you're not starting with an infinite seq of infinite seqs you're doing it wrong
21:54fifosineIs there a way to stop println from trimming strings?
21:57fifosinenvm
22:00fifosineIf nobody minds code-reviewing this small code snippet for idiomatic clojure, efficiency, style, that'd be awesome. http://www.reddit.com/r/dailyprogrammer/comments/2avd5i/7162014_challenge_171_intermediate_zoom_rotate/cizl682
22:02dbasch~flatten
22:02clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
22:03fifosinedbasch: ok, I'll remember that, thanks!
23:39SubapicalHello, transitioning from Scheme to Clojure
23:39SubapicalSo far, so good