#clojure logs

2014-05-22

00:22dbaschtechnomancy: one reason to have web documentation is that you cannot use doc to search
00:22technomancydbasch: you can use apropos though
00:23dbaschtechnomancy: if you know that if exists
00:24dbaschand it won’t help you with things like “concatenate strings in clojure"
00:24technomancyright; you have IRC for that =D
00:25technomancyanyway, you won't find that from autogenerated HTML docs
00:25dbaschbut then we have to help beginners instead of talking about random stuff :)
00:25dbaschyou might if enough people use those terms to link to them
00:26jweaversometimes talking about random stuff is helping beginners ;-).
00:44jweaverSo, is everything we type in Clojure a data literal? The code "is" the data? I'm doing a lot of reading on Clojure (learning), and I've read this a number of times. I'm not sure I grok it though
00:45arrdemjweaver: welcome to homoiconic languages.
00:46amalloyjweaver: yes. for example, (+ 1 2) is a list, containing a symbol and two numbers
00:46jweaverWhat is written, is the actual AST... is that a fair statement?
00:46amalloywhen the compiler evaluates that, you get 3; but before evaluation, it's a list
00:46jweaverAhh
00:47amalloyjweaver: eh. not really, re ASTs
00:47jweaverWow
00:48jweaverWell, since it's data, it's like the AST itself right? I mean, it's not trasnformed or anything
00:50amalloyit's a tree, but it's not really *the* AST. there are lots of other things in an AST, since those are generally produced by the compiler as an intermediate structure
00:51jweaverOk
00:53jweaverAfter years of Java OO/Imperative, I'm opening up my mind as much as possible =). It seems simple, very simple. I'll definitely be putting some night time hours into study and practice.
00:54jweaver("it" being clojure)
00:54tolstoyjweaver: A colleague is going through a similar thing.
00:54tolstoyjweaver: Recently, he decided to fire up .Net to make a simple web app and found himself saying, "Man, this is a lot of typing."
00:55jweavertolstoy: Any words of advice?
00:55jweaverhaha =). Nice.
00:56tolstoyAdvice? Hm. Start simple? Write lots of tiny apps that do the one "part" you're interested in, then start putting them together later?
00:57dbaschto be fair, web apps are almost always a lot of typing
00:58quizdryou can save a ton of typing in Clojure by learning all the functions in clojure.core. if you don't know about some of them, you can accidentally end up writing your own to do the same thing.
00:58tolstoyYep. But he told us the story illustrating that despite himself, he kinda crossed a line.
00:58dbaschone day we may not have to use a tree to represent a rectangular screen anymore, that might save some typing
00:59tolstoyquizdr: I do that all the time. Just the other day I realized that my "loop/recur" thing was solved with "every?". ;)
01:00jweaverquizdr: I'll keep that in mind, the clojure docs seem like a good guide (referencing these docs: http://clojure.github.io/clojure/clojure.core-api.html)
01:00jweaverOf course, I end up googling everything anyway.
01:01quizdrvery rarely is loop/recur necessary
01:02jweaverWowah... core.clj is 1 giant file? So I take it breaking these up into separate files has little or no benefit?
01:02jweaver(and by giant, I mean only ~7k lines in total file size)
01:02tolstoyquizdr: Yeah. I generally only use it to get an idea down if I don't know what I really want. More and more: reduce does it all.
01:03quizdri watched an interesting c++ talk by an Adobe engineer yesterday, and even in a language like that he insisted that one should never use raw loop and rely on simple built-in functions instead (of which c++ has quite many now that resemble functional list comprehension)
01:18FareI'm trying to use reflection to access clojure from java
01:19Fareand actually, even before then, I'm trying to run some code using clojure
01:34yediexpectations test framework seems refreshing
01:49servohttps://www.refheap.com/85760
01:49servo#dark
01:50arrdemreasonable, but yes a bit dark
02:01servothe paradigm of looking at the world as a set of entities that have an ability to do something is pretty powerful
02:01servoi mean both protocols and reducers leverage this
02:02servoisn't the definition of a collection an entity that has the ability to be reducible?
02:06amalloyservo: that defrecord Human isn't very thread-safe
02:06TEttingeramalloy: a noose is an unsafe thread for humans too
02:07servoamalloy: can you give me an example of a scenario in which state would cause that record to perform unexpectedly?
02:07servos/state//
02:08amalloypretty much anytime two threads are working with it at once. for example: health is 1, alive is true. two threads both try to hit it for 5. they both discover that it's alive. then they both take away 5 hp, so it's down to -9. then they both see that health is negative so they both toggle alive, and the monster briefly dies before coming back to life
02:08amalloyor, i guess it's a human, not a monster
02:09amalloyreally just imagine two threads progressing through this function in parallel, each executing the same lines at the same time. you don't need any corner cases to mess this one up
02:10servoah
02:10servothank you
02:10amalloygood news, though, sorta: it's *impossible* to keep two separate atoms in sync in a thread-safe way
02:10amalloyso your design was not much worse than any other
02:11servoso ideally i would use refs with dosync correct?
02:11amalloyi'd use one atom, which is a map containing both health and alive. but refs wouldn't be unreasonable
02:12servothat is one thing i often ponder; whether to use one big referenceable identity for state or to split it up into many
02:13mangeservo: Why do you need "alive" to be a separate atom? Can something have positive health and be dead? (Or negative health and be alive?)
02:13servoi've seen where people use one symbol and call it "state" and it represents entire state of application, not sure how idiomatic that is
02:14mangeAnd when I said "atom" there, let's all just pretend I said "value".
02:14servomange: i wanted to use a predicate function :)
02:15mange(comp neg? :health) wasn't any good?
02:16mange... With a deref.
02:16servopedantry aside, yes, that would have worked ;)
02:17mangeYeah, I'm fairly wrong there on the fine details. Sorry about that.
02:21noncomservo: storing all state under one variable is perfectly ok
02:22noncomusually one atom
02:23quizdrservo that is quite idiomatic; afterall, Om, a widely used Clojure(script) library, just does that: a single atom for the entire app
02:23servocool
02:24quizdri think the question comes down to what is more manageable, both for you as a dev but also for the system. multiple atoms that are related to each other can get messy. a single atom is tight.
02:27servoas noted above, i have learned that even two atoms can get messy fairly quickly
02:42amalloyeven one atom can get messy fairly quickly
03:00quizdr`true dat
03:09owl-v-if i'm programming clojure app in embedded system, what is effective way of representing trees and traverse it?
03:24vijaykiranowl-v-: clojure.walk, perhaps ?
03:25vijaykiranowl-v-: there's this - http://www.ibm.com/developerworks/library/j-treevisit/index.html (not sure if it is outdated a bit)
05:14numbertenwhy is this a thing
05:15numberten,('test 1 "wat")
05:15clojurebot"wat"
05:16numberten,('symbol :a :b)
05:16clojurebot:b
05:16numberten,(and :a :b)
05:16clojurebot:b
05:17Glenjamin,[('test {'test :a} "wat") ('test {'not-test :a} "wat")]
05:17clojurebot[:a "wat"]
05:17vijaykiran,(doc and)
05:17clojurebot"([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true."
05:17vijaykiran,(false? :a)
05:17clojurebotfalse
05:18Glenjaminsymbol's IFn is basically (get)
05:18Glenjamin,(doc get)
05:18clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
05:18numbertendon't understand
05:21vijaykirannumberten: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Symbol.java#L127
05:22vijaykiran('blah 1 3) is invoking symbol as the function get
05:22numberteni see
05:22numberten,(get :a :b)
05:22clojurebotnil
05:22numberten,(get 'wat :a :b)
05:22clojurebot:b
05:22vijaykiranyup
05:22numbertenthat's really strange
05:23Glenjaminit allows you to try and get a value from a map, and not blow up when you don't get a map
05:23numberteni assume that's so you can use (symbol coll)
05:23numbertenas shorthand for get
05:23Glenjaminyes
05:24Glenjamin,({'a :b} 'a)
05:24clojurebot:b
05:24Glenjamin,('a {'a :b})
05:24clojurebot:b
05:24Glenjamin,(nil 'a)
05:24clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
05:24Glenjamin,('a nil)
05:24clojurebotnil
05:24numbertenmakes sense
05:25Glenjaminusing the symbol/keyword's IFn is "safer" than calling the map, and shorter than (get)
05:25numberteni keep forgetting that dispatch is only a matter of the type of the first argument
05:25numbertenso ,('a 1 2) was tripping me out
06:13Vinzentreiddraper, hi, could you please take a look at this slightly modified version of `for-all` which I find handy to use? If it looks ok to you, I can send you a patch
06:13Vinzenthttps://www.refheap.com/85769
06:23clgvVinzent: I think that would be only usefull if the let binding can be used in the next for-all binding
06:24clgvVinzent: but for that it is probably better to have a different macro based on for-all
06:28peterdon(def x 1 y 2)
06:28peterdonsorry
06:29Vinzentclgv, yeah it would be cool, although I'm not quite sure how to implement that. Anyway, the version I pasted is just a way to get rid of repetitive (and ...) blocks, since they are required almost in every spec anyway
06:35clgvVinzent: implicit `and`? I doubt that this is a good idea
06:37clgvVinzent: in clojure a list of forms in a macro indicates a `do` somewhere in the macro which indicates either side effects or a programming error
06:39Vinzentclgv, I wouldn't agree it's a general rule. It's only valid for defn-like macros.
06:40VinzentThough, it's arguable whether for-all is (and should be) such one.
06:41clgvVinzent: I don't know of any exception concerning control flow macros.
06:43clgvwhen you test your implementation the properties you test should be explicitly visible
06:46wunkiis it possible to get the `var` of a function?
06:48clgvwunki: from a function instance?
06:48wunkiclgv: I want to get the var in middleware, so it's a handler function
06:48clgvwunki: for functions created via `defn` you can reconstruct the complete symbol and resolve it
06:49wunkiclgv: with ns-resolve?
06:49clgvwunki: reconstructi it from the class name Iwanted to say ^^
06:49Vinzentclgv, in my mind, for-all is closer to defroutes-like macros than to control flow ones. You pass a list of properties, not just an arbitrary body.
06:50clgvVinzent: well that is not how it is implemented and documented so I doubt that. for a test it is certainly defining the control flow similarly to a doseq
06:53Vinzentclgv, sure, I'm talking about the version I pasted, not the one which is currently there. They are not backwards-compatible in this regard
06:54clgvVinzent: I dont think it is useful to have the implicit `and` since this will only lead to accidental errors.
06:55clgvthe point of the test is to convince you or your stakeholders that your implementation works as specified. so I'd try to minimize errors in the test code ;)
06:56Vinzentclgv, implicit and is an implementation detail; you just pass a number of properties to be checked using the provided generators. Think of it as an equivalent of clojure.test/are or something.
06:57clgvyeah well, even there you have to use the `ara`
06:57clgv`are`
07:02Vinzentclgv, and here you have to use `for-all` :) The only way I see it can lead to accidental errors is breaking backwards compatibility and possibly confusing people used to the old version, which is of course a perfectly valid point.
07:06clgvVinzent: I doubt that for-all will be changed like that. maybe a helper macro is included if you manage to convince anyone that it is actually usefull
07:10Vinzentclgv, well, yeah, that's why I just wanted reiddraper to take a look -- maybe it's not that handy at all for other people as it is for me.
07:13quizdr`why the source for async's >! show basically nothing but an assert? https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async.clj#L118
07:15mpenetit's a catch-all for people using it outside of go blocks, I guess in go blocks it gets rewriten
07:15Vinzentquizdr`, I guess all the work is done in the go macro
07:15quizdr`interesting, so the go block sees the symbol >! and uses that for its logic
07:29clgvquizdr`: https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/ioc_macros.clj#L976
07:52noncom|2can i somehow change the directory where clojure looks for ns files when executing (require) ?
07:53Vinzentnoncom|2, :source-paths in your project.clj, if you want this for the whole project
07:53agarmanor you can use the load function directly
07:54agarman,(doc load)
07:54clojurebot"([& paths]); Loads Clojure code from resources in classpath. A path is interpreted as classpath-relative if it begins with a slash or relative to the root directory for the current namespace otherwise."
07:54agarmanthere's also load-file
07:55opensourcegeekhi guys - i'm a newbie with clojure, just started hacking some stuff together. how can I get :b from ({:a 1, :b ({:label "boo" :name "foo"})} :b) => this throws ArityException Wrong number of args (0) passed to: PersistentArrayMap. I know it is something to do with parens after :b
07:55noncom|2so, a few corrections: 1) i am not using lein in this current setup :) and 2) the (load) seems like all paths must be relative either to the CP or the current ns path... umm
07:55noncom|2,(doc load-file)
07:55clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
07:55noncom|2hmm
07:55noncom|2this looks like the solution
07:56numberten,(take 3 (iterate (fn [m] (let [i (rand-int (count m))] (dissoc m i))) {0 :a 1 :b 2 :c}))
07:56clojurebot({0 :a, 1 :b, 2 :c} {0 :a, 2 :c} {0 :a, 2 :c})
07:56numbertenshouldn't the third map have only 1 element in it?
07:57noncom|2,(:b {:a 1, :b ({:label "boo" :name "foo"})})
07:57clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
07:57opensourcegeekI can fix it with (:b {:a 1, :b '({:label "boo" :name "foo"})})
07:57Vinzentopensourcegeek, ({:label "boo" :name "foo"}) is wrong, you want [{:label "boo" :name "foo"}]
07:57noncom|2opensourcegeek: the problem is that the {} in the list is treated like a function
07:57noncom|2you either have to use [] instead of () or '()
07:58opensourcegeek, but it is sent by clj-http
07:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: but in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:58agarmanopensourcegeek: either what Vinzent said or '() instead of ()
07:59opensourcegeekbut when I do (http/get "http://x.com/&quot; {:as :json}) then I get the response automatically coerced to something like above
07:59Vinzentopensourcegeek, read about clojure evaluation process. When clojure encounters a list, it treats its first element as a function. So (1 2 3) is a perfectly valid list, but you'll get an error if you try to evaluate it. ' suspends evaluation, so '(1 2 3) will return just the list (1 2 3) itself.
08:00opensourcegeek(require '[clojure.data.json :as json])
08:01opensourcegeek@Vinzent, I totally get that - but if the library sends me data structure which has embedded parens what do i do?
08:02Vinzentopensourcegeek, don't copy it from the repl :) or quote it if you do
08:02agarmandata won't be evaluated unless you tell clojure to evaluate it
08:02opensourcegeekahhh - makes sense sorry
08:02agarmanopensourcegeek: if you want to copy it into the repl
08:02llasram,(clojure.edn/read-string "(:foo :bar :baz)")
08:02clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.edn>
08:03agarmanopensourcegeek: quote it with '
08:03llasram,(require 'clojure.edn)
08:03clojurebot#<SecurityException java.lang.SecurityException: denied>
08:03llasramhmph
08:03llasram,(read-string "(:foo :bar :baz)") ;; don't dot this for untrusted data
08:03clojurebot(:foo :bar :baz)
08:03opensourcegeekits repl that's printing after evaluating it? - makes sense thanks guys
08:05amatsuI'm trying to transform ["a" "b" "c"] into {:a {:b "c"}}. Is there an easy way to do this? I couldn't find a way to express this with loop+recur.
08:06llasramamatsu: It's not entirely clear what you're trying to achieve from that example. More details?
08:06wunkianyone familiar with fnhouse?
08:06Vinzentamatsu, assoc-in + butlast is the first which comes to mind
08:06CookedGr1phonif that's your exact example, then (defn f [[a b c]] {(keyword a) {(keyword b) c}})
08:07CookedGr1phonmore info if you want something more general
08:09Vinzentamatsu, although, if the collection is always a vector, it's much better to use peek and pop
08:11noncom|2ok so about 15 minutes ago we found that (load) and (load-file) functions would allow me much customization in choosing where from the load the files. but still, what about (require) ? can i change its behavior?
08:11noncom|2the reason is that i do not want to modify the existing code, which already has normal (ns) declarations and replace it with (load) or (load-file) thingie
08:12agarmannoncom|2: have you read (doc require)?
08:12noncom|2,(doc require)
08:13clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents...
08:13agarmannoncom|2: it's too long for irc
08:13agarmannoncom|2: run it in your own repl
08:13noncom|2ok
08:13Vinzentnoncom|2, you probably should use some classpath managing tool. Maybe clojure.java.classpath will do, but I can't help you much further
08:14llasramnoncom|2: What's your ultimate goal?
08:16noncom|2i have some clojure code in its normal form, but I have to load and run it all from a java app, what means that I use Compiler.load() things and such. leiningen is also not an option for the reason
08:16noncom|2while Compiler.load() loads file a namespace, problems begin when that namespace requires some other ones
08:17noncom|2i thought maybe there are some variables in RT that can be altered to help Clojure locate the namespaces
08:17llasramnoncom|2: Ok. What actually want to do is `require` things from the class path, just like normal
08:17noncom|2llasram: yes, but how do I change the classpath so that require will find the files on the classpath?
08:18noncom|2i was looking for that and did not find anything..
08:18llasramRun the JVM with the correct `-cp` option or `CLASSPATH` environment variable?
08:19llasramAnd then you load the Clojure code by calling `require` via the Java Clojure API: https://github.com/damballa/parkour/blob/master/src/java/parkour/hadoop/Mappers.java#L15
08:19noncom|2llasram: not really an option... because 1) it is Dalvik, not a regular JVM 2) the location(s) is(are) not known at the launch time :)
08:19llasramThere a more formal interface in Clojure 1.6, if you're using only 1.6+
08:21llasramnoncom|2: Ah. You might want to mention that first next time :-p
08:21noncom|2llasram: yeah, I was thinking along similar lines as you point out in the example, but requiring the nss from Java also won't work because it presumes that I know what are the namespaces. I only know the "entry point" namespace which then in turn uses (require)
08:21noncom|2actually it uses (ns name-of-it (:require ...) ) just like usual
08:22CookedGr1phonnoncom|2: so are your generating dex at runtime and then want to require it?
08:22llasramI'm about 90% certain that you need to AOT compile the project then ->DEX the generated JVM byte code
08:22noncom|2yes, looks like it. at least Compiler.load() creates a dex
08:22llasramAnd all attempts at runtime loading of Clojure source will utterly fail
08:22CookedGr1phonllasram: not so
08:22noncom|2no-no, all works ok
08:23llasramInteresting
08:23llasramHow?
08:23noncom|2i successfully load a single file
08:23CookedGr1phonthere's a dexer built in to the clojure android clojure fork
08:23noncom|2the only problem that i can't make (require) look for files where i want
08:23llasramAh
08:23llasramInteresting
08:23llasramOOC which project is that in?
08:23noncom|2clojure-android
08:23noncom|2by sattvik
08:23CookedGr1phonnoncom|2: have you looked at where the repl puts its generated dex?
08:24llasramOh, there's a Clojure fork which includes the DEX support
08:24llasramInteresting
08:24llasramApparently I'm finding things very interesting this morning :-)
08:24noncom|2the repl puts the generated dex files where i tell it to put them :) there is a *compile-path* var which i have to set manually in order for Compiler.load() to work at all. i could also use Neko, but for now i am minimal
08:25noncom|2but *compile-path* has nothing to do with (require) or classpath
08:26noncom|2all these things should be easily configurable, i just cant find how.. spent some time digging the sources but don't have an answer yet
08:26noncom|2llasram: good morning :)
08:27CookedGr1phonnoncom|2: I take it you've looked at the neko.compilation namespace for clues already?
08:28CookedGr1phonisn't that all you need to be able to run require statements?
08:29noncom|2CookedGr1phon: yes I have looked there. I did not use it, but visually i can tell it does not have the solution. It only sets *compile-path* - that's already what I am doing by myself
08:30CookedGr1phonand the system property clojure.compile.path
08:30noncom|2i believe that altering the (require) behaviour is not an android-specific thing, it is general for Clojure
08:31noncom|2CookedGr1phon: hmmmmm I might have missed that one
08:44noncom|2CookedGr1phon: so, tried the clojure.compile.path and no, it won't work, the error message says "Could not locate blablabla on classpath:" - with nothing following the colon
08:44noncom|2or it is just the exception colon, nvm
08:44noncom|2but anyway
08:44noncom|2"not found on classpath"
08:48noncom|2CookedGr1phon: so I guess I will have to recursively scan the dir and (load-file) all the files in it first... can't think of another solution.. .except for trying to make a patch for clojrue-android, but diverging from the main here is not a good idea, I suppose...
09:32sojacquesHello everyone!
09:33sojacquesI have a question regarding sessions (for web development)
09:33sojacquesWhat is the suggested library to deal with those
09:33mdrogalissojacques: Fire away.
09:33sojacques? :)
09:33sojacquesMost resources I found mention sandbar, but it has not been updated for more than a couple years
09:34sojacquesand I have a bit of trouble while dealing with Ring sessions (I use Compojure)
09:34mdrogalissojacques: Yeah, Sandbar is ancient. I think Ring itself has some support for sessions, or you can try Luminous or Pedestal.
09:34mdrogalissojacques: Ah, got'cha.
09:34sojacquesmdrogalis: Thank you, I'll have a look!
09:34mdrogalisWhat seems to be the trouble?
09:35sojacquesLet me write a little gist to show you
09:35mdrogalisSure.
09:39sojacquesmdrogalis: better, just found this http://narhinen.net/2013/09/25/Sessions-with-compojure.html
09:40sojacquesWhat I have a trouble to grasp is: Is it possible to do this without using "response" ?
09:40mdrogalisI seriously hate defroutes. A lot.
09:41sojacquesI'm totally open to any alternative!
09:42mdrogalisI don't do a lot of web development. Luminous did seem pretty okay last I looked though.
09:42sojacquesso far, I've been using defroutes because I thought this was the idiomatic way of having composable routes
09:42sojacquesWill be checking into this!
09:43mdrogalisAh, yeah. I mean I don't really see anyone doing it another way, but it's this nasty macro def'ed smack in the middle of the code. That could easily be a data construct.
09:45sojacquesI'm quite new to web development in Clojure, been doing server management tools & data analysis / stats so far
09:45sojacquesso I'm a bit lost here and there
09:46mdrogalissojacques: Understood - sorry, I'm just ranting a bit. You have good tools, you'll pick it all up pretty quickly.
09:46sojacquesI'm reading the doc of Luminus, looks like it will totally do the job
09:46sojacquesThanks!
09:47justin_smithalso, using sessions with ring is very easy - it pretty much comes down to using the session middleware, and then putting / getting session data under the :session key in the request and response
09:49justin_smithin fact I will commonly construct my response object as a series of transformations of the request
09:50mdrogalisNo prob bob.
10:03aelse, (use '[clojure.java.shell :only [sh]]) (sh "free") (sh "top" "-bn1")
10:03clojurebotnil
10:03aelse, (use '[clojure.java.shell :only [sh]]) (sh "free") (sh "top" "-bn1")
10:03clojurebotnil
10:03pentester_i want to break you
10:03pentester_echo hi
10:03lazybothi
10:04pentester_nil
10:04pentester_aelse: what r u trying to do ?
10:04pentester_what language is that
10:04aelseclojure
10:05pentester_how i can write a hello world in clojure?
10:05teslanick(prn "hello world")
10:05teslanick,(prn "hello world")
10:05clojurebot"hello world"\n
10:06pentester_it sucks ..?
10:06teslanickWhat?
10:06clojurebotWhat is sampling a random integers betwen 2, 12 s..t. P(X = i) = (7-|i-7|)/36
10:06pentester_helpme
10:06pentester_help
10:06pentester_!clojure
10:06pentester_clojure
10:06aelse, help
10:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: help in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:06pentester_, ?
10:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ? in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:07teslanickWhat do you need help *with*?
10:07pentester_teslanick: lol
10:07pentester_trying to learn clojure
10:07clgvteslanick: better use println
10:07aelse, (. (Runtime/getRuntime) exec "ls")
10:07clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
10:07clgvpentester_: get one of the books then ;)
10:07pentester_, ('kill me')
10:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: me' in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:07teslanickpentester_: stop.
10:07pentester_, (scanf "hello world")
10:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: scanf in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:07aelse, (use '[clojure.java.shell :only [sh]])
10:07clojurebotnil
10:07pentester_teslanick: y u need me to stop?
10:08aelse, (println (:out (sh "cowsay" "Printing a command-line output")))
10:08clojurebot#<SecurityException java.lang.SecurityException: denied>
10:08teslanickBecause this isn't your own personal repl to stomp on.
10:08aelse, (println (:out (sh "cat" "-" :in "Printing input from stdin with funny chars like ' \" $@ & ")))
10:08clojurebot#<SecurityException java.lang.SecurityException: denied>
10:08aelse, (sh "pwd" :dir "/home/ics/icsdev")
10:08clojurebot#<SecurityException java.lang.SecurityException: denied>
10:08pentester_, (println (ls))
10:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ls in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:09clgvaelse: you wont get shell access on clojurebot ;)
10:09pentester_, (sh "ls")
10:09clojurebot#<SecurityException java.lang.SecurityException: denied>
10:09pentester_, (sh "echo *")
10:09clojurebot#<SecurityException java.lang.SecurityException: denied>
10:09pentester_, (sh "find /")
10:09clojurebot#<SecurityException java.lang.SecurityException: denied>
10:09pentester_why it keep deny me?
10:09pentester_, (sh "date")
10:09clojurebot#<SecurityException java.lang.SecurityException: denied>
10:09teslanickBecause clojurebot/lazybot are both sandboxed.
10:09clgvbecause there is a sandbox which blocks the underlying functionality of `sh`
10:09aelse, (sh "date;echo hi")
10:10clojurebot#<SecurityException java.lang.SecurityException: denied>
10:10aelseokay lets think outside the box
10:10aelsezsh
10:10pentester_or csh?
10:10clgv,(println (java.uti.Date.))
10:10clojurebot#<CompilerException java.lang.ClassNotFoundException: java.uti.Date, compiling:(NO_SOURCE_PATH:0:0)>
10:10pentester_, (csh "ls")
10:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: csh in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:10clgv,(println (java.util.Date.))
10:10clojurebot#inst "2014-05-22T14:05:00.215-00:00"\n
10:10CookedGr1phonaelse: pentester_ go try to break this instead and stop spamming our channel http://clojurescript.net/
10:10CookedGr1phonor at least do it in a private message, you won't get through to anything useful
10:11aelseCookedGr1phon, it has been done
10:11pentester_i want to play here ..
10:12pentester_how to execute command in java?
10:12pentester_rather than using sh ..
10:13CookedGr1phontry typing /quit to exit out into a shell and then you can enter destructive commands to your heart's content
10:13clgvpentester_: you didn't learn anything from your attempts before?
10:13pentester_clgv: just little
10:13aelsepentester_, http://nelsonmorris.net/2012/09/06/breaking-lazybot-out-of-clojail.html
10:14pentester_aelse: thanks ..
10:14sojacquesjustin_smith: Sorry, just saw your reply about sessions
10:14sojacquesjustin_smith: -> in fact I will commonly construct my response object as a series of transformations of the request -> Isn't the usually a String?
10:14pentester_the language is not promising , and java are breakable by default ..
10:14aelse, (:out (clojure.java.shell/sh "whoami"))
10:14clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.java.shell, compiling:(NO_SOURCE_PATH:0:0)>
10:15aelse, (clojail.jvm/jvm-sandbox (fn [] (:out (clojure.java.shell/sh "whoami"))) nil)
10:15clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojail.jvm>
10:15sojacquesjustin_smith: I started from this type of examples: https://github.com/weavejester/compojure
10:19pentester_, (:out (clojure.java.lang.Runtime.exec "whoami"))
10:19clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.java.lang.Runtime.exec, compiling:(NO_SOURCE_PATH:0:0)>
10:20pentester_can someone explain me the return response from clojurebot?
10:20pentester_(. (Runtime/getRuntime) exec "your-command-line-here")
10:20pentester_, (. (Runtime/getRuntime) exec "your-command-line-here")
10:20clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
10:21clgvpentester_: just stop it. there is a sandbox that prevents you from accessing the shell or files or start new processes
10:21clgvpentester_: start your own repl locally and try there
10:21pentester_clgv: stop it? isn't this a challenge which require us to break it?
10:22clgvpentester_: you can do that by privately talking to clojurebot
10:22pentester_kk
10:27quizdr`anyone know a good list of all the various interface one could use with reify to have a type extended?
10:28quizdr`Like IFn etc
10:29clgvquizdr`: the clojure/lang/ directory on github? ;)
10:30clgvquizdr`: without a specific goal you won't get better answers
10:31quizdr`clgv i'm just trying to understand what the basic Java terms would be since I guess you must use them when workign with reify, and I'm curious how it all works
10:32clgvquizdr`: can't follow you...
10:33clgvquizdr`: if you have a specific interop scenario you just use the needed interface with `reify`
10:33quizdr`i was going through a very basic Om tutorial and right away it was using reify so I figured I better learn what's going on there. IFn, etc are Java terms that don't really have meaning for me. So I was looking for a list of other similar terms so I could look up all the various kinds of reify I am likely to encounter
10:34clgvOm is a ClojureScript library, so you shouldnt be forced to learn java ;)
10:34clgvquizdr`: clojure.lang.IFn is a Clojure(Script) implementation detail
10:35quizdr`sure, but it is also used a lot with reify, so it's one of those implementation details I should know about
10:35llasramclgv: I wouldn't say that. As of Clojure 1.6 it's part of the official JVM public API
10:35clgvllasram: but from his point of view it remains some implementation detail ;)
10:36clgvquizdr`: I dont think a list of all java interfaces would help you at all for learning CLJS and Om ;)
10:37quizdr`well a lot of the reify examples are Java not JS so it would help me understand those tutorials, which would help me understand reify
10:38llasramAll reify does is return an instance of an anoymous type which implements the specified interfaces/protocols
10:38clgvquizdr`: but to understand reify you do not need a list of available interfaces ;)
10:38arrdemlol @ pentester_
10:39quizdr`is reify essentially doing the same thing as extend-type, except that the type is anonymous? that is, it's like a single instance of a type that you would not likely re-use?
10:41llasramquizdr`: s,extend-type,deftype, and s,like re-use,need to refer to by type name, But otherwise yes
10:42clgvllasram: lol you need that search-replace feature of lazybot which seems to be turned off ;)
10:42llasramEach instance of `reify` in your code produces a distinct anonymous type at compile-time. Each invocation of the compiled expression produces one instance of that type
10:43quizdr`ok, looking at more examples now
10:43llasramclgv: Eh. I'm not sure a bot repeating w/ replacement would really be that helpful
10:44clgvllasram: well he did this some time ago.
10:45pkothbauerCan anyone help with a simple core.logic noob question? Check this gist: https://gist.github.com/pkothbauer/b77dead2a024055c4dcf
10:50quizdr`has anyone used Datomic with Heroku?
11:07justin_smithquizdr`: I'll bet technomancy will have some input on that
11:39CookedGr1phonIs there such a thing as a first in-last out buffer in core.async?
11:40justin_smithCookedGr1phon: that's the same as last in first out right?
11:40CookedGr1phonyeah
11:43CookedGr1phonso is tehre a last in first out channel buffer?
11:44justin_smithI don't find one, but I think you could make something that behaves that way by pairing up an in channel and an out channel with a vector that you push and pop on respectively based on the channel activity
11:45justin_smith(with special case for empty of course...)
11:50CookedGr1phonthat could work, thanks
11:51clgva dropping stack channel sounds like an exotic use case
11:53pbostromI have a seq of no arg fns, I want to call each fn in the seq, is there an alternative to (map #(%) (fn1 fn2 fn3)), i.e. is there an actual named function that does #(%)
11:54llasrampbostrom: nope
11:54clgvpbostrom: no, that is as short as you can get
11:54clojurebotRoger.
11:54llasramclojurebot: no, that?
11:54clojurebotCool story bro.
11:54llasramclojurebot: that?
11:54clojurebotthat is weird
11:54clgvsee clojurebot agrees ;)
11:55llasramclojurebot: that?
11:55clojurebotthat is weird
11:55CookedGr1phonpbostrom: have you looked at juxt
11:55clgvand what about lazybot???
11:55lazybotclgv: Yes, 100% for sure.
11:55CookedGr1phonpbostrom: fairly sure you could just do ((juxt fn1 fn2 fn3))
11:55CookedGr1phonor ((apply juxt [fn1 fn2 fn3]))
11:56clgvnot much shorter though ;)
11:56llasramI think mapping with #(%) is clearer
11:56clgvand not lazy if that was the intention
12:10rasmusto(inc applyjuxt)
12:10lazybot⇒ 1
12:19pbostromclgv, CookedGr1phon, llasram : thanks, wasn't sure if there was an actual 'call' function
12:21justin_smith,((apply juxt [+ *]))
12:21clojurebot[0 1]
12:23clgv,(map (memfn invoke) [+ *])
12:23clojurebot(0 1)
12:24clgvnot very idiomatic though
12:25gfredericks,(map deliver [+ *])
12:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/deliver>
12:26clgv,(#(% %) identity)
12:26clojurebot#<core$identity clojure.core$identity@1555d95>
12:29clgvwhy does ('a 1) work anyway? I though only keywrds are supposed to look up themselves in maps
12:31gfredericksbecause symbols are also supposed to
12:35clgvgfredericks: what for?
12:35clgvsame reason as for keywords? because they are usually not mention when the keyword map access rule is stated
12:37clgvseveral times already I called a symbol with one argument instead the corresponding function and did not notice immediately - not before debugging (functions are specified in the configuration as symbols)
12:38lxollist
12:40gfredericksclgv: I assume the same reason, just with a lot less expected use; but I could imagine it being useful for dealing with forms as data a lot
12:41clgvgfredericks: well currently I am aware to check if I forgot to resolve the symbol to the function if I get nil from the evaluation.
12:44gfredericksclgv: I didn't quite understand that
12:44clgvgfredericks: ##('a :anything)
12:44lazybot⇒ nil
12:44clgv,('inc :anything)
12:44clojurebotnil
12:45gfrederickssure; I just couldn't tell if that was a question or an objection or something
12:46clgvgfredericks: the realization that I forgot to resolve the function again and did not get an immediate error annoyed me ;)
12:47clgvI had to track down the resulting NPE ...
12:47gfredericksah right
12:51gfrederickshey here's a fun nrepl middleware
12:52gfredericksprovide an erlc-style alternative to *1 *2 *3 where evals get absolute numbers
12:52gfredericksso you can reference arbitrarily old stuff
12:52arrdemoh nice!
12:52arrdemgfredericks: link?
12:52gfredericksit's in my head
12:53gfredericks"here's" == "here's an idea I just thought of"
12:53arrdemwolfram notebook style :P
12:53arrdemI like
12:53arrdemdbasch: does your tipping site have a way to put bounties on a project?
12:53gfredericksyou could also provide some sort of GC mechanism, if you could detect uses
12:54gfredericksdammit Var is a final class
12:55gfredericksI wonder what would happen if you interned something other than a var in a namespace
12:55l1xhttps://twitter.com/ML_Hipster/status/438418306769244160
12:59clgv,(intern *ns* 'foo 42)
12:59clojurebot#'sandbox/foo
12:59clgv,foo
12:59clojurebot42
13:00clgv,(-> *ns* ns-interns 'foo type)
13:00clojurebotclojure.lang.PersistentList
13:00clgv,(-> *ns* ns-interns (get 'foo) type)
13:00clojurebotclojure.lang.Var
13:00clgvgfredericks: ^^
13:07gfredericks,(.mappings *ns*)
13:07clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: mappings for class clojure.lang.Namespace>
13:09gfredericksI bet mucking with the mappings map of a namespace could let you do some pretty ninja stuff
13:09gfrederickslazy vars for one
13:12gfredericks,(-> *ns* class .getDeclaredFields (->> (filter (comp #{"mappings"} (memfn getName))) first) (.get *ns*))
13:13clojurebot#<AtomicReference {primitives-classnames #'clojure.core/primitives-classnames, +' #'clojure.core/+', Enum java.lang.Enum, decimal? #'clojure.core/decimal?, restart-agent #'clojure.core/restart-agent, ...}>
13:13gfredericks,(-> *ns* class .getDeclaredFields (->> (filter (comp #{"mappings"} (memfn getName))) first) (.get *ns*) deref)
13:13clojurebot#<ClassCastException java.lang.ClassCastException: java.util.concurrent.atomic.AtomicReference cannot be cast to java.util.concurrent.Future>
13:31adilaawfree valide cc plz
13:43clgv,(-> *ns* class .getDeclaredFields (->> (filter (comp #{"mappings"} (memfn getName))) first) (.get *ns*) .get)
13:43clojurebot{primitives-classnames #'clojure.core/primitives-classnames, +' #'clojure.core/+', Enum java.lang.Enum, decimal? #'clojure.core/decimal?, restart-agent #'clojure.core/restart-agent, ...}
14:46arrdemsomeone convince me not to just convert this entire AST to a pointer shared transient structure
14:46rasmustodon't do it!
14:47arrdemrasmusto: that's not convincing tho.
14:47rasmustoarrdem: I tried.
14:47arrdemthe from a usability and a performance standpoint I should totally do this with in place mutability.
14:48arrdemno reason to eat an O(N) tree traversal when I could do an O(1) pointer update.
14:48Bronsaarrdem: if it makes you feel better internally in t.a.j I sometimes use an atom to avoid walking the AST needlessly
14:49arrdemBronsa: I'm gonna take a break, breath, and then probably build a fully transient AST from your nice output. I'm sorry.
14:49Bronsasounds exciting.
14:49arrdemI'll let you know when I shoot my foot off
14:50splunkanybody know how to declare a new type in core.typed? Suppose you wanted a `Path` that a subtype of `String`, and not merely an alias for a String
14:50arrdemsplunk: I don't, but #typed-clojure may
14:50splunkarrdem: awesome thanks
14:50amalloyyou're looking for haskell's newtype in core.typed?
14:51splunkamalloy: mmm, I think data Foo = Foo String in Haskell
14:51splunkbut I don't really actually know Haskell
14:51splunkI think that'll create a Foo using a String, but henceforth that Foo != that String, I think?
14:52amalloyyes, although i'd use newtype instead of data there, probably
14:52splunkI love that I learn more about Haskell walking in here :)
14:52splunkthx
14:52amalloyit's an interesting idea. i dont know enough about core.typed to tell you whether it's possible; it seems a bit tricky
14:53llasramIt does seem like it's conceptually possible though -- it'd all just be type-checking time fiction
14:57arrdemhyPiRion: I'm probably pushing my luck but so be it
14:58hyPiRionarrdem: I just find it funny that people complain about printers when I've tried to fix a printer driver the whole day as the university printer refuses to print my master's pdf.
14:59technomancyit took me two days to get my laser at home working
14:59splunkI'm super hopeful core.typed will work out, I think it has a lot of potential to alleviate some of the heavy mocking and stubbing that's going on in the dynamic language world
14:59pkothbauerHi! Anyone with familiarity of core.logic are to answer a newbie question? http://stackoverflow.com/q/23811409/3506009
14:59pkothbauer*care to answer*
15:00hyPiRionarrdem: and you're not pushing your luck, you have no chance of convincing bitemyapp either way :p
15:00cbp`pkothbauer: you can try posting on the mailing list if no one helps you here
15:00arrdemhyPiRion: at some point I'm gonna give in to my desire to countertroll
15:01hyPiRiontechnomancy: funny thing is, it works fine at home
15:01pkothbauer@cbp okay thanks!
15:12yedii read somewhere that I should look at sigmas like the for loops they are and now they're so easy to read
15:22cbpnot a for loop, a for comprehension :-p
15:27FareHi.
15:28FareI'm trying to use reflection to load & call clojure from java, and am getting a null pointer exception at my first call to Symbol.intern.
15:28FareDo I need to somehow initialize Clojure first? And if so, how do I do that?
15:29Fareor am I just calling it wrong?
15:30Fareprobably just calling it wrong
15:32stuartsierraBefore the public Java API in Clojure 1.6, you had to "initialize" the Clojure runtime by referencing the class clojure.lang.RT in your code.
15:32cbpFare: are you using 1.6?
15:34Fareyes, 1.6
15:34FareI managed to call Symbol.intern. Now having "fun" with Var.intern.
15:34cbpoh
15:35llasramIf you're using 1.6, no need to do that
15:35llasramhttps://github.com/clojure/clojure/blob/master/changes.md#21-java-api
15:35llasramAlthough you shouldn't need to call Var.intern even on older versions
15:37Fareand failing to find read-string — in which namespace is it?
15:38Fareand how do I ask the repl?
15:39llasramIn the REPL you can refer to the var to see it's namespace
15:39llasram,#'read-string
15:39clojurebot#'clojure.core/read-string
15:39waynris there a simple way to get the 'uberjar' task to prefer locall installed/cached copies of dependency jars?
15:40FareCaused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath:
15:41llasramFare: Well that's fun :-)
15:41Fareinterestingly, the second time I try to intern the Var, it works!
15:41FareWTF
15:42Fareclojure-1.6.0.jar
15:43waynrhmm maybe :offline true
15:43Farebut of course, if I try to call it, I get: Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/read-string
15:44arrdemdo you know if the clojure core has been loaded yet? there's still init code that does that which may need to be invoked.
15:44Farearrdem, how do I tell? and how do I load it?
15:45Fareif clojure needs to be initialized... oops
15:45arrdemclojure.lang.RT.doInit()
15:45llasramYou really shouldn't need to call that yourself
15:46llasramJust use the clojure.java.api.Clojure class, or methods on clojure.lang.RT for <1.6
15:47cbpClassCastException appointment.tree.Schedule cannot be cast to appointment.tree.Schedule
15:47llasramStatic initializers will ensure clojure.core is loaded before you try to access its functions
15:47cbphmm yes indeed makes sense
15:47Bronsacbp: double evaluation of deftypes probably
15:47cbpBronsa: ah
15:49Faremaybe there's a problem with my class loader?
15:50llasramFare: Can you gist the actual code you're trying to run?
15:51Farellasram: I can even copy/paste it all. It's a trivial test program that uses a URLClassLoader and reflection to (1) load clojure.jar, (2) extract references to read-string and eval, and (3) tries to use them to hello world with clojure.
15:51Farea bit like clojure.java.api.Clojure, but using reflection because it's all dynamically loaded.
15:57llasramOk -- let's see it :-)
15:58Farewhere is the right place to paste it?
15:59llasramrefheap.com or a github gist
16:00Farehttp://paste.lisp.org/+322O
16:00arrdemseriously. refheap in future.
16:00Fareto use it, just edit the URL to your clojure.jar
16:01Fareand watch it fail :-(
16:05llasramFare: Yeah, I believe you are circumventing everything which would cause `clojure.core` to be loaded
16:05llasramThe good news is that I don't believe there's any good reason to be doing so
16:06Farellasram, whatever I'm doing or failing to do is out of ignorance
16:06Farethat's my first java program
16:06llasramIn your `var` method, just reflection-invoke the `Clojure.var` or `RT.var` instead of manually fiddling with namespaces
16:07llasramInvoking a static method of either of those classes will cause the static initializers to run which actually get Clojure rolling
16:07llasramNope
16:08llasramTHat's a namespace, not a class
16:08Fareoh
16:08llasramAnd (unless I'm mistaken), the ClassLoader.loadClass method does not cause the class's static initializers to run
16:09Farehow do I run the initializers?
16:10llasramCreating an instance of the class or invoking a static method will do the trick. Passing `true` as a second arg to the loadClass method may also work
16:10llasramThere the boundaries of my knowledge end
16:13Fareok — but (1) which class(es) should I thus be instantiating?
16:13Fareregarding passing true: test.java:90: loadClass(java.lang.String,boolean) has protected access in java.lang.ClassLoader
16:15llasramOk. So just call `Clojure.var` instead of doing the manually fiddling
16:16joegalloperhaps consider http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#forName%28java.lang.String%29 (and the other arity that allows you to pass a ClassLoader)
16:17llasramAh! Good call
16:19Farejoegallo, my understanding is that forName will not use my URLClassLoader
16:20Fareoh wait, there is another function of same name and different arity
16:20joegallowhy wouldn't it? you can pass a classloader as the third arg to the second arity...
16:26Fareyes, yes, yes, I was reading the docs for the wrong method
16:27Farestill, I get the same error: Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath: at clojure.lang.RT.load(RT.java:443)
16:31benkayi'd like to run just one test with clojure-test-mode in emacs, any protips?
16:31benkayoh clojure-run-test >.<
16:34benkaygrr but clojure-test-run-test seems to not handle fixtures?
16:35llasramA known outstanding issue, generally perceived to be a problem with the way clojure.test does fixtures
16:35benkayoh :(
16:35llasramFare: Yeah, I'm at a loss. OOC why the wacky URLClassLoader fun?
16:36benkaythanks llasram. any workarounds?
16:36FareSolution was here: http://dev.clojure.org/jira/browse/CLJ-260
16:36llasrambenkay: Pretty much just the obvious ones -- either don't use fixtures, or always run all tests in a namespace
16:36FareThread.currentThread().setContextClassLoader(loader);
16:37benkayokay. thanks llasram !
16:39llasramFare: Cool.
16:40Fareone more thing, though: clojure's print("hello world") went to /dev/null :-(
16:40Farehow do I configure the clojure stdin/stdout?
16:40technomancyare you sure it's not just buffered?
16:40technomancytry flushing or printing a newline
16:41Fare out.println(ReadEval("(* 6 7)")); does print 42
16:41amalloyi bet he knows it went to /dev/null because he's readnig /dev/null from another process and saw the output
16:41Farebut ReadEval("(print \"Hello, World!\\n\")"); doesn't seem to do anything
16:46technomancyamalloy: there should be something that's the opposite of /dev/null
16:46technomancyinstead of sending output to no file, it sends it to *every* file
16:47amalloytechnomancy: when you read from it, you get whatever input you were hoping for
16:47technomancyI bet plan9 supports this.
16:48dbaschtechnomancy: you need /dev/pi, just read and wait until you find what you want
16:51hyPiRiondbasch: wouldn't that break like, literally all copyrights in the world?
16:52dbaschhyPiRion: worse, you could be jailed for possesion of all kinds of illegal information
16:52jcromartieI tried to use Clojure in an Atlassian plugin… but that is not going to fly apparently
16:52hyPiRionjail all the things
16:54arrdemliterally infinite sentence!
17:05jcromartieI'm not sure but I don't think this is going to work...
17:05jcromartiemaking an uberjar of the dependencies for Atlassian plugins...
17:05jcromartiethat's just overkill
17:06arrdemtrue story: one time I made a single jar with all the dependencies and package jars for Eclipse
17:12rasmustohrm, I'm getting a stack overflow in my loop/recur...
17:13rasmustomy recur step is uh, conj onto a vector, take the rest of a lazy seq, and update a map
17:13arrdemsource or you're just raving like I am
17:14amalloy$google stackoverflow clojure prime sieve dbyrne
17:14lazybot[recursion - Recursive function causing a stack overflow - Stack ...] http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow
17:14amalloy^ for rasmuto
17:15rasmustoamalloy: I wonder what my equivalent "filter" is
17:15amalloyit's probably concat
17:15arrdemdefinitely concat
17:15rasmustok
17:16rasmustoI have update-in, zipmap, but yeah
17:16arrdemlazy-seqs ftw
17:16rasmustoconcat probably :D
17:16amalloyrasmusto: if you pasted the code it would be a matter of seconds to identify
17:17rasmustoamalloy: https://www.refheap.com/b8a1eda51a44aee5b9907eddf
17:18amalloywhat the shit
17:18amalloybut yes, it's your merge-with concat
17:18amalloyinstead, use vectors and merge-with into
17:19rasmustoamalloy: okay
17:19rasmustoamalloy: what "what the shit" btw?
17:19amalloyit's huge and messy
17:19rasmustoI know it's a bit weird :p
17:19rasmustohah, ok
17:19arrdemrasmusto: helper functions man
17:19rasmustorgr, this is a first pass
17:20arrdem:+1: do it then do it right. I need that tattooed to my forearms where I can see it when I type.
17:20rasmustoarrdem: another thing, allllways start with a loop/recur
17:23dbaschsee the comment at the bottom of http://clojuredocs.org/clojure_core/clojure.core/vals
17:23dbaschwhy should that be true?
17:23dbasch“Functions keys and vals return sequences such that (= (zipmap (keys m) (vals m)) m)"
17:24dbaschdoes anything guarantee that to be always true?
17:24arrdemdbasch: keys is (map first <map>), vals is (map second <map>), zipmap is (into {} (map vector key-seq val-seq))
17:24arrdemdbasch: intuitively it must be a round trip operation
17:25amalloydbasch: rich said it once, so it's true. for some reason nobody wants to put it in any official docs
17:25dbascharrdem: in theory you cannot guarantee order
17:26arrdemdbasch: sure, but key/value order is not guranteed on maps
17:26dbaschwhat made me think about this is the ugly implementation of map-values here http://aphyr.com/posts/312-clojure-from-the-ground-up-modeling
17:26arrdemdbasch: you could argue that the internal structure depends on insertion order reasonably in which case I'll mutter mumbo jumbo about hashing based equality and pray to Rich that it keeps working.
17:27dbaschwhich could be a one-liner with (zipmap (keys m) (map f (vals m))
17:28amalloydbasch: i do prefer the way aphyr does it to using zipmap, although 'for is a lot nicer than map
17:28amalloy(into {} (for [[k v] m] [k (f v)]))
17:29dbaschthat is a long post
17:30arrdemthat is also guaranteed to use transients in the map construction for what it's worth, although the values will be computed strictly.
17:30arrdemdbasch: fun one tho
17:31dbaschyes, it’s a good post
17:31arrdemorbital insertion maneuvers in Clojure aw man... :D
17:31dbaschthis is not so great, it was on HN earlier http://elegantcode.com/2014/04/29/clojure-kata-3-roman-numerals-2/
17:32dbaschthe most convoluted way of converting to roman numerals I’ve seen
17:36jcromartiewoah… (defn camelCaseNames ?)
17:36jcromartieno
17:39dbaschif I worked at github I’d write a script to find the longest java class names in all their repos
17:40gfredericksdbasch: probably generated
17:40dbaschmaybe InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
17:40amalloyoh man, roman numerals. three years ago i wrote https://github.com/amalloy/claudius/blob/master/src/claudius/core.clj - pretty funny
17:43gfredericksoh are we showing off old clojure code
17:43dbaschmildly interesting interview question: given a dictionary, find all the words that are valid roman numerals
17:44ztellmandbasch: that's a regex construction question, right?
17:44gfrederickshere's some project euler code I found from probably fifty years ago: https://www.refheap.com/85808
17:44gfredericksthat has to be some of the first clojure code I wrote
17:44dbaschztellman: is it? here, I’ll erase the board for you :P
17:45ztellmandbasch: ha, I don't have the time right now to dig into it, I was just wondering if it required going higher up Chomsky's hierarchy
17:45dbaschztellman: http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression
17:45gtrakamalloy: cake template.. lol
17:45ztellmanha
17:45gtrakactually I never got a chance to use it.
17:46dbaschI’d just want to see how the person thinks, because it could be solved in different ways
17:47gfredericks(defn roman-numeral? [word] (re-find #"X" word))
17:47rasmustothose ))) triangles are so cute :)
17:47gfredericksrasmusto: I was just wondering to myself where on earth I would have gotten the idea to do that
17:47amalloygfredericks: i was reading that thinking like "wow he sure is defining a lot of functions, how can you possibly need all of these to solve one euler problem"
17:47gfrederickssurely I had read somebody else's clojure code by then
17:47gfredericksamalloy: and I gave them all great names like p16
17:47amalloywell, it was before i got that far
17:48gfredericksoooh I had a prelude didn't I
17:48rasmustogfredericks: I do it sometimes, since I haven't fully embraced structural editing and like to move full lines of code around
17:48gfredericksthat would be amusing if there was an euler problem that needed all of those functions
17:48amalloyi was like, what problem needs fibonacci numbers, conversion to binary strings, factorial, and prime factorization
17:48amalloyand palindromes!
17:48SegFaultAXamalloy: Reading what now? I missed the link.
17:49amalloySegFaultAX: some code gfredericks wrote when he was an infant. https://www.refheap.com/85808
17:49rasmustooh, just noticed the (defn [] p12 (println ...))
17:49dbaschgfredericks: a semi-cryptic scrolling game of life https://www.refheap.com/85809
17:49arrdemhttps://www.refheap.com/85808#L-30 tearz
17:49SegFaultAXHah. Those parens, yo...
17:50gfredericksarrdem: what aspect of that are we weeping over?
17:50arrdemhey at least all that code is easy to compile :P
17:50arrdemgfredericks: the apply over a huge sequence, but I guess the core * uses reduce so it works out
17:51gfredericksnot too huge
17:51SegFaultAXarrdem: Yea in fairness that's basically a mathematical translation of factorial.
17:51amalloyarrdem: huh? (apply * (take n (iterate inc 1))) is a reasonable way to multiply stuff
17:51gfrederickswhat kind of numbers do you pass to factorial?
17:52amalloygfredericks: integers
17:52arrdemgfredericks: ones with units and exponents :D
17:52rasmusto3.14!
17:52gfredericksthaht was a question for arrdem about why he thought it was a long sequence
17:52amalloyi guess the alternative would be to accept your possible joke setup: "I dunno, gfredericks. What kind of numbers *do* you pass to factorial?"
17:53gfredericksdominoes!!!
17:53amalloy,(apply *' (range 10000))
17:53clojurebot0
17:53amalloy,(apply *' (range 1 10000))
17:53clojurebot2846259680917054518906413212119868890148051401702799230794179994274411340003764443772990786757784775815884062142317528830042339940153518739052421161382716174819824199827592418289259787898124253120594659962598670656016157203603239792632873671705574197596209947972034615369811989709261127750048419884541047554464244213657330307670362882580354896746111709736957860367019107151273058728104115864056128116...
17:53arrdemlololol
17:53amalloylarge sequences are fine
17:53SegFaultAX,(source clojure.core/*')
17:53clojurebotSource not found\n
17:54arrdemSegFaultAX: line 967
17:55gfredericksamalloy: yeah at some point the bigint multiplication will take more time than the sequence overhead eh
17:55amalloypretty damn quickly, i would guess
17:55amalloy,(time (dorun (range 1 100000)))
17:55clojurebot"Elapsed time: 67.798386 msecs"\n
17:55arrdemquick add more zeros
17:55amalloy,(let [xs (doall (range 1 100000))] (time (apply *' xs)))
17:55clojurebotExecution Timed Out
17:56amalloyapparently bigints are big
17:57gfrederickssoooo big
17:57gfredericks,(let [xs (doall (range 1 10000))] (time (apply *' xs)))
17:57clojurebot"Elapsed time: 329.470126 msecs"\n284625968091705451890641321211986889014805140170279923079417999427441134000376444377299078675778477581588406214231752883004233994015351873905242116138271617481982419982759241828925978789812425312059465996259867065601615720360323979263287367170557419759620994797203461536981198970926112775004841988454104755446424421365733030767036288258035489674611170973695786036701...
17:58gfredericks,````foo
17:58clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/list)) (clojure.core/list (clojure.core/seq #))))) (clojure.core/list (clojure.core/seq (clojure.core/concat (clo...
17:58gfredericks,``foo
17:58clojurebot(quote sandbox/foo)
17:59gfredericksI'm just wondering to myself if there's a way to rewrite ` so it works the same for cases that matter but doesn't have exponential blowup
19:11cbpDoes anyone have an interval tree implementation laying around? :-P None of the ones i found on the internets seem to work well.
19:12master_ophello , i'm new in clojure, i want to some a values of a hashmap like this {:a 1 :b 2}
19:12master_opi want to get 3 as result
19:12technomancy,(apply + (keys {:a 1 :b 2}))
19:12clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
19:12Fareload-string is what I wanted! how do I join strings in Java?
19:12technomancyderp
19:12technomancy,(apply + (vals {:a 1 :b 2}))
19:12clojurebot3
19:12cbpGuess I gotta dust off that algo book
19:12master_opthks
19:13cbp:-(
19:15dbaschFare: the old way was to create a StringBuffer and append to it, there might be a better way now
19:16amalloydbasch, Fare: these days StringBuffer is little used; StringBuilder is preferred for building strings (StringBuffer is more like for built strings that you want to mutate)
19:17dbaschamalloy: I think StringBuilder is not thread safe or something like that
19:17cbpStringBuffer isnt threadsafe
19:17dbaschprobably doesn[t matter in this case
19:18cbper
19:18cbpi mean yes STringbuilder isnt threadsafe
19:20amalloydbasch: that's sorta why it's preferred. don't pay for synchronization overhead when all you're doing is incrementally building a string locally
19:20amalloyjust like how Vector was superseded by the unsynchronized ArrayList and so on
19:24arrdemforget synchronization overhead you don't pay for rendering the entire string to a single byte buffer until you choose to. StringBuilder uses ropes and has awesome concat performance because of it. Building the string at the end is a single O(N) buffer copy which is cheap compared to buffer resizing.
19:36dbaschin a way I’m glad I’m starting to forget Java :P
19:36dbascha couple of years ago I saw a preview presentation of the functional features in Java 8 and thought it looked really ugly
20:09justin_smithit's ugly but imho it is soo much better than what was there before
20:09justin_smithI even managed to use a reduce in some java code the other day
20:10justin_smith(faint praise, I know)
20:11FareHi!
20:11Farehow do I call System.out.println from clojure?
20:12beamsoprintln
20:12Fare(.out System) is an error
20:12justin_smith,(.println System/out "hello")
20:12clojurebotnil
20:13beamsojustin_smith: i used java 8 streams the other day as well. having to call .stream() to get something to call .map() or .reduce() on was weird. same with calling .collect to get a list back.
20:13justin_smithprintln will be more likely to use the current clojure output stream
20:13Farewhy is System/out and not System.out ?
20:13justin_smithFare: static method on the class
20:14justin_smith,System/out
20:14clojurebot#<PrintStream java.io.PrintStream@1411c67>
20:14justin_smitherr.. static field that is
20:14justin_smithprintln being the static method on that static field
20:15justin_smithbeamso: yeah, it is awkward, but it's better than what we could do in java 7
20:15justin_smith,(println "Fare: this is what you should actually use)
20:15clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
20:15justin_smitherr
20:15justin_smith,(println "Fare: this is what you should actually use")
20:15clojurebotFare: this is what you should actually use\n
20:16justin_smith$source println
20:16lazybotprintln is http://is.gd/ewuFP7
20:17Farejustin_smith, thanks a whole lot
20:17FareI'm learning both Java and Clojure at the same time
20:17justin_smithahh, that's tricky
20:17justin_smithI learned clojure first, and am finally learning java right now (for career reasons)
20:18FareI just completed my very first Java program: it dynamically loads clojure.jar and load-string's the arguments.
20:23FareI'm just not sure what is the best way to specify where the jar is located. Right now, it's hardwired in the source code... meh
20:23Farewhat would "best practices" be for parsing arguments, using environment variables, and/or hardwiring a default?
20:24Fareideally, the default would be decided at compile-time but not hardwired in the source code.
20:25turbofailthe "best practice" i believe is to use clojure.tools.cli, which is a separate library
20:26turbofailhttps://github.com/clojure/tools.cli
20:26technomancyfor one or two args it's fine to just apply hash-map on a bunch of strings
20:26technomancyand merge it into a defaults map
20:27technomancybut if you want proper --help output you should use a library
20:28justin_smithalso consider a config.edn file
20:28justin_smithedn is easy to hand edit, super easy to parse
20:29justin_smithor config.json if you want it to be less easy but more widely recognized by human users
20:31hiredmanif only there was a configuration library that could use either
20:31hiredmanhttps://github.com/sonian/carica/
20:31technomancycarica takes CLI args?
20:34hiredmanno idea
20:52lemonodorit’s not done yet, but this does package level command-line flags, and reads flags from files: https://github.com/wiseman/clj-gflags
20:52lemonodorsort of a port of google’s gflags library, if you know that.
21:00justin_smith,(merge-with (partial merge-with merge-with) {:a 0 :b {:c 1}} {:b {:c {:d 2}}} {:b {:c {:d {:e 3}}}}) Fare I tried to show you this on ##java lol
21:00clojurebot{:b {:c {:d {:e 3}}}, :a 0}
21:03amalloyjustin_smith: i wanna see a version that works for depths of up to six
21:05justin_smith(apply (fn m [& maps] (if (every? map? maps) (apply merge-with m maps) (apply f maps))) maps)
21:05justin_smithblatantly stolen
21:06amalloynono, that works for arbitrary depth
21:06amalloyit should break for depths 7+
21:06amalloy(i was teasing you for presenting a solution that works for up to depth 3 instead of the general solution)
21:07justin_smithyeah, I figured
21:08amalloyis it really just (merge-with (partial merge-with (partial merge-with ...)))?
21:09woahso, would you guys say that it is a requirement to know java to write good clojure or clojurescript?
21:09amalloy(nth (iterate (fn [f] (partial merge-with f)) merge) 5), maybe. it's starting to look like a fixed point
21:11amalloyyeah, it totally is. that's neat
21:16arrdemwoah: nope
21:17justin_smithit helps to be able to read the docs for whichever backend you are targeting, (and to understand the VM) but clojure does a good job of working standalone
21:17woahcool
21:17mdeboardDunno where to ask this question, but has anyone seen any good responses to cemerick's "Distributed Systems and the End of the API"?
21:19mdeboardI thought it was a really good introduction to CRDTs but want to read other viewpoints on the "demise of the API" bit
21:19caternalso interested in that
21:19caternI am*
21:22arrdemdanneu: you realize that paste of your *coin config was public, right?
21:22beamsomdeboard: maybe look at the HN thread for discussion/further reading points : https://news.ycombinator.com/item?id=7735141
21:28mdeboardbeamso: Hey, thanks
21:36Farelemonodor, thanks a lot!
21:36FareI realize that since it's flags for the small java runtime that loads clojure, though, it can't be written in clojure.
21:43danielcomptonmdeboard I saw some negative comments here https://twitter.com/cemerick/status/466999122139299840
21:45mdeboarddanielcompton: Thanks
21:45mdeboardWould be nice if people would qualify their pooping-upon
21:46danielcomptonmdeboard FWIW, I didn't agree with them
21:46mdeboardI mean I'm sur ethey have reasons, I just want to hear them haha
21:46danielcomptonmdeboard nothing has been announced so I don't think those comments were very fair
21:46danielcompton(dec so)
21:46lazybot⇒ -15
21:47mdeboardwho's so
21:55danielcomptonmdeboard someone who keeps messing up the highlighting in my IRC client
21:59mdeboarddanielcompton: lol
22:01arrdemmdeboard: downvoting him is our traditional equivalent to kicking that beater car you hate after you get out.
22:01mdeboardis this a real person
22:01arrdemnobody has cared enough to find out, but last time I tried it didn't respond to pings
22:02mdeboardhow does he mess up your highlighting? I'm in the emacs/rcirc master race
22:02arrdemerc-nick-highlight picks up on him when used as a substring in normal conversation.
22:02nullptrhmm, i always assumed this channel just hated stack overflow
22:03mdeboardhaha
22:03mdeboardthat's so, so annoying
22:03nullptrha, i'd never noticed the so highlighting until now
22:03nullptr(dec so)
22:03lazybot⇒ -16
22:04technomancynow you can never unsee it
22:04arrdem(dec so)
22:04lazybot⇒ -17
22:06mdeboardrcirc
22:06mdeboarddo it.
22:06mdeboardYou know you want to.
22:06beamsoirssi ftw.
22:08nullptrerc is so simple though
22:09nullptrit's so easy to fix
22:10quizdr(dec so)
22:10lazybot⇒ -18
22:10seangroveSo easy
22:10seangroveNot so simple
22:10nullptrhmm, that did work actually
22:10nullptr(add-to-list 'erc-keywords '("\\bso\\b" erc-default-face))
22:14RaynesI don't think of ERC as either simple or easy.
22:16danielcomptoncircle dec'ing so on #clojure
22:16seangroveRaynes: Well, it's there. Definitely there.
22:18justin_smith(dec so)
22:18lazybot⇒ -19
22:18mdeboardERC == Stockholm Syndrome
22:19quizdr(dotimes [n 400] (dec so)) lolrotflaghxbcs
22:22quizdrI see a lot of David Nolen's tutorials use Google Closure directly to manage quirks between browsers. Anyone know if his Om (or the underlying React) is also doing this automatically?
22:22quizdrOr is it wise to continue using Closure even with those libraries?
22:23nullptrreact isn't, i don't think the om core is either -- but, closure is "in the box" already so i don't see any reason not to use aspects of it which provide value
22:24quizdrso the goog.dom ns is alsways going to be there because of how cljs works, right?
22:24nullptri'm not aware of a compilation path that doesn't make closure library available
22:25nullptrthat said, it would be unwise to consume goog.dom in a non-browser cljs application :)
22:25danielcomptonnullptr like a node cljs app?
22:25nullptryeah
22:29ddellacostaquizdr: the only closure lib Om uses is goog.ui, for generating ids, as far as I know
22:29quizdrentering the js world where so many libraries interact with the DOM it is confusing to know which play nice with each other.
22:34ddellacostaquizdr: generally it shouldn't be a problem unless the library is crap and writing stuff to the global namespace. But getting a dom element from one and using it with another is no big deal.
22:35ddellacostaquizdr: of course, using react means you have to be clear on where in the render cycle you're using external dom libs, but they all behave the same in that sense
22:36quizdrddellacosta thanks. wrapping my head around it all. i think i've settled on Om with maybe just the CSS portion of Bootstrap or PureCSS.io
22:39ddellacostaquizdr: yeah, (in reference to bootstraps js widgets) I've done some integration with google closure widgets and I've found its better to lean as heavily on Om/React as you can, mostly because there are assumptions of use when using UI widgets with standard JS libs that the React render cycle can confound
22:39ddellacostaquizdr: it's not so much about dom libs conflicting with each other than the basic model of rendering being fundamentally different
22:41quizdrddellacosta for example there are some nice JS drop-down menus in the various UI libraries I've looked at. But I'd be worried about mixing third-party JS with Om, at least at first
22:41ddellacostaquizdr: yeah, it can be challenging to get working smoothly. Usually those kinds of widgets have to live in a world of their own and interact with your Om components using channels.
22:42ddellacostaquizdr: but good to see if you can do stuff without widgets first...then add them only when they present a clear win as far as avoiding developing stuff from scratch (is my philosophy)
22:43quizdrperhaps the curve of integrating them is no less than the time spent writing your own menu, for example
22:45ddellacostaquizdr: yeah, I mean, the problem is that there is just less impedance mis-match if you can do things "the Om way." For example, setting state and taking advantage of the natural render update cycle to effect UI updates is really powerful. Once you start using external widgets, you can start to find yourself needing to directly modify the DOM more and more, depending on how you need to integrate stuff...again, this
22:45ddellacostais just based on my experience w/Google closure widgets.
22:47quizdrdo i understand correctly that Om can re-render part of a DOM while another part is currently being interacted with by the user? Such as a text field being typed in while something else updates due to AJAX callback or whatever
22:51ddellacostaquizdr: I mean, I wouldn't put it that way--in one sense Om is really simple, it's just responding to updates to the underlying data structures
22:52ddellacostaquizdr: It doesn't "know" that a user is interacting with the DOM in any meaningful sense.
22:52quizdrso what happens when your page gets a callback that needs to be rendered and the user is interacting with the page; is it queued?
22:55beamsoi think what you're asking is more about if and how the user's interaction changes the om state
22:55quizdrit will probably become clear as I build out some basic stuff first
22:56beamsoi know for one of the things that you've mentioned, autocomplete, jquery ui gives you configuration and the hooks to link back into your form.
22:56ddellacostaquizdr: as far as I understand, if that callback updates data that is associated with an Om component, Om will trigger a React update
22:58ddellacostaquizdr: if the user is interacting with the page and that causes a change to the data, that will just be triggered as it happens. So yeah, things get queued basically. But if multiple app-data/state changes happen within a single render cycle, they will get batched, as far as I know.
22:59quizdrok
22:59quizdri've got some learning to do
22:59quizdryou use async a lot in your Om stuff?
22:59ddellacostaquizdr: play with it, read the source, it will become more clear. :-)
22:59quizdrwatched several asyn vids yesterday, looks amazing even for JS
23:00ddellacostaquizdr: I use core.async extensively in my Om code...I probably couldn't write Om components without it. It's a key part of it
23:00quizdrdnolen is an async evangelist and i've been watching his presentations. quite interesting indeed.
23:01ddellacostaquizdr: yeah, core.async is crazy cool. I've been using it for half a year and still feel like I haven't tapped its potential yet
23:02quizdran on JS it's like half the power as on JVM but that shows how well thought the API is and the implementation to allow both environments access to it
23:02ffmpeglegmind linking one of those vids?
23:03quizdrffmpegleg just search youtube for dnolen and you'll see the titles. anything with async
23:03quizdror maybe search "david nolen"
23:03quizdrffmpegleg his blog is full, and i do mean fulllll, of many many examples of it in clojurescript across many applications and difficulty levels
23:04quizdrfor starters: http://swannodette.github.io/2013/11/07/clojurescript-101/
23:04ffmpeglegthanks :)
23:04quizdrwhen i saw the illusion of multithreading in the browser he demonstrated, it just blew my mind.
23:06ddellacostaalso, Timothy Baldridge (one of the core.async main authors) just posted some videos recently about core.async: https://groups.google.com/forum/#!topic/clojure/6g7WSr41z_Y
23:07mdedetrichquizdr: its not multithreaded, its concurrent programming
23:07mdedetrich*multithreading
23:07mdedetrichthey are separate things, a lot of people confuse them
23:08quizdrmdedetrich i know it's not multihreaded, but as pointed out in the demos, it gives JS programmers an illusion of doing things normally associated with multithreading (and concurrency) even though threads are not supported in the browser
23:09quizdrddellacosta good link thanks. looks like most of the videos are a buck to watch, but probably worth it
23:09ddellacostaquizdr: oh, are they? sorry didn't realize
23:10mdedetrichtrue, I guess my general point is that people conflate concurrent programming with multithreading, concurrent programming is an abstract concept where as multithreading is a feature of the hardware
23:10quizdrddellacosta some are free, but frankly it's worth a buck
23:10quizdri saw Tim's async presentation from 2013 on youtube (i think) and he's a good presenter
23:10beamsofree : http://www.youtube.com/watch?v=enwIIGzhahw
23:10ffmpeglegjust looked at the 10,000 processes one -- think I need to get into Om
23:11ddellacostamdedetrich: I think you could reasonably state that core.async provides the illusion of multithreading in the browser, even if core.async is fundamentally about concurrent programming
23:11quizdrthough I wonder if I am in the minority of watchers who need to pause a video for several moments and rewind sometimes to really know what they are talking about!
23:11ddellacostaquizdr: no, I do that too!
23:11quizdrbeamso yes that's the one I'm talking about
23:12mdedetrichddellacosta: I think its more accurate to say that core.async provides an abstract model that is typically used in multthreading applications, but it amounts to the same thing
23:12quizdrddellacosta if i was actually present at these conferences i'd probably not get so much out of them because i just don't have the experience (and probably the brainpower) to follow these presentations in real-time with the presenters
23:12ddellacostamdedetrich: yes, I mean, I think we're quibbling here. The main point is just that core.async makes the single-threaded nature of JS not matter so much
23:13quizdras was said on a recent episode of "Silicon Valley", "You guys are arguing over which metaphor to use to express that you actually agree with each other."
23:13mdedetrichwell yeah, I think core.asyncs great achievment is it brings general concurrent concept to JS
23:13mdedetrichquizdr: this is the internetz, we are supposed to argue!
23:14mdedetrichbut in all honestly, core.async is amazing
23:15ddellacostamdedetrich, quizdr: yeah, haha...I actually hate that kind of argumentative thing. Especially when people are pretty much in agreement
23:15ddellacostabut agreed, core.async is the bee's knees
23:15quizdrso which one is it then??? is it "amazing" or is the "bee's knees" make up your minds already!!
23:16ddellacostaquizdr: definitely the bee's knees, I don't know about all those other superlatives. ;-)
23:16quizdroff topic, are you in Tokyo or a different city? What's the air quality like in Japan or Tokyo? is a big city mesh of pollution as in so many other places?
23:22ddellacostaquizdr: sorry, didn't see your question. I'm in Tokyo. The air quality is good, except some days when we get winds from China...haha
23:25quizdras i get older i find myself looking for lively places with good air. Singapore's jumps around a lot due to fires from Sumatra and Malaysia
23:26ddellacostaquizdr: ah. Yeah, Tokyo's not bad, really
23:26ddellacostaI don't have numbers for you or anything, but it's good
23:26ddellacostaI've got the windows open right and a pleasant breeze comes in here and there. It's a bright sunny day.
23:26quizdri'm going to have to check it out there. trying to make it around the region as much as i can in case i leave this part of the world some day
23:29yediso i want to make a group text chatting app in the browser, does anyone have any pointers / resources i can look at with regards to dealing with the concepts of "time" in distributed real time apps. I.E. how to determine the ordering of messages
23:30quizdryedi lots of chats are asynchronous, such as IRC in fact, and timing is not always the same for different participants. messages aren't guaranteed to be in a strict order
23:31Frozenlock yedi: timestamps? (or would that fail if the user has a misconfigured clock?)
23:31yediso the order of messages on two different clients can differ
23:31ivanyedi: show messages in the the order the server received them?
23:31quizdryedi often yes. it depends how important this is to you.
23:31quizdrfor casual cases, i wouldn't expect ordering to be so important
23:31ivanyedi: oh, distributed
23:33ddellacostayedi: maybe start here? http://en.wikipedia.org/wiki/Lamport_timestamps
23:34ddellacostaLamport is the man as far as this stuff is concerned
23:34ddellacostacheck the date on that paper at the bottom...1978
23:34quizdrddellacosta 1978 is also when CSP was announced, the foundation of core.async
23:35ddellacostaquizdr: really? didn't know that, cool
23:35quizdrgood year! i was also born that year. omg what is happening right now
23:35ddellacostaheh
23:36yediddellacosta: thanks for the link
23:37ddellacostanp
23:39mdeboardgod how did
23:39mdeboardEverything's coming up lamport for me tonight
23:42en16m4666does lisp code work in clojure?
23:43en16m4666any1 want to share clojure code on a sudoku puzzle solver
23:44sjyen16m4666: well, clojure is a lisp dialect. so the answer is 'yes' in a sense, but lisp dialects are not necessarily mutually intelligible...
23:44rritochHi, I have a q? and I'm not sure if this is the best place for it. Is it possible to gen-class a static constructor?
23:44ddellacostaen16m4666: 1) not directly 2) https://gist.github.com/swannodette/3217582
23:45en16m4666word brah
23:45mdedetrichen16m4666: although clojure is technically a lisp dialect, its quite different from the other lisps
23:46mdedetrichI mean basic lisp is so 'low level' (if that makes sense) that calling clojure a lisp dialect isn't really useful
23:46rritochThe reason I ask is this project (https://github.com/rritoch/clj-nativedep) which helps with loading native dependencies seems to require that loading occurs in static constructors so up till now all implementations are depending on a java jar that contains classes with static constructors.
23:50quizdrmaybe someone can help me understand these cljs async basics in this small snippet: https://www.refheap.com/85823 My first question is where does this go block actually reside in the system? it's clearly a piece of state that the program has access to
23:52ddellacostarritoch: sorry, not a java interop expert...sometimes you get llasram or somebody around who knows this stuff well though...
23:54beamsoa constructor isn't static. do you mean a factory method?
23:55rritochddellacosta: thanks I'll keep my eye open for llasram
23:56rritochbeamso: See https://github.com/rritoch/WarpCTL/blob/master/extra/JADL-SDK/build/java/src/com/vnetpublishing/swig/adl/jadl_sdk.java#L13 which is a static constructor, and utilizing the clj-nativedep library
23:58beamsothat's a static initialisation block, not a constructor.
23:59rritochbeamso: Ok... Call it what you will, can it be created in a Clojure gen-class?