#clojure logs

2012-04-16

00:00yoklovi mean, every deterministic state machine is still an non-deterministic one, so i don't think that you're too pressed to do that
00:10pipelinekovasb: that's the joke, isn't it. They were doing well, but it's an order of magnitude problem. Real estate speculation is the devil.
00:13zenlikepipeline: how so?
00:35kovasbibdknox: i figured out the problem
00:35kovasbibdknox: but the solution hits a bug in noir-cljs
00:35kovasbibdknox: noir.cljs.watcher/build does not respect the :src-dir in the options
00:43ibdknoxkovasb: are you using an older version?
00:44kovasbI'm looking at the source on github right now
00:44ibdknoxhm
00:44ibdknoxit seems to respect src-dir?
00:44ibdknoxwhere doesn't it
00:44kovasbcompile-options its busted
00:44kovasb(@options m)
00:45kovasbshould probably be just @options
00:45ibdknoxno
00:45ibdknoxoptions are keyed by mode now
00:45ibdknox:advanced { ...}
00:46ibdknoxso you can have different options based on what mode you're in
00:46ibdknoxthat likely isn't documented
00:46kovasbok, let me try that
00:46ibdknoxah no it is, hah
00:46kovasb:)
00:48kovasbwhew ok
00:48kovasbanyway the issue is that any clj code that calls himera cannot be on the path for the cljsbuild command
00:48kovasbno idea why its not ignoring the clj files automatically, but that seems to be the problem
00:51kovasb(cljsbuild also has problems with its options; in this case i literally copied the examples and modified them with no luck)
00:54laurusWill the "ratio" type ever exist in clojure-py?
01:14yoklovlaurus: i wouldn't bet on it.
01:15yoklovclojure-py isn't official, it's basically a reworked version of clojurescript's innards, and since javascript can't have a ratio (no integer type…) i wouldn't bet on it.
01:15yoklovoh you aren't even here anymore.
01:15ibdknoxactually clojure-py is based on JVM Clojure I think
01:16ibdknoxI looked at the source and it looked much more java-y :)
01:16ibdknoxwhich is unfortunate :(
01:30yoklovyeah?
01:30yoklovweird, i had thought it was the same sorta deal as clojure-scheme
01:30ibdknoxnope
01:30ibdknoxlots of cool, but duplicated work there :/
01:31yoklovyeah
01:31septomin_ibdknox: so maybe an announce-only mailing list
01:31ibdknoxyeah...
01:31yoklovi saw one that was to actionscript which was the same sort of deal. basically an enormous port of all of clojure
01:32ibdknoxseptomin_: it's only the first day. I'll give it a couple days to settle
01:32ibdknoxif it remains ridiculous, I'll close it down
01:33kovasbi think the deal with clj-py is
01:33kovasbimplementing the core functions in rpython gives you the benefits of the jit'ing compiler
01:34kovasbthough i could be wrong
01:34kovasb(as opposed to implementing the minimal pieces of clojure which then allows you to bootstrap the rest of the definitions)
01:39afoolsuchasianyone have any recommendations on where to host clojure/noir backed by some kind of elastic setup?
01:39ScriptorI think you can host clojure projects on heroku, since they have jvm support now
01:40Scriptorhttp://blog.heroku.com/archives/2011/7/5/clojure_on_heroku/
01:40ibdknoxclojure support on heroku is awesome
01:40ibdknoxand if you created the project with lein noir new
01:40ibdknoxall you need to do is heroku create --stack cedar
01:40ibdknoxgit push heroku master
01:40ibdknoxand done.
01:41afoolsuchasithanks, ill check it out. ive been trying unsuccessfully to get beanstalk working so it may be time to give heroku a shot if ppl here have found success with it
01:41Scriptorkovasb: you'd still get JIT benefits for any clojure code running on the interpeter wouldn't you?
01:42Scriptorif you wrote the core functions in RPython, the advantage would be that they would be compiled to C, not that they would be JIT'd
01:42laurusAny clojure-py users here?
01:42kovasbthe are one and the same
01:42kovasbif it compiles to c then it also builds a tracing jit for that bit
01:43Scriptorreally? It can JIT the C code?
01:43kovasbhold on lemme find u the link
01:43eggsbydoes clojure-py run on pypy yet?
01:44Scriptorit generates a JIT, but I don't think it's for the C code
01:44kovasbhttp://tratt.net/laurie/tech_articles/articles/fast_enough_vms_in_fast_enough_time
01:45lauruseggsby, I'm not sure. Probably!
01:45lauruseggsby, hey, I'll try it, just a sec.
01:45kovasbgreat post explaining all this stuff
01:46Scriptorkovasb: where's it say it JITs the C?
01:46eggsbylaurus: I see there's a clj-py repo on github
01:46lauruseggsby, yes, it works on pypy :)
01:46Scriptorkovasb: it can't literally just-in-time compile the C code...since it's already compiled as far as I know
01:46kovasbread the "JITs for free" section
01:47lauruseggsby, what is clj-py?
01:47kovasbright, it doesn't git the C per say, it overlays instrumentation on top of the C
01:47Scriptorit JITs the code that is being run on top of the VM
01:48kovasb"As said earlier, RPython automatically layers alongside C code a second representation of the interpreter (the tracing interpreter). "
01:48Scriptoryes, that's the JIT
01:48lauruseggsby, the official repository is https://github.com/halgari/clojure-py .
01:49kovasbthough its not obvious to me if simply writing rpython gives you this benefit
01:49eggsbysorry https://github.com/halgari/clj-pypy laurus
01:49Scriptorif you write some core Clojure functions in RPython, I don't think the JIT will be involved
01:49kovasbparticularly since clojure-py is already living inside of pypy, which is already a vm implementation
01:49Scriptoryou can't trace code that is already compiled...
01:49lauruseggsby, well, the normal clojure-py works with pypy anyways.
01:50kovasbi don't understand how these things stack on top of each other..
01:50eggsbyheh, must be an earlier version
01:50eggsbywill pypy is python written in python so doesn't it just use the python instructions for whatever the compiled c is?
01:51Scriptorkovasb: the tracing jit looks for loops run frequently by the regular VM, when it detects one it JITs that loop
01:51lauruseggsby, I don't know the details of pypy, sorry.
01:51Scriptorso that next time the VM can execute the machine code that the JIT just generated for that loop
01:51arohnerI have a fn I want to implement, insert-before. inserts item into a seq, at the position before (f x) returns true. Is it possible to do lazily?
01:52arohnerI can do (lazy-cat (take-while #(not f)) [item] (drop ???))
01:52ScriptorI'm not an expert on JITs or even VMs but that's a basic idea of how a tracing jit works
01:53arohnerI guess I can use an atom to count...
01:53eggsbythanks Scriptor :)
01:53amalloyarohner: ew, no atom
01:54arohneramalloy: what does my drop clause look like then?
01:54amalloyjust write it by hand with lazy-seq - i don't think any of the HOFs help a lot
01:54septomin_maybe split-with?
01:55amalloyarohner: what do you want to happen if f is never satisfied? i'm writing it up
01:55arohnerreturn the unmodified seq then
01:56arohneryeah, I guess I'll use lazy-seq
01:57amalloyarohner: https://gist.github.com/2396569
01:58arohneramalloy: why the fn? why not just return lazy-seq?
01:59amalloyif you recur to insert-before you have to keep passing pred and item, even though they don't change
01:59hsteakhello. I'm new in the clojure world and i would like to implement an tokenizer. Usually i would use a finite state machine but is it the right way in clojure? If not, what would it be? (pointers?)
02:00arohneroh, missed the recur
02:00amalloythere's probably no particular efficiency gain from my ((fn ... (lazy-seq))) compared to just lazy-seq - i'm probably creating a closure and passing it pred and item behind the scenes
02:01amalloybut i like the ((fn )) pattern, since it works anywhere, not just exactly at the head of a named function
02:01yoklovheh, made a dent in a 3d game in clojurescript: http://thomcc.github.com/Argh/ . very unfinished, but is somewhat neat.
02:01yoklovbasically served as a test run for game development in cljs, with the real deal being ludum dare next weekend
02:01amalloyarohner: i like the pattern so much i pulled it out into a nice little macro at https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L105
02:02arohneramalloy: nice
02:02ibdknoxyoklov: nice!
02:02ibdknoxyoklov: code on github?
02:03amalloyarohner: updated the gist to include what it looks like with lazy-loop, if you're interested
02:03yoklovibdknox: thanks, it is! https://github.com/thomcc/Argh
02:09yoklovthe source is messy. i found that doing things elegantly would lead to… very poor frame rates. or in the case of the level generator, a 5-second lag between the page loading and anything happening
02:10ibdknoxvery cool :)
02:11laurusHow do I "subsume" a list into another? I.e, turn (1 (2 3)) into (1 2 3)?
02:12yoklovlaurus: list* works if your list is at the end.
02:12arohnerlaurus: there's flatten, but that's a big hammer
02:12yoklovotherwise you want flatten probably
02:13yoklovor maybe something like 'apply concat'
02:13laurusI could swear there was an easier way to do this :)
02:13yoklovibdknox: thanks, really it ended up being much harder to do than i thought it would be, but i think i have the tricks down so that i'll be able to make something neat next weekend
02:14amalloylaurus: i think the first step is to start with a more thorough definition of what you want to do in various cases. list*, cons, apply concat, and even (god help us) flatten might be right, so far
02:14kovasbyoklov: once you figure out the tricks, please share with the mailing list :)
02:14yoklov,(list* 1 2 3 '(4 5 6))
02:14clojurebot(1 2 3 4 5 ...)
02:14kovasbyoklob: also I'm sure the core devs would be interested in the stumbling blocks
02:16laurusamalloy, I am trying to turn this Python example, http://networkx.lanl.gov/tutorial/tutorial.html#edges , into clojure-py.
02:16laurusSo the equivalent code is (.add_edge G '(2 3))
02:16yoklovkovasb: yeah, most of them are known (e.g. don't use nice data structures in the middle of a big loop), and some weird things are annoying but seem like they might just stay that way regardless (for example, (str) is painfully slow)
02:16laurusBut I wondered how to put in the variable e from (def e '(2 3)) there.
02:17kovasbstr being slow is a concern
02:17kovasbare you using the new optimizations branch?
02:17yoklovyeah
02:17kovasbearly days in clojurescript...
02:18kovasbI've been debugging this clojurescript compiler thing for the last 3 hours
02:18yoklovstr being slow is due partially to checking type, and partially due to using gclosure's stringbuilder.
02:18kovasbpainful
02:18amalloywell, surely it's [2 3] - quoted lists are pretty uncommon and vectors are a much more normal way to represent tuples
02:19kovasbwhat does stringbuilder get you?
02:19yoklovkovasb: what compiler thing
02:19yoklovi have no clue
02:19kovasbmy personal issue
02:19yoklovhah, bummer
02:19amalloybut if you want to do python interop, i dunno man. if it were a real clojure function you'd just want apply; if it were jvm interop you'd have to pull the list apart yourself and then call (.addEdges g x y)
02:19kovasbi just set up this complicated state inside the compiler namespace
02:20kovasband now the repl went bust
02:20kovasbFML
02:20yoklovwhenever ive had an issue with str its been totally replacable with (.join (array …) "")
02:20kovasbyou mean for speed?
02:20yoklovyeah.
02:20kovasbcool. can probably macro that
02:21yoklovi was originally rendering by moving around a bunch of divs and setting their css.
02:21yoklovor just a function, the overhead isn't the function call its the other parts of str
02:22kovasbright, i mean instead of having to type (.join (array ..) "") every time
02:22kovasbso what was faster than setting the css?
02:22yoklovcanvas
02:22yoklovand rewriting everything.
02:22kovasbi c
02:23kovasbyeah i want to do relatively large visualizations in cljs
02:23kovasbso I'm interested in all this stuff
02:24yoklovhttps://github.com/thomcc/Argh/blob/63d9864742083155ef4069ab3920bafd05dd7450/src/argh/core.cljs#L212-230
02:24yoklovand that was rendering around 60fps but it was very limited in what i could do with it
02:24yoklove.g. no shadows
02:25yoklovand even if i was just (str some-num "px") it would end up being about 25% of the time spent overall.
02:25kovasbyeah canvas is the way to go for that sort of thing
02:25kovasbwow
02:25yoklovyeah, when i was doing more it was over 60%
02:25ibdknoxyou should mention that to dnolen, see what he has to say
02:25kovasbwell thats something to keep in mind for DOM manipulation libs
02:25ibdknoxmaybe we should dump google.string
02:26kovasbhow do you profile that?
02:26yoklovyeah, i was goiing to
02:26yoklovgoogle chrome profiler
02:26yoklov* profiles tab in webkit inspector
02:27kovasbcool
02:27yoklovbut google.string is probably not really built for that also
02:28yoklovthat = performance critical string manipulation, as both java and javascript allow you to just use +
02:31yoklovannnnnnd i'm out.
02:31yoklovnight al
02:31yoklov*all
02:31kovasblater
02:40laurusI have a seq of objects. Is there a way to print them all out in a nice way?
02:41laurus(just typing (seq things) prints out a list of what the type of object is)
02:42laurusOh, (map seq (seq things)) did it.
02:42RaynesI'm not sure what the goal is.
02:43RaynesWhat are these objects?
02:43RaynesAnd what is 'a nice way'?
02:43laurusRaynes, sorry, I am using clojure-py, and it was a list of "tuples".
02:43RaynesOh, yeah. No idea about clojure-py.
02:43laurusSo typing (seq mylistoftuples) just printed out a list of "builtin_tuple".
02:43laurusWell the same kind of thing happens with Java objects.
02:44amalloymost of the java builtins have mostly-non-dumb toString representations
02:44amalloyexcept arrays
02:44RaynesWell, what you're doing isn't actually printing anything. The REPL is printing the result of the code you're executing.
02:45laurusRaynes, right, good point.
02:45RaynesBut yeah, what you see when you print is whatever .toString returns for that object.
02:45RaynesAnd most of them are pretty worthless.
02:45laurus:)
02:46RaynesAt least in JVM Clojure.
02:46RaynesNot sure about clojure-py or how it works.
02:46laurusVery similar, I think
02:46laurus:)
02:47laurusI am still not sure how each of the data types of Python compare to the Clojure or JVM equivalents and how clojure-py deals with that.
02:47laurusBut just plowing through and fudging things seems to be working well so far.
02:48RaynesI'm kinda weirded out by how clojure-py is going to have to do Erlangish concurrency.
02:48RaynesBut I guess it's kinda irrelevant since it'll probably be a library thing.
02:49RaynesIt pretty much blows away any chance of compatibility though, I'd think. It'd be like a whole new dialect of Clojure at this point.
02:49laurusRaynes, the thing I am concerned about is the difference in numeric types... for example, I don't think clojure-py supports ratio.
02:50amalloyi don't think so, Raynes. you can easily write future in terms of processes instead of threads, right?
02:50Raynesamalloy: Yeah, probably. But this would pretty much make refs, atoms, etc, pointless, wouldn't it?
02:51RaynesSo anything using STM for important things would suffer.
02:51RaynesIs there even an implementation of those things at all in clojure-py? I haven't checked.
02:53amalloypython probably has some kind of shared-memory library, like mmaping a file or something. so it doesn't have to be super-slow
02:54laurusRaynes, only clojure.core has been ported, I think.
02:55amalloywell, clojure.core has all the hard stuff. so i'm inclined to think clojure.core isn't actually all ported
03:04laurusHow do I make a function that takes a list and puts (map seq ) around it? Is that a "macro"?
03:05LicenserI'd make that a function - at least I don't see a reason to make it a macro out of the box
03:06amalloythat just sounds like...(defn f [x] (map seq x))...?
03:06laurusamalloy, yes, I just figured that out :) Thanks.
03:06Null-A(def f (partial map seq))
03:06laurusI just remembered hearing about macros so I figured this might be one.
03:08bsteuberlaurus: first rule of macro club - don't use macros :)
03:09bsteuberof course there are very useful cases, but they are so rare you can neglect that until more experienced
03:10laurusThanks Licenser, bsteuber :)
03:12Licenserbsteuber is right the better you know macros the less you use them :P
03:14bsteuberlaurus: btw, the main reason not to use macros is less composability, like with higher-order-functions
03:24kralmorning
03:26laurusbsteuber, thanks.
03:29Licensermorning kral
04:58krali know it's ot, but is there anyone that would like to come to italy for some java programming?
04:58kralit's a steady job offer
04:58kralquery me if interested
04:59kralvijaykiran: we are near venice
04:59vijaykirankral: :) nice place too ... but unfortunately I can't move :(
05:15vijaykirankral: may be you should post on clojure mailing list as well
05:30wei_this example from joy of clojure (https://gist.github.com/2397225) transforms a callback-based function to a blocking call. how would I add a 5-second timeout to the blocking call?
05:31kralvijaykiran: not sure if it's clojure related... we may have some side projects that may involve clojure, but we mainly search for a java programmer.
05:31wei_i was thinking of using another thread that sleeps for 5 seconds and calls deliver, since calling deliver twice seems to work ok in my repl
05:58_KY_Does "let" evaluate arguments sequentially?
06:00_KY_Yes it does..
06:14laurusHow do I see the exceptions in the SLIME repl?
06:20vijaykiranlaurus: *e
06:24laurusvijaykiran, thanks!
06:44neotykGood morning everyone!
06:44clojurebotPardon?
06:44neotykclojurebot: are you talking to me?
06:44clojurebotGabh mo leithscéal?
07:14_KY_Is there a convenient way to store in-memory data for quick look-up?
07:14_KY_I'm thinking something similar to Erlang's ETS (Erlang term storage)
07:15angermanneotyk: that async client is yours right?
07:16vijaykiran_KY_: what type of data ?
07:16_KY_Perhaps key-value
07:17vijaykiransimple map won't work ?
07:18_KY_Ah... that's what I'm asking... =)
07:18_KY_Can they be relatively big?
07:18vijaykiranbut ETS claims - "very large quantities" :)
07:19vijaykirandepends on what you mean by "big"
07:19_KY_Well.. almost takes up all main memory
07:19_KY_Potentially, I mean
07:20vijaykiranmay be start with a map - and later switch to redis or something
07:20_KY_I see...
07:20_KY_Redis can be automatically distributed?
07:21vijaykiran"At the same time Redis Cluster, an automatically distributed and fault tolerant implementation of a Redis subset, is a work in progress, and may be a good solution for many use cases."
07:21vijaykiranhttp://redis.io/topics/faq
07:21vijaykiranI'm not a redis expert :)
07:21neotykangerman: yes, indeed
07:21neotykangerman: what about it?
07:22angermando you have a connection pool for it?
07:22neotykyes
07:23angermane.g. call c/GET client url 1000 times, but have them worked down in at most 5 concurrent calls?
07:23_KY_I see...=)
07:23neotykangerman: http://neotyk.github.com/http.async.client/doc/http.async.client.html#var-create-client
07:24neotykand examine max-conns-...
07:24angermanthanks, will take a look
07:24neotykbut what you are asking is queueing, I guess
07:24neotyknot connection pool
07:25neotykangerman: if you allow max 5 conns to host and issue too many requests, they will get rejected
07:25angermanneotyk: you are right. Though what happens if I throw that 1000 urls at one client with :max-cons-tital 5 ?
07:26angermanurgs.
07:26_KY_What if I need a map with possibly duplicate keys?
07:26Derander_KY_: that doesn't sound like a map :-)
07:26neotykangerman: let me check, I had custom queue for it somewhere
07:27Derander_KY_: how do you want that case to behave?
07:27vijaykiran_KY_: use multimap - google collections
07:27angermanneotyk: that would be great
07:29neotykangerman: my implementation for it was based on PriorityBlockingQueue and FixedTdreadPool
07:29angermanneotyk: mind sharing?
07:30neotykangerman: this is code for one of my clients, can't
07:30angermanalright, no worries :)
07:31neotykwould you like to see this feature in http.async.client itself?
07:33angermanyes, I guess it would be great if you could just throw urls at the client, and tell it how many to execute at most in parallel.
07:33angermanwaiting for the promises would do the rest.
07:36neotykangerman: can you create a ticket for autoqueueing? I guess it would be nice feature to have
07:36angermanwill do
07:36neotykthanks
07:48angermandidn't `lein deps` just download the dependencies, that were not there alread?
08:01angermanO_o what am I doing wrong now? Have i been too long away from clojure?
08:01angermanjava.io.FileNotFoundException: Could not locate http/async/client__init.class or http/async/client.clj on classpath:
08:02neotykangerman: can you gist your project.clj and file that is invoking h.a.c?
08:02angermanneotyk: I just copied the sample code from the website...
08:02neotykoh my
08:03neotykwhich sample, the basic one?
08:03angermanyep that one from the README.md
08:03angerman(ns sample ...)
08:03angerman(with-open …)
08:03neotyklet me check
08:03angermanand I added the :dependencies [[org.clojure/clojure "1.3.0"] [http.async.client "0.4.3"]]
08:04angermanran $ lein deps
08:04angermanand since then every lein command crashes. that's very strange!
08:04angermanhmm
08:04angermanneotyk: maybe… it's a stale line install somewhere.
08:05angermanI'll just clear out everything, and start anew :D
08:05neotykhow lein is crashing?
08:06angermanwith?!
08:07neotykyou said: and since then every lein command crashes. that's very strange!
08:08neotykangerman: just recreated sample from scratch, works here
08:09angermanwasn't there a tool to see what's in a jar?
08:09neotykyeah, jar -tf
08:10angermanOOOOkay!
08:11otfromHi
08:11angermanit says it doesn't find the file. But the file is there. And the jar is on the class path… wth is leiningen doing?
08:12neotykwhat version you have, and what plugins you installed
08:12neotykHi otfrom
08:12vijaykiranangerman: it would be better if you paste the output from lein command somewhere
08:12angermanneotyk: lein 1.7.1
08:15neotykangerman: I was at 1.6.2, upgraded to 1.7.1 rm lib and works
08:16neotykit must be plugins
08:16neotykbut vijaykiran is righ, post your output
08:16neotyks/righ/right/
08:28angermanhmm. completely purging leiningen and reinstallng, did the trick...
08:42neotykangerman: good that it worked
08:45neotykangerman: just reviewing docs for next http.async.clinet release, connections will not get rejected above max-conns-... limit, they will be created but will not be kept avlive.
09:05angermanhow do I turn :foo into "foo"?
09:05angerman,(name :foo)
09:06clojurebot"foo"
09:06angermanic
09:06oskarthhttp://clojuredocs.org/clojure_core/clojure.core/name
09:21_KY_How can I test for number type?
09:21gtrak,(number? 5)
09:21clojurebottrue
09:22gtrak,(number? (/ 5 3))
09:22clojurebottrue
09:22_KY_But not float...
09:22_KY_,(number? 0.9)
09:22clojurebottrue
09:22_KY_,(number? .9)
09:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .9 in this context, compiling:(NO_SOURCE_PATH:0)>
09:22_KY_I see...
09:23gtrak. is java interop to the reader i think
09:23gtrakhmm, well at any rate it treats it as a symbol, which isn't what you want
09:24gtrak,.9
09:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .9 in this context, compiling:(NO_SOURCE_PATH:0)>
09:24gtrak,0.9
09:24clojurebot0.9
09:24gtrak.x
09:24gtrak,x
09:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0)>
09:30angermanhow do I turn "2012-04-16T06:20:22-07:00" into a date object in clojure?
09:31raekangerman: use clj-time (or joda-time through interop)
09:33raekwith joda-time: (DateTime/parse s)
09:33vijaykiranangerman: or use Clojure 1.4 Instant Literals :)
09:33vijaykiranhttps://github.com/clojure/clojure/blob/master/changes.md
09:34raekthat method accepts the ISO 8601 format your string uses
09:37gtrakreader literals look awesome
09:39angermanraek thanks. :)
09:49_KY_I need to do "return-from" as in Lisp, what should I do?
09:50S11001001_KY_: use raise from slingshot
09:50Licenserrestructure the code
09:50S11001001_KY_: you cannot do a lexical non-local return in the JVM
09:51S11001001also Licenser is right
09:51Licenserof cause I am :)
09:51Licenser;)
09:51_KY_It's very hard to restructure
09:51S11001001except when spelling :)
09:52S11001001_KY_: Licenser is still right, and restructuring will probably make you a better clojure programmer, but if you really must do it the non-clojure way, use slingshot
09:52_KY_http://pastebin.com/PBV9pCnj
09:53_KY_The code doesn't work yet...
09:53Licenser_KY_ we only look at refheap pasts :P
09:53Licenserj/k
09:53gtrakis return-from like the goto joke?
09:54_KY_I don't know how to break out of the doseq when 0.9 is found
09:54S11001001_KY_: I would suggest, instead of doseq, you use a HOF that gives you intermediate results from consuming fetch-rules. iterate and reductions are good choices
09:54Licensersomething like take-while also comes to mind
09:54S11001001doseq is for non-functional code, and you are intending to write functional code
09:55Licensersomething like <metacode> (take-while #(not= % 0.8) (map evaluate-rule rules))</metacode>
09:55Licenseror drop-while < 0.8 might be even better
09:56_KY_I see...
09:56Licenserit's just a idea from a first glance at your code
09:56Licenserwhen I see it right you want to get the first result that hits 0.9?
09:57_KY_That code is messed up...
09:57Licensera bit yes :)
09:57Licenserbut that's fine :)
09:57_KY_Let me rethink and if it's not solved I'll repost
09:58gtrakhttp://en.wikipedia.org/wiki/COMEFROM
09:58angermanif I have a list of maps ({…}, {…}, …) how could I add a :rank i keyword to all? interleave, partioin, assoc? or is there a simpler solution?
09:58Licenserangerman I think there is reduce-kv now
09:58S11001001gtrak: no, return-from is like break to a lexical label, but it escapes any number of stack frames, and passes a result to be the result of the return-from form
09:59Licenseror even map-kv
09:59Licenserthat'd be greater
09:59S11001001(the block form, that is)
09:59angermanLicenser: map-indexed … whoa
09:59gtrakS11001001, ah, so like an exception
10:00S11001001gtrak: except there's no dynamic capture
10:00Licenserangerman you could also just reduce it
10:00angerman,(map-indexed #(assoc %2 :rank (inc %1)) (list {:o :a} {:o :b})))
10:00S11001001(block blah (lambda () (return-from blah 42))), that lambda will *always* refer to the exact block-blah it was created in, even if you recursively enter block-blah again
10:00clojurebot({:rank 1, :o :a} {:rank 2, :o :b})
10:00angermanLicenser: I don't see that reduce there, right now. Mind to explain?!
10:00_KY_Ok... it's still not solved:
10:01_KY_http://pastebin.com/QYGTHAXF
10:01_KY_The "result" is not defined in my code, but that's what I want to do
10:01Licenserangerman sorry I did not udnerstand what you mean with rank\
10:02angermanLicenser: ahh, ok… I just though I was missing something :)
10:02S11001001_KY_: that's the code you pasted before
10:02Licenserwell you can reduce but it get's more complicated
10:02Licenserso it's not a good solution ^^
10:03S11001001reduce consumes the whole seq, which I assume is not what's desired; reductions is a good general alternative that won't
10:03S11001001but take-while may indeed be easier
10:03_KY_Slightly corrected...
10:03_KY_How does take-while work?
10:03S11001001,(doc take-while)
10:03clojurebot"([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
10:04_KY_So if there is an empty item... the pred fails...
10:04LicenserS11001001 reduce was for angerman not _KY_
10:04S11001001Licenser: ah, sorry
10:05Licenserbut also there it wasn't the best answer :) I just didn't understand his problem
10:05_KY_The problem is quite complicated actually
10:05_KY_If the 0.9 point is reached, I want to return with 0.9
10:06_KY_Otherwise, I want to do the last line
10:06_KY_The last line should be performed after the whole sequence is processed
10:06S11001001so do a first filter, turn the body of doseq into a map, and there you have it
10:06S11001001,(doc filter)
10:06clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
10:08S11001001,(doc split-with)
10:08clojurebot"([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]"
10:08S11001001then you can submit the first of that result, then check the (seq (second result)) to see whether you ran into 0.9
10:08_KY_Ok... I see... but it's more work... =(
10:09S11001001it's not; it's just more thinking about doing things in a way you're not used to
10:09_KY_It seems slower too
10:10_KY_More computation, I mean
10:10S11001001something about premature optimization here...
10:12_KY_So I just need to test if a sequence contains [] in it, how to do that?
10:14S11001001seq or empty?
10:14_KY_I see... "some" will do
10:15_KY_(some #(= % []) sequence)
10:16tomoj#{[]}
10:16S11001001empty?
10:16clojurebotempty is amalloy: therfor I return [previous] if rest
10:16S11001001heh
10:16S11001001,(doc empty?)
10:16clojurebot"([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
10:17_KY_Ah right...
10:18S11001001if you wish to only submit those jobs *preceding* the empty, then split-with seq will help you
10:19_KY_No.. any empty will cause 0.9 and abort
10:20S11001001hmm, your original code invariably submits every job until encountering an empty
10:22_KY_Yes but that's not intended
10:22_KY_Now it's better=)
10:35megaanny one know of a lib for json to clojure data that works in cljs?
10:35goodieboyanyone using the sublime text editor with leiningen and a repl?
10:40Licenser_KY_ how about write metacode first
10:43werggoodieboy, yes it works ok, not quite as nice as an emacs setup i guess
10:44goodieboywerg: good to know. Do you know where I can find instructions to get it working? When I try to connect to SublimtRepl I get "OSError(2, 'No such file or directory')"
10:45_KY_Licenser: I think I've got that part right now...
10:45_KY_But it has another problem
10:45wkmanireHowdy folks.
10:46_KY_http://pastebin.com/xpsMjBUA
10:46wergnone beyond the official docs
10:46_KY_^^ this is the entire code
10:46_KY_Gets an error: "Cannot cast java.language.Double to java.util.concurrent.Callable"
10:47_KY_That "if" statement seems problematic
10:48S11001001_KY_: stick a # before (solve-rule
10:49_KY_Really?
10:49S11001001you forgot the lambda :)
10:49_KY_What would that do?
10:49S11001001what do you give submit?
10:50_KY_Ahh... I see
10:51_KY_Works now... thanks! =)
10:52mmarczykdnolen: ping?
11:26FrozenlockI'm experiencing some difficulties with java interop: I can use the class without any problem, even import them... but I get an error each time I try to do the same with a nested class. How can I use a nested class?
11:28Bronsaclass$nested
11:28Bronsainstead of class.nested
11:28FrozenlockWith the dollar sign?
11:28Bronsayes
11:28FrozenlockThank you so much!
11:33Lajla&(quote #(+ %1 %2))
11:33lazybot⇒ (fn* [p1__7230# p2__7231#] (+ p1__7230# p2__7231#))
11:34LajlaOkido
11:34Lajla&(quote #(+ %1 %2))
11:34lazybot⇒ (fn* [p1__7239# p2__7240#] (+ p1__7239# p2__7240#))
11:34Lajla&(quote #(+ %1 %2))
11:34lazybot⇒ (fn* [p1__7248# p2__7249#] (+ p1__7248# p2__7249#))
11:34LajlaHmm
11:41angerman neotyk does h.a.c. support compression?
11:42neotykangerman: yes
11:42neotykcheck create-client
11:44angermanneotyk: thanks. what are the defaults?
11:44kurtharrigerIs this a bug - seems lazy sequences don't are written as function calls by printer:
11:44kurtharriger(read-string (binding [*print-dup* true] (prn {:propertes (range 0 2)} )))
11:45kurtharriger(prn {:propertes (range 0 2)} )) => {:propertes (0 1)}
11:46kurtharrigerwith print-dup #=(clojure.lang.PersistentArrayMap/create {:propertes (0 1)})
11:47Chousukethat looks correct to me
11:47kurtharrigertry reading it back you get a null pointer exception
11:47FrozenlockAnother java question: My example code "cast" a class to another object--> (some-class)object.method(argument1 argument2) . In clojure: (method. object argument1 argument2 and...?
11:48kurtharrigerwouldn't {:properties (0 1)} imply apply the function 0 to 1 and save the result to :properties in the map
11:48ChousukeFrozenlock: you shouldn't need a cast.
11:48Chousukekurtharriger: no, if it's only read
11:48Chousukeif it's evaluated, then yes
11:48neotykangerman: compression is disabled by default
11:48kurtharrigeryes, thats what *print-dup* is supposed to do?
11:49Chousukeyeah
11:49ChousukeI mean, it's supposed to give you a form that is okay when you read it
11:49kurtharrigerto me it seems that lazy-seq should be serialized by the reader as vectors
11:49angermanneotyk: what I mean is: I guess it would be helpful if http://neotyk.github.com/http.async.client/doc/http.async.client.html#var-create-client would list the defaults.
11:49angermane.g. what' the default connection timeout, request timeout, ...
11:49kurtharrigerbut it currently doesn't do that, it gives me a form that throws an exception when I read it back
11:49Chousukekurtharriger: if you do (read-string "(0 1)") you get the correct output
11:50Chousukekurtharriger: how are you reading it back?
11:50neotykangerman: indeed that would be helpful, I agree
11:50kurtharriger(read-string (binding [*print-dup* true] (prn {:propertes (range 0 2)} )))
11:51kurtharrigerdoh sorry shouldn't be prn
11:51kurtharrigerthats probably my problem
11:51Chousukekurtharriger: prn returns nil :P
11:52LauJensenEvening gents
11:52LajlaChousuke, miksi on: ##(symbol? (symbol "EESTILAISET ON TULEVAT, MIEHITÄ TYKIT"))?
11:52lazybot⇒ true
11:52FrozenlockChousuke: ... I don't understand what you mean :( I'm interested to use the methods associated with the 'some-class' casted to the object in my java example.
11:53LajlaEi ole true, symboleissa ei voi olla spacejä
11:54fmwwhat is the path I can access files in my ring uberwar with? I put a directory called database-views in my resources directory, which is included in the uberwar archive (e.g. WEB-INF/classes/database-views/map_user_by_username.js). However, e.g. (slurp "database-views/map_document_by_feed.js") returns a file not found exception.
11:56fmwlocally (i.e. when not running from the .war on tomcat, but with jetty through lein ring server) it works fine, through a symbolic link I created with database-views/ in my main project directory, so this only concerns the .war deployment.
11:58kurtharrigerChousuke: is there an easy way to make pr-str print lists as vecotrs? I would like to take a datastructure and copy and paste it into a test, but I have to replace lists with vectors otherwise the tests tries to evaluate them as functions
12:00kurtharrigerI could probably use clojure.walk... but I'm not sure yet how to do that
12:00angermanIf I have multiple threads calling one function, but I want that function to be executed in sequence, can clojure help me here?
12:02zamaterianfmw, look at http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/servlets/DefaultServlet.html
12:04tomojangerman: if I understand what you mean, https://gist.github.com/0a0f95c07b16fcc6f358 is one way
12:05fmwzamaterian: thanks, but I'm not sure if I described what I'm intending to do clearly enough. I'm not trying to serve files, but I want to read a file from my clojure application. This works fine with full, hardcoded paths (see https://github.com/fmw/vix/blob/master/src/vix/db.clj for this exact same code, but with hardcoded paths). However, I'm trying to get rid of the hardcoded paths and include the files in the .war instead.
12:05angermantomoj: so agents have a work queue?
12:06Chousukekurtharriger: no, but you can quote the lists
12:06fmwzamaterian: I think your link concerns serving files? I just want to bundle them (which works) and access them (which does not, because I get a file not found exception).
12:06kurtharrigerChousuke: automatically or manually after pasting it into my test?
12:06Chousukemanually
12:06tomojangerman: yeah
12:06angermantomoj: but I don't get a promis back, for which I could wait, no?
12:06Chousukeit's just a single '
12:07angermantomoj: ohh, maybe I can create a promos, and have it delivers by the agent.
12:07tomojalso if one of the fns throws an error, agents may not do what you want
12:07kurtharrigerChousuke: yeah easier perhaps but I think vectors are easier to read in the tests
12:07angermantomoj: ?
12:08zamaterianfmw, 2 sec, then i have something you can use
12:09tomojangerman: you want each thread to be able to get back the return value of the fn they scheduled? or do you just need the latest return value at any point?
12:10tomojif the former, agents don't seem right
12:10tomojoh, well, yeah, you could just have the send-off'd fn deliver the promise
12:11tomojstill seems strange to use agents just to synchronize
12:11zamaterianfmw, https://refheap.com/paste/2150
12:13technomancyibdknox: have you ported lein-noir over to lein-newnew yet?
12:14ibdknoxtechnomancy: I have a pull request for it, need to clean it up a bit though. Just haven't had time :(
12:14mmarczykdoes anybody have any experience testing ClojureScript @ jsPerf ? I'm running some test cases for the port of PersistentHashMap I'm working on and getting completely crazy results
12:15fmwzamaterian: let me have a look at that, thanks
12:15technomancyibdknox: we made the newnew stuff nicer in preview3; if you have a link to the pull req I can put a pointer there to make sure it matches our convention.
12:16technomancythe old style of adding it to the :user profile will still work, but the new style can be used without messing about with profiles
12:16ibdknoxtechnomancy: https://github.com/ibdknox/lein-noir/pull/6
12:16wkmanireIs there a library function that will compare two numbers and return negative, zero or positive based on their relation? example: (compare 25 50) .1, (compare 50 25)
12:16wkmanire-oops
12:16wkmanirepremature return
12:17technomancycool
12:17wkmanire(compare 25 50) -> -1, (compare 50 25) -> 1, (compare 50 50) 0
12:17wkmanirethat's what I'm looking for.
12:17rplevywhen using lein 2 I miss being able to see my transitive dependencies by looking in libs. Maybe this would be a good feature to add to lein-pprint?
12:17technomancyrplevy: try `lein deps :tree`
12:17rplevyoh neat
12:18rplevytechnomancy: thanks!
12:18technomancybrought to you by cemerick and xeqi
12:18mmarczykwkmanire: yes, it's called compare (in clojure.core)
12:18wkmaniremmarczyk: Seriously?
12:18_philis there a way to refer to symbols in single-segment namespaces in clojurescript?
12:18mmarczykwkmanire: totally
12:18mmarczyk:-)
12:18_phili.e. i can write com.bla.f/symbol
12:18_philbut not com/symbol
12:19wkmanire&(doc compare)
12:19lazybot⇒ "([x y]); Comparator. Returns a negative number, zero, or a positive number when x is logically 'less than', 'equal to', or 'greater than' y. Same as Java x.compareTo(y) except it also works for nil, and compares numbers and collections in a type-independent manner. x must implement Comparable"
12:19wkmanire:D
12:20_philspecifically, im trying to write a macro that invokes a domina function without requiring the client code to explicitly :require domina
12:21seancorfield_phil: your macro could include a (require ..) call on domina?
12:21_philso what i would like to do is something like (domina/add-class! ...)
12:21_philseancorfield: i thought clojrescipt didnt support require? only ns?
12:21wkmanirecemerick: I really liked the two code snippets you gave for negated-sum-str where you illustrate a usage of comp.
12:22wkmanirecemerick: I was already more or less understanding the concept, but the example made it crystal clear.
12:22seancorfield_phil: hmm, haven't done enough cljs to know, sorry
12:22cemerickwkmanire: excellent :-)
12:23dnolen_phil: not possible far as I know.
12:24_phildnolen: thx a lot
12:25mmarczykdnolen: hi
12:25mmarczykdnolen: I've put up some tests for phm on jsPerf, but the results are crazy :-(
12:26angermantomoj: I just need the thread to block until that piece of code has been processed
12:26angermandon't care about the result actually
12:26tomojoh
12:26tomojthen (locking 42 ...) should work
12:26angerman?
12:26tomojthough maybe using something other than 42 would be better..
12:27dnolenmmarczyk: thx, I suspected that - I've done some benchmarking - PHMs are way slower than ObjMap.
12:27dnolenmmarczyk: link?
12:27dnolenmmarczyk: especially access times
12:27mmarczykdnolen: actually these results are the opposite sort of crazy
12:27tomojjust have a lock object (e.g. (Object.)) that all the threads have in scope, and wrap the code that should be synchronous in (locking lock-object ...)
12:27mmarczykdnolen: link posted at the ticket's page
12:27mmarczyklinks, rather
12:28mmarczykdnolen: the branch with the transient stuff attempts to do some switching
12:29dnolenmmarczyk: ooh, actually that looks really good :)
12:29mmarczykdnolen: there's definitely some conceptual work left to be done, since e.g. TransientObjMap (obviously) trounces everything for updates, but if all of a sudden a non-string key turns up @ 5000 entries, the cost of conversion to PHM will be noticeable
12:29mmarczykdnolen: do you mean you actually believe that? :-D
12:30dnolenmmarczyk: it's possible, I need to try the patch out myself.
12:31fmwzamaterian: thank you, this solves it. I didn't realize I needed to open files from the classpath directly in this case, instead of through conventional means like slurp.
12:32mmarczykdnolen: great, looking forward to your feedback
12:32dnolenmmarczyk: http://jsperf.com/cljs-persistent-hash-map-tiny-assoc
12:32dnolenmmarczyk: updated with Safari and FF Nightly
12:32dnolenmmarczyk: basically V8 is insane.
12:33dnolenmmarczyk: other browser looks good and reasonable.
12:33mmarczykdnolen: wow, thanks
12:33ibdknoxslashdot is a depressing place
12:33autodidaktoDoes the clojure community have strong opinions about code formatting? Particularly column width
12:33mmarczykdnolen: about V8 -- yeah -- I can't believe it
12:34dnolenmmarczyk: haha yeah, for large maps PHM destroys.
12:34autodidaktoibdknox: I'll make some hot cocoa. tell me everything
12:34mmarczykdnolen: :-)
12:34ibdknoxautodidakto: lol
12:34autodidaktokids can be so cruel :)
12:34angermantomoj: so, i could basically wrap the body of the function i want to be executed synchronized into (locking o body), right?
12:34angermanwhere o is (def o (Object.))
12:35mmarczykdnolen: I like the flat bars on the comparison chart
12:35technomancyclojurebot: style guide?
12:35clojurebotTitim gan éirí ort.
12:35technomancyclojurebot: style?
12:35clojurebotstyle is http://paste.lisp.org/display/81021
12:35autodidaktotechnomancy: thx
12:35technomancyhm... not quite what I was looking for
12:35autodidaktohtm
12:35autodidaktohrm
12:35technomancyhttp://mumble.net/~campbell/scheme/style.txt
12:35technomancymostly applicable to Clojure
12:35autodidaktoGotcha
12:35tomojangerman: think that should work, yeah
12:36technomancyI think the prevailing opinion is that if you have super-wide lines you will annoy people who split their screens into multiple panes; said people may mock you for it
12:36autodidaktooh right I saw this one. they lost me when they started calling ()'s "round brackets"...
12:37dnolenmmarczyk: OK this is looking promising PHM looks nearly always better. so we can probably just replace. I'll do more testing later tonight and if it looks good, apply the patch.
12:37dnolenmmarczyk: thanks a lot!
12:37mmarczykdnolen: fantastic, thanks!
12:38angermannode.js 0, clojure: 1
12:38zamaterianfmw, your welcome :-)
12:39wkmanireDoes #clojure have a preferred paste?
12:39mmarczykwkmanire: http://refheap.com :-)
12:40RickInGAI am trying to translate a simple example from js to cljs, drawing an image on a canvas.. here is both the js and the cljs https://refheap.com/paste/2151
12:40fmwzamaterian: it seems that clojure.java.io/resource does the same thing, though?
12:41RickInGAI am able to draw rectangles and text, but the image isn't working. not sure if it is because of the "new Image()" or the callback
12:41wkmanireI'm building a guessing game for the terminal. I want to branch a function four different ways based on some user input. https://refheap.com/paste/2152
12:42wkmanireShould I nest (if) a bunch of times or is there a better way?
12:42clojurebotGabh mo leithscéal?
12:44technomancywkmanire: cond is typically used for that
12:44zamaterianfmw, thx
12:45mkis there anything that clojure is missing out on by not having currying?
12:45wkmanire&(doc cond)
12:45lazybot⇒ "Macro ([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
12:45RickInGAmk: I think partial does most of what currying does
12:45wkmaniretechnomancy: Thank you.
12:46technomancynp
12:47technomancymk: currying is more concise than partial, but it doesn't support var-args
12:47mkwkmanire: are you doing the typical if ... else if ... else if thing? or are you doing if(..){if(..){ ... }}?
12:48wkmanireif elif elif else
12:48wkmaniremk ^
12:49mkwkmanire: yep, definitely what technomancy said then. You can express the other one using an and, and you can express guards using an or (in case you ever run into that)
12:49wkmaniremk: Yo ulost me with "the other one" and "guards"
12:49wkmanireYou*
12:50autodidaktoVimClojure users: There's a new nailgun server plugin. Supports Lein 2; standalone repl connected to server -> https://github.com/sattvik/lein-tarsier
12:51technomancyisn't nailgun about to be deprecated by nrepl?
12:51mkwkmanire: the if(test) { if (test){...}} -> use and. A "guard" is when you have a sequence of "fallback" values - if (a==null) a=foo; if (a==null) a=bar; is (or a foo bar)
12:52autodidaktotechnomancy: the creator of vimclojure wants to move to nrepl, but he's struggling with the "backend"
12:52autodidaktolink incoming..
12:52technomancyI thought nrepl was the backend
12:52mkwkmanire: you can safely ignore what I'm saying though, your immediate problem is solved :)
12:52autodidaktohttps://groups.google.com/forum/?fromgroups#!topic/vimclojure/WezVKn5eucQ
12:53autodidaktoMeikel: "Currently only the nrepl client is done. The backend needs serious adaption to nrepl from nailgun. This not done, yet. I don't recommend its use unless you want to help migrating things. Any help is appreciated."
12:53wkmaniremk: Okeydokey :)
12:54mktechnomancy: hmm. Currying is also harder to understand than partial, which seems to outweigh the fact that it's concise. Was there anything else special about it?
12:55RickInGAwould js: var SomeImage = new Image(); translate to (def SomeImage (. Image)) in cljs?
12:56wkmaniremk: I'm just starting out with clojure. I've read through the first couple of chapters of cemerick's book and I'm trying to write my first simple app just to burn-in the concepts I've learned so far. Unfortunately with this little sample app I don't need to map, comp or destructure anything. But it's still nice to get used to the syntax and such.
12:56Raynestechnomancy: Yeah, I'm not going to bother with interactive Vim stuff until the nrepl support is done. I don't want to figure that crap out unless I get to use it for a year.
12:56pellebThis probably comes under the department of schoolboy error, but when I run "lein jar" in my project https://github.com/pelle/clauth it packages up all the dependencies within it. What am I doing wrong? I'm using lein-1.7.1.
12:57autodidaktowkmanire: map, comp, and desutrcture anyway :)
12:58wkmanireautodidakto: Where there's a will there's a way I suppose.
12:58wkmanireAh, and I aughta use reduce too. Although to be honest, I'm already familiar with the premise of map and reduce from the the underscore.js library.
12:58autodidaktowkmanire: yeah, it's a throwaway project to learn the first few concepts. It's going to be contrived anyway, might as well shove in as much learning as you can
12:59mkwkmanire: yeah, definitely. And like autodidakto said, you can mess around with those things. You might find that there actually is a good reason to use advanced-seeming functions instead of something you're doing. You might check out 4clojure.com, they have nice exercises for starting out
12:59wkmaniremk: Crap! I meant to do that for this.
12:59wkmaniremk: But somehow I completely forgot about 4closure.
13:00wkmanireI'll just finish this as it is and then tomorrow I'll do a 4clojure problem.
13:01mkwkmanire: yep. Feel free to ask here if you run into any problems, or are wondering if there's an easier way to do something. The early 4clojure problems are very short.
13:02wkmaniremk: Oh I've been feeling free alright. I pester these poor guys almost constantly.
13:02wkmanireha ha ha ha
13:02wkmaniremk: Thank you.
13:02mkwkmanire: no problem, have fun :)
13:05pellebI can see that running lein compile unpacks all dependencies into my classess directory. Is this right?
13:12wkmanirehttps://refheap.com/paste/2153, For the :else of this conditional expression what is the correct way to recurse?
13:12wkmanireShould I use recur or just call query again?
13:15cemerickJust (recur n) should be fine
13:15Chousukebranches of cond are in tail position
13:24technomancypelleb: that's just an unintentional side-effect of the clojure compiler being transitive
13:24technomancyif you don't require your dependencies at compile-time, they won't end up in classes/
13:25technomancypelleb: in your case it looks like :main is triggering AOT; you want to either remove it or do :main ^{:skip-aot true} clauth.demo
13:25technomancyyou really don't want to distribute a library jar with AOT unless you need gen-class or something
13:27pellebtechnomancy: Thanks. Don't quite understand what AOT is, but I did notice the jar's were huge. I'll try adding that skip-aot
13:29technomancyor just remove :main; you can have people use `lein run -m clauth.demo` instead
13:30pellebtechnomancy: adding the skip-aot worked a charm. Is there a particular reason to prefer removing the :main ?
13:31tomojwhen you do need to gen-class something, is there no easy way yet to avoid putting too much in the jar?
13:31wkmanirecemerick, Chousuke: Thanks. Sorry for the delayed response. I was instructed by commander girlfriend to take a break and eat my lunch
13:31wkmanireWhich was delicious.
13:32technomancypelleb: just tidiness I guess
13:32technomancytomoj: in some cases you can perform require calls at runtime
13:32TimMcpelleb: Ahead-Of-Time compilation (conversion into .class files)
13:33pellebtechnomancy: thanks for your help.
13:33technomancytomoj: if you just want an uberjar, use lein-otf
13:33technomancybut other gen-class uses are trickier
13:33pellebTimMc: thanks. I'll read up on it.
13:39mwillhiteis there a way to bring a dependency in as source in leiningen? I'm having issues with a ring middleware, but unable to determine what is going on
13:39mwillhiteI'd like to bring in the source and stick a debugger in the function I'm calling
13:39technomancymwillhite: most ring middlewares come with source
13:40technomancyhopefully all, actually
13:40mwillhitetechnomancy: where can I find it?
13:40mwillhiteits not under lib…
13:40technomancyit should be
13:40mwillhitethe .jar is
13:40technomancyinside the corresponding jar
13:40mwillhiteoh
13:40mwillhitesorry, new to .jars
13:40RaynesThey're just zip files.
13:41mwillhitehm okay
13:41mwillhiteso whats the best way to access that code then? Do I have to re-jar it with every change I make?
13:41technomancyin Emacs you just press M-. on the name of a function and it finds the source for you; many other editors have similar functionality
13:42mwillhiteokay
13:42technomancydepends on the extent of the change. if you're just debugging, you can probably get away with editing straight out of the jar file
13:42technomancyif you're making improvements you want to submit upstream you should use checkout dependencies
13:43mwillhiteokay, yeah I just want to stick a trace in there so I can get some insight as to whats going on
13:43mwillhitethanks for your help
13:44goodieboyI'm having a hard time deciding on whether i should test a private function or not. One the one hand, it'll make the tests brittle (refactoring etc.) but on the other, I'll feel more confident that my app is working properly. Any advice here?
13:45TimMcAsk 3 different CLJers and you'll get 5 different opinions.
13:45goodieboyTimMc: I figured :)
13:45ibdknox|awaydon't have private functions! :p
13:45technomancywat
13:46ibdknox|away:D
13:46technomancyibdknox|away: spoken as someone who hasn't had to maintain a library for over a year yet, I see =)
13:46goodieboyibdknox|away: ha, well that was easy :)
13:46ibdknox|awaytechnomancy: you have no idea :p
13:46TimMctechnomancy: Weren't you marking fns as ^:internal?
13:46ibdknox|awayThough I was only half joking
13:47dnolentechnomancy: I think it would be nicer if ^:private was just documentation and didn't actually mean anything.
13:47ibdknox|awaydon't make them actually private
13:47ibdknox|awaywas my only statement
13:47tmciver_my $0.02: I feel better testing private fns
13:47drewrdoes emezeske hang out in here?
13:47dnolendrewr: yes
13:47technomancydnolen: maybe if completion functions filtered them out
13:47goodieboytmciver_: that's the direction i'm leaning
13:47drewrhaving an issue with lein-cljsbuild building js that doesn't find goog.string
13:48TimMcdnolen: But that would interfere with :use without :only... oh. :-P
13:48ibdknox|awaydrewr: nodejs?
13:48dnolendrewr: in what context, Node?
13:48ibdknox|awaydrewr: use optimizations :simple
13:48drewribdknox|away, dnolen: jesss
13:48technomancyeven without considering testing it's common to have defs that are internal to the library but not limited to a single namespace.
13:48technomancywhich is why I like ^:internal
13:48dnolendrewr: :whitespace optimization won't work, you need to use at least :simple
13:48tmciver_goodieboy: I was recently discussing this with TimMc. I discovered how to use @#' to good effect.
13:48angermanneotyk: would a.h.c. tell me when the connection is reset?
13:48drewrdnolen: will :advanced work ok too
13:48dnolendrewr: yes, that too
13:49drewrkthx
13:49goodieboytechnomancy: what is ^:internal?
13:49TimMcgoodieboy: By "brittle", you mean implementation-specific? I test implementation details all the time.
13:49technomancygoodieboy: just a way to communicate intent via metadata
13:49technomancyit doesn't mean anything special to the compiler
13:49autodidaktogoodieboy: if you're worried about it breaking. test it. if you're worried about worrying too much, read books and articles about testing :)
13:50goodieboyTimMc: well, i might see that my code can be optimized, but requires a either a rewrite, or new functions etc.. Making those changes would then break my tests
13:50goodieboytechnomancy: ahh ok
13:50drewribdknox|away, dnolen: thanks that worked
13:50technomancyI don't think ^:internal is necessarily the right thing here, but it's good for other cases where you can't make things private but still need to give a strong "hands off" message
13:51drewrI'm getting a node warning about the sys module being renamed to util... is that something that gclosure has to fix or is that cljsc-emitted code?
13:51dnolendrewr: the issue is that :whitespace optimizations emits goog.provides which don't work in Node.js. The other optimization modes remove them.
13:51dnolendrewr: that's something to fix in the CLJS Node support I think.
13:52RickInGAIs it possible to have a catch block that doesnt do anthing? (catch Exception e) is not making Chrome happy
13:53dnolenRickInGA: are you talking about CLJS?
13:53RickInGAdnolen yes
13:53dnolenRickInGA: you want Error
13:53dnolenjs/Error
13:53RickInGA(catch js/Error e) ?
13:54dnolenRickInGA: yes
13:54RickInGAdnolen beautiful! thanks!
13:54dnolenRickInGA: np
13:58jamiiThis took an awful lot of coding for so few lines - https://gist.github.com/2400297
13:58dnolenjamii: neat!
13:58RickInGAwow
13:59jamiiI will comment it when I recover
13:59TimMcTHat's what they all say. :-P
13:59mdeboardjamii: nice
14:00technomancyhuh; first time I've seen with-local-vars used
14:00jamiiI need it so that the lazy recursion in is-fact* work properly
14:00jamiiIf it was at the top-level I could just use declare
14:00jamiiTime to go home
14:02RickInGAI am a complete github newb... if someone forks your repository, it means they have made their own branch?
14:02neotykangerman: what do you mean by connection reset, like dropped?
14:02dnolenjamii: minor edit https://gist.github.com/2400319
14:03neotykangerman: anyway, if there is problem with underlying conn while executing request you will get error
14:03angermanneotyk: when I run a connection logging application, I see some connections as "reset by peer", but (client/error resp) seems not to hold any value. I guess i should assume no problem, then?
14:04neotykangerman: it might be that connection was idle
14:05neotykangerman: keep-alive, and when you don't run any request on it, there is no problem for you
14:05amalloyRickInGA: close enough
14:06RickInGAamalloy: thx. I was looking at the wrong graphic. Created my first ever project on github and I had watchers, not forks, which makes more sense to me :)
14:06angermanneotyk: I'll keep a close eye on it… :)
14:07neotykangerman: if you would find an issue with it, do let me know :)
14:07angermanneotyk: :) sure will...
14:12sadgerdnolen and other that helped I got vim working with clojure, so thanks in the end lein nailgun seems to maintain my dependencies
14:13dnolensadger: excellent
14:14sadgerthe thing with the lein nailgun is that it needs to be started with a particular project but as you know you can add some packages for all projects so it works just fine
14:14sadgerin particular some of the repl tools and trace which I couldnt get working
14:14sadgerbut all is well
14:15sadgerNow all that remains is to learn clojure!
14:15sadgerI bought the joy of clojure just out of interest to be honest would you recommend any other books/resources for entry level clojure (just experiance with java really and some haskell)
14:17dnolensadger: been hearing good things about the new O'Reilly book
14:17technomancysadger: yeah, another vote for the O'Reilly one
14:17sadgerhmm interesting I saw that on "beta" release
14:17sadgerI will have a look i think thanks
14:18cemericksadger: The ebook is available; shipping in dead-tree style in a couple of days http://www.clojurebook.com/
14:18sadgercemerick: dead tree! ha ha
14:18TimMcpbook
14:20sadgeri really should just get the e-versions as I have a android tablet but I find books easier to read
14:21sadgermostly for navigation purposes
14:21technomancydepends on whether you want an introductory read or a reference
14:21deechHi all, is there anything similar to dynaspring (http://code.google.com/p/dynaspring/) in clojure? Dynaspring is a Spring integration library for ABCL.
14:21sadgergoing to the index of an ebook and back and forward between chaptesr us a stress
14:22cemerickdeech: wow, what a tech combo! o.0
14:23sadgerdeech: this? https://github.com/lprefontaine/Boing
14:23cemerickI don't think Boing has anything spring-specific to it IIRC.
14:23deechcemerick: What do you mean :)
14:23sadgerthat's just from a google search so usure if it fit your critera
14:24technomancywhy do you think you need spring for Clojure?
14:24cemerickdeech: I've used spring (actually, just spring-security) with Clojure, so the two interop just fine. I don't think anyone's built a spring context DSL for Clojure, though.
14:25deechtechnomancy: Bunch of legacy code that needs to be able use Spring modules etc.
14:25technomancyoh, ok
14:25deechcemerick: It's kinda nice, you can inspect what's been loaded (and create/load beans dynamically) at runtime. No more guessing what the XML file does.
14:26cemerickYeah, I can see the attraction if you're knee-deep there.
14:26cemerickI've managed to dig myself out of ever using spring anymore, though.
14:27deechcemerick: Trying to make the best out of a conservative development environment.
14:27cemerickSure. I totally appreciate that. :-)
14:27deechThank you all for your help.
14:38wkmanireAlright, who wants to play my extremely awesome number guessing game?
14:38wkmanirehttps://refheap.com/paste/2155
14:38wkmanireI finished my exercise for the day.
14:39mfexcemerick, thanks for the friend lib, indeed the missing piece for clojure web apps
14:39cemerickmfex: well, one of many, perhaps :-)
14:40angermanhmm… I have the feeling that sqlite ist hitting a wall. Does anyone know how to see what time queries take?
14:40mfexeverything else can be done with interop, authentication was is in need of a clojure lib to play nice with ring
14:41mfex0.0.6-SNAPSHOT works great with leiningen 1.7.1 so world domination is next
14:46cemerickmfex: Thanks for the confirmation; 0.0.6 is now released.
14:50mfexcemerick, for open id friend requires a post to /openid with the endpoint, is this required by the openid protocol to not allow get links to start the openid workflow?
14:53cemerickmfex: You can set the openid workflow URI to anything you want, but yes, it requires a POST with an identifier param to start. If you want to give the user a button-array or field to enter their own openid endpoint, you can put those on a form accessible to anon users (e.g. @ /login) that POSTs to /openid (or whatever you configure as :openid-uri in (openid/workflow).
14:54mfexyeah, I use the form as a button/link now, just wondering why the post was enforced, a get can work as well right?
14:54cemerickNot at the moment.
14:54cemerickThe POST requirement is mine. GET doesn't make sense to start the openid workflow AFAICT; that, and it makes the workflow itself simpler (i.e. no need to support configuring multiple URIs).
14:55mfexok, makes sense. Just wondering
14:58amalloywkmanire: you forgot a reason the computer can lose the game: i choose a fraction, since the rules don't forbid it
15:02TimMcamalloy: I'm thinking of a real number, can you guess it in 20 tries? I'll tell you high/low.
15:03ibdknox|awayTimMc: your number is e.
15:03amalloy0, 1, 2, pi, e. if i haven't gotten it yet your number is dumb
15:03TimMcibdknox|away: high
15:03TimMcamalloy: low low high high high
15:04TimMcYou all lose, it was phi.
15:04cemerickI figured tau.
15:04TimMcI would have accepted tau just on principle.
15:04ibdknox|awaylol
15:05TimMcNote: You can do "binary search" on an unbounded range, such as the integers.
15:07amalloyi select n+1 as my number, TimMc
15:07technomancyhttp://en.wikipedia.org/wiki/Aleph_number
15:07amalloyecho "yes 'too low'" > guess-my-number.sh
15:08technomancyecho "exit 1" >> guess-my-number.sh
15:09wkmanireamalloy: You chose a fraction?
15:09wkmanireamalloy: You bastard!
15:09amalloywell i didn't actually play. but i read the code
15:10TimMchaha
15:11wkmanireI guess I need to fix the directions.
15:11wkmanireChoose a real positive integer that is greater than 0 and less than 101.
15:11wkmanireIt would be hard to pick a negative integer in that range.
15:11wkmanirebut you get the idea.
15:12TimMcchoose n such that (and (integer? n) (< 0 n 101))
15:13wkmanireTimMc: Nice.
15:14amalloyc'mon, everyone is gonna prefer <=
15:14wkmanireI never even thought about passing more than 2 args to < or >.
15:14TimMctrue
15:14wkmanire&(doc <)
15:14lazybot⇒ "([x] [x y] [x y & more]); Returns non-nil if nums are in monotonically increasing order, otherwise false."
15:15wkmanireCool
15:15TimMc&(apply < [1 2 3 4 5])
15:15lazybot⇒ true
15:15TimMc&(apply < [1 2 300 4 5])
15:15lazybot⇒ false
15:15wkmanire&(apply < [1 2 3 "a fraction" 5])
15:15lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:16amalloyyou can do cool bounds-checking of 2d (or whatever) "points" with that feature. (every? true? (map <= [minx miny] the-point [maxx maxy]))
15:16TimMc&(< 0.1 2/3 4)
15:16lazybot⇒ true
15:19autodidaktoibdknox|away: Any thoughts on my pull request? -> https://github.com/ibdknox/cljs-template/pull/5
15:19wkmanireamalloy: That is definitely nicer than the way I've done that in a few other languages.
15:19wkmanireamalloy: Usually involves 4 explicit comparisons in a for loop.
15:20technomancyautodidakto: if you adhere to a specific group-id convention you don't need to add it to the user profile as of preview3
15:20technomancyhttps://github.com/Raynes/lein-newnew/issues/12
15:21wkmanireTime to start cranking out some VB.Net imperativeness. :( Later folks.
15:22angermanhow do i run an ubarjar?
15:22TimMcangerman: kava -jar
15:22TimMcjava, even
15:22autodidaktotechnomancy: Ok i see. Will incoporate that info.
15:22angermanhmm. says: Exception in thread "main" java.lang.NoClassDefFoundError:
15:22angermanI must have doe something wrong :/
15:25angermanTimMc: if $ lein run, works flawlessly. that -standalone.jar should as well, no?
15:25TimMcangerman: It's looking for a .class file in that jar.
15:25angermanTimMc: there's only a __init.class and a .clj file in there
15:26tmciver_angerman: jars in lib must be on classpath
15:26tmciver_ /lib
15:26angermantmciver_: it's actually complaining about my project/core class
15:27angermantmciver_: and I though that an uberjar actually contained all lib jars.
15:27tmciver_angerman: ah, yes, uberjar does
15:28angermani do have core__init.class and cor$_main.class but no core.class in the classes folder? did I do something wrong?
15:28TimMcangerman: :gen-class in core.clj?
15:28angermanno. ahh. I should, I guess due to the -main, eh?
15:28TimMcyep
15:29TimMcangerman: If you want to avoid all this AOT compilation nonsense, I would recommend my lein-otf plugin. :-)
15:29gf3ibdknox: If you don't have one already, and providing you like it, I'd like to donate this icon to Light Table → http://dribbble.com/shots/186884-Editor-Icon
15:30angermanTimMc: link?
15:30gf3ibdknox: It needs some cleaning up, but I think it could work
15:30TimMchttps://github.com/timmc/lein-otf
15:31TimMcangerman: FYI, I haven't tried it with lein 2.x yet.
15:31ibdknoxgf3: dude, very pretty
15:32gf3ibdknox: I won't be offended if you have something else in mind
15:32ibdknoxgf3: haven't gotten that far yet, to be honest :) Gotta remember I was doing something completely different 3 days ago haha
15:32gf3ibdknox: Absolutely
15:35autodidaktoibdknox: pull request updated -> https://github.com/ibdknox/cljs-template/pull/6
15:37ibdknoxautodidakto: I think you're missing a "need" in there
15:37autodidaktodoh *checking*
15:37ibdknoxautodidakto: past that, looks like it's clearer :) I'll happily take it
15:38angermanso, now I need to figure out how to create a cronjob...
15:38autodidaktoextra "need". I originally said "when you need it", but then it sounds clunky when you later reused the word to say "nothing more is needed"... :P Ok let me fix that
15:39autodidaktoer. Best git practice to commit/rebase/whutcha-mo-call it a pull request? (or do I have to close and reopen?
15:39autodidakto*practice to update/
15:42amalloyautodidakto: just...add commits to whatever branch your pull request is attached to
15:42autodidaktoah, google says github updates it automatically. nvm
15:43autodidaktoamalloy: thanks
15:43amalloybut it's entirely a github best practice, not a git best practice. pull requests are a github thing
15:43autodidaktogotcha
15:45cduffy...well, the general practice behind "pull requests" existed long before github existed
15:46cduffyheck, before _git_ existed -- sending an email to the mailing list asking for pull+review+merge was common practice in the GNU Arch community
15:46cduffy(not Arch Linux the distro, GNU Arch the DSCM)
15:47autodidaktoThe bad-old-days of version control?
15:47cduffyWouldn't say that, necessarily. Some of Arch's features almost nobody has today
15:48cduffyie. history-sensitive merge
15:48cduffynow, from a usability perspective, granted, it was awful
15:49autodidaktosomething about VC and UI/UX... they can't seem to mix
15:50cduffy(...OTOH, making bzr comfortable to users coming from _git_ is something they're only now starting to address, ie. with first-class colocated branch support)
15:51zzachWith (aleph.tcp/tcp-client {:host "127.0.0.1" :port 3335})) , it is possible to open a connection to a TCP server running at port 3335. If there is no server running, a Java exception is thrown (SEVERE: Unhandled error in Netty pipeline. ... java.net.ConnectException: Connection refused ... ). Is it possible to somehow catch or suppress this exception? I would like to silently retry connection
15:51zzachattempts until the server is running (like with the "socat" option "forever").
15:51autodidaktocduffy: what I wish is that VC would work for non-programmers... project gutenberg should be using it
16:00Wild_Catzzach: wrap it in a try-catch block
16:00Wild_Cat(although I've never managed to get aleph working up to the point where stuff actually gets sent to the server)
16:10zzach@Wild_Cat: within a try-catch block, the exception still appears
16:13sattviktechnomancy: Do you know why a console-interactive lein plug-in would work fine in Lein 2.x, but has issues with getting input in 1.x?
16:23mwillhiteI'm looking at using the checkouts dir to bring in some source code
16:23mwillhitethe way I understand it is I should just be able to create a "checkouts" directory at the root level of my lein app
16:23mwillhitethen it should take the place of the specified dependency…
16:23mwillhiteam I missing a step?
16:24mwillhiteIt doesn't appear to be using the checkouts version
16:24cduffyzzach: if you wrap your tcp-client in wait-for-result inside the try-catch, the exception should then be caught properly.
16:25mwillhiteI also updated the dependency version to that of the checkout version, but then running lein ring server went and pulled down another version
16:25cduffyzzach: ...the issue is that, being async, it isn't otherwise actually getting thrown until after construction is done.
16:29straxis there an idiomatic way to call a single function for multiple arguments?
16:29straxinstead of doing (close a) (close b)
16:29amalloymap?
16:29clojurebotmap is an evil genius.
16:29straxsure, but I'm talking about variable arguments here
16:29amalloyso far you aren't
16:30strax_single function for multiple arguments_ :)
16:30straxnot a seq
16:31straxlike a reverse todo
16:32tomoj(doseq [x [a b]] (close x))
16:34straxtomoj: aight, that's probably the way to go, thanks
16:34straxso there's not a "cleaner" way
16:34tomojof course (dorun (map close [a b])) would work too
16:35tomojI don't think of anything like what you're thinking of, no
16:35straxis dorun really needed there?
16:35tomojwell, if you have 32 or less things in the vector, it shouldn't make a difference...
16:35tomojs/less/fewer/
16:36straxyeah, it's just two or three
16:36tomojbut it is odd to rely on the chunked implementation detail here
16:36tomojsemantically you really want dorun
16:37dnolentomoj: I think doseq is better.
16:37straxwell, assuming I have some locals and I need to apply f to all of them
16:37amalloyi doubt that chunkiness matters. if he's not realizing them all, he's probably not realizing any of them
16:37tomojright
16:39tomoj(do (map println [1 2]) nil) prints nothing
16:40kurtharrigertomoj: map is lazy you need to force evaluation
16:40kurtharrigertry do all instead of do
16:41TimMckurtharriger: tomoj was telling strax that.
16:41straxI guess doseq is better then
16:42kurtharrigerah sorry, I fade in and out
16:43technomancymwillhite: checkout dependencies do not replace normal dependencies, they augment them
16:45technomancy((juxt (map (partial comp k) [:a :b :c])) [function1 function2])
16:45technomancyoops, that should be s, not k
16:45jamiislightly less crude - https://gist.github.com/2400297
16:46dnolenjamii: very cool, are you just experimenting?
16:47jamiidnolen: I want to port http://www.bloom-lang.net/
16:47jamiiI will eventually write a proper datalog interpreter and test it against this one
16:48dnolenjamii: sweet!
16:49dnolenjamii: I have their papers (none of which I've really read in depth) but I just watched the Lang.NEXT panel w/ one of the BLOOM guys in it, very interesting stuff.
16:49dnolenjamii: there's actually an old contrib datalog implementation, but it's crazy slow.
16:50jamiidnolen: I've been following the papers for ages (since 2007ish) and just never got around to playing with it
16:51jamiidnolen: But now I have 2 months without much work
16:52dnolenjamii: definitely interested in seeing where your work goes - I'm assuming you've looked a bit at Datomic as well?
16:53jamiidnolen: Yeah. I'm thinking (based on http://db.cs.berkeley.edu/papers/cidr11-bloom.pdf) that it should be possible to provide a similar data model and query power (minus consistency) in a flooded p2p gossip db
16:53jamiiWhich would be fun
16:54jamiiAlthough a bit ambitious for 2 months.
16:54jamiiI'll stick to porting bud for now
16:55dnolenjamii: exciting stuff
16:55dnolenjamii: do you work on tele-hash?
16:56jamiidnolen: yeah, I wrote the erlang version and I'm vaguely porting it to clojure. I redesigned it a bit (https://gist.github.com/1910754). I think the original design had some issues
16:57jamiidnolen: Right now there are bits of kademlia that are bothering me so I'm working on this while I think it over
16:58straxtomoj: (defmacro apply-all [f & args] `(doseq [x# ~args] (f x#))) does the trick
16:58dnolenjamil: I'll be following your progress with much anticipation :)
16:59jamiidnolen: don't hold your breath, I am phenomenally distractable :)
16:59dnolenjamii: haha, if you have something like a prototype that will be very interesting.
16:59dnolenjamii: I was thinking about trying to do a mini-datalog w/ core.logic - you beat me to it.
17:00jamiidnolen: that version still needs stratification/negation if you're bored :)
17:00dnolenjamii: haha sadly I've got enough free time Clojure project as is.
17:00amalloystrax: there's no reason to make that a macro
17:00dnolenprojects
17:01straxamalloy: hmm, true
17:01hiredmanis there a good paper somewhere that summarizes "this is the features datalog has" and "for these inputs you get these outputs" I've been fiddling around a little with what might be datalog
17:02hiredmanjust not a lot of experience with datalog so hard to say
17:03straxi'm surprised something like this doesn't exist in core
17:03hiredmanthere was a contrib datalog
17:03jamiihiredman: http://en.wikipedia.org/wiki/Datalog
17:03hiredmanin old contrib, dunno how much work it saw
17:04amalloystrax: it's just an eager version of map. clojure encourages statelessness
17:04jamiibasically somewhere between sql and prolog
17:04hiredmanjamii: "datalog is like proglog without feature X and Y"
17:04technomancyhiredman: the author of the contrib datalog didn't seem too excited about it
17:04hiredmanthats not really helpful for specing something out
17:04hiredmantechnomancy: right
17:05straxamalloy: sure, but the target is not seq - rather a fixed set of locals
17:05amalloyso what. it costs two characters to wrap those in a vector
17:05amalloy(map f [x y z])
17:05jamiihiredman: see the bullet points near the top of the wikipedia page
17:05jamiihiredman: "In contrast to prolog, it:..."
17:06jamiiThe main tradeoff is you can't do relational programming but your queries are guaranteed to terminate
17:06hiredmanjamii: right, which, unless someone knows prolog and is familiar with terms like "stratification" in the context of prolog that definition is not helpful
17:06jamiihiredman: stratification is about termination. basically...
17:07jamiihiredman: if you have a prolog program like do(X) :- do-not(X), do-not(X) :- not(do(X)) it will never terminate
17:08straxamalloy: then again, doseq is preferred for side-effects and that has bindings, which is _not_ 2 characters
17:08jamiihiredman: stratification means that any time you use 'not' create a new layer. rules in lower layers cannot reference rules in higher layers. that prevents infinite loops like the above forming but it means some loss of power
17:08jamiis/create/you create/
17:09jamiihiredman: thats the next thing I need to add to the toy version above
17:09hiredmanah, interesting
17:18arohnerok, cyclic load dependencies really suck
17:18jconnollyworking some of the clojure koans now to familiarize myself a bit with clojure. this is wrong, but I'm not sure why: (= '(:a :b :c :d :e 0) (conj '(:a :b :c :d :e) 0))
17:19jconnollyanyone have pointers?
17:19jconnollya rtfm is also appreciated, if you've got a url to a m to rtf
17:19Raynes&(conj '(1 2) 3)
17:19lazybot⇒ (3 1 2)
17:19jconnollyah
17:19jconnollyprepend
17:19Raynesconj adds to the front of lists.
17:19jconnollymuch obliged!
17:19jconnollythanks Raynes
17:19RaynesNo problem. :)
17:26septomin_i wonder if the clojure koans should even teach lists
17:28Raynesseptomin_: This is actually a good reason why they should.
17:29Raynes&(conj [1 2] 3)
17:29lazybot⇒ [1 2 3]
17:29jconnolly;D
17:29Raynesconj does something completely different for these two data structures.
17:29RaynesIf you don't hit that early on, I expect it could cause some nasty trouble in real code.
17:30cduffyjconnolly: ...re: the "M to RTF", (doc conj) touches on it.
17:31septomin_well, it's something you need to know sometime
17:32septomin_i just don't like language introductions that spend equal time on each feature of the language
17:33jconnollycduffy: thanks, that's great. just dipping my toe into the clojure pool now, that's helpful
17:33cduffyjconnolly: *nod*. The general rule with conj is that it does whatever is fast/efficient for the data structure in question, rather than having a specific semantic re: location.
17:37cduffyjconnolly: ...incidentally, Clojure's PersistentQueue implementation uses both a list and a vector, thereby leveraging the most efficient behavior of each (vectors being cheap to add onto the end of, lists being cheap to pop from the top of).
17:38jtoywhat file format do clojure people typically use for a project config?
17:38jtoyapp config I mean
17:39Raynesjtoy: Most people use Clojure data structures for configuration. Particularly maps.
17:40amalloywell, it uses a seq and a vector, jconnolly. not really a list
17:41amalloyi guess i meant to send that to cduffy
17:41hagnahow do I get a random element from a set?
17:42jtoywhich json library do you guys normally use?
17:42jtoyI've been using clj-json, but i just found chesire which seems to be better
17:42gfrederickshagna: that is a good question
17:42technomancyclj-json is deprecated
17:43dakronejtoy: use cheshire
17:43jtoydakrone: shah, that is yours, but ok
17:43technomancythough it doesn't say so in the readme; what the heck
17:43technomancyI better heckle mmcgrana about that next time I see him =)
17:43hagnagfredericks: maybe change it to a vector first and then use (nth v (rand-int (count v)))
17:44technomancy(comp rand-nth vec)
17:44gfrederickshagna: yeah that's one of several non-performant options
17:44gfredericksI don't think you could do it performantly without built-in support
17:45hiredman,(doc rand-nth)
17:45clojurebot"([coll]); Return a random element of the (sequential) collection. Will have the same performance characteristics as nth for the given collection."
17:46zzach@cduffy: Exception is caught using wait-for-result inside the try-catch block. The only thing I would still like to remove are remaining messages in the stdout of the lein repl like SEVERE: Unhandled error in Netty pipeline.... (before the exception is caught).
17:46gfredericksso still O(n)
17:47Raynestechnomancy: lancepantz maintains it. I'll mention it to him when he comes back into the room.
17:47hagnagfredericks: well it doesn't work on a sorted-set so I still have to convert to vector
17:47hagna(rand-nth (into [] #{"a" "b" "c"}))
17:47technomancyRaynes: like maintains maintains or he has push access
17:47Raynestechnomancy: Both?
17:48gfrederickswell hopefully not the former but not the latter
17:48technomancyoh, I thought Mark told everyone to quit using it; maybe I'm getting it confused with clj-http
17:48Raynestechnomancy: Well, clj-http isn't deprecated.
17:49Raynesdakrone took that one over.
17:49technomancyyeah, just mark's fork
17:54Raynestechnomancy: Yeah, he just hasn't updated the README. There are a couple of things he wants to make sure cheshire can do first and he wants to ask Mark first before making it as officially deprecated.
17:55technomancyRaynes: good to know; thanks
17:55dakroneRaynes: it should be able to do anything he'd like
17:55Raynesdakrone: He just wants to make sure coercions work the way we need them to.
17:56dakroneRaynes: okay, lemme know if anything doesn't behave
17:56Raynesdakrone: Will do.
18:00cduffyzzach: hmm; SEVERE sounds like a standard log4j / commons-logging level; I'd guess you could configure filtering through whichever of those mechanisms is actually in place.
18:14jtoywhat library is usually used to join a dir with a file name to get a full path?
18:14technomancyjtoy: clojure.java.io/file
18:14jtoycool,txh
18:14Raynes&(clojure.java.io/file "foo" "bar.clj")
18:14lazybot⇒ #<File foo/bar.clj>
18:15RaynesIf you need the actual path (which you probably don't), ##(.getPath (clojure.java.io/file "foo" "bar.clj"))
18:15lazybot⇒ "foo/bar.clj"
18:16jtoyhm, I would have thought (clojure.java.io/file "" "config.json") would be ./config.json buts its /config.json
18:17RaynesI'm not sure I would have expected that.
18:18amalloywhy would "" be "."?
18:18amalloyi mean, "/config.json" is clearly a bit silly, but you gave it a silly input
18:18jtoyamalloy: its better then /config.json
18:19jtoyif not /config.json then what?
18:20technomancyhow else would you specify the root of the filesystem in a portable way?
18:20amalloysmart man
18:24wkmanireI'm back for a short break :)
18:26jtoytechnomancy: is that to deal ith windows because it uses \? i don't even know if it uses \
18:28amalloyjtoy: well it does use \ as a directory separator, but his point is (or is at least related to) that the windows fs has multiple roots
18:30jtoyI see
18:46dnolenanybody have CLJS code that makes heavy use of maps?
18:46ibdknox|awayI do!
18:46ibdknox|awaylol
18:47dnolenibdknox: http://dev.clojure.org/jira/browse/CLJS-178 mind applying this patch and letting me know whether you see a dramatic perf difference?
18:48dnolenibdknox: I'm more interested in not slowing things down - rather than whether there's a speed improvement or not.
18:48ibdknoxmight take me a day or two :/ I'm still responding to stuff
18:48ibdknoxbut I would be happy to when I get a minute
18:48emezeskehaha ibdknox DDoS'ed himself with light table
18:48ibdknoxemezeske: that's actually a really good description
18:48ibdknoxlol
18:49emezeske^_^
18:49ibdknoxemails from all sorts of people
18:49ibdknoxMIT emailed me about an hour ago
18:49emezeskedayyum
18:49dnolenibdknox: wowzers
18:54TimMcibdknox: The whole MIT?
18:55ibdknoxMITx specifically ;)
18:56dnolenibdknox: what did I tell you? online learning folks want Light Table yesterday.
18:57ibdknoxyeah, the more I've explored the idea, the more I've realized it has a lot of applications. One of the most important most interesting is in education I think
18:57ibdknoxand most interesting*
19:32devnibdknox: im so glad you're a part of our community
19:32TimMcawwwww
19:32mdeboard+1
19:33Kowboysecond
19:33TimMc(and I agree)
19:33mdeboardI already said +1 you bandwagoneers
19:33mdeboardFind a new messiah, he's MINE
19:33ibdknoxit's funny how things work
19:34devnseriously, talk about a boon for this community -- the popularity of light table and your association with this language and community make it *ever better* than it would have been had you released that from scala-land
19:34ibdknoxI don't really remember how I started using Clojure
19:34ibdknoxlol
19:34devnor any-language-other-than-clojure-land
19:34emezeskeibdknox: I was just thinking about that the other day, and I don't remember how I got started either
19:34emezeskeibdknox: Which kind of bugs me...
19:35ibdknoxI know roughly that it was because I kept seeing it on HN
19:35ibdknoxand I'd never done a lisp
19:35RaynesI got started by coding.
19:35RaynesStop being silly.
19:35KowboyI got started on clojure.org
19:35emezeskeYeah, HN was certainly involved for me too :P
19:35devnibdknox: i also have to say im incredibly annoyed in some respects, because ive been brain-jamming on an interactive environment that is repl-driven
19:35devnand here you come and blow my mind
19:35ibdknoxbut in retrospect, I have no clue why it attracted me, I wasn't doing anything that clojure was particularly good at, at the time
19:35devnbut it seems just...i dont know...right on time
19:35KowboyI don't follow HN
19:35jconnolly|awayactually, ibdknox unbeknownst to me, is the reason I'm learning clojure too ;D
19:35ibdknoxjconnolly|away: oh?
19:35jconnollyindeed
19:36RaynesI
19:36devnwe were talking the other day at work over lunch about smalltalk, and how the refactoring browsers and so on have just...never caught on in the way they could have
19:36RaynesI've met the guy in person. Seriously, he isn't that great.
19:36Raynes;)
19:36jconnollyhttp://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/
19:36devnone week later...light table demo
19:36ibdknoxpretty short actually
19:36jconnollyand light table
19:36jconnollyI thought it was time to jump in ;D
19:36jconnollyokay, back later
19:37Kowboyfor me, it was Scala that led me to Clojure
19:37ibdknoxholy shit, I didn't make the YC interview...
19:37devnruby => chris wanstrath said "learn a lisp" => common lisp => haskell => clojure
19:37frxhello. what is the -> macro called? I can't google it, and I can't search for it in clojure.org either
19:37devnfrx: thread first
19:38ibdknoxfrx: threading
19:38ivanibdknox: "pg, your finger slipped"
19:38ibdknoxI'm actually astounded
19:38devnfrx: -> is "thread first", ->> is "thread last"
19:38frxthanks
19:38devnfrx: it's also the "thrush combinator"
19:39devnfrx: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
19:39devnfrx: one more: https://github.com/raganwald/homoiconic/blob/master/2008-10-30/thrush.markdown
19:39gfredericksis it time to talk about swiss arrows?
19:40ivanibdknox: Dropbox got rejected at first too
19:40ibdknoxdropbox didn't just have the largest launch in HN's history
19:40kovasb_idbknox: Jordan got cut from his high school basketball team
19:40frxfound it thanks. but what if I want to insert result or object as a non-first item?
19:41ibdknoxplus several recommendations from YC founders
19:41devnibdknox: i was thinking a bit about YC and your project. light table is sort of a funky area for YC, maybe?
19:41devnthe idea of it being open source, an editor
19:41gfredericksfrx: there's a new library called swiss arrows with a generalized version
19:41clojurebotExcuse me?
19:41ibdknoxno more so than Meteor is
19:41ivanibdknox: did you have a cofounder?
19:41ibdknoxivan: yessir
19:41ivanoh wow
19:41devnibdknox: fair enough
19:41Raynesibdknox: Whoa.
19:41TimMccofounder? I hardly even know 'er!
19:41ibdknoxTimMc: haha
19:42technomancyI just updated the Leiningen plugins page to mark plugins which haven't been confirmed to work with lein2: https://github.com/technomancy/leiningen/wiki/Plugins
19:42technomancyif you have a plugin that's been updated, could you please mark it?
19:42eggsbyhey guys, say my noir/compojure app had a caching layer that circled around some api and said 'are there any new records? do I need to flush things?'
19:43Raynesibdknox: Was this for that other company idea you had?
19:43technomancyor rather, remove the "hasn't been confirmed compatible" mark
19:43frxgfredericks: so nothing in standard lib I take it?
19:43eggsbycould I integrate this with noir or compojure or would it need to be its own process?
19:43ibdknoxRaynes: yes, though they claim this whole thing is about people
19:43eggsbystuff like 'lein ring server' not sure I can shove that sort of looping logic into a handler, can I?
19:43clojurebotexcusez-moi
19:44eggsbyibdknox: :/
19:44eggsbyjust kickstarter it
19:44ibdknoxeggsby: that's the plan
19:44devnibdknox: same.
19:45devnbut that's nothing new for me
19:45eggsbyYC is 'can I turn this into a money making machine'
19:45eggsbythat's all VC
19:45Raynesibdknox: Yeah, luckily everybody wants to give you their wallets.
19:45gfredericksfrx: not besides sticking an anonymous function literal in the middle of the thing
19:45devnibdknox: i think keeping it open has the opportunity to make it a /revolution/
19:45frxok thanks, will check that lib out
19:45eggsbystop looking for angels and take my money already damnit
19:45devnnot just a product
19:45ibdknoxdevn: I agree :)
19:46devnchange the way people program. that's bigger than just this rinky dink money making stuff.
19:46ibdknoxeggsby: I'm just waiting on the damn kickstarter people
19:46ibdknoxapparently they're slow ;)
19:46eggsbySo, is it possible to run a polling/caching daemon as part of a noir/compojure app or should I just have it be a separate process operating on the same data?
19:47xeqilike a caching middleware?
19:48TimMcibdknox: Are you sure Kickstarter is the right venue?
19:48ibdknoxTimMc: ?
19:49weavejestereggsby: It depends on what you're caching, really.
19:49TimMcThat Calyx ISP guy was rejected and went with IndieGogo or soemthing instead.
19:49lancepantzibdknox: i would get the kickstarter up, show traction, then re-apply with light table on the app
19:49lancepantzibdknox: for the summer session, as a late applicant
19:50ibdknoxlancepantz: it wasn't late, we were in there a month or two early
19:50lancepantzno, i mean apply again for the same session
19:50ibdknoxoh
19:50lancepantzbut with light table
19:50lancepantzthey will take applications up until the session starts
19:50eggsbyMy particular use case is: A system presents data to a user, the data is aggregated from n other systems, rather than having the web request issue the function that goes and asks what the state of the other systems are, I want to have a loop on a timer fetching the data, and then when a user requests a web page just present them with the most recent information
19:50lancepantzthat's what i did
19:50ibdknoxlancepantz: interesting
19:50lancepantzi got an interview, got rejected, turned around, re-applied
19:50lancepantzgot rejected again
19:51lancepantzbut whatever, didn't hurt
19:51lancepantzand yc is all into traction
19:51septomin_maybe lighttable is more than a business :)
19:51devnyou're a better person for having gone through the process
19:51devnseptomin_: that's the key i think
19:51devnit's not a business. it's a big idea.
19:51devnit could be a business too
19:51ibdknoxdevn: been through it a couple times now haha :) Got an interview the first time
19:51mmarczykdnolen: ping?
19:52eggsbySo the way I see it I can have a project that just populates the db the compojure app is reading from, but what I'm wondering is whether or not this sort of infinite db populating loop is able to be run inside a compojure 'lein ring server' or whether it will need to be standalone
19:52devnibdknox: i have some reading material you might be interested in.
19:52devnibdknox: mainly, white papers on refactoring browsers
19:52devnand how, despite the productivity gains, people were still unwilling to give up grep and ack in favor of using a refactoring browser
19:52dnolenmmarczyk: hullo
19:52lancepantzibdknox: if i was you, i would reapply, with lighttable, but you have to say you are focusing on making it a js ide
19:52mmarczykdnolen: hi
19:53mmarczykdnolen: I just finished a comment on the phm ticket
19:53devnthat's not damning, but it's good to be aware of similar previous attempts at changing the way people write programs
19:53devntheir upsides and downsides
19:53mmarczykdnolen: re: -strobj, or lack thereof
19:53weavejestereggsby: I'm not sure I understand the purpose. Is what you have effectively a database-backed cache?
19:54devnibdknox: you going to euroclojure?
19:54ibdknoxnope, unfortunately the timing didn't work out well for me
19:54devnaww, bummer
19:54ibdknoxlancepantz: on it.
19:54dnolenmmarczyk: but HashMap doesn't support strobj right?
19:54mmarczykdnolen: right
19:54eggsbyweavejester: the data I am presenting is formed by asking hard questions of remote systems. I want to ask those questions on a timer and then write the answers to a db, so then a user can read the data from the db instead of when the client makes a request
19:55dnolenmmarczyk: code relying on strobj is way broken.
19:55dnolenmmarczyk: but yes we should deal with it.
19:55mmarczykdnolen: agreed
19:55devn src/clj/cljs/compiler.clj | 557 ++++++++++++++++++++++++---------------------
19:56eggsbySo, either a separate loop writing to the same db compojure app is reading from, or somehow shoving a loop to populate the db in the compojure handler
19:56devndnolen and company killing it as usual-^
19:56eggsbyI'm not sure if the latter is possible, or where to start looking for how to do it :)
19:56weavejestereggsby: Oh, I have something like that. I implemented the cache in the application itself, which gives me greater control over invalidation.
19:56devnkeeping up with commits on cljs lately has been a hobby unto itself
19:57mmarczykdnolen: I think the vararg js-obj could actually solve much of the problem
19:57mmarczykdnolen: most uses of -strobj I remember seeing where with small map literals
19:57eggsbyweavejester: so I should just be studying compojure's caching? :p
19:57mmarczykthere was at least one funky reduce involving -strobj though... not sure where
19:58weavejestereggsby: Compojure is just a routing library. Caching is up to you.
19:59dnolenmmarczyk: yeah in net.cljs, but that's kinda silly, we just just use a mutable (js-obj) there.
19:59dnolenwe can just use, I mean.
20:01eggsbyweavejester: I guess the hangup i'm having is how I would define an app handler that also handled that... (def app (handler/site my-routes)) <-- where is there room for 'caching' ?
20:01eggsbydo I drop down to ring for this problem?
20:01eggsby(I apologize, I'm still learning clojure)
20:01mmarczykdnolen: right
20:02weavejestereggsby: It depends where you want to cache, whether you want to cache the data directly, before it's returned as a response, or whether you want to cache the response, in which case you'd use some middleware.
20:02eggsbyIf the answer was before?
20:02mmarczykdnolen: TwitterBuzz would be perfectly well served by a variadic js-obj
20:03dnolenmmarczyk: I think this should be a seperate ticket - remove .-strobj usage.
20:03eggsbyI guess it's like a pre-cache or something
20:03mmarczykdnolen: sure, and I can get that done
20:04dnolenmmarczyk: we can add a compiler warning for anyone trying to access that particular propertyto be nice.
20:04mmarczykdnolen: cool
20:05mmarczykdnolen: do you want this in before PHM?
20:06dnolenmmarczyk: yeah ... I think trying to provide a alternate solution is not really a great idea.
20:07dnolenmmarczyk: PHMs can hold arbitrary keys - those simply can't get converted.
20:07dnolenmmarczyk: so people that were relying on .-strobj should just use a mutable js-obj like we will.
20:07mmarczykdnolen: sure
20:08eggsbyweavejester: should I just take the 'two separate projects' route ?
20:09mmarczykdnolen: how about the variadic js-obj to make creating small objects easier?
20:10dnolenmmarczyk: a nice simple enhancement - but definitely separate ticket.
20:11mmarczykdnolen: yeah, but that's the simplest way to remove the -strobj's from twitterbuzz.core :-)
20:11mmarczykdnolen: though (doto (js-obj) (aset ...) ...) will work fine too
20:13dnolenmmarczyk: hmm there's actually a note in there about strobj already
20:14mmarczykdnolen: yeah, noticed that too; been there for a long time apparently, judging by the property access syntax
20:15dnolenmmarczyk: I think clj->js to complement js->clj is what we want.
20:15gfredericksI wrote one of those once
20:15dnolenmmarczyk: it should throw on maps with complex keys.
20:17mmarczykdnolen: that's one oft-reinvented function, I believe
20:17mmarczykdnolen: and obviously solves this particular problem
20:17dnolenmmarczyk: yeah
20:19devnmmarczyk: dnolen: +1 on that -- i see it a lot
20:20devnclj->js and vice versa
20:20mmarczykright, I'm writing a version now
20:21weavejestereggsby: Well, it doesn't really matter. Middleware is effectively the same as a proxy. The only difference is whether it is local, or remote.
20:21weavejestereggsby: It's also pretty easy to turn caching middleware into a caching proxy.
20:22mmarczykdnolen: what do you think it should do to seqs?
20:23dnolenbtw, if anyone has CLJS code that uses maps a lot, you should try mmarczyk's patch, we're looking for perf feedback - http://dev.clojure.org/jira/browse/CLJS-178
20:24dnolenmmarczyk: I guess convert them into arrays.
20:24devn^-that's what i was thinking
20:24devnwhat about for lazy-seqs?
20:24mmarczykright
20:24mmarczykarrays it is
20:25ivancan you use two different versions of the same jar/namespace in the same process?
20:25dnolendevn: it should realize them and put them into an array.
20:25dnolendevn: if you give clj->js an infinte seq that's programmer error.
20:25devndnolen: fair enough -- i was imagining it might hold onto the producer fn or something
20:25devnbut i agree
20:25devnjust didnt know if you had tricks up your sleeve
20:26technomancyivan: yes, but you have to construct your own classloaders
20:26ivantechnomancy: thanks, I guessed it would be something tricky like that
20:26dnolendevn: nah, this is just about interop.
20:27ivantechnomancy: lein will just blow up if there's a version conflict, right?
20:27dnolenmmarczyk: it should probably handle fns, since that's so common in JS interop.
20:27technomancyivan: it will refuse to resolve if there are non-overlapping ranges in the version tree
20:27ivanright. thanks.
20:27mmarczykdnolen: handle as in pass through?
20:27technomancyivan: but there's no problem with having multiple versions specified in and of itself
20:28technomancyonly one can "win"
20:28dnolenmmarczyk: yeah.
20:30dnolenmmarczyk: but I think it should error on sets.
20:30mmarczykdnolen: it could emit a wrapper function, but I'm not sure it's worthwhile
20:32dnolenmmarczyk: anything that doesn't have a sensible JS representation should not be allowed I think.
20:32mmarczykdnolen: ok, so I'll have it throw on complex keys and stuff which looks too outlandish from JS perspective
20:33dnolenmmarczyk: cool.
20:33mmarczykdnolen: except perhaps when passed an option to force stringification / pass-through ?
20:33mmarczykdnolen: or should we let those crazy enough to think they need that worry about it themselves
20:34dnolenmmarczyk: I think symbols and keywords should have name called on them.
20:35dnolenmmarczyk: (goog/isString x) (name x)
20:36mmarczykdnolen: right, I'm doing that
20:38mmarczykdnolen: alternatively we could have an option :stringify-keys causing that behaviour
20:38mmarczykdnolen: and default to throwing on symbols / keywords too
20:39mmarczykor maybe I'll just mention in the docstring that having strings/symbols/keywords with the same "name" in a map will result in information loss.
20:39dnolenmmarczyk: hmm, now that I think it - probably some legitimate uses for allowing them to pass through for event handling interop.
20:40dnolenmmarczyk: perhaps leave them alone, and add :stringify-keys option.
20:40mmarczykdnolen: ok
20:45mmarczykdnolen: first cut: https://github.com/michalmarczyk/clojurescript/tree/clj-to-js
20:45mmarczykdnolen: oops, wrong link -- https://github.com/michalmarczyk/clojurescript/commit/11734e71aae765cfb51b7f8cd1641af337bc7f73
20:46mmarczykthat's on top of the transient stuff cause I forgot to switch branches.
20:48ivanturning maps into JavaScript objects is always dangerous business. things like toString can get set. you probably already know this.
20:48dnolenmmarczyk: I think clj->js should be properly recursive and handle the allowed types - i.e. string
20:50ivanand hasOwnProperty and valueOf
20:50alexbaranoskyhow do I use a library such as javax.speech or javax.speach.synthesis from my project?
20:51alexbaranoskyjust importing them doesn't work, is there something I need in my project file?
20:51alexbaranosky(ns gong.core
20:51alexbaranosky (:import [java.util Locale]
20:51alexbaranosky [javax.speech.synthesis SynthesizerModeDesc]
20:51alexbaranosky [javax.speech Central Synthesizer]))
20:52alexbaranoskythere's no complaint about java,util Locale, but the others get a classNotFoundException
20:52dnolenmmarczyk: hmmm, this probably needs more thought and discussion ... which is probably why it wasn't done in the first place.
20:52dnolenivan: not an issue for CLJS - CLJS maps are real maps.
20:53mmarczykdnolen: ahhhh well.
20:53ivandnolen: well, presumably the user is going to do something with that object that they get from clj->js, and sometimes you'll have weird consequences, depending on how much untrusted input was used as keys
20:56dnolenmmarczyk: put the patch in a ticket and we can trigger a discussion.
20:56ivanI think you need a really well-defined spec that defines the lossiness
20:56mmarczykdnolen: ok
20:56dnolenmmarczyk: I think PHM higher priority - we can warn and say build your js-objs yourself.
20:57mmarczykdnolen: great
20:57ivanyay PHM
20:57mmarczykdnolen: and yeah... clj->js in core should be able to be the "canonical" version
20:58dnolenivan: i'm less concerned about the untrusted bit - but I agree that the lossiness problem is not something that can be decided on very quickly.
20:59mmarczykdnolen: I'll prepare a quick fix for TwitterBuzz too, with a separate ticket
20:59mmarczykdnolen: we'll be able to prettify it if (a version of) clj->js lands someday
21:03alexbaranoskywish there was a clojars for java libraries - is there? I'm looking for whatever it is I need to paste into my project file to import javax.speech and javax.speech.synthesis
21:04technomancyalexbaranosky: tried search.maven.org or jarvana?
21:04Raynestechnomancy: You can use clojars for Java libraries too.
21:04Raynes*shrug*
21:05technomancyyeah, assuming he meant for search
21:05mmarczykdnolen: ah, arrays should probably be traversed recursively, as should objects... I'll post the ticket with a somewhat more workable patch soon, though I'm beginning to feel super sleepy, so might need to wait until morning
21:05RaynesOh, his question makes no sense then.
21:05technomancythough I guess clojars still doesn't let you search by class or namespace
21:05Raynesclojars search sucks worse than maven central's.
21:05technomancybut at least it doesn't take 20 minutes to download the indices! =)
21:05RaynesTrudat
21:05technomancydid you see we had someone investigating the search indices?
21:06technomancyhttps://github.com/technomancy/leiningen/issues/243 <3
21:07alexbaranoskydang javax.speech gives zero results on both links
21:07alexbaranoskywtf
21:07Raynestechnomancy: hot
21:09alexbaranoskygoing with plan B -- robokind speech :)
21:09cmajor7I see that clojure stream is in development. what is the standard way to consume a stream of data (e.g. a feed)?
21:12seancorfieldclojure stream?
21:12amalloycmajor7: you are probably reading some very old documentation
21:13amalloysomeone should take that stuff about streams replacing lazy sequences off of atlassian or wherever it is
21:13alexbaranoskyif it's in Maven Central then leiningen should be able to find it with no customizations right?
21:15cmajor7amalloy: I see, so Streams are all cooked?
21:15amalloywhatever they were going to be, they're not. lazy-seq won
21:15seancorfieldcmajor7: URL for the docs you are referring to?
21:15amalloythough if you link to whatever document made you think streams are relevant...
21:16seancorfieldjust in case we can fix it or prevail upon the author/owner to do so
21:16cmajor7or what is the (other/better) way to consume a feed?
21:16amalloyseancorfield: probably http://clojure.org/streams
21:17cmajor7seancorfield: yes, clojure streams.
21:18cmajor7amalloy: interesting, so you would consume a feed in a regular seq?
21:18amalloycmajor7: "consume a feed" is so tremendously vague that i can't answer you
21:18seancorfieldugh! let's see if we can prevail upon clojure/core folks to remove that page...
21:18amalloybut most things in clojure are done with seqs, yes
21:20alexbaranoskycmajor7, you could use some kind of lazy sequence
21:23cmajor7amalloy: point taken. it is a vague desire.. let's say I'd like to consume a feed that comes in on a socket, where I read it with something like netty framing packets. I would like to be able to capture this data somewhere. can that "somewhere" be a lazy seq (data is streaming in)
21:23amalloyyes, absolutely you can create a lazy sequence out of the bytes coming in over a socket
21:26cmajor7internally though, the data is.. cached? by a lazy seq? since before actually getting the data from a seq (take 5), the data needs to be evaluated (looked at) as it comes in?
21:27alexbaranoskycmajor7, this might be useful http://clojuredocs.org/clojure_core/clojure.core/lazy-seq
21:31cmajor7alexbaranosky: yep, I looked at it before, thx. the point that is still moot to me is where does the data actually go (from the socket) _before_ invoking an action on a lazy seq
21:35alexbaranoskyI guess this is God punishing me for my laziness... I never wanted to wait the time to use ling search
21:35alexbaranoskylein search *
21:36cmajor7any thoughts?
21:36alexbaranoskylein search of course worked like a charm
21:36alexbaranoskycmajor7, I'm not sure I understand
21:36alexbaranoskythe lazy part of the lazy seq would pull off a new chunk of data
21:37seancorfieldin other words cmajor7 the data is consumed from the socket when the lazy-seq is consumed (if you've written it correctly)
21:38cmajor7but the socket is not lazy
21:38seancorfieldfor example, we use a lazy-seq around search results - our search engine returns results in pages... the second page is only requested when enough of the lazy-seq is consumed to go past the first page
21:38seancorfieldbut data is only consumed from the socket when you actually read it, yes?
21:39cmajor7no
21:39seancorfieldso if you only read it when you need the data, the process is lazy
21:39cmajor7the data is always coming
21:39cmajor7other wise
21:40cmajor7an OS socket receive queue will over fill pretty quickly
21:40gfredericksoh man I didn't know about this stream stuff; fascinating bit of history
21:40gfredericks"SVN" in particular
21:40cmajor7so you need to constantly consume, it is streaming in
21:41seancorfieldcmajor7: what is your interface to the socket? java's Socket class?
21:42cmajor7yes. I have regular and NIO implementations
21:42seancorfieldusing this as an example http://docs.oracle.com/javase/tutorial/networking/sockets/readingWriting.html you would call .readLine() when you wanted the next element of the sequence
21:43seancorfieldassuming you wanted a lazy seq of lines from the socket
21:43seancorfieldsimilarly with nio, you'd read bytes as you needed them
21:44cmajor7when you consuming a feed, you need to keep up at a certain rate e.g. 300,000 quotes a sec
21:44seancorfieldthat has nothing to do with laziness tho'
21:44cmajor7otherwise a producer will disconnect you
21:44seancorfieldyour code could still consume the lazy seq fast enough to satisfy that
21:45cmajor7so you consume _before_ you call on a lazy seq
21:45bubba42hi I need to do the equivalent of sum = sum + x in a recur ... do I use a let ? ... not clear how to do this ... would appreciate some help.
21:45seancorfieldno, you consume as part of the process that satisfies consumption of the lazy seq
21:46gfredericksbubba42: like (recur (+ sum x))?
21:46cmajor7ok. in this case there is no point of a lazy seq
21:46seancorfieldcmajor7: sure there is - a lazy seq can make your code much easier to write
21:47seancorfieldthe rest of your code doesn't need to care about buffering or chunks or anything inconvenient like that
21:47cmajor7sean, why is that?
21:47gfredericksbubba42: or if you haven't even gotten that far, try (loop [sum init-val] (let [x (... compute stuf ...)] (recur (+ sum x))))
21:47gfredericksor even better tell us what you're doing at a higher level and we can tell you why you probably don't need to use loop or recur at all
21:47seancorfieldthe search engine example i gave: our code just consumes search results... it doesn't care where they come from and it doesn't care about pagination or anything... only the lazy-seq wrapped code cares
21:50bubba42thx @gfredericks -- first few hours on clojure, it's just different enough that my old language skills don't carry forwards :-) ... let me look @ what you're proposed
21:51bubba42@gfredericks ... (recur (+ sum x)) what I don't understand here is how does it know where to place the + sum x ... how does it know to place it in sum and not x
21:51y3dido you guys know of any webapps that use noir?
21:51seancorfieldbubba42: recur says to re-bind the symbols in the loop binding
21:52seancorfield(loop [sum 0] ... (recur (+ sum x))) will re-bind sum to (+ sum x) next time
21:52xeqiy3di: looks like refheap uses noir
21:52seancorfieldcmajor7: did i answer your question?
21:52bubba42ah
21:52bubba42I think i c
21:52bubba42so the order of the expressions in the recur statement is important ?
21:53seancorfieldyes, they correspond to each element of the binding in (loop [...] ...)
21:53bubba42ah .... I'm glad I dropped on this channel ... I could have been stuck for weeks on this
21:54seancorfieldso (loop [a 1 b 2] ... (recur (+ a b) (inc b))) binds a to (+ a b) and b to (inc b)
21:54bubba42got it thx
21:54bubba42is it worth it to understand the *immutability* philosophy early on ?
21:55seancorfieldif you're coming from OO, that's the hardest part, but yes you need to grok it early on
21:55muhoois anyone using lein2 with trampoline repl?
21:55seancorfieldthat way you don't think in terms of sum := sum + x
21:56bubba42did fair bit of clos in grad school and some early on @ work .... so I'm excited about clojure :-) cool have to do some reading then
21:56muhoo"lein trampoline repl" times out even if i set :repl-options {:timeout 120000} in user profile
21:58seancorfieldi love writing clojure every day at work... i'm excited about programming all over again!
22:00zackzackzackAny ideas about why the clojurescript one repl would freeze after firing an event?
22:01emezeskezackzackzack: Uncaught exception on the client-side?
22:01cmajor7seancorfield: buy if you have to always consume to meet the throughput reqs, what is the advantage of using a lazy seq?
22:04zackzackzackemezeske: that's what it looks like now. Opened up the console in chrome and found an error. Unable to reproduce again though.
22:04gfrederickscmajor7: being able to treat it like a normal data structure instead of a stateful thingy?
22:04seancorfieldcmajor7: i already answered that - yes, what gfredericks said
22:05gfredericksand by "normal" I include "immutable"
22:05seancorfieldfrom the program's p.o.v. it looks just like a regular immutable data structure
22:05alexbaranoskycmajor7, which means you can use all the great clojure.core functions on it
22:05emezeskezackzackzack: I've seen problems with uncaught exceptions not being logged when they were thrown from event handlers
22:06emezeskezackzackzack: In chrome. not sure if it still does that, though
22:06zackzackzackNo idea. Trying to understand clojurescript now. It's mostly just magic at this point to me.
22:07cmajor7but does it matter it is lazy or not if the data is constantly being evaluated..
22:08cmajor7I get that I can call all the map/reduce/filter on it, but would that be all?
22:08emezeskezackzackzack: ClojureScript One is an example of a fully-featured application stack
22:08zackzackzackThere's no doc in clojurescript!
22:08emezeskezackzackzack: I'm not sure it's the best starting point to learn from
22:08cmajor7or there is an actual real advantage of it being lazy in this case
22:09seancorfieldwithout laziness, you'd have to consume all the data upfront, then process it
22:09emezeskezackzackzack: Yeah :/
22:09zackzackzackemezeske: What would you recommend as a good place to start?
22:09seancorfieldwith laziness, you can process it as you consume it - so an infinite sequence is possible
22:09emezeskezackzackzack: That's a good question; I'm not really sure to be honest
22:09seancorfieldand you'll only use as much memory as needed for the data on hand
22:09emezeskezackzackzack: I haven't looked at introductory examples in a while
22:10zackzackzackemezeske: That's pretty much why I am starting with clojurescript one
22:10emezeskezackzackzack: haha
22:10zackzackzackThere isn't really a good introduction to actually using it as far as my google fu knows
22:11emezeskezackzackzack: Yeah, I know there's a book due out this summer, but none yet
22:11gfrederickscmajor7: it gives you separation of concerns in your code
22:11zackzackzackTime to use the source
22:11gfredericksyour data code doesn't have to know whether the data comes from a socket or not
22:11cmajor7seancorfield: ok, let's take an example of a feed that streams in at 300,000 orders a second. You need to process all this data _as it comes in_ => there is always "data at hand", it is a streaming protocol (e.g. TCP/IP)
22:11cmajor7gfredericks: but for that I can use any other data structure e.g. a queue
22:12emezeskezackzackzack: I probably would recommend starting with https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/simple
22:12emezeskezackzackzack: To build your own app
22:12emezeskezackzackzack: But to keep using clojurescript one as a source of example code
22:12zackzackzackNeat! Thank you
22:12emezeskezackzackzack: It's the opposite of cljs one; it's the simplest thing possible, and does nothing
22:13muhoowhat about cljs-template?
22:13emezeskeOh, yeah, zackzackzack ^
22:13emezeskemuhoo: I forgot about that, it's even better than my recommendation
22:14zackzackzackGreat
22:14zackzackzackJust got finished with the first one
22:15zackzackzackGraduating quickly so far
22:15gfrederickscmajor7: so the difference between a lazy seq and a queue is mutability
22:16gfredericksif you don't see any benefit to immutability then you probably won't be convinced that lazy seqs are worth the trouble
22:17cmajor7gfredericks: I know what the difference is, and I always prefer immut/referential transparency/composition/etc.. this is not the question of theory
22:17cmajor7but of a concrete example
22:18gfredericksokay; well I guess we're done listing benefits then
22:19muhoodoes nrepl even work with trampoline?
22:19muhooi'm starting to think that "lein2 trampoline repl" will never work because it can't ever work
22:20TimMclein tasks do not *tend* to compose well, in my experience
22:20TimMcI think that situation can improve, though.
22:21seancorfieldcmajor7: sorry, i don't know how to explain it any more clearly
22:21seancorfieldthe speed of consumption has nothing to do with laziness
22:21seancorfieldit's a matter of how the data is exposed to your application
22:22seancorfieldas gfredericks said, we're about out of explanations and benefits - why don't you _try_ it?
22:23cmajor7seancorfield: right, I understand where you going to, and a lazy-seq is a nice abstraction around the socket (_generally_), but let's simplify, and say that you need to consume the data and persist it to a durable store (that's it). would you use a lazy seq in the middle?
22:25xeqiI would so I could use (doseq ..), until a profiler told me not to
22:27arohnerhas anyone had a good experience with a distributed messaging library?
22:28muhooarohner: i haven't, but i have heard people raving abotu rabbitmq on clojure
22:31seancorfieldcmajor7: it depends on how you would persist it - if you're persisting it piecemeal (say in records in RDBMS or document store) then a lazy seq of those chunks is still valuable
22:49cmajor7seancorfield: right, because it buffers, and can be replayed if needed.. but let's take an nio example where you don't really block on receive (e.g. event loop) => something is received and you provide a calllback.. how do you wrap that in a lazy-seq?
22:50spoon16anyone know how to get the clojurescript compiler to output a js file with goog.global.CLOSURE_NO_DEPS = true?
23:06dnolenmmarczyk: btw, are you planning on taking the strobj problem? or do you want me to fix that?
23:28seancorfieldhmm, i don't actually know how to answer cmajor7's last Q but he's gone now... if the only way data is "read" is via a callback, then i guess the app has to put it in a queue and the lazy-seq can wrap the other end of the queue?
23:33emezeskespoon16: I don't think you can
23:33emezeskespoon16: This is what I do: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/simple/src-clj/example/views.clj#L11
23:38spoon16emezeske: I saw that and ended up doing something similar
23:38spoon16thanks
23:40amalloyyou need another thread, seancorfield. have the callback drop stuff into a blockingqueue, and your lazy-seq is reading from it and blocking as necessary
23:41spoon16using lein-cljsbuild I'm trying to require the cljs.repl namespace
23:41spoon16https://gist.github.com/2403227
23:42spoon16do I need to add a cljscript dependency in my project.clj?
23:42spoon16other than the lein-cljsbuild plugin
23:42wkmaniremuhoo: Do you use paredit?
23:43emezeskespoon16: Nope, that should always exist
23:44emezeskespoon16: Wait, are you trying to start a cljs repl?
23:44spoon16wierd
23:44emezeskespoon16: Check this out: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/REPL.md
23:44drewremezeske: started using lein-cljsbuild and it really sped things up for me thanks!
23:45emezeskespoon16: I think my comment about that already existing is wrong, I was confused about what you were trying to do
23:45emezeskedrewr: That's great to hear!
23:45drewrhad to drop back to lein1 and not use :whitespace but other than that it worked really well
23:45drewrany plans for lein2 support?
23:46emezeskedrewr: It should be supported now; what version did you have trouble with?
23:46emezeskedrewr: version of lein-cljsbuild I mean
23:46drewr0.1.7
23:46emezeskedrewr: Huh, if that didn't work, it's a bug.
23:46emezeskedrewr: What went wrong?
23:47drewremezeske: http://p.draines.com/133463402710643ce57ef.txt
23:48emezeskedrewr: Interesting, let me look at that
23:49drewrgracias
23:49emezeskedrewr: What version of lein2?
23:50drewra sort-of recent 2.0.0-SNAPSHOT
23:50emezeskedrewr: I think I released 0.1.7 just before the latest release
23:50emezeskedrewr: K
23:53wkmanireYesterday in the mall I stopped in a tobacco shop. Not because I smoke, but because they cell all kinds of guy stuff, like cologne and knives and what not.
23:54wkmanireThere I saw a Sudoku magazine and I remembered about representing data structures in Clojure.
23:54wkmanireHow would you go about storing a Sudoku game board and passing it around as an argument?
23:55wkmanireYou would need to be able to do all sorts of accessing on it to validate it.
23:55wkmanirethey sell* bleh
23:56emezeskedrewr: Unfortunately, the latest lein2 has more than one change that lein-cljsbuild has to support
23:57emezeskedrewr: I'll have to track things down and fix them
23:57drewrok thanks
23:57emezeskewkmanire: Seems like a vector, or a vector of vectors would be fine
23:57xeqiI would use a vector of vectors
23:58xeqito start with
23:58espeedWill someone look at my multimethod attempt and let me know what I'm doing wrong: https://gist.github.com/2403336