#clojure logs

2015-03-29

13:43danlentzI'm self taught, so I'm quite aware of what a prick I can be as a teacher.
13:46danlentzAlso as a student. Hmmm.
13:46justin_smithdanlentz: realizing I can be a jerk has been a repeated theme as I grow older, it comes back in so many nuanced varieties.
13:48gfredericksit culminates at your death bed when you realized you never actually succeeded at not being a jerk at all ever not even once
13:48justin_smithhaha
13:48danlentzIn that final realization, you attain humanity
13:49danlentzWait, wasn't that what happend to Spock?
13:56joe124http://pastebin.com/dECUn04R why is this not tail position?
13:57joe124brb
13:57mavbozoparens solve everything?
13:57justin_smithjoe124: (( means you are calling something, then calling what it returns
13:58joe124ok i removed extra parens around the if statement?
13:58justin_smithjoe124: it's not tail position, because your code wants to call it
13:58justin_smithnow you'll likely see an error with (result ...) because result is a collection
13:59justin_smithwell, depending on the arg, I guess the arg could be a number, then you just get a nil...
13:59joe124i have an out of bounds exception
13:59justin_smithwhat do you intend (result(last coll)) to do?
14:00joe124i want to append the last element of coll to result
14:00justin_smithjoe124: how would clojure know you wanted that, and not calling result as a function?
14:00justin_smithbecause that syntax means a function call, right?
14:00joe124well earlier result was defined as []
14:00joe124and [] is a function
14:01justin_smithyes, but it doesn't do what you want
14:01joe124should i use conj or something
14:01justin_smith,([] 3 :out-of-bounds)
14:01clojurebot#error{:cause "Wrong number of args (2) passed to: PersistentVector", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: PersistentVector", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval25 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compi...
14:01justin_smithoops
14:01danlentz(foo ) invokes a function foo
14:01justin_smith,([] 3)
14:01clojurebot#error{:cause nil, :via [{:type java.lang.IndexOutOfBoundsException, :message nil, :at [clojure.lang.PersistentVector arrayFor "PersistentVector.java" 152]}], :trace [[clojure.lang.PersistentVector arrayFor "PersistentVector.java" 152] [clojure.lang.PersistentVector nth "PersistentVector.java" 156] [clojure.lang.APersistentVector invoke "APersistentVector.java" 283] [sandbox$eval49 invoke "NO_SOUR...
14:01justin_smithso that's your error
14:01joe124yes
14:02justin_smithjoe124: so yeah, ##(conj [] 3) is likely what you want
14:02lazybot⇒ [3]
14:03danlentzIt would be funnier if somehow the Chinese could launch an attack on Gravatar and give us embarrassing icons
14:03joe124ok cool it worked, but i had defined result as []. So why does it work when the input is a list?
14:04justin_smithjoe124: can you rephrase that?
14:04joe124https://www.4clojure.com/problem/23#prob-title
14:04justin_smithdo you mean, how can it take things out of a list and put them in a vector?
14:05joe124(= '(1 2 3) [1 2 3]) ?
14:05justin_smith,(= '(1 2 3) [1 2 3])
14:05clojurebottrue
14:05joe124ok well that solves that haha
14:05gratimaxwhen checking for equality, you don't care about the type of the sequence
14:05justin_smithjoe124: my favorite definition for reverse is (partial into ())
14:05justin_smithjoe124: but that is way over your head for now
14:06joe124ok let me look up partial and into then maybe u explain it to me?
14:06justin_smithjoe124: sure, feel free to ask any follow up you need
14:08danlentz,((partial into ()) (range 8))
14:08clojurebot(7 6 5 4 3 ...)
14:08justin_smithdanlentz: of course as a literal you can just do ##(into () (range 10000))
14:08lazybot⇒ (9999 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9... https://www.refheap.com/99036
14:09ggherdovHello. I googled "rest api clojure" and got to https://mmcgrana.github.io/2010/08/clojure-rest-api.html (the post is from 2010)
14:09ggherdovquestion: in the toy example the author wraps the data he's exposing over the API in an atom.
14:09ggherdovIs that because he wants to prevent concurrent http requests to have inconsistent views of the data? Is that what one would do in a "real world app" as well, where the data comes from a db?
14:09tahmidWhen’s a good time to learn macros ?
14:10justin_smithggherdov: I think the atom is just for representing a state that PUT etc. can manipulate
14:10swarthyggherdov: He likely did it because he wanted a mutable piece of data that he could add to by hitting the rest API.
14:10danlentztahmid: we call that macroexpansion time
14:10swarthyggherdov: in production you would just update/read from your DB
14:10tahmidLOL
14:10ggherdovjustin_smith: swarthy: ah right
14:11danlentzYou should be really comfortable using functions
14:11justin_smithggherdov: but, bigger picture, in clojure we almost always put something that we expect to mutate in runtim inside an atom, or ref, or agent, because they have good behavior when interacting with updates from multiple threads
14:11ggherdovjustin_smith: ok
14:11tahmidI am really comfortable using funcions
14:11justin_smithso in that sense you are right, we could have used a mutable java data structure or class instead, but it would not likely be as well behaved
14:12justin_smithtahmid: I'd use macros when you have the functionality dialed in, but usage is clumsy and could be fixed if you could modify syntax
14:12tahmidI mean when should one try to solve something with macro ?
14:12danlentzThe best way to approach macros is to look at examples and build up practice examples
14:12justin_smithtahmid: for example not needing to quote an arg, or just specifying optional forms instead of functions to call as args
14:12tahmidjusting_smith: Okay, got my ans
14:12danlentzWhen it cannot be done with a function
14:13joe124,((partial into ()) '(1 2 3))
14:13clojurebot(3 2 1)
14:13tahmidCool
14:14mavbozo,into
14:14clojurebot#object[clojure.core$into "clojure.core$into@2f18c986"]
14:14mavbozo,(doc into)
14:14clojurebot"([to from] [to xform from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied."
14:14joe124,((into ()) '(1 2 3))
14:14clojurebot#error{:cause "Wrong number of args (1) passed to: core/into", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (1) passed to: core/into", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 32] [sandbox$eval93 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784...
14:14danlentzWhen you are in some way looking to change the normal syntax of clojure
14:14joe124,(into () '(1 2 3))
14:14clojurebot(3 2 1)
14:14joe124,(into () [1 2 3])
14:14clojurebot(3 2 1)
14:14oddcully,(doc conj) ?
14:14clojurebot"([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
14:15justin_smith,(into '(1 2) 3) ; joe124
14:15clojurebot#error{:cause "Don't know how to create ISeq from: java.lang.Long", :via [{:type java.lang.IllegalArgumentException, :message "Don't know how to create ISeq from: java.lang.Long", :at [clojure.lang.RT seqFrom "RT.java" 506]}], :trace [[clojure.lang.RT seqFrom "RT.java" 506] [clojure.lang.RT seq "RT.java" 487] [clojure.core$seq__4079 invoke "core.clj" 135] [clojure.core.protocols$seq_reduce invoke ...
14:15justin_smithoops, I mean ##(into '(1 2) [3])
14:15lazybot⇒ (3 1 2)
14:16joe124since lists and stuff are immutable does into do the exact same thing as reverse
14:16mavbozo,((partial into []) '(1 2 3))
14:16clojurebot[1 2 3]
14:16danlentzMacros (generally) operate programmatically on the source code of your program, rather than directly contributing to computing the result
14:16tahmidthat’s why I am scared of macros
14:16joe124if you write your macro wrong it will delete your program
14:17justin_smithjoe124: the implementation is not exactly the same, but the behavior is
14:17joe124and auto save over it
14:17danlentzDelete your program?
14:17tahmidI read in somewhere that I should always prioritize data over functions over macros
14:18mavbozoi am still scared of macros
14:18justin_smithjoe124: do you know about clojure.repl/source ? if you look at the source of reverse, and the source of into, you should be able to see that (partial into ()) and reverse are very close to being identical when you go down a couple layers
14:18justin_smithtahmid: that is solid advice
14:18justin_smithmavbozo: that's healthy
14:19tahmidI understand the function part
14:19tahmidBut how can data > function
14:19danlentzMacros are really nice in clojure
14:19justin_smithtahmid: there are a lot of things we can do with data, that we can't do to functions
14:19tahmidI mean datas are just data
14:19tahmidexample pls
14:19justin_smithand similarly, there are a lot of things we can do with functions, that we can't do with macros
14:22justin_smithtahmid: ##(do (require 'clojure.walk 'clojure.string) (clojure.walk/postwalk (fn [x] (if (string? x) (clojure.string/reverse x) x)) {"hello" {:a "world"}})
14:22Jaoodtahmid: why do you mean by data? functions operate on data
14:23justin_smithtahmid: we can scramble, reorganize, store and retrieve, query from users, aggregate and analyze
14:23justin_smithtahmid: you don't have the same flexibility with functions
14:23bbloomwhen clojure ppl say "data" in this context they are referring to a particular style of data
14:24justin_smithwe don't even have useful equality predicates for functions, other than object identity
14:24tahmidWoW never thought of that way before
14:24bbloomin particular, 1) immutable values with 2) structural equality and 3) printable/readable representations
14:24justin_smith(inc bbloom)
14:24lazybot⇒ 51
14:24justin_smithvery important point, thanks
14:24tahmidYes you are write I can store pass and scramble data
14:24justin_smithyup
14:24mavbozo(inc bbloom)
14:24lazybot⇒ 52
14:24tahmidlol what am I writing
14:25justin_smiththen, functions we can compose, pass as first class values at runtime - these things don't work so nicely with macros
14:26tahmidguys why are you increasing people’s name ?
14:26tahmidoh I get it
14:26justin_smithtahmid: fake internet points
14:26tahmid(inc bbloom)
14:26lazybot⇒ 53
14:26tahmid(inc justin_smith)
14:26lazybot⇒ 224
14:27danlentzCL can pass macros as first class values
14:27swarthythere are some pretty cool white papers on something called Language Oriented Programming that I read recently. They have altered my views a bit such that now I ask, "Can I solve this problem with Clojure the language?" When the answer is no, I then create the missing piece of the language with a macro. The answer however is usually: yes I can do it in clojure.
14:27danlentzWell, there is macro-function
14:28danlentzswarthy: that's what I love about lisp
14:28bbloomdanlentz: macro-function isn't exactly what ppl would consider first class macros
14:28danlentzYes
14:28danlentzbbloom: I was sorry I made the point
14:29bbloomdanlentz: we can do macro-function in clojure too
14:29danlentzFirst class macros are FEXPRS
14:29bbloom@(find-var `binding)
14:29bbloomdanlentz: fexprs are a little different than first-class macros too
14:30bbloom,@(find-var `binding)
14:30clojurebot#object[clojure.core$binding "clojure.core$binding@5996f646"]
14:31bbloom,(@(find-var `binding) nil nil '[x 1 y 2] '(+ x y)) ; heh, don't try this (impl detail) at home
14:31clojurebot(clojure.core/let [] (clojure.core/push-thread-bindings (clojure.core/hash-map (var x) 1 (var y) 2)) (try (+ x y) (finally (clojure.core/pop-thread-bindings))))
14:33danlentzYes I see regarding FEXPRS
14:34danlentzSomething I've clearly not gotten to use in real life
14:35bbloomi'm not sure anyone in the last few decades has really :-)
14:35danlentzKernel
14:35danlentzI think it's called.
14:36danlentzhttp://web.cs.wpi.edu/~jshutt/kernel.html
14:37bbloomthere's no "real life" implementation of it, for a value of "real life" that equals "actually useful"
14:37bbloomdanlentz: i've built a handful of kernel-style interpreters ;-)
14:42danlentzThere was an experimental build of SBCL a few years ago I think, but obviously it was just a curiosity
14:46tahmidis ed an editor for clojure ?
14:46justin_smithed is a text editor, and I think it is mocked more often than used
14:46justin_smithit doesn't have any language specific features
14:49justin_smithif I had to use an editor from within my repl, I would probably pick ed
14:50tahmidI was reading clojure irc log and someone mentioned ed
14:50bensuDoes anybody have experience with the timber logging library?
14:50ticking_timbre?
14:50justin_smithtahmid: it was probably a joke
14:50clojurebottimbre is awesome if you are tired of java logging (c.f. java logging)
14:50bensuticking: yeah! timbre
14:51ticking_bensu: yeah it's nice
14:53bensuticking_: I'm thinking of storing my logs in DynamoDB or S3. Do you think I'll can with timbre?
14:54bensu*I'll be able
14:54justin_smithbensu: yeah, that can be done, it's just a clojure-friendly config frontend for java logging
14:54justin_smithand java can log to just about anything
14:55bensujustin_smith: I thought it was *all* Clojure and that clojure.logging was the wrapper over java
14:56ticking_bensu: yeah you can just write a custom appender
14:56ticking_https://github.com/ptaoussanis/timbre/tree/master/src/taoensso/timbre/appenders
14:56justin_smithbensu: timbre uses jvm logging
14:56ticking_a bunch of example appenders
14:58bensujustin_smit: I guess I misread the README. I'm not sure what "Small, uncomplicated all-Clojure library." means
14:58bensujustin_smith: I thought that meant it implemented it's own thing.
15:00bensuticking_: thanks, I looked at those but I'm not yet familiar with the abstractions, so I don't really understand the code.
15:00bensuticking_: I'll have to dive in and try until I get it.
15:00bensuticking_ justin_smith: Thanks for your help!
15:01ticking_justin_smith: I don't think so, timbre doesn't use java logging internally
15:01ticking_bensu: you're right I think
15:02ticking_bensu: tibre has this simple concept of appenders, which is just a function that will get called when a log occurs
15:02ticking_you can do whatever you want in there
15:02ticking_it's also doccumented in the timbre readme
15:03justin_smithticking_: hmm, I was looking for the proof that it used java logging, but yeah, not finding it - I'll have to figure out how I got confused
15:03justin_smithticking_: I wonder if this changed at some point?
15:03ticking_would have to be a long time ago I guess
15:03ticking_I fixed a big a 2 years ago or something like that, and it wasn't using logging back then I think
15:04justin_smithticking_: in that case I was just wrong, thanks
15:04danlentzI recently had a pretty unpleasant experience with log4j/slf4j
15:05justin_smithI have a syslog appender in caribou.logger that I should totally adapt for timbre and submit there
15:05ticking_justin_smith: There are mentions of tool.logging all thoughout the codes comments though :/
15:05justin_smithticking_: that could be it - via tools.logging it can end up using log4j ?
15:05ticking_yeah I think so
15:06danlentzIn general. Nothing specific, but some really sticky conflicts in transitive dependencies with Datomic
15:06justin_smithwhen was tools.logging made optional? that would make me feel less stupid if that was some time in the last year or so
15:07justin_smithanyway, syslog appending is handy, I should submit that to timbre
15:07danlentzjustin_smith: you are caribou?
15:07justin_smithdanlentz: not the founder, but one of the core devs
15:07danlentzNice
15:08justin_smithdanlentz: we lost our corporate funding, so it hasn't been as active in the last year or so
15:09danlentzIf people ask why the project is not more active, just tell them it's because the code is already near perfect
15:09justin_smithoh man I would die of hypocrisy
15:10danlentzIve seen great deal of evidence that hypocrisy is not fatal.
15:11danlentzI thought it had a nice "product launch"
15:11danlentzVery clean, well presented
15:12tahmidMe too
15:12tahmidI wanted to use caribou in prod
15:13tahmidBut later used plain ring
15:13danlentzI think you guys go about this ass-backwards. I'm going to pick the animal first, then come up with some kind of software to write for it to represent
15:14danlentz(Going off to create http://github.com/danlentz/clj-naked-mole-rats)
15:15tahmid(page-not-found github is under ddos )
15:17danlentztahmid: sorry i was just joking about all of the animal-named projects
15:18justin_smithdanlentz: tahmid: thanks, patchwork definitely put a lot of work into the docs and the frontend design
15:18justin_smithdanlentz: no joke, this is really how caribou was named
15:18justin_smiththere was a big taxidermied caribou head on the wall
15:19justin_smithso the lib got named after it
15:19danlentzHa poor caribou
15:19justin_smithpatchwork is a genius and or madman when it comes to naming things
15:20justin_smiththere are certain strings that if you google them are only found in caribou source, and in irc logs asking what the hell the names in the caribou source mean
15:20justin_smith:)
15:20danlentzThe small print: "Very few animals were beheaded during the implementation of this web framework"
15:21justin_smith$google jopotonio
15:26bensujustin_smith: I didn't know of caribou, it looks pretty cool
15:27justin_smithbensu: thanks, it's very opinionated, but as a bonus it gives you a GUI admin for your data (including modeling data in the gui, and defining routes and pages in the gui and defining where they get their data) right out of the box
15:27bensudalentz: so log4j doesn't play well with Datomic
15:27danlentzlog4j/slf4j is used internally by datomic
15:27justin_smithbensu: in fact, it might be worthwhile to just modularize that admin to be used as a CMS / RAD tool.
15:28tahmiddanlentz: is there any uuid generator for cljs ?
15:28bensudalentz: got it. explains the conflict.
15:29danlentzso if you have another dependency which requires a different version, you have to do a hairy :exclusions kind of thing
15:29bensujustin_smith: I'm definitely gonna checkout the src since the admin side of things is universal
15:29tahmidjustin_smith: how to modularize that admin to be used as CMS / RAD tool ?
15:30danlentztahmid: good question
15:30justin_smithbensu: well, specifically the way you can define pages / routes etc. in the admin requires some integration, at least with your routing layer
15:30justin_smithtahmid: it is alreayd a CMS / RAD tool, but it would need an adaptor layer to use it with your favorite routing lib, template lib, etc. since otherwise it can't help your with those things.
15:31justin_smithor you can just use caribou. and then use polaris, and antlers, and all these work together already and you have a framework.
15:31justin_smithof course
15:31danlentzhoo-hoo antlers
15:32justin_smithor use the CMS but not its page definition functionality
15:32justin_smithand just use it for data modeling / content entry
15:32justin_smithmaking it slightly less convenient
15:33tahmidThis is the missing part of my clojure web-dev tools
15:33tahmidI find myself moving to django for the admin panel they provide
15:33danlentzin the java mentality if software is not constantly being patched and rewritten it must not be any good
15:33tahmidand then come back to clojur e
15:33justin_smithtahmid: well caribou is out there, and you can use it, and the docs are very good
15:34justin_smithtahmid: we took a lot of ideas from django actually
15:34tahmidWhat I don’t like about caribou is it’s very tightly coupled
15:34justin_smithwe were working on that...
15:34tahmidi want to use aleph with compojure + caribou admin panel
15:34danlentzi think the idea that software may just work well and be stable does not usually occur
15:34danneupgadmin is my admin panel
15:34justin_smithtahmid: like I said, you totally can just use the admin (plus the data modeling in core) and skip the rest
15:35tahmidI would definitely like to help with modularizing the admin panel
15:35tahmidOkay I am giving it a try now
15:35tahmidThanks
15:36justin_smithtahmid: oh, that would definitely be welcome. I still am in #caribou last I checked, and will gladly answer any questions that will help get you up and running with that.
15:42gfrederickshello
15:43justin_smithfancy seeing you here
15:44not-much-ioDoes anyone know why clojure.org is so "bare bones"? I visited haskell.org and felt motivated to learn the language based on the cool homepage. It makes haskell look cool! Superficial reason I know. Still for new people it might be offputting to see this new language they are interested having such a boring homepage. People can be quite shallow like that sometimes. :)
15:45bbloomnot-much-io: clojure.org is actually useful
15:45bbloomit's just for a different audience
15:45Frozenlockbbloom: it is? I always considered #clojure to be the official doc.
15:46bbloomFrozenlock: the documentation on clojure.org is excellent
15:46justin_smithnot-much-io: I think it's a very different (and pragmatic) design approach.
15:46bbloomit's clear, succinct, and correct
15:47justin_smithnot-much-io: I think haskell.org is optimized for your first visit, clojure.org is optimized by your 10th visit, and all following visits
15:47justin_smithFrozenlock: on that note, clojure.org does have a link to this irc on its front page
15:48joe124,(reverse (seq "abc"))
15:48clojurebot(\c \b \a)
15:48not-much-iobbloom: I have not really looked at haskell.org in any depth but it SEEMS to be quite "content rich", under the documentation tab and news tab :)
15:48joe124(reverse "abc")
15:48justin_smithjoe124: the seq call there is redundant
15:48tahmidclojure.org is simple made easy
15:48joe124,(reverse "abc")
15:48clojurebot(\c \b \a)
15:48justin_smith,(apply str (reverse "abc"))
15:48clojurebot"cba"
15:48Frozenlockjustin_smith: and the cheatsheet points to clojuredocs
15:49bbloomnot-much-io: justin_smith is definitely right about visit # optimization. the haskell docs page has a big list of books, courses, tutorials, etc
15:49joe124in 4clojure problem 27 #(= % (reverse %)) does not work while #(= (seq %) (reverse (seq %)) ) does work
15:49not-much-iojustin_smith : Well would it become less pragmatic and useful with some added css? *honest question*
15:49bbloomthe references are buried on that page & not really highlighted
15:49bbloommost haskellers know to use hoogle
15:50bbloomand hackage refs
15:50justin_smithnot-much-io: it's a good question, it might be worth trying some variant designs and proper UX research to see what is most effective
15:50bbloomnot-much-io: by adding visual design, you make information design more rigid
15:51mavbozonot-much-io: is clojure.com style much more preferable to you?
15:51justin_smithnot-much-io: my impression is that it may not feel "impressive" but the things that catch my eye when I glance at the page are the useful things I would be looking for
15:51bbloomas it is, Alex Miller (among others) can make changes to clojure.org trivially w/o having to worry about messing up a beautiful page layout
15:52justin_smithbbl, lunch
15:52bbloomthe more visual polish you put in to things, the harder they are to change, so you should delay doing it until you understand the information design
15:52bbloomand then you have to ask: what value do i get from spending the effort on visual design?
15:52not-much-iomavbozo : It's kind of what I was thinking.
15:52mavbozonot-much-io: haskell.org website is built from scratch, clojure.org is built from wikispaces
15:52bblooma few more low quality community participants? *shrug*
15:53mavbozoi think there is a limitation in wikispaces though
15:53bbloomif you want high quality design, check out the cognitect pages
15:53bbloomhttp://cognitect.com/clojure
15:53bbloomthe mission there is to sell you clojure and services
15:53bbloomoptimized for first visit
15:53joe124https://www.4clojure.com/problem/27 why doesn't it work with #(= % (reverse %))
15:53not-much-iobblook: I have to say, you've made your point about trading information manipulation ability for eye candy
15:53dnolennot-much-io: people are aware of the issue, the lack of an attractive official ClojureScript website is also annoying. Hopefully will eventually get addressed.
15:54dnolennot-much-io: there's no real reason other than, it's a lot of work and hasn't been made a priority
15:55Frozenlock"a few more low quality community participants? *shrug*" o_O
15:55bensuFrozenlock: what do you mean?
15:56justin_smithjoe124: (reverse "racecar") is not equal to "racecar"
15:56not-much-ioThanks for the info, I suppose it really is just a pragmatic decision as I suspected. And nice to keep cognitect.com/clojure in your backpocket for showing friends :)
15:56FrozenlockI'm surprised by this sentence. I find it harsh.
15:56bbloomFrozenlock: if a pretty picture is the difference between using clojure and not, then i'd rather not :-P
15:57bbloomi'm not discounting the value of visual design. i'm only making a statement about the value produced in this instance being low
15:57mavbozo,(reverse "racecar")
15:57clojurebot(\r \a \c \e \c ...)
15:58mavbozojoe124 ^not working for string
15:58joe124ok im getting it know
15:58bensuFrozenlock: I'm sorry, I missed the earlier comment (just found it)
15:59bensubbloom: is "You work for me, Computer" your blog?
15:59bbloombensu: yes
16:00bensubbloom: first, kudos on the blog, it's been the end of long google journeys a couple of times :)
16:00bbloombensu: heh, really? cool :-)
16:00bbloomthanks
16:00not-much-ioFrozenlock: Didn't mean to spark any controversy. I was just thinking to myself that a "pretty page" for a language would help getting young college kids more attracted to clojure
16:01not-much-ioDon't know if they count as "low quality community particiapnts" :)
16:01Frozenlocknot-much-io: Sure. IMO the best intro page for clojure is probably http://www.tryclj.com/ (depending on your background)
16:01bensubbloom: I'm surprised you find the value of visual design in this instance low, when your blog is quite good visually
16:03bbloommy blog and a programming language landing page are quite different
16:03not-much-ioFrozenlock : tryclj.com is just what I went with when showing some friends. :)
16:06mavbozonot-much-io: clojuredocs.org is also cool
16:06bensubbloom: I agree but it is still unexpected. In my experience people that produce a visually appealing blog tend to be strict about everything being visually appeling
16:06bensu*appealing
16:07bbloombensu: and here in the clojure community, you find people who understand that the world is available in shades of gray ;-)
16:07mavbozobensu: and use emacs
16:08bensubloom: sure, I agree. Do you really use vim?
16:09mavbozobloom: xmonad?
16:09not-much-ioFrozenlock: IMHO people, even otherwise smart, pragmatic and productive people can be easily swayed by a cosmestic reason. Our visual sense is our strongest sense afterall :) But I suppose their numbers are debatable. :D
16:09bbloombensu: yes
16:09bbloommavbozo: no
16:09mavbozobbloom: :)
16:09not-much-iomavbozo: clojuredocs is cool :P
16:10joe124i think the clojure landing page should be as visually appealing as possible to attract newbies
16:10Frozenlockjustin_smith: caribou looks very nice! Is it possible to have authentification in the API? Customer A login/password, customer B login/password...
16:10mavbozonot-much-io: as far as i know, clojure core actively encourages community contribution
16:10bensubbloom: I was in vim myself until evil-mode :)
16:10mavbozonot-much-io: maybe you could build a clojure-for-college-kids website
16:11mavbozonot-much-io: clojuredocs.org is the result of community contribution
16:11bbloomjoe124: i'd rather attract people who respect and nurture newbies. it's a slower growth strategy, but seems to produce good results :-)
16:11not-much-iomavbozo: Would if I could do it in a matter that would actually be visually as cool as clojure is conceptually :)
16:12mavbozoclojuredocs.org wasn't as beautiful as it is now
16:13bensunot-much-io: you would have to be very talented! :)
16:13oddcullyyeah, the design of the home page is really what makes a programming language viable...
16:14not-much-iomavbozo: Understood, I was just thinking today that I should offer to fix some example snippets I've seen using strange s-syntax. (braces on new lines) Just to contribute something :)
16:14adamhillspeaking of clojuredocs.org. Is search broken for everyone else?
16:14adamhillsearched for 'http' got 0 hits
16:15not-much-iooddcully: Please don't misunderstand, that is not what I am saying. Just a bit more appealing to quite a few newbies perhaps.
16:15mavbozoadamhill: me too, search http also got 0 hits
16:15not-much-iobensu: Awfully talented! :)
16:16andyfadamhill: Safari doesn't work in my experience. Firefox is better there
16:16adamhillok, other core things do return something, so just a gap in the knowledge base
16:17andyfClojureDocs is not comprehensive on libraries
16:17mavbozonot-much-io: great!
16:17oddcullynot-much-io: you mean: let's use bootstrap
16:23not-much-iooddcully: No, I am not saying to do anything, just asking about the reason. If it was just that noone got around to doing it I thought maybe I would lend a hand. (ever so slightly as my skill would allow it) But as was made clear, and I agree, that the versatility of the page's content would be limited by "styling". There are other more visually appealing sites for the "first look" effect :)
16:24oddcullynot-much-io: i'm just pulling your leg
16:25oddcullyit really p*sses me off, when usability get's sacrificed for "mobile first" or "da appeal". like e.g. with elasticsearch recently
16:28not-much-iommm, dat css
16:28not-much-iojkjk
16:29mavbozooddcully,: elastic.co ?
16:30oddcullyyes. it seams they have paddeld back. you can search again without javascript
16:30oddcullyin the recent days of the change you had to remove some full-site-overlay divs
16:37justin_smithFrozenlock: just got back, yes, you can have arbitrary role based auth, where you have multiple users and each have apropriate roles
16:37justin_smithFrozenlock: one of these days I may even plug it into friend
16:38justin_smithand thanks
16:42danlentzi for one would not complain if someone were to spend some time on the clojure site/documentation
16:44danlentzand generating clojuredoc style documentation really isn't as easy as "lein doc" with codox for example
16:45Frozenlockjustin_smith: I'm trying it and loving every bit so far.
16:45justin_smithFrozenlock: awesome!
16:45mavbozodanlentz: most of active denizens here like justin_smith already wrote one such as this http://conj.io/store/v0/org.clojure/clojure/1.7.0-alpha4/clj/clojure.core/defmulti/
16:46andyfAlex Miller has spent nontrivial hours on adding text to the docs on clojure.org over the past year or so. Not saying he is finished, and I don't know what future plans might be, but the content there has improved.
16:47mavbozodanlentz: and andyf too also actively wrote in clojuredocs.org
16:47mavbozo*writes*
16:48andyfThere is a preference for concise docs on clojure.org and official doc strings that will likely never change. Other doc sites can be more verbose, like ClojureDocs.org, which is easy for anyone to edit in bits and pieces.
16:49mavbozo,(doc future-cancel)
16:49clojurebot"([f]); Cancels the future, if possible."
16:50hyPiRionOh no, time freezes yet again
16:50danlentzwell, as a language it seems that (and Im just speculating) the lack of an explicit specification is at odds with the direction clojure has taken towards implementations across various platforms
16:52andyfAnyone that wants to can try writing a spec :). I would not expect clojure core team to want to spend time on such a project.
16:52danlentzno. i wouldn't want to be the guy to do it. Im just saying I think lets not undersell the value of _having_ such a thing if it were possible
16:54arrdemdanlentz_: core will never write a spec I suspect.
17:00gfredericksthat'd be an interesting thing to try to sell for bundling with clojure 2.0
17:00gfredericksin particular taking the opportunity to break a few things in the name of a simpler spec
17:00arrdemI would agree.
17:01Bronsai'd rather have a more open development process than a spec
17:03bbloomgenuine question: why do you want a spec?
17:04Bronsabbloom: have you ever used IPersistentMap in your code?
17:05andyfGuess: a more precise spec gives more guarantees on behavior than docs that leave much behavior unspecified.
17:05bbloomBronsa: only after making a portability/compatibility risk tradeoff :-)
17:05Bronsaor any of the c.l interfaces that you kinda know you can use, but there's actually no *guarantee* of it
17:06bbloomBronsa: well there is a guarantee of binary compat for public java code
17:06bbloombut it's a microsoft/sun style promise, rather than a source compatability promise
17:06bbloomwhich is a separate thing from portability between implementations
17:07Bronsabbloom: afaik the only public java api is c.l.ifn and c.java.api.clojure
17:08Bronsaeverything else is technically implementation details
17:08bbloomBronsa: yes, but rich & alex have gone out of their way to preserve binary compat of the impl details
17:10bbloomhttps://groups.google.com/d/msg/clojure/BAlKtMB8pp8/F_4ru1ISf3sJ
17:11bbloomi also don't necessarily buy the argument that having a spec would improve the situtation
17:11bbloomthe spec would simply neglect to mention implementation details that you'd then have to make the same cost/benefit risk tradeoff decision about
17:11bbloomw/o any material new info
17:12danlentzwow
17:13bbloomwhat's so wow?
17:13danlentzI think a spec would go a long way toward advancing clojure in a number of ways
17:13bbloomi'm not arguing against having a spec, i'm arguing that the spec would be useful for the IPersistentHashmap interface Bronsa mentioned
17:13bbloomhappy to hear other arguments
17:15danlentzi mean, I'm not talking about creation of the CLJHS (or at least not in the image of CLHS)
17:15Bronsabbloom: my only other argument is the usual "metadata is evaluated weirdly, also :tag" one :P
17:15bbloomBronsa: lol, metadata :-P
17:15danlentztype hinting
17:16hyPiRionThere are some funny edge cases lying around
17:16hyPiRion,(#(`{~@% ~@%&} %) 1 2 3 4)
17:16clojurebot#error{:cause "Don't know how to create ISeq from: java.lang.Long", :via [{:type java.lang.IllegalArgumentException, :message "Don't know how to create ISeq from: java.lang.Long", :at [clojure.lang.RT seqFrom "RT.java" 506]}], :trace [[clojure.lang.RT seqFrom "RT.java" 506] [clojure.lang.RT seq "RT.java" 487] [clojure.core$seq__4079 invoke "core.clj" 135] [clojure.core$concat$fn__4166 invoke "core...
17:16danlentzbut at minimum we could specify what we intend to leave unspecified
17:16hyPiRionwhoops
17:17andyfHas an attempt and later abandonment of a Ruby spec hurt Ruby adoption?
17:17bbloomandyf: no, but i don't know if adoption was the objective
17:17Bronsa,(map meta ['^:foo [] '^:foo [1]])
17:17clojurebot(nil {:foo true})
17:17danlentzare we trying to be the most popular or the most useful/best?
17:18danlentzthe spec encourages implementations
17:18arrdemporque no los dos?
17:18danlentzi mean, without a spec what are you even trying to implement
17:19andyfClojure does not seem to be lacking in implementations.
17:20danlentzi think that their existence does not necessarily justify the conclusion that no specification is the most effective environment to nurture those implementations
17:22bbloom,(defn print-spec [] (->> (ns-publics 'clojure.core) keys (map #(eval (list 'doc (symbol "clojure.core" (name %)))))))
17:22clojurebot#'sandbox/print-spec
17:22bbloom,(print-spec)
17:22clojurebot("; " "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +" "([n]); Returns true if n is a BigDecimal" "([a new-state & options]); When an agent is failed, changes the agent state to new-state and then un-fails the agent so that sends are allowed again. If a :clear-actions true option is given, any actions queued on the agent that were bei...
17:22andyfdanlentz: Have you considered that specs can be a hindrance in some cases, too? They beget language lawyers :)
17:22danlentzyeah, language lawyering is painful
17:23bbloomdanlentz: the lack of a spec also meant that clojurescript could find a happy tradeoff
17:23bblooma clojure spec would have restricted clojure to provide features that may not have been possible on javascript runtimes
17:23bbloomor not possible with good perf
17:23Bronsait also meant that I wanted to kill myself twice a day when making sure t.a could handle both clj and cljs :P
17:23bbloomby writing a spec, you constraint what gets to be called "clojure"
17:24bbloomBronsa: would the existence of a spec have prevented that problem?
17:24rhg135it also means you can write code that works identically on all platforms
17:24danlentzwell, going forward can't we look ahead and anticipate what is going to be a reasonable set of abstractions to support?
17:24bbloomand if so, would the spec have had to existed before or after clojurescript was implemented?
17:25bbloomdanlentz: we can only look backwards to see which reasonable set of abstractions have been supported successfully
17:25rhg135how about a versioned spec?
17:25rhg135say when clj only existed we had 1.0 then cljs came and it's 1.1
17:26bbloomrhg135: but you're proposing a solution to a problem with a solution that hasn't been successfully motivated by a problem :-P
17:26bbloomi ask again: what benefit does a spec provide us?
17:26andyfPerhaps the spec could be versions with sha1 values? (ducks)
17:27arrdem(inc andyf)
17:27lazybot⇒ 26
17:27danlentzi mean, as a developer I would love to have definitive language to refer to in addition to the "few well chosen example" approach of the clojure doc
17:27bbloomdanlentz: the doc strings in clojure.core are definitive
17:27danlentzdo they tell me how to type hint?
17:27rhg135i know that, andyf, that's just my view on a way a spec would be useful and maintainable
17:27andyfAlbeit sometimes leaving details unspecified
17:27bbloomno, but type hints differ between clojure and clojurescript
17:27Bronsabbloom: it would have probably made some of the problems I had to work around, somebody else's problems when implementing cljs
17:28bbloomso type hints wouldn't have been covered in this theoretical hint anyway
17:28Bronsabbloom: type hints are dialect-specific things though
17:28bbloomBronsa: as far as i'm concerned, your implementations are specs
17:28danlentzthey should be documented as unspecified
17:28rhg135type-hints are details anyway
17:28rhg135mainly for performance
17:29bbloomdanlentz: but how were we to know apriori the ways in which type hints would or wouldn't map to other platforms?
17:29danlentzwell, details are not important in documenting a language
17:29Bronsarhg135: it stops being details when you need that performance and they don't do what you'd expect them to do
17:29danlentzwe could say where they belong
17:29bbloomthe danger of writing a spec is that you screw up and now it's a spec
17:29bbloomthe if you change it, ppl get pissed you broke it
17:29danlentzwe could say what the syntax of defn should look like
17:30bbloom(doc defn)
17:30clojurebot"([name doc-string? attr-map? [params*] prepost-map? ...] [name doc-string? attr-map? ([params*] prepost-map? body) + ...]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata. prepost-map defines a map with optional keys :pre and :post that contain collections of pre or post conditions."
17:30bbloomthe syntax is defined there
17:30arrdembbloom: without the spec you have the same problem. Imagine the ire if defn got changed in 1.7.
17:30bbloom,(-> #'defn meta :arglists)
17:30clojurebot([name doc-string? attr-map? [params*] prepost-map? ...] [name doc-string? attr-map? ([params*] prepost-map? body) + ...])
17:30danlentzso if i am returning a long where do i put the type hint?
17:31bbloomarrdem: sure, which brings me back to my question: what value does the spec provide us?
17:31TEttingeryou can't return a long on JS because JS doesn't have longs
17:31bbloomthe web is a place where we have 1) specs and 2) many implementations
17:31rhg135js is a prime example of a spec
17:31TEttingerinternet explorerjure!
17:31bbloomand i find the spec to be of significantly less value then mozilla's community maintained documentation, which records facts about implementations
17:31danlentzthe type hint can go on the var or on the arg vector
17:32danlentzif on the var, it cannot be primitive
17:32rhg135i'm not sure what the opposite would be
17:32danlentzif on the type vector, it must be fully qualified
17:32danlentzshow me where it says that in the clojure documentation
17:32TEttingerdanlentz: that's what's called a wart
17:32bbloomrhg135: js mainly benefits from being a spec b/c js code is trasmited as data to agents w/ unknown execution environments
17:32rhg135most languages have varying degrees of specs: from ansi to 'what is a spec'
17:32bbloomclojure doesn't have that use case
17:32jbizzlehey
17:32arrdembbloom: I would argue that we have an implicit spec in the form of the Clojure implementation which should be better rendered in the form of a clear document so that people like Bronsa and myself who are interested in making "near Clojure" langs have something more to work with and some idea of the extent to which we are breaking compat.
17:33danlentzso it should DEFINITELY be documented
17:33TEttingerand they've been meaning to change it, but it would break a lot of code
17:33jbizzlewhat us clojure
17:33TEttingerjbizzle: see topic
17:33rhg135bbloom: that's the key. one language, lots of platforms
17:33TEttingerit's a programming language
17:34bbloomrhg135: the fundamental distinction is whether the code runs on a KNOWN platform/implementation, or an *unknown* one
17:34bbloomyou'll notice that EDN has a spec
17:34danlentzthings and intents are left unspoken
17:34bbloomthat's b/c it's expected to be interpreted by unknown implementations
17:34jbizzleok ok
17:34danlentzeven if "everbody knows" how a particular implementation works
17:34bbloomwriting specs is 1) time consuming 2) difficult and 3) not without risks
17:34bbloomso you need a strong motivation, like with JS or EDN
17:34danlentzlooking at that in another context might not be so clear cut
17:35danlentzi think having things expressed explicitly facilitates the discussion that helps bridge those gaps
17:35bbloomarrdem: if you were trying to implement a scheme and the spec said "you must have tail calls" but your platform doesn't support them, well then, you're going to spend a whole hell of a lot of time trying to match the spec & dealing w/ ppl bitching you don't have tail calls
17:35rhg135i think we should start on a spec once we hit 150 platforms
17:36bbloomarrdem: now granted, if you tried to run some scheme code on your no tail calls platform, it would fail... but what if tail calls were spec'd LATER and all the code out there didn't rely on them?
17:36bbloomarrdem: like is the case with javascript
17:36danlentzwell lets not call the other languages "clojurexxxxx" then
17:36bbloomarrdem: if rich specs something, ppl like you will force yourself to adhere to the spec
17:36danlentzbecause clojure is defined by this one java implementation and that is what we should expect as clojure
17:37bbloomarrdem: and while admirable, that would be a detrimental effect to your experiments
17:37arrdembbloom: agreed, one of the many reasons I've abandoned calling my experiments "clojure".
17:37bbloomlook at pypy which runs some % of all python code, minus some c ffi stuff, and subject to dozens of caveats
17:37rhg135a good test suite should work
17:38bbloomrhg135: yes, i'd much prefer a portable test suite than a spec
17:38rhg135it'd be nice
17:38rhg135if you pass the clj suite, you're good. if not, no
17:38danlentzi think there is a very close relationship between a formal portable test suite and a spec
17:39arrdemdanlentz: loosely construed Curry/Howard, yes.
17:39bbloomdanlentz: there's a critical difference in my mind, which is that a spec aims to be exhaustive, or at least is treated as such
17:39bbloomtests are expected to not necessarily be comprehensive
17:40danlentzbut even with tests its important to understand test coverage
17:40danlentze.g. what is currently remains untested
17:40bbloomanyway, my position is not that a spec is a bad idea
17:40bbloomonly that it 1) is not without costs/risks and 2) would provide limited value for clojure
17:41danlentzjust as with a spec you are free to say what you are specifying, what is implementation defined, and what is undefined
17:41bbloomi'll also add that, in my career, i've never once encountered a spec that was widely implemented correctly by multiple independent vendors
17:41bbloomand i've coded to a lot of specs...
17:42danlentz"we all suck, so why bother trying..."
17:42bbloom"this isn't working, let's double down"
17:42danlentz:)
17:42mavbozoguys, how many pages needed to write a clojure spec? I guess it won't be that many cause clojure is a lisp
17:43bbloommicrosoft pushed the W3C to start publishing test suites, and surprise surprise, that seems to be working :-)
17:43mavbozoalgol-60 spec is 34 pages
17:43arrdemmavbozo: this is left as an exercise for the reader
17:46rhg135for the syntax? maybe a paragraph
17:46rhg135aside from the edn spec of course
17:46danlentzthere are actually other lisp specifications we can look at an learn from
17:48danlentzat minimum, do no worse
17:54danlentzthe way w3c tests sparql and ttl and n3 is really quite good
17:56danlentzalso the ansi-cl test suite demonstrates some very extensive and concerted effort to verifiably test an implementation and correlate the results with the standard
18:13justin_smithwow, this contributor agreement is weird (on google chrome, linux) http://i.imgur.com/YTTeTgn.png
18:14bbloomjustin_smith: *sigh* adobe....
18:14justin_smithinorite
18:16justin_smithI waited too long to sign this thing.
18:19gfredericksback in my day we could only sign contributor agreements with printers and pens and stamps and mailmen
18:20gfredericksbut we were happier then, though we were poor
18:20oddcullyweird and from adobe... that is odd
18:28brehautgfredericks: and we waited bloody months for international postage
18:29gfrederickshell yes we did
18:29gfredericksthen we had to email somebody at relevance to ask if they every got the letter
18:30gfredericksbut did we complain?
18:30gfredericksyes.
18:30gfrederickspretty much nonstop.
18:30brehautvocally, on the mailing lists
18:30oddcullyhaha
18:31Bronsagfredericks: it's a thing of the past now, let's find something else to complain about ;)
18:31bbloom:-)
18:31brehauttheres always jira
18:32gfredericksyeah why the hell do these unchecked functions do so much checking
18:33bbloomgfredericks: numerics are hard :-(
18:34gfredericksnumbers I will tell you what.
18:39justin_smithgfredericks: we should emulate the olive oil people and make extra-unchecked functions
18:40Glenjaminits mildly amusing that all computers can do is numbers
18:40Glenjaminand now we can't get them to do only that
18:42gfredericksjustin_smith: I can go for that
18:42gfredericks,(defn extra-unchecked-add [x y] (unchecked-add (long x) (long y)))
18:42clojurebot#'sandbox/extra-unchecked-add
18:53brehautjustin_smith: its like unchecked, but with a more pepper taste
18:55danlentzau-poive
19:01danlentzis there a particularly good resource to see a large number of examples of how to build various abstractions with the primitives of core.logic?
19:03danlentzi was really interested in screamer when working in common lisp but I had a look at the source code and porting it seems like a lost cause
19:05danlentzhttps://github.com/nikodemus/screamer
19:06danlentzfirst there is the issue of what seems to be a system of delimited continuations
19:06justin_smithdanlentz: could that be modeled with trampoline?
19:06danlentzsecond there is the issue that this macro system needs to pretty much account for the entire language
19:07danlentzbut if I could have a wish this would be it
19:09danlentzit is really an awesome tool
19:10danlentzalso (blush) i ported Screamer+ and gathered some extensions and documentation
19:10danlentzhttps://github.com/danlentz/screamer-plus
19:11danlentzby "ported" i mean de-allegrized it
19:14danlentzwell with atoms I would think
19:17danlentzIE, an unknown would be modeled as an atom with a watcher and when it became known, any logical implications of that would be reflected in an update to the other unknowns of the universe
19:17danlentzthe trick is to make that calculation lazy
19:27justin_smithsounds like a delay, not an atom
19:28justin_smithunless it can become known more than once
19:30danlentzno, retraction is complicated
19:31danlentzhttps://github.com/danlentz/screamer-plus/raw/master/doc/screamer.pdf
19:32danlentz"Screaming Yellow Zonkers"
19:32danlentzso the basic idea is "nondeterministic lisp"
19:36danlentzthis describes the screamer-plus extensions
19:36danlentzhttps://github.com/danlentz/screamer-plus/blob/master/doc/screamer-plus.pdf
19:37danlentzyes, delay
19:44danlentzi think there would have to be some adaptation of the concept to a model more conciliatory toward immutability, but I guess that has to be addressed with any layered extension to clojure for deductive logic
19:46danlentzbuilt up as a macro on top of funcall-nondeterministic
20:50ShayanjmI have a big vector containing center points of circles that need to be plotted. I'm running through them with map and plotting them with Incanter.
20:50ShayanjmIf I try running the same exact vector with pmap, though, it returns a wildly different result
20:51Shayanjmit's almost as if pmap doesn't actually run through the entire vector
20:51Shayanjmany reasoning re: why/how to rectify? I'd like to parallelize this if possible because there could be a non-trivial amount of plotting necessary in the future
20:52justin_smithShayanjm: I don't think pmap will help much because your GUI still only has one event loop to register all these shapes to display
20:52justin_smithunless calculating the actual display data is a CPU bottleneck
20:52justin_smithwhich I doubt
20:52justin_smith~pmap
20:52clojurebotpmap is not what you want
20:52Shayanjmjustin_smith: nah, no CPU bottleneck - though in the (near) future i'll be needing to make tons of API requests using these points
20:53Shayanjmso parallelizing that if possible would be very helpful
20:54justin_smithyeah parallelizing that would be good, but pmap has a hard baked strategy that assumes the task is CPU bound, not network bound
20:54ShayanjmGotcha. is there a well-adopted norm for parallelizing network stuff?
20:54Shayanjmor is it basically bake your own solution?
20:54justin_smithyou can use an async network client and feed the result into your GUI updating function
20:54ShayanjmThat works
20:55justin_smithalso the async network client will do fancy shit like keeping the http connection open for multiple requests
20:55justin_smithwhich is a big plus if you keep hitting the same host
20:55Shayanjmnice
20:55ShayanjmYeah definitely
20:55ShayanjmI'm psyched that my general solution packing function works as expected
20:56Shayanjmso any additional leg work on top to get it wired up is no problem
20:56justin_smithyeah, that's always cool
20:56justin_smithyou have the correct version, so now you can work on turning it into the fast version
20:56Shayanjmyup definitely
21:14prt44I've got a map keyed by a java.util.Date {d v d2 v2}, I'd like to convert to the map be keyed by year i.e. 2015, then the value is a nested map keyed by month with it's value the original value. Note the day is not really significant because it's always the last day of the month.
21:19andyfprt44: Check out group-by. You could start by making a function that extracts the year from a java.util.Date and using that in the call to group-by.
21:19andyfThen iterate on each value of the map created to do something similar with the month.
21:21andyfHmmm, not exactly what you asked for, but not too far from it.
21:21prt44andyf: thanks, I had been using reduce and update-in, but I'll experiment with group-by
21:26amalloygroup-by is probably going to be more work than reduce/update-in
21:27amalloy(reduce (fn [m date] (assoc-in m [(.year date) (.month date)] date)) {} dates)
21:27amalloyor however you get data out of Date objects
21:32justin_smithand change that assoc-in to an update-in / conj date if you would care about multiple pieces of data with the same month (which it sounds like you may not)
21:37justin_smith,(reduce (fn [acc date] (update-in acc [(.getYear date) (.getMonth date)] conj date)) {} (repeatedly 8 #(java.util.Date. (long (rand-int 1000000000)))))
21:37clojurebot{70 {0 (#inst "1970-01-01T19:42:43.552-00:00" #inst "1970-01-06T07:52:39.424-00:00" #inst "1970-01-07T06:32:57.051-00:00" #inst "1970-01-05T18:26:28.078-00:00" #inst "1970-01-06T01:30:58.082-00:00" ...)}}
21:38justin_smith,(reduce (fn [acc date] (update-in acc [(.getYear date) (.getMonth date)] conj date)) {} (repeatedly 5 #(java.util.Date. (* 10000 (rand-int 1000000000)))))
21:38clojurebot{196 {2 (#inst "2096-03-06T03:51:50.000-00:00")}, 280 {2 (#inst "2180-03-11T19:01:10.000-00:00")}, 369 {7 (#inst "2269-08-05T03:25:20.000-00:00")}, 359 {2 (#inst "2259-03-31T01:35:40.000-00:00")}, 171 {10 (#inst "2071-11-27T19:31:10.000-00:00")}}
22:16elvis4526Hi! Is it possible to use a regexp when matching a path with compojure ?
22:16arrdemelvis4526: yep!
22:16arrdemelvis4526: the context macro allows you to gard path elements with a regexp.
22:16arrdemelvis4526: you may be able to do the same with other routing terms, I can't say I'm sure.
22:17Lewixhello folks
22:17caternis there a "Java for Clojure programmers" tutorial yet?
22:17caternplease someone write it soon
22:18arrdemelvis4526: (context ["/:a", :a #"fo+"] [a] ...) should work for instance.
22:19elvis4526I'm not sure I understand why I would be using context
22:19elvis4526What I meant is:
22:19elvis4526I want a route like that (GET "^\w*$" [] foo)
22:20elvis4526I don't want to prefix all my routes with something necesseraly
22:20raspasovcatern: https://www.youtube.com/watch?v=P76Vbsk_3J0 Clojure for Java Programmers video
22:20caternraspasov: wrong way around
22:20caternfriend
22:20arrdemelvis4526: https://github.com/weavejester/compojure/wiki/Routes-In-Detail#matching-the-uri
22:21raspasovcatern: oops :)
22:21elvis4526alright cool
22:21caternI think this is kind of what i'm looking for http://www.braveclojure.com/java/#3_3__Importing
22:21elvis4526and are the rules defined after this rule of mine
22:21elvis4526will override it ?
22:21caterner
22:21caternhttp://www.braveclojure.com/java/
22:21arrdemelvis4526: no compojure works on a "first match" basis.
22:22elvis4526oh okay
22:22elvis4526so basically i just put it at the end
22:22raspasovcatern: yea I learned most of this stuff with the help of IntelliJ and Cursive, and auto-filling of imports is badass
22:22elvis4526thanks
22:22arrdemelvis4526: sure, but there is a built in for the route which matches anything.
22:22elvis4526are you speaking about ANY ?
22:22elvis4526I thought it matches every type of requerst
22:22arrdemelvis4526: https://github.com/weavejester/compojure/blob/master/src/compojure/route.clj#L40
22:31gfredericks4L96dmaMgJ
22:33TEttingerhahaha
22:33TEttinger$google 4L96dmaMgJ
22:33brehautgfredericks: your pass is ********** ?
22:33gfredericksmaybe a security breach email would be more appropriate
22:33brehautthat doesnt sound very secure
22:33TEttingeralso, no symbols? for shame
22:34TEttingeryou're in #clojure and you don't use symbols whenever possible???
22:34lazybotTEttinger: How could that be wrong?
22:34brehautTEttinger: i prefer keywords in my passphrases
22:35TEttingerI like BOMs
22:35TEttingerjust in general
22:36TEttingerpassword: \0\0\0password\0\0\n\r\n\0
22:36TEttingerI wonder how many places would even be able to take that
22:52justin_smithTEttinger: more as a paste - that way it won't get in the way of widget / tty key bindings
22:52justin_smithbut with a password like that, you wouldn't be typing it all in by hand anyway I don't think
22:53justin_smithcatern: that's a really shallow intro to interop, the docs on clojure.org are better
22:54justin_smithcatern: http://clojure.org/java_interop
22:54caternjustin_smith: I don't need docs on interop
22:55caternjustin_smith: I need an explanation of WTF all this Java crap is
22:55justin_smithcatern: and the extra thing neither resource mentions, is that java is documented by a highly standardized format called javadoc, and there are tools like javadoc-search-pane for modern browsers that make finding things really easy
22:55justin_smithcatern: this java crap is 100% interop
22:55justin_smiththat's the way you access it
22:55caternwell
22:55caternlet me assure you
22:56caternthat the brave clojure one is much better for me personally as someone unfamiliar with Java
22:56TEttingercatern, are you writing java coming from a clojure bg?
22:56justin_smithcatern: the problem to me is that the entire chapter there covers like what you could get from half a paragraph on the clojure.org page
22:56TEttingerjava is, thankfully, not that hard of a language compared to many others out there
22:57caternjustin_smith: and I need that
22:57TEttingercatern, if you have any specific questions we can try to answer some
22:57caternwell
22:57caternI haven't actually read the brave clojure or the clojure.org pages yet
22:57caternI have other things I have to get done
22:57caternBUT LATER I WILL
22:58TEttinger(I'm guessing the package/namespace stuff is a big headache for anyone coming from java or clojure and trying to learn the other)
23:03justin_smithTEttinger: no matter what, they are two parallel and weirdly incompatible systems - I came in knowing neither java or clojure and it was confusing
23:03TEttingerwow
23:17devllHow long have you been using Clojure ? justin_smith
23:17justin_smithabout 3 years
23:18devllYeah. Big relief, I have 2 years to catch up.
23:18devlllol
23:19devlldo you have blog on Clojure?
23:20justin_smithdevll: funny, I was thinking about that earlier, some ideas for one...
23:22tolstoyHard to think of what to write about with Clojure that hasn't already been done and available via Planet Clojure.
23:22tolstoyMaybe an un-clojure Blog?
23:22tolstoyShow how you can translate a few lines of Clojure into 100 lines of Java or whatever?
23:23tolstoyBlog: Leiningen Considered Harmful -- 1st paragrah: Let us open to chapter 59 of the Gradle documentation site....
23:23justin_smithI think I might have a kind of unique intro-to-programming via clojure perspective, different from the other stuff I've seen
23:23tolstoyEh. Barrels. Fish.
23:24devlljustin_smith: that will be awesome.
23:24tolstoyAh, yeah. Nice.
23:25justin_smithmy general idea is: first the abstraction, then the various ways you will see it leak, and the signs that particular abstraction is leaking
23:26justin_smitheg. "cannot find ... _init.class" usually means you asked for a namespace but clojure failed to load the file for it
23:27tolstoyBack in 2008ish, I _always_ got caught with the error for not using a vector for parameters.
23:27justin_smiththe stuff that held me back for so long, and then I came to IRC and people could tell me instantly what was wrong, when I first started
23:27justin_smithtolstoy: yeah, that's another good one
23:27justin_smithmaybe "the clojure error dictionary"
23:27tolstoyIt's better now. At least they mention "parameter". ;)
23:27justin_smithhaha
23:29tolstoyI wonder if there's a "how to read clojure" opportunity out there?
23:29tolstoyMaybe, "How to read Clojure source for the not particularly detail oriented."
23:29TEttingerheh
23:29justin_smithtolstoy: that would be another good thing to cover
23:30justin_smith"clojure speed reading"
23:30TEttingerthe lazy guide to lazyseqs
23:30justin_smithhaha
23:30justin_smithoh, here's another idea: stack trace flash cards
23:30TEttingeryes!
23:30tolstoyWhenever you see "reduce", you know someone's taking a bunch of values and crunching 'em down to a few. So just glance right over that without getting lost in the actual anonymous function.
23:30tolstoyThat kind of thing. ;)
23:30TEttingerI like it
23:30justin_smithon one side it has a real stack trace, on the other side, the kind of mistake that makes that stack trace, lol
23:31TEttingerOutOfMemoryError
23:31justin_smithTEttinger: that would be the name for the clojure flavor of the game memory
23:31TEttingerheh
23:31amalloyTEttinger: fat-themed yo mama joke
23:31TEttingeror dumb-themed, amalloy!
23:31tolstoy"For a stack trace, read the first line. That's all you need unless it's a NullPointerException. Then get a cup of coffee."
23:32TEttinger"yo mama's so dumb she gets an OutOfMemoryException when she tries to turn on her TV"
23:34devllIt will be nice if we could stack those to one github repo.
23:34TEttinger"yo mama's so dumb she gets an NullPointerException when she tries to figure out if Darnell is really the baby's father on Jerry Springer"
23:34TEttingerI'm typoing all over here
23:35justin_smithTEttinger: "yo mama got an NPE when she tried to dereference her BabyDaddy field"
23:35TEttingerhaha
23:35TEttingerUnknownInheritanceException
23:35justin_smithLOL
23:44justin_smithso set!, with-redefs, binding and alter-var-root walk into a var...
23:50morganthomashi all! i have a situation which i don't understand. i have couple instructions which produce different results when run in a "do" block and when run separately on the repl.
23:51morganthomasif i write into the repl:
23:51morganthomas> (foo bar)
23:51morganthomas> (baz abc)
23:51morganthomasthat produces a different result than doing
23:51morganthomas> (do (foo bar) (baz abc))
23:51justin_smithmorganthomas: if foo is lazy, then printing in the repl will force it to be eager
23:51justin_smithbut inside do, it won't do anything at all
23:52justin_smiththe moral of this story is that laziness and side effects are star-crossed features, doomed to a complicated and bug-ridden romance
23:52morganthomasah, thank you!
23:52justin_smithmorganthomas: options include dorun (if you never use the result) and doall (if you use it)
23:52morganthomasso foo uses a for loop to do a series of actions on a java object. i am assuming the action of "for" is lazy?
23:53justin_smithmorganthomas: yes, for is lazy, and unlike every other language out there, clojure's for is not a loop
23:53justin_smithmorganthomas: it's easy to test this in general actually
23:53justin_smith,(type (for [a (range)] a))
23:53clojurebotclojure.lang.LazySeq
23:53justin_smithif type gives that answer, the function is lazy
23:54morganthomasjustin_smith: ah, thank you so much. so what would be the idiomatic way to perform a series of actions, one for each element in a sequence?
23:54justin_smithmorganthomas: doseq is identical to for, except it returns nil
23:54justin_smithand is not eager
23:55justin_smithand accepts N forms in its body
23:55morganthomasjustin_smith: brilliant, thank you! now i can fix my code. :-)
23:55justin_smithbut it has the same binding syntax and features as for, so you can just s/for/doseq
23:55justin_smithmorganthomas: np
23:56justin_smiththat would be one of the chapters in my tutorial
23:56justin_smithwhen your thing suddenly does nothing, it's usually because it's lazy and you aren't using its result
23:57morganthomasi'll go take a look at that.
23:57justin_smithmorganthomas: my hypothetical not yet existing tutorial, something we were discussing earlier
23:58morganthomasah, i see. yes, it did not come up on google. :-)
23:58justin_smithmorganthomas: this too I can attribute to laziness
23:58justin_smithso if I just edit my inner for and make it a doseq...
23:58morganthomas:-p