#clojure log - May 10 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:04 catern: just getting started with clojure, following Clojure for the Brave and True, and sometimes when I try to trigger an error in the CIDER repl with (map)<RET> it doesn't show up; and never do I see the stacktrace, even though clojure-repl-popup-stacktrace is set to t. some simple problem hopefully?

0:07 l1x: ,(/ 1 0)

0:07 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

0:07 l1x: what sort of error do you want to trigger?

0:08 catern: (pst)

0:08 ,(/ 1 0)

0:08 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

0:08 l1x: ,(pst)

0:08 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable>

0:09 catern: well, I don't really care about the error ((/ 1 0) also intermittently fails to show the exception and doesn't show the stacktrace)

0:09 i more care about the fact that it's not showing up

0:09 l1x: (pst) <<

0:09 catern: that would probably get annoying at some point and is indicative of some deeper problem

0:09 l1x: ,doc pst

0:09 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)>

0:10 l1x: ,(doc pst)

0:10 clojurebot: "([] [e-or-depth] [e depth]); Prints a stack trace of the exception, to the depth requested. If none supplied, uses the root cause of the most recent repl exception (*e), and a depth of 12."

0:10 l1x: is this what you would like to do?

0:11 catern: well, that's helpful, but no

0:11 the problem is that CIDER just seems to intermittently and randomly not print an exception when it's triggered

0:13 it does still happen though since (pst) prints the stack trace for it

0:26 rgrinberg: is there a way to create a compojure route that will match any number of url slashes. For example: "xxx/*" with a url like "xxx/1/2/3" would give [1 2 3] in the params

0:38 ddellacosta: rgrinberg: from reading this, it seems like the answer would be no, since forward slashes are handled differently in compojure: https://github.com/weavejester/compojure/wiki/Routes-In-Detail#matching-the-uri

0:41 rgrinberg: yeah, seems like it wouldn't work because of how Clout works: https://github.com/weavejester/clout/blob/master/src/clout/core.clj#L127-L128

0:41 rgrinberg: that said, you could probably write your own alternate route compiler

1:04 zeroem: anyone know what protocol/interface exposes the "find" function for maps?

1:19 amalloy: zeroem: from memory i think it's ILookup/entryAt

1:20 no, that's valAt

1:21 Associative.entryAt

1:22 zeroem: amalloy: ah, thanks

1:27 yeah, that did it.

1:48 seangrove: I'm looking at Datascript right now - how would I write an aggregate function to group contacts by the first letter of their last name?

1:54 sm0ke: can i exclude a single test from a profile in lein?

1:59 muhuk: eastwood doesn't seem to be checking for unused imports. :require'd, :refer'd, specific imports.

1:59 is there an add-on or something to enable this?

2:01 sm0ke: hurm i think it is impossible to know something is unused in clojure

2:01 i may be wrong though

2:04 muhuk: sm0ke: I suppose it'd be difficult. But why should it be impossible?

2:04 if there's a symbol in :refer vec, and it's not referred later in the file, we can say it's not used no?

2:05 sm0ke: muhuk: unless you run the code how would you know it is unused? even if you run it the code may take different paths is a whole different thing

2:05 muhuk: keep in mind the macros and eval stuff

2:06 muhuk: sm0ke: I'm not necessarily looking for used, as in var is resolved.

2:06 sm0ke: I'm ok with referred or not.

2:06 sm0ke: (it can be referred yet not used, as you said)

2:07 sm0ke: ah, something like (def xy ...) (eval (str \x \y) -- I'd rather get a warning in this case.

2:08 sm0ke: what about ##(eval (read-string "(split "a b c" #\" \")"))

2:08 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

2:08 sm0ke: if there was a :require clojure.string :refer (split) , you would remove tit

2:08 it*

2:10 altough this is a negative case imo

2:12 https://github.com/technomancy/slamhound

2:12 may be slamhound is doing this

2:13 muhuk: sm0ke: yeah, I wouldn't mind getting warnings in such cases. I think it'd be still more useful to get warnings on stuff that used to be used, but then removed and the import was left...

2:14 sm0ke: oh, neat. Thanks!

2:33 sm0ke: i wish there was something for plain java classes in fireplace

2:33 like listing methods for a class

2:34 spot35: what is clojure used for?

2:35 sm0ke: programming mainly

2:35 spot35: i was curious since I've never used it before.

2:36 I know C++, Python, and Javascript are the most important languages to know.

2:36 sm0ke: people are doing all kind of stuff, web , music, bigdata, games, android, ml, dsl to name a few

2:36 beamso: python?

2:36 clojurebot: python is "I think dropping filter() and map() is pretty uncontroversial…" — GvR

2:37 rpaulo: javascript?

2:37 clojurebot: javascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p

2:37 rpaulo: c++?

2:37 java?

2:37 clojurebot:

2:37 sm0ke: clojurebot: c++ |is| mule crap

2:37 clojurebot: Roger.

2:37 sm0ke: c++?

2:37 clojurebot: c++ is mule crap

2:38 rpaulo: ruby?

2:38 clojurebot: Chunky bacon!

2:38 beamso: hahaha

2:39 spot35: Which languages would rate as important to know?

2:40 beamso: c, java, javascript, haskell, a lisp...

2:40 spot35: hmmm

2:40 beamso: i learnt of clojurebot's functionality then because i've never heard of python being a must-know language

2:41 i never did it at school and very few places hire for the skills in my local area

2:41 spot35: C++ is important since it is ubiquitous in scientific computing and open source.

2:42 beamso: i'd strongly argue that c is more ubiquitous

2:42 sm0ke: clojurebot: c++ |is| ubiquitous

2:42 clojurebot: 'Sea, mhuise.

2:42 spot35: I would agree that C is important.

2:43 sm0ke: clojure?

2:43 clojurebot: clojure is far closer to perfection then python

2:43 beamso: hahaha

2:45 spot35: http://stackoverflow.com/questions/4260522/what-is-clojure-useful-for

2:47 seangrove: clojurebot: forget clojure

2:47 clojurebot: Pardon?

2:47 spot35: Well according to one of this question's answers, Clojure seems to be useful in that it provides better language constucts.

2:49 It's great.

2:50 "Clojure is being used extensively for processing large volumes of data. It is very well suited to data mining/commercial-AI (ie: Runa) and large scale predictions (aka WeatherBill). Clojure's concurrency story really helps in these data heavy domains where parallel processing is simply the only answer."

2:51 muhuk: spot35: forgot who said it, but there's a famous quote like this: "scheme is not a programming language to solve any particular problem, you build programming languages using scheme to solve your specific problems"

2:51 spot35: you can replace scheme with pretty much any LISP

2:52 spot35: even Python

2:52 spot35: awesome muhuk.

2:52 muhuk: (takes cover)

2:52 spot35: :-)

2:57 why do i get this message "#html Cannot send to channel" ?

2:58 I tried to type in the #html channel.

3:08 systemfault: Try to registrer your nickname to freenode.

3:08 *register even...

3:14 spot35: \register spot35

3:15 how do I do it?

3:40 amalloy: $google freenode help register

3:40 lazybot: [freenode: frequently-asked questions] https://freenode.net/faq.shtml

5:50 spot35: thanks a lot

5:51 how come this room is so quiet?

5:51 clgv: almost no US people awake I guess ;)

5:51 pepijndevos: spot35 time of the day + timezones

5:52 * pepijndevos highfives clgv

5:52 clgv: :D

5:53 spot35: i read about this channel on a hacker news article about best irc channels.

5:54 dbushenko: can you share a link?

5:54 clgv: spot35: you got a clojure question?

5:55 spot35: i'm glad that clojure exists

5:55 https://news.ycombinator.com/item?id=7161236

5:57 dbushenko: nice :-)

5:57 spot35: clgv, no clojure questions, wwas that a private message?

5:57 i'm new to irc :-)

5:57 hyPiRion: spot35: that's neat, hope you enjoy your stay here :)

5:57 private messages typically end up in another window in IRC clients

5:57 clgv: spot35: no, a normal question but with your name that you know you were meant ;)

5:58 spot35: thanks a lot i appreciate it. this is a friendly room.

5:59 hope everyone enjoys the article

6:00 hyPiRion: Oh right: It's generally a bit more silent on weekends, and considering the americans aren't awake yet, even more so.

6:01 ddellacosta: who is uniclaude? Curious who else is in Japan

6:01 sm0ke: i have noticed one thing very interesting, hostility in irc language rooms is directly proportional to how low level the language is

6:02 ddellacosta: spot35: re: why quiet, definitely I see phases throughout the day when various country/region populations wake up or go home/go to bed, etc.

6:02 sm0ke: java, c++ irc rooms are really hostile, haskell clojure otoh usually firendly

6:02 ddellacosta: sm0ke: yeah, I haven't hung out on IRC for years until I joined Clojure (and sometimes Haskell, also super friendly)

6:03 dbushenko: sm0ke, maybe its bcs java, c++, etc. have lower entering bound, and there are lots of young zealots there :-)

6:03 hyPiRion: sm0ke: hm, I think that's coincidental. the #rust channel is friendly too

6:04 ddellacosta: another nice thing about this channel is that a lot of the main movers and shakers hang out here...you can directly ask them questions about libs and whatnot (and everyone I've talked to is friendly ta boot)

6:04 dbushenko: yep!

6:05 bozhidar: indeed

6:05 hyPiRion: Ah, the power of a relatively small community

6:05 bozhidar: unfortunately (for Europeans at least) most of them are stateside

6:06 ddellacosta: I guess that is indeed part of it. I think another part is that the Clojure community really seems to emphasize learning and thinking about programming in a deep way (not to say other communities don't...Haskell certainly comes to mind)

6:06 and I think that comes out in the patience many folks bring to it

6:06 bozhidar: ddellacosta: and any other FP community I guess :-)

6:07 ddellacosta: bozhidar: yeah, most definitely, I think so. Again, not to say there aren't smart folks elsewhere--and plenty of brilliant people writing in mainstream languages, of course

6:07 hyPiRion: ddellacosta: I think the Clojure community emphasize on thinking in general. =) As in we don't usually do "hey, this test succeeds, let's ship it!"

6:07 bozhidar: Btw, I'm thinking of starting a #clojure-emacs channel dedicated mostly to cider, clojure-mode, etc

6:08 I wonder if people would be interested in something like this

6:08 ddellacosta: hyPiRion: yes. :-)

6:08 bozhidar: I'm often here, but I rarely actually read this discussions, because there are so many of them

6:08 ddellacosta: bozhidar: dunno...I mean, I'm on the fence since it seems like there is a fair amount of emacs + Clojure discussion here, which people tolerate okay

6:08 bozhidar: but maybe you're right that it should be elsewhere (I'd be interested)

6:09 hyPiRion: bozhidar: How many developers are there working witch cider/clojure-mode or other emacs-related things?

6:09 bozhidar: on cider - just me

6:09 on clojure-mode - mostly me

6:10 but it has a few other maintainers as well

6:10 hopefully with the transition to cider-nrepl more Clojurists will join the cider development

6:10 clgv: how can one make emacs jokes here from time to time when you direct those questions away? ;)

6:11 hyPiRion: In #leiningen, we're not that many people (3-4 active), but whenever there's a discussion about lein internals, it's nice to have

6:11 ddellacosta: hyPiRion: fair point

6:11 clgv: yeah, I only hope to #leiningen if I got a problem with it. that happens not that often ;)

6:11 hyPiRion: People come in to ask lein questions every now and then, but I feel it's mostly for discussions

6:11 clgv: *hopp

6:12 ddellacosta: offtopic, speaking of IRC, does anyone have suggestions on a good channel to hang out in to learn more about graphics-related math?

6:12 hyPiRion: I mean, most people end up asking in both #clojure and #leiningen if the have a lein problem/question most of the time :)

6:12 clgv: ddellacosta: I doubt its existence. sounds more like a computer graphics lecture or associated student tutorials ;)

6:13 sm0ke: ddellacosta: opengl used to be very nice

6:13 ddellacosta: clgv: yeah, I'm actually trying to find a channel where I can fish for resources like what you're talking about! I really just need to buckle down and learn the math though. :-/

6:14 sm0ke: took openGL course yeeeeears ago

6:14 sm0ke: ddellacosta: i am talking about #opengl channel

6:14 clgv: ddellacosta: so you mean the more basic "working math" or the complex stuff for simulating different fluids and stuff?

6:14 ddellacosta: sm0ke: oh, yeah, I figured...was just kind of reminiscing. ;-)

6:16 clgv: all of the above; I need a math refresher (which I can do on my own) but I also just need to try to understand *what* math to learn in the first place. I need something like a survey course of various graphics programming techniques--everything from visualization (ala math you can find in D3 libs) to 3d stuff (linear algebra?) to...physics

6:17 clgv: I want to get a basic sense of what is out there...I'm very uninformed

6:17 sm0ke: take a graphics 101 or something like that to start with i guess

6:17 hyPiRion: ddellacosta: I'm working with a guy who pursued a PhD in 3D graphics, and wanted me to start with it too. I'll try to dig up the book recommendation he had for me.

6:17 sm0ke: mostly its all about triangles :D

6:18 ddellacosta: sm0ke: yeah, maybe I'll poke around and see if I can find a 101-level course somewhere available online.

6:18 hyPiRion: I would be most appreciative!

6:19 sm0ke: http://www.glprogramming.com/red/

6:19 this is a must read once for graphics i guess

6:19 clgv: ddellacosta: found that book recommendation on one of the old courses "Peter Shirley: Realistic Raytracing, AK Peters."

6:20 pepijndevos: what does 101 actually mean? "bunch of random info for getting started"?

6:21 ddellacosta: clgv, sm0ke, thanks

6:21 sm0ke: 101 is basic course in most colleges

6:21 so just an analogy for the basic stuff

6:21 ddellacosta: pepijndevos: I think that usually 101 was often the first level in many schools, and higher levels would have correspondingly higher numbers (200, 300, etc.)

6:21 pepijndevos: http://en.wikipedia.org/wiki/101_%28term%29

6:21 ddellacosta: yep, that...

6:22 man, sorry for hijacking #clojure w/graphics programming questions, thanks for all the help folks

6:24 clgv: ddellacosta: now you must do it in clojure :P :D

6:24 ddellacosta: clgv: heh, that was the goal all along. :-)

6:24 clgv: well no hijacking then ;)

6:25 pepijndevos: Swing has some things for 2D, pretty fun.

6:33 hyPiRion: ddellacosta: I was recommended Mathematics for Computer Graphics by John Vince, 3rd/4th edition. It starts off really basic, so the first chapters could be skimmed by about anyone.

6:33 ddellacosta: hyPiRion: thank you so much! I'll check that out right now

6:33 hyPiRion: But from chapter 6 I think, you start doing stuff with cameras

6:34 Just so you know: It's only mathematics, there's not a single piece of code in the book.

6:35 But it's pretty good at it.

6:36 ddellacosta: hyPiRion: that's actually exactly what I want...

6:36 perfect

6:36 hyPiRion: ddellacosta: great then! :)

6:37 clgv: hyPiRion: oh that book really starts from scratch

6:40 hyPiRion: yeah, I think I said so

6:41 clgv: hyPiRion: yeah well "from scratch" is no absolute measure ;)

8:00 mr-foobar: in clojure, what is the best way to make something like "view" into symbols like make-view, ViewFoo .... ?

8:03 beamso: ,(keyword "foo")

8:03 clojurebot: :foo

8:21 clgv: mr-foobar: you should specify an example because your sentence is not easily comprehensible

8:22 mr-foobar: clgv: I found a solution https://stackoverflow.com/questions/2410082/clojure-type-conversion-string-to-symbol

8:23 clgv: mr-foobar: ah you just did not know clojure.core/symbol?

8:24 $findfn "bla" 'bla

8:24 lazybot: [clojure.core/symbol clojure.core/read-string]

8:25 clgv: lazybot: botsnack

8:25 lazybot: clgv: Thanks! Om nom nom!!

8:27 mr-foobar: ,((symbol "+") 1 2)

8:27 clojurebot: 2

8:28 mr-foobar: clgv: i needed the resolve

8:28 clgv: mr-foobar: yeah thats wrong. you need to resolve the symbol to get the variable

8:28 ,(some-> "+" symbol resolve (1 2))

8:28 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

8:29 clgv: args wrong asumption ;)

8:29 mr-foobar: clgv: what do you think of prettify ?

8:29 clgv: ,(when-let [f (some-> "+" symbol resolve)] (f 1 2))

8:29 clojurebot: 3

8:29 clgv: ,(when-let [f (some-> "++" symbol resolve)] (f 1 2))

8:29 clojurebot: nil

8:29 clgv: mr-foobar: prettify?

8:30 mr-foobar: clgv: oops https://github.com/AvisoNovate/pretty I'm thinking of using it for exceptions

8:32 clgv: mr-foobar: would only help on the command line repl. which I use less frequent than the repl of my ide ;)

8:33 the colors I meant

8:35 DerGuteMoritz: b

8:35 clojurebot: b > c

8:35 DerGuteMoritz: haha, oops

8:35 c

8:37 clgv: a

8:38 lol strange bot

9:10 wei__: I’m looking for an elegant way to write a function like max(..), but returns the value x for which f(x) is maximum

9:12 ambrosebs: ,(doc max-key)

9:12 clojurebot: "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

9:15 wei__: ambrosebs: thanks! exactly what I was looking for

9:16 michaniskin: does leiningen do anything special when resolving snapshot deps on windows?

9:17 i'm using pomegranate directly and on windows 8 i need to downcase the "snapshot" part of the version, and on window 7 that doesn't even work. but leiningen seems to be able to do it

9:38 clgv: project licenses: I have one helper namespace that isnt necessary for my library to work but useful for debuging. since that ns uses quil I can't license it as EPL. so what should I do?

9:38 or what is the best practice here?

9:40 oh wait the EPL FAQ lists the CPL as approved

9:47 catern: the licensing issues really make me uncertain about clojure

10:00 clgv: catern: huh? what? the majority of Clojure libs is EPL so that there are no licensing issues for those. you only get into the trouble to need to find out license compatibility if a different license is used

10:01 catern: provided you use EPL for your release as well

10:01 or something compatible but that you'd need to find out again ;)

10:02 catern: yes, but EPL is so uncommon, and I don't really want to use it for my software. it would be better if the LGPL or something was used

10:06 clgv: catern: EPL is actually less restrictive than LGPL and GPL

10:07 catern: maybe so, but it's also much less common

10:10 clgv: that doesnt convince me ;)

10:15 _rc: catern: it's less common in the things you're used to seeing, sure. Probably worth your while getting used to it, or at least asking your legal team if it looks reasonable.

10:17 catern: i think it's actually just overall less common...

10:17 my real question is whether anyone in the clojure community actually sees this as a problem, or if a relicensing of clojure.jar could ever even happen

10:19 _rc: Well from the sample you've already tapped, I'd say it's not seen as a problem. Apart from by yourself, as you're part of the community now.

10:26 ddellaco_: catern: this kind of stuff does come up on the mailing list, for example: https://groups.google.com/forum/#!topic/clojure/mGf_SuHsSGc

10:26 catern: I do suggest poking around the archives if you have specific questions, it's quite likely someone has brought it up before

10:27 catern: and--ha--probably the most pertinent message in that thread: https://groups.google.com/d/msg/clojure/mGf_SuHsSGc/kMhE4VxqG0sJ

11:18 seangrove: Is there some way to get datomic to return a hash map of results rather than just vectors/sets?

11:21 May be a bit too early to ask in here...

11:29 pyrtsa: seangrove: What would the keys and values be in that case?

11:31 (I can think of a few ways to create hash maps from query results but datomic.api/q never returns a map if that's what you're asking.)

11:31 seangrove: pyrtsa: Yeah, I'm struggling to think of the proper transfomartion for what I want, but maybe at the very least => [:find ?first ?last ...] => {:first ... :last ...}

11:32 But then that's probably not right, because you might be expecting a hashmap per first/last pair

11:33 pyrtsa: Hmm, you can also use the {:find [?first ?last] ...} syntax and build the value of the :find key programmatically... or create the map keys from it programmatically.

11:34 seangrove: pyrtsa: Thinking of going that route. I'll explore more, just wanted to make sure I wasn't reinventing the wheel here

11:38 pyrtsa: I also can't think of a way to aggregate results by some arbitrary function, for example trying to group a set of results by the first letter of the last name

11:41 pyrtsa: You can use Clojure, including Java interop, in the query expression, e.g. [(first ?last-name) ?initial] captures the value of the first letter of ?last-name to ?initial.

11:41 seangrove: Ah, interesting, let me try

11:41 pyrtsa: seangrove: Btw, there's also #datomic on Freenode.

11:42 seangrove: pyrtsa: I'll definitely lurk. Trying to use datascript though, which probably isn't as polished/capable yet

11:45 pyrtsa: seangrove: You could do something like https://gist.github.com/pyrtsa/84b1c86764425a7f3def to get maps out of a query. Not sure why you'd do that, though. I usually try to fetch as little as possible from the query and use the entity API for extracting the rest of data.

11:46 That was maybe a bad example. Updated the Gist to show what it looks like when the patterns have a different name (?i, ?v) from the attributes (:id, :val).

11:48 seangrove: pyrtsa: That looks great, thank you. Second example is clear as well

11:52 nathan7: Hey humans

11:52 Can I make gen-interface generate a .class somehow?

11:57 lxsameer: hey guys, I have a routing question ( so don't hit me :P) I'm not a JVM user, is clojure good for me over scala or golang ?

11:57 dbushenko: lxsameer, depends on your tasks

11:58 lxsameer: dbushenko: in general term

11:58 dbushenko: anyway, scala is a mess of OOP/FP, its a modern Perl if you see what I mean

11:58 lxsameer: dbushenko: i'm a python/ruby user and have a little background about elisp

11:58 dbushenko: yeah i get it

11:59 dbushenko: well, I think, clojure is simplier to study than elisp since it is very uniform

11:59 lxsameer: dbushenko: does clojure uses the FP pattern ?

11:59 dbushenko: yep, clojure is mosly functional

11:59 not so pure as Haskell but near to it

12:00 actually I use Clojure for hobby projects and for production like 1.5 years or something and very happy with it

12:00 lxsameer: dbushenko: hmm good, what about golang? how is it compare to golang

12:01 dbushenko: I don't know about Go much, but I think -- their areas are a little different

12:01 lxsameer: dbushenko: how come ?

12:01 dbushenko: Go thinks in channels and is mostly about server-side speed

12:01 Clojure is more general, it may be server side/client side, the performance is OK but not that blazing

12:02 lxsameer: dbushenko: cool

12:02 dbushenko: thanks buddy, it was such a big help

12:02 dbushenko: I don't know, may be Go is also OK for your tasks

12:02 nathan7: Fast enough for most real-world tasks, which is good enough unless you're actually going to worry about benchmarks

12:03 dbushenko: lxsameer, just don't forget that clojure can use all the java heritage which is huge: you can find a library for absolutely everything

12:04 lxsameer: dbushenko: nice, but scala and golang or even jruby can do that, am i right ?

12:04 dbushenko: Go doesn't have anything in common with jvm

12:06 lxsameer: dbushenko: good to know

12:06 dbushenko: so I think clojure have some big advantages over scala

12:07 dbushenko: yeah, it seems like it was designed :-)

12:07 and scala is a mess, really

12:07 lxsameer: dbushenko: thanks buddy

12:07 dbushenko: np

12:45 gfrederi`: reiddraper: oh I remember the single-trial-level-seeding was not very compelling for you because the arguments are always available to run the function directly, but here's another feature I have that I don't think is possible otherwise: resumable shrinking

12:45 which I think can be quite valuable in any scenario where shrinking takes a long time, for whatever reason

12:45 e.g., we have a CI system that times out builds after 1 hour; so if a test fails and it spends more than an hour shrinking, the effort can be lost

12:46 but with the output I have I can pick up where it left off on a different machine

12:48 I might be able to assemble a lot of this functionality into a library oriented around slow/flaky tests though

12:49 mostly it would just have some duplication of the code in the test.check namespace and the test.check.properties namespace

12:49 Glenjamin: Hi everyone, is there a deployment middle ground for clojure between lein run and uberjars? Something like capsule perhaps?

12:51 Seems to be a pain to google for - I'm referring to https://github.com/puniverse/capsule

12:51 reiddraper: gfrederi`: erlang quickcheck writes some of that to a temporary file, which might be an option

12:52 Glenjamin: technomancy: Are you familiar with capsule at all?

12:53 aha - What's Missing/TODO (contributions happily accepted!) Gradle, Maven and Leiningen plugins for easy creation of capsules.

12:53 Might have a go at that some time

12:53 reiddraper: gfrederi`: maybe this would be easier as an email thread, since I seem to be out whenever this comes up on IRC :D

12:59 justin_smith: Glenjamin: for deploying what? webserver? standalone?

13:00 Glenjamin: justin_smith: Standalone, like an uberjar but with jvm opts and agent config included

13:00 justin_smith: Glenjamin: capsule looks cool, you could probably make a lein plugin for it

13:01 or even an option extending the existing uberjar

13:01 Glenjamin: Yeah, it seems like the project.clj will already have all the info

13:02 justin_smith: looks like it would just be a question of adding the capsule dep, setting capsule as your main, and adding some junk to pom.xml

13:02 or some custom stuff to the manifest directly maybe

13:03 I'm definitely bookmarking it for later, seems handy

13:13 dnolen_: Bronsa: ping

13:13 Bronsa: dnolen_: pong

13:14 dnolen_: Bronsa: trying to fix core.match with tools.analyzer, I'm trying to detect the presence of recur in the AST, I thought I could just reuse the existing check-loops pass, but that doesn't seem to be true?

13:15 gfredericks: reiddraper: we should just do another lunch; it might take a while to type up the different changes I've made

13:15 reiddraper: ticket & patch for the bind issue are imminent

13:16 dnolen_: Bronsa: er check-recurs

13:16 (:recurs (loops/check-recur (analyze '(loop [] (recur)) (ana-jvm/empty-env)))) => nil

13:17 Bronsa: dnolen_: check-recur does something a little different than what you're expecting it to do

13:18 dnolen_: Bronsa: also is it possible to disable the tail check? I just want to check the body of something

13:18 reiddraper: gfredericks: yeah lunch would be great

13:18 Bronsa: dnolen_: give me one sec, I just came back home

13:18 dnolen_: Bronsa: k thanks

13:21 Bronsa: dnolen_: so, in your example is correct that (:recurs ast) is nil: the (loop ..) expression is not in a recur path

13:21 (-> ast :body :recurs) however will be true

13:22 check-recurs doesn't check if there's a recur somewhere in the children nodes, it checks whether or not the current node is in a recur path

13:23 dnolen_: I don't understand what you mean with "disable the tail check"

13:24 lxsameer: does clojure has some tools like virtualenv of python or rbenv of ruby ?

13:31 Jaood: lxsameer: leiningen

13:32 eraserhd: Oops.

13:32 Jaood: you did it again?

13:32 eraserhd: Is there something I don't know about lazy-seq being bad for realtime event-streaming stuff?

13:32 Perhaps. I seem to have been offline when I asked that question the first time :)

13:33 dnolen_: Bronsa: in core.match I want to detect the presence of recur in a match clause, this is without having to analyze the entire match (as it can be quite large)

13:33 (match [x] [1] (recur ...))

13:33 so I want to check if (recur ...) contains recur

13:33 eraserhd: The stream seems to be processed one event in arrears.

13:34 dnolen_: Bronsa: though I guess, I could just catch that error ...? and know that the user used recur?

13:34 Bronsa: dnolen_: oh I see. so you need to (analyze '(recur ..)) without having that throw an error?

13:36 dnolen_: there's not much that you can do if that's what you need.

13:39 dnolen_: there's a really ugly hack that comes to mind.

13:39 dnolen_: Bronsa: yes but that's actually all I need I think. If the error is thrown I know the user used recur.

13:40 Bronsa: dnolen_: you could use clojure.lang.Compiler/LOOP_LOCALS in conjunction with &env to create a fake loop wrapping the expr

13:41 cljnoob: Hi

13:41 dnolen_: Bronsa: got an example?

13:41 Bronsa: dnolen_: one sec

13:41 cljnoob: I am using http-kit to provide http client functionality, and I have a need to supply a query which will have an embedded double-quote

13:42 If I do (def myquery "SELECT something from whatever where name=\"somename\"")

13:43 should I expect this to be normalized or would this be submitted with the escape character?

13:44 ambrosebs: dnolen_: is it an issue using tools.analyzer if the pattern introduces some locals?

13:44 dnolen_: ambrosebs: I haven't use tools.analyzer before, would that be a problem?

13:45 whodidthis: cljnoob: not sure what you up to but you should probably look into https://github.com/krisajenkins/yesql for sql queries

13:45 dnolen_: in CLJS the analyzer just warns, not a hard error by default about unresolved locals

13:45 ambrosebs: dnolen_: I would imagine it's an error

13:46 but you could probably extend the local env somehow

13:46 dnolen_: ambrosebs: when running the analyzer just now w/ unresolved locals I didn't see any issues, i.e. (analyze '(let [x y] x) ..) works

13:46 ambrosebs: ah cool

13:48 cljnoob: whodidthis it is not a sql query

13:48 I was just giving an example

13:48 what do I have to do print a string that has quotations without the escape sequence?

13:49 whodidthis: oh, that should work then

13:50 ambrosebs: dnolen_: I guess a local from a pattern could shadow a macro, so you'd get a bogus expansion.

13:50 cljnoob: (def webquery "param1:\"somevalue\"")

13:50 #'crdf.core/webquery

13:50 crdf.core=> webquery

13:50 "param1:\"somevalue\""

13:51 so I would like to print param1:"somevalue" instead

13:51 whodidthis: ,(pr-str "param1:\"somevalue\"")

13:51 clojurebot: "\"param1:\\\"somevalue\\\"\""

13:52 cljnoob: that is more backslashes even

13:52 dnolen_: ambrosebs: hmm good point ... though if a macro is expanding to a recur ... not sure if this some I should care about

13:52 s/some/something

13:53 ambrosebs: dnolen_: yea pretty insane case

13:53 whodidthis: ,'param1:"somevalue"

13:53 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: param1:>

13:54 ambrosebs: dnolen_: if you can extract the locals easily from the pattern, might as well extend the current local env.

13:54 I don't know how to do that.

13:55 dnolen_: ambrosebs: getting the locals out shouldn't be too hard ... need to think about it

13:57 Bronsa: dnolen_: http://sprunge.us/WLQZ?clj

13:58 dnolen_: ugly but it works fine

13:58 dnolen_: also (analyze 'y (empty-env)) is working for you probably because you're not running all the t.a.j passes, thus you're not running `validate`

13:59 dnolen_: Bronsa: works for me, but how does that let me know that recur occurred somewhere?

13:59 Bronsa: do I just need to write my own pass? (simple enough if that's the case)

13:59 ambrosebs: Bronsa: please keep a bag of tricks/examples like this somewhere :)

14:00 Bronsa: dnolen_: depends on what recur you need to know of

14:00 dnolen_: e.g. do you need to know if there's a recur referring to an outer loop only

14:00 or do you need to know if e.g. the expr contains (loop [..] (recur ..)) too?

14:00 dnolen_: Bronsa: no

14:00 just an unmatched recur

14:01 Bronsa: dnolen_: if you only need the former, run check-recurs on the ast & look for (-> ast :body :recurs)

14:02 dnolen_: Bronsa: (:recurs (:body (loops/check-recur (analyze '(loop [] (recur)) (ana-jvm/empty-env)))))?

14:03 Bronsa: dnolen_: yes

14:03 dnolen_: Bronsa: hmm, returns nil

14:04 Bronsa: :/ sorry. check-recurs wasn't really intended to be used on its own. run loops/annotate-loops instead

14:07 danneu: Does anyone know what part of a commit object is being signed when you `git commit --gpg-sign _`?

14:08 Bronsa: dnolen_: if you use t.a.j/analyze directly you get all of that out of the box btw.

14:09 dnolen_: Bronsa: I think this works + your loop/local code + annotate-loops

14:11 Bronsa: dnolen_: cool. btw just FYI you should probably use (t.a.passes.jvm/emit-form (:body ast)) as your expr after you've done the analysis rather than using the original expr.

14:11 dnolen_: else you might do macroexpansion twice

14:11 mi6x3m: hey guys, can someone provide me some insignts how idiomatic a function I wrote for a 4clojure task actually is?

14:13 ddellaco_: mi6x3m: just post it here if it is a one-liner, or put it in a gist/refheap and put that link in. Don't need to ask

14:13 mi6x3m: the code is here: http://pastebin.com/xFxpAzdm and it's a clone of nth

14:13 for this task https://www.4clojure.com/problem/21

14:13 dnolen_: Bronsa: why do I need emit-form? the only I need to do is detect recur?

14:13 mi6x3m: now I am aware one can do it with (take (drop .... ))

14:13 but I wanted to throw IndexOfOutBounds exception

14:14 dnolen_: er I mean the only thing I need to do is detect recur

14:14 mi6x3m: which won't be possible with the 1 liner

14:15 Bronsa: dnolen_: I mean, what you're doing is more or less (defmacro match [..] (let [.. analyzed-exprs (mapv my-analyze exprs)]) (.. ~@exprs)))

14:15 doing it like this means that the exprs will be macroexpanded twice: once by t.a.j and once by clojure

14:16 ddellaco_: mi6x3m: I wouldn't tend to use a Java Exception if I could avoid it, but just return nil probably

14:16 dnolen_: Bronsa: hmm, I guess I don't really see that as much of an issue - macroexpansion is not a huge bottleneck :)

14:16 Bronsa: to avoid macroexpanding twice you need to do (defmacro match [..] (let [.. analyzed-exprs (mapv my-analyze exprs) exprs (mapv emit-form analyzed-exprs)]) (.. ~@exprs)))

14:16 dbasch: mi6x3m: my solution to that problem was simply .get :P

14:16 Bronsa: dnolen_: sure, but macroexpansion can be side-effecting though

14:16 mi6x3m: ddellaco_: yes, but I wanted to throw the exception as extra points :) just to get it as closer to nth as possible

14:17 dnolen_: Bronsa: yeah this is not something I care about either :)

14:17 Bronsa: dnolen_: ok :)

14:17 ddellaco_: mi6x3m: you may also want to use loop instead of a recursive function

14:17 mi6x3m: ah, fair enough

14:17 mi6x3m: but does it look idiomatic enough :)

14:17 dbasch: ,(.get [1 2 3 4 5 6] 10)

14:17 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

14:18 dbasch: ,(.get [1 2 3 4 5 6] 4)

14:18 clojurebot: 5

14:18 ddellaco_: mi6x3m: instead of (empty? coll) the usual idiom is (seq [])

14:18 mi6x3m: dbasch: well, you see, I am trying to learn something here and not call interop :)

14:18 ddellaco_: er, (seq coll) rather

14:18 ,(seq [1])

14:18 clojurebot: (1)

14:18 ddellaco_: ,(seq [])

14:18 clojurebot: nil

14:18 dbasch: mi6x3m: in that case don’t worry about throwing the exception

14:18 mi6x3m: ah, I see, thanks :)

14:19 ddellaco_: mi6x3m: and yeah, I think using loop would be more idiomatic compared to the let defined fn you're using, but whatevs

14:20 mi6x3m: ddellaco_: afaik loop/fn with recur doesn't matter as clojure will optimize the tail recursion into iteration?

14:21 dbasch: mi6x3m: it you’re trying to loop, writing loop/recur makes your intent more clear

14:21 ddellaco_: mi6x3m: sure but you asked about what was idiomatic

14:21 mi6x3m: ah, yeah!

14:21 good point

14:21 this is what I asked about, you are right :)

14:21 ddellaco_: mi6x3m: I mean, I'm not one to hate on people doing things differently...don't get me wrong. ;-)

14:21 mi6x3m: nope, perfectly clear point, it is more clear

14:23 dbasch: btw, nth is a function that’s probably optimized for underlying collections, so it’s not the best pick for idiomatic clojure if you really want it to be as good as the original

14:24 mi6x3m: dbasch: yeah, it's optimized for the different types, I just checked, I wanted functional equivalence, nth is far more powerful

14:25 thanks guys :) very useful insights

14:25 all very helpful

14:26 thank you very much

14:30 ddellaco_: mi6x3m: why didn't you want to use something like take though?

14:30 ,(defn nnth [c n] (if (< (count c) (inc n)) (throw (IndexOutOfBoundsException.)) (last (take (inc n) c))))

14:30 clojurebot: #'sandbox/nnth

14:31 ddellaco_: (nnth [1 2 3] 0)

14:31 er

14:31 ,(nnth [1 2 3] 0)

14:31 clojurebot: 1

14:31 ddellaco_: ,(nnth [1 2 3] 2)

14:31 clojurebot: 3

14:31 ddellaco_: ,(nnth [1 2 3] 3)

14:31 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

14:31 mi6x3m: ddellaco_: count would execute the lazy seq

14:31 I wanted to avoid that

14:31 ddellaco_: mi6x3m: ah, okay. I never think about much other than solving the problem when it comes to 4clojure

14:32 dbasch: you could avoid the count with a map-indexed

14:33 mi6x3m: how do you mean?

14:33 dbasch: and take-while your index is less than n

14:33 ddellaco_: oh, nice, yeah

14:34 mi6x3m: yes, that would work

14:35 but what was that map-indexed thing?

14:35 dbasch: ,(doc map-indexed)

14:35 clojurebot: "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."

14:36 dbasch: ,(map-indexed #(do [%1 %2]) [:a :b :c :d])

14:36 clojurebot: ([0 :a] [1 :b] [2 :c] [3 :d])

14:37 mi6x3m: ah yes, dbasch, this is an elegant solution

14:44 Frozenlo`: The low-constrast Liberator's webpage is killing me

14:44 mi6x3m: can someone tell me why (seq coll) is more idiomatic than (empty? coll) ?

14:45 Frozenlo`: I don't think it's more idiomatic

14:45 Here's `empty?' source: (not (seq coll))

14:46 mi6x3m: hm, I see

14:47 nathan7: So I found a language annoyance and wrote a patch to fix it, filed a JIRA issue etc — http://dev.clojure.org/jira/browse/CLJ-1419

14:47 Anything I'm doing wrong there? It's my first attempt at contributing to Clojure.

14:48 lxsameer: what is the difference between slim, javadoc and normal version of clojure ?

14:50 bbloom: lxsameer: https://groups.google.com/forum/#!topic/clojure/sCCg6i-gue0

14:50 lxsameer: if you're just getting started, use lein

14:50 ~lein

14:50 lxsameer: thanks

14:50 clojurebot: lein is http://github.com/technomancy/leiningen

14:51 nathan7: seems I get to sign and mail a CLA, whoo

14:51 lxsameer: bbloom: thanks buddy

15:50 programmancer: Is there a way to hook into the calls to println (or similar) in core.async go blocks?

15:50 (with-out-str (go (println "Nope"))) returns "".

16:04 mi6x3m: clojure, how can I check what a reader form expands to?

16:05 justin_smith: programmancer: iirc, with-out-str uses dynamic binding, which is per thread, so the go block is already in another thread, and printing to that thread's *out*

16:05 programmancer: Yeah, precisely.

16:05 mi6x3m: like an anonymous function

16:06 justin_smith: ,(macroexpand '#({:dont :do-this}))

16:06 clojurebot: (fn* [] ({:dont :do-this}))

16:06 justin_smith: like that?

16:06 (probably the most frequent error in usage of anonymous fns)

16:06 programmancer: Essentially I want to test that a "print-everything-and-pass-it-on" chan actually mutates *out*.

16:07 It's hardly essential to test, though, I was just curious.

16:07 mi6x3m: justin_smith: yes

16:07 thanks

16:07 perfect :)

16:07 programmancer: So it's a channel that takes something, pprints it, and returns a chan onto which what it takes is put.

16:08 Mostly for debugging, obviously.

16:08 mi6x3m: i didn't know the reader macros can be expanded as normal macros

16:11 is there a way to get vector projection?

16:15 clojure is there a version of take that has a start parameter?

16:16 so a combination of drop and take

16:16 Frozenlock: I was going to say drop and take... I don't think it has its own function

16:19 kind of a general question: any advice on how to deal with invoicing and subscription? general tips? (Like store the pricing inside each account to give you the ability to give different prices with rebates and stuff)

16:19 'Stuff' being the most important, obviously :-p

16:20 mi6x3m: Frozenlock: what are you working on?

16:21 Frozenlock: mi6x3m: In what sense? What industry? What kind of application? What part I'm currently coding?

16:22 *which part

16:22 mi6x3m: Frozenlock: it seems to be a shop so I would ask about the current part

16:22 Frozenlock: Well, the invoicing part

17:14 tuft: Frozenlock: i've usually done that with positive and negative valued line items

17:14 it does get tricky if the pricing structure is really complicated, though

17:15 i worked on one system where trying to codify their pricing revealed all these inconsistencies, heh

17:16 Frozenlock: tuft: the pricing is not complicated, but I know I haven't though of everything. When the problems bubble up, I don't want to be 'well, too bad I can't change anything in my pricing'.

17:16 Positive and negative values seem to be the safest route I've seen so far

17:16 *thought

17:17 tuft: replicating the on-paper techniques always seems like a pretty good starting point

17:17 users can get it more easily then too

17:32 seangrove: dnolen_: I'm just getting around to actually experimenting with Datascript - how's it compare to the datomic interface? Seems like it has a few twists

17:33 dnolen_: seangrove: I haven't actually played around with it that much, just enough to see that I like the idea and I want to something like it to work well with Om

17:34 seangrove: Well, it didn't take you long to threaten a re-implementation then ;)

17:34 dnolen_: seangrove: yeah I have a private repo I'm hacking on here and there.

17:35 seangrove: Got it. Presumably close to the datomic interface, so porting shouldn't be a problem if you release it?

17:35 dnolen_: seangrove: yes my intention is for it to be as close to Datomic as possible, also thinking about performance from the get go.

17:37 seangrove: Yeah, looking at the timing for some simple queries in datascript's current state, it'd be very, very difficult to get consistent 60fps. To be fair though, he mentions it in the readme.

17:37 d0ky: hello how can i rename file using clojure ?

17:37 mi6x3m: d0ky: use the standard java api?

17:38 dnolen_: seangrove: yeah I think with a some tweaking you could easily query tens of thousands of datoms at 60fps

17:38 seangrove: dnolen_: I'd hope so, but seeing the GC pressure for this kind of stuff makes me think it's going to be tough. You'd have to be mindful of it pretty early on in the design

17:38 mi6x3m: could someone explain why (fn [str] (apply clojure.core/str (filter Character/isUpperCase str)))

17:39 fails

17:39 d0ky: mi6x3m: i tried (File/renameTo xml-file (str file-name ".xml")

17:39 mi6x3m: but it doesn't works

17:39 mi6x3m: clojurebot

17:39 how is it used?

17:40 dnolen_: seangrove: I'm not really concerned too much about that, reducers work :)

17:40 d0ky: xml-file (File. (str "."(java.io.File/separatorChar)"rss"(java.io.File/separatorChar)"settings.xml"))

17:40 * seangrove crosses his fingers

17:40 seangrove: But yeah, should work

17:41 d0ky: Also the fs library if you're ok with adding a dep http://raynes.github.io/fs/me.raynes.fs.html#var-rename

17:41 ~fs

17:41 clojurebot: It's greek to me.

17:41 seangrove: clojurebot: fs is https://github.com/Raynes/fs

17:41 clojurebot: In Ordnung

17:41 seangrove: ~fs

17:41 clojurebot: fs is https://github.com/Raynes/fs

17:42 d0ky: seangrove: thanks i will try it

17:43 mi6x3m: seangrove: I am wondering why you can't use def with a java static method, any help for me?

17:43 like (def x Character/isUpperCase)

17:43 it seems I can only invoke the method

17:43 I understand it might not be a normal clojure function

17:44 seangrove: ,(map Character/isUpperCase ["a" "B"])

17:44 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: isUpperCase in class java.lang.Character, compiling:(NO_SOURCE_PATH:0:0)>

17:45 d0ky: seangrove: thanks it works :)

17:45 seangrove: Hrm, doesn't work for me :)

17:45 ,(map #(Character/isUpperCase %) (seq "aBcD"))

17:45 clojurebot: (false true false true)

17:46 waynr: why do clojure stacktraces always look like gibberish to me

17:46 seangrove: waynr: We've tried to make it better, but people like technomancy refuse to accept the PR into clojure.core for it

17:47 waynr: that's too bad...

17:47 i usually just end up changing random stuff around until i am able to get to the next step in getting things to run

17:48 seangrove: waynr: Actually, it's not too bad, you'll get used to it. There are some packages that make it better as well I think

17:48 But it isn't ideal, I agree

17:49 waynr: for example right now i see java.io.FileNotFoundException: Could not locate clj_time/local__init.class or clj_time/local.clj on classpath: but i'm not sure what clj_time is or what i'm doing that is leaving it out of classpath

17:53 ah, figured it out

17:55 "No such var: com.cemerick.pomegranate.aether/resolve-artifacts"

18:00 seangrove: thanks for the encouragement by the way

18:01 seangrove: waynr: Keep at it ;)

18:02 teslanick: Question: is there something like (doto) that allows for multiple assignment (does doto allow multiple assignment?

18:03 I have a dom node in clojure script that I want to set some properties on compactly without calling set! (.-blah node) over and over again

18:05 amalloy: teslanick: i mean, you can do it with doto, but it's not very pleasant: (doto node (-> .-blah (set! 1)) (-> .bar (set! 2)))

18:05 teslanick: Gross. Oh well.

18:05 amalloy: but you can easily enough write a macro set-multi! or something

18:06 teslanick: It might be easier to smash a new function onto the dom node that would let me use doto. :)

18:07 (and the JS programmer in me comes out)

18:16 dnolen_: optimized case dispatch in ClojureScript master

18:16 mi6x3m: any way to lazily append an element to a sequence in clojure?

18:16 dnolen_: not as fancy as Clojure's yet, but still a nice bump

18:22 waynr: interesting, respolve-artifacts was added in Pomegranate 0.3.0 but for some reason Pomegranate 0.2.0 is being used

18:22 can't quite tell why that is

18:24 Glenjamin: mi6x3m: i think http://clojuredocs.org/clojure_core/clojure.core/concat will do this

18:24 clojurebot: excusez-moi

18:25 dbasch: mi6x3m: what exactly do you want to do?

18:37 waynr: if my lein plugin specifies pomegranate 0.3.0 and 'lein deps :plugin-tree' doesn't show any other library requiring pomegranate, why is pomegranate 0.2.0 being used? is it related to the version of clojure or leiningen that i am running?

18:38 Glenjamin: i'd try throwing a debug line that prints out the classpath

18:39 technomancy: waynr: you can't override dependencies that ship with Leiningen itself

18:40 waynr: :/ is there a version of leiningen that uses pomegranate 0.3.0?

18:40 arrdem|finals: you could build one :P

18:42 waynr: this is true...but probably wouldn't always be practical for my intended use case

18:43 seangrove: arrdem|finals: Get back to finals

18:43 arrdem|finals: seangrove: fiiiine

18:43 tata

18:54 waynr: hmm so if i want to use the latest leiningen, should i just put https://github.com/technomancy/leiningen/blob/master/bin/lein in my PATH?

18:55 i did that, doesn't seem to have worked

18:58 derp, nevermind wget doesn't automatically overwrite existing files

18:59 it's trying to install leiningen-2.4.0-SNAPSHOT which i have installed in ~/.m2/

19:01 dbasch: waynr: why do you want to use an unstable version?

19:02 waynr: because it uses pomegranate 0.3.0 which has the cemerick.pomegranate.aether/resolve-artifacts function

19:02 pomegranate 0.2.0 does not have this function

19:02 so when writing a plugin it is apparently not available

19:03 okay so i have to copy the uberjar where the self_install shell function would normally put it

19:05 or maybe update the lein bash script to search for the snapshot in ~/.m2 if LEIN_VERSION contains 'SNAPSHOT'

19:05 or maybe i can get by without using resolve-artifacts

19:18 nathan7: I'm building a little thing for making DTrace more accessible from Clojureland

19:19 I have a macro that looks like (defprovider trace MyApp start hello [int String] end)

19:19 and the interface I'd like to have looks like (trace/start) (trace/hello 42 "Hello, world!")

19:20 I'm rather unsure about just barging into the user's namespace and creating a publically visible sub-namespace though

19:21 I was going for (create-ns (str *ns* "." name)), which would expand to (create-ns (str *ns* ".trace"))

19:21 and then defining trace/start, trace/hello and trace/end in that namespace

19:22 having that publically visible is a bit of a bummer, though

19:22 I suppose I could do (create-ns (gen-sym)), but I'm not sure if that's a sane idea

19:29 tuft: man, clojars is really picky about pgp public key format

19:29 had to trim headers, etc.

19:30 wow abbreviated scp deployment is wicked though

19:31 Glenjamin: nathan7: how about ((trace :start)) ?

19:32 nathan7: Glenjamin: trying to make it feel like a real function though

19:32 Glenjamin: (trace!start) perhaps?

19:32 nathan7: I'm doing the (create-ns (gensym)) thing now, it seems to be working alright

19:33 Glenjamin: i suppose if you're using it and the docs clearly say its going to create a namespace you should be fine

19:33 nathan7: I'm prefixing it with my module's own namespace now

19:34 so I have like jsdt.provider.probe1234

19:34 which you get imported as trace

19:34 Glenjamin: makes sense

19:35 nathan7: no polluting namespaces I don't own

20:04 amcnamara: dnolen_: any recommendations for a cljs book, I dig your work with om

20:05 dnolen_: amcnamara: I don't know of anything beyond the O'Reilly one. I mostly suggest getting familiar with Clojure, ClojureScript isn't that different.

20:05 amcnamara: cool, thanks!

20:10 servo: whats the right way to do this: (assoc {} :foo "bar" (if (= 3 3) [:been "baz"]))

20:13 Kitty-: I'm hoping someone can help, I'm trying to figure out how I can 'escape' quotes. I'm connecting to Oracle and to create a new table, quotes are needed. i.e "CREATE TABLE "TEUSER"."TEMP" " however I am not sure how or if there is a way to escape the double quotes needed around "TEUSER."TEMP", I've tried googling and had no joy, perhaps there is a way?

20:14 Glenjamin: servo: more than one assoc?

20:14 servo: watcher.core=> (println "\"FOO\"")

20:14 "FOO"

20:14 Glenjamin: nonono

20:15 Kitty-: for database stuff, you probably want to be using JDBC and whatever escaping facilities it provides that has knowledge of what is and isn't safe for use when talking to a database

20:16 servo: Glenjamin: how would i keep "state" of the previous assoc?

20:16 Glenjamin: servo: chain it

20:16 servo: not sure conceptually how to do that

20:16 space-otter: im not aware of a way to optionally chain function calls

20:16 Glenjamin: ,(let [m (assoc {} :foo :bar)] (if (= 3 3) (assoc m :been "baz") m))

20:16 clojurebot: {:been "baz", :foo :bar}

20:17 space-otter: ,(println "\"FOO\"")

20:17 clojurebot: "FOO"\n

20:17 servo: (inc Glenjamin)

20:17 lazybot: ⇒ 4

20:17 Kitty-: Glenjamin: In the depencies list, I see it's using clojure.org

20:18 It's using the clojure jbdc

20:18 I did find http://stackoverflow.com/questions/16115465/easy-way-to-work-with-text-without-having-to-escape-quotation-marks-in-clojure so I will try \

20:18 * Kitty- crosses fingers \ will work

20:19 Glenjamin: Kitty-: http://clojure.github.io/java.jdbc/

20:19 oh

20:19 but why are you typing the quotes?

20:19 Kitty-: Glenjamin: hmm? like why should they be in there or?

20:19 Glenjamin: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html#manipulating-tables-with-ddl

20:20 in general, when working with databases you should let the DB library take care of putting quotes in the right places

20:20 space-otter: it's probably better to use a higher level API where you can pass queries as data structures instead of strings

20:20 more robust

20:20 Kitty-: API, hah I wish

20:21 It's just a command line tool

20:21 space-otter: i mean like the library Glenjamin is suggesting

20:21 Kitty-: hmm

20:22 Here is a snipit of the code (where I attempted to add "'s with an \ escape) http://pastie.org/9163779

20:23 Although based on Glenjamin's link, I can use something like...

20:23 (jdbc/db-do-commands db-spec (jdbc/create-table-ddl :fruit

20:27 koreth_: Can someone explain why if-let with a destructuring form tests true even if the destructuring sets everything to nil? Example:

20:27 ,(if-let [[x] []] :succeeds)

20:27 clojurebot: :succeeds

20:28 koreth_: ,(if-let [[x y z] []] :succeeds)

20:28 clojurebot: :succeeds

20:28 koreth_: It wasn't the behavior I expected, which is a sign I don't understand if-let as well as I thought I did.

20:30 space-otter: ,(if [] :succeeds :fails)

20:30 clojurebot: :succeeds

20:31 koreth_: Oh, right. Duh. Thanks.

20:31 amalloy: koreth_: the "if" part of if-let doesn't know/care about how you're destructuring the value. it just looks at the value you're testing, and if it's truthy then it destructures it

20:31 koreth_: For some reason I had it in my head that it was looking at the truthiness of the bound values. Thanks.

20:32 space-otter: iirc false is the only falsey value

20:32 Glenjamin: ,(if-let [[x] (seq [])] :ok)

20:32 clojurebot: nil

20:32 Glenjamin: not that that's particularly readable

20:32 amalloy: space-otter: nil

20:33 space-otter: that too

20:41 Glenjamin: what are the advantages of moving a lib to clojure contrib?

20:41 seangrove: It's instantly obsolete?

20:41 If you want to make sure no one uses it in production, maybe.

20:42 Glenjamin: i note that simple-check moved recently

20:42 seangrove: Oh, no

20:43 Well, if that's what you mean by contrib, then I think the advantage is that it can be used in core clojure testing

20:43 Glenjamin: right, yeah - not the old contrib

20:44 not sure what the correct term is now

20:44 seangrove: "I'm happy to announce the first release of the newest Clojure contrib library: test.check"

20:44 Seems they call it that more or less as well

20:44 So, please excuse my joke

20:44 Glenjamin: it does seem to add a few barriers to contribution

20:44 seangrove: It does, but ti's not really a big deal

20:45 I didn't mind it at all for cljs contributions

20:45 Glenjamin: i have no objections to signing a CLA

20:45 but my pull request to an MIT licensed project on github is now in limbo due to an imminent move to clojure.data :)

21:09 coventry: Is there a way to execute a defspec at the repl? (In cljs with double-check, if it makes a difference.)

21:12 Glenjamin: you can just call it as a function

21:13 well, that works in simple-check - i asked the same thing yesterday

21:16 coventry: Thanks, I may be confused by bad uninformative errors from the browser repl, then.

21:18 Which namespace has such-that? Trying to get this example to run: https://github.com/clojure/test.check#clojuretest-integration

21:18 Ah, generators.

21:22 Am I doing anything wrong here? The contents of the property def seem to run fine in the first line when tested with (every?), but I'm still getting an error when I try to run the defspec. https://www.refheap.com/85324

21:29 Glenjamin: it looks about right to me, but i'm no expert

21:29 i suspect the cljs version cannot just be called

21:30 although the stack trace looks like it got into the body of the check

21:33 tomjack: is Writable insane?

21:33 (Hadoop's)

21:39 amcnamara: 4clojure's about to pass 555555 solutions :)

21:41 amalloy: tomjack: for most X, hadoop's X is insane. but Writable seems okay to me?

21:44 tomjack: I feel vaguely that the 'Clojure way' would not include anything like Writable

21:45 which makes me wonder -- is the Clojure way not satisfactory?

21:45 I conjecturally reduce this question to "do we really care about boxing and allocation _that_ much?"

21:46 s/care/need to care/

21:49 I guess if you're writing a framework that you expect many java developers in many different contexts to use for many years, the question sounds different

22:49 amcnamara: yay, 4clj just hit 555555 solutions

22:50 congrats amalloy

23:24 cljnoob: Anyone using Emacs Live? If so, how to get rainbow parens in a cider repl? Works OK when editing a file.

23:35 nathan7: I'm mucking around with *data-readers* at macro evaluation time — this seems to break when AOTing, though.

23:35 When I use (when *compile-files* …) though, it breaks when *not* AOTing, but works perfectly fine when AOTing

Logging service provided by n01se.net