#clojure logs

2014-07-22

01:25andyfbbloom: I gave you the wrong impression of my true thoughts on Clojure JIRA tickets earlier today, when you mentioned that there were a dozen you may have filed. Closer would be: You miss 100% of the shots you don't take.
01:36andyf69% of all 1264 tickets for Clojure are closed, either completed (50.4%), declined (14.8%), or as a duplicate of another ticket (3.6%)
01:37andyf(end of public service announcement :-)
01:37SagiCZgood morning
01:43bbloomandyf: it's not about hitting shots, it's about activation energy
01:43bbloomandyf: writing a good ticket takes a non-trivial amount of time and involves reasonable friction
01:45bbloomandyf: just searching to see if i'm creating a duplicate is exceptionally frustraiting
01:45bbloomthe back button doesn't work
01:45bbloomand if jira bombs out on me even once, i just don't feel like dealing with it
01:46bbloomthe entire thing is optimized for batch operations on behalf of maintainers, which is head and shoulders above github, that's for sure, but it just doesn't justify me spending 10s of minutes for something that ought to be 10s of seconds
01:47bbloomespecially when the issues are small and classified as "enhancements"
01:47bbloomwhich are all but entirely ignored
01:47andyfI'm not lying about the 50% closed and completed, although I'll be the first to agree that it is anything but convenient.
01:48bbloomandyf: the thing is that i run in to issues CONSTANTLY
01:48bbloomi splunk around pretty deep in the clojure codebase
01:48bbloommore than half the stuff i find has already been found
01:48bbloomis already reported
01:48bbloomusually i mention it here, and somebody else says "we know"
01:48bbloomand half the time there is an open ticket w/ patch
01:48bbloomif i spent 10s of minutes every time i said "wtf?" i'd never get anything done
01:49andyfdo you add your vote to them? That is dead quick.
01:49bbloomi don't b/c apparently i'm only allowed 5 useful votes or something like that
01:49andyfNo, you can vote as often as you like
01:49bbloomand almost none of them block me
01:49bbloomhttp://jafingerhut.github.io/clj-ticket-status/CLJ-top-tickets-by-weighted-vote.html
01:50bbloomapparently each vote lowers the weight i give to prior votes
01:50bbloomand i have voted on issues that i really would like to see fixed, but havent been
01:50andyfAlex Miller and others also look at unweighted vote counts, too, I've seen him mention.
01:51bbloomok, well i'll vote more in the future then
01:51bbloomthanks
01:51ambrosebsany stats on how effective votes are to getting a ticket closed?
01:51bbloomargh. like now i'm going to see if there's any top issues i'd like to add votes to
01:51bbloomi can't figure out how to do that
01:52andyfno problem. I understand being frustrated with the pace. Just wanted to put some more positive comments in that quite often tickets do get fixed. Sometimes it helps if you only look once per release :)
01:52bbloomi'm not frustrated with the pace really
01:52bbloomi experience PHYSICAL DISCOMFORT when i use JIRA
01:53andyfI've heard similar comments before. I can't recall it ever bothering me all that much, but tastes differ.
01:53bbloomi have like microsoft flashbacks
01:54andyfambrosebs: I've not seen any such stats. I do know Alex Miller looks at the top voted tickets and takes some action to move them along when he can.
01:54bbloomproduct studio *cringe*
01:54ambrosebsandyf: might be a more interesting stat to encourage votes
01:55bbloomhow do i see top voted issues?
01:55andyfThere are links to top voted tickets here with links to JIRA where, if you are logged in (top right link), you can click the 'Vote' link: http://jafingerhut.github.io/clj-ticket-status/CLJ-top-tickets-by-weighted-vote.html
01:55andyfYou can get to that page a couple of clicks away from clojure.org/cheatsheet, strangely enough, since I maintain both.
01:55bbloomjira has like 7395789353 reporting tools, right? why can't i get to that from jira?
01:56bbloomi don't bookmark anything, ever. how do i find this again?
01:56andyfYou can get to top unweighted votes in a JIRA report. It doesn't do weighted vote calculation that I am aware of -- that was custom.
01:56andyfclojure.org/cheatsheet
01:57andyfClick "Download other versions with tooltips". Look down that page for links to reports on JIRA tickets.
01:57bbloomlol, not gonna remember that :-P
01:57andyfGoogle is your bookmark list?
01:57bbloomyup
01:58bbloomi declared bookmark bankruptcy years ago
01:58andyfclojure top voted tickets
01:59bbloomok, thanks
02:00andyfambrosebs: Sorry, just noticing your latest comment -- you mean publishing stats on average time from a ticket reaching X votes until Rich makes a decision whether it moves forward or not?
02:00SagiCZwould you recommend clojure for building automated fund
02:00SagiCZtrading system
02:00SagiCZis it mature enough?
02:00bbloomyes
02:00SagiCZi dont want to run into hidden language issues
02:00SagiCZi mean java has been around many years and i expect it to be quite reliable..
02:01bbloomSagiCZ: clojure is quite reliable. and when it isn't you can use java seamlessly from clojure
02:01ambrosebsandyf: something like that.
02:01SagiCZbbloom: i know.. that sounds good
02:02andyfambrosebs: I'll keep that in mind, for a rainy day of hacking, perhaps. But it doesn't rain very often where I live :)
02:03ambrosebsandyf: :)
02:04andyfambrosebs: Bronsa asked earlier if you knew what arrdem was planning to do with your latest core.typed release. I am curious, too.
02:05ambrosebsandyf: arrdem wanted a quick way to collect all annotations from core.typed
02:05ambrosebsI assume there's going to be some amazing hyperlinked thing in grimoire
02:05andyfambrosebs: For additional documentation of functions, I'd guess. Sounds good.
02:05ambrosebsyes
02:06andyfBronsa: ^^^
02:06bbloomandyf: how big is the impact of having a patch or not?
02:06bbloomandyf: ie are patchless tickets more or less completely invisible?
02:07andyfThe exact criteria isn't revealed to me, but from my observations over time it appears that Rich's Vetted/Declined decision depends more upon the description of the problem, impact, and how the behavior should be changed, than whether there is a patch.
02:08andyfPresence of a patch is obviously critical for getting a patch screened by a screener, and then later approved by Rich, but nothing gets screened unless Rich has Vetted the ticket first (well, almost nothing)
02:09andyfI've seen plenty of patchless tickets be Vetted.
02:10bbloomok
02:10andyfI suppose that can be a good thing to know when creating a ticket, if you are trying to save time.
02:16andyfRock the Clojure vote :)
02:38SagiCZanybody uses Cursive editor for typing Clojure programs?
02:38SagiCZits a plugin for IntelliJ IDEA
02:45ivanSagiCZ: many
04:08tuftSagiCZ: i do
04:17zanesWhen the core.async docs say, “Use transformer instead” what, exactly, are they suggesting? Rolling my own with map or a go loop?
06:28swiHello. If i run lein jar i get jar file, but java -jar on this file gives me Could not find or load main class one.core. With uberjar and lein run all is working. Did i miss some idea ? :)
06:32augustlswi: "lein jar" doesn't bundle dependencies, so it can't find one.core because it's not there :)
06:33swiaugustl: em. one.core is my project file, so it' in jar afaiu. May be it' something with classpath ?
06:34augustlswi: I guess one.core requires stuff that isn't on the classpath
06:34augustl?
06:38swiaugustl: actualy it's file right after lein new app one :) http://paste.debian.net/110950/
06:41augustlswi: never really used "lein jar". Perhaps it can't find clojure itself or something ominous like that
06:41augustlnot sure if lein jar bundles clojure
06:43technomancyyeah augustl is right; you shouldn't expect that to work with java -jar
06:43swiso the 'hello classpath-hell' ? :)
06:43technomancyno
06:43technomancyjust use an uberjar
06:44swiand if i dont want to pack all in one file (i.e. distribute to server side) ?
06:46hyPiRionIsn't that the exact reason why you'd want to pack all in one file? To ensure the servers run same code?
06:47technomancyI guess if you want to make things more complicated, it's still possible to self-inflict classpath hell on yoruself.
06:47swi:)
06:49switechnomancy: remind me my story with 'all-in-one-exe-file written with pygtk :)
06:50augustlswi: you can do that, as long as all the deps are available in the classpath when it is loaded
06:51swiaugustl: i see. i think i'll stick with uber- for now :)
06:51swior even with nrepl actualy
07:14sm0kehello
07:15sm0kehow are you people profiling your code for performance hotspots?
07:16sm0kei have a function call which i want to bring down from 800 microsec to 100 mircosecs. Where do i start?
07:16vijaykiransm0ke: pasting your code - if you don't mind - helps
07:16SagiCZyou could use some hotspot tools
07:16SagiCZjvm console
07:17hyPiRionvijaykiran: I think sm0ke meant how you actually go forward and find the bottlenecks
07:17sm0keyea the function is imaginary here
07:17SagiCZor VisualVM
07:17sm0keSagiCZ: i tried that
07:17sm0kebut nothing was there relevant to my code
07:17SagiCZsm0ke really.. well thats a bummer
07:18sm0keonly clojure .invoke calls iirc
07:18SagiCZisnt there some profiling library for clojure?
07:18hyPiRionSagiCZ: there's criterium, but that's for benchmarking only
07:18vijaykiranthere's criterium or something
07:18hyPiRion... I think
07:18sm0kehyPiRion: I am using it for profiling
07:19sm0kei wont tell you what code in the expression is taking so long
07:19sm0keit*
07:19SagiCZclojure is slow
07:19sm0kejust a fancy timer i would say
07:19sm0keSagiCZ: no it is not
07:20sm0keclojure is fast enough imo
07:20SagiCZsm0ke: i have seen some benchmarks.. slower than java
07:20sm0keyea ok
07:20SagiCZsm0ke: but i am not sure about the methodology of the statistic
07:20sm0kelets talk about my incompetence to write faster code not clojure's
07:20SagiCZyeah sorry
07:21SagiCZso it is not a concrete function you are talking about? you mean profiling in general?
07:21sm0keconsider that clojure is assembly
07:21sm0keyes
07:22SagiCZit sucks it's not possible to use JVM analysis tools, because that would leave you with tons of options
07:22hyPiRionsm0ke: From what I know, people tend to use YourKit, JProfiler, or VisualVM. But I also think it's possible to use Timbre
07:22hyPiRion$google clojure timbre
07:22lazybot[ptaoussanis/timbre · GitHub] https://github.com/ptaoussanis/timbre
07:23engblomIdiomatic Clojure will be slower in many cases than Java. With Java you use global variables inside of the classes to store your data. Using methods not passing this data around will result in faster code, but bigger chance for bugs. Clojure has atoms and refs which could do the same, but then we begin to miss out the real benefit of functional programming
07:23sm0keargh i understand that clojure is slower than java!
07:23sm0kei am talking about which is slowest part of my code among all
07:24sm0kehyPiRion: that would be a hell lot of manual process
07:24sm0keputting profiling code everywhere
07:24sm0keisnt there something like eclipse MAT or whatever its called
07:25sm0keoh MAT is for heap
07:25vijaykiranMAT is for leaks and heap analysis
07:26justin_smithsm0ke: regular java profilers will tell you where hotspots are, you just need to round that up to your user level clojure calls
07:26sm0kejustin_smith: sounds hard
07:26sm0kereally
07:27sm0kehow much can you shave off by avoiding reflection?
07:27justin_smithvisualvm and yourkit were mentioned above. they will give a profile of your code without needing to do manual instrumentation
07:27justin_smithsm0ke: a lot
07:28sm0kehurm
07:28sm0keis yourkit free?
07:28sm0kei see it being publicize a lot
07:29technomancyit's not
07:30sm0kewell
07:30justin_smithit's free as in beer for open source project usage
07:31technomancythey make you publicize it in order to use it, which might explain that
07:31sm0keyep, i see it a lot of github landing pages of repos
07:32SagiCZsorry to jump in but what IDE do you guys use<
07:32SagiCZ?
07:32vijaykiranSagiCZ: Ah, the age-old question - I use Emacs (for clojure), IntelliJ for Java/Scala
07:33sm0kei use vim for both, working with Java feels like walking on a rope blindfolded though
07:33SagiCZvijaykiran: Is there any non-emacs editor that would let me recompile selected functions on the fly? I dig that functionality but I can't survive emacs
07:33sm0kevim, eclipse, nightcode, lighttable..
07:34sm0keidea
07:34SagiCZi use idea (cursive)
07:34sm0keit doesnt allow that?
07:34SagiCZbut don't know how to compile on the fly
07:34SagiCZnot sure..
07:35sm0kesearch for it, its the most basic thing in clojure imo..must be there
07:36SagiCZalright will dig into it
07:36sm0keok i think i would start with refelection then
07:36cflemingSagiCZ: you're trying to re-evaluate a function in the REPL?
07:41SagiCZcfleming: not REPL.. in clojure file
07:42cflemingSagiCZ: right, but you're trying to send a function from the editor to the REPL?
07:42SagiCZcfleming: no
07:42SagiCZinteractive evaluation is only in repl<
07:42SagiCZ?
07:43cflemingYeah, interactive evaluation is always using a REPL.
07:43cflemingThat's true of Emacs et al too
07:43SagiCZooooh.. alright, i think that might work.. i will look into that, thank you
07:43cflemingThe only one that's different is LightTable, and it just hides the REPL really - it's still using one behind the scenes
07:44SagiCZLightTable is IDE?
07:44cflemingYes
07:44SagiCZalright
07:44SagiCZi will try to stick with IntelliJ since I use it for java and all
07:45cflemingSo in Cursive, you'd start a REPL, then you can send forms to it using Tools->Run form before cursor in REPL or Tools->Run top form in REPL
07:45cflemingGood choice :-)
07:45cfleming(I develop Cursive BTW)
07:46SagiCZWow amazing! I used that menu to share namespace and forgot about the other options..
07:47SagiCZbtw if you are a developer i have one question, why is synchronizing by leiningen so slow? and why is the call to (use '(...)) so slow? it takes around 6 seconds on my machine.. it might be clojure problem, not cursive
07:48SagiCZcfleming
07:48cflemingLein sync is often slow the first time, since it downloads all the dependencies you need.
07:48cflemingOnce they're in your Maven cache it should be basically instantaneous.
07:48SagiCZso rebuilding my project on every run while developing is not a good idea right?
07:49SagiCZwell thats what i thought.. in java they download first and then its fast..
07:49cflemingThe (use '(…)) being slow is just Clojure, Cursive doesn't affect that.
07:49SagiCZalright.. i think it was the "use" slowing me and not leiningen
07:49cflemingOne thing to check - do you have Settings->Leiningen->Automatically download sources/javadocs selected?
07:50cflemingThat can make things very very slow - I recommend turning them off.
07:50SagiCZwhat if i like javadocs? :D
07:50cflemingHehe
07:50cflemingThis is tricky with Clojure
07:51sm0keso the warn-on-reflection falg just warns the first time?
07:51cflemingThe problem is that most Clojure libs are distributed as source, so they don't have a source artifact.
07:51cflemingSo every time you sync, Cursive has to go out to see if all your libs have source artifacts, since there's no way to tell if they do or not.
07:52sm0kei mean why doesnt it warn on a function call eveytime? just one the use and require's
07:52SagiCZoh i see
07:52SagiCZso how do we go around that in clojure? ("use" being slow)
07:52cflemingThe problem is that there's no way to know if a library is a Java dependency (where you want them) or a Clojure one (where you don't).
07:52cflemingIf you navigate to a Java class from a library, it'll prompt you to download the sources, and then you'll have sources + javadocs for that library
07:53SagiCZso the comments in clojure functions are not called javadocs? i want those..
07:53cflemingUnfortunately Clojure is just slow loading large namespaces.
07:53SagiCZyeah (use '(incanter core)) takes 6 seconds :(
07:54cflemingNo - you'll get those automatically, since libraries are all distributed as source and Cursive gets the doc from those sources.
07:54SagiCZoh alright.. well i can disable that option then..
07:54sm0kehmm that migh be overkill but useful imo
07:54expezIs there some library that lets you squirrel away the results of calling some functions? I have some services that my app relies on, but I don't want to be calling those services in my tests. So I would like to turn on 'squirrel mode', run my tests, and save the (args, result) pairs for these functions so I can replace them with mock services in my tests. When the services are altered I could just rerun
07:54expezthe tests with 'squirrel mode' to update the dummy data.
07:54cflemingYeah, sadly there's nothing to be done about that. There's a bunch of projects going on right now to make that faster, they might make it into Clojure 1.7
07:55SagiCZcfleming: cool
07:55cflemingSagiCZ: But Clojure startup is very slow right now, which is why it's not great on Android, sadly.
07:56SagiCZcfleming: luckily i dont care about that.. i am actually planning to develop large scale desktop application which will run 24/7 so start time doesnt affect me..
07:56SagiCZit sucks during development, but now i know how to evaluate functions in repl so it should be ok
07:57cflemingGreat. The nice thing about the REPL is that you only wait once when you start the REPL up too, not when you run every test.
07:58SagiCZ2cfleming: yep i like that too.. actually i chose lisp dialect because of the posibility to fix bugs while running.. it could be potentially really expensive to shut down the whole thing down too often
07:59sm0kehow do i put type hint for `f` in this expr ? ## (set *warn-on-reflection* true) (-> ^Integer 1 inc) ;?
07:59lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$set
07:59sm0kehow do i put type hint for `f` in this expr ? ## (set! *warn-on-reflection* true) (-> ^Integer 1 inc) ;?
07:59lazybotjava.lang.SecurityException: You tripped the alarm! set! is bad!
07:59sm0kehow do i put type hint for `f` in this expr ? ## (-> ^Integer 1 inc) ;?
07:59SagiCZset!
07:59sm0keobviously this wont work!
08:00sm0kemacro doesnt recognizes type hints right?
08:00xsynanybody here used neocons?
08:00sm0kehmm oh it does! but still i get warning
08:00xsyncan you define the id of a node with a batch-insert?
08:01xsyncreate-batch even
08:03sm0keok this, (defn foo [s] (-> ^String s .length .longValue))
08:04sm0kehow do i put type hint for Integer?
08:04Bronsasm0ke: ^Integer (do 1)
08:05justin_smithsm0ke: http://clojure.org/java_interop#Java%20Interop-Type%20Hints
08:06justin_smithsm0ke: specifically the definition of hinted
08:06sm0kejustin_smith: sorry i dont understand which part of that is relevant here?
08:06justin_smith(defn hinted (^String []) (^Integer [a]) (^java.util.List [a & args]))
08:06justin_smitheach arg arity is type hinted
08:07sm0kejustin_smith: umm i have already put type hint for first argument
08:07sm0kejustin_smith: just not in the conventional place though
08:07justin_smithsm0ke: that is not hinting args
08:08justin_smiththat is hinting return types
08:08justin_smithsm0ke: also, when we were finding performance issues with an app I worked on, the biggest win was eliminating usage of eval
08:08sm0kejustin_smith: i am asking about the type-hint for Integer coming from .length
08:08Bronsasm0ke: you shouldn't need any hinting there, clojure has local type inference
08:08sm0keBronsa: i warns me
08:08sm0keit*
08:08sm0kei am on 1.4
08:09Bronsasm0ke: .length returns an int not an Integer
08:09sm0keBronsa: ok my mistake but i still get, reference to field longValue can't be resolved.
08:09sm0keoh ok
08:10justin_smiththen you need to hint the thing longValue is called on
08:10sm0kelet me see
08:10Bronsasm0ke: this should be enough (defn foo ^long [s] (-> ^String s .length))
08:10sm0keok just a sec i couldnt make up a sensible example
08:12sm0ke(defn foo [m] (-> m :str .length))
08:12sm0kehow do you handle this without removing the threading macro
08:12sm0ke(-> ^String (:str m) .length) is not allowed either
08:13BronsaI'm actually a bit surprised that clojure doesn't box the int to an Integer there
08:13sm0kemy point being it could be (-> a :b :c :d :e)
08:13Bronsasm0ke: (-> m ^String (:str) .length)
08:14sm0kewhat!!
08:14sm0kehaha
08:14Bronsasm0ke: (-> foo bar) == (-> foo (bar))
08:14sm0keyep
08:15sm0kei was trying (-> m ^String :str .length)
08:15sm0kei am not sure why that isnt valid?
08:15Bronsasm0ke: keywords can't take metadata
08:16swiI just end up reading http://www.braveclojure.com/, was very fun but not everything i understand clear. What nextbook or resource can you recommend to read ?
08:16sm0keok make sense i guess
08:17SagiCZjoy of clojure?
08:17sm0keBronsa: thanks
08:21engblomI found Brave Clojure to be very easy to understand, but then on the other hand I had some Haskell background so functional programming was not completely new for me. I looked at several online Clojure books, and I found Brave Clojure to be the easiest to follow because it was fun at the same time.
08:23swiengblom: same here, but i have a little background in FP (touch a haskell a little with lyhgg), but clojure looks more elegant to me.
08:25tvanhensis there a core function to generate a map (graph) of your namespeaces and their dependencies?
08:26tvanhensI want to make a graph chart of our namespaces and their requires for documentation purposes
08:26xsynthat doesn't sound like something that there would be a core function for
08:27nkozotvanhens, I think there was some project in github for doing that, don't remember it
08:28tvanhensIt doesn't need to be core, I should of said is there a set of core functions I could use or is there a readily available library
08:28tvanhensI've tried noodling around with the ns functions but it was turning into a mess and though that this must have been done before
08:29mpenetyou could try to look how codox does the ns walking part
08:30sm0keok another weird one, (defn foo [s] (.getBytes ^String (cond true s)))
08:31Bronsasm0ke: .. yeah about that
08:31Bronsaturns out macros lose metadata on &form
08:31Bronsaso there's really no good way to type hint those forms
08:31Bronsayou have to wrap it in a do
08:32Bronsa^String (do (cond ..))
08:32sm0kehey but the macro expansion is (if true s nil)
08:32Bronsahttp://dev.clojure.org/jira/browse/CLJ-865
08:32Bronsasm0ke: vote or/and comment in this ticket if you care
08:33Bronsasm0ke: it's macroexpansion that discards meta
08:34sm0kei think i would vote that up
08:34sm0kewill*
08:43ambrosebsBronsa: do you think preserving the metadata is a good idea?
08:45Bronsaambrosebs: yes
08:46ambrosebsBronsa: sounds a bit odd to me.
08:46ambrosebsbut I'm sure I'd get used to it.
08:46ambrosebsI'm eager to see what crazy code it breaks :)
08:49Bronsaambrosebs: well since nobody has come screaming at you for breaking their code yet, I guess it really doesn't break any
08:49Bronsaambrosebs: t.a.j preserves metadata :P
08:49ambrosebsorly
08:49ambrosebswell I'm convinced now then :P
09:08bacon1989so I was wondering, I have a string, that I want to pass to a function as a reader. Is there a way to convert a string to a reader?
09:09BronsaStringReader
09:11bacon1989ah
09:11bacon1989i've tried StringReader, but it's not doing what I suspect
09:12bacon1989i'm trying to get the namespace from my file, along with all of it's dependencies. the file is in the form of a string though
09:12bacon1989so i'm using read-ns-decl from http://clojure.github.io/tools.namespace/
09:12bacon1989it keeps returning nil, even though my string content clearly has a (ns declaration at the top
09:15stuartsierrabacon1989: read-ns-decl returns nil on error, so that may be the reason
09:16stuartsierra(clojure.tools.namespace.parse/read-ns-decl (java.io.PushbackReader. (java.io.StringReader. "(ns foo (:require bar))")))
09:17bacon1989what is the point of the pushback reader?
09:18stuartsierraClojure's `read` requires a PushbackReader, so `read-ns-decl` does too. It's what allows the parser to read one character ahead without consuming it from the stream.
09:19bacon1989ah ok
09:19bacon1989I thought reseting the stringreader would have worked
09:19bacon1989using the pushbackreader seems to have done the trick
09:19bacon1989thank you
09:20xsyn,(keyword 123)
09:20clojurebotnil
09:20xsyn??
09:20lazybotxsyn: Definitely not.
09:20clojurebot? is suddenly
09:21xsynwhy can't I make a number a keyword?
09:22hyPiRionyou can, just do ##(keyword (str 123))
09:22lazybot⇒ :123
09:23xsynyeah, just done that
09:23xsynta
09:29pro_1This channel has many users.
09:29xsyn(statement? (last pro_1))
09:29xsyn=> true
09:30pro_1Programmers moatly?
09:31pro_1Mostly*
09:32pro_1I read somewhere that this channel is a welcoming one.
09:32pro_1Get me beer, guys.
09:37swiCan someone explain me syntax for doseq ? Am i understand right, that if a have a list of promises and whant to print the results i need (doseq [i mylist] (println @i)) ?
09:40ambrosebsswi: that's right
09:45swiambrosebs: and if want pass two seq's ? i.e. [1 2 3] and ("A" "B" "C") ?
09:45raj91i'm looking for a generalization of nth that lets me choose a seq of indices
09:45raj91e.g. (nth* [10 11 12 13 14 15] [1 3]) ; [11 13]
09:46raj91does this exist in core?
09:46opqdonut,(map [10 11 12 13 14 15] [1 3])
09:46clojurebot(11 13)
09:46opqdonut;)
09:46raj91opqdonut: haha, thanks
09:46michaelr525hey
09:47Bronsamapv if you want to get a vector back
09:47raj91opqdonut, Bronsa : yeah, but I suspect neither is meant to be fast like subvec or nth, right?
09:47justin_smithraj91: mind you that will only work with a vector
09:48justin_smithraj91: if the numbers are in some other sequential type, you will need to turn them into a vector first
09:48raj91justin_smith: thanks
09:48justin_smithraj91: nth is slow
09:48justin_smithusing [] as an fn uses get, which is faster
09:48ambrosebsswi: depends what output you want?
09:49justin_smithbut you have to do the work of making the vector first, so really it depends, in the big picture
09:49swiambrosebs: something like parentesis 1 - A, 2 - B etc
09:49Bronsajustin_smith: wut
09:49Bronsajustin_smith: how is nth slow
09:50ambrosebsswi: (doseq [a [1 2 3] b ["a" "b" "c]] (println a b))
09:50vijaykiranswi: liek this ##(doseq [x [1 2 3] y [ "A" "B" "C"] ] (println x y)) ?
09:50lazybot⇒ 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B 3 C nil
09:50justin_smithBronsa: compared to get on a vector
09:50Bronsajustin_smith: get on vectors is implemented in terms of nth
09:50raj91justin_smith: ok, this helped clarify
09:51swiambrosebs: vijaykiran no, like this i get 1abc 2abc etc but i need output only three line - 1a 2b 3c
09:51justin_smithBronsa: OK sorry, I was thinking of the worst case performance of nth (if input was a seq), and for some reason it worked that way with other datatypes
09:51justin_smithBronsa: perhaps I was thinking of "last"
09:51Bronsa,(doseq [x (mapv list [1 2 3] ["a" "b" "c"])] (println x)
09:51Bronsa)
09:51clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:51Bronsa:(
09:51SagiCZwhy does (use 'mynamespace) work fine but (ns thisspace (:require 'mynamespace)) throw noclassfound exception?
09:52Bronsa,(doseq [x (mapv list [1 2 3] ["a" "b" "c"])] (println x))
09:52clojurebot(1 a)\n(2 b)\n(3 c)\n
09:52michaelr525hi
09:52justin_smithSagiCZ: that ' is being read as part of the namespace
09:52Bronsajustin_smith: yeah definitely last
09:52swiBronsa: haha :) seems like i dont' describe clearly
09:53SagiCZ2justin_smith: Thanks, that was it.. :)
09:53michaelr525I need to develop some CRUD administrative interface, thought maybe I could use the oportunity to try Om
09:53michaelr525Has anyone gone that path before?
09:53swii mean i need output like this http://paste.debian.net/110988/ :)
09:54vijaykiran##(doseq [[x y] (zipmap [1 2 3] ["A" "B" "C"])] (println x "-" y))
09:54lazybot⇒ 3 - C 2 - B 1 - A nil
09:54swiAAhh.. zipmap!
09:54Bronsavijaykiran: better to use map list than zipmap
09:55SagiCZ,(println "hello")
09:55clojurebothello\n
09:55Bronsa,(zipmap [1 1 2 3] '[a b c d])
09:55clojurebot{3 d, 2 c, 1 b}
09:55Bronsavijaykiran: using zipmap you're potentially removing some values
09:55SagiCZ,(interpose \, (zipmap [1 1 2 3] '[a b c d]))
09:55clojurebot([3 d] \, [2 c] \, [1 b])
09:56vijaykiranBronsa: yup - but in my defense - it satisfies the pasted result :)
09:56vijaykiranswi: ^ so - make sure you use map list than zipmap as Bronsa says
09:57swiwill try
09:57vijaykiranmichaelr525: yeah - I'm on a similar path using Om for a Crud App
09:57michaelr525vijaykiran: wooohoo !! :)
09:58michaelr525vijaykiran: how is it there?
09:58vijaykiranmichaelr525: not too bad - still using 'callback' communication between the components not core.async
09:59vijaykiranmichaelr525: also, no backend ... yet.
09:59swiBronsa: vijaykiran YES! (doseq [[x y] (map list A B)] (println ...)) do right what i need! Thanks a lot, i'm a little confused with all these 'similar' do-something functions :)
09:59michaelr525vijaykiran: hum hum.. I have fears of "developing generic ui components" here, instead of stitching the damn admin interface, if you know what I mean..
10:00yunfanmichaelr525: what do you meant by `generic ui components` ?
10:00vijaykiranmichaelr525: yeah -- there have been moments of .. wait I should make this "re-usable"
10:00Glenjaminthere's react-bootstrap, which you should be able to use from om
10:01michaelr525yunfan: what vijaykiran said, i meant reusable components
10:02yunfanmichaelr525: but arent you talking about clojure? or you're actually talk about clojurescript?
10:02michaelr525vijaykiran: clojurescript + om
10:02yunfani think ui isnt the server side stuff
10:02michaelr525yunfan: ^^
10:02michaelr525heh
10:02yunfanunless you dont like data backend the concept
10:03michaelr525vijaykiran: do you get up to speed after the initial learning curve?
10:04vijaykiranmichaelr525: yeah - e.g. I think after 2 days of why the hell "delete" isn't working on table row, suddenly things are clearer again
10:04michaelr525yunfan: hmm, not sure what you mean. I have to write a web application to edit some values in a database..
10:04vijaykiranmichaelr525: but I'm keeping an eye on reagent too
10:05yunfanmichaelr525: i meant you dont need worry about ui stuff, since there're so many generic ui components, just pick anyone
10:06yunfanfocus on the data backend, make your backend api security and fast, also restful
10:06michaelr525vijaykiran: so why delete isn't working on table row? ;)
10:07silasdavishow can I set the print-length and print-level for lein test
10:08michaelr525yunfan: oh, well the abundance of UI components is part of the problem here.. I thought to use Om this time for the UI and I haven't seen many Om components out there
10:08vijaykiranmichaelr525: :) not realizing that each component gets cursor instead of the data directly
10:09silasdavisalso how do you go about debugging clojure.test tests
10:09vijaykiranmichaelr525: I'm not using bootstrap-components - but http://www.getuikit.com
10:09michaelr525vijaykiran: oh, so how had you solved it?
10:09silasdavisthey don't return values, and print statements aren't echoed as far as I can see
10:10michaelr525vijaykiran: ohh nice
10:10yunfanmichaelr525: i understand your problem now, you might like those tranditional tech , which would even generate the FORM ui in your backend code, like xajax to php
10:10vijaykiranmichaelr525: BTW, gettin more familiar with React.js
10:10yunfani dont like this style, but its your project. :]
10:17sm0kewhats the type hint for array types?
10:17sm0kee.g. a bytes array?
10:17justin_smithsm0ke: bytes
10:18justin_smithor doubles, ints, shorts, longs, etc.
10:19sm0kejustin_smith: got it thanks
10:19Bronsabeware that
10:19Bronsa,(defn ^bytes x [])
10:19clojurebot#'sandbox/x
10:20justin_smithhttp://stackoverflow.com/questions/3720196/how-can-i-type-hint-an-array
10:20Bronsa,(-> #'x meta :tag)
10:20clojurebot#<core$bytes clojure.core$bytes@1432e1a>
10:20Bronsayou want to put the bytes tag on the argvector not on the def sym or it will resolve to the `bytes` function and be ignored
10:20swibtw, what is prefered way to play with Datetimes in clojure ?
10:20vijaykiranswi: clj-time
10:21vijaykiranswi: which is wrapper for joda-time
10:21sm0keoh ok
10:21sm0kethats again a bug?
10:21swivijaykiran: aha... seems like a perfect to me :)
10:21sm0keand whats up with #^bytes vs ^bytes?
10:21Bronsasm0ke: #^ is old syntax for ^
10:22Bronsasm0ke: not a bug, def evaluates its metadata, it's documented
10:22Bronsasm0ke: the bug there is probably that clojure silently ignores wrong tag metadata rather than throwing an error
10:23sm0keumm does that means every type hint on def symbols is ignored?
10:23sm0kenot just bytes?
10:23sm0kei mean most of them are functions right?
10:23sm0keint float double etc..
10:24sm0keof course custom classes are fine
10:24Bronsasm0ke: right
10:25Bronsasm0ke: (defn ^'bytes x []) works though
10:25Bronsamanually quoting the tag, I mean
10:25sm0keok, wow seems like you know type hinting to the every last detail
10:26sm0ketype hint much? :D
10:26Bronsawell I wrote a clojure compiler so.. :)
10:27sm0keoh cinc
10:27bbloom(inc Bronsa)
10:27lazybot⇒ 32
10:27clojurebotGabh mo leithscéal?
10:28sm0ke(inc Bronsa)
10:28lazybot⇒ 33
10:28sm0kewhats the rationale behind writing a clojure compiler in clojure?
10:28sm0kehow does it helps?
10:29Bronsasm0ke: in the short-term the most important thing has been the analyzer, it's being used by a number of big libraries like core.typed and core.async
10:30mikerodtools.analyzer++
10:31Bronsasm0ke: in the long-term, maybe one day we could get clojure to be self-hosting, having the compiler&analyzer written in clojure is a big win for extensibility, fast prototyping etc
10:31BronsaIMHO at least
10:31swivijaykiran: is there way to specify what tz i want to use by default in clj-time ?
10:31Bronsaalso it's fun.
10:33mikerodBronsa: I like the idea of that. Having the AST-as-data can be a very useful thing.
10:33mikerodIt really opens the door for some better analysis tools I'd imagine.
10:33tbaldridgeat some point I want to extend tools.analyzer to provide something like macros 2.0. Macros, but you get access to the AST of the form (or program?).
10:33mikerodI thought I heard a talk mention that the emitter is not intended to replace the real clj bytecode emitter though?
10:33sm0kehmm sounds nice, i am still too thick too see where and how it is used though
10:34tbaldridgewould be useful for non-trivial macros.
10:34vijaykiranswi: not sure which func in clj-time - but joda has setDefaultTimeZone
10:34mikerodtbaldridge: Yes, I think it has a lot of benefits in that area.
10:34boxedtbaldridge: looked into seqex.syntax?
10:34vijaykiranswi: http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTimeZone.html#setDefault(org.joda.time.DateTimeZone)
10:35Bronsatbaldridge: might be tricky, at macroexpansion time there's not yet a complete AST
10:35arrdemtbaldridge: yeah I'm not sure that's meaningful generally.
10:35Bronsatbaldridge: what cljs does is a good compromise & can already be done -- manually using the analyzer on macro args
10:36swivijaykiran: aha, thanks a lot :)
10:36sm0kebtw, wrapping this in (do..) didnt help either..(defn foo [s] (.getBytes ^String (do (cond true s))))
10:37mikerodTo move the the clj analyzer over the current clj compiler, I'd imagine you'd have to out-perform or be relatively similar to have a shot.
10:37Bronsasm0ke: blah, use identity rather then do then
10:37tbaldridgemikerod: or provide better features
10:38tbaldridgeCLJ 1.7 is getting compiler switches, add a few more of those in (for invokedynamic, etc. ) and you're going to start getting a nice hairy mess in the current compiler.
10:38bbloomBronsa: where are you at on perf?
10:38mdrogalisIs anyone at LambdaJam now?
10:38Bronsabbloom: still too slow unfortunately, 10/15x
10:38tbaldridgethat's where tools.analyzer is better in my mind, I can add layers without intertwining them with existing layers.
10:38mikerodtbaldridge: true. I'd still imagine that perf has to be a goal at some point. clj is often compiled on the fly. I don't think a significant slow down there would be a very welcome thing.
10:39bbloomBronsa: have you profiled it? what's the low hanging fruit? / what is gonna be hard to fix?
10:39sm0keBronsa: Thanks :)
10:41Glenjamini think self-hosting is more compelling on the cljs side, generally
10:41Glenjaminbut probably further away?
10:41arrdemGlenjamin: several steps away.
10:41Glenjaminanything i can chip in on?
10:42arrdemand probably not a goal... google closure does stuff that tools.emitter.* probably never will.
10:42Glenjaminoh right, forgot about that bit
10:42arrdemI mean not that I don't want to see optimizing compilers for clojure in clojure..
10:42boxedAutomatically run the code in your README.md: https://github.com/boxed/midje-readme
10:42Bronsabbloom: haven't profiled in a while, I'll get on perf work once tools.analyzer.js is good enough, which isn't really going to take much longer
10:43Bronsabbloom: the emitter can be heavily optimized and we know how but unfortunately that only accounts for a small amount of the overhead
10:43Glenjaminbeing able to compile cljs macros in the browser would be ace
10:44Bronsagiven that t.a.js is ~3x slower than cljs.analyer that indicates that the AST walking multi-pass approach has some intrinsic overhead that might be difficult to reduce
10:45Glenjaminis there any parallelism in the compiler?
10:45Bronsano
10:45Glenjamini was thinking the other day that non-dependant namespaces could be compiled in parallel
10:45tbaldridgeDuh man....everyone knows parallelism makes stuff faster
10:46tbaldridgewhat's wrong with programmers these days?
10:46tbaldridge:-P
10:46bbloomhehe well, it's true tho
10:46arrdemGlenjamin: unfortunately due to Clojure's load semantics that's not really possible.
10:46bbloomthe Roslyn compilers are like 20% slower than the previous compilers when single threaded
10:46bbloombut when compiling independent .cs files, it's almost a linear speed up
10:46Glenjaminarrdem: which part? i'd have though the lack of foward declarations and global namespaces would help
10:47BronsaGlenjamin: it's non trivial to determine what namespaces a ns depends on
10:47ghadishaybanBronsa: is multimethod dispatch part of the problem?
10:47bbloomBronsa: well, at least the ns form is quasi declarative
10:47bbloomunfortunately the way it's implemented isn't super helpful in that regard
10:47Bronsabbloom: ns is not the only way to load a namespace
10:47Glenjamini kinda imagined some sort sort of queue
10:48bbloomBronsa: right, but it's the most common and readily parallelized
10:48Glenjaminload adds to a queue, if you hit another load then queue another and pause until it's fulfilled
10:48tbaldridgeI've done tests on storing analysis data in a tuple store + a datalog to query. It completely changes the model, but it does allow you to touch leaf nodes without updating the path to that node.
10:48ghadishaybanI've tackled static vars, protocol calls, and keyword invokes with invokedynamic, but I haven't started plotting what to do with MM dispatch
10:49blunteHello all. I'm struggling a bit to understand how to iterate over a sequence of vectors properly. Can I show a line of code for suggestions?
10:49ghadishaybanblunte: go for it
10:49Bronsaghadishayban: I do think the heavy use of multimethods is part of the problem but, I have plans to try using records for the AST nodes & using protocols to see if that helps
10:49tbaldridgeghadishayban: you'll have tons of fun with that, since it's basically opaque to the compiler. You could dispatch on anything
10:49ghadishaybantbaldridge: my only idea is to intrinsify MMs
10:50blunteI'm processing CSV like data, and for testing purposes I would like to join the inner vectors with comma and the sequence elements (vectors) with newline)
10:50arrdemtbaldridge: build a partial application/evaluation engine and precompute dispatch where possible :D
10:50tbaldridgedang it! now I want go and run a profiler over t.a.j instead of working this morning
10:50blunte(doall (map clojure.string/join "," '(["one" "two" "three"] ["four" "five" "six"] ["seven" "eight" "nine"])))
10:50blunteit just returns the first vector, comma joined.
10:51Glenjaminblunte: you need to wrap the "join ," bit into a function
10:51Glenjamin,(map #(clojure.string/join "," %) '(["one" "two" "three"] ["four" "five" "six"] ["seven" "eight" "nine"]))
10:51clojurebot("one,two,three" "four,five,six" "seven,eight,nine")
10:51blunteooh
10:51bluntethanks. processing mentally
10:51bluntethat's very nice, thanks!
10:52blunteand that returned sequence can be joined with newline to give me the result I want
11:10lvhHi!
11:10lvhAre there bindings for nacl/libsodium anywhere?
11:10lvh(If not I guess I can use the Java stuff)
11:14justin_smithlvh: there is clojurescript for targetting js, but no nacl backend that I know of
11:14lvhehh
11:14ssiderishttp://blog.cognitect.com/blog/2014/7/22/transit
11:14lvhjustin_smith: sorry I should clarify, I mean nacl the crypto lib, not native client :)
11:14ssiderisMr Hickey strikes again
11:18john2xwhat's the opposite of assoc-in?
11:18nkozajohn2x: get-in ?
11:18mdrogalis*Cough* http://dev.clojure.org/jira/browse/CLJ-1063
11:18john2xi mean the dissoc part
11:18mdrogalisjohn2x: ^
11:18john2xooh.. thanks mdrogalis
11:19mdrogalisjohn2x: You can find an implementation of dissoc-in in most util libraries.
11:19tbaldridgejohn2x: normally, this
11:19andyfBronsa: Expected change from t.a.j 0.2.2 to 0.3.0 that ignored/wrong primitive type hints cause exceptions to be thrown?
11:19tbaldridge, (update-in {:a {:b 42}} [:a] dissoc :b)
11:19clojurebot{:a {}}
11:19arrdemwell at least it's not "patch declined" yet...
11:20tbaldridgejohn2x: mdrogalis: would a "true" dissoc-in remove the entire path? or just the leaf node,
11:20Bronsaandyf: got an example?
11:21john2xtbaldridge: for my needs just the leaf node (I guess it's analogous to get-in that way)
11:21andyfBronsa: (defn #^bytes to-bytes ...) throws exception with 0.3.0 but not 0.2.2
11:21Bronsaandyf: oh yeah
11:21tbaldridgejohn2x: right, but I think that is one of the reasons dissoc-in was never added to core
11:22Bronsaandyf: intended
11:22tbaldridge,(assoc-in {} [:a :b :c :foo :bar] :baz)
11:22clojurebot{:a {:b {:c {:foo {:bar :baz}}}}}
11:22andyfBronsa: Wrong tag: clojure.core$bytes@6747009b in def: to-bytes
11:22JohnTalenthow can you check your tried password attempts on freenode?
11:22justin_smithtbaldridge: if you want to remove the whole path, you only need to dissoc the prefix
11:22andyfBronsa: Thought so, but wanted to verify that it didn't surprise you too much :)
11:22tbaldridgejustin_smith: recursively, yes
11:22Bronsaandyf: https://github.com/clojure/tools.analyzer.jvm/commit/829c996198ecbc7023e8bd3f0757e830cd6b475e
11:24andyfBronsa: I'll take a stab at documenting this change, since some Eastwood users will see it.
11:24Glenjaminis core incubator still a thing?
11:25Bronsaandyf: I'm going AFK for a couple of hours now, if you need me write to me in query and I'll reply when I get back
11:25andyfGlenjamin: I think it has been a year or three since any change has been made to it
11:25andyfBronsa: got it
11:27andyfGlenjamin: Medley and Prismatic plumbing libraries are not official, but have similar kinds of things you may find useful https://github.com/weavejester/medley
11:27Glenjaminyeah, there's also useful too
11:28Glenjaminas in, the library called useful
11:29andyfGlenjamin: understood. I can't speak to future plans of other people here, but it seems like a safe bet that core incubator will remain static.
11:30Glenjaminin the sense that it isn't really incubating things anymore :)
11:30andyfwell, it is still incubating the same things -- they just won't hatch :)
11:31Glenjaminheh
11:32arrdemI mean... now that technomancy has obligingly solved the dependency management problem, there's kinda no good reason for core to bloat at all. In fact shrinking core has become possible...
11:33arrdemnot that I really consider stuff like dissoc-in "bloat", but we have the tools to implement our own convenience tools without having to enshrine them in the lang itself
11:34andyfSeems some people like enshrined things
11:34Glenjaminunless two libs depend on different versions of a util lib
11:34andyfI'm not arguing for or against enshrining here -- just observing.
11:36andyfI hope Transit gets an ANN in the Clojure group, too. I don't want to feel I have to follow all the blogs :)
11:37arrdemandyf: thoughts on transitioning Grimoire to a simple Ring app?
11:37Glenjaminwhere would you host it arrdem?
11:37arrdemGlenjamin: same place I already do... my underutilized digitalocean instance
11:38Glenjaminoh, i assumed it was github pages currently
11:38andyfarrdem: I have no advice there, unfortunately. I am a very rare bird these days -- a software developer who has never written a dynamic web site.
11:39john2xso is Transit "replacing" EDN?
11:41ambrosebsandyf: should we feel bad for that?
11:42andyfambrosebs: I don't think so :) It can certainly change in the future, and probably will when I get off my a** and do it some day.
11:42ambrosebsyea that's what I tell myself
11:44dnolen_http://blog.cognitect.com/blog/2014/7/22/transit
11:44dnolen_Transit landed
11:44dnolen_probably time to EOL sending EDN or JSON between CLJ/CLJS :)
11:48nullptrdnolen_: given that both sides speak EDN natively, the primary motivator in that scenario would be -- wire perf?
11:53justin_smithnullptr: looking at the github repo examples, transit looks bulkier on the wire than edn would be
11:55dnolen_justin_smith: not true - caching
11:55dnolen_justin_smith: will be way smaller
11:55dnolen_nullptr: yes for Clojure data easily faster than JSON most of the time
11:55dnolen_because of caching and lot of optimizations
11:56dnolen_cognitect.github.io/transit-tour
11:56dnolen_look at the bottom
11:56dnolen_89K for raw JSON rep, 53k w/ caching
11:57dnolen_V8 based engines can parse that nearly 2X faster and the remaining time hydrate
11:57dnolen_also true for recent IEs
11:57dnolen_Safari & Firefox lag a bit, but still blows EDN away
11:57dnolen_20X faster to read
11:58Glenjamincaching seems be a bit of an overloaded term in this case
11:58dnolen_Glenjamin: in what sense?
11:58Glenjaminbut i guess compression would suffer from the same overloaded meaning
11:59Glenjaminwell wire caching usually refers to intermediaries serving stale responses
11:59dnolen_Glenjamin: it's not just comprehension
11:59dnolen_we read values out of the cache
11:59Glenjaminand i know this isn't wire caching, but it's talking about caching for a wire format
11:59dnolen_if a keyword appears 1000s of times
11:59dnolen_... same keyword
11:59Glenjaminoh right, i see
11:59Glenjaminit's both wire compression and reader caching
12:00averelldoes that test include compressed transport?
12:00dnolen_averell: the last 2 lines do
12:13dnolen_basic transit clj/cljs example https://github.com/swannodette/transit-example
12:13sm0kei have a definition (defn ^bytes tobytes....) ..but the compiler throws java.lang.IllegalArgumentException: Unable to resolve classname: clojure.core$bytes@73fc62f
12:16razum2umhow does transit compare to protobuf?
12:16tbaldridgerazum2um: protobufs have a external format
12:16sm0keBronsa: mentioned that ^bytes on def is error prone, but seems like defn is also in the same boat
12:17sm0kemoreover ^'bytes also doesnt work
12:17tbaldridgerazum2um: transit is ad-hoc in the sense that there is no formal schema you simply write/read values
12:17sm0kewhat a joke
12:18razum2umtbaldridge: I feel like it's gonna be a lib further anyway like prismatic schema :)
12:18tbaldridgebe a lib further?
12:19razum2umtbaldridge: I mean there will appear a lib to schemify transit :)
12:20tbaldridgerazum2um: perhaps, but I doubt it will come from Cognitect (IMO my opinion is my own). Existing schemas will work with transit, and yet I've never used one in my professional work.
12:38silasdavisis the a clojure core function: (fn [v f] (f v))
12:38silasdavis?
12:38silasdavisis there*
12:39hoverbearAre there any guides to deploying Clojure apps to Wildfly/Jboss?
12:43DomKMhoverbear: http://immutant.org/
12:48hoverbearDomKM: Ah yes, with it's lovely blank "Deploying with Wildfly" page. :(
12:48DomKMhoverbear: oh, sorry. Maybe hop over to #immutant and ask them.
12:48hoverbearDomKM: Yeah. :) already there.
12:49johncashWhy use json and msgpack for transit rather than edn and fressian?
12:49johncashI don't see the point of using JSON if you need a separate library to parse it
12:50tbaldridgejohncash: fast JSON parsers exist for almost every language.
12:50tbaldridgeThe only way you're going to get decent performance in the browser for example, is by writing your data format on top of JSON
12:51johncash(inc tbaldridge)
12:51lazybot⇒ 8
12:51tbaldridgefun fact, msgpack implementations for JS are actually slower than JSON JS implementations.
12:53johncashIs that because JSON parser is in C?
12:53hoverbearjohncash: The JSON parser in browsers are generally native
12:53hoverbearC/C++/C# or whatever goofy stuff IE is written in
12:54johncashby "C" I mean low level language the browser is written in
12:54tbaldridgejohncash: partly, and just that JSON in node.js/browsers has has been optimized by dozens of people over years and years of work. Beating that is going to be super hard.
12:55johncashSo we are letting the nodejs and browser people dominate the clojure world? A sad day, but pragmatic I guess
12:57bbloomdnolen_: is the transit-tour up somewhere? or should i just run it local?
12:58tbaldridgeFrom some of the small tests I see, transit also outperforms EDN, so I'd use it all most all my CLJ->CLJS apps. The only time I wouldn't use it is when Fressian would work (only on the JVM)
12:58dnolen_bbloom: http://cognitect.github.io/transit-tour/
12:58bbloomdnolen_: would you accept a PR for the readme? ;-)
12:58dnolen_johncash: even if you do Clojure <-> Clojure, Transit beats EDN
12:58dnolen_bbloom: can't
12:59dnolen_johncash: it's a win if you're entire stack is Clojure, esp. if ClojureScript is involved
13:00johncashI'm going to start calling this JSON 2.0
13:01bbloomdnolen_: your `new Date(0)` example is problematic b/c it "works" with normal objects too
13:02bbloomie it will return "Works!" but obviously that's broken in actuallity
13:02bbloomcalls toString on the date
13:03dnolen_bbloom: not seeing that here, got a specific snippet?
13:03bbloomvar m = transit.map([new Date(0), "Works!"]); m.get(new Date(0)); // "Works!"
13:04bbloom> var m = {}; m[new Date(0)] = "works?"; m[new Date(0)] // "works?"
13:04bbloomdnolen_: i know what you're trying to say, but somebody might try that and be like "what is this dnolen guy smoking?
13:04dnolen_bbloom: I have no idea what you are talking about yet
13:04dnolen_show me something that shouldn't work
13:04bbloomon http://cognitect.github.io/transit-tour/
13:05dnolen_bbloom: you haven't shown me anything that should not work
13:05dnolen_the second thing you posted here doesn't even make sense in the context of transit
13:06bbloomdnolen_: you write "The above is impossible under the proposed ES6 Map specification." which is true, but anybody reading this might think the second thing i posted
13:06dnolen_what does that have to do w/ ES6 Maps
13:06dnolen_?
13:07bbloomdnolen_: i'm saying that what you wrote may fail to convey what you're attempting to demonstrate
13:07dnolen_it won't work w/ ES6 Maps that's all that I'm saying
13:07dnolen_your point is completely orthogonal
13:08bbloomi'm not trying to make a counterpoint or anything
13:08justin_smithsm0ke: looking at your unable to resolve class name, for the ^bytes type hint, the class name it lists looks like the actual value of the bytes function
13:08bbloomwhat you've written is correct
13:08dnolen_bbloom: for people who can't imagine doing this w/ more types and w/ good perf ... we can't help those people
13:08justin_smithsm0ke: I would not be surprised if ^'bytes only works in newer versions of clojure - is there some reason you need to stay at 1.4?
13:09bbloomdnolen_: *shrug* ok
13:13dnolen_http://jsperf.com/json-vs-transit
13:14bbloomdnolen_: the mini benchmarks on the bottom of the tour don't run long enough to present useful results
13:14bbloomabout 1ms each on my machine
13:15bbloombut other than that, just read it. super good stuff
13:15bbloomgo team
13:15dnolen_bbloom: thanks! :)
13:17bbloomdnolen_: the example json you linked to contains some... suggestive... keys ;-)
13:18dnolen_bbloom: no comment :)
13:20CookedGr1phonIs there anyone here familiar with JVM bytecode? I'm debugging an issue with monitorenter and monitorexit on the new android ART runtime
13:20sm0kejustin_smith: yep need to stick to 1.4
13:21sm0keisnt there some workaround for 1.4?
13:21bbloomCookedGr1phon: i'm not a bytecode expert, but i do know that montior enter/exit are weird in that they have to be statically verified in pairs, or something like that
13:22bbloomCookedGr1phon: ie you get some kind of verification failure if you have one without the other in the same lexical extent
13:22CookedGr1phonbbloom: yeah, and the art compiler is falling over claiming that the clojure generated bytecode doesn't pass this check
13:23bbloomCookedGr1phon: gist the clj & bytecode
13:23CookedGr1phonbbloom: okay, one sec
13:28CookedGr1phonbbloom: sorry, taking more than a sec, having to rebuild the project to remove my attempted workaround (moving the monitor-enter out of the try in the locking macro - something I'm fairly sure should be the case anyway looking at the bytecode that a plain java synchronized generates)
13:29gtrakso... is transit related to EDN and fressian at all?
13:29devthgtrak: https://news.ycombinator.com/item?id=8069731
13:30gtrakperfect :-)
13:36CookedGr1phonbbloom: here you go https://gist.github.com/AdamClements/2ae6c4919964b71eb470
13:38CookedGr1phonbbloom: I realise the two segments aren't exactly equivalent, but when I had the java one just return 2, it did a shortcut returning from within the monitorenter/exit and I thought that might be affecting things
13:39CookedGr1phonbbloom: my observations so far: the try in the clojure version includes the monitorenter instruction, and in the java version doesn't
13:40bbloomCookedGr1phon: did your custom locking macro fix it?
13:40bbloommy guess is that this is an ART bug, that only expects output from javac
13:40bbloombut presumably if moving the monitor-enter fixes it, then it may be reasonable to make that change
13:41CookedGr1phonI'm not sure yet, just going to go back to that, I reverted it just after I'd made the change in order to show you the bytecode of the original master clojure version
13:42CookedGr1phonI'm trying it again now, I'm also trying different versions of the java code to see if I can find one which art won't run
13:42hiredman it looks like the java code's exception handler is installed for the bytecode right after the monitorenter, the clojure code's exception handler is installed for the bytecode starting right before the monitorenter
13:43bbloomhiredman: yeah, that he was saying about the definition of locking
13:43bbloom`(let [lockee# ~x] (try (monitor-enter lockee#) ~@body (finally (monitor-exit lockee#))))
13:43bbloomCookedGr1phon: hiredman *is* a byte code expert, as far as i know :-P
13:43hiredmanfuh
13:44hiredmanthrown under the bus, just like that
13:45hiredman(I am not)
13:45bbloommore than me
13:46CookedGr1phonone thing I really don't get about this bytecode, is what aconst_null, pop can be doing
13:46m_m_Hi. I am searching simple clojure web framework with clojurescript support and good doc. Any suggestions?
13:47boxedm_m_: reagent on the client side and ring+compojure on the server side
13:48m_m_how about caribou framework?
13:49hiredmanCookedGr1phon: locals clearing
13:49hiredmanCookedGr1phon: nulling out locals that aren't used anymore so as not to keep references longer than required
13:50Bronsahiredman: no he's talking about https://gist.github.com/AdamClements/2ae6c4919964b71eb470#file-test_locks-class-L42-L43
13:51hiredmanOh, right, not a store
13:51hiredmanBronsa is the guy writing a clojure compiler
13:51boxedm_m_: haven’t tried it… but from what I can see it doesn’t seem to have a react-based frontend system so that’s a bit of a bummer for me personally… the db stuff looks interesting though
13:52BronsaCookedGr1phon: the null is there so that that's what's returned if the monitor-exit is in return position
13:53BronsaCookedGr1phon: but since that's not the case there, it's popped
13:53sm0keis there some way to associate type hint in with-open binding?
13:53Bronsaadmittedly the compiler could be a little smarter there and could not emit the null at all but this works too
13:54sm0kei tried (with-open [s (vary-meta x assoc :tag FooClass)]...) to no use
13:54Bronsasm0ke: type hints must be visible at compile time to have any effect
13:54hiredman"Clojure: The compiler could be smarter"
13:54sm0keoh right
13:55Bronsasm0ke: also reading the backlog, ^'foo obviously doesn't work I meant it as a shortrand for ^{:tag 'foo}, sorry if it wasn't clear
13:56sm0keok got it
13:56sm0keits a way to avois it resolving to function
13:56sm0kei am not very familiar with meta yet
13:57Bronsawait wtf
13:57Bronsa,'^foo []
13:57clojurebot[]
13:57Bronsa,(meta '^foo [])
13:57clojurebotnil
13:57Bronsaoh I have a patched clojure.
13:57CookedGr1phonokay, looking at the *java* version bytecode, what's with the second exception handler, where it's handled with itself
13:58CookedGr1phondoes that just keep trying monitorexit until it succeeds?
13:59sm0ke,(meta {:tag 'foo} [])
13:59clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/meta>
13:59sm0ke,(meta ^String [])
13:59clojurebot{:tag java.lang.String}
13:59CookedGr1phonin the clojure version, neither of the monitor-exits are in the scope of an exception handler, but in the java version both of them are... that's weird
13:59sm0ke,(meta {:tag 'String} [])
13:59clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/meta>
13:59sm0ke,(meta ^{:tag 'String} [])
13:59clojurebot{:tag String}
13:59sm0ke,(meta {:tag 'foo} [])
13:59clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/meta>
14:00sm0ke,(meta ^{:tag 'foo} [])
14:00clojurebot{:tag foo}
14:00hiredmanlooks like some kind of encoding of finally semantics
14:00Bronsasm0ke: please avoid spamming clojurebot in the channel
14:00sm0keok so :tag can be anything ? clojure doesnt check for a valid classs?
14:00sm0keyep sorry
14:00Bronsasm0ke: correct
14:01hiredmanor maybe not, I dunno
14:01sm0keso for the with-open thing is there a workaround or i would have to write my own (with-open*..)
14:02Bronsasm0ke: can't you type-hint the with-open binding symbol?
14:02Bronsa(with-open [^foo x ..] ..)
14:02sm0keyou mean (with-open [x ^int 1] x) ?
14:02sm0keoh shit
14:03sm0kedoesnt work either
14:04sm0kemore over i had (with-open [^foo x (bar)] ..) where bar already has type hint for return
14:04sm0kedoes it works for you?
14:06CookedGr1phonIs there a way to express the same semantics in clojure at all?
14:06CookedGr1phona catch which catches exceptions and retries until it works
14:06hiredmanCookedGr1phon: no
14:06CookedGr1phonor am I down to fiddling with ASM at this point
14:07hiredmanit is very weird, because I am not sure that is what would happen
14:07CookedGr1phonhiredman: but you agree the bytecode looks like that's what's happening right?
14:08CookedGr1phonWould it be possible to forego all this and make something which uses the ACC_SYNCHRONIZED tag on the method instead?
14:08hiredmanCookedGr1phon: not without doing the bytecode generation yourself
14:09btcNeverSleepsCan you call APIs written in Java 8 in Clojure? Do you need a specific Clojure version for that?
14:09hiredmanCookedGr1phon: yeah, I don't think that is even actually finally semantics, I wonder if that bytecode is actually just generated as part of compiling a sychronized block
14:10hiredmanthat isn't a sensible way to compile a finally, but for a synchronized where you *really* want that monitorexit to run
14:12justin_smithbtcNeverSleeps: you can use parts of java8 via interop, if you use the java8 runtime
14:12justin_smithbtcNeverSleeps: clojuer version should not affect this at all
14:12btcNeverSleepsjustin_smith: thanks, that is great
14:14CookedGr1phonhiredman: if that were the case, wouldn't you think there'd be something in ASM for that construct? Or is it reasonable for that to be at a higher level
14:15hiredmanCookedGr1phon: I doubt there is a construct in asm for it, it would be an implementation detail of javac
14:16hiredman(which art may depend on because they only ever delt with code generated by javac)
14:17hiredmanhttp://www.ibm.com/developerworks/ibm/library/it-haggar_bytecode/#4 shows the same kind of region that handles itself for monitorexit
14:20CookedGr1phonhiredman: so, is this a clojure bug waiting to happen, or an acceptable alternative way of doing things do we think?
14:21CookedGr1phoni.e. should I be looking at getting this changed in clojure, or bugging google to allow this bytecode in ART?
14:22hiredmanI dunno
14:23CookedGr1phoncould do with the equivalent of c's inline assembly block to try this out :P
14:23hiredmanI suspect it is an art bug in the sense that the bytecode spec lets you do it, and the art compiler does not
14:24CookedGr1phonhiredman: but by the same token you can do all sorts of things in the wrong order, jump to invalid instructions etc., it might be that monitorenter and monitorexit are only meant to be used in fairly specific ways
14:24SagiCZwhats the idiomatic way to ask if seq is empty?
14:24hiredmanCookedGr1phon: you can't though
14:24SagiCZ(= x [])
14:24SagiCZ?
14:24technomancy,(doc empty?)
14:24hiredmanCookedGr1phon: jvms verify bytecode on load and barf on that kind of stuff
14:24justin_smith,(map empty? [[] {} '()])
14:24clojurebot"([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
14:24clojurebot(true true true)
14:25SagiCZ,(empty? [])
14:25clojurebottrue
14:25SagiCZty
14:25CookedGr1phonSagiCZ: calling (seq x) is the idiomatic + fast way, it will return either the sequence or nil which is falsey if there's nothing in it
14:25hiredmanCookedGr1phon: so the code clojure emits passing the bytecode verifier but art is barfing on it
14:25CookedGr1phonhiredman: yeah, fair point
14:26hiredmanit might even be both
14:27SagiCZ CookedGr1phon: I think that empty? is way clearer, its obvious what i was asking ..
14:27CookedGr1phonhiredman: I'm fairly sure having the monitor-enter inside the try is wrong
14:27hiredmane.g. that bytecode passes the verifiers so art should accept it, but clojure should generate safer code
14:28hiredmanCookedGr1phon: wrong in what sense?
14:28CookedGr1phonhiredman: if the monitor-enter fails, you don't want to run monitor-exit
14:28CookedGr1phonwhich is what the current implementation does
14:29CookedGr1phonSagiCZ: sorry, wasn't paying full attention, I meant to say seq is the idiomatic way to check if a collection has something in it, rather than (not (empty? x))
14:30CookedGr1phonSagiCZ: as a potentially relevant aside
14:31SagiCZCookedGr1phon: I see
14:31hiredmanCookedGr1phon: I suspect monitorenter only ever fails when the object is nil
14:32SagiCZI need to pass a string or 'symbol to a function according which the function chooses one of its subfunctions to execute, how can i pass that?
14:32SagiCZi am trying to acll it as (fun 'parameter) but it doesnt work
14:32hiredmanCookedGr1phon: but you are right, that may be an implementation detail of all jvms to date
14:32CookedGr1phonhiredman: http://stackoverflow.com/questions/15121402/jvm-synchronized-finally-blocks has some relevant discussion
14:33CookedGr1phonjustifies it as "at least the deadlock will happen in the right place, rather than next time something tries to get the lock"
14:33amalloyhiredman: is it not possible to also fail if someone interrupts your thread while you're waiting to get the lock?
14:34hiredmanamalloy: dunno, it would depend on how you interrupt, I sort of doubt and implementations of monitorenter poll the thread interrupted flag
14:35hiredmanhttp://docs.oracle.com/javase/specs/jvms/se5.0/html/Compiling.doc.html#6530 the bytecode here doesn't have the second handler
14:36SagiCZ(= 'parameter (symbol "parameter"))
14:36SagiCZ,(= 'parameter (symbol "parameter"))
14:36clojurebottrue
14:37CookedGr1phonI'm wondering if it's the goto that's throwing ART's static analysis, none of the java examples I've seen jump over the exception handler like the clojure version
14:38hiredmanCookedGr1phon: it maybe easier to get clojure to make a change than to get google to, but I am not sure
14:38hiredmanI am pretty sure https://gist.github.com/AdamClements/2ae6c4919964b71eb470#file-java_test-class-L22 is jumping over the handler?
14:38CookedGr1phonI mean if we *can* get it fixed in clojure, it's certainly no worse, and there's an argument for it being better, especially if it matches javac
14:39CookedGr1phonhiredman: oh yeah, ignore that then!
14:40hiredmanCookedGr1phon: well, I am pretty sure it would involve adding support for something like java's sychronized blocks to the compiler, I don't think you'll want to try and check try/finallys for synchronize like blocks and generate the same bytecode
14:41hiredmanwhich means adding a special form, and then what do we do with the existing monitor-enter and exit forms, I dunno, I doubt anyone uses them directly
14:41CookedGr1phonhiredman: the docstring explicitly says not to use them...
14:42CookedGr1phonI was surprised how few things even used locking tbh
14:43hiredmanit might be easier/better to make it possible to mark functions as synchronized
14:43CookedGr1phonand then just make locking generate a function internally?
14:43hiredman(^:synchronized fn [] ...) and generate synchronized methods
14:43hiredmanCookedGr1phon: or just ignore locking
14:44CookedGr1phonI'm thinking for making existing code compatible with ART
14:44CookedGr1phonbut yeah, you wouldn't need locking in that case
14:46CookedGr1phonanyway, I have to head home now, not really sure what the next step is to fixing this
14:47CookedGr1phonmight be worth moving this conversation to the mailing list
14:47SagiCZcan anyone explain me difference between ` ' ~ ?
14:49amalloywhenever i type them in that order i always feel like i'm executing a hadouken in street fighter, SagiCZ
14:49SagiCZamalloy: yeah i dont necessarily mean to use that in that particular order :)
14:49amalloyjust looking at the directions they go in. it's so perfect
14:50amalloybut, briefly, ' quotes a subform, and ` also quotes a subform but allows ~ to suspend quoting
14:50justin_smith' is a shorthand for wrapping the next thing in (quote ...), ` is known as quasiquote and is like quote but it resolves symbols to their namespace and allows for ~ (unquote) / ~@ (unquote splicing) which selectively unquote inside the form
14:50amalloyif you had to ask the question, this brief answer was probably not very helpful
14:50justin_smithor what amalloy said
14:50SagiCZamalloy: no, it actually sounds good
14:50SagiCZthank you guys
14:51justin_smith,`(a b c ~+)
14:51clojurebot(sandbox/a sandbox/b sandbox/c #<core$_PLUS_ clojure.core$_PLUS_@8b0bea>)
14:51SagiCZ,'~`~',
14:51clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:51SagiCZi thought so
14:51SagiCZ:D
14:51DerGuteMoritz,(let [a 1] `(a ~a))
14:51clojurebot(sandbox/a 1)
14:51DerGuteMoritzbetter example I guess!
14:52SagiCZnot too shabby, thank you
14:52DerGuteMoritzwhat's the deal here though:
14:52DerGuteMoritz,```()
14:52clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/list))))
14:52stuartsierraAnyone having problems with clojars.org?
14:52DerGuteMoritz` in clojure isn't actually like traditional quasiquote
14:52Bronsastuartsierra: it doesn't load for me
14:53DerGuteMoritzit also plays a role in its macro hygiene system by fully qualifying symbols
14:53Bronsastuartsierra: now it does, but I see an empty page
14:53DerGuteMoritzwhich probably also explains that weird expansion for quasiquoted quasiquotes
14:54DerGuteMoritzcompare with quoted quote:
14:54DerGuteMoritz,'''()
14:54clojurebot(quote (quote ()))
14:55SagiCZDerGuteMoritz you just hit me with this when i thought i was starting to get it
14:55SagiCZ:)
14:55amalloyDerGuteMoritz: the hygienic nature of ` isn't really what leads to the runaway explosion in the expansion of ````
14:56DerGuteMoritzSagiCZ: heh, well, you can safely ignore that, it's rarely necessary to quasiquote quasiquote and probably better to express it differently anyway in case you think you need it :-)
14:56amalloyoh, i guess you didn't really claim it did
14:56DerGuteMoritzamalloy: indeed, just the implementation of ` leaking through I guess!
14:57amalloy,````````````x
14:57clojurebot#<StackOverflowError java.lang.StackOverflowError>
14:57DerGuteMoritzheh
14:57DerGuteMoritzthis is also interesting:
14:57DerGuteMoritz,''a
14:57clojurebot(quote a)
14:57DerGuteMoritz,'`a
14:57clojurebot(quote sandbox/a)
14:58DerGuteMoritzso symbol qualification happens even inside quote
14:58DerGuteMoritzprobably at read time?
14:58amalloyDerGuteMoritz: ` happens at read time, so it has no idea it's inside of a quote
14:58DerGuteMoritzright
14:58DerGuteMoritzwell, a slightly shady corner!
15:08SagiCZ,(clojure.pprint/pprint "hello")
15:08clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>
15:08SagiCZwhy cant it find pprint<
15:08SagiCZ?
15:09Bronsa,(require 'clojure.pprint)
15:09clojurebotnil
15:09Bronsa,(clojure.pprint/pprint "foo")
15:09clojurebot"foo"\n
15:09SagiCZ:> this channel is 100x quicker than google .. thanks
15:19zanesAnyone have any insight into why so many functions were deprecated from the core.async API at once?
15:19zanesJust curious what the thinking was there.
15:21zanesAh, I see: https://github.com/clojure/core.async/commit/4b06327455d993930a121db7ecfadc6359a23e95
15:22zanesGuess they’re coming back at some point.
15:24bbloomzanes: problem is that rich is working on master rather than a feature branch :-P
15:24bbloomthe master branch updates the docs automatically
15:24zanesbbloom: Got it.
15:57stuartsierraWho's running clojars.org these days?
16:00numbertenis there a good rule of thumb for when to use threading macros?
16:00numbertenlike how many nested sexprs you should have?
16:00impermanstuartsierra: is it working now? see white page only
16:03justin_smithnumberten: I don't understand that question
16:04impermannumberten: more a personal favor, I think
16:04stuartsierraimperman: same here
16:05gill_can confirm, clojars is returning bum route
16:05numbertenif I have (f (g (h x))) I can rewrite it (-> x h g f), which seems to be idiomatic afaik
16:05numbertenbut what if I have (f (h x))
16:05numbertenis that worth theading?
16:06numbertencertainly using -> as identity isn't the thing to do >.>, so I guess my question was when is it no longer worth threading
16:06bbloomnumberten: do what feels right
16:06bbloomthere's no hard rule
16:06numbertenalright thanks
16:06numberteni had a feeling that was the answer
16:06technomancystuartsierra, imperman: can't repro clojars issues; can you provide details?
16:06gill_stuartsierra: maybe phil? https://groups.google.com/forum/#!topic/clojars-maintainers/d8HNd-R4uw8
16:06numbertenjust wanted to be sure there wasn't a standardized informal rule
16:06numbertenthanks :)
16:07technomancyis it a specific page? a 500 error?
16:07BobSchacktechnomancy: It's a 500 error for me
16:07gill_technomancy: it's a blank page
16:07stuartsierratechnomancy: Getting a blank page on clojars.org/
16:07gill_like an empty route
16:07BobSchackNM I'm getting it now
16:07bbloomnumberten: one other thing to consider is that -> reads imperatively: "do this then this then this", which may or may not be sway you one way or another when you're on the fence
16:08stuartsierratechnomancy: Odd, suddenly now it works
16:08bbloomie you want to emphasize sequencing or results
16:08impermantechnomancy: oh, i'ts ok now. blank white bage before, mabe browser bug\
16:09stuartsierraI'm pretty sure I couldn't fetch dependencies from Clojars a couple of hours ago.
16:09technomancyhm; seems unlikely to be a connectivity issue if you're able to get an HTTP response back
16:10stuartsierraOh well, maybe a false alarm. Sorry for the interruption if that's the case.
16:10technomancyonly a single 500 in the logs for today
16:10technomancyon an index out of bounds exception, which is probably a legit bug but also probably not what you're seeing
16:11technomancyif you have headers I'd be interested in seeing them
16:12stuartsierratechnomancy: Don't have headers from a failing request, I'm afraid.
16:12technomancyoh, if it was affecting dependency downloads it was probably an ngnix problem
16:12technomancythe clojars app shouldn't get hit for static files
16:13technomancyalso it gives you a stack trace on 500s, not a blank page
16:13amalloynumberten: http://stackoverflow.com/questions/12715577/when-should-i-use-the-clojure-arrow-macro/12716708#12716708 is my opinion on how to use ->
16:15impermantechnomancy: I tried only from a firefox and had a result like that: https://github.com/ato/clojars-web/issues/231
16:16impermantechnomancy: white blank page. at now i'ts all right. in any case - thx for support :)
16:19bbloomdnolen_: is there a way to force the decoder to always return longs? would be useful for testing purposes to ensure i don't do anything stupid like try to use + and get back a string, heh
16:21dnolen_bbloom: well you won't get back a string I think you'll likely get a corrupted number (which is worse)
16:21dnolen_bbloom: at one point this was overrideable but the spec has since changed
16:21bbloomtransit.reader("json").read('"~i9007199254740994"') + 10
16:21bbloom"900719925474099410"
16:22dnolen_bbloom: huh, ok I guess goog.math.Long must return the string rep then, I though it didn't do that.
16:22dnolen_bbloom: I can bring it up w/ the powers that be.
16:22dnolen_s/though/thought
16:22bbloomdnolen_: it seems highly likely that i may overflow an int and start crashing :-P
16:23bbloomalso .add doesn't seem to work
16:23bbloomx.toString()
16:23bbloom"9007199254740994"
16:23bbloomx.add(5).toString()
16:23bbloom"9007199254740994"
16:24dnolen_are you using this from CLJS or JS?
16:24bbloomdnolen_: right now just experimenting in the console onn the transit tour page
16:24bbloomx.multiply(2).toString()
16:24bbloom"0"
16:25dnolen_bbloom: oh yeah probably not going to work, that page uses the advanced build and we don't guarantee anything about the underlying rep
16:25dnolen_from CLJS it should work
16:26dnolen_we may expose more functionality to JS users if there's interest
16:26bbloomohhh
16:26bbloomx.add(x) seems to work
16:26bbloomi guess goog.Long expects anothe rlolng
16:26bbloomjust silently passes on non-longs
16:26dnolen_oh k
16:26bbloompresumably b/c it expects you to be using their type system at compile time...
16:26dnolen_yeah
16:37SagiCZanybody has pdf or mobi of this book? http://www.braveclojure.com/
16:38amalloySagiCZ: if you want to read it, buy it. it's not like they've made that hard
16:39SagiCZ25 bucks?
16:39amalloy#clojure is the wrong place to ask for unauthorized copies of books by people in the clojure community
16:39SagiCZgot it
16:40amalloySagiCZ: if it's not worth $25 to you, don't buy it
16:40SagiCZ$25 is not the same amount depending on where you live.. some people work 25 hours to get that.. some 10 minutes
16:40technomancythat doesn't justify copyright infringement
16:41amalloyi didn't say "$25 is nothing, you should buy it"
16:41amalloyi said, if you're not willing to pay the price the authors are asking, then they won't give you a copy, and stealing one isn't the right reaction
16:41arrdemseems like you have an opportunity to write a cheaper book on clojure then...
16:41technomancyespecially not when it involves using freenode's services to rip someone else off
16:41SagiCZok i dont think we need to discuss it anymore.. i get yall's point
16:41arrdemunless you just want to complain about the price in a single vendor market
16:42technomancyamalloy: nitpick: stealing is not the correct term for this, and it bugs me when people conflate the two.
16:42technomancy(simply because it makes accurate discussion of copyright infringement murkier)
16:43amalloyalso, http://www.braveclojure.com looks like you can read the whole thing for free online?
16:43SagiCZ2amalloy: I know, exactly. so why should I pay for a different format, I don't get it.
16:43amalloybecause they chose to give you one format for free, and not the other
16:44SagiCZif i write a script that crawls the html and builds a pdf for my purposes, is that copyright infrigment?
16:44amalloydon't repay their generosity by doing something that technomancy prefers not to call stealing
16:44lysergide___Hi
16:44technomancyamalloy: you can call it "being a dick" if you like
16:44aperiodic$google price discrimination
16:44lazybot[Price discrimination - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Price_discrimination
16:45lysergide___I’m a beginner at clojure. Let’s say I wanna repeat a function roulette 100000000 times and apply a if to what is returned.
16:45lysergide___To do this I write.
16:45lysergide___(dotimes [n 100000000] ( if ( > (roulette) 50) (println "Catastrophe")))
16:45lysergide___Is there a better way to do this?
16:46SagiCZ(dotime [_ 100] (fun))
16:46amalloytechnomancy: i can't support your campaign for a word less murky than "stealing" if the only alternative you can offer is so generic it applies to anything at all
16:46technomancyamalloy: the technical term is copyright infringement
16:46SagiCZ2amalloy: answer my question please.. i wonder what you think about it
16:46technomancybut I know it doesn't roll off the tongue quite as nicely
16:47SagiCZ2lysergide: (dotimes [_ 100] (fun))
16:47amalloySagiCZ: i'm not a lawyer. my answer would have no value
16:47SagiCZamalloy: It has a value for me. I care.
16:47amalloyalso of course "answer my question please" rather rudely implies that you're somehow entitled to my answers
16:47lysergide___SagiCZ: Okay thank you very much ! basically you use « _ » to say that we don’t care about the « variable » ?
16:48SagiCZamalloy: I am not and if saying "please" makes the whole thing rude pardon me. I am not native English speaker.
16:48SagiCZlysergide___: exactly.. its still a valid symbol as far as I know but its the idiomatic way to say that you will not use it
16:48justin_smith,(do (repeatedly 10 (print "."))) another option, the do can be left out, it just makes the bot output more clear
16:49clojurebot#<NullPointerException java.lang.NullPointerException>
16:49justin_smitherr
16:49amalloyjustin_smith: ??????
16:49llasramI think you mean `dorun`
16:49lysergide___SagiCZ: It seems like it does not work..
16:49llasramWell, and a function
16:49lysergide___Oh yes it works.
16:49amalloyanyway, i'm not going to answer that question, SagiCZ. giving legal advice is not a good business to be in, as a software developer
16:49justin_smithllasram: oh, I thought repeatedly took a number like repeat does, I guess not
16:50SagiCZamalloy: fair enough.. it was a hypothetical question of course
16:50amalloyit does, justin_smith
16:50justin_smith,(do (repeatedly 10 #(print ".")))
16:50clojurebot(..nil .nil .nil .nil .nil ....)
16:50justin_smithbut I misused the do, Ok
16:50amalloyjustin_smith: that's lazy
16:50hyPiRion,(do (repeatedly 10 #(print ".")) nil)
16:50clojurebotnil
16:51justin_smith,,(dorun (repeatedly 10 #(print ".")))
16:51clojurebot..........
16:51justin_smithfinally
16:51SagiCZ,(dotimes [_ 10] (println "."))
16:51clojurebot.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n
16:51lysergide___Lazy sequence is a better solution, that’s what I am using with filter.
16:51lysergide___I just wanted to know If I had it right with dotimes
16:52lysergide___Laziness is why I love clojure.
16:52lysergide___Haskell too but Haskell takes too much time to be learnt
16:52lysergide___imo
16:52llasramOh, BTW, hi everyone! Not that anyone missed me, but I am starting to be back from being totally burned out
16:52SagiCZllasram: what happened to you?
16:52hyPiRionlysergide___: how much time does it take to learn Haskell?
16:52llasramSagiCZ: Just working too hard
16:52technomancytoo many amps passing through your body?
16:53aperiodicllasram: good to hear!
16:53seangrovelysergide___: I don't know if that's good reasoning...
16:53SagiCZ llasram: welcome back then :)
16:53hyPiRionllasram: welcome back =) I know that feeling too
16:53ZekkaSpeaking as a Haskell programmer, it doesn't take as long to learn as people say but it can still take a while
16:54lysergide___Zekka: Well for example I wanted to create a simple game.
16:54Zekkato varying degrees of grok it took either a month, six months, or a year for me to understand it as well as I do now, but I could have written useful programs after the first month
16:54lysergide___I had to learn about the State monad
16:54lysergide___stuff like that
16:54ZekkaWell, right, there's a sharp learning curve initially
16:55lysergide___It is a an interesting language but not sure it is worth the time to learn it
16:55seangroveRight
16:55ZekkaA Haskell dogmatist would probably reply that the alternative of not making people learn about things like that is much worse than losing people in making them do that
16:55seangroveIf you're going to be programming for years, probably shouldn't spend much time picking up new concepts
16:55llasramZekka: How much of the sharpness do you think is just learning new tokens for familiar things, and how much foreign concepts?
16:56Zekkallasram: Mu.
16:56SagiCZwhat I don't understand is why people say that Clojure is easy because it has easy syntax... yeah you only need to know THIS http://clojuredocs.org/quickref/Clojure%20Core to effectively use it.. wtf
16:56llasramha
16:56ZekkaA lot of the unfamiiar parts of Haskell are actually familiar things reified in a way you wouldn't expect
16:56ZekkaBut learning how Haskell treats them is really hard sometimes
16:56Zekkai.e. instead of globals you have Reader
16:57Zekkaso you still have the familiar concept of globals, but you have to understand them in terms of strategies for function composition
16:57lysergide___After doing some haskell clojure looks super easy
16:57ZekkaAnd that last thing is the unfamiliar part
16:57lysergide___Because you already learnt the concepts
16:57ZekkaClojure is much more like the languages you've probably already worked with than Haskell is
16:57arrdemSagiCZ: counterpoint because clojuredocs is comparatively out of date.. http://grimoire.arrdem.com/
16:57lysergide___I find it greate that I can use Java’s libraries
16:57ZekkaI don't personally like it as much but it's more of a taste judgment IMHO
16:58lysergide___I hate java’s syntax but the libraries are so great
16:58boxedzekka: clojure is a lot easier to ease into. Haskell is a lot of “all these things or you can’t do shit”… or at least that’s my experience from trying Real World Haskell and some online tutorials
16:58SagiCZbut java's syntax has 5 times less keywords..
16:58Zekkaboxed: That's pretty accurate
16:59Zekkayou really need to understand the idea of offloading things to your data types before you can write neat code in it
16:59Zekkaand if you don't understand that it just feels like ugly, inflexible Scheme
16:59boxedbut clojure is annoying in that every function potentiallt has it’s own syntax
16:59SagiCZboxed: +1
17:00ZekkaYou actually get most of the semantics you want pretty easily once you understand that
17:00technomancyevery form you mean?
17:00Zekkaalthough a lot of people justifiably argue that in large programs State becomes pretty ugly
17:00lysergide___It is the power of clojure to have a lot of keywords.
17:00technomancycertainly not every function
17:00SagiCZZekka: are you talking about haskell or clojure
17:00ZekkaSagiCZ: Haskell
17:00SagiCZok
17:01hyPiRionllasram: I'm just in the middle of Haskell learning atm. The immutability is rather easy due to Clojure nature. Type system was easy to comprehend, monads took some time to grok (not yet finished with the different monad types).
17:01ZekkaI used 'Scheme' because it's a mostly-pure language that doesn't do a lot of the things Haskell does AFAIK in terms of offloading work to i.e. composition strategies
17:01boxedtechnomancy: probably… but to me as a nood the difference between “form” and “function” sounds like academic wankery and not a useful difference :P
17:01Zekka(when I say 'composition strategy' substitute 'monad', 'category', 'applicative', or 'arrow' based on personal preference and/or degree of knowledge)
17:01SagiCZlysergide___: well they are not effectively keywords or reserved words.. just core functions or macros really.. but there is just too many of them and nobody tells you which of them necessary
17:01arrdemboxed: wat
17:01JaoodhyPiRion: are you going to write a monad tutorial?
17:01hyPiRionJaood: I've written 5 already
17:01technomancyboxed: well, forms that aren't functions are pretty rare in good code
17:01boxedtechnomancy: well, the binding stuff for functions makes every function it’s own syntax
17:01Jaood;)
17:01llasramhyPiRion: Cool. I'm thinking of tackling a project where I don't need the JVM, and was considering using it as an excuse to actually learn Haskell. Or maybe OCaml
17:02technomancythat is, unfamiliar forms
17:02ZekkaIMHO Haskell is totally worth learning and it's a really easy language to write good code in once you get used to it
17:02lysergide___SagiCZ: Well I agree with you, and you need to pick up many different books to get Clojure.
17:02technomancyllasram: doooo eeeet
17:02llasramhe
17:02llasramheh even
17:02lysergide___Every tutotial is incomplete
17:02Zekkait kind of makes me sad that it doesn't have more useerbase
17:02lysergide___Ocaml syntax is the worst aha
17:02benkaydoes anyone else suffer from the JVM falling over during uberjar compilation on aws t1 micros?
17:03technomancylysergide___: the precedence rules are a train wreck, but I found "just add parens till it compiles" helped with that
17:03ZekkaOf course you have to get used to the fact that it will train you to casually say things that make no sense to all your friends who don't know it already
17:04Zekkasomeone was quoting the old "monads are monoids in the domain of endofunctors joke" and I tried to explain what it actually meant, and may have accidentally fried his brain instead
17:04hyPiRionor that lenses are costate comonad coalgebras?
17:06ZekkahyPiRion: I don't think a lot of people on the outside know about lenses.
17:06HodappZekka: Yeah, I tried to explain Haskell to a contractor once and ended up making him lose his job instead.
17:06Hodappoh wel.
17:07systemfaulthahaha
17:07Hodappthat's only partially a joke.
17:07ZekkaWhat's the whole story?
17:08ZekkaMine pretty much tells itself: I explained it in a straightforward fashion using lots of big words that he didn't know and things got worse every time I tried to define them
17:08Hodappwe also had some co-ops (20something college kids in the engineering & comp sci program) that I explained Haskell to, and they found it fascinating.
17:08Hodappthey were much more receptive to new ideas.
17:09HodappI use the term 'new' sometimes a bit jokingly, because sometimes the newest ideas to get through a person's head are some quite old ideas.
17:09ZekkaI have a few friends who are writing haskell code at my recommendation but for some reason they're having trouble getting much expressivity out of it
17:10Zekkathey seem allergic to the idea of offloading design details to types
17:10gfixlerZekka: it's difficult - I'm struggling with kinds at the moment
17:10Zekkai.e. manual reinvention of State, but occasionally writing Reader instead just by accident, and having to wite tons of code to glue everything together
17:10HodappThis fellow mostly just insisted that if it couldn't be expressed in C++ cleanly, you were doing it wrong.
17:10gfixler(thought I was in #haskell for a minute there)
17:11Zekkagfixler: Yeah, I remember you from earlier!
17:11systemfaultHaskell is hard. Took me two weeks of reading to be able to do simple things :(
17:11justin_smithbenkay: any reason you need to create the uberjar on the micro? why not a more powerful machine dedicated to doing the builds?
17:11ZekkaHodapp: Did you write everything in TMP instead then?
17:11gfixlerI'm new to freenode - loving it (#git, #haskell, #vim, #clojure)
17:12zanesWhat’s the right way to terminate any running go routines when working in the REPL?
17:13Hodappgfixler: you'll find some channels you don't like :P
17:13ZekkaIIRC I had very bad experiences with #emacs at least
17:13Zekkaand #cobol is kind of dead
17:13amalloy#emacs is pretty cool. it's just mostly not about emacs
17:14arrdem#emacs is the best offtopic I know of
17:14Zekkaamalloy: Really? They shouted me down three or four times for reasons of "Read the fucking source!" after I had already read the fucking source and found the apparent bug causing my woes
17:14Zekka(my question was basically "is this a config issue or a bug?")
17:15hiredmanamalloy: it's just that no one can be told what emacs is, you have to see it for yourself
17:15lysergide___Emacs sucks hard.
17:15HodappTry asking a conceptual question sometime in #java.
17:15impermanemacs editor at all is not about editor but about "have time with it" ;)
17:15amalloyhah. so when i think #emacs is off topic, it's really just evidence that i don't truly understand emacs
17:15HodappI've found that folks here and in #haskell, for instance, have no problem with conceptual questions.
17:15Hodappin #java they flip their shit.
17:15ZekkaHodapp: Last time I did that they just redefined my problem domain until I quit
17:16HodappZekka: I don't understand, could you give a test case?
17:16impermanlighttable is pretty cool nowadays
17:16justin_smithHodapp: or ask a posix centric (or sometimes even a stack architecture centric) question in ##c
17:16hiredmanit is an osmosis learning lab
17:16Hodappjustin_smith: or do anything else there o_O
17:16justin_smithheh
17:16Hodappgod, what a channel of assholes and drunken idiots
17:16gfixlerHodapp: no worries - there are something like 30 #haskell-* groups to try out :)
17:17ZekkaHodapp: Let's see: the gist was "I want to define a type which can always be constructed based on two numbers." (so I can parameterize another type over it and guarantee my code still works)
17:17ZekkaThey responded with a bunch of flavors of "what if you want to construct it based on a *STRING*?!" though, and explained that I really wanted the factory pattern
17:17mdrogalisOh man, I really want to hop in #java and ask a conceptual question now D:
17:18amalloyguys, complaining about or insulting other freenode channels is just not productive
17:18Zekkanever mind that if I went with the factory pattern I would have exactly the same problem as if I were able to put the constructor in the interface!
17:18amalloyif you don't like ##java or whatever, don't go there
17:18mdrogalisamalloy: Yeeeeah but its fun D:
17:18gfixler#haskell is great for conceptual questions, but you must brace yourself for a torrent of responses
17:19tbaldrid_it all started when when somebody mentioned haskell, we should just ignore that it exists and then we won't have rant sessions in #clojure anymore
17:19Hodappgfixler: oh, I got a torrent of responses in #java, but they were mostly "Test case, or GTFO."
17:19ZekkaSorry: hope I'm wrecking no one's day
17:19Zekka(and that's not an attempt to be snide or flippant)
17:19Hodappamalloy: Why is "don't go there" the only valid choice?
17:20gfixlerNow I want to create a table of responses to various kinds of queries for each group
17:20mdrogalisZekka: Entire day. Ruined. D:
17:20gfixlerI love #clojure, but it's very tied to Java, and so are a huge portion of the people using it
17:20Hodappamalloy: And actually, if I convince even one person to not go there and have their time wasted, it in fact _is_ productive.
17:21gfixlerpercentagewise, I think java programmers outnumber all other kinds
17:21gfixlerI've really never used Java, and I'm not a big fan of OO anymore (did my 10 years of fighting that monster)
17:21ZekkaI'm working in Clojure specifically as a part of working in Java, so I'm one of those
17:21gfixlerbut when I come into #clojure often, it feels like there's a lot of java-y stuff being discussed (which makes sense)
17:21amalloythere are lots of valid choices, Hodapp. construct an altar in your closet to some dark gods and call down their wrath on ##java or whatever, for all i care. just don't clutter up #clojure with complaints - they don't make anyone happier
17:21Zekkaour app is largely Java with significant Clojure parts, but if push came to shove we would generally use more Java over more Clojure
17:22Hodappamalloy: If you don't care, then why are you cluttering up #clojure with complaints?
17:22hyPiRionHodapp: He didn't say he didn't care though, he just said he didn't mind you setting up an altar
17:22amalloyi'm trying to keep #clojure on-topic, constructive, and friendly
17:23Hodappgfixler: yeah, I am definitely over using OO as the default, go-to method for attacking problems.
17:23gfixlerI see amalloy in here constantly, always helping out and furthering discussions (not that amalloy needs defending)
17:24ZekkaHodapp: Although I think the goals of OO are pretty cool
17:24HodappZekka: the goals and the original work are quite interesting
17:24impermanamalloy: +1, I'ts better to create some #clojure-flame for other purposes
17:24rurumateI need a fn that takes as input two arbitrary functions f and g, and returns (fn [x y] (and (f x) (g y))
17:24amalloyis clojerks still around?
17:24mdrogalisamalloy: Ahaha, what's that?
17:24HodappZekka: ever read some of Alan Kay's work, or the "Programming as experience" paper on the Self language?
17:25amalloyrurumate: you're almost there! just write one more right-paren, and you'll have written the function you wanted!
17:25ZekkaHodapp: I don't think so: I've read some of Kay's interviews but I don't think I've read any essays/books by him
17:25rurumateamalloy: yes, but it's not variadic yet, like and
17:25Zekkarurumate: Well, how do you want to make it variadic?
17:25amalloyhuh? you said the number two, your example has exactly two things
17:26rurumatealso, I need this operation for or. it's getting tedious, this seems to be a general thing to do
17:26ZekkaDo you want to alternate applications of f and g to the list of args?
17:26amalloywhat function are you actually trying to write, if two is not what you want
17:26ZekkaDo you want to take a variable number of functions and result in a function that takes that many args?
17:27rurumateI want something for two at this moment, but when I start using it I'm gonna need 3-arg version too
17:27gfixlerrurumate: we're all wondering where f and g are coming from
17:27amalloybut what does the three-argument version *do*? your example is too specific to exactly two args; it's not clear in what direction you hope for it to generalize
17:27ZekkaHe already said
17:28Zekka(fn [f g] (fn [x y] (and (f x) (g y))))
17:28amalloywhich is what Zekka is asking
17:28ZekkaHe wants to generalize this pattern
17:28ZekkaAt least I think that's what he wants
17:28rurumateyes Zekka
17:28hyPiRionrurumate: If you decide f and x, then (fn [& fns] (fn [& args] (every? true? (map #(%1 %2) fns args)))) takes a list of functions and returns that function you wanted (sans checking correct amount of input vars)
17:28Zekkait seems to me like your answer lies in the domain of map and apply
17:29amalloysure. but do you N functions and M args? N functions and two args? N functions and N args? two functions and N args?
17:29rurumateyes, soemthing like map
17:29hyPiRionf and g*
17:30rurumateyes, I want more arguments than just the two of f and g
17:31gfixlerrurumate: do you want to pass pass in functions and get back a function that takes arguments, or vice versa, or pass in all the functions and arguments at once and get back a result?
17:32rurumateI just want and to "work as expected" on fns
17:32justin_smithamalloy: mdrogalis: if you mean clojerks as in the portland, or clojure meetup group, yeah, we still meet (though some think the name should change)
17:32amalloyjustin_smith: really i couldn't remember what clojerks actually was, the name just sounded appropriate
17:33justin_smithheh
17:33rurumatesomething like creating new predicates from existing ones, by ANDing them
17:34rurumatethink of f and g as predicates or truth functions
17:35rurumatethat should be EASY, but it's a lot of work with standard clojure
17:35ZekkaI think hyPiRion's looks pretty simple and correct
17:36zoldarHi. Is anyone able to use om 0.6.4 (or any post 0.5.0 for that matter) along with austin repl? there seems to be conflict in requirements for a particular clojurescript version.
17:36rurumateit's not obviously correct. there should be something more accessible
17:36Zekkawith the exception that I think you can use 'and' instead of 'every? true?''
17:36ZekkaWell, wait, I don't think you can use and without 'apply'
17:36Zekkarurumate: I'm not sure how you would simplify it
17:37rurumateok then
17:37technomancyamalloy: it's where you go to complain about jira to keep this channel positive
17:37ZekkaI'm not a Clojure expert, of course
17:37rurumatebut this is basic stuff, it should be in some standard library at least.. no fun writing it over and over everywhere
17:37hyPiRionrurumate: so you want something more evident, is that it?
17:37rurumateI just want that stuff to "already exist"
17:37hyPiRionah
17:38rurumateit's kina low level
17:38amalloyrurumate: what you're asking for is clojure.core/every-pred, except that as i said it's not clear what the relation between x/y and f/g is once you go beyond two args each. if you want pairwise correspondence, then fine, that's what hyPiRion did
17:38ZekkaI'm tempted to write out the Haskell definition here because in Haskell at least it's one of those functions that looks too small to factor out
17:38rurumateamalloy: cheers
17:38Zekkabut this isn't really a Haskell channel
17:39amalloyZekka: sure, it's even easier in haskell, of course
17:39Zekkaamalloy: Although not very safe.
17:39amalloyand $ zipWith ($) fs xs -- right?
17:39Zekkait's as safe as the Clojure version but you would expect it to be safer
17:39Zekkaamalloy: Yeah, with optional point-free
17:40amalloyoh, sure
17:40amalloynice. so just: and . zipWith ($)
17:40amalloyor...not quite. ugh. composing functions with more than one arg always trips me up
17:40ZekkaI think it's actually nontrivial to get rid of the fs, let me check with lambdabot
17:40ZekkaI think it ma be (and .) . (zipWith ($)) but I'm not sure
17:41ZekkaYeah, it is, although you probably s houldn't write it that way
17:41Zekkajust eta out the xs and leave the fs alone
17:43Zekkaamalloy: A lot of people take pointlessness far too far. It's a bad habit!
17:43technomancyjust maximize your juxt usage and you should be good
17:44ZekkaIf you really like writing pointless code, switch to Java.
17:46nullptrIf you really like pointless tools writing pointless code for you, switch to Java.
17:46rurumateamalloy: yes there was a mistake in my original expression, there should be no y but only x
17:47amalloyAUGH. and you couldn't say that after the many requests to clarify? the whole time the function you wanted was just every-pred
17:47rurumatesorry, I meant (fn [x] (and (f x) (g x)))
17:47rurumateyes
17:48hyPiRionoh well, at least it's sorted out
17:48cespareHow can I read a file to a byte[]?
17:48amalloywell, at least the question got answered. five points from rurumate for obstinacy and a few from hyPiRion and Zekka for answering an unclear question nistead of getting it clarified
17:48hyPiRionhorray!
17:49ZekkaPretty sure the word was 'from'
17:49Zekkaso technically we should be upset
17:50Zekkaamalloy: Strangely enough, someone had a near-identical problem in #haskell earlier this morning, and once again they were asking for something other than what they wanted
17:50rurumateZekka: b-but clojure was written in javaD
17:51hyPiRionZekka: I consider that as a compliment from amalloy.
17:51Zekka(they actually wanted folds)
17:51amalloyZekka: new game idea: ask a vague question in one irc channel. take the answer, and ask it as a new question in the irc channel for a different language
17:51rurumateshould we not be thankful for the world class garbage collection that the jvm provides?
17:52systemfaultJava is fine… haters gonna hate.
17:52technomancyamalloy: you're really taking this "freenode as a distributed multiplayer text adventure puzzle game" thing to its logical conclusion.
17:52hyPiRionrurumate: I'm actually not sure if you refer to the garbage collector or the collection of garbage that the jvm provides.
17:52brehautz-machine as implemented by IRC users
17:53ghadishaybanhttps://twitter.com/shipilev/status/491610175284183040
17:53amalloy(inc hyPiRion)
17:53lazybot⇒ 39
17:53rurumatejava is so cool. they have lucene. and storm
17:53hiredmanghadishayban: heh
17:54technomancy"I've seen things you people wouldn't believe ..."
17:54hiredmanI use emacs on Compiler.java all the time
17:55Zekkacespare: Slurp gets you a string, I'm not sure how to get a byte[] right offhand, though
17:55Zekkalet me do a little googling
17:55amalloyghadishayban: that tweet alerted me to the use of //*/ in Compiler.java, which i had never noticed before
17:55cespareZekka: found a fairly crappy looking function on SO that nevertheless works, and I only need this for checking something in a repl real quick, so I'm good.
17:55cesparethanks
17:55amalloywhat an interesting solution to the self-imposed problem of "i have no idea if my file contains comments"
17:56Zekkacespare: *Should* be dead easy -- I'm surprised if it's not
17:56hiredmanwhat does //*/ do?
17:56gtrakwhoa
17:57amalloyhiredman: it's a lexer trick: "if i'm inside a /* block already, then close it; otherwise, do nothing"
17:57gtrakit comments the comment
17:57cespareZekka: writing using clojure.io.java/output-stream is certainly dead-easy. The inverse is harder because you have to bring your own buffer for the .read call, so I think a loop a required to do it properly.
17:57hiredmanamalloy: pffft
17:57hiredmanjesus
17:58ghadishaybanthat's awesome
17:58hiredmanman's machine mediated inhumanity to man
18:02amalloyhiredman: introduced via https://github.com/clojure/clojure/commit/2c57f4b5cbb5608905f45cccad3958de51c62590#diff-1, which is practically performance art
18:03hyPiRionI'm glad it's not normal to allow nested comments.
18:03technomancyif you're stuck writing java, the least you can do is make it an art form
18:04technomancy(says the guy who has never written java)
18:04amalloytechnomancy: that would explain the creative indentation in clojure/lang
18:04hoverbeartechnomancy: And good on you
18:05technomancyI have led a sheltered life.
18:05Zekkatechnomancy: Personal experience has been that it introduces a ton of "right way"/"sane way" tradeoffs
18:05technomancyprobably couldn't hack it on the streets
18:05Zekkawhere conceptualizing a problem the Java way requires you to lose flexibility and neatness
18:06Zekkaso it's actually a really hard language to write well IMHO
18:06gfixlerwe used to call the /*/ stuff "tie-fighter comments"
18:06hoverbeargfixler: Insulting to tie-fighters
18:06technomancyZekka: I've heard others say it's the opposite, because it forces you to give up on producing good code. You know from the outset that what you produce will be mediocre.
18:08gfixlerhoverbear: well, such language was common in the Rebellion - it was a different time
18:08gfixlerI don't like java itself, but I like how much thinking has sprung up because of java
18:08gfixlerjava seems really hard to write, so a lot of really strong tooling and thinking has come out of it
18:09gfixlerall of the TDD, refactoring, clean coding, design patterns stuff seems to swell from java springs
18:09hyPiRiongfixler: oh, that made me realise why Go has such good tooling
18:09gfixlerhaha
18:09gfixlerI grabbed a copy of Head First Design Patterns, and sighed when I realized it was all Java examples
18:10gfixlerand then learned that other languages don't need many/most of the design patterns
18:10systemfaultBecause Java is the “classic” OOP language.
18:10gfixlermany of them mitigate all-oo, all-the-time issues
18:11gfixlerthe examples had lines like WeatherStation weatherStation = new WeatherStation (weatherstation, alsoweatherstation)
18:11gfixlerand I was like "How does anyone do anything in this language?"
18:11hoverbearI've been growingly interested in Rust lately.
18:11hoverbearNo OO junk
18:11gfixlerI think it was Bob Martin who showed an example of some code he converted from Java to Ruby
18:11gfixlerit was 7x smaller
18:11gfixlerthe difference between a screen of code and 7 screens of code is big
18:12hoverbearHuge
18:12gfixlernot that tiny is always great
18:12technomancya systems language written by someone who has actually researched the existing landscape before designing their own? how novel! =)
18:12ZekkaSome of my pals who used to write tons of low-level code are huge Rust fans
18:12systemfault10 times slower and 2 times less reliable :P
18:12gfixlerI can't figure out what is going on with J examples posted to /r/dailyprogramming, e.g.
18:12Zekkaso I'd say based on their appraisals that it's probably pretty cool
18:12hoverbeartechnomancy: Someones!
18:12Zekkagfixler: J's an APL relative, right?
18:12gfixlerthat's why I'm loving Clojure and Haskell - much more expressive
18:12hyPiRionZekka: yes. It's like APL without the greek characters
18:12gfixlerZekka: I think so, but I'm not convinced it really exists, and that I'm not being trolled
18:12hoverbeargfixler: I like haskell but I find Cabal is huge let down
18:13ZekkaOne of my friends actually works in APL: he's a huge fan of it
18:13gfixlerhoverbear: that's what I'm hearing; haven't experienced it yet personally
18:13gfixleralso, I have some first-hand experience now of what happens when you move away from OO
18:13ZekkaI've gotten the rough impression that it's tied really closely to the problem domain ("manipulate matrices or go home") but I haven't worked in it
18:13gfixler11 classes shrinking down to none, and then turning into some functions and a couple of maps
18:13gfixlerand seeing orders of magnitude more/less everything in positive ways
18:14hoverbeargfixler: Lein, comparatively, is frigging brilliant. ( technomancy )
18:14gfixleractually finishing tricky things, implementing 3 new tricky things in a few hours, unexpectedly
18:14gfixlertons of reuse
18:14gfixleractual reuse, it's amazing
18:15gfixlerhoverbear: I'm using Lein in very tiny ways; I need further investigation
18:15gfixlerdoes it download and install dependencies for you? (it seems so)
18:15hoverbeargfixler: Yeah, automatically. Plugins too.
18:16gfixlerI just finished up about 2 years of deep-diving into dependencies and DAGs
18:16gfixlerthey've been in my face for more than a decade in my job, and I've always fought them
18:16hoverbearI love not having to do some stupid stuff like `npm install` or `bundle install` (Heaven forbid I have to code in Ruby, frick)
18:16gfixlerthey're in everyone's face
18:16gfixlermany don't know it
18:16gfixlernow I have crazy ideas about how I wish it all worked
18:17gfixlerthings like - nothing should be able to import from above itself
18:17hoverbearI'm really interested in seeing how Cargo (Rust's package manager) turns out... It's made by the folks who made bundler... So I'm not expecting much
18:17gfixlerI don't like dependencies traveling upward
18:17gfixlerthat means no PATH, which is completely nuts
18:17gfixlerthe dependencies we never have problems with are the things directly in our project trees
18:18technomancyhoverbear: yeah that was pretty discouraging to hear
18:18gfixlerthe end game there is that everything becomes a member of a project
18:18hoverbeargfixler: We've got some Ruby code running on 1.9.3... It took one of our coders over 3 months to update to 1.9.3 from 1.9.2
18:18gfixlerthat's the logical extreme - no dependencies, everything local
18:18hoverbeartechnomancy: They should have got you :)
18:18gfixlerof course, we don't want to copy everything from everywhere, so we use symlinks for files and directories
18:18hoverbeartechnomancy: If it's any consolation, Cargo doesn't support versions yet.
18:19technomancyhoverbear: yeah, that was a huge "doesn't understand the problem" red flag
18:19technomancy"because things are changing quickly, there is no way to lock to a specific version"
18:19Zekkahoverbear: Developers wouldn't break compatibility!
18:19gfixleralso, I don't really love tags and releases
18:19ZekkaThat'd be terribly impolite!
18:19technomancyum... hello? quick change is exactly when you need locking to specific versions the most.
18:19hyPiRionhoverbear: well, that sounds like the Golang way
18:19hoverbeartechnomancy: Well I understand the reasoning. Most Rust projects right now won't compile on a compiler from last week anyways.
18:19gfixlerthis is a murkier area, but if we had a gitOS, everything could be a unique thing in the universe
18:20hoverbeargfixler: nixOS
18:20technomancyhyPiRion: rust had such a great track record of avoiding the foolish design mistakes of google go up to that point
18:20gfixlerif you needed a dependency, you'd pull the entire project
18:20hoverbeartechnomancy: Remember, Cargo isn't done, hell it's not even beta.
18:20gfixlerthere would be some place for all git(-like) repos
18:20gfixlerand everything would refer to things in submodule fashion
18:20technomancyhoverbear: you can't retroactively apply a DTRT mindset in things like that
18:21hoverbeartechnomancy: DTRT?
18:21gfixlerbut, the gitOS would check things out internally to a project
18:21technomancypeople *still* put "version X or greater" in their gem declarations and it's been known for the better part of a decade how harmful that is
18:21technomancyhoverbear: Do The Right Thing
18:21gfixlerso /gitos/proj/<hash>/
18:21gfixlerand then your project would symlink that in
18:21gfixlerand another could symlink in /gitos/proj/<hash2>/
18:21technomancyif you can't bother to get it right at the start, there's not a lot of hope
18:21hoverbeartechnomancy: Yeah. The only reason they released Cargo when they did is because it became as capable as `Cargo-lite`
18:22gfixlerif 3 prjects need to symlink the same thing, they symlink the same checkout
18:22gfixlergitOS would handle this internally
18:22hoverbeartechnomancy: I have high hopes, but I suspect Cargo will languish.
18:22hyPiRiontechnomancy: I get this feeling that every single language must have at least one wart
18:22gfixleralso, anything that's the same between two checkouts would be symlinked
18:22gfixleror hard linked
18:22gfixlerhard links would allow reference counting
18:23technomancyhyPiRion: at least it helps me justify the fact that I'm not paying attention to rust when it seems promising in most other aspects
18:23technomancynot having persistent data structures is a pretty big hindrance though
18:23gfixlerthere are some weird benefits - there could be hash trackers online that track hashes to projects
18:23hoverbeartechnomancy: What do you mean?
18:24gfixlerso if you need a particular commit, it could figure out from a tracker which project that is and pull the whole thing into the gitOS, check out that one into that project, and symlink it in
18:25gfixlerI also want this at the langauge level, somehow
18:25amalloygfixler: i honestly can't tell if you're describing a utopia or a dystopia
18:25gfixleramalloy: me either
18:25amalloyi'm pretty sure it's not in the middle, though
18:25hoverbeardystopia
18:26amalloyit sounds that way to me, hoverbear, but he sounds so enthusiastic
18:26gfixleramalloy: it's a thought exercise
18:26hoverbearI shudder in horror at the thought of Git integrated into my OS
18:26gfixlerhoverbear: I don't literally mean git, but something with that beautiful data model
18:27hoverbeargfixler: Look at nixOS, seriously.
18:27gfixlerhoverbear: I thought you made that up
18:27hyPiRiontechnomancy: yeah, that was the one big issue I have with it. I found it hard to implement them myself last time I tried too.
18:27hoverbearhyPiRion: In Rust?
18:28hyPiRionhoverbear: yup (persistent data structures)
18:28hoverbearhyPiRion: When abouts was this?
18:29hyPiRionhoverbear: this was a long time ago, last year sometime
18:30hoverbearhyPiRion: The language is very, very different now
18:30technomancyeven though I know ocaml will probably not have as bright of a future as rust, at least it has persistent data structures
18:30technomancyand way better type inference
18:30hoverbeartechnomancy: You realize they use the same algorithm yeah?
18:30technomancyhoverbear: from the examples I've seen, rust needs a lot more spoon-feeding
18:30hoverbeartechnomancy: It does. :)
18:31hoverbeartechnomancy: They've improving it quite a bit.
18:31gfixlerhoverbear: nixOS looks pretty impressive
18:31hoverbearA patch that landed Sunday night removed like 60% of lifetime annotations
18:31hoverbeargfixler: Looks cool to me
18:32technomancyhoverbear: rust certainly has much more low-hanging fruit and easy fixes ahead of it =)
18:33hoverbeartechnomancy: I agree. I think it has some great potential, though.
18:33hoverbearI certainly like the ideas it's touting.
18:33technomancyhoverbear: I agree, and I'm glad if it takes off
18:33technomancyespecially if it means fewer people writing C and google go
18:34hoverbearExactly
18:34hoverbearI'd rather see Rust then C.
18:34technomancyI've heard there's potential for it to be used in microcontrollers
18:34brehauthigh bar
18:34technomancywhich would make me pretty happy
18:35hoverbeartechnomancy: I was playing with that actually, really cool. I like how you can use it without the stdlib
18:35hoverbeartechnomancy: I'm interested in using it for init
18:36technomancywait, have you got it running on a microcontroller? arm or what?
18:36mirfdon't speak
18:36mirfI know
18:36mirfjust wjut yur sayin
18:36mirf9don't (say it) cos it hurts)
18:36hyPiRionhoverbear: Looks like there's potential in the persistent data structure land. Not sure how transients work out, but I think it's possible with unsafe.
18:37mirfhi crank1988
18:37hoverbeartechnomancy: You can use it on an Arduino Due
18:37hoverbearI don't have a Due, though.
18:37technomancyhoverbear: that's arm?
18:37hoverbeartechnomancy: ATMega
18:37technomancyhuh
18:37technomancyhoverbear: it says here it's an atmel cortex m3
18:38aperiodichoverbear, technomancy: no, the Due is an ARM board
18:38technomancyI've got a cortex m4 board in my closet
18:38hoverbeartechnomancy: Whoops, yeah, Due is ARM, sorry. I have an ATMega
18:38mirfdue or die
18:38mirfit's all the same
18:39technomancyhoverbear: is this still a "you need to be a rust expert to get it to compile" stage?
18:39technomancyfor a uc specificaly
18:40hoverbeartechnomancy: You'll want to be on the #rust irc channel, but you don't need ot be an expert
18:40technomancysuper tempting!
18:40hoverbeartechnomancy: I'd be happy to work with you on it
18:41hoverbear(For those wondering what Rust looks like doing simple tasks: https://github.com/hoverbear/rust-rosetta )
18:41justin_smithtechnomancy: just think how much better your keyboard could be with a 64 core coprocessor attached http://www.parallella.org/board/
18:41technomancyjustin_smith: I was toying with the idea of building one around a 100MHz sparc core board with an onboard GPS receiver that I kickstarted
18:41hoverbeartechnomancy: Type by moving the keyboard?
18:42technomancyhehe
18:42technomancyhttps://www.indiegogo.com/projects/navspark-arduino-compatible-with-gps-gnss-receiver too bad the toolchain is a hopeless mess
18:43hoverbeartechnomancy: Rust has actually been splitting their stdlib into "std" and "core"... Core will run freestanding.
18:44technomancy"The current version supports only static memory allocation and no stack pointer safety checks." hmm... sounds pretty raw
18:45technomancyOTOH keyboard firmware doesn't need malloc
18:45hoverbeartechnomancy: Just started happening like 1 or 2 weeks ago
18:48technomancyhm; the thing is if I switch to ARM I was going to pick back up on my forth implementation
18:48technomancysince then I'd get a repl for free
18:56justin_smithI'm amazed there isn't a tiny forth for arm already
18:56technomancyjustin_smith: there are a few for arm. there's only one for avr, and I can't really use it because of reasons.
18:56hiredmanarm isn't low end enough to interest people who write forth
18:57justin_smithor ubiquitous enough (x86)
18:58Frozenlock"Ran 5 tests containing 3 assertions." Uh.... I should have many more assertions than this. Has anyone had experiences with tests ignoring assertions? What was causing it?
18:59amalloyFrozenlock: bet you a nickel you're doing something lazy, like (for [x xs] (is (zero? x)))
18:59FrozenlockNo, unless the lazyness is hidden deep within my code.
19:03amalloywell, my attempt to telepathically hack into your mind and guess what your code is has failed, Frozenlock. so you'll need to ask something more specific than "tests don't run"
19:04FrozenlockI know. I'm staring at the screen trying to figure out what might be good info.
19:05justin_smithFrozenlock: first you could verify whether all the test namespaces are loaded
19:06Frozenlockjustin_smith: I'm not testing all the namespaces, just one in the repl. Calling the test directly or using run-tests doesn't work.
19:06Frozenlockhttps://www.refheap.com/88475
19:06justin_smithand you have loaded the latest version of the test ns?
19:06FrozenlockYes. Closed the jvm, started it again...
19:07FrozenlockErr the grammar fail in that paste.
19:07justin_smithand how are you requiring the test ns?
19:08justin_smithis there a chance the test ns has the same name as some other ns?
19:08Frozenlockctrl-c alt-k
19:08FrozenlockI doubt it, but I'll look.
19:09FrozenlockWell, at least this fails (deftest dummy-test (is (= 1 0)))
19:09technomancywhen in doubt, bisect
19:12FrozenlockOh I think I found it. Wait for it....
19:12justin_smithwaiting...
19:12FrozenlockAh no, still nothing :-(
19:12FrozenlockI should write tests for my tests.
19:14justin_smithtake a point of failure out, what happens when you manually run lein test rather than relying on editor tooling?
19:23bbloomdoes anybody know if the extra colon in the protocols in the URIs for datomic's connect function are a "thing" or just something datomic made up? http://docs.datomic.com/clojure/index.html#datomic.api/connect
19:23FrozenlockOk, it seems I have a NullPointerException somewhere. Good to know that an exception isn't enough to make a test fails.
19:23bbloomi've never seen "sub-protocols" in uris or whatever
19:23amalloybbloom: jdbc uses subprotocols for its connections
19:23Frozenlock*make it fail even
19:23amalloyjdbc:postgres:whatever or something
19:24bbloomamalloy: crazy, since java.net.URI doesn't parse them...
19:24bbloomtreats them as "protocolSpecificPart"
19:24amalloywell, that's what they are
19:25Jabberzso organization of compojure routes -- do you group them all together in a single handler ns, or break them apart into separate ns's for collection of logical routes for different pages/capabilities
19:25bbloomi guess so, but there's no method to get parse out the sub protocol specifically or to get the full protocol w/ subprotocol
19:25amalloyjava.net.URI doesn't know about the datomic: protocol, so all it can say is "it's a URI whose scheme is datomic, and then some more stuff i don't understand, maybe ask someone who knows about datomic"
19:25amalloybbloom: huh? just take out the protocol-specific part, which will be like "riak://whatever", and parse that as a uri
19:26bbloomamalloy: ah, i guess that makes sense
19:37justin_smithJabberz: I have often used a pseudo mvc thing, where there is an ns for each "controller", and each route is an "action" defined by that controller
19:37justin_smithand a set of routes are handled by a given controller and its actions
19:38justin_smith(technically I wasn't using compojure for this, but the concept is general enough to apply across routing libraries here)
19:45Jabberzjustin_smith: ah yeah, i think that's where the compojure-app template kinda leads you to too
19:52Jabberzso for webapp auth solutions -- is lib-noir or friend preferred these days? looks like friend is the most popular/maintained?
19:53justin_smithyeah, I think lib-noir is much less popular
20:08amalloyis lib-noir even an auth solution?
20:11xcthulhuNo, it’s not
20:11xcthulhuYou are probably going to have to break your mind with friend
20:12xcthulhuGL
20:12xcthulhufriend != simple made easy
20:13Jabberzyeah i meant more in terms of gluing things together with lib-noir session handling, but don't really want to go down that road
20:13Jabberzis there another alternative?
20:13xcthulhuWell, this is the modern auth middleware https://github.com/cemerick/friend
20:13Jaoodroll your own ;)
20:14xcthulhu(this is what I am complaining about)
20:14Frozenlockxcthulhu has a point, friend is a little cryptic.
20:14xcthulhuYeah, but lib-noir is deprecated
20:14FrozenlockIf it's for a toy-like application, just roll your own with lib-noir.
20:14Jaoodthe clojure community is not as webish as python/ruby/hs
20:14Jaoodjs
20:14xcthulhuCompojure security is a sad place
20:15kristofIs it sad, or just insecure?
20:15Frozenlockxcthulhu: lib-noir isn't deprecated https://github.com/noir-clojure/lib-noir
20:16xcthulhuI suppose noir is deprecated, random parts of it live on
20:16FrozenlockNot 'random' parts. The best parts :-D
20:16kristofJaood: That surprises me, because a lot of the Conj talks are web related and server/client side software seem to be the niche this community's going for
20:16boxedJaood: ruby has historically been a security nightmare :P
20:17boxedbut I guess that’s pretty webish.. ^_-
20:17zanesWhat determines when println sends to nrepl-server vs cider-repp?
20:21justin_smithzanes: the binding of *out* at the point where the printing happens
20:22zanesjustin_smith: So, if I’m using http-kit with callbacks and printlns inside the callbacks are going to nrepl-server that means http-kit is somehow rebinding *out*?
20:25amalloyzanes: more like it's *not* rebinding out. nrepl works by rebinding *out* in some clever way or other while you're at the repl, but that binding does not carry over to the other threads running your callbacks, and so you just get the default printing behavior
20:26zanesamalloy: Super helpful! Thanks!
20:26xcthulhuamalloy: If you just do (bind [*out* -whatever-] …) it’s threadsafe
20:27kristofxcthulhu: How does it make it thread safe?
20:27xcthulhuI don’t know. But I ran into this today
20:27kristofxcthulhu: So binding should be thread-safe too, right?
20:27xcthulhuShould, yeah
20:27kristofI gotta look at the source for that, that's interesting
20:28xcthulhuIf you don’t want it to be threadsafe, try (with-redefs [*out* -whatever-] …)
20:28xcthulhu(which is what I ended up doing)
20:28amalloywhat you guys are writing makes no sense. it is not related to zanes's situation at all aside from mentioning *out*
20:29kristofI was just asking a question about bind and binding.
20:29xcthulhuYeah
20:30xcthulhuI suppose I should be saying “thread-local”
20:30xcthulhuRather than thread-safe
20:31amalloyyes. thread-safe is not well-defined in this context. thread-local is true but, again, not related to the question i was answering
20:32xcthulhuI was really talking with kristof… I’m sorry if I offended you
20:32kristofWoah, now I'm confused.
20:33kristofWhat I meant was that if I establish a dynamic binding in a goroutine, and that goroutine gets parked, and ends up on say a *different* thread, that special variable will still have the same dynamic binding
20:33kristofTHAT's what I meant by "thread-safe".
20:35xcthulhuI think if A passes a dynamic variable to B, and B rebinds it (using bind), A won’t notice
20:35xcthulhuNot sure
20:35amalloykristof: that's certainly not true for (binding [...] (go ...)), but it probably is true for (go ... (binding [...] ...))
20:36xcthulhuerm binding
20:39kristofamalloy: I don't think it's true for the latter, either. If there's a put or a take from a channel in the body of that binding in the second example, and that entire block is 1) parked 2) later rescheduled on a different machine thread, then the binding should be different
20:39kristofamalloy: Because if I understand correctly, dynamic bindings are stored on the TLS
20:40amalloykristof: yes, but go does all kinds of form rewriting. it probably turns that binding into something else, which it re-establishes each time it un-parks
20:41kristofamalloy: I'll look for what it does when it parses the symbol 'binding, but I wouldn't bet that it does anything special
20:45amalloyi guess there wouldn't be much point, would there - what i'm proposing would just be the same as let
20:49numbertenis there a clean way to take two strings x y and get [(head y)] ++ x ++ (tail y)?
20:49numbertenthe shortest solutions I could think of make lots of ugly lazy seqs which don't string well :(
20:50amalloy(str (subs y 0 1) x (subs y 1)) sounds right
20:50amalloy,((fn [x y] (str (subs y 0 1) x (subs y 1))) "hello" "world")
20:50clojurebot"whelloorld"
20:52numbertenwasn't familiar with subs
20:52numbertenthat's nice
20:52numbertenthanks :)
20:53kristofnumberten: How do you normally get substrings?
20:53numbertenshould have thought to use more string specific functions
20:53kristof:P
20:53nullptr,(clojure.string/replace "world" #"(\w)(\w*)" "$1hello$2")
20:53numberten**shame**
20:53clojurebot"whelloorld"
20:54nullptr"never do cleanly with functions that which may be grotesquely expressed with a regular expression"
20:54brehautwhere is my table flipping emoticon
20:54blur3dDoes anyone know of a clojure TCP library other then ztellman/aleph for low level stuff? I really dislike lamina. Otherwise it looks like I’ll write my own using java interop
20:55technomancylmao if you don't have M-x tableflip configured in your irc client
20:55justin_smithblur3d: what about http-kit?
20:56justin_smithwell never mind, that's http not tcp
20:56justin_smithobviously
20:56blur3djustin_smith: this is for the same project as yesterday… so I’m hoping to write simple adapters for tcp/udp/serial
20:56amalloyblur3d: probably just java.nio
20:57blur3daleph supports tcp/udp (I have serial apready), but it doesn’t sit well with me
20:57blur3daleady’
20:59blur3dhmm, I might give aleph a go, and then look at java.nio
20:59TEttinger,((fn [x y] (clojure.string/replace y #"(\w)(\w*)" (str "$1" x "$2"))) "hello" "world")
20:59clojurebot"whelloorld"
20:59amalloyTEttinger: and if x is "$1"?
20:59blur3dperhaps a tcp/udp library that supports core.async would be nice to write
21:00TEttinger,((fn [x y] (clojure.string/replace y #"(\w)(\w*)" (str "$1" x "$2"))) "$1" "world")
21:00clojurebot"wworld"
21:00amalloy(hint: you want java.util.regex.Matcher/quoteReplacement)
21:08boxedanyone want to read the readme for https://github.com/boxed/instar ? I just rewrote it but it’s 3AM here and I’m not totally sure I’m 100% coherent
21:09boxedplus… blind to flaws at home
21:10boxedthanks
21:12tuftlooks good to me -- neat lib
21:13boxedtuft: cool. It’s born out of my pain :P
21:15mthvedtboxed: readme looks good
21:15boxedmthvedt: thanks
21:16mthvedtboxed: can you return the favor? i’m planning to ANN this tomorrow: https://github.com/mthvedt/qarth
21:16amalloyboxed: (update-in {:foo {:bar {:baz 1}}} [:foo :bar] #(dissoc % :baz)) should just be (update-in {:foo {:bar {:baz 1}}} [:foo :bar] dissoc :baz) - if you're planning to show that your function is better than the built-in, you should use the built-in well to be convincing
21:17gfixlerboxed: looks nice; I made something along these lines for Python a couple of years ago
21:17boxedamalloy: ah, my bad, I’ll fix
21:18boxedgfixler: on
21:18amalloyalso, this style makes it hard (impossible?) to store the function assoc itself in a map
21:18mthvedtor anyone else is welcome also :P
21:18boxedgfixler: on github or something?
21:18amalloyor any function, really, since you assume it's an update
21:18gfixlerboxed: no, unfortunately it's company-internal
21:19gfixlerpython's mutable, so it just modified in-place
21:19gfixlerbut it used paths and wildcards
21:19boxedamalloy: not impossible, just ugly :P but yea, I made the decision that it’s probably worth it to do that tradeoff
21:20boxedgfixler: pity.. would have been nice to combine with something like pyrsistent
21:20gfixleryou could Tree() or Tree({'a':{'b':{'c'}}})
21:20gfixlerand tree.grow('/a/b/c'), which would grow any parts that didn't exist as new dicts
21:20boxedamalloy: the update-in example is fixed now, thanks
21:20amalloyamusingly, you're also in a weird spot if i do something like (let [* unchecked-multiply] (transform m [:x *] * 10))
21:21gfixlertree.grow('/a/b/c', 42) to make the terminal an int
21:21amalloyer, #(* 10 %) in your style, i mean
21:21gfixlerbut also tree.search('/a/?/c'), or tree.search('/a/*/c') for recursive path part finding
21:22gfixlerit returned triples - (path, terminal key, value) - so you could do for path, key, val in tree.search(...):
21:22boxedamalloy: heh, yea well… also a tradeoff…
21:22gfixlerhad grafting, pruning, cloning, etc
21:22kristofboxed: ^ so you should change your wildcard to _
21:22gfixlerfun stuff
21:23boxedkristof: well, then I’d have to change the name and also learn how to write macros I believe
21:24amalloyanyway, the wildcard stuff is cool. i don't love that you're comparing functions to each other; that's the cause of both problems i noted. but, sure, it probably makes things convenient. personally, i prefer the tradeoffs that update-in and friends use (like the ability to use varargs as i suggested you do in your update-in example), but i can see some people liking your way
21:24gfixlertree.search could also take a leaf parameter, which was a value predicate, which made it easy to grab all paths to particular values
21:25boxedamalloy: well I can probably do the varargs thing anyway, but I’d have to redo this as macros…
21:25gfixlersomething like tree.search('/a/*/c/?', leaf=lambda key, val: key.startswith('foo') and val > 42)
21:25boxedgfixler: neat… I’ve thought about doing predicates for instar but I didn’t have a usecase for it myself so I haven’t bothered yet
21:26gfixlerI forget the method now - prune, maybe - worked just like search, but instead of triples, it returns a filtered version of the tere
21:27gfixlertree*
21:27gfixlerso you could tree.prune('a/*/c').pretty() to see the reduced tree pretty printed out, e.g.
21:28gfixlertrees had a hidden __root__, too, for metadata about the tree - that was always fussy to keep working right, though
21:28gfixlerbut if you did a tree('/path/to/JSON/file'), it would tuck the filename in the root, and then after modifications, you could tree.plant()
21:28gfixleror at any point tree.plant('some/path')
21:29gfixlertree.prune('/a/?/c/').plant('smallerTree.json')
21:29gfixlerit was all very convenient
21:30boxedcute with “plant”
21:30gfixlertree.prune('*', leaf=lambda k,v:type(v)=int).plant('justTheInts')
21:30gfixleryeah, I called the whole thing ficus - the genus of the figs
21:31gfixlertiny bonsais up to 100' tall trees, and they also like to strangle other things and destroy sidewalks, which seemed fair warning to anyone using it
21:32boxedgfixler: funny story… a phychologist friend of mine had a lecture once about a man who had ficus-fobia :P
21:33gfixlerwow
21:33gfixlerit's an impressive spread of species - benjamin figs in everyone's offices, rubber tree plants, enormous banyan trees, all ficus
21:33boxedI think the point of the lecture was something like “you need to keep a straight face no matter what crazy shit you hear, it’s still a patient that needs help” :P
21:33gfixler:)
21:34gfixlerfolks here are still using ficus, but I haven't in more than a year
21:34gfixlerI've moved on to immutability, and very flat dicts where possible
21:34boxedgfixler: have you seen this: https://github.com/tobgu/pyrsistent ? Made by a collegue of mine
21:35gfixlerboxed: I appreciate the attempts to unify the formats and simplify expression
21:35gfixlerboxed: looks interesting
21:36gfixlerI'm stuck in Python for work - it's integrated into our main application - so any attempts to bring immutability to it are appreciated
21:36boxedgfixler: “I appreciate the attempts to unify the formats and simplify expression” <- in relation to instar? you switched context pretty fast
21:36gfixlersorry, yes
21:36boxedcool thanks :P
21:37gfixlerI have a question for the room about refs, agents, vars, and atoms
21:37gfixlerI don't know enough about them yet to know if this is even a good question
21:37gfixlerbut I've been wondering if underneath they're not all actually the same thing
21:38gfixlerand that it's really just some behavioral or implementation details that make them entirely separate constructs
21:38gfixlerwould it be possible to unify any or all of them into a single concept?
21:39justin_smithgfixler: definitely not the same thing
21:40gfixlere.g. ref is for transactional changes (correct me where I'm wrong, please)
21:40gfixlerbut couldn't that just be (transaction ref ref)?
21:41gfixleri.e. transaction is some kind of wrapper you put around some code to make it all work or fail together
21:42justin_smiththey have different update rules (sequencing/locking vs. check/retry vs. change and hope nothing broke)
21:43justin_smithagents don't retry, and do enter a failure state
21:43justin_smithatoms do retry, and have no concept of a failure state
21:43justin_smiththere are many differences in behavior
21:43gfixlerright, but that just sounds like functional programming to em
21:43gfixlerme*
21:44justin_smithgfixler: which one?
21:44justin_smithyou get to choose one of the behavior sets
21:44gfixlerthings would be uncoordinated by default, unless you put them into a coordination context
21:44gfixlerit could even be a kind of binding in that case
21:45gfixler(transact [a ref1 b ref2] (- 5 a) (+ 5 b))
21:45gfixlerso coordination wouldn't be a property of the thing, but a construct of the function applying the changes
21:45gfixlerthat feels more FP to me
21:46gfixlerit's strange to me that coordination exists in the objects - that feels OO, and at the wrong level
21:47justin_smithgfixler: then you are back in the world of java, where it is up to each user of an object to respect the invariants (lock the right thing when accessing the shared value etc.). The point here is the right (semantically clean) thing is the easy default, but you have different reference types for when different conventions of update make sense.
21:48gfixlerI see - I don't come from a Java world, and I've not had to think about coordination in my work, so it's a new area for me
21:48justin_smithis what you are doing pure and retryable? use an atom. Is it impure but commutative? you probably want an agent
21:48justin_smithI am vastly oversimplifying here though
21:48gfixleryou're speaking in FP terms, though
21:48gfixler"what you are doing" sounds like a function
21:49gfixlermaybe right now I want a transactional thing with two refs that must change atomically
21:49gfixlerbut later I might not care
21:50justin_smiththen don't focus on the container, focus on the values, and use the right reference type for the behaviors you want
21:50nathan7You're using a type to capture a property of a value.
21:50justin_smithput it in a ref now, an atom later, if the semantics need to change
21:50gfixlerok
21:50nathan7The container type signifies its properties.
21:50gfixlerI was missing that bit
21:50gfixlerso you deref out of one and drop it into another?
21:51justin_smithif you really need to change up the behaviors - but I actually find that pretty rare in practice
21:51nathan7the semantics will likely change only your code changes
21:51nathan7not at runtime
21:51gfixlersure, I'm realizing this is probably mostly theoretical talk
21:51justin_smithgfixler: in haskell, you don't conflate the mondads you use with the values that flow through them, I hope
21:52gfixlernathan7: I get that the container type signifies the properties, but that feels very OO
21:52justin_smithsimilarly, you shouldn't conflate the reference type which controls the update semantics with the value they store
21:52gfixlerRich talks about FP when he talks about these things
21:52gfixlerit just felt more FP to choose the behaviors at the function level
21:52gfixleras needed
21:52gfixlerjustin_smith: haven't made it to monads yet :(
21:53gfixlerI'm up to kinds, having just grokked functors
21:53justin_smithOK, I only brought it up because you mentioned haskell before
21:53nathan7gfixler: I'm quite familiar with Haskell's type system
21:53nathan7gfixler: so to me this seems very much in the functional realm
21:54gfixlernathan7: I might be able to see that
21:54gfixlerif I think of the containers more like constructed types
21:54nathan7Yeah. That's the trick.
21:54gfixlerthe 4 types feel like vehicles, or payload systems
21:55nathan7They're boxes for state.
21:55gfixlerload a value into them, and then fire them off into some function
21:55justin_smithgfixler: simpler analogy: you decide whether to put your string in a vector vs. lazy-seq vs. hash-map depending on how the values should flow through your code - this is all a separate thing from the fact that it is an immutible string, and you pick the container with the behavior characteristics you need
21:55gfixlerjustin_smith: that's a good comparison
21:55justin_smithgfixler: similarly, if you need an updatable reference type, you again choose the one with the properties and behaviors you need
21:56gfixlerI think the thing that was bugging me was the idea of "forever"
21:56gfixlerlike if I (def foo (atom 0)) then foo is *always* an atom
21:56gfixlerbut you could just as easily slide the value out of there and into something else
21:56justin_smithright
21:57gfixleror even let it into something else
21:57gfixlerI get the practicality of the 4 types
21:57gfixlerand I even understand if it's an implementation thing - it's just hard to not do it as 4 types, e.g.
21:58gfixlerbut it felt less pure than just (def foo 5)
21:58gfixlera name pointing at a value
21:58gfixlerand then determining how that would work in tandem with other values on-the-fly
21:58gfixlerfunctionally
21:58justin_smithwell, that is the least pure thing in clojure, since vars can be rebound (we just know they shouldn't be)
21:58gfixlersure
21:58zanesWith core.async, if I have an asynchronous process that generates channels over time and I want to read from any of them as they’re available what’s the best way to do that? merge? mix?
21:58boxedit’s nice not being able to fuck up too.. and binding it strongly to atom/ref/whatever makes fuckups explode instead of subtly break
21:59jack_rabbitSo, I've included [org.slf4j/slf4j-log4j12 "1.7.7"] and [org.clojure/tools.logging "0.2.6"] in my project.clj, but when I (log/*anything*) on the repl, nothing happens. I'm sure I'm doing something stupid.
21:59boxedsometimes complecting a little bit is a good thing :P
21:59gfixlerzanes: one thing I haven't considered was not being inside the context
22:00zanesgfixler: Sorry, what?
22:00gfixlerzanes: you bring up a good point about getting values over time
22:00justin_smithgfixler: he wasn't talking about your issue
22:00gfixlerjustin_smith: lol, it made sense in my head
22:00justin_smith:) but sure, core.async channels are another way of representing / coordinating values over time
22:01gfixlerwell, it made me think of 'over time' as a problem
22:01justin_smithgfixler: if you get abstract enough, everything is always relevant
22:01gfixlerif I (def foo 5) and (def bar 7), then want to transactionally change them the way I was saying with (transact <changes to foo and bar>)
22:01gfixlerthen I have to stay inside of that over time if I want to keep seeing what they're doing
22:01gfixlerjustin_smith: touche
22:02gfixlerso that would be a problem with what I was proposing about purely functional properties
22:03brehautgfixler: just to check: you know that putting refs into vars is not really best practise eh
22:03gfixlerbrehaut: I don't know all that much tbh :)
22:03gfixlerI'm speaking well about my station currently
22:03gfixlers/about/above
22:04gfixlerI've only used atoms so far, but I've read up a bit on the other 3
22:04gfixlerI just wanted to ask about this, because it's been on my mind since earlier this year, when I was reading through JoC
22:04justin_smithgfixler: in some ways core.async channels can be considered a fourth :) though they are more conduits for values than containers of course
22:06kristofthey are containing conduits that implement control
22:09gfixlerI appreciate all the answers - I make tools and pipelines for artists (games), so I have no web/scalability/async experience
22:09gfixlerI just find it all very interesting
22:09kristofgfixler: You're right, sort of. The functions are responsible for the coordination, not the datatypes.
22:10gfredericksI want to go to bed has anybody asked about the ambiguity of transit supporting vanilla json?
22:10kristofgfixler: A ref does not do its coordination, a compare-and-swap function does, on arguments that happen to be within the same ref
22:10kristofgfixler: The thing is that when you establish data structures that need to be coordinated in some way, that coordination philosophy is intimately tied to the logic, and your logic is never going to change.
22:11gfixlerkristof: that makes sense
22:12gfixlerThe other thought I had was that 'coordinated', 'asynchronous', etc could just be metadata on regular variables
22:12kristofgfixler: Why would a collection of values that make a ref suddenly not need synchronized, coordinated update?
22:12kristofgfixler: You're missing "synchronous".
22:13kristofgfixler: "Coordinated" implies it's coordinated with another variable. You'd have to store all the variables it's coordinated with. And then... you just reinvented the ref data type.
22:14zanesRelated: Not understanding the difference between >!! and put!.
22:14gfixlerkristof: that could be something I've not understood properly
22:14gfixlerI've been thinking of these types the way I used atom, with a value inside
22:14kristofzanes: Who is?
22:14zaneskristof: I’m not!
22:14gfixlernot as large collections of distinct things
22:15kristofzanes: A goroutine is a little (fn [] body) that gets passed around from thread to thread by a threadpool scheduler
22:15zanesYeah, that much I understand.
22:16amalloygfixler: also it's kinda impossible to do what you were suggesting, to start with atoms and then if you need coordination wrap them up in some coordinator context
22:16amalloythe contract that atoms provide is not conducive to coordination - you can't coordinate them externally
22:16kristofzanes: Wait, are you talking about ">!!" and ">!"?
22:17zaneskristof: No, I’m talking about ">!!" and "put!”.
22:17gfixleramalloy: impossible with atoms as they exist, or even in concept?
22:17kristofzanes: put! is nonblocking
22:17zanesAh! Okay.
22:17zanesSo it’s more or less equivalent to using >! inside a go block?
22:17kristofzanes: Works exactly like >!
22:18amalloygfixler: as in, if your primitives are "a mutable cell, deref, swap!, and reset!", you cannot write a function like dosync
22:18gfixleramalloy: my simple example is (def accountA 10) and (def accountB 10) and I want to transfer 5 from A to B
22:18amalloythat is, something that takes two atoms and performs a single coordinated transaction across them
22:18gfixleramalloy: I'm not sure that what you're saying isn't just implemenation specific, though
22:18gfixlerI agree atoms as they exist can't do this, or probably can't
22:19amalloyuhhhh, i'm not talking about an implementation, i'm talking about any implementation of the atom contract, which is deref, swap, reset
22:19gfixlerthat's a kind of implementation, though
22:19amalloyi don't see any way you could combine those primitives to build something that acts like the refs we have today
22:19gfixlerthat contract
22:20amalloy...it's how atoms are defined. you could say "we could do X with atoms if only atoms were a different thing", but what's the point? you could use spaghetti noodles instead of atoms, if we gave them good enough coordination guarantees
22:20gfixlerhaha
22:20justin_smithgfixler: what is there to an atom aside from the behavioral guarantees described?
22:20gfixlerI didn't mean to get you all worked up :)
22:21gfixlerjustin_smith: nothing, but my point isn't these existing constructs
22:21amalloygetting worked up is a hobby
22:21seangroveCan't quite get clj-time to give me the right format - (.toString (clj-time.core/now)) => "2014-07-23T02:16:49.620Z", when I want "2014-07-23T02:16:49+07:00"
22:21alandipertamalloy, you can rewrite refs and dosync into an atom + swap with some rewriting; scope becomes a map in the atom. the difference is dynamism i think - refs can be added any time
22:21gfixlerit was name=value and then coordinating changes in different ways on them, functionally
22:21seangrove(no milliseconds and the timezone)
22:21gfixlerinstead of as properties on the names that point to the values
22:21gfixlerthat's all
22:22gfixleramalloy: it's good to have a hobby
22:22amalloyalandipert: i don't think so. not without leaking your transactions into other threads who are reading while you're writing
22:22Jaoodamalloy: he needs some concurrency 101
22:22justin_smithgfixler: I just don't understand what you would even mean by "atom" if you were not describing those behaviors. There are different reference types because they have different behaviors for access, update, and synchronization.
22:22gfixlerjustin_smith: I'm actually talking about throwing out the term atom (not really - just as a thought exercise)
22:22amalloyi'd be interested to be proven wrong
22:22alandipertamalloy, oh right, and throughput - all threads would need to go through the same atom
22:22gfixleryou guys keep talking about behavior, but won't let me make that a functional thing
22:23justin_smithgfixler: in that case our conversation has no basis - I thought we were comparing the various clojure reference types
22:23gfixleryou keep making properties of objects and containers
22:23gfixlerjustin_smith: I'm using them as a starting point
22:23gfixlerfor the behaviors they describe
22:24gfixlerI like the structural sharing thing
22:24justin_smithThey *are* the behaviors they describe. There is nothing else there to talk about. The point is that they describe behaviors that are not unifiable into a single thing.
22:24gfixlerand the necessary double-referencing required by that
22:24amalloyalandipert: i'm confused. are you saying that it's possible to write macros and/or functions named "ref", "dosync", and "alter" that give you ref-like behavior on top of atoms without making you change anything compared to using refs as they are now?
22:25gfixlermy name actually points to a particular moment in time in the life of a value
22:25amalloyor that you can rewrite your whole app to use atoms instead of refs
22:25alandipertamalloy, i'm not fully convinced, but i went through some exercises to this end
22:25alandipertamalloy, and i surprised myself with what new possibilities emerged when the environment is static
22:25gfixlerbut if I needed to change two values pointed to in an atomic way, I could imagine doing that functionally, maybe
22:26gfixlerI could be wrong, of course
22:26JaoodI really haven't seen refs used much in clojure, what libraries out there use them?
22:26amalloyJaood: you'll never need a ref
22:26alandipertamalloy, to clarify, this isn't anything possible in clojure currently lol
22:26alandipertamalloy, or at least, this would involve a whole-program macro :-)
22:27amalloyright. obviously you can do everything with atoms if you rewrite the whole program
22:27Jaoodamalloy: why is that?
22:27amalloywhy will you never need a ref?
22:27JaoodI know STM hasn't been much of a success
22:27Jaoodamalloy: yeah
22:28blur3dI’ve given up on using aleph (and never touching again)… onto java.nio
22:28ztellmanblur3d any particular reason?
22:28amalloyalandipert: you can do everything with lambda calculus if you rewrite the whole program. but gfixler was talking about some sort of combinator that glues two atoms together and gets you something like a ref (or at least i thought so at the time; apparently he was just talking in general about mutation)
22:29justin_smithamalloy: do you have a link to a blog post that gets into the details of demonstrating that / why you never need a ref?
22:29alandipertjustin_smith, datomic.com
22:29alandipert:-)
22:29alandipertamalloy, gotcha, sorry for traipsing in and blathering
22:30justin_smithalandipert: so you mean use datomic as a data store instead of using refs?
22:30ztellmanblur3d: fwiw, I'm on the cusp of rewriting Aleph to use https://github.com/ztellman/manifold instead
22:30kristofzanes: I'm a dirty liar. put! is the exact same as >!! for two arguments.
22:30blur3dztellman: everytime I touch it I seem to hit dead ends. I had trouble with UDP broadcasting working correctly the first time, and now I’m finding working with tcp more difficult then I’d like it
22:30gfixleramalloy: well, I was questioning whether or not it was possible to have one reference type, and then get the behaviors of the current 4 by functional application
22:30gfixlerso obviously I was throwing out the 4 existing types
22:30alandipertjustin_smith, right, datomic is a competitor because it offers in-memory storage
22:31gfixlerthe point was basically "Couldn't we just achieve the same thing with functional wrappers?"
22:31ztellmanblur3d: well, sorry to hear that
22:31alandipertjustin_smith, the cost is ease of use - you lose the idea of a collection when you invest in datomic
22:31alandipertjustin_smith, the benefit is, with minor modification whatever you made can be durable
22:31gfixleri.e. you wouldn't decide on a type up front, but decide on coordination and such later, when you did something with them
22:31hiredmansome guy published a thesis paper recently about building resuable composable concurrent stuff, which had some similar sorts of things like fusing atoms together
22:31ztellmannot sure what the issue with UDP broadcasting would be, it's just a flag
22:31gfixlerit may not make any sense logically, which is why I asked the room about it
22:31alandipertjustin_smith, also it's proprietary and stuff which may or may not appeal to you
22:32justin_smithalandipert: yeah, I've considered datomic before and did run up against the licensing
22:32blur3dztellman: I am also trying to do a few things that I wouldn’t expect it to support out of the box - like using 7 bit bytes - so it isn’t entirely the libraries fault
22:32alandipertjustin_smith, the free version is quite capable as of recently-ish
22:33ztellmanblur3d: ha, yeah, that'll cause a few impedance mismatches, but ideally Aleph should be a much thinner wrapper around the protocols than it currently is
22:33justin_smithblur3d: any good reason not to just use a jvm byte and truncate it to a positive value? there's your seven bits
22:33blur3dztellman: UDP was likely related to https://github.com/ztellman/aleph/pull/96 - but I haven’t tested it since
22:33hiredmanhttps://www.mpi-sws.org/~turon/turon-thesis.pdf
22:34blur3djustin_smith: I’m building on top of the Arduino Firmata library, so just going with what it uses
22:34justin_smithahh
22:34alandiperthiredman, this looks like an incredible find
22:34justin_smithblur3d: yeah, you need it to actually be 7 bits on the wire or whatever then
22:34hiredmanalandipert: just aesthetically it is a beautiful pdf
22:35blur3djustin_smith: yeah, the 8th bit is used for control chars
22:35alandiperthiredman, i was gonna say, it's a marvel of typesetting
22:35blur3djustin_smith: http://firmata.org/wiki/V2.3ProtocolDetails
22:35justin_smithblur3d: OK, use the absolute value, and multiply * -1 if you need the control bit to be set
22:35hiredmanlike, he must have figured out the concurrency stuff in a year and spent the rest of the time futzing with latex
22:36justin_smithblur3d: since everything is signed in the jvm integral types
22:36amalloyjustin_smith: i got disconnected. i tried to say:
22:36blur3djustin_smith: I actually have all the data stuff working using https://github.com/peterschwarz/clj-firmata - but its the transfer that I’m working on atm
22:36amalloyjustin_smith: i mean, refs are more powerful than atoms, so in theory you could be in a situation where one makes your life simpler; i can't prove you'll never need one
22:36amalloyall i can say is "lots of people who've written a lot of clojure agree you never need a ref", which is only slightly more interesting than an argument from authority
22:37amalloyand of course "never" is in quotes, because who knows, it could happen someday. but usually if it does it means you wrote the rest of your program poorly
22:37justin_smithblur3d: also, mind that there is extensive midi support in the jvm
22:37justin_smithamalloy: OK, I do trust your judgment on this, I was honestly interested in reading an in depth post or article on the subject though
22:37blur3djustin_smith: nice to know. Firmata uses a superset of the MIDI - but for my use I am more using the superset
22:37justin_smithamalloy: maybe it's a blog post you need to make
22:39amalloyi don't know of one; hiredman might? he's another member of the Campaign Against Ref [E-something - i couldn't come up with the rest of this acronym but it's a shame to waste]
22:40amalloyEnnoblement seems too grandiose
22:40gfixleramalloy: so wait, I only need to learn 3 of these things now?
22:40kristofzanes: The difference is that for 3 arguments, or 4 with a 4th that isn't nil, you can call a function as well. That's really it.
22:40justin_smithblur3d: when I most recently played with low level data on the jvm (I made a simple real time audio maniuplation engine), I found java.nio.ByteBuffer really useful for getting bits out of and back into twiddly little formats
22:41amalloygfixler: probably. but refs are a fun theoretical study anyway
22:41gfixlerwell, if there are only 3 now, I don't feel the need to turn them into functional wrappers ;)
22:41amalloyhah
22:41gfixler4 was just too many
22:42amalloyvars are rarely used for mutable constructs anyway; they're mostly just for changing top-level defs at the repl
22:42gfixlerdid my point ever end up making any sense, btw?
22:42hiredmanthe one place we use a ref instead of atom it is because we have this side effect thing that we do in an agent, and transactions hold agent sends until they commit
22:43amalloyCampaign Against Ref Evangelism! how did i miss that?
22:43justin_smithblur3d: http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html - lets you grab the next N bytes and treat them as whatever datatype you need, or insert whatever datatype as the next N bytes - but below 8 bits you need to do some masking / AND ing whathaveyou
22:44hiredmanI suspect more people write data processing jobs than large multithreaded simulations
22:45hiredmandata processing tends to be sort of logically single threaded, with sort of parallel data processing combinators, like mapreduce, so some kind of coordinated transaction stuff doesn't really make sense
22:47hiredmanwe can't all write systems that simulate national elections via sythesizing music
22:53alandiperthiredman, i've found transactionality very lucrative in the browser in cljs
22:54alandipertvia cells and the spreadsheet approach, it's a kind of reverse transaction i guess since it's all 'push', but you have the same consistency guarantees
22:55alandipertbad for IO-bound stuff but fortunately that's not even possible in the browser
22:55hiredmanalandipert: which is interesting, it may just be that the stm doesn't get used because people do more backend server work on the jvm than guis
22:56alandiperthiredman, yeah my feeling is like you say, people are doing processing or interacting with a DB
22:56alandipertbut yeah, transactions are killer for UI, because there's only ever data (not process) behind a UI, and it needs to be coordinated
22:56hiredmanthe cannonical stm example, the ants simulation, uses the stm to take consistent snapshots to render a gui "report" (if I recall correctly)
23:00alandiperthiredman, the situation we ran into taht motivate transactions was 'the pregnancy test' - present a form in which is was impossible to indicate you were both male and pregnant, under any circumstance
23:04sitrusI was wondering if anyone knew of a way for running all of the tests in a namespace multiple times. I have two *Contexts* that I want to run through but can't find a way to have tests repeat after running
23:04hiredmansitrus: using clojure.test?
23:05justin_smithsitrus: what I do is put multiple is calls in a defn, and call that function in different contexts (sometimes it makes sense to make the contaxt an arg to the function even)
23:05hiredmansitrus: (use-fixtures :once (fn [f] (f) (f))) should do it
23:05justin_smithif a deftest calls a function with calls to is, the tests are noted properly by the runner
23:05hiredmanyou can setup different things around each call to f
23:07hiredmanhttp://dev.clojure.org/jira/browse/CLJ-701?focusedCommentId=35148&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-35148 I am excited about this, I've wanted to be able to do hoisting kinds of things in the compiler for a long time
23:08hiredmanI want to turn letfns that aren't used in a higher order way in to methods too
23:08sitrusso hiredman I'm currently using (use-fixtures :once…) to set the context for that particular run of the file, would there be a way to have it run each of the deftests multiple times with different functions
23:09hiredmansitrus: a once fixture gets passed a function that when invoked runs the tests
23:09hiredmanif you invoke it multiple times, it will run multiple times
23:10hiredmanif you setup a different binding or with-redefs around each call to the function, each run of the tests will have different environment setup by the binding or with-redefs
23:11sitrusthank you! I'm going to take a stab at it now!
23:41Jaoodis there a function that removes only the first occurrence of some item in a collection?
23:44nkozoJaood: (rest [1 2 3]) => (2 3)
23:45Jaoodnkozo: heh
23:46RaynesJaood: Also ##(next [1 2 3])
23:46lazybot⇒ (2 3)
23:46nkozosorry, misread
23:46sm0keis there some way to preserve collection type?
23:46Raynes99% of the time you don't want to preserve collection type
23:47Raynes1% of the time you have to use whatever functions are native to that collection.
23:47RaynesOr functions like 'conj' that Do The Right Thing.
23:47sm0kethere should be a conj equvivalent for rest too then?
23:47JaoodI mean some like remove or filter but only for the first match
23:47sm0kelike conj is for cons
23:48Jaood,(remove #('a %) '[b c a d a f])
23:48clojurebot(b c a d a ...)
23:48sm0ke,(conj [1 2 3] 4)
23:48clojurebot[1 2 3 4]
23:48sm0ke,(conj {:a 1} [:b 2])
23:48clojurebot{:b 2, :a 1}
23:49Jaood,(remove #(= 'a %) '[b c a d a f g])
23:49clojurebot(b c d f g)
23:49justin_smithJaood: remove expects a predicate, a symbol used as a function does get (just as a keyword would) so will not return true for the same symbol
23:49Jaoodjustin_smith: fixed ^^
23:49nkozobut that removes all occurrences
23:49JaoodRaynes: like that example but I only want to remove the first 'a for example
23:50JaoodI can write this but clojure.core has so many fns and was wandering if there is already something for it
23:52nkozo,(let [[a b] (split-with #(not= 3 %) [1 2 3 4 5 6])] (concat a (rest b)))
23:52clojurebot(1 2 4 5 6)
23:53justin_smithnkozo: nice
23:54justin_smith,(let [[a [_ & b]] (split-with #(not= 3 %) [1 2 3 4 5 6])] (concat a b))
23:54clojurebot(1 2 4 5 6)
23:54justin_smithcleaned up a little :)
23:54nkozo:)
23:55justin_smithsince you were destructuring already and all