#clojure log - Jul 12 2015

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

0:00 justin_smith: imagine taking english lessons from someone who doesn't understand basic grammar...

0:00 vas_: Hey guys, I'm using postal to send stuff, it works great, but how do I include line breaks or html formatting in my :body clause for emails?

0:00 freeman42: have to bend the mind to use fewer language features... which are quite utterly important :/

0:02 and this gives the same error: http://i.imgur.com/U5ewrcc.png

0:03 vas_: " probably the worst possible way to learn clojure, a compiler that doesn't even work" LOL

0:03 turbofail: freeman42: well you don't want to call `leattack' when you pass it in

0:03 freeman42: should be (times 2 leattack)

0:03 freeman42: turbofail, removed, but now it does not attack :) http://i.imgur.com/oi17QI5.png

0:04 turbofail: hm. well, it should

0:04 depending on what the hell `this' is

0:04 justin_smith: freeman42: yeah, that's just a broken compiler / env

0:05 freeman42: keep using it if it's fun I guess, but it will teach you nothing interesting about clojure

0:05 worse it will "teach" you things about clojure that are totally false

0:05 freeman42: right now it would force me to implement some times function which uses recursion

0:06 hmmm, false?

0:07 justin_smith: freeman42: because it doesn't interpret your code properly, I'm all but certain code will succeed in that environment that would be invalid in a real clojure environment. And beyond that, the style you need to use in order to solve those puzzles is the wrong way to be coding clojure.

0:08 turbofail: yeah, that side-effecting API there is pretty un-clojurific

0:08 tomjack: I wonder what the codecombat-in-cljs-bootstrap apis will look like

0:08 in-game apis I mean

0:08 turbofail: that said i've done plenty of side-effecting in clojure myself

0:15 justin_smith: turbofail: it goes beyond that though

0:16 turbofail: for example (.goLeft this) (.goRight this) (.hokeyPokey this) is better expressed as (doto this .goLeft .goRight .hokeyPokey) which is totally invalid in that environment

0:42 vas_: what's a simple way to check if an email address in properly formed? regex?

0:43 justin_smith: vas_: oh man emails are crazy, and most email programs don't even get them right

0:43 vas_: こんにちは

0:44 justin_smith: the only simple, and fully reliable way to check an email is to send a message to it

0:44 vas_: did you know emails allow inline comments?

0:44 vas_: Hahah

0:44 justin_smith: what.

0:44 justin_smith: like /* this is not my real email? */

0:45 justin_smith: like me(this part is a comment)smith@some(this is also a comment)host.com

0:45 vas_: justin_smith: I use a + sign in my gmail all the time...

0:45 Wow. I had no idea that was valid according to the 80s

0:45 justin_smith: that's a gmail convention - emails is a crazy spec, and I doubt many people even implement it properly

0:46 including email providers

0:46 vas_: Okay. I will just leave it up to the user to not have any typos before they click 'take a bunch of my points to invite a friend'

0:47 justin_smith: "john.smith(comment)@example.com and (comment)john.smith@example.com are both equivalent to john.smith@example.com."

0:47 https://en.wikipedia.org/wiki/Email_address

0:47 vas_: haha, or you could use one of the many many half assed and incorrect validators (all regex based) that work on 99.99% of addresses people use

0:47 vas_: but it's just a sad state of affairs

0:49 vas_: read this list and weep for any validator https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses

0:51 http://i.imgur.com/nZS5OB7.jpg

0:53 vas_: #!$%&'*+-/=?^_`{}|~@example.org

0:53 Even has that hysterical winky face

0:54 Hahahaha mathematical sobbing

0:54 crying deltas

0:57 Man I'm excited. I've been working on the first phase of this website/app for a few months on and off now, and I am almost ready to go live.

0:57 Thank you Clojure

0:58 Anyone played around with titanium (graph [as in directed] library) ?

0:58 justin_smith: vas_: I looked at it but didn't actually end up using it

0:59 vas_: justin_smith: do you know of any alternatives to doing graphy things?

0:59 for*

0:59 justin_smith: my tech lead just ended up impelmenting a bunch of stuff from scratch (but I'm still not convinced that is the best way to do it)

1:00 vas_: Yeah that would be a great learning exercise.. _but_

1:01 not really where I wanted to spend the next few weesk ^_^

1:01 weeks (read as months years eons)

1:03 freeman42: both of the last 2 lines work in Clojure REPL but not in CodeCombat :( http://i.imgur.com/a7QM0xU.png

1:04 justin_smith: freeman42: I am amazed you haven't given up on that thing yet

1:04 freeman42: no macros? ok..., but no lambdas?!?! nooooo :'( no point in continuing to play using Clojure

1:04 well, the whole point was to learn something

1:04 justin_smith: heh, I spoke just a little too soon I guess :)

1:05 freeman42: is there a 3rd way to do lambdas? :p

1:05 justin_smith: it would be cool to make something like that game, but using cljs (no need for sandboxing, since everything is evaluated browser side)

1:06 #() is just a reader macro for (fn []) but there is also eg. comp, and partial

1:06 but I seriously doubt those would be supported if fn isn't :P

1:06 vas_: I was reading earlier that (fn []) has an implied (do)

1:07 justin_smith: indeed!

1:07 vas_: not sure what difference that makes in practicality

1:07 justin_smith: (fn [] (println "what") 42) for example

1:07 let also has an implied do

1:07 for does not

1:07 doseq does

1:08 when does

1:08 freeman42: argh :( that last console message http://i.imgur.com/lBipW2d.png

1:11 vas_: so would something like "for" eventually terminate on a "nil" ?

1:11 justin_smith: vas_: ?

1:11 I don't even understand that question

1:12 vas_: that's okay, I did not understand it when asking

1:12 don't worry about it

1:12 You answered it earlier with justin_smith> (fn [] (println "what") 42) for example

1:13 justin_smith: vas_: since for is explicitly only for lazy operations, they intentionally did not add an implicit do, because those are for side effects

1:14 whereas just about every other macro that has a "body" has a do

1:14 vas_: Ahh that makes perfect sense

1:14 because a lazy body, like the universe, only exists when you're measuring.

1:14 ;D

1:14 justin_smith: something like that

1:15 vas_: Haha i will have to work on my quantum standup..

1:15 justin_smith: side effects inside lazy things make code go wrong in so many weird ways

1:22 freeman42: I give up, this will have to do for now http://i.imgur.com/UzSICco.png

1:24 vas_, is it idiomatic enough?

1:25 vas_: freeman42: Beeeauuuuutiful

1:25 =)

1:25 freeman42: vas_, lol, not sure if serious or joking :p

1:25 vas_: well i think it is beautiful

1:25 others have their opinions no doubt

1:26 freeman42: ok, cool then :) got some abstractions learned for now

1:26 clojurebot: Pardon?

1:26 vas_: the way you implemented that looks a lot like ->>

1:27 try (->> ["Rig" "Gurt" "Ack"] (attack 2))

1:27 freeman42: ah yeah, we never spoke about -> and ->>

1:27 reads up

1:27 vas_: they're very cool!

1:27 justin_smith: vas_: that wouldn't work in regular clojure

1:28 vas_: it's like operator pizza

1:28 justin_smith: yeah i had my suspicions.. what would be the proper way? or is it not really the appropriate circumstance

1:28 justin_smith: vas_: it would require a map and dorun or something

1:28 and a partial maybe

1:28 turbofail: there's run!

1:29 in 1.7

1:29 justin_smith: (doc run!)

1:29 clojurebot: "([proc coll]); Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the collection. Returns nil"

1:29 justin_smith: turbofail: I doubt his weird env supports that

1:29 turbofail: oh i thought we were talking about regular clojure

1:29 justin_smith: turbofail: but yes, run! would be perfect

1:29 vas_: what would it look like using run?

1:30 justin_smith: (->> ["Rig "Gurt" "Ack"] (run! (partial attack 2))

1:30 freeman42: tried to read about -> but I understood that this it not even his final form (I don't know what a form is)

1:30 justin_smith: freeman42: a form is a unit of a clojure program

1:31 vas_: like a brick for building a house out of?

1:31 justin_smith: "(+ 1" is not a form, "(+ 1 2)" is, as is "+"

1:31 freeman42: for me that is like explaining that a bloopeedy doop is a unit of goopidy foo

1:31 vas_: mmm goopidy foo

1:31 justin_smith: freeman42: a form is a valid input to a clojure compiler

1:31 freeman42: uhm,... ok :)

1:31 vas_: Whoa

1:31 I just put +

1:31 into my repl

1:31 justin_smith: freeman42: in clojure, most places where you can use a value, you can also use a form

1:31 vas_: and got

1:32 #<core$_PLUS_ clojure.core$_PLUS_@6c3c0ef2

1:32 justin_smith: right, that is the value of +

1:32 freeman42: justin_smith, I think this for another day for me :)

1:45 still hoping for a times function, too many _-es http://i.imgur.com/cyxqDOi.png

1:46 there is a way to create a range easily I assume

1:47 justin_smith: ,(range)

1:47 clojurebot: (0 1 2 3 4 ...)

1:47 freeman42: was thinking to implement repeat using a range as recursion is not supported

1:55 justin_smith, any other way? ^^ (defn times [n f] (doseq [_ (take n (range))] (f))) does not seem to work in closer.js either

1:55 or rather, in codecombat at least, works in clojure repl just fine

1:55 justin_smith: freeman42: (take n (range)) is just (range n)

1:55 freeman42: oh

1:55 justin_smith: maybe that version works?

1:56 freeman42: I'll try

1:57 justin_smith, nope, it seems it does not know the range function

1:57 guess it could be implemented... with some other thing? :)

1:58 justin_smith: loop?

1:58 clojurebot: loop is a macro of last resort

1:58 freeman42: I'll give it a try

1:58 justin_smith: clojurebot: yes, but he appears to be out of other options

1:58 clojurebot: Pardon?

1:58 justin_smith: haha

1:58 amalloy: it sounds like you are not writing clojure, so much as just trying to guess at an arbitrary set of undisclosed rules

1:58 justin_smith: indeed

1:59 freeman42: amackera, you are pretty much correct, but it is still fun

1:59 justin_smith: broken compiler as game

1:59 freeman42: hahaha, funny way of putting it

2:06 so loop/recur is the equivalent of for/while loops in some other languages?

2:06 justin_smith: exactly

2:08 freeman42: well, we also have while

2:08 but loop is usually more convenient because it provides updated bindings, and while requires some mutable object to test

2:08 freeman42: justin_smith, is it easier to comprehend?

2:10 clojure docs seem to think it is pretty idiomatic "While for is somewhat like a loop, recur is a real loop in Clojure. recur represents such a remarkable idea that we might even say, “this is Clojure.” "

2:10 justin_smith: freeman42: while is loop without the bindings (and a test instead). easier to comprehend depends - is a mutable object easier to comprehend than a recursive call with new bindings?

2:10 freeman42: ah wait, that is not clojure docs...

2:11 hmm, dunno, looking over them now

2:12 justin_smith: freeman42: loop is like a recursive function, except only allowing self-calls from the tail position

2:13 freeman42: that sounds quite nice

2:21 justin_smith: freeman42: as the clojurebot factoid indicates, we consider it the low level way to do things usually, but it sounds like you don't have the other options

2:26 rritoch: Loops aren't easy to use or read, at least for people new to lisp, so there are now a number of higher level abstractions which provide easier to use and read flow-control. Unfortunatly your not guaranteed any portability because there's no LISP standard (such as ANSI). Technically loops are more portable but they're low-level and part of CLISP.

2:27 If you care about portability, loops are really the way to go. If you care about your sanity, use anything but.

2:36 Well, I guess Common Lisp (Clisp) is technically an ANSI standard, but it's extremly outdated and doesn't fit well into modern applications.

2:38 justin_smith: Is clojure CLISP compliant? I've never actually tried to run CLISP apps on clojure, I just assumed they wouldn't work.

2:38 Chousuke: Clojure is very different from Common Lisp

2:39 about the only thing they have in common is that both have lots of parentheses :P

2:46 justin_smith: rritoch: CLISP is a specific implementation of the common lisp standard, it is not a shortcut for common lisp. Clojure does not intend or attempt to implement common lisp.

2:47 clisp: http://www.clisp.org/ - just an implementation

2:51 Chousuke: to be fair, clojure macros owe more to common lisp than any other language

2:55 rritoch: justin_smith:I wouldn't say clojure has no intent of implementing common lisp. The political environment of clojure is clearly ruled by $$, the first time a big company goes to cognitect asking for compatiblity with their legacy apps, I'm sure clojure will fall in line with common lisp.

2:56 H4ns: rritoch: sorry, but that is utter nonsense. you need to know more before making such claims.

3:00 rritoch: H4ns: Clojure doesn't qualify as not-for-profit, and certainly isn't backed by the Free Software FOundation.

3:01 H4ns: These are facts which should be readily available to anyone taking up clojure. Clojure is open source and still proprietary.

3:05 H4ns: I guess I was wrong about the free software foundation status

3:06 H4ns: I really don't know the relationship between clojure and FS

3:06 err, FSF

3:10 H4ns: It is something I'd be interested in learning though because when I was working for a venture capital firm developing apps in clojure I submitted feature requests based on features that they needed for their systems, the requests were not flat out denied, but they made it very clear that the requests would probably never be integrated with clojure.

3:12 H4ns: It seemed to me as if the reason was based on the fact hat cognitect clients had no need for the features.

3:12 H4ns: rritoch: what makes you think that?

3:13 rritoch: H4ns: Checking my old emails.

3:13 H4ns: rritoch: maybe you want to discuss one of your language feature proposals instead.

3:14 rritoch: H4ns: No need. I was able to implement it (recently) without any support for clojure by using reflection.

3:14 H4ns: rritoch: that is probably the reason why your feature request was denied.

3:18 rritoch: H4ns: The request was never denied, and at the time it wasn't known that it could be implemented with reflection.

3:20 H4ns: rritoch: in any event, you're mixing up many things: common lisp, free software, clojure features, cognitect customers, reflection - too many for me, i need to drop out of this discussion.

3:24 rritoch: H4ns: These are all different issues, but related. Clojure isn't standards compliant, clojure is proprietary property of cognitect, if clojure is backed by FSF there is at least some guarantee that it will remain free software. Reflection is just an implementation detail, unrelated to the feature. It was an alternative implementation, or more like hack, to get around clojure politics.

3:25 chelseaclinton: got problems installing leiningen on windows

3:26 i've installed leiningen but when i hit lein into a cmd prompt, then i get this standalone-jar not found. When I do lein self-install "unable to locally verify the issuers authority"

3:29 got it working using this fix: https://github.com/technomancy/leiningen/issues/1902

6:19 j-pb: urgh, clojures numeric tower is even more broken than I though, `denominator` and `numerator` are not safe to use except if you do a manual type check for ratio?

6:20 for example + will recast them into bigints and on those numerator and denominator are invalid

6:20 ,(nominator (+ 1/2 4/3))

6:20 clojurebot: #error {\n :cause "Unable to resolve symbol: nominator in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: nominator in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: nomin...

6:21 j-pb: ,(denominator (+ 1/2 4/3))

6:21 clojurebot: 6

6:21 j-pb: ,(denominator (+ 1/2 1/2))

6:21 clojurebot: #error {\n :cause "clojure.lang.BigInt cannot be cast to clojure.lang.Ratio"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.BigInt cannot be cast to clojure.lang.Ratio"\n :at [clojure.core$denominator invoke "core.clj" 3468]}]\n :trace\n [[clojure.core$denominator invoke "core.clj" 3468]\n [sandbox$eval72 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compi...

6:36 bpr: does anyone know why tools.reader.edn can't read "(get @*rmq-publications* 0)" but clojure.core/read-string can?

6:37 I mean what's the rationale? It's clear that there's no reader-macro defined for \@ in the edn reader, but why?

6:41 hiredman: edn is a data format, the reader macro @x expands in to a call to the deref function, edn having a reader macro for that would be like json having special syntax for encoding a call to javascripts toString method

6:43 bpr: so if i'm writing a code analyzer i should use c.t.r/read-string instead?

6:43 ok

7:09 freeman42: ehm, why would this give a null-pointer exception? http://i.imgur.com/LWtsqdg.png

7:09 lumafi: because you're calling runit and passing to it the return value of println, which is nil

7:09 so you try to call nil inside runit

7:10 freeman42: ah

7:10 I'm doing it wrong, thank you :)

7:15 gmanny: what are clojures main advantages over python?

7:31 H4ns: gmanny: they're different languages and fulfill different needs. there is no way to meaningfully specify one as the other with certain advantages.

7:35 gmanny: that said, the main advantage of clojure over python is that it is much better :D

7:35 catonano: exploring clj-date, I'm having

7:35 (f/parse multi-parser "2013-03-07 17:00:00")

7:35 => #<DateTime 2013-01-07T17:00:00.000+01:00>

7:36 the month, 03, is being parsed as "01"

7:36 look

7:36 (f/unparse multi-parser (f/parse multi-parser "2013-03-07 17:00:00"))

7:36 => "07/00/2013 17.00"

7:36 I had created the parser with

7:36 (def multi-parser (f/formatter (t/default-time-zone) "dd/mm/YYYY HH.mm" "YYYY-mm-dd HH:mm:ss"))

7:36 What am I doing wrong ?

7:37 H4ns: catonano: you're using mm for both month and minutes

7:37 gmanny: H4ns: :). can you expand on that a bit, what things does it do better?

7:37 catonano: H4ns: Oh gosh. I had completely missed that !

7:37 H4ns: thanks !

7:38 H4ns: gmanny: it caters better for my taste. really.

7:39 gmanny: "good/better/best" is not a helpful category when judging languages. you need to ask more specific.

7:39 gmanny: for example, you could ask whether python or clojure support object oriented programming better, and the answer would be "python".

8:27 freeman42: was wondering, does . at the begining of a function name has any special purpose? eg. (.moveRight this) or is it just valid part of the identifier?

8:28 was thinking to refactor (.moveRight this) into something called like (go :direction count) and/or (go :direction) for count = 1

8:30 H4ns: freeman42: . at the beginning of a "function name" indicates that the form is not a function call, but rather a java method invocation (http://clojure.org/java_interop)

8:32 freeman42: H4ns, thanks, interesting to know, that sheds some light on where the code is interpreted

8:33 crocket: Does clojure support bitwise operations like & and | ?

8:33 >, >>

8:34 freeman42: crocket, https://clojuredocs.org/clojure.core/bit-and

8:34 https://clojuredocs.org/clojure.core/bit-or

8:35 https://clojuredocs.org/clojure.core/bit-shift-right

8:36 crocket, what does > and >> mean? :) I assume one of them is bit shift right

8:37 crocket: 2 >> 3 means shift '2' three times.

8:37 2^3

8:37 2*2^3

8:38 freeman42: crocket, can't seem to find a shift right/left n times function

8:39 guess you could easily create one by repeatedly applying shift

8:40 dottedmag: freeman42: >> is the same as bit-shift-right

8:41 freeman42: dottedmag, oh, it does take a number of shifts to apply, didn't notice

8:41 crocket: How efficient is bit-shift-left compared to << in C and java?

8:42 freeman42: probably as efficient as java, best bet is to try it

8:42 crocket: ok

8:42 java has '>' operator.

8:43 dottedmag: erm, "greater then"?

8:43 freeman42: dottedmag, funny :)

8:44 crocket: Oops

8:44 dottedmag: crocket: do you mean >>>?

8:44 crocket: >>

8:44 '>>' operator

8:44 dottedmag: crocket: bit-shift-right

8:44 crocket: >>> is unsigned-bit-shift-right

8:44 crocket: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html

8:45 freeman42: or maybe the `goes to` operator while (n --> 0) :D http://stackoverflow.com/questions/1642028/what-is-the-name-of-the-operator

8:46 crocket: I was worried that clojure couldn't do bitwise operations.

8:46 Clojure seemed to operate at such a high level that I thought it couldn't do bitwise operations.

8:48 freeman42: another beginner question... say I want to match on the 4 directions (need someting like a C# enum in Clojure) what can I use for that enum?

8:48 related to "was thinking to refactor (.moveRight this) into something called like (go :direction count) and/or (go :direction) for count = 1"

8:49 think I heard before that symbols (:symbolName) can be used for that

8:49 H4ns: freeman42: those are keywords, and they can be used for the purpose you describe.

8:49 freeman42: just not sure how/if they are needed to be declared and and example of matching on them

8:49 *an example

8:50 H4ns: freeman42: keywords are not associated values, though, so if you need to map to numbers, you'll have to manually translate them or use variables instead.

8:50 freeman42: keywords need not be declared. you can just use them.

8:51 freeman42: H4ns, not sure what you mean by map to numbers, I'm thinking to refactor (.moveRight this) into something called like (go :direction count)

8:51 so inside the go function I'd pattern match on a direction

8:51 H4ns: freeman42: as you know, .moveRight is not a function invocation, but a java method call, and as such, you cannot replace it by a function directly.

8:52 oddcully: s/:direction/:east/ ?

8:52 freeman42: and call the corresponding (.moveRight this), (.moveUp this) etc

8:52 oddcully, yeah, something like that

8:52 H4ns: freeman42: java methods are not first class objects, so you'll have to use (case direction :left (.moveLeft this) :right (.moveRight this) ....)

8:53 terom: maybe just use :left, :right, :up, :down - you don't need enum like thing

8:53 freeman42: oh, there is a case statement cool, is that prefered to core.match?

8:54 H4ns: freeman42: case is a more specific tool than core.match, which can do more things at the expense of being generally slower.

8:54 freeman42: terom, yes, I will probably do that, even though an enum would be nice to limit the possible values

8:54 H4ns, ok, I'll give it a try, thank you for all the help

8:54 H4ns: freeman42: if you use case, you'll get a run-time error when no clause can be matched and no default clause exists.

9:03 freeman42: hmmm

9:03 H4ns, I see, so it is like the C# case statement, that is ok

9:08 oh boy, nothing works in this game :D http://i.imgur.com/gPuHmH6.png

9:13 chelseaclinton: freeman42: sauce?

9:13 freeman42: oh, I'm drunk nvm

9:13 does not support case either, aw man :( http://i.imgur.com/xGzeSuH.png

9:13 chelseaclinton: what kind of game is that

9:14 freeman42: chelseaclinton, https://codecombat.com

9:14 it has an option to switch to clojure when playing but it is experimental

9:15 chelseaclinton: I am most grateful

9:15 * freeman42 hears XP gain sounds and level up.

9:16 freeman42: chelseaclinton, after you see how flawed the clojure engine is you might wanna hunt me down :D

9:16 doesn't even support function as values

9:19 chelseaclinton: i'm doing basic syntax for now

9:21 freeman42: no cond either o.O' http://i.imgur.com/NO04EX1.png

9:21 Wild_Cat: quick poll: SublimeText's support for Clojure seems to suck. Should I settle for what little it does and leverage the (Windows) command-line for the rest, or should I attempt the switch to IntelliJ for Clojure work?

9:22 freeman42: Wild_Cat, switch to IntelliJ :D I think the community edition gives you all that you need

9:22 Wild_Cat, I'm using Cursive plugin right now, but that won't be free for long afaik

9:22 the default clojure plugin should be not bad either

9:23 Wild_Cat: how much should I expect to pay for that?

9:23 freeman42: Wild_Cat, not sure, check https://cursiveclojure.com/

9:24 Wild_Cat: that's... vague :p

9:25 ty for the info, still

9:25 freeman42: Wild_Cat, might want to give Atom a try also http://i.imgur.com/23F725m.png

9:25 Atom got quite... or rather very fast lately

9:26 oddcully: the authors wording here was like this here in the past: cursive will be sold as a third party addon to intellij in the price range of webstorm etc (the smaller packages, not ultimate)

9:26 Wild_Cat: freeman42: ha. Would that mean there's actually something Atom does *not* suck at? Interesting, I'll take a look

9:26 freeman42: Wild_Cat, the Atom Haskell plugins are really amazing lately, and setup is very very easy using stack for dependencies

9:26 probably similar for Clojure

9:27 Wild_Cat: (my early experience with Atom was thoroughly unimpressive. It really felt like a slow, bad version of Sublime that can't open log files)

9:27 freeman42: sweet.

9:27 freeman42: Wild_Cat, ah yeah, Atom when it appeared was really slow and quite bad, now it is quite amazing (not bad)

9:28 gmanny: what is clojure better at than python?

9:28 mmeix: more fun to program :-)

9:28 freeman42: gmanny, clojure is better than python because it is not python :)

9:29 oddcully: gmanny: questions like this will only provoke opionionated answers (especially, if you ask them about @language in #language)

9:29 freeman42: gmanny, this is my favorite site for getting a general idea of language comparisons based on their qualities:

9:29 http://hammerprinciple.com/therighttool/items/clojure/python

9:30 oddcully: gmanny: do you know python and want to learn clojure? or do you want to know in what of those languages to "invest" next?

9:30 gmanny: oddcully: I know, which is what I expect.

9:30 I know python


9:32 gmanny: that is an interesting page. it is vote based?

9:32 freeman42: gmanny, seems so

9:36 Wild_Cat, if you are giving Atom a try, please tell us how it goes

9:39 Wild_Cat: freeman42: will do!

9:40 gmanny: as a seasoned (8+ years) Pythonista currently learning Clojure, the main selling points are immutable data structures, metaprogramming, interop with the JVM, ability to run in the browser (ClojureScript) and performance. Specifically, parallel processing performance and STM.

9:41 freeman42: should have just read the issues ^^ it seems when IS implemented... now let's see what `when` does

9:41 Wild_Cat: it is my belief that Clojure systems are easier to scale up than Python systems.

9:41 that, and Leiningen rocks, too.

9:44 FWIW, I want to use Clojure to generate boring C++ code.

9:44 liuchang: boring C++ code .....

9:45 freeman42: Wild_Cat, shhh, that might offend someone :p

9:45 too late

9:45 Wild_Cat: it's the code that is boring, not C++.

9:45 I'm talking hundreds of lines of near-identical boilerplate crap.

9:45 freeman42: Wild_Cat, ah, badly written C++

9:46 C++ certainly has the abstractions of making it non-redundant

9:46 Wild_Cat: stuff that should be autogenerated but isn't, and that I'm tired of cut&pasting

9:47 freeman42: Clojure question: can I use `when` in place of a `case`?

9:47 liuchang: do you think about Template and Macro in C++ to solve the problem

9:47 Wild_Cat: (and crap conversions between near-identical types because the idea of standardized types hit C++ stupidly recently)

9:48 liuchang: yes, and sadly the need to support MSVC 2010 and Clang on the same codebase means I'm locked out of a ton of features (variadic templates, ##__VA_ARGS__ ...) that *would* significantly reduce the size of my codebase were I able to use them.

9:51 liuchang: sorry, i can't get your point. you mean that Templates and ##__VA_ARGS__ can't be supported by diff compilers ?

9:52 Wild_Cat: liuchang: MSVC 2010 doesn't support variadic templates, and it doesn't support ##__VA_ARGS__ either (or rather, it does, as a special-case to __VA_ARGS__ which Clang does *not* support)

9:53 so to answer your question, yes, the need to support different compilers makes our codebase bigger, less elegant and more auto-generated :(

9:54 nooga: is there a way to inspect running threads? I'm fighting with async manifold code and my laptop is getting hot once in a while when there's not much going on

9:54 liuchang: ok.. thanks

9:56 freeman42: any idea what I'm doing wrong here? or is it not possible? http://i.imgur.com/RBMHvk4.png

9:58 nooga: freeman42: see http://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/case/ instead of when

9:58 when is like (if something something nil)

9:58 freeman42: nooga, can't use case cause of https://github.com/vickychijwani/closer.js/issues/3 this is for use in CodeCombat using closer.js, a subset of Clojure

9:58 nooga: so your first when evaluates as you'd expect, but the second one evaluates to nil and that's what your function returns

9:59 freeman42: nooga, oh, I see

9:59 so then I can solve it with if chain :(

10:00 nooga: wait, they're talking about cond

10:00 cond != case

10:01 freeman42: nooga, yeah, but I mentioned in last comment that case is not supported either

10:01 nooga: ah, didn't notice, sorry

10:01 oddcully: freeman42: at first glance i found the whole idea there really a nice idea (gamification of learning programming languages). but the code indenting is off and things like case/for are not even working

10:01 so they basically want to type me in (.moveRight this)

10:02 freeman42: oddcully, you could probably reinvent some abstractions, and it would also be fun :)

10:02 oddcully: to me this looks like pretty odd way to let me learn clojure

10:02 freeman42: oddcully, ah yeah, definitely a bad way to learn clojure, takes away a lot of the critical functionality

10:02 like, no functions as values, no case/cond :/

10:03 I wonder how hard it would be to implement them in their open source repo of closer.js

10:04 oddcully: well that is basically the nail into the coffin for me. why would i learn closer instead of clojure(script)

10:05 freeman42: oddcully, cause it could be still more useful than playing some other game which does not teach a programming language

10:06 and working with a subset of clojure is still something cool to learn

10:06 you could probably recreate different functions yourself

10:06 nooga: I started by implementing scheme :D

10:06 freeman42: hahahahaha xD that was hilarious :D

10:07 nooga, when you finish, please post a link to your blog post on it to HN, reddit etc.

10:07 will be a fun thing to read

10:07 "How I implemented Scheme in a bad subset of clojure in CodeCombat"

10:08 good example of monsters crawling out of the turing tar-pit

10:09 nooga: :]

10:10 liuchang: I would like to implement a scheme :)

10:10 freeman42: is this idiomatic indentation of if piramid of doom? http://i.imgur.com/yy5Kkeb.png

10:14 oddcully: looks like idiomatic closer code :X

10:29 freeman42: this works http://i.imgur.com/BcqfIvB.png , but I will have to paste it almost all of the time since they do not provide any way to store user functions accross levels

10:30 liuchang: what's this game?

10:31 freeman42: hadou ken!!! http://i.imgur.com/BtjZedW.jpg

10:31 liuchang, www.codecombat.com

10:31 liuchang: thanks

10:31 freeman42: liuchang, yw

10:32 crocket: Is it possible to include two versions of the same jar in a leiningen project?

10:33 liuchang: No

10:34 crocket: Does leiningen pull dependencies recursively as npm does?

10:34 H4ns: crocket: yes.

10:36 crocket: ok

10:36 What about clojurescript?

10:37 freeman42: really funny, used dotimes on the previous levels xD http://i.imgur.com/cOhsutc.png

10:41 mmeix: could someone lend me an eye on https://www.refheap.com/106013 - can't load a lib in boot ...

10:41 (maybe some silly typo)

10:43 freeman42: and then can't use the (go direction count) function cause of line limit bonus :D DRY - do repeat yourself http://i.imgur.com/04lun3P.png

10:44 mmeix, maybe you don't have the jar containing that namespace added as a dependency

10:45 oh wait, you do

10:45 maybe it needs that :scope "test" thing too?

10:45 mmeix: reagent didn't need it, and gets loaded without problem

10:46 hm

10:48 just tested - this is not the problem

10:49 oddcully: mmeix: this is clojurescript code?

10:50 freeman42: mmeix, what IDE are you using?

10:50 mmeix: Clojurescript, yes

10:50 IDE = Light Table

10:50 oddcully: i am not sure about this, but are generic clj libs compatible with cljs at all?

10:51 in the browser even a js/JSON could be enough for what you are up to

10:51 mmeix: ah, maybe data.json is not cljs compatible

10:51 oddcully: also transit is a popular choice for the client

10:52 mmeix: the use case is another: I just need to convert a lengthy JSON once to a Clojure(Script) map

10:52 it doesn't change

10:52 (a huge map of settings for a music font)

10:52 will do this in Clojure instead

10:52 and just copy paste in

10:52 thanks

10:56 freeman42: mmeix, maybe: http://swannodette.github.io/2014/07/26/transit--clojurescript/

10:56 mmeix: ah, thanks!

10:56 freeman42: mmeix, and this might be helpful too http://stackoverflow.com/questions/9820869/idiomatically-accessing-json-objects-with-clojurescript

10:56 mmeix, yw

11:01 is there an int.max in clojure? (dotimes [_ intMaxHere] (.attack this "Door")))

11:02 ah, found it: Integer/MAX_VALUE

11:03 only it does not work in closer.js, gosh (dotimes [_ Integer/MAX_VALUE] (.attack this "Door")))

11:04 liuchang: interesting game

11:09 freeman42: liuchang, wish they would give better use cases when introducing new concepts

11:09 liuchang, not sure if having let bindings is any use here http://i.imgur.com/JbQ0S6B.png

11:10 or rather, could just say that it is not, cause it is not :)

11:10 when introducing let bindings they should at least tought of a case when they wouuld have been actually useful, as in reusable

11:10 liuchang: just introduce the variable

11:10 i think

11:11 *let* is local bind

11:11 it's not easy to introduce this

11:12 so, I think this game will introduce it again, with more words

11:12 freeman42: it just started badly, as in, here's a tool... there is no problem it solves in this case, but use it anyway!

11:13 here's the solution, now find a problem :)

11:13 liuchang: : )

11:14 It's too slow to learn clojure....

11:14 I prefer to read book...

11:16 freeman42: doing it mostly for the fun, there are definitely better ways of learning clojure

11:16 liuchang: yes : )

11:16 freeman42: this game has the benefit of forcing me to actually use clojure, with learning clojure optional :)

11:16 liuchang: It's very interestring

11:17 freeman42: easier to get trapped in the opposite, reading a lot and almost never doing anything

11:17 doing automatically forces a minimal ammount of thinking, not the same way with reading

11:18 now they shown an actual reuse of let http://i.imgur.com/7tdlPH2.png

11:19 liuchang: I am here too~

11:19 freeman42: you are playing much faster

11:19 liuchang, how much Clojure experience do you have?

11:20 liuchang: a litter...

11:20 just read some books

11:20 programing in clojure, the joy of clojure, 7 weeks 7 concurrents

11:22 freeman42, and you?

11:22 freeman42: liuchang, actually this still has no use as it is highly redundant http://i.imgur.com/Pt11C2C.png

11:23 liuchang, this is my entire Clojure experience, read it 2 or 3 times http://learnxinyminutes.com/docs/clojure/

11:23 liuchang, plus a few meetups I attend

11:24 liuchang: where are you from :)

11:24 i use cpp and python in work, clojure is just for fun.

11:25 freeman42: liuchang, currently Dublin, Ireland, I use C# at work

11:26 liuchang: beautiful Ireland

11:26 i come from China

11:29 freeman42: liuchang, let was completely unneded now too :( 1 liner http://i.imgur.com/D1xTAr4.png

11:29 virmundi: hello. does anyone have a systemd configuration example for a ring app?

11:32 drwin: it there a variant of threading macro -> which would pass object further in the pipeline when fn returned nil?

11:34 freeman42: liuchang, I wonder when it will actually have a level when let is actually needed

11:35 oddcully: drwin: did you mean "which would NOT pass"... ?

11:36 drwin: oddcully: no, I want it to pass, I don't want to reinvent some->

11:37 oddcully: but isn't -> just passing it?

11:37 drwin: oddcully: I'm going to modify some-> macro to do it, it has the test there

11:37 oddcully: no, if expr returns nil, then nil flows down the pipe

11:38 I want when any expr return nil, it would not modify existing input, and pass it down

11:38 s/return/returns/

11:39 basically "nil" answer means, I don't want to touch "it"

12:16 gfredericks: drwin: I don't think anything exists, no, but it's not hard to make it

12:18 ,(defmacro heck-> ([x] x) ([x form] `(-> ~x ~form)) ([x form1 form2] `(let [x1# ~x x2# (-> x1# ~form1)] (-> (if (nil? x2#) x1# x2#) ~form2))) ([x form1 form2 & more] (heck-> (heck-> ~x ~form1 ~form2) ~@more)))

12:18 clojurebot: #'sandbox/heck->

12:18 gfredericks: ,(heck-> [1 2] next next next next)

12:18 clojurebot: #error {\n :cause "Attempting to call unbound fn: #'clojure.core/unquote"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalStateException\n :message "Attempting t...

12:18 gfredericks: whoopsiedoodle

12:18 ,(defmacro heck-> ([x] x) ([x form] `(-> ~x ~form)) ([x form1 form2] `(let [x1# ~x x2# (-> x1# ~form1)] (-> (if (nil? x2#) x1# x2#) ~form2))) ([x form1 form2 & more] `(heck-> (heck-> ~x ~form1 ~form2) ~@more)))

12:18 clojurebot: #'sandbox/heck->

12:18 gfredericks: ,(heck-> [1 2] next next next next)

12:18 clojurebot: nil

12:19 gfredericks: I guess that makes sense

12:19 ,(heck-> [1 2] next next next next next identity)

12:19 clojurebot: nil

12:19 gfredericks: hmmm

12:19 oh yeah

12:19 er no I'm not sure

12:29 ,(defmacro heck-> ([x] x) ([x form] `(-> ~x ~form)) ([x form1 & more] `(let [x1# ~x x2# (-> x1# ~form1)] (heck-> (if (nil? x2#) x1# x2#) ~@more))))

12:29 clojurebot: #'sandbox/heck->

12:29 gfredericks: fixed it; the recursion was wrong; didn't need that many clauses anyhow

12:29 ,(heck-> [1 2] next next next next next identity)

12:29 clojurebot: (2)

12:30 gfredericks: oh wait I'm treating the last function differently but I bet that's not how it's supposed to work

12:30 ,(heck-> [1 2] next next next next next next)

12:30 clojurebot: nil

12:30 gfredericks: yeah that's bad

12:34 ,(defmacro heck-> ([x] x) ([x form1] `(let [x1# ~x x2# (-> x1# ~form1)] (if (nil? x2#) x1# x2#))) ([x form1 & more] `(heck-> (heck-> ~x ~form1) ~@more)))

12:34 clojurebot: #'sandbox/heck->

12:34 gfredericks: ,(heck-> [1 2] next next next next next next)

12:34 clojurebot: (2)

12:34 gfredericks: okay all better

12:35 drwin: ^

12:35 justin_smith: ,(heck-> [1 2] next next next next next next first inc)

12:35 clojurebot: 3

12:45 cfleming: oddcully freeman42 Wild_Cat: the pricing for Cursive for an individual dev will almost certainly be $100.

12:47 freeman42: wat? stumped http://i.imgur.com/c9voA5N.jpg

12:48 justin_smith: freeman42: I don't know what your issue is, but remember that = is not assignment in clojure, it's an equality test

12:49 freeman42: justin_smith, my issue is just the way they ask us to solve the problems :) solution looking for a problem... completely unneeded conditions

12:49 justin_smith: yeah, that's pretty dumb

12:50 I mean they could have designed a puzzle where you needed conditionals

12:50 freeman42: yeah, exactly

12:50 this is like teaching bad programming

12:54 correct way, no if's needed (doseq [text ["Hey!" "Yes, you!" "Come at me!" "You are an OGRE!"]] (.say this text))

12:56 (O_O) http://i.imgur.com/HcB9uTA.jpg

13:00 gfredericks: (dotimes [n 4] (.say this (case n 0 "Hey!" "Yes, you!" "Come at me!" "You are an OGRE!")))

13:00 ^ another wrong way

13:01 oddcully: closer does not have case

13:02 freeman42: gfredericks, ah the amazing for-case paradigm, even clojure has it http://thedailywtf.com/articles/The_FOR-CASE_paradigm

13:03 justin_smith: I'd think you'd need some numbers to make that case work

13:08 freeman42: what is opposite of https://clojuredocs.org/clojure.core/nil_q ?

13:09 ah "nil counts as false for the purposes of conditional expressions"

13:10 oddcully: some?

13:10 freeman42: is that for single elements also? not just collections?

13:10 this is somehow not working: http://i.imgur.com/SUwP2RD.png

13:11 oddcully: ,(map some? [1 :1 nil])

13:11 clojurebot: (true true false)

13:12 freeman42: , (some? nil)

13:12 clojurebot: false

13:12 freeman42: , (some? 1)

13:12 clojurebot: true

13:12 freeman42: oh, it works, thank you

13:14 ah, it actually worked, didn't need to use dotimes which was probably broken in that context

13:27 lodin_: freeman42: Still talking about dotimes?! ;-)

13:28 freeman42: lodin_, lol no :D

13:28 lodin_, doseq is all the hype now ;)

13:30 lodin_: It would make more sense to use Clojure if the game was functional, instead of using side effects for all game interaction.

13:31 freeman42: lodin_, clojure code is guaranteed to have no side effects?

13:31 lodin_: freeman42: ?

13:32 oddcully: lodin_: i bet they just literally translated the python/js/... versions

13:32 freeman42: lodin_, https://xkcd.com/1312/

13:33 lodin_: freeman42: http://prog21.dadgum.com/23.html

13:34 freeman42: lodin_, ?

13:34 lodin_: I thought we were exchanging links.

13:41 freeman42: Seriously though, that's a good read.

13:44 freeman42: lodin_, yeah, but not sure what you want me to focus on that article

13:46 lodin_: freeman42: One of the insight that the author arrives at is where to put the side effects in a game (the outer game loop), and that the game logic can be functional.

14:29 underplank: Hi all. is there a way once you have a compojure app running to inspect the routes its registered

14:48 domokato: what function/macro do I use to take a collection and apply some function to it repeatedly with each value from another list as a parameter?

14:48 do I have to resort to loop/recur?

14:49 justin_smith: domokato: doseq (for side effects) or for or map (for values)

14:49 underplank: also note that map is lazy. thats tripped me up sometimes.

14:49 mmeix: ,(map * [1 2 3] [10 20 30])

14:49 clojurebot: (10 40 90)

14:49 justin_smith: underplank: yeah, that's why I specified for values / for side effects

14:50 mmeix: right?

14:50 underplank: yeah. as a newb the differences between value/side effects lazy vs non-lazy and which you use is still difficult to grasp.

14:50 domokato: in the end I want the collection that is the result of applying all those function calls to it repeatedly

14:50 single result

14:51 underplank: I often go for map to start and then try the others when that doesnt do what I want.

14:51 justin_smith: domokato: oh, so you are updating some value for each input? then you want reduce

14:52 domokato: hm, but reduce operates on pairs of items in a list; not sure that fits my use case

14:52 justin_smith: what?

14:52 clojurebot: what is an outrage!

14:52 justin_smith: domokato: that's not what reduce does

14:52 j-pb_: clojurebot:lol

14:52 clojurebot: I don't understand.

14:53 justin_smith: ,(reduce + [12 24 36])

14:53 clojurebot: 72

14:53 domokato: yeah, so it does (+ 12 24) first, etc.

14:53 hellofunk: ,(= (reduce + 1 2) (apply + 1 2) (+ 1 2))

14:53 clojurebot: #error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.core$seq__4126 invoke "core.clj" 135]\n [clojure.core.pro...

14:54 justin_smith: domokato: + calls reduce

14:54 hellofunk: ,(= (reduce + 1 2) (apply + [1 2]) (+ 1 2))

14:54 clojurebot: #error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.core$seq__4126 invoke "core.clj" 135]\n [clojure.core.pro...

14:54 hellofunk: sigh

14:54 justin_smith: hellofunk: reduce needs a collection

14:54 hellofunk: ,(= (reduce + [1 2]) (apply + [1 2]) (+ 1 2))

14:54 clojurebot: true

14:54 hellofunk: right

14:54 justin_smith: domokato: the reason + does the same thing is because + uses reduce in its definition

14:55 domokato: + was just a simple example - reduce accumulates a result as it visits each member of an input collection

14:55 ,(reduce conj [] [:a :b :c :d :e])

14:55 clojurebot: [:a :b :c :d :e]

14:56 justin_smith: ,(reduce conj () [:a :b :c :d :e])

14:56 clojurebot: (:e :d :c :b :a)

14:56 mmeix: ,(reduce str ["He" "l" "l" "o"])

14:56 clojurebot: "Hello"

14:56 domokato: justin_smith: basically, instead of applying a function to two elements, i want to apply a function to a hash-set and each element in turn

14:57 justin_smith: domokato: the same hash-set each time?

14:57 nooga: is it better to reduce with str or apply str ?

14:58 ,(apply str ["He" "l" "l" "o"])

14:58 clojurebot: "Hello"

14:58 justin_smith: nooga: apply will be faster in that case

14:58 nooga: good, because I'm doing this all the time

14:58 domokato: justin_smith: well, the function will conj something into the hash-set, then i want to use that new hash-set for the next iteration

14:58 nooga: :D

14:58 mmeix: (was just another example for reduce, to excuse me ...)

15:00 justin_smith: domokato: ##(second (reduce (fn [[hash acc] el] (if (contains? acc el) [hash acc] [(conj acc el) (inc acc)])) [#{} 0] [:a :b :c :d :a :a :a :b]))

15:00 lazybot: java.lang.IllegalArgumentException: contains? not supported on type: java.lang.Long

15:00 justin_smith: err

15:00 ,(second (reduce (fn [[hash acc] el] (if (contains? hash el) [hash acc] [(conj hash el) (inc acc)])) [#{} 0] [:a :b :c :d :a :a :a :b]))

15:01 clojurebot: 4

15:01 justin_smith: that's a reduce with effectively two accumulators

15:02 mmeix: maybe domokato could show an example of what he wants to achieve ...?

15:02 justin_smith: ,(second (reduce (fn [[hash acc] el] (if (contains? hash el) [hash (inc acc)] [(conj hash el) acc])) [#{} 0] [:a :b :c :d :a :a :a :b])) ; counting dups this time

15:02 clojurebot: 4

15:02 domokato: hm, let me stare at that for a while lol

15:03 justin_smith: domokato: the only difference there from a normal reduce is each element in the vector is effectively a separate accumulator

15:03 so it tracks a set of things it has seen, and an accumultated score, side by side

15:04 domokato: oh okay neat

15:05 can i basically stick the hash-set as the first element of the list and then pass reduce a function that takes the hash-set and the next element and returns the hash-set with the next element conjoined?

15:06 justin_smith: domokato: well that sounds a lot like ##(reduce conj #{} [:a :b :c :d :a :b :c :a :b :a])

15:06 lazybot: ⇒ #{:c :b :d :a}

15:06 justin_smith: unless you are doing something else with the hash-set

15:07 domokato: like I said before, reduce doesn't go over pairs of the input, it goes over successive accumulated results and the input

15:07 domokato: oh, reduce takes a val argument! i missed that

15:08 thanks :)

15:08 justin_smith: so you were asking a much simpler question, cool

15:08 yeah, if you don't provide an accumulator argument, it uses the first element of the collection for that

15:08 domokato: i knew i was just missing something simple

15:09 mmeix: as an aside - in this case: wouldn't it be better to do just:

15:09 ,(apply hash-set [:a :b :c :d :a :b :c :a :b :a])

15:09 clojurebot: #{:c :b :d :a}

15:10 justin_smith: or ##(set [:a :b :C :d :a :b :c :a :b :a])

15:10 lazybot: ⇒ #{:C :c :b :d :a}

15:10 justin_smith: haha, typo

15:10 or ##(into #{} [:a :b :c :d :a :b :c :a :b :a])

15:10 lazybot: ⇒ #{:c :b :d :a}

15:10 mmeix: ah, better still

15:10 justin_smith: (into is useful if you arleady have part of your set

15:10 )

15:11 mmeix: into is especially useful, I found

15:11 (beginner's mind still)

15:13 ,(inc justin_smith)

15:13 clojurebot: #error {\n :cause "Unable to resolve symbol: justin_smith in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: justin_smith in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol:...

15:13 mmeix: lol

15:13 hellofunk: (inc mmeix)

15:13 lazybot: ⇒ 2

15:13 hellofunk: that's how

15:13 justin_smith: mmeix: inc is a lazybot command, so no , is needed

15:14 mmeix: (into brain [more stuff])

15:14 all the time

15:14 :)

15:42 lynn: how do I expand a variable that I'm passing to a macro?

15:42 here is what I'm trying to do:

15:42 https://gist.github.com/lynndylanhurley/695495f7584c1295a75f

15:43 where `defroutes` is a macro defined by Pedestal

15:44 justin_smith: lynn: the only way to do it is to write another macro

15:44 or directly use whatever function the defroutes macro is calling

15:45 lynn: justin_smith: thanks I have tried that actually. I'll show you what I tried, maybe you can help me figure out what I'm doing wrong

15:45 justin_smith: sure

15:45 macros are a bit tricky

15:46 lynn: yeah I'm finding that out for myself :)

15:46 here was my best attempt:

15:46 https://gist.github.com/695495f7584c1295a75f

15:47 when I try running (foo-routes) outside of the defroutes macro, it seems to output what I want

15:48 but it doesn't seem to expand when used within the defroutes macro

15:48 I also tried (macroexpand (foo-route))

15:48 but that didn't work either

15:51 justin_smith: lynn: for your macro to work the defroutes call has to be inside your macro

15:51 lynn: oh I see - so I need to write a macro that contains the call to the defroutes macro

15:51 justin_smith: lynn: the problem is that the defroutes macro uses some of its input unevaluated, which means you need another macro around it that evaluates the things you want evaluated before calling the macro

15:51 right

15:52 sometimes we call this "macro-contagion" - you want to extend something, it's a macro, now you need another macro surrounding it

15:52 mmeix: is this a case of macros being "contagiuous"?

15:52 ah, ok

15:52 lynn: lol

15:54 justin_smith: in terms of extensibility, it's good to remember data > functions > macros - the further to the left you are on that list, the more flexibly others can use it

15:55 mmeix: that's a good sentence to remember

15:55 (inc justin_smith)

15:55 lazybot: ⇒ 275

15:57 mmeix: aha, that's why libs sometimes have two versions of some functionality: as a function and as a macro - right?

15:57 lynn: yeah that's really good advice! I was trying to write a module that could be mounted to an existing pedestal app. I wonder if there's another way

16:55 rlb: Perhaps I'm misreading, but I just noticed that it seems like the current jvm atom implementation might allow you to have an atom with a state that doesn't agree with the current validator...

16:55 justin_smith: rlb: do you have code that shows that happening?

16:55 rlb: i.e. there's no synchronization in ARef setValidator. Perhaps that's intentional.

16:55 justin_smith: rlb: oh, iirc setValidator does not validate the existing state

16:55 rlb: justin_smith: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ARef.java#L49

16:56 it says it does in the docs

16:56 justin_smith: oh, well that would validate it yeah

16:56 rlb: yes, but I'm wondering if there's a race between the validation and the assignment.

16:57 justin_smith: ahh, now I get it

16:57 rlb: i.e. you check the value you just derefed, then someone else changes the value, then you set the validator.

16:57 If that's right, then perhaps the docs or the behavior needs adjustment...

17:27 bcham: hey I

17:27 I'm having an issue with enlive snippets that I can't figure out. when a snippet returns a value it's wrapped in parens as in ({:tag :div})

17:28 justin_smith: AKA it's a list?

17:28 bcham: yes

17:28 how do I transform it into the tag tree?

17:29 ((html/wrap {:tag :div}) {:tag :div :content ["hello"]})

17:29 is basically what I

17:29 am going for.

17:29 justin_smith: you could do (apply html/wrap v) or (html/wrap (first v))

17:29 depending on whether there would be other things you want in that list

17:32 bcham: Thanks justin, I think I've got it. Was confused about this list wrap.

17:35 But now I'm suffering from a different issue. I want to pass this into a template and i'm getting an error doing so. I cannot cast a persistent hash map to clojure.lang.named

17:38 html/wrap seems to return an array-map instead of the correct structure

17:38 Man this language makes me feel like an idiot.

17:40 I'm trying to convert it back to nodes and a list but that doesn't seem to work. Relevant wrap function is here: https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj

17:42 any ideas justin_smith ?

17:47 nevermind, just tried to avoid the problem entirely.

17:47 or found a way to

18:33 bucketh3ad: Is there a way to get a lein project to load the :provided profile dependencies first? I'm working with a library that only works if it's loaded before any other libraries.

22:56 mrcheeks: bucketh3ad:Have you considered the Xbootclasspath JVM parameter?

23:13 Sublixt: Im trying to assoc an infinite list as a value for a map. but it times out.

23:14 Is this just impossible to do, or am I going about it wrong?

23:14 justin_smith: ,(assoc {} :a (range))

23:14 clojurebot: {:a (0 1 2 3 4 ...)}

23:14 justin_smith: Sublixt: the assoc should just work, the printing might time out

23:15 Sublixt: Odd, when I did it in my game it never left the frame I called it in

23:15 justin_smith: are you sure you aren't using the value?

23:16 Sublixt: Ummm I'm not quite sure what you mean

23:16 justin_smith: well, anything that tries to consume that infinite list is going to time out

23:17 Sublixt: Oh I understand what youre saying

23:17 Yeah Im dumb

23:18 the api is probably trying to render it

Logging service provided by n01se.net