#clojure logs

2015-07-12

00:00justin_smithimagine taking english lessons from someone who doesn't understand basic grammar...
00:00vas_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?
00:00freeman42have to bend the mind to use fewer language features... which are quite utterly important :/
00:02freeman42and this gives the same error: http://i.imgur.com/U5ewrcc.png
00:03vas_" probably the worst possible way to learn clojure, a compiler that doesn't even work" LOL
00:03turbofailfreeman42: well you don't want to call `leattack' when you pass it in
00:03turbofailfreeman42: should be (times 2 leattack)
00:03freeman42turbofail, removed, but now it does not attack :) http://i.imgur.com/oi17QI5.png
00:04turbofailhm. well, it should
00:04turbofaildepending on what the hell `this' is
00:04justin_smithfreeman42: yeah, that's just a broken compiler / env
00:05justin_smithfreeman42: keep using it if it's fun I guess, but it will teach you nothing interesting about clojure
00:05justin_smithworse it will "teach" you things about clojure that are totally false
00:05freeman42right now it would force me to implement some times function which uses recursion
00:06freeman42hmmm, false?
00:07justin_smithfreeman42: 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.
00:08turbofailyeah, that side-effecting API there is pretty un-clojurific
00:08tomjackI wonder what the codecombat-in-cljs-bootstrap apis will look like
00:08tomjackin-game apis I mean
00:08turbofailthat said i've done plenty of side-effecting in clojure myself
00:15justin_smithturbofail: it goes beyond that though
00:16justin_smithturbofail: for example (.goLeft this) (.goRight this) (.hokeyPokey this) is better expressed as (doto this .goLeft .goRight .hokeyPokey) which is totally invalid in that environment
00:42vas_what's a simple way to check if an email address in properly formed? regex?
00:43justin_smithvas_: oh man emails are crazy, and most email programs don't even get them right
00:43vas_こんにちは
00:44justin_smiththe only simple, and fully reliable way to check an email is to send a message to it
00:44justin_smithvas_: did you know emails allow inline comments?
00:44vas_Hahah
00:44vas_justin_smith: what.
00:44vas_justin_smith: like /* this is not my real email? */
00:45justin_smithlike me(this part is a comment)smith@some(this is also a comment)host.com
00:45vas_justin_smith: I use a + sign in my gmail all the time...
00:45vas_Wow. I had no idea that was valid according to the 80s
00:45justin_smiththat's a gmail convention - emails is a crazy spec, and I doubt many people even implement it properly
00:46justin_smithincluding email providers
00:46vas_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'
00:47justin_smith"john.smith(comment)@example.com and (comment)john.smith@example.com are both equivalent to john.smith@example.com."
00:47justin_smithhttps://en.wikipedia.org/wiki/Email_address
00:47justin_smithvas_: 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
00:47justin_smithvas_: but it's just a sad state of affairs
00:49justin_smithvas_: read this list and weep for any validator https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses
00:51justin_smithhttp://i.imgur.com/nZS5OB7.jpg
00:53vas_#!$%&'*+-/=?^_`{}|~@example.org
00:53vas_Even has that hysterical winky face
00:54vas_Hahahaha mathematical sobbing
00:54vas_crying deltas
00:57vas_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.
00:57vas_Thank you Clojure
00:58vas_Anyone played around with titanium (graph [as in directed] library) ?
00:58justin_smithvas_: I looked at it but didn't actually end up using it
00:59vas_justin_smith: do you know of any alternatives to doing graphy things?
00:59vas_for*
00:59justin_smithmy 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)
01:00vas_Yeah that would be a great learning exercise.. _but_
01:01vas_not really where I wanted to spend the next few weesk ^_^
01:01vas_weeks (read as months years eons)
01:03freeman42both of the last 2 lines work in Clojure REPL but not in CodeCombat :( http://i.imgur.com/a7QM0xU.png
01:04justin_smithfreeman42: I am amazed you haven't given up on that thing yet
01:04freeman42no macros? ok..., but no lambdas?!?! nooooo :'( no point in continuing to play using Clojure
01:04freeman42well, the whole point was to learn something
01:04justin_smithheh, I spoke just a little too soon I guess :)
01:05freeman42is there a 3rd way to do lambdas? :p
01:05justin_smithit would be cool to make something like that game, but using cljs (no need for sandboxing, since everything is evaluated browser side)
01:06justin_smith#() is just a reader macro for (fn []) but there is also eg. comp, and partial
01:06justin_smithbut I seriously doubt those would be supported if fn isn't :P
01:06vas_I was reading earlier that (fn []) has an implied (do)
01:07justin_smithindeed!
01:07vas_not sure what difference that makes in practicality
01:07justin_smith(fn [] (println "what") 42) for example
01:07justin_smithlet also has an implied do
01:07justin_smithfor does not
01:07justin_smithdoseq does
01:08justin_smithwhen does
01:08freeman42argh :( that last console message http://i.imgur.com/lBipW2d.png
01:11vas_so would something like "for" eventually terminate on a "nil" ?
01:11justin_smithvas_: ?
01:11justin_smithI don't even understand that question
01:12vas_that's okay, I did not understand it when asking
01:12vas_don't worry about it
01:12vas_You answered it earlier with justin_smith> (fn [] (println "what") 42) for example
01:13justin_smithvas_: since for is explicitly only for lazy operations, they intentionally did not add an implicit do, because those are for side effects
01:14justin_smithwhereas just about every other macro that has a "body" has a do
01:14vas_Ahh that makes perfect sense
01:14vas_because a lazy body, like the universe, only exists when you're measuring.
01:14vas_;D
01:14justin_smithsomething like that
01:15vas_Haha i will have to work on my quantum standup..
01:15justin_smithside effects inside lazy things make code go wrong in so many weird ways
01:22freeman42I give up, this will have to do for now http://i.imgur.com/UzSICco.png
01:24freeman42vas_, is it idiomatic enough?
01:25vas_freeman42: Beeeauuuuutiful
01:25vas_=)
01:25freeman42vas_, lol, not sure if serious or joking :p
01:25vas_well i think it is beautiful
01:25vas_others have their opinions no doubt
01:26freeman42ok, cool then :) got some abstractions learned for now
01:26clojurebotPardon?
01:26vas_the way you implemented that looks a lot like ->>
01:27vas_try (->> ["Rig" "Gurt" "Ack"] (attack 2))
01:27freeman42ah yeah, we never spoke about -> and ->>
01:27freeman42reads up
01:27vas_they're very cool!
01:27justin_smithvas_: that wouldn't work in regular clojure
01:28vas_it's like operator pizza
01:28vas_justin_smith: yeah i had my suspicions.. what would be the proper way? or is it not really the appropriate circumstance
01:28justin_smithvas_: it would require a map and dorun or something
01:28justin_smithand a partial maybe
01:28turbofailthere's run!
01:29turbofailin 1.7
01:29justin_smith(doc run!)
01:29clojurebot"([proc coll]); Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the collection. Returns nil"
01:29justin_smithturbofail: I doubt his weird env supports that
01:29turbofailoh i thought we were talking about regular clojure
01:29justin_smithturbofail: but yes, run! would be perfect
01:29vas_what would it look like using run?
01:30justin_smith(->> ["Rig "Gurt" "Ack"] (run! (partial attack 2))
01:30freeman42tried to read about -> but I understood that this it not even his final form (I don't know what a form is)
01:30justin_smithfreeman42: a form is a unit of a clojure program
01:31vas_like a brick for building a house out of?
01:31justin_smith"(+ 1" is not a form, "(+ 1 2)" is, as is "+"
01:31freeman42for me that is like explaining that a bloopeedy doop is a unit of goopidy foo
01:31vas_mmm goopidy foo
01:31justin_smithfreeman42: a form is a valid input to a clojure compiler
01:31freeman42uhm,... ok :)
01:31vas_Whoa
01:31vas_I just put +
01:31vas_into my repl
01:31justin_smithfreeman42: in clojure, most places where you can use a value, you can also use a form
01:31vas_and got
01:32vas_#<core$_PLUS_ clojure.core$_PLUS_@6c3c0ef2
01:32justin_smithright, that is the value of +
01:32freeman42justin_smith, I think this for another day for me :)
01:45freeman42still hoping for a times function, too many _-es http://i.imgur.com/cyxqDOi.png
01:46freeman42there is a way to create a range easily I assume
01:47justin_smith,(range)
01:47clojurebot(0 1 2 3 4 ...)
01:47freeman42was thinking to implement repeat using a range as recursion is not supported
01:55freeman42justin_smith, any other way? ^^ (defn times [n f] (doseq [_ (take n (range))] (f))) does not seem to work in closer.js either
01:55freeman42or rather, in codecombat at least, works in clojure repl just fine
01:55justin_smithfreeman42: (take n (range)) is just (range n)
01:55freeman42oh
01:55justin_smithmaybe that version works?
01:56freeman42I'll try
01:57freeman42justin_smith, nope, it seems it does not know the range function
01:57freeman42guess it could be implemented... with some other thing? :)
01:58justin_smithloop?
01:58clojurebotloop is a macro of last resort
01:58freeman42I'll give it a try
01:58justin_smithclojurebot: yes, but he appears to be out of other options
01:58clojurebotPardon?
01:58justin_smithhaha
01:58amalloyit sounds like you are not writing clojure, so much as just trying to guess at an arbitrary set of undisclosed rules
01:58justin_smithindeed
01:59freeman42amackera, you are pretty much correct, but it is still fun
01:59justin_smithbroken compiler as game
01:59freeman42hahaha, funny way of putting it
02:06freeman42so loop/recur is the equivalent of for/while loops in some other languages?
02:06justin_smithexactly
02:08justin_smithfreeman42: well, we also have while
02:08justin_smithbut loop is usually more convenient because it provides updated bindings, and while requires some mutable object to test
02:08freeman42justin_smith, is it easier to comprehend?
02:10freeman42clojure 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.” "
02:10justin_smithfreeman42: 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?
02:10freeman42ah wait, that is not clojure docs...
02:11freeman42hmm, dunno, looking over them now
02:12justin_smithfreeman42: loop is like a recursive function, except only allowing self-calls from the tail position
02:13freeman42that sounds quite nice
02:21justin_smithfreeman42: 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
02:26rritochLoops 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.
02:27rritochIf you care about portability, loops are really the way to go. If you care about your sanity, use anything but.
02:36rritochWell, I guess Common Lisp (Clisp) is technically an ANSI standard, but it's extremly outdated and doesn't fit well into modern applications.
02:38rritochjustin_smith: Is clojure CLISP compliant? I've never actually tried to run CLISP apps on clojure, I just assumed they wouldn't work.
02:38ChousukeClojure is very different from Common Lisp
02:39Chousukeabout the only thing they have in common is that both have lots of parentheses :P
02:46justin_smithrritoch: 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.
02:47justin_smithclisp: http://www.clisp.org/ - just an implementation
02:51justin_smithChousuke: to be fair, clojure macros owe more to common lisp than any other language
02:55rritochjustin_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.
02:56H4nsrritoch: sorry, but that is utter nonsense. you need to know more before making such claims.
03:00rritochH4ns: Clojure doesn't qualify as not-for-profit, and certainly isn't backed by the Free Software FOundation.
03:01rritochH4ns: These are facts which should be readily available to anyone taking up clojure. Clojure is open source and still proprietary.
03:05rritochH4ns: I guess I was wrong about the free software foundation status
03:06rritochH4ns: I really don't know the relationship between clojure and FS
03:06rritocherr, FSF
03:10rritochH4ns: 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.
03:12rritochH4ns: It seemed to me as if the reason was based on the fact hat cognitect clients had no need for the features.
03:12H4nsrritoch: what makes you think that?
03:13rritochH4ns: Checking my old emails.
03:13H4nsrritoch: maybe you want to discuss one of your language feature proposals instead.
03:14rritochH4ns: No need. I was able to implement it (recently) without any support for clojure by using reflection.
03:14H4nsrritoch: that is probably the reason why your feature request was denied.
03:18rritochH4ns: The request was never denied, and at the time it wasn't known that it could be implemented with reflection.
03:20H4nsrritoch: 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.
03:24rritochH4ns: 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.
03:25chelseaclintongot problems installing leiningen on windows
03:26chelseaclintoni'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"
03:29chelseaclintongot it working using this fix: https://github.com/technomancy/leiningen/issues/1902
06:19j-pburgh, 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?
06:20j-pbfor example + will recast them into bigints and on those numerator and denominator are invalid
06:20j-pb,(nominator (+ 1/2 4/3))
06:20clojurebot#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...
06:21j-pb,(denominator (+ 1/2 4/3))
06:21clojurebot6
06:21j-pb,(denominator (+ 1/2 1/2))
06:21clojurebot#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...
06:36bprdoes anyone know why tools.reader.edn can't read "(get @*rmq-publications* 0)" but clojure.core/read-string can?
06:37bprI mean what's the rationale? It's clear that there's no reader-macro defined for \@ in the edn reader, but why?
06:41hiredmanedn 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
06:43bprso if i'm writing a code analyzer i should use c.t.r/read-string instead?
06:43bprok
07:09freeman42ehm, why would this give a null-pointer exception? http://i.imgur.com/LWtsqdg.png
07:09lumafibecause you're calling runit and passing to it the return value of println, which is nil
07:09lumafiso you try to call nil inside runit
07:10freeman42ah
07:10freeman42I'm doing it wrong, thank you :)
07:15gmannywhat are clojures main advantages over python?
07:31H4nsgmanny: they're different languages and fulfill different needs. there is no way to meaningfully specify one as the other with certain advantages.
07:35H4nsgmanny: that said, the main advantage of clojure over python is that it is much better :D
07:35catonanoexploring clj-date, I'm having
07:35catonano(f/parse multi-parser "2013-03-07 17:00:00")
07:35catonano=> #<DateTime 2013-01-07T17:00:00.000+01:00>
07:36catonanothe month, 03, is being parsed as "01"
07:36catonanolook
07:36catonano(f/unparse multi-parser (f/parse multi-parser "2013-03-07 17:00:00"))
07:36catonano=> "07/00/2013 17.00"
07:36catonanoI had created the parser with
07:36catonano(def multi-parser (f/formatter (t/default-time-zone) "dd/mm/YYYY HH.mm" "YYYY-mm-dd HH:mm:ss"))
07:36catonanoWhat am I doing wrong ?
07:37H4nscatonano: you're using mm for both month and minutes
07:37gmannyH4ns: :). can you expand on that a bit, what things does it do better?
07:37catonanoH4ns: Oh gosh. I had completely missed that !
07:37catonanoH4ns: thanks !
07:38H4nsgmanny: it caters better for my taste. really.
07:39H4nsgmanny: "good/better/best" is not a helpful category when judging languages. you need to ask more specific.
07:39H4nsgmanny: for example, you could ask whether python or clojure support object oriented programming better, and the answer would be "python".
08:27freeman42was 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?
08:28freeman42was thinking to refactor (.moveRight this) into something called like (go :direction count) and/or (go :direction) for count = 1
08:30H4nsfreeman42: . 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)
08:32freeman42H4ns, thanks, interesting to know, that sheds some light on where the code is interpreted
08:33crocketDoes clojure support bitwise operations like & and | ?
08:33crocket>, >>
08:34freeman42crocket, https://clojuredocs.org/clojure.core/bit-and
08:34freeman42https://clojuredocs.org/clojure.core/bit-or
08:35freeman42https://clojuredocs.org/clojure.core/bit-shift-right
08:36freeman42crocket, what does > and >> mean? :) I assume one of them is bit shift right
08:37crocket2 >> 3 means shift '2' three times.
08:37crocket2^3
08:37crocket2*2^3
08:38freeman42crocket, can't seem to find a shift right/left n times function
08:39freeman42guess you could easily create one by repeatedly applying shift
08:40dottedmagfreeman42: >> is the same as bit-shift-right
08:41freeman42dottedmag, oh, it does take a number of shifts to apply, didn't notice
08:41crocketHow efficient is bit-shift-left compared to << in C and java?
08:42freeman42probably as efficient as java, best bet is to try it
08:42crocketok
08:42crocketjava has '>' operator.
08:43dottedmagerm, "greater then"?
08:43freeman42dottedmag, funny :)
08:44crocketOops
08:44dottedmagcrocket: do you mean >>>?
08:44crocket>>
08:44crocket'>>' operator
08:44dottedmagcrocket: bit-shift-right
08:44dottedmagcrocket: >>> is unsigned-bit-shift-right
08:44crockethttps://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html
08:45freeman42or maybe the `goes to` operator while (n --> 0) :D http://stackoverflow.com/questions/1642028/what-is-the-name-of-the-operator
08:46crocketI was worried that clojure couldn't do bitwise operations.
08:46crocketClojure seemed to operate at such a high level that I thought it couldn't do bitwise operations.
08:48freeman42another 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?
08:48freeman42related to "was thinking to refactor (.moveRight this) into something called like (go :direction count) and/or (go :direction) for count = 1"
08:49freeman42think I heard before that symbols (:symbolName) can be used for that
08:49H4nsfreeman42: those are keywords, and they can be used for the purpose you describe.
08:49freeman42just not sure how/if they are needed to be declared and and example of matching on them
08:49freeman42*an example
08:50H4nsfreeman42: 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.
08:50H4nsfreeman42: keywords need not be declared. you can just use them.
08:51freeman42H4ns, not sure what you mean by map to numbers, I'm thinking to refactor (.moveRight this) into something called like (go :direction count)
08:51freeman42so inside the go function I'd pattern match on a direction
08:51H4nsfreeman42: 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.
08:52oddcullys/:direction/:east/ ?
08:52freeman42and call the corresponding (.moveRight this), (.moveUp this) etc
08:52freeman42oddcully, yeah, something like that
08:52H4nsfreeman42: java methods are not first class objects, so you'll have to use (case direction :left (.moveLeft this) :right (.moveRight this) ....)
08:53terommaybe just use :left, :right, :up, :down - you don't need enum like thing
08:53freeman42oh, there is a case statement cool, is that prefered to core.match?
08:54H4nsfreeman42: case is a more specific tool than core.match, which can do more things at the expense of being generally slower.
08:54freeman42terom, yes, I will probably do that, even though an enum would be nice to limit the possible values
08:54freeman42H4ns, ok, I'll give it a try, thank you for all the help
08:54H4nsfreeman42: if you use case, you'll get a run-time error when no clause can be matched and no default clause exists.
09:03freeman42hmmm
09:03freeman42H4ns, I see, so it is like the C# case statement, that is ok
09:08freeman42oh boy, nothing works in this game :D http://i.imgur.com/gPuHmH6.png
09:13chelseaclintonfreeman42: sauce?
09:13freeman42oh, I'm drunk nvm
09:13freeman42does not support case either, aw man :( http://i.imgur.com/xGzeSuH.png
09:13chelseaclintonwhat kind of game is that
09:14freeman42chelseaclinton, https://codecombat.com
09:14freeman42it has an option to switch to clojure when playing but it is experimental
09:15chelseaclintonI am most grateful
09:16freeman42chelseaclinton, after you see how flawed the clojure engine is you might wanna hunt me down :D
09:16freeman42doesn't even support function as values
09:19chelseaclintoni'm doing basic syntax for now
09:21freeman42no cond either o.O' http://i.imgur.com/NO04EX1.png
09:21Wild_Catquick 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?
09:22freeman42Wild_Cat, switch to IntelliJ :D I think the community edition gives you all that you need
09:22freeman42Wild_Cat, I'm using Cursive plugin right now, but that won't be free for long afaik
09:22freeman42the default clojure plugin should be not bad either
09:23Wild_Cathow much should I expect to pay for that?
09:23freeman42Wild_Cat, not sure, check https://cursiveclojure.com/
09:24Wild_Catthat's... vague :p
09:25Wild_Catty for the info, still
09:25freeman42Wild_Cat, might want to give Atom a try also http://i.imgur.com/23F725m.png
09:25freeman42Atom got quite... or rather very fast lately
09:26oddcullythe 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)
09:26Wild_Catfreeman42: ha. Would that mean there's actually something Atom does *not* suck at? Interesting, I'll take a look
09:26freeman42Wild_Cat, the Atom Haskell plugins are really amazing lately, and setup is very very easy using stack for dependencies
09:26freeman42probably similar for Clojure
09:27Wild_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)
09:27Wild_Catfreeman42: sweet.
09:27freeman42Wild_Cat, ah yeah, Atom when it appeared was really slow and quite bad, now it is quite amazing (not bad)
09:28gmannywhat is clojure better at than python?
09:28mmeixmore fun to program :-)
09:28freeman42gmanny, clojure is better than python because it is not python :)
09:29oddcullygmanny: questions like this will only provoke opionionated answers (especially, if you ask them about @language in #language)
09:29freeman42gmanny, this is my favorite site for getting a general idea of language comparisons based on their qualities:
09:29freeman42http://hammerprinciple.com/therighttool/items/clojure/python
09:30oddcullygmanny: do you know python and want to learn clojure? or do you want to know in what of those languages to "invest" next?
09:30gmannyoddcully: I know, which is what I expect.
09:30gmannyI know python
09:31freeman42lol "THIS LANGUAGE HAS A STRONG STATIC TYPE SYSTEM"
09:32gmannythat is an interesting page. it is vote based?
09:32freeman42gmanny, seems so
09:36freeman42Wild_Cat, if you are giving Atom a try, please tell us how it goes
09:39Wild_Catfreeman42: will do!
09:40Wild_Catgmanny: 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.
09:41freeman42should have just read the issues ^^ it seems when IS implemented... now let's see what `when` does
09:41Wild_Catit is my belief that Clojure systems are easier to scale up than Python systems.
09:41Wild_Catthat, and Leiningen rocks, too.
09:44Wild_CatFWIW, I want to use Clojure to generate boring C++ code.
09:44liuchangboring C++ code .....
09:45freeman42Wild_Cat, shhh, that might offend someone :p
09:45freeman42too late
09:45Wild_Catit's the code that is boring, not C++.
09:45Wild_CatI'm talking hundreds of lines of near-identical boilerplate crap.
09:45freeman42Wild_Cat, ah, badly written C++
09:46freeman42C++ certainly has the abstractions of making it non-redundant
09:46Wild_Catstuff that should be autogenerated but isn't, and that I'm tired of cut&pasting
09:47freeman42Clojure question: can I use `when` in place of a `case`?
09:47liuchangdo you think about Template and Macro in C++ to solve the problem
09:47Wild_Cat(and crap conversions between near-identical types because the idea of standardized types hit C++ stupidly recently)
09:48Wild_Catliuchang: 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.
09:51liuchangsorry, i can't get your point. you mean that Templates and ##__VA_ARGS__ can't be supported by diff compilers ?
09:52Wild_Catliuchang: 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)
09:53Wild_Catso to answer your question, yes, the need to support different compilers makes our codebase bigger, less elegant and more auto-generated :(
09:54noogais 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
09:54liuchangok.. thanks
09:56freeman42any idea what I'm doing wrong here? or is it not possible? http://i.imgur.com/RBMHvk4.png
09:58noogafreeman42: see http://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/case/ instead of when
09:58noogawhen is like (if something something nil)
09:58freeman42nooga, 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
09:58noogaso your first when evaluates as you'd expect, but the second one evaluates to nil and that's what your function returns
09:59freeman42nooga, oh, I see
09:59freeman42so then I can solve it with if chain :(
10:00noogawait, they're talking about cond
10:00noogacond != case
10:01freeman42nooga, yeah, but I mentioned in last comment that case is not supported either
10:01noogaah, didn't notice, sorry
10:01oddcullyfreeman42: 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:01oddcullyso they basically want to type me in (.moveRight this)
10:02freeman42oddcully, you could probably reinvent some abstractions, and it would also be fun :)
10:02oddcullyto me this looks like pretty odd way to let me learn clojure
10:02freeman42oddcully, ah yeah, definitely a bad way to learn clojure, takes away a lot of the critical functionality
10:02freeman42like, no functions as values, no case/cond :/
10:03freeman42I wonder how hard it would be to implement them in their open source repo of closer.js
10:04oddcullywell that is basically the nail into the coffin for me. why would i learn closer instead of clojure(script)
10:05freeman42oddcully, cause it could be still more useful than playing some other game which does not teach a programming language
10:06freeman42and working with a subset of clojure is still something cool to learn
10:06freeman42you could probably recreate different functions yourself
10:06noogaI started by implementing scheme :D
10:06freeman42hahahahaha xD that was hilarious :D
10:07freeman42nooga, when you finish, please post a link to your blog post on it to HN, reddit etc.
10:07freeman42will be a fun thing to read
10:07freeman42"How I implemented Scheme in a bad subset of clojure in CodeCombat"
10:08freeman42good example of monsters crawling out of the turing tar-pit
10:09nooga:]
10:10liuchangI would like to implement a scheme :)
10:10freeman42is this idiomatic indentation of if piramid of doom? http://i.imgur.com/yy5Kkeb.png
10:14oddcullylooks like idiomatic closer code :X
10:29freeman42this 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:30liuchangwhat's this game?
10:31freeman42hadou ken!!! http://i.imgur.com/BtjZedW.jpg
10:31freeman42liuchang, www.codecombat.com
10:31liuchangthanks
10:31freeman42liuchang, yw
10:32crocketIs it possible to include two versions of the same jar in a leiningen project?
10:33liuchangNo
10:34crocketDoes leiningen pull dependencies recursively as npm does?
10:34H4nscrocket: yes.
10:36crocketok
10:36crocketWhat about clojurescript?
10:37freeman42really funny, used dotimes on the previous levels xD http://i.imgur.com/cOhsutc.png
10:41mmeixcould someone lend me an eye on https://www.refheap.com/106013 - can't load a lib in boot ...
10:41mmeix(maybe some silly typo)
10:43freeman42and 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:44freeman42mmeix, maybe you don't have the jar containing that namespace added as a dependency
10:45freeman42oh wait, you do
10:45freeman42maybe it needs that :scope "test" thing too?
10:45mmeixreagent didn't need it, and gets loaded without problem
10:46mmeixhm
10:48mmeixjust tested - this is not the problem
10:49oddcullymmeix: this is clojurescript code?
10:50freeman42mmeix, what IDE are you using?
10:50mmeixClojurescript, yes
10:50mmeixIDE = Light Table
10:50oddcullyi am not sure about this, but are generic clj libs compatible with cljs at all?
10:51oddcullyin the browser even a js/JSON could be enough for what you are up to
10:51mmeixah, maybe data.json is not cljs compatible
10:51oddcullyalso transit is a popular choice for the client
10:52mmeixthe use case is another: I just need to convert a lengthy JSON once to a Clojure(Script) map
10:52mmeixit doesn't change
10:52mmeix(a huge map of settings for a music font)
10:52mmeixwill do this in Clojure instead
10:52mmeixand just copy paste in
10:52mmeixthanks
10:56freeman42mmeix, maybe: http://swannodette.github.io/2014/07/26/transit--clojurescript/
10:56mmeixah, thanks!
10:56freeman42mmeix, and this might be helpful too http://stackoverflow.com/questions/9820869/idiomatically-accessing-json-objects-with-clojurescript
10:56freeman42mmeix, yw
11:01freeman42is there an int.max in clojure? (dotimes [_ intMaxHere] (.attack this "Door")))
11:02freeman42ah, found it: Integer/MAX_VALUE
11:03freeman42only it does not work in closer.js, gosh (dotimes [_ Integer/MAX_VALUE] (.attack this "Door")))
11:04liuchanginteresting game
11:09freeman42liuchang, wish they would give better use cases when introducing new concepts
11:09freeman42liuchang, not sure if having let bindings is any use here http://i.imgur.com/JbQ0S6B.png
11:10freeman42or rather, could just say that it is not, cause it is not :)
11:10freeman42when introducing let bindings they should at least tought of a case when they wouuld have been actually useful, as in reusable
11:10liuchangjust introduce the variable
11:10liuchangi think
11:11liuchang*let* is local bind
11:11liuchangit's not easy to introduce this
11:12liuchangso, I think this game will introduce it again, with more words
11:12freeman42it just started badly, as in, here's a tool... there is no problem it solves in this case, but use it anyway!
11:13freeman42here's the solution, now find a problem :)
11:13liuchang: )
11:14liuchangIt's too slow to learn clojure....
11:14liuchangI prefer to read book...
11:16freeman42doing it mostly for the fun, there are definitely better ways of learning clojure
11:16liuchangyes : )
11:16freeman42this game has the benefit of forcing me to actually use clojure, with learning clojure optional :)
11:16liuchangIt's very interestring
11:17freeman42easier to get trapped in the opposite, reading a lot and almost never doing anything
11:17freeman42doing automatically forces a minimal ammount of thinking, not the same way with reading
11:18freeman42now they shown an actual reuse of let http://i.imgur.com/7tdlPH2.png
11:19liuchangI am here too~
11:19freeman42you are playing much faster
11:19freeman42liuchang, how much Clojure experience do you have?
11:20liuchanga litter...
11:20liuchangjust read some books
11:20liuchangprograming in clojure, the joy of clojure, 7 weeks 7 concurrents
11:22liuchangfreeman42, and you?
11:22freeman42liuchang, actually this still has no use as it is highly redundant http://i.imgur.com/Pt11C2C.png
11:23freeman42liuchang, this is my entire Clojure experience, read it 2 or 3 times http://learnxinyminutes.com/docs/clojure/
11:23freeman42liuchang, plus a few meetups I attend
11:24liuchangwhere are you from :)
11:24liuchangi use cpp and python in work, clojure is just for fun.
11:25freeman42liuchang, currently Dublin, Ireland, I use C# at work
11:26liuchangbeautiful Ireland
11:26liuchangi come from China
11:29freeman42liuchang, let was completely unneded now too :( 1 liner http://i.imgur.com/D1xTAr4.png
11:29virmundihello. does anyone have a systemd configuration example for a ring app?
11:32drwinit there a variant of threading macro -> which would pass object further in the pipeline when fn returned nil?
11:34freeman42liuchang, I wonder when it will actually have a level when let is actually needed
11:35oddcullydrwin: did you mean "which would NOT pass"... ?
11:36drwinoddcully: no, I want it to pass, I don't want to reinvent some->
11:37oddcullybut isn't -> just passing it?
11:37drwinoddcully: I'm going to modify some-> macro to do it, it has the test there
11:37drwinoddcully: no, if expr returns nil, then nil flows down the pipe
11:38drwinI want when any expr return nil, it would not modify existing input, and pass it down
11:38drwins/return/returns/
11:39drwinbasically "nil" answer means, I don't want to touch "it"
12:16gfredericksdrwin: I don't think anything exists, no, but it's not hard to make it
12:18gfredericks,(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:18clojurebot#'sandbox/heck->
12:18gfredericks,(heck-> [1 2] next next next next)
12:18clojurebot#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:18gfrederickswhoopsiedoodle
12:18gfredericks,(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:18clojurebot#'sandbox/heck->
12:18gfredericks,(heck-> [1 2] next next next next)
12:18clojurebotnil
12:19gfredericksI guess that makes sense
12:19gfredericks,(heck-> [1 2] next next next next next identity)
12:19clojurebotnil
12:19gfrederickshmmm
12:19gfredericksoh yeah
12:19gfrederickser no I'm not sure
12:29gfredericks,(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:29clojurebot#'sandbox/heck->
12:29gfredericksfixed it; the recursion was wrong; didn't need that many clauses anyhow
12:29gfredericks,(heck-> [1 2] next next next next next identity)
12:29clojurebot(2)
12:30gfredericksoh wait I'm treating the last function differently but I bet that's not how it's supposed to work
12:30gfredericks,(heck-> [1 2] next next next next next next)
12:30clojurebotnil
12:30gfredericksyeah that's bad
12:34gfredericks,(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:34clojurebot#'sandbox/heck->
12:34gfredericks,(heck-> [1 2] next next next next next next)
12:34clojurebot(2)
12:34gfredericksokay all better
12:35gfredericksdrwin: ^
12:35justin_smith,(heck-> [1 2] next next next next next next first inc)
12:35clojurebot3
12:45cflemingoddcully freeman42 Wild_Cat: the pricing for Cursive for an individual dev will almost certainly be $100.
12:47freeman42wat? stumped http://i.imgur.com/c9voA5N.jpg
12:48justin_smithfreeman42: I don't know what your issue is, but remember that = is not assignment in clojure, it's an equality test
12:49freeman42justin_smith, my issue is just the way they ask us to solve the problems :) solution looking for a problem... completely unneeded conditions
12:49justin_smithyeah, that's pretty dumb
12:50justin_smithI mean they could have designed a puzzle where you needed conditionals
12:50freeman42yeah, exactly
12:50freeman42this is like teaching bad programming
12:54freeman42correct way, no if's needed (doseq [text ["Hey!" "Yes, you!" "Come at me!" "You are an OGRE!"]] (.say this text))
12:56freeman42(O_O) http://i.imgur.com/HcB9uTA.jpg
13:00gfredericks(dotimes [n 4] (.say this (case n 0 "Hey!" "Yes, you!" "Come at me!" "You are an OGRE!")))
13:00gfredericks^ another wrong way
13:01oddcullycloser does not have case
13:02freeman42gfredericks, ah the amazing for-case paradigm, even clojure has it http://thedailywtf.com/articles/The_FOR-CASE_paradigm
13:03justin_smithI'd think you'd need some numbers to make that case work
13:08freeman42what is opposite of https://clojuredocs.org/clojure.core/nil_q ?
13:09freeman42ah "nil counts as false for the purposes of conditional expressions"
13:10oddcullysome?
13:10freeman42is that for single elements also? not just collections?
13:10freeman42this is somehow not working: http://i.imgur.com/SUwP2RD.png
13:11oddcully,(map some? [1 :1 nil])
13:11clojurebot(true true false)
13:12freeman42, (some? nil)
13:12clojurebotfalse
13:12freeman42, (some? 1)
13:12clojurebottrue
13:12freeman42oh, it works, thank you
13:14freeman42ah, it actually worked, didn't need to use dotimes which was probably broken in that context
13:27lodin_freeman42: Still talking about dotimes?! ;-)
13:28freeman42lodin_, lol no :D
13:28freeman42lodin_, doseq is all the hype now ;)
13:30lodin_It would make more sense to use Clojure if the game was functional, instead of using side effects for all game interaction.
13:31freeman42lodin_, clojure code is guaranteed to have no side effects?
13:31lodin_freeman42: ?
13:32oddcullylodin_: i bet they just literally translated the python/js/... versions
13:32freeman42lodin_, https://xkcd.com/1312/
13:33lodin_freeman42: http://prog21.dadgum.com/23.html
13:34freeman42lodin_, ?
13:34lodin_I thought we were exchanging links.
13:41lodin_freeman42: Seriously though, that's a good read.
13:44freeman42lodin_, yeah, but not sure what you want me to focus on that article
13:46lodin_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:29underplankHi all. is there a way once you have a compojure app running to inspect the routes its registered
14:48domokatowhat 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:48domokatodo I have to resort to loop/recur?
14:49justin_smithdomokato: doseq (for side effects) or for or map (for values)
14:49underplankalso note that map is lazy. thats tripped me up sometimes.
14:49mmeix,(map * [1 2 3] [10 20 30])
14:49clojurebot(10 40 90)
14:49justin_smithunderplank: yeah, that's why I specified for values / for side effects
14:50mmeixright?
14:50underplankyeah. as a newb the differences between value/side effects lazy vs non-lazy and which you use is still difficult to grasp.
14:50domokatoin the end I want the collection that is the result of applying all those function calls to it repeatedly
14:50domokatosingle result
14:51underplankI often go for map to start and then try the others when that doesnt do what I want.
14:51justin_smithdomokato: oh, so you are updating some value for each input? then you want reduce
14:52domokatohm, but reduce operates on pairs of items in a list; not sure that fits my use case
14:52justin_smithwhat?
14:52clojurebotwhat is an outrage!
14:52justin_smithdomokato: that's not what reduce does
14:52j-pb_clojurebot:lol
14:52clojurebotI don't understand.
14:53justin_smith,(reduce + [12 24 36])
14:53clojurebot72
14:53domokatoyeah, so it does (+ 12 24) first, etc.
14:53hellofunk,(= (reduce + 1 2) (apply + 1 2) (+ 1 2))
14:53clojurebot#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:54justin_smithdomokato: + calls reduce
14:54hellofunk,(= (reduce + 1 2) (apply + [1 2]) (+ 1 2))
14:54clojurebot#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:54hellofunksigh
14:54justin_smithhellofunk: reduce needs a collection
14:54hellofunk,(= (reduce + [1 2]) (apply + [1 2]) (+ 1 2))
14:54clojurebottrue
14:54hellofunkright
14:54justin_smithdomokato: the reason + does the same thing is because + uses reduce in its definition
14:55justin_smithdomokato: + was just a simple example - reduce accumulates a result as it visits each member of an input collection
14:55justin_smith,(reduce conj [] [:a :b :c :d :e])
14:55clojurebot[:a :b :c :d :e]
14:56justin_smith,(reduce conj () [:a :b :c :d :e])
14:56clojurebot(:e :d :c :b :a)
14:56mmeix,(reduce str ["He" "l" "l" "o"])
14:56clojurebot"Hello"
14:56domokatojustin_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:57justin_smithdomokato: the same hash-set each time?
14:57noogais it better to reduce with str or apply str ?
14:58nooga,(apply str ["He" "l" "l" "o"])
14:58clojurebot"Hello"
14:58justin_smithnooga: apply will be faster in that case
14:58noogagood, because I'm doing this all the time
14:58domokatojustin_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:58nooga:D
14:58mmeix(was just another example for reduce, to excuse me ...)
15:00justin_smithdomokato: ##(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:00lazybotjava.lang.IllegalArgumentException: contains? not supported on type: java.lang.Long
15:00justin_smitherr
15:00justin_smith,(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:01clojurebot4
15:01justin_smiththat's a reduce with effectively two accumulators
15:02mmeixmaybe domokato could show an example of what he wants to achieve ...?
15:02justin_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:02clojurebot4
15:02domokatohm, let me stare at that for a while lol
15:03justin_smithdomokato: the only difference there from a normal reduce is each element in the vector is effectively a separate accumulator
15:03justin_smithso it tracks a set of things it has seen, and an accumultated score, side by side
15:04domokatooh okay neat
15:05domokatocan 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:06justin_smithdomokato: well that sounds a lot like ##(reduce conj #{} [:a :b :c :d :a :b :c :a :b :a])
15:06lazybot⇒ #{:c :b :d :a}
15:06justin_smithunless you are doing something else with the hash-set
15:07justin_smithdomokato: like I said before, reduce doesn't go over pairs of the input, it goes over successive accumulated results and the input
15:07domokatooh, reduce takes a val argument! i missed that
15:08domokatothanks :)
15:08justin_smithso you were asking a much simpler question, cool
15:08justin_smithyeah, if you don't provide an accumulator argument, it uses the first element of the collection for that
15:08domokatoi knew i was just missing something simple
15:09mmeixas an aside - in this case: wouldn't it be better to do just:
15:09mmeix,(apply hash-set [:a :b :c :d :a :b :c :a :b :a])
15:09clojurebot#{:c :b :d :a}
15:10justin_smithor ##(set [:a :b :C :d :a :b :c :a :b :a])
15:10lazybot⇒ #{:C :c :b :d :a}
15:10justin_smithhaha, typo
15:10justin_smithor ##(into #{} [:a :b :c :d :a :b :c :a :b :a])
15:10lazybot⇒ #{:c :b :d :a}
15:10mmeixah, better still
15:10justin_smith(into is useful if you arleady have part of your set
15:10justin_smith)
15:11mmeixinto is especially useful, I found
15:11mmeix(beginner's mind still)
15:13mmeix,(inc justin_smith)
15:13clojurebot#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:13mmeixlol
15:13hellofunk(inc mmeix)
15:13lazybot⇒ 2
15:13hellofunkthat's how
15:13justin_smithmmeix: inc is a lazybot command, so no , is needed
15:14mmeix(into brain [more stuff])
15:14mmeixall the time
15:14mmeix:)
15:42lynnhow do I expand a variable that I'm passing to a macro?
15:42lynnhere is what I'm trying to do:
15:42lynnhttps://gist.github.com/lynndylanhurley/695495f7584c1295a75f
15:43lynnwhere `defroutes` is a macro defined by Pedestal
15:44justin_smithlynn: the only way to do it is to write another macro
15:44justin_smithor directly use whatever function the defroutes macro is calling
15:45lynnjustin_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:45justin_smithsure
15:45justin_smithmacros are a bit tricky
15:46lynnyeah I'm finding that out for myself :)
15:46lynnhere was my best attempt:
15:46lynnhttps://gist.github.com/695495f7584c1295a75f
15:47lynnwhen I try running (foo-routes) outside of the defroutes macro, it seems to output what I want
15:48lynnbut it doesn't seem to expand when used within the defroutes macro
15:48lynnI also tried (macroexpand (foo-route))
15:48lynnbut that didn't work either
15:51justin_smithlynn: for your macro to work the defroutes call has to be inside your macro
15:51lynnoh I see - so I need to write a macro that contains the call to the defroutes macro
15:51justin_smithlynn: 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:51justin_smithright
15:52justin_smithsometimes we call this "macro-contagion" - you want to extend something, it's a macro, now you need another macro surrounding it
15:52mmeixis this a case of macros being "contagiuous"?
15:52mmeixah, ok
15:52lynnlol
15:54justin_smithin 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:55mmeixthat's a good sentence to remember
15:55mmeix(inc justin_smith)
15:55lazybot⇒ 275
15:57mmeixaha, that's why libs sometimes have two versions of some functionality: as a function and as a macro - right?
15:57lynnyeah 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:55rlbPerhaps 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:55justin_smithrlb: do you have code that shows that happening?
16:55rlbi.e. there's no synchronization in ARef setValidator. Perhaps that's intentional.
16:55justin_smithrlb: oh, iirc setValidator does not validate the existing state
16:55rlbjustin_smith: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ARef.java#L49
16:56rlbit says it does in the docs
16:56justin_smithoh, well that would validate it yeah
16:56rlbyes, but I'm wondering if there's a race between the validation and the assignment.
16:57justin_smithahh, now I get it
16:57rlbi.e. you check the value you just derefed, then someone else changes the value, then you set the validator.
16:57rlbIf that's right, then perhaps the docs or the behavior needs adjustment...
17:27bchamhey I
17:27bchamI'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:28justin_smithAKA it's a list?
17:28bchamyes
17:28bchamhow do I transform it into the tag tree?
17:29bcham((html/wrap {:tag :div}) {:tag :div :content ["hello"]})
17:29bchamis basically what I
17:29bchamam going for.
17:29justin_smithyou could do (apply html/wrap v) or (html/wrap (first v))
17:29justin_smithdepending on whether there would be other things you want in that list
17:32bchamThanks justin, I think I've got it. Was confused about this list wrap.
17:35bchamBut 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:38bchamhtml/wrap seems to return an array-map instead of the correct structure
17:38bchamMan this language makes me feel like an idiot.
17:40bchamI'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:42bchamany ideas justin_smith ?
17:47bchamnevermind, just tried to avoid the problem entirely.
17:47bchamor found a way to
18:33bucketh3adIs 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:56mrcheeksbucketh3ad:Have you considered the Xbootclasspath JVM parameter?
23:13SublixtIm trying to assoc an infinite list as a value for a map. but it times out.
23:14SublixtIs this just impossible to do, or am I going about it wrong?
23:14justin_smith,(assoc {} :a (range))
23:14clojurebot{:a (0 1 2 3 4 ...)}
23:14justin_smithSublixt: the assoc should just work, the printing might time out
23:15SublixtOdd, when I did it in my game it never left the frame I called it in
23:15justin_smithare you sure you aren't using the value?
23:16SublixtUmmm I'm not quite sure what you mean
23:16justin_smithwell, anything that tries to consume that infinite list is going to time out
23:17SublixtOh I understand what youre saying
23:17SublixtYeah Im dumb
23:18Sublixtthe api is probably trying to render it