#clojure logs

2015-04-12

00:46lexi-lambdaAre any of Trammel, clojure-contracts, or core.contracts commonly used?
00:47LaVidaPortlandNot that I've seen, but I'm pretty new to clojure.
00:48lexi-lambdaWhat is the usual way of ensuring preconditions, then?
00:48lexi-lambdaI.e., if I have a function that requires a string, what's the idiomatic way to guard against something else getting passed in?
00:50LaVidaPortlandNot sure, but what about using type hints for that scenario?
00:50lexi-lambdaOf course, the usual Java approach for non-type-based preconditions would be if (n < 0) throw something;, but that seems like clutter compared to a good contracts system.
01:31nuwanda_lexi-lambda: you could use :pre to test the args type
01:48justin_smithhell, I've seen "if we're counting the number of elements in a linked list, and this is the last element, throw something" in java
01:51adujustin_smith, wut
01:51justin_smithadu: it was in the .length method for LinkedList in an old openjdk
01:51justin_smithhell, it may still be there
01:59adujustin_smith, there is no length method for LinkedList
01:59adujustin_smith, did you mean size()?
02:06justin_smithadu: clearly I misremembered
04:08Fareis there a disassembler to look at the JVM bytecode produced by clojure?
04:10TEttingerFare: javap should be included with your JDK
04:10TEttingerhttp://www.theserverside.com/news/1363881/The-Working-Developers-Guide-to-Java-Bytecode
04:11FareI'd like to see how much better the code is than a naive interpreter... and maybe convince colleagues to rely on that technology instead of reinventing it, badly
04:12TEttingeroh wow
04:16Farewow?
04:19TEttingerFare, it's just that seems like a very bad idea to try to make your own interpreter from scratch when you already have a repl for clojure that actually does benefit from the JIT
04:20TEttingerunless it adds some very much-needed features
04:20sveriambrosebs: ping
04:20Farewell, the interpreter is not exactly for clojure
04:20TEttingerah
04:20Farebut I'm writing a compiler in clojure targetting clojure
04:20TEttingercould it be written as an internal DSL?
04:21Farenot sure what you mean.
04:21FareThe source language is some python-like language
04:22TEttingerinternal DSL as in, a domain specific language that's made with macros or whatever but ends up, once macroexpanded, as perfectly viable source in another language (hopefully clojure)
04:22TEttingerah
04:22Fareand it has to integrate into a java application.
04:22TEttingerah.
04:23TEttingersounds like "fun"
04:23Fare"indeed"
04:23TEttingerthe compiler sounds like the best option by far
04:23Fareduh
04:25TEttingerif you can maybe figure out a way to compile in separate units of code (like a method that corresponds to a single form in clojure), you could call your compiler on such a unit of code and pass it in to a running clojure repl
04:26Farecoming from CL, I really enjoy the clojure data model and its concurrency model. I think its paucity of control structures sucks, though.
04:26Fareit's a survivable suckiness, especially with higher-order functions, but still.
04:27FareI understand that direct integration with the substrate language "justifies" this paucity, but it still hurts.
04:27TEttingerso they type in, myFoo = "bar"<hits enter> then your compiler compiles that to your clojure equivalent, say, (def myFoo (atom "bar")), thrusts it into the repl, and runs it
04:27Farebasically
04:28TEttingerI haven't had any issues with a lack of control structures tbh
04:28Farethough a compiler is only interesting if the compiled files are cached.
04:28Fareif it were a run-once kind of thing, the interpreter would make more sense.
04:28TEttingerright, this might have to be a separate thing huh
04:28TEttingerhaving macros does make control structures fairly convenient to work with though
04:29Fareyes, macros and higher-order functions help survive that.
04:29TEttingerI'm not sure if you mean something different from doseq, for, loop/recur, etc.
04:30Fareand you can emulate delimited continuations in userland. But then, you can't interact well with other people's code, and pay a hefty price in performance.
04:32Farecompared to CL's loop's, its lexical block/return, or (yuck) tagbody/go, clojure is a bit poor. But yes, it does make it up in other ways.
04:33Farehandler-bind is also a big thing I miss from CL. Not obvious how you'd do it on the JVM though
09:29sobeljustin_smith: btw i found my emacs package issue. melba repo had to be manually added.
10:12sobeld'oh. calling System/exit affects my repl.
10:22justin_smithyou don't say?
10:24justin_smithsobel: System/exit is how I usually shut down my vm
10:31justin_smith$mail Fare many people use no.disassemble to read the clojure bytecode output, and also the bytecode is generated with a lib called asm
10:31lazybotMessage saved.
10:42matthavardI'm using the byte-streams library (https://github.com/ztellman/byte-streams) to read a file into a byte array. In my file, foo.html, there is a character/byte that has a value of 0x92 (146 decimal), which I have verified using a hex editor, but if I do `(map int (to-byte-array (java.io.File. "foo.html")))`, the integer at the corresponding position of the character is -110
10:43justin_smithmatthavard: there are no unsigned bytes in java
10:44matthavardHah yeah I just thought about that. It overflows to -100
10:44justin_smith,(- 146 127)
10:44matthavard*-110
10:44clojurebot19
10:45justin_smithmatthavard: yeah. The no unsigned thing makes java stuff with bytes a little painful sometimes.
10:45justin_smithit's the same 8 bits...
10:46justin_smiththere's probably a good trick for taking a byte and returning the int you would get for those 8 bit values, with all other bits being 0
10:46justin_smith,(bit-and -128 256)
10:46clojurebot256
10:46matthavard,(bit-and -128 -110)
10:46clojurebot-128
10:47afhammadcan someone take a look at this compile time error for me, its probably something silly https://www.refheap.com/99531
10:47justin_smith,(bit-and -110 256)
10:47clojurebot256
10:47justin_smithergh
10:47justin_smithoh, two's complement
10:47justin_smith,(bit-and (bit-xor -110 256) 256)
10:47clojurebot0
10:47justin_smithanyway, I bet there is some trick, maybe after I wake up more
10:51justin_smith,(defn uns [b] (if (pos? b) b (dec (* -1 (bit-xor b 255)))))
10:51clojurebot#'sandbox/uns
10:51UruvielHey! I'm using the Buddy wrap-access-rules. Currently I have a seq of rules like [{:uris ["/projects/:project-id"] :handler owns-project?}], but when inspecting the request map in owns-project? the project-id is not in the params (it's empty, in fact)
10:51justin_smith,(uns -110)
10:51clojurebot146
10:51justin_smithmatthavard: ^
10:51Uruvielis there a way to make buddy-auth parse out the params?
10:52justin_smithmatthavard: definition for "uns" is up there if you scroll up a little
10:57matthavardthanks justin_smith
10:57matthavarduns for un-sign?
10:57justin_smithhaha, yeah
10:57justin_smithterrible name
10:58justin_smithbut better for a one liner
10:58matthavardha it's great.
10:58matthavard,(uns -110)
10:58clojurebot#error{:cause "Unable to resolve symbol: uns in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: uns in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: uns in this context", :at [clojure.l...
10:59justin_smithmatthavard: clojurebot unloads definitions fast
10:59matthavard,(sandbox/uns -110)
10:59clojurebot#error{:cause "No such var: sandbox/uns", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: No such var: sandbox/uns, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "No such var: sandbox/uns", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[clojure....
10:59justin_smith,(defn uns [b] (if (pos? b) b (dec (* -1 (bit-xor b 255)))))
10:59clojurebot#'sandbox/uns
10:59matthavard,(uns -110)
10:59clojurebot146
10:59matthavardha awesome
10:59justin_smithwith a little extra fiddling, it could take an optional bit-count arg
10:59justin_smithto work on shorts, ints, longs
11:02justin_smithhmm, shorts and ints is easy, longs is tricky...
11:04matthavardIs there a way to read 0x92 as a unicode character and get the correct value? 0x92 is unicode for some weird right quote thing, and I'm trying to convert all non-ascii characters to html entities like "&#x92;"
11:06matthavardlike (let [c (int (unicode (get-char-from-file-somehow)))])
11:07TEttingermatthavard: ##(char 0x92)
11:07lazybot⇒ \’
11:07TEttingermatthavard: ##(char 0xa2)
11:07lazybot⇒ \¢
11:10justin_smithmatthavard: if you convert the byte-array to string, and map int across the string
11:11justin_smithwhen you create the string, there is an optional encoding arg (with clojure it defaults to utf-8 which is almost always the right thing in my experience)
11:12matthavardThat would not be the standard str function would it?
11:12TEttinger,(def some-bytes (byte-array (vec "hello")))
11:12clojurebot#error{:cause "java.lang.Character cannot be cast to java.lang.Number", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number, compiling:(NO_SOURCE_FILE:0:0)", :at [clojure.lang.Compiler$StaticMethodExpr eval "Compiler.java" 1696]} {:type java.lang.ClassCastException, :message "java.lang.Character cannot...
11:12justin_smithmatthavard: String
11:12justin_smith,(get-bytes "hello")
11:12clojurebot#error{:cause "Unable to resolve symbol: get-bytes in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: get-bytes in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: get-bytes in this contex...
11:13justin_smith,(.getBytes "hello")
11:13clojurebot#object["[B" "[B@41e6be86"]
11:13TEttingerthere we go
11:13justin_smith,(String. (.getBytes "hello"))
11:13clojurebot"hello"
11:13TEttinger,(String. (.getBytes "hello\u0092"))
11:13clojurebot"hello’"
11:13TEttinger,(String. (.getBytes "hello\u00a2"))
11:13clojurebot"hello¢"
11:13TEttingerthere we go
11:13justin_smithand you can map int on that
11:13justin_smithto get the int values of each char (not byte)
11:14TEttinger,(map int (String. (.getBytes "hello\u0092")))
11:14clojurebot(104 101 108 108 111 ...)
11:14TEttinger,(map int (String. (.getBytes "hey\u0092")))
11:14clojurebot(104 101 121 146)
11:14justin_smithand the circle is complete!
11:14matthavardSo how do I get from file object to string?
11:15justin_smithmatthavard: we just showed you how to get from byte-array to string
11:15matthavardoh oops
11:15justin_smithyou can already get byte-array from a file
11:15justin_smiththere is also slurp
11:15justin_smiththat directly gives a string from a file
11:16TEttinger(doc slurp)
11:16clojurebot"([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."
11:16TEttingerthe arguments can include an encoding
11:16mbachas some helpful fellow done the work of writing their own clojure photo gallery generator?
11:18matthavardjustin_smith: So theoretically (map int (String. (to-byte-array (java.io.File. "foo.html")))) should work?
11:18matthavardand/or TEttinger
11:18TEttinger(map int (slurp "foo.html"))
11:18justin_smithmatthavard: or (map int (slurp "foo.html"))
11:18TEttinger:D
11:19justin_smithheh
11:20matthavardAnd you were saying there's a way to set the encoding with that? Because that's giving me 65533 for bytes larger than 127
11:20justin_smith(slurp "foo.html" :encoding "something")
11:21justin_smithmatthavard: supported encodings are http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
11:21justin_smith~supported encodings is http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
11:21clojurebotA nod, you know, is as good as a wink to a blind horse.
11:21justin_smith~supported encodings
11:21clojurebotsupported encodings is http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
11:21TEttinger~supported
11:21clojurebotI don't understand.
11:32film42424I have a code style question.
11:34film42424I really want to add default vars to a record, but I want to be able to introspect those, so reify doesn't seem like a good option. I ended up with something like this: https://github.com/film42/rinok/blob/f5ea4c666be270e327c83582e07d2067ba05bc09/src/rinok/engine.clj#L63-L68
11:34film42424I'm sure the whole thing could be more idiomatic, so maybe there's a larger problem
11:34film42424Would love any kind of insight
11:35justin_smithfilm42424: the normal thing is to just create a function that manages your defaults, and not use the constructor directly
11:35justin_smithwhich looks like what you are doing
11:35film42424yeah, I just mocked it to look like a standard record constructor
11:36justin_smithwell, you actually replaced the automatically generated constructor function
11:36film42424since won't actually take any args, I always know what to give it. Just seems awful to override the constructor
11:36film42424yeah
11:36justin_smithsee also map->MatchingEngine
11:36justin_smithwhich is also automatically generated
11:38film42424Oh wow, I didn't know about map->MatchingEngine
11:41silasdavishello clojure, I'm failing to bind the dynamic vars *client-id* and *client-secret* in https://github.com/mochify/hiroba/blob/master/src/mochify/hiroba/rest.clj
11:42silasdavisI think i've just forgotten how to clojure
11:42silasdavisI've set globar-vars in my project.clj
11:42silasdavisalso used binding
11:42silasdavisi'm using fully-qualified name
11:42silasdavishow should I be setting these?
11:42matthavardTEttinger, justin_smith: Update, looks like any of the ISO8859_* encodings work!
11:43TEttingerwoo!
11:43matthavardJust went down the list and tried them one by one haha
11:45film42424silasdavis: What happens if you actually set them in your shell?
11:47film42424Oh I guess that's not how environ works
11:55mbacluminus is pretty shiny
11:58noncom|2mbac: true
11:58Uruvielhttps://github.com/funcool/buddy/issues/31
12:28mbacis the .html template format in luminus the same as the one in python django?
12:29mbacSelmer is a templating language similar to Django and Rails templates. If you're familiar with Django or similar templating languages you should feel right at home.
12:29mbacawesome!
12:29mbacthis framework is filling me with entrepreneurial zeal
12:30sobelhaha
12:30sobelthat is hilarious/familiar
12:44tomjackI think Selmer's readme could use a "why?" section
12:47justin_smithtomjack: like why use Selmer when there's Integer/MAX_VALUE other options?
13:01tomjackwell, I don't go in for those questions too much, I mostly look at the thing itself
13:02tomjackbasically "why would I (Clojure programmer) want to use Django-inspired templates?"
13:03justin_smithtomjack: in my experience there is a very productive collaboration when you have a front-end person who knows html,css,js and a back end person who does clojure,devops and the selmer template is where the two meet
13:04tomjackyeah, I kind of imagined that's what it's meant for
13:04justin_smithso it needs to comprehensible and powerful for the frontend person to get their stuff done, while also providing access to what the backend can provide
13:04justin_smith*needs to be
13:04tomjacklike "for when you're forced to use something like Django-inspired templates"
13:04justin_smithhaha
13:05justin_smithmore like, when the front end folks don't know any clojure, but sure
13:06tomjackbut if the author would use these templates when writing an entire project on their own, I'd also like to hear why. but it's also fine to have a readme which assumes the reader already wants X, so doesn't explain why one might want X
13:08_1_gudduhy
13:09_1_guddudm3
13:31dwysockiI'm having a problem that's probably just ignorance on my part
13:31dwysockiI'm using miner/tagged to save a record to a file in EDN format
13:31dwysockiWhen I parse it from the file, it properly resolves the type, with the fully-qualified namespace
13:31dwysockibut then the type is no longer considered equal its non-fully qualified form
13:31dwysockiso (= Foo my-ns/Foo) is false
13:31dwysockiI'm not really sure what to do at this point
13:32dwysockiit's causing my multimethods to fail to recognize the type
13:38tomjackthat doesn't make sense to me
13:38tomjackeither (identical? Foo my-ns/Foo) or not
13:38tomjackif not, why not?
13:38tomjackif not, you have two different Foo and it's getting the wrong one?
13:40tomjackactually..
13:40tomjackwhat is even my-ns/Foo
13:40justin_smithdwysocki: did you run defrecord twice?
13:40justin_smithreloading files that contain defrecord can lead to this sort of thing
13:40justin_smithif you have instances created with the prior defrecord before the reload
13:41justin_smithtomjack: because they mention a tagged reader I would assume a defrecord or maybe deftype
13:41dwysockidefrecord should only be run once
13:41tomjackdefrecord doesn't define a var
13:41tomjackwell, not that var
13:42tomjackif it's the class my-ns.Foo, then it should be the same class as Foo, or else the problem is that there are two Foo :)
13:42dwysockiI made a CLI that starts a separate instance of my program each time
13:43dwysockiso I can do `my-program write | my-program read`
13:43justin_smithtomjack: the issue with re-running defrecord has nothing to do with vars. It's that you get two different classes with the same name.
13:43tomjacksure, I didn't expect it was a re-running defrecord issue
13:43tomjackjust "(= Foo my-ns/Foo)" doesn't make sense
13:44justin_smithahh, that is looking at a var
13:44justin_smithright
13:44dwysockiactually, it might be a re-running defrecord issue
13:44dwysockiI'm running my program from a jar
13:45dwysockiand it's spinning up twice
13:45dwysockithe first time writes something in EDN to stdout
13:45dwysockithe second time reads it from stdin
13:45justin_smithdwysocki: with defrecord my-ns/Foo shouldn't even get created (though my_ns.Foo should)
13:46tomjackit shouldn't matter.. I suggest taking a look at some instances which don't work with your defmethods, and comparing their classes to instances which do work.
13:46dwysockiit actually is my_ns.Foo, sorry
13:46dwysockialthough
13:46dwysockiwhen it's written to stdout, it uses hyphens
13:46dwysockioddly
13:47dwysockibut when it's read, they've been replaced with underscores
13:47justin_smithdoes the tagged literal with hyphens get reloaded properly?
13:47dwysockiit looks like it does
13:47justin_smithone thing you could test is whether a single instance can generate the string for the edn, and then read it and get the same result back
13:47dwysockithat's a good idea
13:48justin_smitheliminating variales yo
13:48dwysockiyup
13:51tomjackhmm
13:51tomjackhypothesis: you're getting miner.tagged/TaggedValue
13:52tomjacktry it with a namespace that doesn't have hyphens :)
13:52justin_smithdwysocki: and if that works, next step is double checking that the reading side has loaded the ns that defines that record
13:52dwysockino, i'm not getting miner.tagged/TaggedValue
13:52dwysockithat was my first thought
13:52tomjackah, missed this: https://github.com/miner/tagged/blob/master/src/miner/tagged.clj#L87
13:52dwysockiI'm testing whether (= (class x) (class (parsed-x))) right now
13:53dwysockioh fuq
13:53dwysockiit's not =
13:53tomjacktoo bad he has to munge classnames :(
13:54dwysockiI'm wondering now whether I should just write the map to a file, and assume it's always that type
13:54tomjacknot =, but has the same name?
13:54dwysockiyeah, looks like the same name
13:55justin_smithdwysocki: that's weird
13:55justin_smithso (not= x (read-string (pr-str x)))
13:56dwysockiprecisely
13:56justin_smiththat's messed up
13:56justin_smithwhat about (= (read-string (pr-str x)) (read-string (pr-str (read-string (pr-str x)))))
13:56tomjackgotta be a defrecord-multiple-times error?
13:57dwysockiooh, I'll try that one
13:57justin_smithif that's a yes, then yeah my initial hunch about multiple defrecord loads is probably it
13:58justin_smithif it's a no, that is maybe a defrecord bug?
13:58dwysockiit's false :\
13:58dwysockiunless I mistyped
13:58justin_smithsounds like a bug in either the printing or reading side of records...
13:58justin_smithweird!
13:59dwysockior this library I put my trust in
13:59tomjackif you run (class (read-string (pr-str x))) over and over, do you get a different class every time?
13:59justin_smithtomjack: oooh, good call
13:59tomjackthat would be nuts
13:59tomjackI can't imagine how..
13:59dwysockimaybe I'm just doing something stupid
14:00dwysockiwouldn't be the first time
14:00dwysockinor the last
14:00justin_smith"programmer's program does not work, but only because they did something stupid, news at 11"
14:01dwysockihistory in the making
14:03dwysockihuh
14:03dwysockiso when I encode it the second time and on
14:03dwysockithe type is miner.tagged.TaggedValue
14:03dwysockibut not the first
14:03tomjackminer/tagged has this lovely 'feature' that the record tags are handled by the default tag reader, and there is a global fallback
14:03justin_smithdwysocki: what's the repo for miner?
14:04dwysockihttps://github.com/miner/tagged
14:04tomjackapparently there is some problem with the round-tripping of the record class/factory info for you
14:04tomjackso the record handlers fail and it defaults to TaggedValue, confusingly printed with the same (or almost the same?) tag?
14:05justin_smithdwysocki: and you are using the reader that miner provides?
14:05dwysockiyes
14:05dwysockiso
14:06dwysockiI override print-method on my record type to call (tag/pr-tagged-record on this w)
14:06dwysockibut if it's not seeing that the types are the same
14:06dwysockiit's going to default to the standard print-method
14:07dwysockiwhich prints the type as my_ns.Foo, instead of my_ns/Foo
14:07dwysockiand that's why the 2nd iteration and on are all of type TaggedValue
14:08dwysockiI think I've spent too long on this problem :P I should just give up and save a standard map
14:08tomjackI suspect the functionality there, which could have been easily added to Clojure core, wasn't added for a very good reason :)
14:08dwysockiand parse it into my record, which is almost trivial
14:08dwysockithis was supposed to be the easy part of what I did this weekend, lol
14:10dwysockiI think I'll actually just use the built-in edn reader, and inspect the tag
14:10dwysockithere are only 2 types I ever expect to see
14:11justin_smithdwysocki: a :type key added to a map should do it
14:12dwysockiyup
14:12dwysockidamned type systems
14:13justin_smithserialization is hard
14:13dwysockiI thought I'd finally found a case where a defrecord would be sensible
14:13dwysockiprobably could have just added a :type key
14:13justin_smithmy primary usage of defrecord has been in combination with protocols
14:14dwysockiI've just been using it with defmethods
14:14dwysockithat do slightly different things on my 2 types
14:14justin_smithit's easy to convert those to look at a :type tag
14:14justin_smithof course
14:14dwysockiyeah
14:14dwysockiI realize that now haha
14:15dwysockiugh, I don't want to change all this code now
14:53dwysockiwelp, I'm finally record-free
15:41wagjo,(clojure-version)
15:41clojurebot"1.7.0-master-SNAPSHOT"
16:18ShayanjmFor anyone who's interested, here's the (spherical) haversine formula implemented in clj: https://gist.github.com/shayanjm/39418c8425c2a66d480f
16:19the-kennyShayanjm: you might want to pull out some more stuff like (Math/sin (/ dlon 2)) into the let. There's also Math/exp
16:19Shayanjmthe-kenny: Very good call
16:19Shayanjmone min, refactoring
16:20dwysockialso, newlines
16:20Shayanjmdwysocki: I don't ever know where to break lines in big mathy implementations :\
16:20dwysockiI would do it for the arguments to the initial +
16:21dwysockiso I don't have to scroll :P
16:22dwysockiand when I say "initial +", I guess I mean "the only +"
16:33zirmanI've been trying to understand y combinator. I had a version that computed factorial that I reworked it into a different form. Is it still essentially a y combinator? Thanks.
16:33zirmanfunction y(y) {
16:33zirman return function (n) {
16:33zirman return n === 0 ? 1 : n * y(y)(v)(n - 1);
16:33zirman }
16:33zirman}
16:33zirmany(y)(5);
16:34zirmanoops
16:34zirmanthis is what I meant
16:34zirmanfunction y(y) {
16:34zirman return function (n) {
16:34zirman return n === 0 ? 1 : n * y(y)(n - 1);
16:34zirman }
16:34zirman}
16:34zirmany(y)(5);
16:38Frozenlockzirman: refheap.com
16:38oddcullyyour javascript made dnolen timeout
16:39zirmansorry
16:39dwysockihaha, I've encountered yet another serialization issue
16:39dwysockihow do you serialize Double/NEGATIVE_INFINITY?
16:39dwysockibecause it's getting output as -Infinity, and parsed as a symbol
16:40zirmanhttps://www.refheap.com/99541
16:51dwysockiI suppose the -Infinity issue is taken care of in tools.reader
17:12LaVidaPortlandzirman, that's some strange looking clojure. :)
17:12sandbagscfleming: ping ... don't suppose you're an Overtone user?
17:13cflemingsandbags: Pong... no, I'm not. I think I know the next question, though :)
17:13TEttingersandbags, I'm curious about Overtone, does something in the livecoding break in Cursive?
17:13TEttingerI have only used at-at from Overtone, which is definitely nice
17:14sandbagscfleming: i just tweeted a screenshot of some code in cursive
17:14sandbagscfleming: it works but cursive seems unhappy
17:14cflemingTEttinger sandbags: It's not the live coding, it's the way the symbols are generated: https://github.com/cursiveclojure/cursive/issues/774
17:14cflemingsandbags: Yeah overtone makes Cursive sad
17:15sandbagsso if i pull in overtone.core will that fix things?
17:15sandbagsoh wait, i see, no
17:16cflemingsandbags: There's some hope that I might be able to fix that using stub generation, but that requires more time than I have right now.
17:16cflemingsandbags: However stub generation is also required for datomic to work nicely, so I'll do it at some point.
17:16sandbagsokay so basically overtone is too-much-voodoo
17:16sandbagsi mean, it's not a problem as is
17:16cflemingMore or less, yeah
17:16sandbagsit works
17:17sandbagsoh one thing i could really use, is there a way to write a macro to send to the REPL?
17:17cflemingsandbags: Sure, you could just turn off the unresolved symbols warning.
17:17sandbagsi wrote a macro but of course it's just inserting wherever the cursor has focus
17:17cflemingsandbags: https://github.com/cursiveclojure/cursive/issues/85
17:18zirmanLaVidaPortland: not clojure but it has closures
17:18cfleming(which is a polite way of saying no)
17:18sandbagscfleming: yeah, awkward
17:19cflemingsandbags: You could fudge a macro if you assign a Cmd-number sequence to the REPL toolwindow - then you could start your macro with that key, which will jump to the REPL toolwindow.
17:19sandbagsbut in that don't you say that will close it if the REPL is already open?
17:19cflemingIt'll close it if that toolwindow is already selected
17:20cflemingSo if you're in a normal editor it will do what you want
17:20sandbagsright, i think because i am switching back and forth that's likely to be annoying too often
17:21cflemingsandbags: Ok. I'll look into fixing that issue, it's been open for ages and it's a popular request.
17:21sandbagsi'd hoped IDEA was a little more controllable
17:21sandbagsbut the macros look pretty rubbish
17:21cflemingsandbags: It'll be post-Clojure/West though.
17:21nicferriercould a lein project generate more than one main class?
17:21nicferrierif I just put gen-class in the ns decl does that make it a main?
17:21sandbagscfleming: would it be possible to script IDEA in Clojure(Script) using Cursive at some point?
17:22sandbagsi mean it's Java...
17:22cflemingsandbags: Yeah, I'm planning that
17:22sandbagsnice
17:23sandbagsdo you get any support from JetBrains... actually do you work for JetBrains? :)
17:24cflemingnicferrier: Sure - you can only have one per ns AFAIK, but you can have many namespaces with main functions, no problem. I think you can only specify one in project.clj to work with lein run, though
17:24nicferriercfleming: right. thanks.
17:25cflemingsandbags: No, I don't, but they're fairly helpful. I have one mole there who helps a lot because he's a Clojure fan, and they're more helpful in general as Cursive gets more popular.
17:25sandbagsso, labour of love
17:25sandbagsimpressive what you've done
17:26sandbagsi was cautiously happy with LightTable but since i managed to get Cursive installed I've not looked back
17:26cflemingWell, you're going to have to pay for it at some point :)
17:26sandbagssure, sure, we all gotta eat :)
17:26oddcullycfleming: but it will be part of ultimate? like all the other languages?
17:26sandbagsgod knows what i've paid for this hobby over the years
17:27cflemingoddcully: Sadly, no - that would require some sort of deal with JetBrains. It's not out of the question, I suppose, but it's unlikely to be any time soon.
17:28oddcullyok, so all the other ones are actually done by JB i assume?
17:28cflemingOr are open source, right.
17:28cflemingBut there are only a couple of decent open source ones - it's a huge amount of work.
17:28sandbagsye gods the overtone code is a bit complex ... i think i am goign to have to find my supercollider book to grok this stuff
17:29oddcullyi only have python installed additional to the jvm ones. i guess that is from them (pycharm i guess)
17:31cflemingoddcully: Right, that's from them. The core Python support is actually open source now, but the framework and web support is not.
17:32sandbagsGood opportunity for them to rewrite IDEA in Clojure :)
17:33cflemingsandbags: Ummmm.... that's unlikely to happen :-). They'll probably write more of it in Kotlin at some point I assume.
17:34sandbagsDamned NIH :)
17:38arrdemare there any good composable regex DSLs for Clojure?
17:38arrdemI'm just realizing that I have a few productions that are repeated a _lot_
17:43TEttingerarrdem: that seems like... a very odd idea
17:43arrdemTEttinger: why?
17:43TEttingerregexes are already a dsl, and I have no idea how you would compose them
17:44TEttingerdo you mean this-followed-by-this?
17:44arrdemyep, or this as a group in a new production
17:44TEttingerI wonder... #(str #"(\w+)\1\1")
17:45TEttingerI wonder... ##(str #"(\w+)\1\1")
17:45lazybot⇒ "(\\w+)\\1\\1"
17:45TEttingerhm
17:45TEttinger,(re-pattern (str #"(\w+)\1\1"))
17:45clojurebot#"(\w+)\1\1"
17:45scottjTEttinger: have you seen rx in emacs? https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L966-L983
17:45TEttingernot an emacs user
17:45TEttingercfleming is my lord and savior
17:46TEttingerwoaah scottj that looks outrageously verbose
17:47cflemingarrdem: ztellman's automat, maybe?
17:47TEttingerthat ztellman
17:47TEttingeralways with the useful libs
17:47cflemingarrdem: or you could wrap a dsl around this: http://www.brics.dk/automaton/index.html
17:47scottjTEttinger: there are shorter names for a lot of the things. like instead of zero-or-one you can use optional or opt
17:47TEttingerah ok
17:47arrdemcfleming: heh nice one
17:48scottjTEttinger: or one-or-more can be 1+
17:48svericfleming: sandbags I heard one of the kotlin developers talk last year about it. He said that more and more teams are switching to kotlin at JB. Most interesting fact for me was that the teams are free to choose their language they want to code in
17:49sandbagslooks like YAOOPL
17:49cflemingsveri: Really? I'm surprised - basically all their code is in Java, except for the Scala and Kotlin plugins, which have a fair amount of their respective langs.
17:49cflemingsveri: And a lot of groovy in builds and tests
17:50svericfleming: He was coding in C# before he started working on kotlin, thats what he said
17:50sveriI guess there are a lot of teams doing different things beside Intellij
17:51cflemingsveri: Interesting - he was probably working on resharper, I guess, and I think they have some .NET profiling tools too
17:51svericfleming: Yea, could be, that sounds reasonable
17:52cflemingBut yeah, they have a ton of products now.
17:52sandbagsso complicated
17:52sverisandbags: the java interop was pretty hard to understand the last time I looked at it, maybe one year ago
17:52cflemingsandbags: It's not so bad actually, takes a bit of getting used to, like anything I guess
17:53cflemingI'd use it for Android development, I think
17:53cflemingAt least until arrdem finally finishes OxCart
17:53sveri:D
17:53arrdemcfleming: oxcart is dead. you may get oxlang evetually
17:54svericfleming: I tried that and gave up after some hours guessing how to integrate the java android api into kotlin code
17:54cflemingarrdem: I shall wait for it patiently.
17:54arrdemcfleming: just for that you're buying first at clj/w
17:54cflemingsveri: Oh, bummer. I'd say Java 8 but that's no good either.
17:54cflemingarrdem: Ok, ok....
17:54svericfleming: does not work ion Android yet IIRC
17:54sveriI mean Java 8
17:55cflemingsveri: Right, it doesn't.
17:56sandbagsanyone here used JavaFX ... i've been looking at fn-fx but i can't tell if JavaFX is actually a useful thing to build on
17:57cflemingsandbags: tbaldridge seems to love it, I've never used it myself
17:57sandbagsassuming tbaldridge is actually going to continue to work on fn-fx anyway (much like React for JavaFX)
17:57cflemingsveri: https://github.com/orfjackal/retrolambda should work for most of the interesting Java 8 stuff, that's nice.
17:57sandbagsmy last Java GUI experience was Swing in about 2001 so i'm kind of at sea
17:57cflemingsandbags: seesaw?
17:58sandbagsi did take a look at that but... it didn't grab m
17:58sandbagse
17:59sandbagsit's not like i remember anything useful about swing at this point anyway
17:59svericfleming: sounds interesting...but I guess I cannot use this at work as you need JDK 8 to compile the code and all our build systems must run JDK 7
17:59oddcullymine was AWT... i have the 1.1 oreilly book to prove it
17:59oddcullynever finished it
18:00cflemingsveri: He recommends using JDK 8 for dev, but JDK 7 for builds/testing to make sure you catch any problems.
18:01svericfleming: "Use JDK 8 to compile your source code." that won't work for us I guess
18:03sandbagsright, time for sleep ... thx again cfleming
18:04ShayanjmOk now the opposite - "reverse haversine" implementation: https://gist.github.com/shayanjm/644d895c1fad80b49919
18:04Shayanjmany criticism is more than welcome -- still haven't fully figured out how to write thing in a clojuric way I think
18:07cflemingShayanjm: That looks fine to me
18:08cflemingShayanjm: One thing is that the official Clojure lib guidelines recommend not destructuring in your arglists - I actually quite like that though, since it appears in doc popups and so on, and documents the shape of the map you're expecting.
18:09Shayanjmcfleming: that was my reasoning for doing the destructuring
18:09cflemingShayanjm: I think it's ok, I wouldn't worry about it
18:09ShayanjmSweet thanks for the input :)
18:10oddcullyand R should be some const (maybe for gist sake here dome otherwise)
18:10oddcullys/dome/done/
18:11Shayanjmgood point cfleming
18:12cflemingShayanjm: All credit for that goes to oddcully :)
18:12Shayanjmoops, oddcully *** tabbed the wrong name
18:17oddcullyis there a way to import java stuff :as ? Like with all that Math/ stuff going on there to alias that to m/ ?
18:18Shayanjmoddcully: Yeah honestly I definitely should've done that
18:18ShayanjmI'll probably refactor with that in there once I finish testing @ scale
18:18Shayanjmit'll be part of the whole "tear down the duct tape" process prior to open sourcing
18:19cflemingoddcully Shayanjm: No, you can't do that - you need the class/method syntax
18:19Shayanjmcfleming: use as m wouldn't work?
18:20cflemingoddcully Shayanjm: The best you could do is wrap them in a function.
18:20Shayanjmorly
18:20cflemingShayanjm: No, Math is a class, so you import it, not use it
18:20ShayanjmAhh right
18:20oddcullyok, was just wondering, because searches/grimoire did not show anything
18:20TEttinger$google java 7 Math
18:20lazybot[Math (Java Platform SE 7 ) - Oracle Documentation] http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
18:21cflemingActually, Math you don't have to import because it's in java.lang, but if it were in another package you'd have to import it, and import has nothing like :as
18:21oddcullyi only wanted to alias it ;)
18:21TEttinger,(def M Math)
18:21TEttingercurious
18:21clojurebot#'sandbox/M
18:21oddcullyok, is found nothing, because it does not exist
18:22TEttinger,(M/sqrt 4)
18:22clojurebot#error{:cause "No such namespace: M", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: No such namespace: M, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "No such namespace: M", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[clojure.lang.Util ru...
18:22TEttinger,(.sqrt M 4)
18:22clojurebot#error{:cause "No matching method found: sqrt for class java.lang.Class", :via [{:type java.lang.IllegalArgumentException, :message "No matching method found: sqrt for class java.lang.Class", :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}], :trace [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53] [clojure.lang.Reflector invokeInstanceMethod "Reflector.java"...
18:22oddcullyTEttinger: this means no, right?
18:22TEttingerhm
18:23oddcullythanks anyway, bbl
18:23oddcully(inc cfleming)
18:23lazybot⇒ 15
18:23oddcully(inc TEttinger)
18:23lazybot⇒ 49
18:23TEttingerthx
18:24cflemingAhh, sweet karma
18:24TEttinger,(def M #'Math)
18:24clojurebot#error{:cause "Expecting var, but Math is mapped to class java.lang.Math", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Expecting var, but Math is mapped to class java.lang.Math, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.RuntimeException, :message "Expecting var, but Math is mapped t...
18:24TEttinger,(def M Math)
18:24clojurebot#'sandbox/M
18:24TEttinger,(.sqrt #'M 4)
18:24clojurebot#error{:cause "No matching method found: sqrt for class clojure.lang.Var", :via [{:type java.lang.IllegalArgumentException, :message "No matching method found: sqrt for class clojure.lang.Var", :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}], :trace [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53] [clojure.lang.Reflector invokeInstanceMethod "Reflector.jav...
18:25TEttingerdog-at-keyboard.jpeg
18:25cflemingTEttinger: Can't do it, sorry
18:26cflemingI'd actually like to be able to do that, especially when you want to import two classes with the same name
18:39arrdemI guess I'd refactor that to use unit tagged values and define my own sin/cos/tan etc, but this is left as an exercise for another barber
18:39arrdemas-is it's fine tho
18:40Shayanjmthanks yo
18:58ticking_dnolen: hey, this looks liek abug in core.match, should I fill an issue? (match [[1 2 3]] [([h & r] :as a)] a) -> [1]
19:04ticking_additionally, does it grant its own issue, or should I just add it as a comment on http://dev.clojure.org/jira/browse/MATCH-93 ?
19:06dnolenticking_: just add it to the ticket as additional case via comment, I believe sritchie may have found a similar issue w/ :as.
19:07ticking_dnolen: k, I'll do :)
19:07dnolenticking_: no idea when I'll have time to look at though, so patch very welcome.
19:07ticking_dnolen: I'll look into it :)
19:07dnolenI've maxed out on Clojure OSS contribution
19:07ticking_dnolen: yeah, I was already wondering how you handled all that TBH
19:09ticking_dnolen: so thanks for all the good work :)
19:44TEttingercfleming: I'm pretty proud of my first real macro
19:44clojurebotExcuse me?
19:44TEttingeralso my first nested macro
19:45TEttinger,(defmacro import-alias [new-name imported] `(defmacro ~new-name [f# & body#] `(. ~'~imported ~f# ~@body#)))
19:45clojurebot#'sandbox/import-alias
19:45TEttinger,(import-alias mmm Math)
19:45clojurebot#'sandbox/mmm
19:45TEttinger,(mmm sqrt 4.0)
19:45clojurebot2.0
19:45TEttingerit doesn't use a / of course
19:46TEttinger(inc amalloy) ; for writing an excellent blog post on macros-in-macros
19:46lazybot⇒ 257
19:46justin_smith,(mmm PI) ; delicious
19:46clojurebot3.141592653589793
21:02Shayanjm6 hours and 8.4k requests later, my algo works and I now have a pretty comprehensive list of every restaurant in Austin TX ranked by popularity/foot-traffic :)
21:06justin_smithnice!
21:06justin_smithShayanjm: is this just a data crunching thing, or do you have a frontend too?
21:07Shayanjmjustin_smith: purely data crunching thing right now
21:07Shayanjmwould be really cool to have a UI
21:07Shayanjmbut I'd love to show off the implementation before it's super polished, since really it's a showcase of efficient hexagonal circle packing
21:07justin_smithShayanjm: maybe incanter?
21:07Shayanjmjustin_smith: Yeah I could do that - but at the scales i'm dealing with, just plotting is a HUGE issue
21:07justin_smithoh, nice, screenshot?
21:07Shayanjmsec i've got a few laying around
21:08Shayanjmjustin_smith: http://puu.sh/gQUd9/3e76116348.png
21:09Shayanjmexample at a reasonable scale
21:09Shayanjmi think the dimensions on that was something like 3km radius bounding 50m radius circles
21:09justin_smithlooks like something that some opengl might help with - maybe cljs with 3.js or webgl?
21:10ShayanjmYeah, tons of really cool stuff. Ideally i'd like to overlay on a map
21:10Shayanjmprobably like a v2 thing tho
21:10Shayanjmwhat's really cool is that it can generate packings at even incredibly unreasonable scales
21:10Shayanjmhttp://puu.sh/gTuqz/dcd5406b74.png (in progress HUGE circle packing)
21:10Shayanjmsomething like 750k 5km circles being packed into a circle with radius 5M KM
21:11justin_smithso all these circles are identical in size, right?
21:11Shayanjmwhich, for reference, is bigger than the surface area of most planets in our solar system
21:11Shayanjmyeah
21:11Shayanjmone of the requirements for the implementation
21:11Shayanjmidentical in size, no overlap
21:11Shayanjmthis is specifically for API optimization
21:11justin_smithI bet there is some really good math for optimal packing of unit circles
21:11Shayanjmyou want the minimum # of requests to some geo-bound API while still maximizing coverage
21:11Shayanjmjustin_smith: yeah, circle packing is a still unsolved problem
21:11justin_smithahh
21:12Shayanjmhexagonal packing is considered the most trivially optimal solution
21:12justin_smithhttp://mathworld.wolfram.com/CirclePacking.html
21:12Shayanjmbut is by no means 'the' solution (as you can tell by the gaps)
21:12justin_smithyeah, that looks like what wolfram is saying too
21:12Shayanjmyeah, something like .906 average coverage
21:12Shayanjmunfortunately to get other packing configurations you pretty much have to brute force it
21:12justin_smithI didn't realize it was still an open thing, that's cool
21:12Shayanjmbut for hexagonal packings specifically, I think I came up with a pretty clever implementation which is pretty fast
21:13Shayanjm30 seconds to generate 750k lat/long pairs on a macbook pro
21:13Shayanjm(to cover that bigger-than-a-planet area)
21:13Shayanjmso generating the points isn't even the bottleneck anymore - it's doing stuff with that data that takes forever.
21:14Shayanjmi'll be opening the project really soon so I would love any criticism at all
21:14justin_smithyeah, and then you have some questions to answer before you can get a fast solution - what kind of lookup should be optimized, neighbors vs. absolute position...
21:14ShayanjmYeah exactly, there were a few ideas that I was throwing around
21:14Shayanjmwith hexagonal packing the neighbors 'dumb way' is just generating 6 surrounding circle for each circle you generate
21:15Shayanjmwhich, obviously, would get hella computationally intensive as you have a bigger and bigger bounding area
21:15justin_smitheg. quad trees are amazing for fast lookup, but are kind of sad for traversing neighbors
21:15ShayanjmYeah. the iterative solution was very very complicated
21:15Shayanjmand required tons of dynamic shit which just wasn't worth it
21:15justin_smithright
21:15Shayanjmso the implementation I settled with is fairly simple
21:16Shayanjmthe gist is that you can split that hexagonal packing into 6 triangles
21:16Shayanjmif you figure out how to generate a triangle, you can just rotate those points 6 times
21:16Shayanjmwhich seems fairly obvious, but interestingly enough the triangle you have to generate resembles pascal's triangle
21:17Shayanjmeach 'new number' in pascal's triangle (i.e: 1 _2_ 1) is a new distance from the center point that you have to manage if you were to generate the solution iteratively
21:17Shayanjmso as you generate more and more layers, you have to keep track of more and more distances from the center point, therefore you have an indefinite number of vars you have to keep track of iteratively
21:17justin_smithoh, of course
21:17Shayanjminstead, you can just generate the next-layer neighbors for each circle
21:18Shayanjmand take the set of those returned points
21:18Shayanjmbecause each distance to the next circle is only ever going to be 2 * circle's radius
21:18justin_smithShayanjm: my hunch is that this sort of graph is not good for the standard graph algorithm optimizations (because it is so densely connected and uniform)
21:18Shayanjmand the bearing from each circle will only ever be 0 degrees or 60 degrees (each circle in the triangle has exactly 2 'next layer neighbors')
21:18Shayanjmyeah probably justin_smith
21:19Shayanjmi'm still trying to figure out if this is even a 'good' implementation
21:19Shayanjmit seems so, because the packing points are generated pretty damn fast
21:19Shayanjmand it mitigates the bottleneck to API rate limits
21:19Shayanjmin any case, i think it's a pretty cool project and hopefully someone can use it if they ever want to canvas huge areas using circle packing
21:20Shayanjmthe lat/long coordinate generation is pretty accurate too - in line with the assumptions that most popular GIS APIs use (i.e: google maps)
21:21justin_smithShayanjm: depending on what you are trying to do with the data, isn't there a variant / alternative to packing where instead of ensuring no overlaps, you ensure no uncovered area and minimize total count given that constraint?
21:21justin_smithShayanjm: I ask this not really fully comprehending what you are doing
21:22Shayanjmjustin_smith: yeah, that's theoretically "the seed of life"
21:22ShayanjmI think
21:22Shayanjmthe packing would end up looking something like this: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSaSaPEOU1riyviI1pSqLqPlC6Ed6wK50jjXW01jftN7ngvz7nfF1GNrA
21:22justin_smithoh, interesting
21:22Shayanjmjustin_smith: the usecase is this: imagine you wanted to get data on every business in your city. Or even bigger - every business in your state
21:23justin_smithShayanjm: isn't that cetner circle redundant there?
21:23Shayanjmunfortunately if you just ask google: "Get me every business in 5km from my point" it'd only return at most like 20 results, because it limits the return despite having a huge upper bounding radius
21:23justin_smithahh, OK
21:24Shayanjmjustin_smith: Nah that's why it's called the "seed of life". It's a pattern that occurs naturally where you have a single entity, put 6 points around it separated by 60 degrees each
21:24Shayanjmand draw circles with centers at those points
21:24Shayanjmand it overlaps 100%
21:24Shayanjmif you removed the center circle, you'd end up with my pattern
21:24justin_smithand if you shrink all the circles, you get a standard hex packing, right?
21:24ShayanjmYup
21:24justin_smithcool
21:25Shayanjmeven more interesting: if you make each circle so small it becomes a point
21:25Shayanjmyou can get the trivially-optimal electron coverage for a sphere
21:25Shayanjmof some given radius
21:25justin_smithShayanjm: I just got a job doing some graph / big data stuff, so I'm finding it useful to exercise some semi-related brain muscles
21:25ShayanjmYeah, I work in financial tech so I love working on projects like this
21:25Shayanjmbefore Fintech, I was in Health IT doing predictive modeling for patient outcomes
21:26Shayanjmso weird off-the-wall data projects are my bread and butter
21:26justin_smithcool - I love this kind of stuff because what "normal people" find "intuitive" is so much less a factor
21:26justin_smithhaha
21:27Shayanjmhahahaha yup
21:27Shayanjm@ day job I have to write pretty dumb code so everyone else can quickly understand & get up to speed
21:27justin_smith"we know that's how it really works, but we don't understand it, so can you present us with something totally inaccurate that we understand?"
21:27Shayanjmon these types of projects, I can sit and think about a problem for 3 hours and implement like 2 (dense, but clever) lines
21:27Shayanjmlolol yup precisely
21:27justin_smith"oh, and we are going to complain if it's ever wrong, even though we asked for a thing that is wrong"
21:27Shayanjmhahahahaha exact same tension w/ me @ work
21:28ShayanjmI tend to want to optimize for the general solution that will _always_ work
21:28Shayanjmit describes the problem accurately, and delivers a solution in a format that is true to the problem domain
21:28Shayanjmbut then I end up having to rewrite it in a dumb breakable way because no one can quickly read it and fully grok it
21:29Shayanjmjustin_smith: I'll be writing a blog post outlining what I did in this project, but I think I'm going to take it in a different direction
21:30Shayanjminstead of going over the technicalities of the project, I think I'm going to write something along the lines of: "How to take an idea from Point A to Point B when the bottleneck is a lack of domain knowledge"
21:30Shayanjmand using this specific project as an example/springboard
22:24fellipebritoDo you guys use cljs for something? If yes, how do you guys test it? I've found clojure pretty good at tests, but cljs makes me a little confuse.
22:25LaVidaPortlandI'm just starting to learn clojure, so I haven't done anything with cljs yet. Sorry!
23:43Bruce_Wayneanyone know the best library when dealing with passing params in a url?
23:43justin_smithBruce_Wayne: use ring wrap-params
23:44Bruce_Waynehaving trouble with params that have a &
23:44Bruce_Waynewon’t pass in the url
23:44justin_smithcan you give an example?
23:44Bruce_WayneWagner & Sons
23:44XorSwapBatman?
23:44Bruce_Waynea string such as that is a paramater I need to pass in the url
23:44justin_smithyeah, that's not a valid syntax in a URL param, you need to escape it
23:44Bruce_Waynebut it won’t accept the & symbol
23:45justin_smiththat's a limitation of how URL parameters work
23:45Bruce_Waynejustin_smith: exactly, so how can I escape it?
23:45arrdemjustin_smith: cemerick and some other people have lighter weight url parsing and forging libraries
23:45justin_smithoh, for generating such a thing? there's a library that does URL encoding, sorry
23:45Bruce_Wayneyep!
23:45Bruce_Waynewhat’s the library?
23:46justin_smitharrdem: lighter weight than wrap-params?
23:46justin_smithBruce_Wayne: checking
23:46Bruce_Waynethank you!
23:46arrdemjustin_smith: isn't that part of ring's routing infra?
23:46justin_smithit's a middleware, I thought he was serving requests
23:46arrdemjustin_smith: when doing the lib-grim url crap I found a few things that were _just_ url parsing/generating
23:46arrdemmaybe he is
23:46arrdemBruce_Wayne: the hell are you doing so we can arm you accordingly
23:47arrdemdon't want to give you bad advice now do we :P
23:47Bruce_WayneI am passing params through a url, then populating a form with those params on the other end
23:47Bruce_Wayneso I need to take the param
23:47Bruce_Wayneencode it for the url
23:48Bruce_Waynethen decode it back to the original to prepopulate the form
23:48justin_smithBruce_Wayne: with jvm 1.7+ use (URLencoder/encode str "UTF-8")
23:48justin_smithfor 1.6 I'm not sure
23:48Bruce_Wayneok, and how can I decode the params on the other end?
23:49justin_smithwrap-params does it if you have a ring server on the other end
23:49arrdemjustin_smith: aw come on man [cemerick/url "RELEASE"]
23:49justin_smitharrdem: it's a single static method, you don't need a lib for that
23:49arrdemjustin_smith: the lib is literally defn wrappers around that single static method lol
23:50justin_smithanotehr static method to decode (URLDecoder/decode str "UTF-8")
23:50justin_smithBruce_Wayne: as long as you can use 1.7, use those two, I'd say
23:51Bruce_Waynejustin_smith: Thank you
23:52justin_smithhaha