#clojure logs

2015-01-02

01:46justin_smithI love debugging after I have had some wine ";; the data generated is ill specified, and the function generating it is a fucking mess"
01:48rritochjustin_smith: LOL, was this in a commit for future generations of clojure developers to enjoy?
01:48justin_smithnah, it is a comment for me to follow up on when I am thinking more clearly
01:49rritochjustin_smith: heh, well I've actually seen a lot of crazy comments over the years. I'm not sure if there is a top 10/100 list somewhere, but your comment would certainly warrent recommendation.
01:51rritochjustin_smith: My favorite comment for non-client projects is ;WTF? , which beyond the standard meaning can mean "What to fix"
01:52rritochIf I'm really annoyed that comment is used on client projects, but luckly it's never made it to a commit, yet.
01:59rhg135;ignore this
02:04justin_smith;; truly the person I was in the past is a sadistic monster torturing me with this absurd code
02:05rhg135what was the code?
02:06justin_smithrhg135: an attempt to normalize data from a csv so that references to unique ids already existing in the datomic db will be found and upsert merged
02:07rritochhttp://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
02:07justin_smithrhg135: and I clearly was deranged and delusional while trying to design it, the datastructures I was generating didn't even make any sense
02:08rhg135souns like most c, justin_smith
02:08justin_smithheh, but it's clojure. and now I must fix it
02:08justin_smithin the morning, after coffee. Now to drink more wine, and harrass a wooden box covered in metal strings until it screams in pain
02:11rhg135I hope u refer to a guitar
02:11justin_smithrhg135: viola. Close enough.
02:11justin_smithviolas are better at screaming though. Guitars require electricity for that sort of thing.
02:11rhg135viola or Viola, justin_smith ;)
02:12justin_smith?
02:12rhg135ok good
02:13rhg135Also acoustic guitars can wail
02:13justin_smithOK.
03:49weitrying to figure out why my loggback logger runs on compilation (lein javac).
03:50weiit’s failing because it can’t find a java class that’s not compiled yet.
06:34ercusr.
06:51jonathanjhrm, how does one limit the size of a POST request body to a ring server?
06:51jonathanji found https://github.com/ring-clojure/ring/pull/98 but it's not merged (last updated almost a year ago)
06:53spradnyeshi have 500 days, and 1000 files (each about 3-4k lines) for each day. i want to run the *same* clojure program on each of these files. i have 4 octa-core PCs. what is a good way to go about distributing these processes across these cores? cascalog (hadoop + clojure)?
06:54spradnyeshbtw, the clojure program uses 3rd party Java libraries
06:55spradnyeshbasically, the program reads *a* file, uses a 3rd party Java library to do computations, and inserts the results into a DB
07:01spradnyeshhttp://stackoverflow.com/questions/27741873/clojure-parallel-processing-using-multiple-computers
07:49AeroNotix1000 files * 4k seems like a single 8 core cpu would blast through that.
07:49AeroNotixit's a tiny tiny amount of data.
07:49AeroNotix* 500 as well. Still not much
09:15jonathanjit's not clear to me if i can abort a POST in a ring application
09:32hellofunk,(into [] '(1 2 3 4))
09:32clojurebot[1 2 3 4]
09:32hellofunk,`[~@(1 2 3 4)]
09:32clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
09:33hellofunk,`[~@'(1 2 3 4)]
09:33clojurebot[1 2 3 4]
09:33perplexaeeew
09:33hellofunki'm finding that i like syntax unquote splicing quite a bit and am using it instead of into quite often. bad thing?
09:35perplexahellofunk: it massiely decreases readability and makes unnecessary use of macros ;p
09:37perplexai have no idea about technical aspects such as laziness though ;p
09:37hellofunkperplexa: well technically what i have provided is not a macro
09:38perplexahellofunk: ~@ is a macro.
09:38perplexa,(macroexpand '~@'(1 2 3 4))
09:38clojurebot(clojure.core/unquote-splicing (quote (1 2 3 4)))
09:39hellofunkperplexa: a reader macro, no?
09:40perplexahellofunk: yes, but how does that make it better or any different?
09:40perplexawhat's with your aversion against into?
09:41perplexacheck out https://github.com/bbatsov/clojure-style-guide
09:42hellofunkperplexa: my example was trivial, but usually a combination of into and concat can be consisely handled by a single reader macro
09:43perplexathere's no need for a macro when a function does the same
09:44hellofunkjust getting opinions, i see it more as a matter of taste, there are quite a lot of examples i come across in production code where these macros were used rather than functions
09:45perplexahellofunk: doesn't mean it's good ;P
09:45hellofunkperplexa: for example
09:45hellofunk,(into [] (concat [1 2 3 4] [5 6 7 8]))
09:45clojurebot[1 2 3 4 5 ...]
09:45perplexadon't get me started on the pile of dirt our php frontend team leaves everywhere :D
09:45hellofunkvs:
09:45hellofunk,`[1 2 3 4 ~@[5 6 7 8]]
09:45clojurebot[1 2 3 4 5 ...]
09:46perplexayeah definitely the first one ;)
09:46hellofunkperplexa: i used to agree with you until i starting seeing the second more and more
09:46perplexamaybe wait for some other people to pop up here :)
09:47perplexai'm rather a clj newb ;x
09:47perplexabut i'm sure somebody has some good reasons for the first one ;p
09:47hellofunkperplexa: I suppose it is worth noting that a reader macro would not invoke runtime function call so could be faster
09:53dysfunit's also less useful
09:53dysfuni can't imagine a situation where i'd find it useful
09:54supersymperplexa: I have the joy of working PHP/Magento now... :( It hates you so much
09:55perplexasupersym: i learned oop with magento 0.8 - no docs whatsoever, was much fun to reverse all their badly written code :)
09:55supersymI find it extremely hard NOT to create messy code with PHP though
09:55perplexanot even inline docu
09:55supersymyeah... everything has to be a scavanger hunt
09:56supersymI am loving my 'ack' atm
09:57supersymalso zen coding the XML files saves some pain etc but coming back from clojure, I don't think its that good for my motivation until there is a clj->php of decent quality sometime, I'll hate it with a passion
09:59supersymnot every clojure library does provide (inline) documentation, some are just notoriously hard to grasp or just outside of reach (of me) at a given point... but at least its not mutable soup where this is actually the norm
09:59supersymmeaning most don't actually need to extra comments... PHP projects sure do though
10:16supersymah... my login problem of course: cookie domain
10:21EvanR-workis there a string split which simply splits on a single char or a simple string delimiter
10:28mdrogalis,(clojure.string/split "a,b,c" #",")
10:28clojurebot["a" "b" "c"]
10:28mdrogalisEvanR-work: ?^ Should just be able to do that.
10:29EvanR-workright, but i tracked down a performance problem to this
10:29EvanR-workim doing 5 levels of splitting on not that much, to get a [[[[[string]]]]], it takes too long
10:31mdrogalisEvanR-work: Maybe pull out partition-by since Strings are colls?
10:32EvanR-work:Doc partition-by
10:33EvanR-workworth a shot
11:33justin_smithcoll opps are going to be slower than string ops, for almost anything
11:34vanilahi
11:34gfredericks~coll opps |are going to be| slower than string ops, for almost anything
11:34clojurebotAck. Ack.
11:43arrdemdoes the clojurescript compiler expose anything like ns-publics on the JVM side?
11:45Bronsaarrdem: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L1675
11:48arrdemBronsa: thanks
12:59djamesI'm using gen-class with a JavaFX class. It appears a static initializer is being run by `lein compile`. I don't see why this is necessary for compilation.
12:59djames^ to extend a JavaFX class
13:00djamesI noticed CLJ-1315 addressed the issue of static initializers for import statements. I wonder if the same should apply to gen-class.
13:00djameshttp://dev.clojure.org/jira/browse/CLJ-1315
13:11akkaddjames did you use to live in Austin?
13:13djamesakkad: yes. do we know each other?
13:38AWizzArdWhat is the max number of elements in a PersistentVector? 2^32 ?
13:39stuartsierraI expect it's much higher than that.
13:40stuartsierraI think Java arrays have a limit of 2^31
13:40[blake|2^33 at least...
13:40stuartsierraI think you'll run out of memory before you hit any hard limit in PersistentVector.
13:44[blake|Well...if PersistentList uses an int for its count, it would have to be limited to 2^31-1, as the Java int, no?
13:46stuartsierraoh yeah, looks like it does use an `int` https://github.com/clojure/clojure/blob/05af4b52a474bc60d2eb931e388b302c14edc884/src/jvm/clojure/lang/PersistentVector.java#L40
13:51gfredericks~2^31-1 |ought to be| enough for anyone
13:51clojurebotAck. Ack.
13:54andyf2^31 ought not to be enough for everyone. No way. Rage against the limitation created when memory was more expensive.
13:55AWizzArdVectors use this bit mechanism under the hood, and it is set to 32.
13:56AWizzArdSo I thought in the highest level there are just 2 bits.
13:56AWizzArdNext level contains 4 arrays of size 32.
13:57AWizzArdNext 32x more, next 32 more, and so on, until in level 7 there would be 2^32 arrays, each pointing on an object stored in the Vector.
13:59AWizzArdOn a 64 bit machine the arrays of 5 cells on the lowest level alone would already consume 32 GB of RAM, the references to the objects (which themselves would eat much more than this).
14:00AWizzArdSomeone here who has access to a machine with 300 GB of RAM? :-)
14:01akkadyeah I build a big swapfile to my 1TB SSD
14:02AWizzArdI might test out of curiosity how much time it takes to actually insert 4 billion objects on an EC2 instance. Amazon gives us in its r3.8xlarge instance 244 GB RAM for 41 cents per hour.
14:02AWizzArdThey talk about 63000 MB/s memory bandwidth. Nice.
14:15justin_smithAWizzArd: next question of course is how quickly you could generate enough objects to take up that much space
14:15justin_smithI guess you could just have a big vector where every element is nil for starters though
14:19AWizzArdYes, nil or possibly a fixed object, say, a String. And all point to the same.
14:26weiwhy does “lein javac” also try to compile my clojure sources?
14:26weiam i doing it wrong
14:30justin_smithLike the compile and deps tasks, this should be invoked automatically when needed and shouldn't ever need to be run by hand.
14:30justin_smith(quoting "lein help javac")
14:31weiso my problem is when running my app with “lein run”, I get a ClassNotFoundException on one of my java sources
14:33weiI specified the java sources with :java-source-paths ["src/java"]
14:51djameswei: actually, I'm having the same problem perhaps
14:51djamesI would expect `lein javac` would compile the classes before the clojure compilation needs them
14:55djameswei: are you using dev/user.clj? I'm reading this https://github.com/technomancy/leiningen/issues/1477 -- it may be the cause of my problem.
15:05djameswei: removing a :dev profile that pointed to dev/user.clj addressed my problem. I also started a thread on the mailing list: https://groups.google.com/forum/#!topic/clojure/4ytDn6OHabI
15:09stuartsierradjames: Simple workaround: don't use dev/user.clj. Call it something else like "dev.clj" and load it when you start your REPL.
15:11djamesstuartsierra: thanks. is there something magic about "dev/user.clj" in particular? profiles?
15:11stuartsierradjames: user.clj is magic to *Clojure* — it's always loaded on startup.
15:12djamesstuartsierra: much appreciated. there are, I think, 3 leiningen tickets about this :)
15:13stuartsierraSince it's in Clojure, it's not something that Leiningen can fix. The solution is just not to put compilation-sensitive code in user.clj
15:15djamesstuartsierra: right, I linked 4 of the leiningen tickets together with a comment.
15:15stuartsierradjames: thanks
15:16craigglennieWhy doesn’t this work? Shouldn’t it destructure the key and value from each hash-map in the list? (map (fn [[x y]] {y x}) [{:a :b} {:c :d}])
15:17justin_smithcraigglennie: that's not how hash-maps destructure
15:17justin_smith,(map (fn [[[x y]]] {y x}) [{:a :b} {:c :d}])
15:18clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap>
15:18justin_smitherm...
15:18justin_smithI guess you can't destructure the entries on a hash-map
15:19justin_smithcraigglennie: anyway, your issue there is this: ##(seq {:a :b})
15:19lazybot⇒ ([:a :b])
15:19justin_smithnote that each k/v pair becomes a vector
15:19justin_smith&(seq {:a :b :c :d})
15:19lazybot⇒ ([:c :d] [:a :b])
15:21craigglenniejustin_smith: Where does seq come into it? Is it called as part of destructuring?
15:21djamescraigglennie: I've got a pretty exhaustive list of destructuring examples here: https://github.com/xpe/clj-destruct/blob/master/src/destruct/core.clj
15:22justin_smithcraigglennie: unless you know the key you are destructuring for a map, your ownly destructuring option is to destructure a sequence
15:22justin_smith*only
15:23craigglenniejustin_smith: Okay… so it is a bit confusing that this works: (map (fn [[x y]] {y x}) {:a :b})
15:23craigglennieAnd the other way doesn't
15:23justin_smithcraigglennie: map calls seq on its arg
15:24craigglennieOh, okay
15:24craigglennieI think I get it
15:24justin_smithso you are destructuring not the map, but the individual entry (a key and a value as a vector)
15:25justin_smith&
15:25lazybotjava.lang.RuntimeException: EOF while reading
15:25craigglennieThat makes sense… (seq {:a :b}) returns [:a :b] which can be destructured, but (seq [{:a :b]) returns [{:a :b}] and the inner value is still a hash-map, which can’t be destructured
15:25justin_smith&
15:25lazybotjava.lang.RuntimeException: EOF while reading
15:25justin_smithno, (seq {:a :b}) does not return [:a :b] it returns [[:a :b]]
15:26justin_smith&(vector? (first {:a :b}))
15:26lazybot⇒ true
15:26craigglennieoh, yes
15:27AWizzArdamalloy: do you happen to know what the max number of elements in a PersistentVector is?
15:27amalloy&(Integer/MAX_VALUE)
15:27lazybot⇒ 2147483647
15:27amalloyprobably
15:28AWizzArdI “calculated” 2^32
15:28jackjackHi, i have a Lucene frontend that uses clojure expressions while scoring, and for that i am compiling the query expressions once and caching them (just using Map<Object,IFn> for every (IFn) clojure.lang.Compiler.load(new StringReader(raw))
15:28amalloynah, should be 2^31-1
15:28jackjacki was wandering if this is the proper way to do that, or should i do clojure.eval from java?
15:28amalloycount will rollover to be negative, and then lots of bad stuff will happen
15:29AWizzArdpossible, possible
15:29AWizzArdI remember there are 7 layers. And vectors use 5 bits as bitmask.
15:30AWizzArd6*5 bits => 30. So the highest level could have 2 more bits, and that’s 32.
15:32amalloyeven if that's "possible" in terms of bit arithmetic, there's a lot of code in the implementation that depends on count that will break if it's negative
15:32amalloyeg, seq checks whether count is positive and returns null otherwise
15:32AWizzArdYes.
15:33AWizzArdBesides that, for practical reasons this is an unlikely scenario anyway.
15:33AWizzArdJust out of curiosity I’m interested :-)
15:34amalloyyes, i thought of making a vector of 2^31 elements to see how it behaves, but with the boxing overhead i probably don't have enough memory, and i'd get bored waiting for it too
15:34AWizzArdEven with the 2^31 variant the lowest nodes would consume 16 GB of RAM for the references to the objects alone.
15:40gfredericks,(.nextProbablePrime (biginteger (rand-int Integer/MAX_VALUE)))
15:40clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
15:40gfredericks&(.nextProbablePrime (biginteger (rand-int Integer/MAX_VALUE)))
15:40lazybot⇒ 557350501
15:40gfredericks(inc 557350501) ;; I like primes
15:40lazybot⇒ 1
15:40Kristienthat's a weird incrementing
15:41gfredericksclojure has this weird feature where if you increment a prime you always get 1
15:41Kristien(inc 2)
15:41lazybot⇒ 1
15:41Kristien(source inc)
15:41Kristienlazybot stop being lazy
15:42justin_smithKristien: lazybot 's inc command is not clojure's inc
15:42KristienRight. :P
15:42Kristien(inc 2)
15:42lazybot⇒ 2
15:42KristienIt increments a global map value.
15:43justin_smithit increments a number stored in mongodb, or creates one if it was not there before
15:43Kristiensounds overkill
15:43justin_smithoh?
15:44Kristiento use mongodb for it
15:44Kristienor is mongodb also used for other things?
15:44justin_smithit needs some sort of persistent storage, or else how would amalloy get over 200 karma?
15:44justin_smith(identity amalloy)
15:44lazybotamalloy has karma 210.
15:44KristienCould just read/write a map from/to disk with edn.
15:45justin_smithKristien: that isn't thread safe
15:45KristienIt is if you synchronise it.
15:45justin_smithand would require rewriting an entire file to change a single value
15:45justin_smithdatabases have already solved these issues
15:46KristienI have once made a similar application it was pretty fun.
15:47KristienBut it stored fails or wins instead of integers. :P
15:47Kristiens/or/and/
15:47jackjackdo you know if clojure.lang.Compiler.load(string) is thread safe?
15:48justin_smithjackjack: not as far as I know, no
15:48EvanR-workwhat does it mean for a function to not be thread safe in this case?
15:48jackjackthanks!
15:49jackjackjustin_smith: how about the IFns returned from it?
15:49justin_smithEvanR-work: if two threads load files that define the same vars, it's a race condition
15:50jackjackEvanR-work: i meant can i invoke that from multiple threads, with different strings, and use the results in multiple threads as well
15:50justin_smithjackjack: functions are immutable, the vars are mutable though and can get into an inconsistent state
15:50EvanR-workok, theres global bindings
15:50jackjacksorry my web irc client is acting weird
15:51jackjackjustin_smith: my argument is just string that is a (fn [])
15:51justin_smithOK, if you don't mutate any vars, then it should be fine, since functions are immutable
15:52jackjackmy question was more about if Compiler.load itself has somekind of state that i have to protect
15:52jackjackbut if not, it should be ok
15:52jackjackthanks
15:53justin_smithI would be very surprised if Compiler.load itself was not thread safe.
15:55EvanR-workare facts such as these documented in some standard place
15:55EvanR-workif standard function x is or is not thread safe
16:01stuartsierraIn Clojure generally you can assume everything is thread safe unless documented otherwise. In Java, the opposite.
16:01stuartsierra"thread safe" is kind of vague anyway
16:02stuartsierraA more useful question is, "Is this object safe to use simultaneously from multiple threads?"
16:02jackjack\o/ glad i picked clojure :)
16:03stuartsierraMost stuff in the Clojure runtime (namespaces, vars) uses AtomicReference or ConcurrentHashMap under the hood, so the answer is usually yes.
16:04jackjackstuartsierra: i was just playing around, when i noticed that .invoke() on clj IFn invoked 5 million times adds surprisingly small overhead on my scoring (it was 140ms without it and 220 with it), this includes doing some local bindings and some bit processing
16:04jackjackin the end i was very happy, but just wasnt sure i was compiling the expression the correct way
16:04jackjackthanks for the info
16:05chouserdoc proxy-super
16:05chouserI forget how to use the bots
16:06nuwanda_,(doc proxy-super)
16:06clojurebot"([meth & args]); Use to call a superclass method in the body of a proxy method. Note, expansion captures 'this"
16:08chouserHm, I thought the docstring there made it clear how thread-unsafe it is.
16:09chouserAnyway, it's not thread safe.
16:10jackjackchouser: what is not thread safe?
16:11jackjackproxy-super?
16:11chouserright
17:08warzhi all. im setting on Cursive, on IntelliJ. i've imported my lein project, and it's asking for an SDK. is this the JDK?
17:12AWizzArdwarz: yes
17:13AWizzArdtbaldridge: ping
17:51FrozenlockAnyone knows how to wrap-params with bidi?
17:51Frozenlock*use
17:53EvanR-workis there a way to determine which import a particular class in my code is coming from
17:53EvanR-work(fireplace)
17:54justin_smiththe printed form of the class should include the full package name
17:55EvanR-workok i see it in the import list
18:21dnolen_Just shipped ClojureScript 0.0-2644 https://groups.google.com/forum/#!topic/clojure/mRAED4TFlCM
18:21dnolen_greatly enhanced REPLs across the board
18:23EvanR-workhow to convert a string into a byte array?
18:23justin_smith.getBytes
18:23justin_smith,(into [] (.getBytes "hello"))
18:23clojurebot[104 101 108 108 111]
18:24EvanR-work,(into [] (.getBytes "日本語"))
18:24clojurebot[-26 -105 -91 -26 -100 ...]
18:24EvanR-workseems legit
18:24justin_smiththe into [] is just so it prints readably for demo purposes of course
18:25justin_smith.getBytes returns a byte-array
18:25EvanR-workyeah i guess i was counting on positive numbers to check the encoding
18:25EvanR-workbut i recall java byte type is signed
18:25justin_smithyeah, the jvm doesn't have any unsigned anything
18:26EvanR-workso what encoding does it use?
18:26justin_smithit's almost utf-16 - but getBytes takes an encoding argument
18:26justin_smithI'd ask it for utf8
18:26EvanR-workthank god
18:26justin_smith,(.getBytes "hello" "UTF-8")
18:26EvanR-work(encoding argument)
18:26clojurebot#<byte[] [B@45207ff0>
18:28gfredericks,(count (.getBytes "hello"))
18:28clojurebot5
18:28gfredericks,(count (.getBytes "hello♥"))
18:28clojurebot8
18:29EvanR-worksane default
18:29gfredericks,(count "hello♥")
18:29clojurebot6
18:29gfredericks,(count (.getBytes "hello♥" "UTF-8"))
18:29clojurebot8
18:29gfredericks,(seq (.getBytes "♥"))
18:29clojurebot(-30 -103 -91)
18:30gfredericksman I dunno nuthin bout unicode
18:30EvanR-workshowing the utf8 bytes as negative does not help understanding
18:30crack_userhello
18:31crack_userfast question, someone knows how can I install a package in clojure to play in repl?
18:31justin_smithcrack_user: lein try
18:31crack_userthe package in question is core.async
18:31gfredericksclojurebot: the package in question is core.async
18:31clojurebotIn Ordnung
18:31justin_smithor you can use pallet/alembic to load just about any dep at runtime
18:32justin_smithbut lein try is easy enough
18:32crack_user$lein try
18:32crack_user'try' is not a task. See 'lein help'.
18:32EvanR-workwhat does "almost utf16" mean?
18:32gfrederickscombined with lein-shorthand all I have to do is (./add-dep [some/thing "0.0.0"])
18:33justin_smithcrack_user:
18:33crack_userI think I am lost the point here
18:33amalloyi just saw (defmacro foo [x y] `(get ~x ~y)), and it made me think of a silly simple puzzle. obviously in this case, foo could just be a function: (defn foo [x y] (get x y)), but can you think of some f such that (defmacro foo [x y] `(f ~x ~y)) would work and (defn foo [x y] (f x y)) wouldn't?
18:34justin_smithsorry, tried to paste something, weird client setup issues - lein try is a lein plugin you can find on github
18:34justin_smith$google lein try
18:34lazybot[rkneufeld/lein-try · GitHub] https://github.com/rkneufeld/lein-try
18:35crack_userjustin_smith: ok I will check that
18:36andyfEvanR-work: You can make a simple function to show bytes as unsigned if it makes them easier for you to read, e.g. (defn unsigned-byte-val [x] (if (< x 0) (+ x 256) x))
18:37EvanR-workthey would be easier to read as hex
18:37EvanR-workeven mod 256 shouldnt require me to type that much
18:37andyfSo (format "%02x" ...) them if you like
18:37EvanR-workgood to know
18:38EvanR-work[0x1f 0x1f]
18:38EvanR-work,[0x1f 0x1f]
18:38clojurebot[31 31]
18:38crack_userjustin_smith: it works, but I guess I am cheating the process here
18:38justin_smithcrack_user: cheating? I don't know about that. Of course you should eventually make a proper project, but there is not harm in one off repls to try things.
18:38[blake|What about Clojure makes it unsuitable for Android where Java is just fine? Is it loading the compiler/etc?
18:39akkad xb
18:39andyfEvanR-work: I do not know why justin_smith said "almost UTF-16". getBytes should return a sequence of bytes that is encoded in UTF-8, UTF-16, etc. exactly, not almost. Unless it has bugs.
18:39EvanR-workyeah the bugs part is what i was wondering about
18:39justin_smith[blake|: it really depends on the device, clojure uses more resources (and is very liberal with its RAM usage)
18:39amalloyandyf, EvanR-work: ##(format "%x" (byte -110))
18:39lazybot⇒ "92"
18:39amalloyoh, i see you already said that while i was testing that it works
18:39[blake|justin_smith: Gotcha.
18:40justin_smithandyf: I meant as in the internal representation used by the vm
18:40justin_smithandyf: then it became clear he wanted to know what format he could get from it of course
18:40andyfjustin_smith: Why do you qualify with "almost"?
18:40crack_userjustin_smith: this is because I can not properly require a package in the repl?
18:40justin_smithandyf: what the jvm uses isn't quite utf-16 - one moment, let me get my cite
18:41EvanR-workyes that part is much less interesting (unless of course its buggy)
18:41amalloyhey neat: ##(format "%#02x" (byte 10))
18:41lazybot⇒ "0xa"
18:41andyfEvanR-work: I am not aware of any bugs with getBytes, but I haven't looked hard, either.
18:41amalloy&(format "%#02X" (byte 10))
18:41lazybot⇒ "0XA"
18:41amalloyhah, it upcases the X too. that's kinda annoying
18:42justin_smithandyf: my bad, it is utf-16 internally, but a "modified utf8" in some other contexts.
18:43andyfjustin_smith: Thanks for checking. I was pretty sure it was utf-16 internally always.
18:45justin_smithandyf: java switched from UCS-2 to UTF-16 with J2SE 5.0
18:47andyfmakes sense. UTF-16 had no reason to be created yet when Java began.
18:48justin_smithand I also just learned that "modified utf8" has a specific definition, relating to BOM handling
18:48justin_smithweird
18:51amalloyman, i learned it back when it was UCS-2, and i just can't erase that factoid even though it is obviously impossible
18:51[blake|I'm trying to save a field as a blob in Monger and not having any luck. It doesn't help that all the GitHUb URLs contain "blob", though.
18:52andyfClojurebot: brainwash amalloy to the ways of UTF-16 by spamming him every 24 hours
18:52[blake|It's not great that "Monsters vs Aliens" has a General Monger and Bob the Blob, either. >:-{
18:53justin_smithhaha
18:53amalloyamalloy: java |uses| UTF-16
18:53amalloyYou don't have to tell me twice.
18:53andyflol
18:53gfredericksclojurebot: scala |uses| UTF-17
18:53clojurebot'Sea, mhuise.
18:54justin_smithlol
18:54andyfand UTF-17 has mutable and immutable interfaces
18:54EvanR-workUTF-16++
18:54gfredericks(inc andyf)
18:54lazybot⇒ 21
18:54amalloyi wanted to say "Ik berjikp" but i couldn't remember how clojurebot spells that
18:55gfredericksandyf: I've always like the idea of numbers being mutable
18:55amalloy"Ik begrijp", apparently
18:55gfredericksamalloy: functionally identical
18:55andyfgfredericks: Because you like to make Plato spin in his grave?
18:56amalloyclojurebot: Ik begrijp is not easy to spell
18:56clojurebotAlles klar
18:56justin_smithgfredericks: I had to google and double check, but I am really glad scala falls short of that measure of insanity
18:56gfredericksMutable Platonic Forms
18:56andyfgfredericks: It will be a little while yet, but I'm finally on the way to implementing specially-formatted comments in Eastwood that disable specific warnings.
18:56justin_smithgfredericks: play-doh-nic forms?
18:57gfredericksandyf: justin_smith: https://github.com/gfredericks/flexnum
18:57gfredericksandyf: w00t w00t
18:57andyfI went with the specially formatted comments, because I can sleep at night knowing they will never affect generated code.
18:57andyfuntil some other tool starts using comments for code generation
18:58EvanR-workgfredericks: im now having ruby flashbacks
18:58amalloyandyf: what's wrong with the obvious approach of like (defmacro eastwood-annotation [annotation form] form)?
18:58gfredericksEvanR-work: should I put a trigger warning in the README?
18:59gfredericksandyf: ultimately anything can affect anything; you can't get away from it
18:59andyfamalloy: Probably nothing, except the need to define that macro wherever you need it, or require/use a lib
18:59gfredericksamalloy: I had always thought metadata was the obvious not-yet-thought-out solution
19:00gfrederickspre-hammock
19:00amalloyman, maybe it is. i just don't really reach for metadata often (ever)
19:00andyfI don't claim my hammock has the same qualities as Messr Hickey's, but once I figured out how to modify tools.reader to remember the contents of comments and every other form, with source code locations, I was happy.
19:01gfredericksamalloy: definitely doesn't have the import drawbacks andyf just mentioned
19:02weidjames: your solution re: compiling java sources works for me, thanks!!!
19:02weisorry for the late response. I stepped out for a bit
19:02gfredericksamalloy: feels like metadata is great for not having to use magic-comments in particular
19:02gfrederickslike, in lots of scenarios, not just eastwood
19:02djameswei: did you see the suggestions from Stuart Sierra and the mailing list post?
19:03amalloygfredericks: i have a vague worry about macros that inspect metadata and blow up when there's something there they don't like
19:03andyfgfredericks: magic-comments have the potential benefit over metadata of annotating things that can't have metadta
19:03amalloyand also that
19:03andyfNot sure if I'll ever use that, though.
19:03djamesin short, it is still possible to use dev/user.clj if you are careful about what it requires
19:03djameswei: ^
19:04gfredericksandyf: magic comments via ;; don't obviously annotate anything in particular though
19:04andyfI just need to qualify magic-comments for Eastwood with a prefix like "This-comment-is-special-to-Eastwood-so-keep-your-hands-off-if-you-aren't-Eastwood: "
19:04gfredericksI don't want to put a keyword on its own line just so I can put a ;; on the previous line
19:05gfredericksandyf: that sounds like exactly why metadata can have namespaced keywords :P
19:05amalloygfredericks: you can't annotate keywords with metadata anyway
19:05justin_smithgfredericks: clearly the solution is a magic comment written in a morse code realized using zero width whitespace and BOM
19:05gfredericksamalloy: yeah that's why I used that
19:06andyfMy current implementation is "a magic comment always annotates the next expression in the source code"
19:06gfredericksamalloy: keywords are the only thing that can't take meta that I can imagine worth linting
19:06andyfwhether that next expression is a keyword, number, parenthesized expression, etc.
19:06gfredericksand probably only the "this keyword looks like a typo" linter
19:07amalloygfredericks: (+ 1 ^:eastwood/should-be-zero 0)
19:07amalloythen the linter can let you know if you accidentally put in a non-zero number
19:07gfredericksamalloy: oh yeah well that's a good example actually
19:07gfredericksamalloy: no wait
19:07gfredericksisn't the linter really applying to the whole (+ ) expr?
19:07gfredericksa 0 by itself is not suspicious
19:08amalloygfredericks: it's a totally nonsense linter anyway
19:08weidjames: not clear on what user.clj is for anyways. i just added a support namespace that basically does the same thing
19:08andyfI'm not sure the ability to annotate individual keywords, numbers, etc. is something that Eastwood will actually take advantage of, but we'll see.
19:08gfredericksamalloy: dunno adding zero seems worth linting, aside from infrequency concerns
19:08amalloyi was suggesting a new linter for checking that the only thing you annotate with :eastwood/should-be-zero is 0, not that all 0s are annotated
19:09djameswei: it is just a convenient way to have functions available in the user namespace (that's how I see it). why it loads first is unclear to me, as a design decision.
19:09gfredericksuser.clj is usefully for haxing in specific situations
19:11andyfIs anyone aware of any Clojure-verse tools that use magic comments yet?
19:11gfredericksmy new project called eastwood-the-linting-tool-that-andy-fingerhut-made-not-garys-thing does
19:13andyfwe should probably coordinate on magic comment syntax, then :)
19:14andyfWe can divide it in half. You take all of them whose UTF-16 encoding starts with a bit of 1.
19:14gfredericksI'll take all the comments whose SHA512 hashes start with 1
19:14andyfmuch better
19:14djamesandyf: I couldn't think of anything, but I started digging re: clojure and magic comments. Found this: http://gorilla-repl.org/start.html
19:14gfredericksin UTF-17
19:15gfredericksdoes lein-oneoff use magic comments?
19:15gfredericksfor dependencies?
19:15gfredericksmaybe it was a #_ comment
19:15andyfdjames: Thanks. I do recall seeing an example save file for a gorilla repl document before, and noticed that, but had forgotten.
19:15weidjames: I need the helper functions in my uberjar, anyways. i don’t think user.clj is included
19:16djameswei: if you are curious about uberjars, dependencies, and profiles, it helps to dig around in the lein source code
19:16djamesI often forget what gets pulled in :)
19:19andyfFuture non-documentation: "In order to prevent accidentally writing a comment that affects Eastwood behavior, all magic comments that Eastwood pays special attention to must be written in the form of Clojure code Quines, containing the string "lint-config", and have a SHA512 equal to 0"
19:19gfredericksthe whole sha?
19:20andyfWell, to keep the probability of accidents low, you know
19:20andyfFor all practical purposes, that feature is already implemented :)
19:21andyfSubmit a bug report for this feature and win the awe and amazement of coders everywhere.
19:24djamesAre there other libraries like this -- perhaps more widely used? https://github.com/konrad-garus/yaclot
19:25djamesI like that the library above uses `convert` in a way roughly similar to `into`.
19:44kenrestivoi'd look in crossclj.info . that's been by far the best resource i've found for evaluating libraries
20:09dnolen_http://swannodette.github.io/2015/01/02/the-essence-of-clojurescript-redux/
21:40djamesIf I was designing a code base with a bunch of vars (from def and defn) and wanted to encourage/allow redefinition of any of them, is it best that I mark them as dynamic?
21:41djamesThis would not be a typical application ... one that encouraged extensibility (like Emacs for example) and trusted users to do whatever.
21:41justin_smithdjames: better to explicitly pass the state rather than redefine top level vars I think
21:42justin_smithwould you want the vars to take on unique per-thread values?
21:42djamesjustin_smith: I figure the end user might want to redefine anything (at their peril of course)
21:42djamesI don't think I care about per-thread bindings
21:43justin_smithwell, don't make it dynamic if you don't care about per-thread bindings
21:44djamesjustin_smith: I get that binding makes a thread-local binding
21:44djameswhat's the mechanism by which redoing a `def` would work?
21:44justin_smithalter-var-root
21:44djamesbecause, if I understand it correctly, all threads will pick up the new value
21:44justin_smithor just calling dif again
21:44justin_smith*def
21:45djamesjustin_smith: right, but under the hood, what guarantees should I expect about threads accessing the root binding?
21:45djamesthe root binding is checked with every access if I remember correctly
21:45djames(with every var access)
21:45justin_smithunless you capture the value (via let or whatever)
21:46djamesso IF (a big IF) I'm worried that different threads might read different versions of the var value (as it is changing), then I might be in trouble?
21:47djamesit that is the case, I should use a "proper" reference type (I'm speaking out loud here)
21:47justin_smithit will be altered atomically, but if you need any sort of consistancy between threads, yeah that's messy
21:47djamesjustin_smith: cool, thanks for discussing. I seem to pick up new and interesting angles on things that I never wondered about before on here
22:29justin_smithlein do clean, check, eastwood, test, run
22:32gfredericks:aliases {"dccetr" ["do" "clean," "check," "eastwood," "test," "run"]}
22:33justin_smiththat's a good idea
22:33gfredericksI like those kinds of aliases they're easy to remember and never collide
22:34justin_smithgfredericks: I could translate it phonetically to "lein decatur"
22:34justin_smithgfredericks: but then someone would need to come up with "lein urbana" and "lein chicago" to top that