#clojure log - Dec 21 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

1:53 kenrestivo: hmm, 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

1:54 raspasov: kenrestivo: what's the problem?

1:55 kenrestivo: i'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

1:56 raspasov: networked pub/sub or in-process only?

1:56 i.e. pub/sub over core.async only (local, in process) or via some external queue ?

1:58 kenrestivo: in-process

1:59 just core.async, no other queues. the message bus has a buffer though

1:59 i'm wondering what the typical/expected latency would be for such a thing?

2:00 raspasov: not 100% sure but should be pretty fast - what do you mean by 3-4 repetitions ?

2:00 3-4 repetitions of what?

2:00 kenrestivo: i have to send the same message, repetitively, before it gets received

2:01 raspasov: that's definitely weird, it's either a bug, or you're using something wrong, how are you trying to take from the channel?

2:01 kenrestivo: and, interestingly, it only gets received fewer times than it was sent. it's as if the other sends are lost

2:01 takes are in a loop in a future

2:01 raspasov: do you have gist?

2:02 kenrestivo: i could try to distill one down

2:03 raspasov: your take should look something like (go (loop [] (println "got val on a chan::" (<! my-chan)) (recur)))

2:03 yea that would be helpful, hard to talk without code :)

2:04 kenrestivo: well there are a lot of moving parts.

2:04 there are two pubs, off of one message bus, in several namespaces, etc

2:04 but yeah, let me paste something

2:05 raspasov: are you using the core.async pub/sub stuff or building your own? last I remember the core.async pub/sub was experimental

2:06 kenrestivo: the core of it is just this https://www.refheap.com/95237

2:06 hmm, i didn't realize i was gonna get cut that badly, but i'm not surprised.

2:06 raspasov: first of all, use (thread) instead of (future)

2:07 not sure what's the difference, but that's the recommended way to do it I beliee

2:07 I think there is some

2:08 kenrestivo: the 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)

2:08 i don't see any notes about pub/sub being experimental, but all of async is alpha, so i'm not too surprised

2:09 raspasov: yea I don't see it either

2:09 in general it has been pretty solid for me, but I haven't used to pub/sub part of it

2:10 is that drop happening under load or just when you put values one by one?

2:10 I also see "Items received when there are no matching subs get dropped."

2:10 http://clojure.github.io/core.async/#clojure.core.async/pub

2:11 are your subs active when the first messages gets put on the pub channel?

2:13 kenrestivo: no load, just testing.

2:13 the subs are active, yes.

2:14 i'm starting to think i might be rearchitecting the whole app without async soon.

2:15 raspasov: I 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

2:15 I've been using channels for a while and never felt the need to use pub/sub

2:16 kenrestivo: that'd be a less drastic step: i could blow off this message bus idea and just pass channels around instead

2:18 the idea of decoupling everything was very attractive. but now i'm wondering if it just is making things more complex than necessary.

2:22 crispin: hey peeps! How do i eval an expression with a macro in it?

2:22 I can do this

2:22 ,(eval '(map inc [1 2 3]))

2:22 clojurebot: (2 3 4)

2:23 crispin: but I cant do this

2:23 ,(eval '(doseq [i [1 2 3]] (inc i)))

2:23 clojurebot: nil

2:23 crispin: doseq is a macro. Putting in macroexpand doesnt fix it

2:24 kenrestivo: doseq returns nil, it's side-effecting

2:24 crispin: ahahhhhhahah

2:24 ffs

2:24 kenrestivo: you meant "for" not "doseq"?

2:24 crispin: ,(eval '(doall (for [i [1 2 3]] (inc i))))

2:24 clojurebot: (2 3 4)

2:24 crispin: haha yeah

2:25 thanks kenrestivo

2:25 kenrestivo: np

2:25 crispin: so eval lazyseq will expand the seq, not just return the lazyseq?

2:25 ,(eval '(for [i [1 2 3]] (inc i)))

2:25 clojurebot: (2 3 4)

2:25 crispin: right

2:27 raspasov: kenrestivo: check this out https://gist.github.com/raspasov/81c678961b6292eebe04

2:27 seemed to work for me

2:28 I get the published message on both subscribers

2:32 kenrestivo: yeah, my test code works too, and did, before i weaved it into the app

2:33 everything 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 :-/

2:34 not too surprising.

2:34 raspasov: yea 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

2:35 kenrestivo: it'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

2:35 but if latency issues are cropping up, i've got to back out of that idea

2:35 one of the great things about clojure is how easy it is to make rather large sweeping changes without too much work

2:36 raspasov: yes, that's true

2:36 Lisp is just like a lego

2:36 kenrestivo: if i had to do a major rethink about stuff lke this in any other language, i think i'd be well and truly screwed

2:36 raspasov: how long have you been doing Clojure?

2:36 kenrestivo: almost 3 years, off and on

2:37 raspasov: cool

2:37 kenrestivo: and i keep cutting my fingers on new things (like async) so i never really feel that experienced

2:38 you seem to be fairly comfortable with core.async. thanks for your help and perspective.

2:39 raspasov: no 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

2:41 kenrestivo: i'm going to try to simplify. the fewer moving parts the better.

2:43 raspasov: yea, agree

4:28 rivrkeepr: lookz2boring

4:28 4actualInterchange

4: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?

4:35 expez: How 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.

4:35 s/expecting/inspecting/

4:35 dysfun: you can read the file and not macroexpand it

4:35 adu: what's the difference between doto and ->

4:36 expez: dysfun: then what? string match the macro name?

4:36 dysfun: doto is for mutable things

4:36 expez: yup

4:36 expez: this was my 'simplest thing that could possibly work' plan, but I was hoping for other options :p

4:37 dysfun: that would require knowledge of what you're trying to achieve

4:37 adu: dysfun: so x.f() x.g() instead of y = x.f(), y.g()?

4:37 expez: dysfun: 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.

4:38 dysfun: adu: if you replace that comma with a semicolon, yes

4:38 expez: you're reimplementing slamhound?

4:38 adu: how do you pronounce -> and ->>?

4:38 dysfun: 'thread' and 'thrush' or 'thread-last'

4:38 expez: dysfun: yes

4:39 dysfun: is there a reason you're not just using slamhound?

4:39 expez: yes, it doesn't work :p

4:39 dysfun: perhaps we can help you with that rather than reinventing the wheel? :)

4:40 (or perhaps you may be tempted to patch it?)

4:41 expez: dysfun: https://github.com/clojure-emacs/refactor-nrepl/pull/9 I think this op does a bit more than slamhound and it should work better

4:42 dysfun: oh that's pretty cool

4:43 so doing this 'properly' is going to require stepping through macroexpansion and it'll get very tedious

4:43 but 99% of cases will be caught by the 'simple' method

4:44 thanks largely to syntax-quote

4:44 expez: so if I search for "(some-macro " what's going to get missed?

4:45 maybe I should search for "some-macro", then and just leave an extra symbol in the ns every now and then

4:45 dysfun: i suspect there's scope for missing things when generating macros in macros

4:45 justin_smith: "( some-macro" is valid, though pathological

4:45 ,( + 1 1 )

4:45 dysfun: and you would actually step through an edn tree, rather than string match

4:45 clojurebot: 2

4:47 dysfun: justin_smith: this explains a lot about your code :)

5:47 expez: dysfun: I did find a use for, parts of slamhound, https://github.com/clojure-emacs/clj-refactor.el/pull/88

6:08 dysfun: :)

6:11 anyone using reloaded workflow with something that tries to invert control? in this case jmonkeyengine

6:12 i'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

6:14 i'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

7:44 triss: so chaps. what's the simplest way to extract values for two keys in a map in to a tuple?

7:46 andyf: triss: juxt, probably.

7:46 ,((juxt :c :d) {:a 1 :c 2 :d 7 :e -2})

7:46 clojurebot: [2 7]

7:46 andyf: if by 'tuple' you mean vector.

7:47 triss: splendid thanks andyf!

7:48 andyf: juxt is useful for other similar things, too, when you want a vector of results

8:08 lodin: Is there any way to write a macro that would insert two elements into e.g. (let [(mymacro)] ...), without modifying let?

8:08 Bronsa: lodin: no that's not possible

8:08 lodin: That's what I figured. :-/

8:09 The drawback of Clojure prefering flat structures and less brackets.

8:09 dysfun: ooh, i hadn't seen 'juxt' used like that before, that's pretty neat

8:09 Bronsa: lodin: that wouldn't be possible in cl either

8:10 lodin: Bronsa: Why not? (I don't know CL.)

8:10 Bronsa: dysfun: (let ((mymacro 1))) would bind mymacro to 1 rather than invoke mymacro and bind whatever first symbol it returned

8:10 dysfun: i think you mean 'lodin'

8:10 Bronsa: dysfun: yeah sorry

8:10 lodin: ^ that was meant for you

8:11 lodin: Bronsa: True.

8:11 So maybe let wasn't the best example. :-)

8:11 Bronsa: amalloy_: picasso is the daily spammer

8:12 triss: ok... laziness is confusing me re: writing performant code...

8:12 anyone know of any good writings on the subject?

8:12 lodin: Bronsa: (let (((mymacro 1)))) then? Can't bind to (mymacro 1). ;-)

8:13 triss: or will this sort of understanding take a while to sink in?

8:13 Bronsa: lodin: I'll take that as a joke :)

8:13 dysfun: triss: don't worry about performance yet. worry about performance when you have a performance problem

8:13 focus on algorithm order of complexity

8:14 triss: i got one.... I'm wondering wether clojurescript's a nicer language that js for writing low level web audio stuff.

8:14 dysfun: plus as you say, you'll develop an intuition in time

8:14 how do you mean? run it on client side?

8:15 triss: "algorithm order or complexity"?

8:15 yep. run on the client side....

8:15 dysfun: https://en.wikipedia.org/wiki/Big_O_notation

8:15 well if you're running on the client side, i don't see you have much choice than clojurescript

8:15 triss: cheers dysfun. I think I'm paying attention to all that stuff.

8:16 lodin: triss: Note that if if have ((juxt k1 k2) the-map)) you could run into problems.

8:16 ,(let [a 3 b 5 m {a :three b :five}] ((juxt a b) m))

8:16 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

8:16 lodin: Not fun to debug.

8:16 dysfun: in which case, i recommend not worrying about performance yet

8:16 triss: cheers dysfun. we'll see how it goes.

8:17 dysfun: i'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

8:17 triss: excellent news. cheers dysfun

8:18 dysfun: in general, most problems deal with a fairly small amount of data anyway and even order of complexity makes little difference

8:18 not that i'd advocate not paying it attention

8:19 lodin: Bronsa: 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.)

8:20 triss: what'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

8:20 it feels most unnatural in clojure to be writing a function like this.

8:21 most example code (in JS) doesn't the imperative thing of updating a slot at a time of the output array in a for loop

8:22 dysfun: you may even find that it's better to just write it in javascript for that bit

8:22 one of the great things about clojurescript is that you get proper javascript interop

8:23 triss: hmmmm... I'm gonna push on with cljs for the time being and see if its sluggish or not.

8:24 fast enough is fast enough i suppose.

8:26 dysfun: depends how much audio you're processing i guess

8:27 triss: 44100 samples of it per second. with only a smidgeon of latency

8:42 so what's a nice ay of copying a lazy sequence in to a Java/JS array?

8:42 ^nice way

8:43 I guess doing this could be considered not nice at all.....

8:51 brucehauman: triss: clj->js

10:15 vmarcinko: hey 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:15 d process can last even months/years..

10:16 so i just wanted to have some kind of conrimation that core.async is not made for this kind of "processes"

10:18 these 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:33 triss: ah thanks brucehauman.....

10:33 but doesn't that create a new array? I want to populate an existing one.

11:07 Bronsa: chouser: hi, mind banning picasso? the usual spam bot

11:28 luxbock: I 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:42 mindbender1: How do I remove hidden directories from a file-seq?

12:15 justin_smith: triss: for audio processing with low latency, everything should remain arrays, don't use vectors or lazy seqs for samples

12:16 triss: ahhhhhhh..... thought so justin_smith thanks.....

12:17 that won't the last few hours of attempting to write a bitcrusher in a functional style go away though

12:17 clojure really is ugly for that sort of thing though....

12:18 justin_smith: triss: check out kunstkusic/pink to see low latency audio processing in clojure done decently

12:20 triss: cheers justin.... not seen those. I'll take a peek

12:20 justin_smith: *kunstmusic that is (irc from the phone)

12:21 it's just one project, kunstmusic is the org, pink the package

12:22 ,

12:22 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

12:23 triss: thanks man. this stuff looks really cool

12:25 jonathanj: i'm getting the following error from this <https://pb.codehash.net/kitokegi.clj> 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:28 oh... i guess there is no 1 arity version of the generated query functions, that's unfortunately rather cryptic

12:31 triss: is there a way to swap the order or a functions arguments?

12:32 TEttinger: justin_smith, kinda funny how the german word for art (kunst) is so un-beautiful

12:32 justin_smith: triss: s/or/of?

12:32 TEttinger: heh, indeed

12:32 triss: TEttinger. Art doesn't need to pretty chaps. (or that's the excuse I use for my work)

12:33 hellofunk: TEttinger or the dutch word

12:33 TEttinger: heh, indeed.

12:33 picasso: Bronsa, it was picassoo who was spamming, not picasso

12:33 no affiliation

12:33 TEttinger: lol

12:33 that's hilariously coincidental

12:34 maybe the spambots are starting to learn and pick modifications of names used in the channel to divert blame

12:34 picasso: indeed

12:34 TEttinger: TEttingerr is spamming now :P

12:34 picasso: i wouldnt put it past them

12:34 kids with too much time

12:35 TEttinger: there 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:35 triss: sorry justin_smith: of

12:36 hellofunk: TEttinger wow that's awful

12:38 TEttinger: http://www.politico.com/magazine/story/2014/12/pharma-spam-113562.html

12:39 it makes you wonder, how hard can it possibly be to not but uranium in things?

12:39 *put

12:40 triss: to swap fn order in a 2-arg fn?

12:41 ,(#(map %2 %1) [1 2 3] inc)

12:41 clojurebot: (2 3 4)

12:43 TEttinger: for an arbitrary-number of-args order reversal,

12:43 ,(#(apply map `[~@(reverse %&)]) [10 20 30] [1 2 3] +)

12:43 clojurebot: (11 22 33)

12:44 TEttinger: ,(#(apply map `[~@(rseq %&)]) [10 20 30] [1 2 3] +) ; might work?

12:44 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.ArraySeq cannot be cast to clojure.lang.Reversible>

12:44 TEttinger: assuming map is the fn you want

12:45 hm wait

12:45 that's unneeded

12:45 ,(#(apply map (reverse %&)) [10 20 30] [1 2 3] +) ; might work?

12:45 clojurebot: (11 22 33)

12:45 TEttinger: much easier :D

12:45 triss: cheers TEttinger - mulling this over. it's just a two arg function.

12:46 TEttinger: then %2 %1 may be easiest

12:46 there may be a built-in lib fn but I kinda doubt it

12:50 justin_smith: there is a flip in flatland/useful

12:50 triss: ah flip... that's what I'm looking for. cheers.

12:51 what are the reasons for that useful stuff not makings it way in to .core

12:51 ?

12:52 hey 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:52 justin_smith: core is pretty conservative about what it includes

12:58 mindbender1: I need to get rid of hidden folders from a file-seq. What's an efficient way of doing that?

12:59 tcrayford___: mindbender1: can't you just use `filter` and call whatever java api lets you get at hidden/not hidden on File?

13:02 justin_smith: tcrayford___: what about filtering files inside hidden directories?

13:02 tcrayford___: oh, touché :/

13:03 justin_smith: at that point you are better off rewriting file-seq

13:03 tomjack: reimplement file-seq?

13:06 borkdude: Is it possible to add a message to a :post condition in a function when the assertino fails?

13:12 bbloom: ,((fn [x] {:post [(and (odd? %) "a message")]} x) 6) ; borkdude: this work? :-)

13:12 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (and (odd? %) "a message")>

13:13 borkdude: it's a hack ;)

13:13 bbloom: ,((fn [x] {:post [(do "must be odd" (odd? %)))]} x) 6) ; this feels marginally less hacky

13:13 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

13:13 bbloom: eh, you get the idea

13:24 munderwo: Is 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:25 bbloom: munderwo: define "doesn't work"

13:26 munderwo: So 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:27 bbloom: munderwo: (let [repo (or (open-or-nil ...) (clone ...))] ....

13:27 or in two statements:

13:27 munderwo: in 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:27 bbloom: (let [repo (open-or-nil ...) repo (or repo (clone ... ...

13:28 (let [[status repo] (open ...), repo (if (= status :not-found) (clone ...) repo) ....

13:28 munderwo: one of those many variations should work for you

13:29 munderwo: ok thanks… i’ll give those a shot

13:30 bbloom: munderwo: 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:31 munderwo: ok, I think that makes sense. Thanks for the help!

13:31 andyf: Bronsa: 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:32 Bronsa: andyf: ok, I'm busy doing stuff right now so I likely won't be able to look at it until tomorrw

13:32 andyf: No problem.

13:57 dnolen_: http://swannodette.github.io/2014/12/21/browserless-clojurescript/

14:25 sveri: Hi, 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:32 michaniskin: sveri: can you paste your build.boot file please?

14:35 sveri: michaniskin: 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:39 michaniskin: sveri: what's on line 8 of sveri.clojure.commons.files.edn source file?

14:39 sveri: oh i see

14:39 fname is nil i think

14:39 trying to make a reader from nil throws

14:40 i mean there is no resource maybe

14:40 sveri: michaniskin: ah, resource paths -.-

14:40 michaniskin: sveri: debug print (io/resource fname)

14:40 it's probably nil

14:41 sveri: the boot file I copied from has only this resource path set: src/clj, this is not enough for me, I try it

14:41 michaniskin: sweet

14:43 sveri: michaniskin: 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:44 michaniskin: sveri: you can call set-env! anywhere

14:44 you can make a task that calls it

14:44 basically all the different things in lein can be done in boot with just deftask

14:45 Bronsa: amalloy: I won't talk about what I just saw.

14:45 amalloy: Bronsa: i'm not sure what the deal is there. i didn't actually type that

14:45 sveri: michaniskin: ok, I think I get it

14:45 Bronsa: amalloy: <insert joke about your irc client here>

14:45 michaniskin: (deftask dev [] (set-env! :dependencies #(conj % '[...])) identity)

14:45 sveri: then you can use it like a lein profile: `boot dev run-tests`

14:46 or something, there are lots of options cause you're programming there

14:46 amalloy: Bronsa: 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 i actually attempted to ban *!~mike@bb.pixor.net

14:47 so i am gonna leave this for more a competetent op

14:48 Bronsa: amalloy: I'm pretty sure any client will do the right thing with /mode #clojure +b picasso

14:48 michaniskin: sveri: 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:48 amalloy: Bronsa: i don't think you want to ban nicks

14:48 hellofunk: Bronsa: please forgive my ignorance, i beg you most kindly please note the difference in the /mode you mentioned and /ignore

14:49 sveri: michaniskin: thanks, I just wrote this up

14:49 Bronsa: amalloy: meh, he's identified though

14:49 hellofunk: I have already /ignored it but banning it from the channel is the only way to prevent it won't spam other users

14:50 hellofunk: Bronsa: 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:50 sveri: michaniskin: 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:51 Bronsa: hellofunk: are you by any chance sdegutis?

14:51 hellofunk: Bronsa: 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:09 Bronsa: lol just having a bit of fun, but no i am not that other user, if that's what you meant.

15:10 btw 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:15 TEttinger: hellofunk, yep, clojure's a great language with a great community

15:20 Deraen: sveri: Interesting. The boot doesn't print anything before the exception? Is your build.boot file still similar to what you linked previously?

15:21 michaniskin: sveri: you can increase verbosity with the -v option, like `boot -vvvv dev`

15:22 sveri: Deraen: yea, but I just saw, I have to add a special boot.clj file like in the example, I totall ymissed this

15:22 Deraen: You were trying to require some code from build.boot which requires some ns which has to be compiled using cljx?

15:24 Pistahh: hi

15:24 <- relatively new to clojure

15:25 how to do ((mymap "foo") "bar") more clojure-ly?

15:26 michaniskin: Pistahh: (get-in mymap ["foo" "bar"])

15:27 Pistahh: see also assoc-in, update-in

15:27 Pistahh: thy

15:27 michaniskin: np

15:28 sveri: Deraen: but yea, I am requiring cljx code in clj code, I guess thats what the error says+

15:31 emaczen`: How can I debug in clojurescript repl?

15:31 I want to find the values of some web-forms.

15:36 michaniskin: sveri: you can make a task that is after cljx in the pipeline and that can require things

15:37 you would need to require/refer or require/eval in there, of course

15:39 sveri: michaniskin: for debugging purposes?

15:39 michaniskin: sveri: i mean if you're using things produced by cljx in your build.boot

15:39 you'd need to put that code in a task that comes after the cljx task

15:50 sveri: michaniskin: 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:05 michaniskin: sveri: the clj code that requires the cljx should not itself be required until after the cljx task runs

16:05 you can do this from a task that runs after the cljx task

16:07 sveri: ah I see, that makes sense

16:07 michaniskin: thank you, I guess I have to refactor a bit then

16:16 Pistahh: I 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:18 andyf: ,(zipmap [:a :b :c] [1 2 3])

16:18 clojurebot: {:c 3, :b 2, :a 1}

16:20 havenwood: ,(interleave [:a :b :c] [1 2 3])

16:20 clojurebot: (:a 1 :b 2 :c ...)

16:20 havenwood: ah right, assoc map

16:33 SagiCZ1: top o' the mornin' to ya

16:35 kenrestivo: howdy

16:36 hmm, 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:37 could also ref/atom the channels but that starts to smell funny to me (async/<!! @chan)

16:38 SagiCZ1: maybe you could use poision pill approach

16:38 kenrestivo: how so?

16:38 SagiCZ1: feed the channel something that the consumer recognizes and shutdowns... "-1" or nil or something

16:39 this is what is commonly used in java when operating blocking queue

16:39 kenrestivo: oh, a kill message. but what if someone else shuts it down? the error handling becomes complex

16:40 SagiCZ1: i guess.. it was just an idea, i dont understand your case well enough

16:40 kenrestivo: neither do i, apparently :-/

16:42 SagiCZ1: i 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:43 kenrestivo: i'm learning it. it has a lot of potential but i'm still trying to figure out how to use it properly.

16:44 i 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:46 SagiCZ1: so you would need the channel to recognize that one of its ends is dead and close itself?

16:46 kenrestivo: hmm, lemme see if i can refheap something up. might help me think about the problem better too

16:47 see, 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:47 SagiCZ1: yeah i see

16:47 kenrestivo: it's real easy to just close a channel adn stop a loop that way, but then restarting... that's the thing

16:48 (loop [] (when-let [v (async/<!! chan)] (do-stuff v) (recur)))

17:32 numberten: is aset O(1) ?

17:33 SagiCZ1: numberten: what do you mean? set? what operation?

17:34 numberten: ,(doc aset)

17:34 clojurebot: "([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."

17:35 SagiCZ1: numberten: oh sorry

17:36 i think it should be definitely O(1)

17:36 kenrestivo: ok, just played around with it, i think it'll work the way i want it to. https://www.refheap.com/95273

17:51 andyf: kenrestivo: 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:52 kenrestivo: andyf: i think you meant SagiCZ1

17:52 or maybe numberten

17:52 andyf: sorry, yes.

17:52 numberten: ^^

17:53 kenrestivo: (who is probably wonder why his computer is beeping so much now)

17:54 numberten: this is an array of bigints

17:54 so reflection could probably be a big constant cost I imagine :/

17:55 kenrestivo: type hints

17:55 kills reflection dead

17:55 numberten: cool

17:55 never actually used them before

17:56 jonathanj: is there a better way of writing: (into {} (map (juxt :id :name) modes))

17:57 Bronsa: select-keys

17:57 ,(doc select-keys)

17:57 clojurebot: "([map keyseq]); Returns a map containing only those entries in map whose key is in keys"

17:57 kenrestivo: i like "lein update-in : assoc :pedantic? :warn -- check" to find all the reflection warnings, dependency mismatches, etc

17:57 Bronsa: no, that doesn't do what you want

17:58 jonathanj: that is turning [{:id "a" :name "Aye"} ...] into {"a" "Aye" ...}

18:00 Bronsa: jonathanj: yeah I can't think of a better solution than the one you wrote

18:02 numberten: kenrestivo: is it possible to type hint an array?

18:02 SagiCZ1: yes

18:03 ints, longs, floats, doubles ..

18:04 Pistahh: is there anything like "map" but without collecting the results?

18:04 justin_smith: in fact, arrays aren't just hinted - they are typed

18:04 Pistahh: doseq

18:04 numberten: bigints?

18:04 justin_smith: or (dorun (map ...)) if you really want the map syntax

18:05 numberten: "bigints" would not make sense, because bigint is not a primitive type

18:05 ,(into-array BigInt [])

18:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: BigInt in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:06 justin_smith: ,(into-array clojure.lang.BigInt [])

18:06 clojurebot: #<BigInt[] [Lclojure.lang.BigInt;@248d7e99>

18:06 numberten: ,(into-array clojure.lang.BigInt [])

18:06 clojurebot: #<BigInt[] [Lclojure.lang.BigInt;@33ba11b3>

18:06 justin_smith: but that's not the same sort of thing as longs, doubles, bytes etc. - each element must be boxed

18:07 numberten: i see

18:09 so 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:10 justin_smith: ^"[Lclojure.lang.BigInt" may work as an annotation there actually

18:10 iirc the string will be interpreted properly

18:10 numberten: i didn't know you could wrap types in strings

18:10 justin_smith: it's needed for [L...

18:11 Bronsa knows more about this stuff though

18:11 kenrestivo: hahaha, the complexity in starting/stopping multiple threads/channels comes when i get into using alts!!...

18:11 a simple when-let ain't gonna cut it

18:12 numberten: it worked

18:12 but it needed the ;

18:12 ^"[Lclojure.lang.BigInt;"

18:12 justin_smith: thanks

18:12 justin_smith: np - forgot the ; was part of the class name, yeah

19:13 dthurn: Can somebody help me understand why this doesn’t return 15: (let [[tween [:tween]] [15 [:tween]]] tween) ?

19:14 Bronsa: dthurn: destructuring is not pattern matching

19:14 ,(let [[tween [_]] [15 [:tween]]] tween)

19:14 clojurebot: 15

19:15 seangrove: ,(let [[tween [:tween]] [15 [:tween]]] tween)

19:15 clojurebot: :tween

19:15 Bronsa: ,(let [[:a] [1]] a) ; :(

19:15 clojurebot: 1

19:15 Bronsa: this works by accident since 1.6

19:16 seangrove: Wow, didn't know that keywords would turn into bindings..

19:16 dthurn: you can use keywords instead of symbols in bindings?

19:16 seangrove: Ah, ok

19:16 dthurn: didn’t know that

19:16 Bronsa: seangrove: only in destructuring

19:16 dthurn: don't do that. it's an implementation detail

19:17 dthurn: That’s too bad, I like the idea of using constants in binding expressions

19:17 Bronsa: seangrove: if you're interested, this works as a side-effect of the patch for destructuring namespaced keywords

19:17 dthurn: But it makes sense, I guess

19:18 seangrove: Bronsa: Ah, interesting actually

19:59 sova: :D Clojure!

20:00 xnil: Finally, some Clojure.

20:01 Clojure for Windows [close your four windows]

20:08 Clojure Mind, Clojure Buddha

20:19 sova: could someone kindly point me to an open source project which uses clojureScript?

20:20 rads: ztellman: 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:20 ztellman: rads: so do I, a lot of the time

20:20 rads: one insight I liked was that data is more general than code because it has no predefined semantics

20:20 which makes the program more general

20:20 ztellman: in both the good and bad senses of the term

20:20 anyway, glad you liked it

20:21 rads: I'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:21 I find this concept of data-orientation hard to explain to people who only know OO

20:22 ztellman: I'd be interested in seeing that talk

20:22 rads: it seems like there's not much literature on this idea right now, but maybe that's because it's a relatively new concept?

20:23 ztellman: I'm sure there are multiple papers in the 70s that discuss it under a different name

20:23 rads: I 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:24 I haven't heard much about "data-first" programming in haskell

20:24 yeah, that's the tricky part :)

20:24 figuring out the different name

20:25 TEttinger: there's also this http://www.dataorienteddesign.com/dodmain/node3.html

20:25 data oriented design is a crazy concept

20:26 but rather different from the high-level approach to data in clojure

20:26 rads: cool, thanks for the link

20:27 another 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:28 TEttinger: more data than fns than macros sounds like a good approach

20:28 rads: I've heard it around the community before, but I don't know where it originally came from

20:30 TEttinger: it looks like "data-orientented design" and "data-driven design" are two separate things

20:31 TEttinger: rads, indeed!

20:31 $wiki data driven design

20:31 lazybot: [Data-driven programming - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Data-driven_programming

20:31 TEttinger: who fixed lazybot, Raynes, justin_smith, rhg135?

20:31 Raynes: ?

20:32 TEttinger: google didn't work for a while because the API died

20:32 $google google search api deprecated

20:32 lazybot: [Google Web Search API (Deprecated) — Google Developers] https://developers.google.com/web-search/

20:33 Raynes: Well, nobody fixed it.

20:33 rads: when 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:33 TEttinger: hm

20:34 For 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:34 rads: after 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:34 perhaps it's not the weakness of the programming orientation, but the specific choices the grunt authors made

20:34 tadni_: Is Luminus suggested for webdev?

20:35 sova: luminus is sweet, depending on the complexity of your app

20:35 TEttinger: I 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:36 tadni_: 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:36 TEttinger: I 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:37 tadni_: 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:37 TEttinger: make that https://duckduckgo.com/?q=panda+site:wikipedia.org

20:38 rads: tadni_: might want to look into something based on React.JS for a functional-approach to front-end development

20:38 TEttinger: Om ?

20:39 tadni_: rads: Thanks, I'll add it to my list of things to check. :^)

20:39 rads: om is one option, there's also reagent which is a more direct clojure wrapper for react.js

20:40 tadni_: 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:42 xnil: tadni_: clojurescript, m8

20:49 * tadni_ needs to look into this all a bit more, he's sure it doesn't help that he's been up for near 52 hours now.

20:49 tadni_: But yeah, of the selections I've seen -- Luminus seems decent.

20:54 Raynes: http://www.tryclj.com/ has a new design

20:54 Sure wish folks would contribute more cool stuff like this to tryclj ;)

20:54 It hasn't seen love in a while.

20:54 Sure would be neat if someone updated it for new Clojures and stuff ;)

21:03 xnil: Raynes: oh, that's nice.

21:03 kl: Hi, 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:03 xnil: kl: because instead of reinventing the wheel, we decided to use preexisting tools

21:04 kl: xnil: so the aim was to avoid creating a runtime, rather than Java interoperability?

21:04 xnil: it was both

21:05 i believe hickey's got an official explanation

21:05 let me find it

21:05 kl: xnil: that's pretty much my question: why would anybody want Clojure interop with a side-effectful & mutable language

21:05 oh ok, thanks

21:05 xnil: http://clojure.org/rationale

21:06 kl: ^^

21:07 so yeah, java interop is a huge incentive

21:08 if 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:08 kl: xnil: lol, no. I'm not a Java proponent :)

21:08 xnil: it was more "why infect clojure with java"

21:09 xnil: you 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:16 tadni_: Okay, probable nap time. o/

21:19 xnil: \o

21:24 kl: xnil: that, I didn't know.

21:25 (Clojure on CLR)

21:25 xnil: :)

21:25 kl: I'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:26 I'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:27 xnil: between scala and clojure, i've got to say clojure rubs me the right way. and i'm a massive fan of static typing

21:27 just wait until you try haskell

21:27 kl: https://github.com/clojure/core.typed

21:27 kl: It's possible to know Scala without already knowing Haskell? :)

21:28 (Scala seems a much more complicated, distorted, far removed version!)

21:28 xnil: barely

21:28 i'd say haskell is that to ocaml, and scala is that to ruby if i were the one concocting the rhetoric

21:29 kl: I'm not sure I felt any kind of relationship between Scala and Ruby

21:29 (And Ruby is my day-job)

21:29 xnil: well, i like neither

21:29 godd2: yea scala syntax reminds me more of ruby than most things

21:29 xnil: i'm more of a lispy person. python over ruby for me

21:30 kl: xnil: I just find when dealing with Python/Ruby... I have to rely much more upon grep than I'd like

21:30 I mean, there's only so much following you can do when everything's so dynamic

21:30 xnil: as a result of dynamic typing?

21:30 kl: Maybe that. I'm not sure.

21:30 xnil: ah

21:32 kl: xnil: is that a sentiment you could at all agree with, from experience?

21:33 I understand Clojure to be dynamic, too. But I'm not really sure what dynamic with lisp actually means.

21:33 xnil: clojure's dynamic typing is only a boon in my experience

21:33 well

21:33 scratch the only

21:34 there 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:35 kl: Would you say that Clojure's dynamic typing is more beneficial+less detrimental, say, than that existing in Ruby/Python?

21:35 xnil: yes, by far

21:35 kl: Or would you say it's pretty much of same consequence.

21:35 Oh

21:36 xnil: i feel python and ruby achieve almost a comparatively toyish feel to them because they try to be something lisp yet traditional

21:36 it's a very usable awkward middleground

21:36 kl: I'm pretty sure I'm going to feel more rounded as a developer with Clojure in my arsenal

21:36 xnil: absolutely

21:36 but then again, surely i'm biased

21:37 kl: I used to think (and sound, to many) that I was a real polyglot. I've done so many languages.

21:37 But none were in the functional sphere

21:37 C/C++, Perl, PHP, Python, JS, Ruby

21:37 xnil: to be honest, japanese is harder than mandarin chinese

21:37 kl: I'm sure I've done others for extended periods that I couldn't even recall

21:40 xnil: I wish my capacity for learning formally specified languages extended to the spoken ones

21:40 xnil: C, 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:41 game maker language, anyone?

21:41 kl: esperanto's formally specified :^)

21:41 kl: xnil: hmm. In retrospect, I'm not sure the formal specification is really the qualifying criterion for me :)

21:42 xnil: you can build things with esperanto, like artism

21:43 i've got a cheesecake of 1 foot in diameter

21:44 kl: I really like the idea of esperanto. If it had higher adoption, I'm quite sure I'd learn it

21:44 xnil: built it with La Mastro de L'Ringoj

21:44 kl: I try using English as a language which can be logically built upon, except that just doesn't work

21:44 xnil: all natural languages are that way, sorry :P

21:45 kl: How did every single naturally emerging language screw it up?!

21:45 It seems easier to just make a consistent one!

21:45 sova: until you see a tiger

21:45 xnil: it's the brain's fault

21:45 sova: or a leopard

21:45 i type better with leopards

21:45 sova: and have to shout "HOLY S*** A TIGER/LEOPARD"

21:46 sorry to rudely throw in my two cents, i enjoy language discussions

21:46 *lurks back to the shadows*

21:50 xnil: Did you mean "Holly, shoot a torque laser"?

21:50 anyone here from the greater Boston area?

22:18 sova: language discussions are fun. i say we implement a natural language with lisp

22:18 in fact, i think i have a conthept for it right now.

22:19 munderwo: this is probably a long shot, but has anybody used https://github.com/nodegit/promise from clojurescript?

22:57 kenrestivo: ugh, debugging locked-up async channels is no fun.

22:58 sdegutis: xnil_: I dunno, why s-expressions?

22:58 There doesn't seem anything inherently worthwhile in using s-expressions. It seems merely to be a matter of preference.

22:58 kenrestivo: how about t-expressions

22:59 maybe it's time to move off of s

22:59 sdegutis: Then we should have S++-expressions.

22:59 kenrestivo: msft can have s# expressions

22:59 sdegutis: kick picasso it's a spambot

22:59 arrdem: the core value of sexprs is homoiconicity for generated programs.

23:00 sdegutis: arrdem: I think it's been done without s-expressions though.

23:00 arrdem: sdegutis: eh you need some equivalent representation of a "form" tho.

23:00 sdegutis: True.

23:00 I suppose code<->data is a legitimate benefit.

23:01 I guess its value is what's really arguable.

23:01 arrdem: code <-!-> data, we have read-eval

23:01 :c

23:01 @ops picasso indeed is a spammer.

23:01 amalloy / oh shit where'd technomancy go

23:02 amalloy: arrdem: i tried to deal with that earlier but apparently don't know how

23:02 arrdem: amalloy: thanks

23:09 xnil_: sdegutis: wrong

23:09 sdegutis: s-expressions achieve a particular simplicity and minimalism that nothing else i've seen does

23:09 and expressiveness!

23:10 sdegutis: xnil_: sure, but expressiveness is subjective

23:10 xnil_: and the value of simplicity and minimalism is also subjective

23:10 xnil_: subjectivity is simply expressive

23:10 minimalism? i hardly knew 'er

23:10 sdegutis: xnil_: 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:11 xnil_: i've done the same and i have the opposite opinion

23:11 i respect yours though

23:11 i just think it's totally wrong

23:15 sdegutis: :)

23:15 I respect yours too.

23:15 And I don't think yours is wrong.

23:15 Because opinions can't be right or wrong ;)

23:16 (i.e. I don't hold it strongly enough to consider that mine is Right™.)

23:29 arrdem: Naming: a linked document / hypertext editor & stack based browser

23:41 xnil_: it is my opinion that righteousness is a matter of subjectivity

23:45 kl: xnil_: your opinion is also a matter of subjectivity. :P

23:46 (I completely agree ;)

23:53 arrdem: andyf: ping

Logging service provided by n01se.net