#clojure logs

2014-12-21

01:53kenrestivohmm, buffering in async channels is kind of ruining my day now too. seems it takes 3 or 4 repetitions of a message before it actually gets handled by any of the listening threads
01:54raspasovkenrestivo: what's the problem?
01:55kenrestivoi've got a message bus with pub/sub. several listeners. i send a message... takes 3 or 4 repetitions before any of the listeners seem to get it. and then there's like a 1-second delay after that last message before it goes through
01:56raspasovnetworked pub/sub or in-process only?
01:56raspasovi.e. pub/sub over core.async only (local, in process) or via some external queue ?
01:58kenrestivoin-process
01:59kenrestivojust core.async, no other queues. the message bus has a buffer though
01:59kenrestivoi'm wondering what the typical/expected latency would be for such a thing?
02:00raspasovnot 100% sure but should be pretty fast - what do you mean by 3-4 repetitions ?
02:00raspasov3-4 repetitions of what?
02:00kenrestivoi have to send the same message, repetitively, before it gets received
02:01raspasovthat's definitely weird, it's either a bug, or you're using something wrong, how are you trying to take from the channel?
02:01kenrestivoand, interestingly, it only gets received fewer times than it was sent. it's as if the other sends are lost
02:01kenrestivotakes are in a loop in a future
02:01raspasovdo you have gist?
02:02kenrestivoi could try to distill one down
02:03raspasovyour take should look something like (go (loop [] (println "got val on a chan::" (<! my-chan)) (recur)))
02:03raspasovyea that would be helpful, hard to talk without code :)
02:04kenrestivowell there are a lot of moving parts.
02:04kenrestivothere are two pubs, off of one message bus, in several namespaces, etc
02:04kenrestivobut yeah, let me paste something
02:05raspasovare you using the core.async pub/sub stuff or building your own? last I remember the core.async pub/sub was experimental
02:06kenrestivothe core of it is just this https://www.refheap.com/95237
02:06kenrestivohmm, i didn't realize i was gonna get cut that badly, but i'm not surprised.
02:06raspasovfirst of all, use (thread) instead of (future)
02:07raspasovnot sure what's the difference, but that's the recommended way to do it I beliee
02:07raspasovI think there is some
02:08kenrestivothe difference is that a channel is returned from thread. i don't care about the result, so i was usnig a future instead (also can future-cancel)
02:08kenrestivoi don't see any notes about pub/sub being experimental, but all of async is alpha, so i'm not too surprised
02:09raspasovyea I don't see it either
02:09raspasovin general it has been pretty solid for me, but I haven't used to pub/sub part of it
02:10raspasovis that drop happening under load or just when you put values one by one?
02:10raspasovI also see "Items received when there are no matching subs get dropped."
02:10raspasovhttp://clojure.github.io/core.async/#clojure.core.async/pub
02:11raspasovare your subs active when the first messages gets put on the pub channel?
02:13kenrestivono load, just testing.
02:13kenrestivothe subs are active, yes.
02:14kenrestivoi'm starting to think i might be rearchitecting the whole app without async soon.
02:15raspasovI bet there's something weird with what you're doing, I highly doubt there's a glaring bug that no-one has noticed that's so elementary, but yes - async is a tool for special cases and you should make sure you need it before you use it, esp this pub/sub
02:15raspasovI've been using channels for a while and never felt the need to use pub/sub
02:16kenrestivothat'd be a less drastic step: i could blow off this message bus idea and just pass channels around instead
02:18kenrestivothe idea of decoupling everything was very attractive. but now i'm wondering if it just is making things more complex than necessary.
02:22crispinhey peeps! How do i eval an expression with a macro in it?
02:22crispinI can do this
02:22crispin,(eval '(map inc [1 2 3]))
02:22clojurebot(2 3 4)
02:23crispinbut I cant do this
02:23crispin,(eval '(doseq [i [1 2 3]] (inc i)))
02:23clojurebotnil
02:23crispindoseq is a macro. Putting in macroexpand doesnt fix it
02:24kenrestivodoseq returns nil, it's side-effecting
02:24crispinahahhhhhahah
02:24crispinffs
02:24kenrestivoyou meant "for" not "doseq"?
02:24crispin,(eval '(doall (for [i [1 2 3]] (inc i))))
02:24clojurebot(2 3 4)
02:24crispinhaha yeah
02:25crispinthanks kenrestivo
02:25kenrestivonp
02:25crispinso eval lazyseq will expand the seq, not just return the lazyseq?
02:25crispin,(eval '(for [i [1 2 3]] (inc i)))
02:25clojurebot(2 3 4)
02:25crispinright
02:27raspasovkenrestivo: check this out https://gist.github.com/raspasov/81c678961b6292eebe04
02:27raspasovseemed to work for me
02:28raspasovI get the published message on both subscribers
02:32kenrestivoyeah, my test code works too, and did, before i weaved it into the app
02:33kenrestivoeverything worked fine, which is why i felt safe goign with this approach. of course, now that it's into the app which is all built out, it's not working :-/
02:34kenrestivonot too surprising.
02:34raspasovyea not sure then, it seems unlikely that the guarantees of core.async's pub/sub will change though - how big is your app in terms of lines of code? as you said, really think if you really need that pub/sub mechanism in there
02:35kenrestivoit's not that big. i was hoping to not have to pass a bunch of channels around, a single message bus seemed so much cleaner
02:35kenrestivobut if latency issues are cropping up, i've got to back out of that idea
02:35kenrestivoone of the great things about clojure is how easy it is to make rather large sweeping changes without too much work
02:36raspasovyes, that's true
02:36raspasovLisp is just like a lego
02:36kenrestivoif i had to do a major rethink about stuff lke this in any other language, i think i'd be well and truly screwed
02:36raspasovhow long have you been doing Clojure?
02:36kenrestivoalmost 3 years, off and on
02:37raspasovcool
02:37kenrestivoand i keep cutting my fingers on new things (like async) so i never really feel that experienced
02:38kenrestivoyou seem to be fairly comfortable with core.async. thanks for your help and perspective.
02:39raspasovno problem, hope I could help more, feels like something small is off somewhere, if you can share some more code, esp where the stuff is being put on the channel? but if you're going to re-architect out of pub/sub prob not worth it
02:41kenrestivoi'm going to try to simplify. the fewer moving parts the better.
02:43raspasovyea, agree
04:28rivrkeeprlookz2boring
04:28rivrkeepr4actualInterchange
04:32_steven_if i do (let [x <expression>]), is it true that everytime i use x, the code inside the expression will be run again?
04:35expezHow can I find out if some macro is in use? To find out if a function is in use I've been expecting the AST, but macros are expanded prior to building said AST.
04:35expezs/expecting/inspecting/
04:35dysfunyou can read the file and not macroexpand it
04:35aduwhat's the difference between doto and ->
04:36expezdysfun: then what? string match the macro name?
04:36dysfundoto is for mutable things
04:36dysfunexpez: yup
04:36expezthis was my 'simplest thing that could possibly work' plan, but I was hoping for other options :p
04:37dysfunthat would require knowledge of what you're trying to achieve
04:37adudysfun: so x.f() x.g() instead of y = x.f(), y.g()?
04:37expezdysfun: I'm writing tooling to clean up the ns form. Part of that job is getting rid if stuff that is no longer in use.
04:38dysfunadu: if you replace that comma with a semicolon, yes
04:38dysfunexpez: you're reimplementing slamhound?
04:38aduhow do you pronounce -> and ->>?
04:38dysfun'thread' and 'thrush' or 'thread-last'
04:38expezdysfun: yes
04:39dysfunis there a reason you're not just using slamhound?
04:39expezyes, it doesn't work :p
04:39dysfunperhaps we can help you with that rather than reinventing the wheel? :)
04:40dysfun(or perhaps you may be tempted to patch it?)
04:41expezdysfun: https://github.com/clojure-emacs/refactor-nrepl/pull/9 I think this op does a bit more than slamhound and it should work better
04:42dysfunoh that's pretty cool
04:43dysfunso doing this 'properly' is going to require stepping through macroexpansion and it'll get very tedious
04:43dysfunbut 99% of cases will be caught by the 'simple' method
04:44dysfunthanks largely to syntax-quote
04:44expezso if I search for "(some-macro " what's going to get missed?
04:45expezmaybe I should search for "some-macro", then and just leave an extra symbol in the ns every now and then
04:45dysfuni suspect there's scope for missing things when generating macros in macros
04:45justin_smith"( some-macro" is valid, though pathological
04:45justin_smith,( + 1 1 )
04:45dysfunand you would actually step through an edn tree, rather than string match
04:45clojurebot2
04:47dysfunjustin_smith: this explains a lot about your code :)
05:47expezdysfun: I did find a use for, parts of slamhound, https://github.com/clojure-emacs/clj-refactor.el/pull/88
06:08dysfun:)
06:11dysfunanyone using reloaded workflow with something that tries to invert control? in this case jmonkeyengine
06:12dysfuni'm pondering starting it on another thread and wanted to know things i'll have to watch out for since it's rather not in the spirit
06:14dysfuni'm also very much hoping i won't have to keep it on the main thread (as is the case with javafx), because my first thoughts on that are that it'll be messy as hell
07:44trissso chaps. what's the simplest way to extract values for two keys in a map in to a tuple?
07:46andyftriss: juxt, probably.
07:46andyf,((juxt :c :d) {:a 1 :c 2 :d 7 :e -2})
07:46clojurebot[2 7]
07:46andyfif by 'tuple' you mean vector.
07:47trisssplendid thanks andyf!
07:48andyfjuxt is useful for other similar things, too, when you want a vector of results
08:08lodinIs there any way to write a macro that would insert two elements into e.g. (let [(mymacro)] ...), without modifying let?
08:08Bronsalodin: no that's not possible
08:08lodinThat's what I figured. :-/
08:09lodinThe drawback of Clojure prefering flat structures and less brackets.
08:09dysfunooh, i hadn't seen 'juxt' used like that before, that's pretty neat
08:09Bronsalodin: that wouldn't be possible in cl either
08:10lodinBronsa: Why not? (I don't know CL.)
08:10Bronsadysfun: (let ((mymacro 1))) would bind mymacro to 1 rather than invoke mymacro and bind whatever first symbol it returned
08:10dysfuni think you mean 'lodin'
08:10Bronsadysfun: yeah sorry
08:10Bronsalodin: ^ that was meant for you
08:11lodinBronsa: True.
08:11lodinSo maybe let wasn't the best example. :-)
08:11Bronsaamalloy_: picasso is the daily spammer
08:12trissok... laziness is confusing me re: writing performant code...
08:12trissanyone know of any good writings on the subject?
08:12lodinBronsa: (let (((mymacro 1)))) then? Can't bind to (mymacro 1). ;-)
08:13trissor will this sort of understanding take a while to sink in?
08:13Bronsalodin: I'll take that as a joke :)
08:13dysfuntriss: don't worry about performance yet. worry about performance when you have a performance problem
08:13dysfunfocus on algorithm order of complexity
08:14trissi got one.... I'm wondering wether clojurescript's a nicer language that js for writing low level web audio stuff.
08:14dysfunplus as you say, you'll develop an intuition in time
08:14dysfunhow do you mean? run it on client side?
08:15triss"algorithm order or complexity"?
08:15trissyep. run on the client side....
08:15dysfunhttps://en.wikipedia.org/wiki/Big_O_notation
08:15dysfunwell if you're running on the client side, i don't see you have much choice than clojurescript
08:15trisscheers dysfun. I think I'm paying attention to all that stuff.
08:16lodintriss: Note that if if have ((juxt k1 k2) the-map)) you could run into problems.
08:16lodin,(let [a 3 b 5 m {a :three b :five}] ((juxt a b) m))
08:16clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
08:16lodinNot fun to debug.
08:16dysfunin which case, i recommend not worrying about performance yet
08:16trisscheers dysfun. we'll see how it goes.
08:17dysfuni've yet to write any clojure which wasn't "fast enough" if that helps, and i've been doing it full time for a while now
08:17trissexcellent news. cheers dysfun
08:18dysfunin general, most problems deal with a fairly small amount of data anyway and even order of complexity makes little difference
08:18dysfunnot that i'd advocate not paying it attention
08:19lodinBronsa: Yes, a joke. Partly. ;-) It's like of like when you do (-> a (#(... % ...))) to move the "insertion point". Really don't look good. (Yes, I know there are other macros too.)
08:20trisswhat's worrying me is that the callbacks required to do web-audio stuff pass you in an input array and expect you to populate an output array
08:20trissit feels most unnatural in clojure to be writing a function like this.
08:21trissmost example code (in JS) doesn't the imperative thing of updating a slot at a time of the output array in a for loop
08:22dysfunyou may even find that it's better to just write it in javascript for that bit
08:22dysfunone of the great things about clojurescript is that you get proper javascript interop
08:23trisshmmmm... I'm gonna push on with cljs for the time being and see if its sluggish or not.
08:24trissfast enough is fast enough i suppose.
08:26dysfundepends how much audio you're processing i guess
08:27triss44100 samples of it per second. with only a smidgeon of latency
08:42trissso what's a nice ay of copying a lazy sequence in to a Java/JS array?
08:42triss^nice way
08:43trissI guess doing this could be considered not nice at all.....
08:51brucehaumantriss: clj->js
10:15vmarcinkohey everyone, i have a need to have huge number of processes within my app, each of them corresponding to single entity such as Order, so one can have few hundreds of thousands of orders... Each of this orders has its own, potentially complex, lifecycle, but although at first glance core.async would be good since it inverts the control, i cannot see that it is good fit for it, because I need individual go blocks for each entity, an
10:15vmarcinkod process can last even months/years..
10:16vmarcinkoso i just wanted to have some kind of conrimation that core.async is not made for this kind of "processes"
10:18vmarcinkothese kind of processes are usually handled in java land by some SOA/BPM platforms such as BPEL/BPMN, but it seems to me these are a bit different then core.async processes - they can last for years, they are not kept in memory, they stroe their current state thus if one reobots the app, it cpontinues where it left off etc..
10:33trissah thanks brucehauman.....
10:33trissbut doesn't that create a new array? I want to populate an existing one.
11:07Bronsachouser: hi, mind banning picasso? the usual spam bot
11:28luxbockI have a deftype backed up by a vector of doubles, and I'll be serializing a lot of these inside a tree structure to disk. would it make sense to re-implement Serializable to use a double-array for writing and reading from disk instead to save up some disk space, or is this a bad idea?
11:42mindbender1How do I remove hidden directories from a file-seq?
12:15justin_smithtriss: for audio processing with low latency, everything should remain arrays, don't use vectors or lazy seqs for samples
12:16trissahhhhhhh..... thought so justin_smith thanks.....
12:17trissthat won't the last few hours of attempting to write a bitcrusher in a functional style go away though
12:17trissclojure really is ugly for that sort of thing though....
12:18justin_smithtriss: check out kunstkusic/pink to see low latency audio processing in clojure done decently
12:20trisscheers justin.... not seen those. I'll take a peek
12:20justin_smith*kunstmusic that is (irc from the phone)
12:21justin_smithit's just one project, kunstmusic is the org, pink the package
12:22justin_smith,
12:22clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:23trissthanks man. this stuff looks really cool
12:25jonathanji'm getting the following error from this <https://pb.codehash.net/kitokegi.clj&gt; yesql code and i have no idea what it's telling me: Exception in thread "main" clojure.lang.ArityException: Wrong number of args (1) passed to: generate/generate-query-fn/query-wrapper-fn--5115, compiling:(/private/var/folders/qj/lb3tbsp97gg74jpcxtcw30zm0000gn/T/form-init271047470154200468.clj:1:123)
12:28jonathanjoh... i guess there is no 1 arity version of the generated query functions, that's unfortunately rather cryptic
12:31trissis there a way to swap the order or a functions arguments?
12:32TEttingerjustin_smith, kinda funny how the german word for art (kunst) is so un-beautiful
12:32justin_smithtriss: s/or/of?
12:32justin_smithTEttinger: heh, indeed
12:32trissTEttinger. Art doesn't need to pretty chaps. (or that's the excuse I use for my work)
12:33hellofunkTEttinger or the dutch word
12:33TEttingerheh, indeed.
12:33picassoBronsa, it was picassoo who was spamming, not picasso
12:33picassono affiliation
12:33TEttingerlol
12:33TEttingerthat's hilariously coincidental
12:34TEttingermaybe the spambots are starting to learn and pick modifications of names used in the channel to divert blame
12:34picassoindeed
12:34TEttingerTEttingerr is spamming now :P
12:34picassoi wouldnt put it past them
12:34picassokids with too much time
12:35TEttingerthere was an excellent thing I read about the spam pharmacy emails mostly distributing counterfeit drugs, and one woman in canada died after consuming too much uranium and lead from online-purchased meds
12:35trisssorry justin_smith: of
12:36hellofunkTEttinger wow that's awful
12:38TEttingerhttp://www.politico.com/magazine/story/2014/12/pharma-spam-113562.html
12:39TEttingerit makes you wonder, how hard can it possibly be to not but uranium in things?
12:39TEttinger*put
12:40TEttingertriss: to swap fn order in a 2-arg fn?
12:41TEttinger,(#(map %2 %1) [1 2 3] inc)
12:41clojurebot(2 3 4)
12:43TEttingerfor an arbitrary-number of-args order reversal,
12:43TEttinger,(#(apply map `[~@(reverse %&)]) [10 20 30] [1 2 3] +)
12:43clojurebot(11 22 33)
12:44TEttinger,(#(apply map `[~@(rseq %&)]) [10 20 30] [1 2 3] +) ; might work?
12:44clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.ArraySeq cannot be cast to clojure.lang.Reversible>
12:44TEttingerassuming map is the fn you want
12:45TEttingerhm wait
12:45TEttingerthat's unneeded
12:45TEttinger,(#(apply map (reverse %&)) [10 20 30] [1 2 3] +) ; might work?
12:45clojurebot(11 22 33)
12:45TEttingermuch easier :D
12:45trisscheers TEttinger - mulling this over. it's just a two arg function.
12:46TEttingerthen %2 %1 may be easiest
12:46TEttingerthere may be a built-in lib fn but I kinda doubt it
12:50justin_smiththere is a flip in flatland/useful
12:50trissah flip... that's what I'm looking for. cheers.
12:51trisswhat are the reasons for that useful stuff not makings it way in to .core
12:51triss?
12:52trisshey really are useful... should I be looking to avoid using stuff like applied and flip? the little haskell I've done got me kinda used to it
12:52justin_smithcore is pretty conservative about what it includes
12:58mindbender1I need to get rid of hidden folders from a file-seq. What's an efficient way of doing that?
12:59tcrayford___mindbender1: can't you just use `filter` and call whatever java api lets you get at hidden/not hidden on File?
13:02justin_smithtcrayford___: what about filtering files inside hidden directories?
13:02tcrayford___oh, touché :/
13:03justin_smithat that point you are better off rewriting file-seq
13:03tomjackreimplement file-seq?
13:06borkdudeIs it possible to add a message to a :post condition in a function when the assertino fails?
13:12bbloom,((fn [x] {:post [(and (odd? %) "a message")]} x) 6) ; borkdude: this work? :-)
13:12clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (and (odd? %) "a message")>
13:13borkdudeit's a hack ;)
13:13bbloom,((fn [x] {:post [(do "must be odd" (odd? %)))]} x) 6) ; this feels marginally less hacky
13:13clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
13:13bbloomeh, you get the idea
13:24munderwoIs there a way in a let block to have two statements assign to the same var? I basically have two ways of getting a value, if the first doesnt work I want to try the second. and then just deal with the same variable further down in the function. any ideas?
13:25bbloommunderwo: define "doesn't work"
13:26munderwoSo in this case we are checking out a git repo. If it already exists on the filesystem then the first function will return a representation of it. If it doesnt find it then we need to check it out, and then the second function will do that and return the exact same representation of it.
13:27bbloommunderwo: (let [repo (or (open-or-nil ...) (clone ...))] ....
13:27bbloomor in two statements:
13:27munderwoin python I would just try the first, put some kind of if statement for None and the assign to the same variable, and then use the same variable further down.
13:27bbloom(let [repo (open-or-nil ...) repo (or repo (clone ... ...
13:28bbloom(let [[status repo] (open ...), repo (if (= status :not-found) (clone ...) repo) ....
13:28bbloommunderwo: one of those many variations should work for you
13:29munderwook thanks… i’ll give those a shot
13:30bbloommunderwo: in short, the common pattern is to shadow the variable with a variable of the same name. you just can't specify a 1-armed if, you need to use something like the `or macro, or repeat the variable name in the other arm of the if
13:31munderwook, I think that makes sense. Thanks for the help!
13:31andyfBronsa: I'm getting some exceptions thrown with latest t.a(.j) that I wasn't with the version from about 4 weeks ago. Creating a brief ticket with repro steps -- I haven't figured out what is going on yet.
13:32Bronsaandyf: ok, I'm busy doing stuff right now so I likely won't be able to look at it until tomorrw
13:32andyfNo problem.
13:57dnolen_http://swannodette.github.io/2014/12/21/browserless-clojurescript/
14:25sveriHi, I became curious yesterday to try out boot and build my own build.boot file, now when I run boot dev I get this error: ←[1;31mclojure.lang.ExceptionInfo←[m: ←[31mNo implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil (whole stacktrace and the function in question can be found here: http://pastebin.com/fKn0QV8r) Any ideas what is wrong here?
14:32michaniskinsveri: can you paste your build.boot file please?
14:35sverimichaniskin: http://pastebin.com/0XRNzAb2 I thought I saw this error in a different kind of context once, but cannot remember the solution. However, the same code works with my leiningen project
14:39michaniskinsveri: what's on line 8 of sveri.clojure.commons.files.edn source file?
14:39michaniskinsveri: oh i see
14:39michaniskinfname is nil i think
14:39michaniskintrying to make a reader from nil throws
14:40michaniskini mean there is no resource maybe
14:40sverimichaniskin: ah, resource paths -.-
14:40michaniskinsveri: debug print (io/resource fname)
14:40michaniskinit's probably nil
14:41sverithe boot file I copied from has only this resource path set: src/clj, this is not enough for me, I try it
14:41michaniskinsweet
14:43sverimichaniskin: ok, that error is gone, hopping to the next one :D Btw. are there options for dev-resource paths? I have an extra resource path set for the tests in leiningen
14:44michaniskinsveri: you can call set-env! anywhere
14:44michaniskinyou can make a task that calls it
14:44michaniskinbasically all the different things in lein can be done in boot with just deftask
14:45Bronsaamalloy: I won't talk about what I just saw.
14:45@amalloyBronsa: i'm not sure what the deal is there. i didn't actually type that
14:45sverimichaniskin: ok, I think I get it
14:45Bronsaamalloy: <insert joke about your irc client here>
14:45michaniskin(deftask dev [] (set-env! :dependencies #(conj % '[...])) identity)
14:45michaniskinsveri: then you can use it like a lein profile: `boot dev run-tests`
14:46michaniskinor something, there are lots of options cause you're programming there
14:46@amalloyBronsa: picasso's hostmask is different-looking from previous incarnations, and what i was doing to ban the others apparently results in a ban to *!*@*
14:46@amalloyi actually attempted to ban *!~mike@bb.pixor.net
14:47amalloyso i am gonna leave this for more a competetent op
14:48Bronsaamalloy: I'm pretty sure any client will do the right thing with /mode #clojure +b picasso
14:48michaniskinsveri: clojure.core/identity is actually the noop middleware, like if you have a task that you want to just pass through to the next task and not actually do anything (like the "profiles" pattern above)
14:48amalloyBronsa: i don't think you want to ban nicks
14:48hellofunkBronsa: please forgive my ignorance, i beg you most kindly please note the difference in the /mode you mentioned and /ignore
14:49sverimichaniskin: thanks, I just wrote this up
14:49Bronsaamalloy: meh, he's identified though
14:49Bronsahellofunk: I have already /ignored it but banning it from the channel is the only way to prevent it won't spam other users
14:50hellofunkBronsa: I care very much to provide to you this moment my thanks, given to you for your succinct reasoning that you have imminently shared
14:50sverimichaniskin: I now got problems with cljx I guess, so if you got some time, this is the stacktrace: http://pastebin.com/svnfVYgD "de/sveri/structconverter/routes/csv.clj" is clj code and de/sveri/structconverter/csv_common is cljx code, looks like it cannot find the compiled cljx classes
14:51Bronsahellofunk: are you by any chance sdegutis?
14:51hellofunkBronsa: while my medical history is not something wish to share, i all the same admit that i am unfamiliar with the condition you just mentioned.
15:09hellofunkBronsa: lol just having a bit of fun, but no i am not that other user, if that's what you meant.
15:10hellofunkbtw happy holidays gentlemen and ladies, this has been a good year for me and clojure and you guys are a big part of why
15:15TEttingerhellofunk, yep, clojure's a great language with a great community
15:20Deraensveri: Interesting. The boot doesn't print anything before the exception? Is your build.boot file still similar to what you linked previously?
15:21michaniskinsveri: you can increase verbosity with the -v option, like `boot -vvvv dev`
15:22sveriDeraen: yea, but I just saw, I have to add a special boot.clj file like in the example, I totall ymissed this
15:22DeraenYou were trying to require some code from build.boot which requires some ns which has to be compiled using cljx?
15:24Pistahhhi
15:24Pistahh<- relatively new to clojure
15:25Pistahhhow to do ((mymap "foo") "bar") more clojure-ly?
15:26michaniskinPistahh: (get-in mymap ["foo" "bar"])
15:27michaniskinPistahh: see also assoc-in, update-in
15:27Pistahhthy
15:27michaniskinnp
15:28sveriDeraen: but yea, I am requiring cljx code in clj code, I guess thats what the error says+
15:31emaczen`How can I debug in clojurescript repl?
15:31emaczen`I want to find the values of some web-forms.
15:36michaniskinsveri: you can make a task that is after cljx in the pipeline and that can require things
15:37michaniskinyou would need to require/refer or require/eval in there, of course
15:39sverimichaniskin: for debugging purposes?
15:39michaniskinsveri: i mean if you're using things produced by cljx in your build.boot
15:39michaniskinyou'd need to put that code in a task that comes after the cljx task
15:50sverimichaniskin: hm, I think I misexpressed myself. I have cljx code in my existing project and clj code that requires it, this does work in the liningen project, but not with boot
16:05michaniskinsveri: the clj code that requires the cljx should not itself be required until after the cljx task runs
16:05michaniskinyou can do this from a task that runs after the cljx task
16:07sveriah I see, that makes sense
16:07sverimichaniskin: thank you, I guess I have to refactor a bit then
16:16PistahhI have a vector of some values, e.g. [1 2 3], and I want an assoc map with e.g. keys [:a :b :c] to have those values -> { :a 1 :b 2 :c 3 } - how to do that? :)
16:18andyf,(zipmap [:a :b :c] [1 2 3])
16:18clojurebot{:c 3, :b 2, :a 1}
16:20havenwood,(interleave [:a :b :c] [1 2 3])
16:20clojurebot(:a 1 :b 2 :c ...)
16:20havenwoodah right, assoc map
16:33SagiCZ1top o' the mornin' to ya
16:35kenrestivohowdy
16:36kenrestivohmm, ok, replacing a message bus with individual channels for each component presents a problem: the components can't be shutdown and restarted individually because there'll be other components taking or putting onto dead channels
16:37kenrestivocould also ref/atom the channels but that starts to smell funny to me (async/<!! @chan)
16:38SagiCZ1maybe you could use poision pill approach
16:38kenrestivohow so?
16:38SagiCZ1feed the channel something that the consumer recognizes and shutdowns... "-1" or nil or something
16:39SagiCZ1this is what is commonly used in java when operating blocking queue
16:39kenrestivooh, a kill message. but what if someone else shuts it down? the error handling becomes complex
16:40SagiCZ1i guess.. it was just an idea, i dont understand your case well enough
16:40kenrestivoneither do i, apparently :-/
16:42SagiCZ1i read just one little tutorial on async.. seems nice but i need to learn how to apply it properly.. and also recognize a problem that benefits from it
16:43kenrestivoi'm learning it. it has a lot of potential but i'm still trying to figure out how to use it properly.
16:44kenrestivoi found it very useful in cljs in the context of om, for example. now i'm trying to use it to get components to communicate with one another in a jvm app, and it's been challenging
16:46SagiCZ1so you would need the channel to recognize that one of its ends is dead and close itself?
16:46kenrestivohmm, lemme see if i can refheap something up. might help me think about the problem better too
16:47kenrestivosee, in a lot of core.async examples, they just assume threads or go-loops just start and go on forever. trying to make things modular so that loops are treated as daemons, seems not as well documented
16:47SagiCZ1yeah i see
16:47kenrestivoit's real easy to just close a channel adn stop a loop that way, but then restarting... that's the thing
16:48kenrestivo(loop [] (when-let [v (async/<!! chan)] (do-stuff v) (recur)))
17:32numbertenis aset O(1) ?
17:33SagiCZ1numberten: what do you mean? set? what operation?
17:34numberten,(doc aset)
17:34clojurebot"([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
17:35SagiCZ1numberten: oh sorry
17:36SagiCZ1i think it should be definitely O(1)
17:36kenrestivook, just played around with it, i think it'll work the way i want it to. https://www.refheap.com/95273
17:51andyfkenrestivo: Definitely O(1). However the constant differs dramatically and noticeably if it uses reflection. If it is used many times during run time in your code, you'll want to enable reflection warnings and eliminate them if you can.
17:52kenrestivoandyf: i think you meant SagiCZ1
17:52kenrestivoor maybe numberten
17:52andyfsorry, yes.
17:52andyfnumberten: ^^
17:53kenrestivo(who is probably wonder why his computer is beeping so much now)
17:54numbertenthis is an array of bigints
17:54numbertenso reflection could probably be a big constant cost I imagine :/
17:55kenrestivotype hints
17:55kenrestivokills reflection dead
17:55numbertencool
17:55numbertennever actually used them before
17:56jonathanjis there a better way of writing: (into {} (map (juxt :id :name) modes))
17:57Bronsaselect-keys
17:57Bronsa,(doc select-keys)
17:57clojurebot"([map keyseq]); Returns a map containing only those entries in map whose key is in keys"
17:57kenrestivoi like "lein update-in : assoc :pedantic? :warn -- check" to find all the reflection warnings, dependency mismatches, etc
17:57Bronsano, that doesn't do what you want
17:58jonathanjthat is turning [{:id "a" :name "Aye"} ...] into {"a" "Aye" ...}
18:00Bronsajonathanj: yeah I can't think of a better solution than the one you wrote
18:02numbertenkenrestivo: is it possible to type hint an array?
18:02SagiCZ1yes
18:03SagiCZ1ints, longs, floats, doubles ..
18:04Pistahhis there anything like "map" but without collecting the results?
18:04justin_smithin fact, arrays aren't just hinted - they are typed
18:04justin_smithPistahh: doseq
18:04numbertenbigints?
18:04justin_smithor (dorun (map ...)) if you really want the map syntax
18:05justin_smithnumberten: "bigints" would not make sense, because bigint is not a primitive type
18:05justin_smith,(into-array BigInt [])
18:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: BigInt in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:06justin_smith,(into-array clojure.lang.BigInt [])
18:06clojurebot#<BigInt[] [Lclojure.lang.BigInt;@248d7e99>
18:06numberten,(into-array clojure.lang.BigInt [])
18:06clojurebot#<BigInt[] [Lclojure.lang.BigInt;@33ba11b3>
18:06justin_smithbut that's not the same sort of thing as longs, doubles, bytes etc. - each element must be boxed
18:07numberteni see
18:09numbertenso then there's no way I could typehint away this warning: Reflection warning, solution.clj:35:54 - call to static method aget on clojure.lang.RT can't be resolved (argument types: unknown, int)
18:10justin_smith^"[Lclojure.lang.BigInt" may work as an annotation there actually
18:10justin_smithiirc the string will be interpreted properly
18:10numberteni didn't know you could wrap types in strings
18:10justin_smithit's needed for [L...
18:11justin_smithBronsa knows more about this stuff though
18:11kenrestivohahaha, the complexity in starting/stopping multiple threads/channels comes when i get into using alts!!...
18:11kenrestivoa simple when-let ain't gonna cut it
18:12numbertenit worked
18:12numbertenbut it needed the ;
18:12numberten^"[Lclojure.lang.BigInt;"
18:12numbertenjustin_smith: thanks
18:12justin_smithnp - forgot the ; was part of the class name, yeah
19:13dthurnCan somebody help me understand why this doesn’t return 15: (let [[tween [:tween]] [15 [:tween]]] tween) ?
19:14Bronsadthurn: destructuring is not pattern matching
19:14Bronsa,(let [[tween [_]] [15 [:tween]]] tween)
19:14clojurebot15
19:15seangrove,(let [[tween [:tween]] [15 [:tween]]] tween)
19:15clojurebot:tween
19:15Bronsa,(let [[:a] [1]] a) ; :(
19:15clojurebot1
19:15Bronsathis works by accident since 1.6
19:16seangroveWow, didn't know that keywords would turn into bindings..
19:16dthurnyou can use keywords instead of symbols in bindings?
19:16seangroveAh, ok
19:16dthurndidn’t know that
19:16Bronsaseangrove: only in destructuring
19:16Bronsadthurn: don't do that. it's an implementation detail
19:17dthurnThat’s too bad, I like the idea of using constants in binding expressions
19:17Bronsaseangrove: if you're interested, this works as a side-effect of the patch for destructuring namespaced keywords
19:17dthurnBut it makes sense, I guess
19:18seangroveBronsa: Ah, interesting actually
19:59sova:D Clojure!
20:00xnilFinally, some Clojure.
20:01xnilClojure for Windows [close your four windows]
20:08xnilClojure Mind, Clojure Buddha
20:19sovacould someone kindly point me to an open source project which uses clojureScript?
20:20radsztellman: I watched your "Always Be Composing" talk and really enjoyed it. I'm trying to learn the tradeoffs between data-oriented code and function-oriented code, but I basically have to write it both ways to see which works best right now
20:20ztellmanrads: so do I, a lot of the time
20:20radsone insight I liked was that data is more general than code because it has no predefined semantics
20:20radswhich makes the program more general
20:20ztellmanin both the good and bad senses of the term
20:20ztellmananyway, glad you liked it
20:21radsI'm interested in doing a talk that goes into more detail about those tradeoffs, but I need more experience and research to be able to do that
20:21radsI find this concept of data-orientation hard to explain to people who only know OO
20:22ztellmanI'd be interested in seeing that talk
20:22radsit seems like there's not much literature on this idea right now, but maybe that's because it's a relatively new concept?
20:23ztellmanI'm sure there are multiple papers in the 70s that discuss it under a different name
20:23radsI don't have a lot of experience with other FP languages besides clojure, but in haskell for example it appears there's a lot of emphasis on higher-order funtions
20:24radsI haven't heard much about "data-first" programming in haskell
20:24radsyeah, that's the tricky part :)
20:24radsfiguring out the different name
20:25TEttingerthere's also this http://www.dataorienteddesign.com/dodmain/node3.html
20:25TEttingerdata oriented design is a crazy concept
20:26TEttingerbut rather different from the high-level approach to data in clojure
20:26radscool, thanks for the link
20:27radsanother way to put it is that we have this rule of thumb of "data > functions > macros" when designing a program. I'm wondering what are the principles that make that rule of thumb work
20:28TEttingermore data than fns than macros sounds like a good approach
20:28radsI've heard it around the community before, but I don't know where it originally came from
20:30radsTEttinger: it looks like "data-orientented design" and "data-driven design" are two separate things
20:31TEttingerrads, indeed!
20:31TEttinger$wiki data driven design
20:31lazybot[Data-driven programming - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Data-driven_programming
20:31TEttingerwho fixed lazybot, Raynes, justin_smith, rhg135?
20:31Raynes?
20:32TEttingergoogle didn't work for a while because the API died
20:32TEttinger$google google search api deprecated
20:32lazybot[Google Web Search API (Deprecated) — Google Developers] https://developers.google.com/web-search/
20:33RaynesWell, nobody fixed it.
20:33radswhen I first heard about this idea of modeling a program as passing in a data structure to a domain-specific evaluator, I thought of grunt (the javascript build tool) and thought "yuck"
20:33TEttingerhm
20:34TEttingerFor CSE users, the API provides 100 search queries per day for free. If you need more, you may sign up for billing in the Developers Console. Additional requests cost $5 per 1000 queries, up to 10k queries per day.
20:34radsafter thinking about it some more, I think the problem with grunt I had is that I felt limited by what I could express in its data format
20:34radsperhaps it's not the weakness of the programming orientation, but the specific choices the grunt authors made
20:34tadni_Is Luminus suggested for webdev?
20:35sovaluminus is sweet, depending on the complexity of your app
20:35TEttingerI had an issue with my lazybot after restarting it, that any $google requests didn't print anything because there was no :body in the JSON, just a response like "this has been deprecated, use our paid thing instead"
20:36tadni_sova: I mean, it'll mostly just be a document viewer -- but also have a system that will talk to my server and build a custom GNU+Linux distro on my end, probably though tome simplisiticish UI.
20:36TEttingerI ended up adding my own google plugin, that scrapes DDG's redirect page for a request like http://duckduckgo.com/q=\panda%20site:wikipedia.org
20:37tadni_I really want to do it in as much Lispyness as possible, but I keep having people suggesting Angular to me. I know very, very little about webdev. And JS about at that same level.
20:37TEttingermake that https://duckduckgo.com/?q=\panda+site:wikipedia.org
20:38radstadni_: might want to look into something based on React.JS for a functional-approach to front-end development
20:38TEttingerOm ?
20:39tadni_rads: Thanks, I'll add it to my list of things to check. :^)
20:39radsom is one option, there's also reagent which is a more direct clojure wrapper for react.js
20:40tadni_I mean, to a large degree -- I want to just clone getfedora.org with having most everything on the page ... but also, having a distro genrator seems like a relatively cool/easy thing to implement.
20:42xniltadni_: clojurescript, m8
20:49tadni_But yeah, of the selections I've seen -- Luminus seems decent.
20:54Rayneshttp://www.tryclj.com/ has a new design
20:54RaynesSure wish folks would contribute more cool stuff like this to tryclj ;)
20:54RaynesIt hasn't seen love in a while.
20:54RaynesSure would be neat if someone updated it for new Clojures and stuff ;)
21:03xnilRaynes: oh, that's nice.
21:03klHi, a question. Clojure uses the JVM to enable interoperability with Java stuff. But Clojure promotes immutability & referential transparency - why would anybody have an interest in linking up Clojure stuff to Java stuff to begin with?
21:03xnilkl: because instead of reinventing the wheel, we decided to use preexisting tools
21:04klxnil: so the aim was to avoid creating a runtime, rather than Java interoperability?
21:04xnilit was both
21:05xnili believe hickey's got an official explanation
21:05xnillet me find it
21:05klxnil: that's pretty much my question: why would anybody want Clojure interop with a side-effectful & mutable language
21:05kloh ok, thanks
21:05xnilhttp://clojure.org/rationale
21:06xnilkl: ^^
21:07xnilso yeah, java interop is a huge incentive
21:08xnilif your question is the opposite, why would anyone want to use clojure where they can just use java instead, that page should explain the same thing
21:08klxnil: lol, no. I'm not a Java proponent :)
21:08klxnil: it was more "why infect clojure with java"
21:09xnilyou don't necessarily have to, as it's also on the .NET platform and compiles down to javascript, but the JVM's just cool, man.
21:16tadni_Okay, probable nap time. o/
21:19xnil\o
21:24klxnil: that, I didn't know.
21:25kl(Clojure on CLR)
21:25xnil:)
21:25klI've been learning Scala for a while - I'm not convinced it's *the* language for me, but I like a lot of the stuff I've come across. Primarily because it's my first foray away from the "mutable" kind of languages
21:26klI'm going to spend the evening looking at Clojure for comparison - the only thing that concerns me is its lack of static typing. I was never concerned about such things pre-Scala: but a rich type system seems to bring a lot.
21:27xnilbetween scala and clojure, i've got to say clojure rubs me the right way. and i'm a massive fan of static typing
21:27xniljust wait until you try haskell
21:27xnilkl: https://github.com/clojure/core.typed
21:27klIt's possible to know Scala without already knowing Haskell? :)
21:28kl(Scala seems a much more complicated, distorted, far removed version!)
21:28xnilbarely
21:28xnili'd say haskell is that to ocaml, and scala is that to ruby if i were the one concocting the rhetoric
21:29klI'm not sure I felt any kind of relationship between Scala and Ruby
21:29kl(And Ruby is my day-job)
21:29xnilwell, i like neither
21:29godd2yea scala syntax reminds me more of ruby than most things
21:29xnili'm more of a lispy person. python over ruby for me
21:30klxnil: I just find when dealing with Python/Ruby... I have to rely much more upon grep than I'd like
21:30klI mean, there's only so much following you can do when everything's so dynamic
21:30xnilas a result of dynamic typing?
21:30klMaybe that. I'm not sure.
21:30xnilah
21:32klxnil: is that a sentiment you could at all agree with, from experience?
21:33klI understand Clojure to be dynamic, too. But I'm not really sure what dynamic with lisp actually means.
21:33xnilclojure's dynamic typing is only a boon in my experience
21:33xnilwell
21:33xnilscratch the only
21:34xnilthere are some places i would like static typing but usually i can whip up something cool to compensate for the lack of mojosa-ness
21:35klWould you say that Clojure's dynamic typing is more beneficial+less detrimental, say, than that existing in Ruby/Python?
21:35xnilyes, by far
21:35klOr would you say it's pretty much of same consequence.
21:35klOh
21:36xnili feel python and ruby achieve almost a comparatively toyish feel to them because they try to be something lisp yet traditional
21:36xnilit's a very usable awkward middleground
21:36klI'm pretty sure I'm going to feel more rounded as a developer with Clojure in my arsenal
21:36xnilabsolutely
21:36xnilbut then again, surely i'm biased
21:37klI used to think (and sound, to many) that I was a real polyglot. I've done so many languages.
21:37klBut none were in the functional sphere
21:37klC/C++, Perl, PHP, Python, JS, Ruby
21:37xnilto be honest, japanese is harder than mandarin chinese
21:37klI'm sure I've done others for extended periods that I couldn't even recall
21:40klxnil: I wish my capacity for learning formally specified languages extended to the spoken ones
21:40xnilC, C++, PHP, Ocaml, Haskell, PHP, Python, JS, C#, Java, Clojure, Common Lisp (in various implementations), Racket, Rust, D, and of course the web stacks that every aspiring nerd learns as well as some other languages i didn't use for more than 4 or 5 projects
21:41xnilgame maker language, anyone?
21:41xnilkl: esperanto's formally specified :^)
21:41klxnil: hmm. In retrospect, I'm not sure the formal specification is really the qualifying criterion for me :)
21:42xnilyou can build things with esperanto, like artism
21:43xnili've got a cheesecake of 1 foot in diameter
21:44klI really like the idea of esperanto. If it had higher adoption, I'm quite sure I'd learn it
21:44xnilbuilt it with La Mastro de L'Ringoj
21:44klI try using English as a language which can be logically built upon, except that just doesn't work
21:44xnilall natural languages are that way, sorry :P
21:45klHow did every single naturally emerging language screw it up?!
21:45klIt seems easier to just make a consistent one!
21:45sovauntil you see a tiger
21:45xnilit's the brain's fault
21:45xnilsova: or a leopard
21:45xnili type better with leopards
21:45sovaand have to shout "HOLY S*** A TIGER/LEOPARD"
21:46sovasorry to rudely throw in my two cents, i enjoy language discussions
21:46sova*lurks back to the shadows*
21:50xnilDid you mean "Holly, shoot a torque laser"?
21:50xnilanyone here from the greater Boston area?
22:18xnilsova: language discussions are fun. i say we implement a natural language with lisp
22:18xnilin fact, i think i have a conthept for it right now.
22:19munderwothis is probably a long shot, but has anybody used https://github.com/nodegit/promise from clojurescript?
22:57kenrestivough, debugging locked-up async channels is no fun.
22:58sdegutisxnil_: I dunno, why s-expressions?
22:58sdegutisThere doesn't seem anything inherently worthwhile in using s-expressions. It seems merely to be a matter of preference.
22:58kenrestivohow about t-expressions
22:59kenrestivomaybe it's time to move off of s
22:59sdegutisThen we should have S++-expressions.
22:59kenrestivomsft can have s# expressions
22:59sdegutiskick picasso it's a spambot
22:59arrdemthe core value of sexprs is homoiconicity for generated programs.
23:00sdegutisarrdem: I think it's been done without s-expressions though.
23:00arrdemsdegutis: eh you need some equivalent representation of a "form" tho.
23:00sdegutisTrue.
23:00sdegutisI suppose code<->data is a legitimate benefit.
23:01sdegutisI guess its value is what's really arguable.
23:01arrdemcode <-!-> data, we have read-eval
23:01arrdem:c
23:01arrdem@ops picasso indeed is a spammer.
23:01arrdemamalloy / oh shit where'd technomancy go
23:02amalloyarrdem: i tried to deal with that earlier but apparently don't know how
23:02arrdemamalloy: thanks
23:09xnil_sdegutis: wrong
23:09xnil_sdegutis: s-expressions achieve a particular simplicity and minimalism that nothing else i've seen does
23:09xnil_and expressiveness!
23:10sdegutisxnil_: sure, but expressiveness is subjective
23:10sdegutisxnil_: and the value of simplicity and minimalism is also subjective
23:10xnil_subjectivity is simply expressive
23:10xnil_minimalism? i hardly knew 'er
23:10sdegutisxnil_: I have written many languages, some with s-expressions, some without, and enjoyed them all, but I would not say s-expressions are superior and it's not my favorite syntax
23:11xnil_i've done the same and i have the opposite opinion
23:11xnil_i respect yours though
23:11xnil_i just think it's totally wrong
23:15sdegutis:)
23:15sdegutisI respect yours too.
23:15sdegutisAnd I don't think yours is wrong.
23:15sdegutisBecause opinions can't be right or wrong ;)
23:16sdegutis(i.e. I don't hold it strongly enough to consider that mine is Right™.)
23:29arrdemNaming: a linked document / hypertext editor & stack based browser
23:41xnil_it is my opinion that righteousness is a matter of subjectivity
23:45klxnil_: your opinion is also a matter of subjectivity. :P
23:46kl(I completely agree ;)
23:53arrdemandyf: ping