#clojure log - Jul 06 2014

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

0:01 ddellacosta_: Janiczek: try instead [purnam.test :refer [fact]]

0:02 Janiczek: or I suppose that error indicates you could use a list? I dunno, I usually use :refer rather than :only

0:08 Janiczek: ddellacosta_: thanks. it was actually cljsbuild not knowing what to with :use without :only a few rows above! :)

0:08 it's kind of annoying cljs doesn't know anything about :refer :all or use (all)

0:09 ddellacosta_: Janiczek: hmm, I'd call that a feature not a bug--dumping everything willy-nilly into your namespace is not a great idea generally speaking.

0:10 Janiczek: probably yeah - just the (ns) form now feels bloated

0:10 ddellacosta_: Janiczek: I'm pretty sure :use has been depricated exactly for that reason.

0:11 Janiczek: yeah, that's the tradeoff. I do have some files which start with an entire page of require statements. Not great I guess. :-(

0:11 Janiczek: but, on the flip side, easy to figure out what has been required and from where.

0:45 Fare: no, apparently I don't understand how dependencies work

3:03 Frozenlock: *cricket*

4:37 unsafeCoerce: Deraen

4:38 Derander*

4:38 what is your opinion on this whole persistentvector thing

5:44 m_m__: Hi. Is there a possibility to mare reduce on range ? I need to sum all numbers from 1 to 1000.

5:45 hyPiRion: mare reduce?

5:45 You can do ##(reduce + (range 1 (inc 1000)))

5:45 lazybot: ⇒ 500500

5:47 m_m__: hyPiRion: But why i cannot make something like that: (reduce + (range(1000)))?

5:47 hyPiRion: (range 1000) works fine

5:48 but it includes 0

5:48 (and not includes 1000)

5:49 m_m__: strange...I had an error but now everything is ok. Thank you.

5:58 _KryDos_: Hello. I’m trying to learn Clojure and I got the problem when I’m trying to compare two vectors. [0 0 0 0] and [0 0 0 0] - in repl it true but in the program it’s false :( Could you please help me. http://pastebin.com/BLVkPr6r - this is my function. Do you see «if». I’m trying to compare here are two vectors but I got the false. I’m sure that «opcode» contains [0 0 0 0]. Could you please explain me why this happening?

6:01 Also as you can see I’ve added two println functions to check the type of the «opcode» and «empty-opcde». There is same type.

6:04 m_m__: Is there anything wrong with: https://gist.github.com/anonymous/5d769d07b85d4305844d i have error that I cant canst LazySeq to Ifn.

6:07 spradnyesh: _KryDos_: i find them equal (true) in the program too

6:08 _KryDos_: can you tell me "how" you are invoking the function?

6:10 _KryDos_: spradnyesh: wow. it’s great. I’m invoking it as it works in lisp… via «(«. as first argument in list. Or you mean something another? Anyway here is line where I invoke this function - http://pastebin.com/cXuGJ7zG

6:10 spradnyesh: get-opcode function returns list with 4 elements

6:11 spradnyesh: oops. not list. vector I mean

6:11 spradnyesh: I’m using (into [] opcode) as return value of the get-opcode funciton

6:13 spradnyesh: _KryDos_: equality in clojure looks at values (inside collection) and not at the collection itself, so (= [1 2 3] '(1 2 3)) => true

6:13 _KryDos_: spradnyesh ahh. wow. thank you. I didn’t know that

6:13 spradnyesh: _KryDos_: what is output of "(get-opcode rom-data registers)"

6:14 ,(= [1 2 3] '(1 2 3))

6:14 clojurebot: true

6:14 _KryDos_: spradnyesh: it’s a vector with 4 elements

6:14 spradnyesh: I will paste the get-opcode funcion… one second...

6:15 spradnyesh: can you try doing "(println opcode empty-opcode)" just before your if and see the output? maybe they are different structures/values

6:15 _KryDos_: spradnyesh: here is - get-opcode.

6:15 spradnyesh: sure. I will try

6:15 spradnyesh: thank you.

6:16 spradnyesh: when i tried "(execute-opcode [0 0 0 0] 1)" it went "inside" the "then" part of if, and my repl exited (with all my unsaved state :( )

6:17 _KryDos_: spradnyesh: http://pastebin.com/BF8HnygW - here is the output of the (println opcode empty-opcode).

6:17 spradnyesh: seems like it equal.

6:18 spradnyesh: _KryDos_: yes, they are same values

6:18 _KryDos_: try replacing the System.exit w/ some println

6:18 how are you invoking the program? via repl? or from command line?

6:18 _KryDos_: spradnyesh: I know that get-opcode returned the lazy-seq and now I add the (into [] …) function for the get-opcode.

6:19 spradnyesh: if I replace the system.exit println doesn’t work. «else» block is working.

6:19 spradnyesh: it’s a magic for me :(

6:20 spradnyesh: «into» function works well with lazy-seq?

6:20 spradnyesh: _KryDos_: you mean "(println "Executing opcode => " opcode "...")" gets executed?

6:20 _KryDos_: spradnyesh: sure

6:20 spradnyesh: oops. It’s executed but it’s not a else block

6:20 spradnyesh: _KryDos_: ???

6:20 lazybot: spradnyesh: Yes, 100% for sure.

6:20 _KryDos_: spradnyesh: what you mean?)

6:21 spradnyesh: _KryDos_: i'm confused. you said "sure", then you said "oops...., not else block"

6:21 _KryDos_: spradnyesh: wait a second. I will show you…

6:21 spradnyesh: _KryDos_: did the "then" part get executed?

6:22 _KryDos_: how are you invoking the program? via repl? or from command line?

6:22 _KryDos_: spradnyesh: «then» part executed. «else» part doesn’t. «Executing opcode => …» it’s not in else block

6:22 spradnyesh: via command line. using «lein run»

6:22 spradnyesh: ahh, i understand

6:23 _KryDos_: your control is coming inside the "then" clause (as correctly expected). and then your command exits (because of the System.exit), and you thought that the "then" part wasn't getting executed

6:23 you see?

6:24 _KryDos_: oh… I confuse you again :( «then» part doesn’t work with [0 0 0 0] [0 0 0 0] but «else» part works. Please excuse me :(

6:25 oh my god. And again I confused you :( with [0 0 0 0] [0 0 0 0] if statement returns «true» but with «opcode» «empyt-opcode» it return false.

6:25 spradnyesh: wait, wait

6:25 _KryDos_: for me [0 0 0 0] [0 0 0 0] and opcode empty-opcode it’s a same

6:26 spradnyesh: _KryDos_: wait wait

6:26 _KryDos_: waiting :)

6:26 spradnyesh: _KryDos_: i read your code again; your "if" block does NOT contain the "else" part. it contains only the then part (try matching/counting parenthesis again)

6:27 _KryDos_: replace your if code w/ this:

6:27 (if (= empty-opcode opcode) (println "match") (println "does NOT match"))

6:27 and see what is output

6:27 _KryDos_: spradnyesh: yes. it’s true. But when I add the else block it get executed

6:27 spradnyesh: else required params?

6:27 required parameter*

6:28 spradnyesh: _KryDos_: how about

6:28 (if (= empty-opcode opcode)

6:28 (println opcode empty-opcode "match")

6:28 (println opcode empty-opcode "does NOT match"))

6:28 * rau raises an eyebrow at spradnyesh.

6:28 _KryDos_: spradnyesh: can I use only (if (= empty-opcode opcode) (println match))?

6:28 spradnyesh: _KryDos_: no, else is optional; but i'm not able to understand why the control is not going inside if

6:28 trying to debug

6:31 _KryDos_: spradnyesh: here is output with a little debug info - http://pastebin.com/tYCeBDfE

6:32 http://pastebin.com/YbFTD3fk - it’s a same but with better formating.

6:32 better format* excuse me

6:32 spradnyesh: _KryDos_: i'm sorry, i don't know what is going wrong here

6:33 _KryDos_: spradnyesh: me too :( thank you very much for you help and time :)

6:33 s/you/your/

6:43 visof: hello

6:44 zeebrah: i have a simple interpreter that is written as a tail recursive loop. i'm working on a swing gui debugger for it mainly to be able to step through the interpreter one instruction at a time. not sure what clojure/java primitive is appropriate for mediating between the user clicking next and evaluating the next instruction

6:44 visof: http://pastebin.com/fhaxEZcA i got this error msg when using orientdb client

6:44 how can i fox this?

6:44 fix*

6:45 _KryDos_: visof: are you sure about address?

6:47 visof: _KryDos_: tcp6 0 0 :::2424 :::* LISTEN 16751/java only tcp6

6:48 _KryDos_: how can enable tcp v4 ?

6:49 _KryDos_: visof: I don’t know. How about 2480 port for tcp v4?

6:49 visof: _KryDos_: also tcp6 0 0 :::2480

7:41 m_m__: After 4 years in Java i thought that there is nothing better and faster in development there python. After 3 years in Python i have found something faster...thank you clojure!

8:32 igorw: hello, I ran into an edge case with core.logic's disequality that seems contradictory to me

8:32 https://gist.github.com/igorw/06cffdef743fbe97e477

8:33 it there any explanation for this? or is it a bug?

10:49 wink: igorw: unrelated to that problem: too bad I don't have much time right now, but really cool stuff you did lately

11:54 Shayanjm: Is it bad to use eval in macros?

11:54 I know in most other languages, using eval is one of the deadly sins.

11:56 TimMc: Shayanjm: It usually means you are doing something wrong, yes.

11:57 Shayanjm: I'm trying to build a macro that takes an atom as an arg, and runs another function based on the name of that atom

11:58 i.e: (update-all atom) => (do (update-atom-api atom) (update-sentiments atom))

11:58 so if 'atom' was actually 'atomname', it would be 'update-atomname-api atomname'

11:59 TimMc: The main problem with that is code readability.

12:00 Any time you are building a var name from pieces (either to define or reference it) you're asking to have the most impressive curses attached to your name a year down the road.

12:00 Shayanjm: TimMc: Yeah the reason I'm doing it this way is because I'm interfacing with a number of APIs that return data in different formats

12:00 so having a 'general' (update-api) function is out

12:01 so I'm using the convention of <atomname> and update-<atomname>-api

12:01 to differentiate between the various services

12:01 https://www.refheap.com/724ab95f30e6750c4f47737d0

12:02 TimMc: To me, having non-greppable var names is worse than using eval in a macro. :-)

12:03 Shayanjm: TimMc: Internally in the macro? should I be using different names for the vars?

12:03 ddellacosta_: Shayanjm: can't you just return a list, and call resolve on the symbol?

12:03 radix: Does that really need eval anyway?

12:04 Shayanjm: I have 0 idea. Very very new to clojure. Very likely i'm doing this incorrectly

12:04 ddellacosta_: Shayanjm: doesn't need the do either as far as I can tell

12:04 Shayanjm: ddellacosta_: I added the do because I needed to add another function inside the block

12:04 Fare: I must do something obviously wrong with my project.clj, but I have no clue what

12:04 ddellacosta_: Shayanjm: ah okay

12:04 Shayanjm: but I'm with radix, I don't see why you need eval here

12:04 bbloom: Shayanjm: you definitely do not need to call eval in there

12:04 Fare: so I have project A, called leijure/delta-position — I do lein install, it creates a .jar, so far so good

12:04 bbloom: Shayanjm: but let's rewind a bit

12:05 ddellacosta_: Shayanjm: I think you just need resolve

12:05 Shayanjm: sure

12:05 bbloom: Shayanjm: the real source of your problem is that you have so many atoms that you feel a syntax need to deal with them all

12:05 Shayanjm: yep :\

12:05 bbloom: Shayanjm: most likely what you really want is just a single atom with a map in it

12:05 Fare: then in project B, I have a project.clj that has [leijure/delta-position "0.1.0-SNAPSHOT"] in my :dependencies, and a symlink to the delta-position directory in checkouts/

12:05 bbloom: then all you need is (swap! some-atom update-in [:some-key] some-fn and some args)

12:06 Shayanjm: bbloom: sure, that would probably make more sense. Out of curiousity, why that approach vs. multiple refs?

12:06 Fare: but it says Exception in thread "main" java.io.FileNotFoundException: Could not locate leijure/delta_position__init.class or leijure/delta_position.clj on classpath: , compiling:(lexer.clj:1:1)

12:06 bbloom: Shayanjm: are you doing any actual concurrency?

12:07 Shayanjm: bbloom: Yeah. There will need to be certain guarantees that information is 'up to date'

12:07 arguably I could just do it in a single atom, but that would be a HUGE swap!

12:07 ultimately this project will be interfacing with some 30 or so different APIs

12:07 and scraping data from all of the websites for analysis

12:08 so the two most fragile parts of it are: handling the data from the different APIs in a unified manner, and dealing with scraping

12:08 ddellacosta_: Shayanjm: I don't fully get what you're doing, but if you are only updating bits and pieces at a time it's not a big deal to keep it all in one atom regardless

12:08 Shayanjm: the whole scope of the project is a newsreader + intelligence

12:08 bbloom: Shayanjm: refs are only really useful when you have a bunch of different threads operating on subsets of the total dataset where there's small, but non-zero overlap between each thread's working set

12:08 Shayanjm: ah I see

12:09 bbloom: Shayanjm: if each thread is operating totally independently, you can have one atom per thread, or one global atom, or one extra thread doing aggregation off queues from the worker threads

12:09 don't try to optimize, try to get it working first

12:09 Shayanjm: Sure that's fair. If I wanted to go down the single atom avenue

12:09 my question is: how would I handle the various API interfaces?

12:09 bbloom: it's easier to go from 1 global atom to some more complex arrangement, than it will be to go from some complex arrangement to a different complex arrangement that actually solves your problem

12:10 i have no idea what you mean

12:10 Shayanjm: i.e: API1 returns data in a {:result {:data data :url url :thing thing}} format

12:10 API2 might return data in a {:webURL url :webThing thing...} etc. format

12:10 ultimately they're providing the same/similar data

12:11 but I would have to know precisely how to identify the various pieces of data

12:11 and I'd have to do that separately for all the different APIs

12:11 bbloom: how does that have anything to do with atoms?

12:11 (defn api1 [& args] (your-transform-fn (some-common-code-path ...)))

12:12 Shayanjm: So the swap shouldn't actually happen inside api1?

12:12 I transform all of the data from all of the APIs into a usable format, and then swap! after?

12:12 bbloom: you haven't explained at all what you're trying to do to any degree in which anybody can provide actual advice to you

12:13 Shayanjm: Okay let me be clearer

12:13 bbloom: Shayanjm: that's exactly what i told you days ago, isn't it? avoid swap!s, prefer pure functions

12:13 Shayanjm: bbloom: sure, which is what I did for the single API access for New York Times.

12:13 That gets slightly more complex when you're coordinating >5 API accesses and scraping for all URLs

12:13 anyway

12:14 bbloom: i'm not sure where that complexity suddenly creates need for state in your data-transforming functions

12:14 Fare: how do I debug a project.clj and/or jar installation?

12:14 Shayanjm: https://github.com/shayanjm/Sentimental/tree/develop

12:14 That's the repo. the project as it stands right now just receives a set of titles, urls, and abstracts from the new york times newswire API

12:15 it grabs the URL of each article separately, scrapes the article-content, and then passes it to a sentiment analyzer function

12:15 which returns a collection of 'sentiments' (integer from 0-4) for each sentence in the article

12:15 a mean of each collection is then calculated and stored in the same atom. This is all displayed on a webpage of sorts

12:17 The next steps for the project are to integrate with more news outlet sources (the guardian, AP, etc.)

12:17 and scope out of just sentiment analysis

12:17 start grouping news articles by event/content, and provide more useful insights

12:17 so ultimately, this will become a newsreader application that has some additional 'intelligence' tools

12:18 bbloom: so why does adding more apis make this harder? you have some in memory database in an atom, you do some transform, then you merge that data in to the atom

12:18 write pure functions from scraped content -> sentiment results

12:18 then write a pure function of database of results + new result -> new database of results

12:18 Shayanjm: Sure. I guess my mental block is figuring out what a pure function is in terms of API access

12:19 bbloom: content -> result

12:19 Shayanjm: should I figure out some way to write one 'fuzzy' API transform tool?

12:19 and make it as general as humanly possible?

12:19 bbloom: no

12:19 the exact opposite of that

12:19 Shayanjm: or write a bunch of separate transform tools for each API i'm integrating?

12:19 bbloom: you're thinking too hard and trying to do too many parts at once

12:19 forget the web server for a moment

12:19 forget the atom for a moment

12:19 i-blis: Fare: jars should be in your .m2 after `lein install`

12:19 Shayanjm: sure.

12:19 bbloom: scrape the page once, save the results in a file

12:20 in your repl, slurp in that file, test a function on it that does the analysis

12:20 once you have the analysis working, write down the format in a text file

12:20 make a note of it for yourself

12:20 then go do the same thing again for a 2nd api

12:20 rau: bbloom: Please stop abusing your return key, you daft loser.

12:21 bbloom: Shayanjm: then figure out how to glue those things to your web service & the scraper later

12:22 Shayanjm: hmmk

12:23 Fare: what's .m2 ? how am I supposed to put it there? I thought (from the lein tutorial) that it was enough to symlink my dependency in checkouts/

12:23 bbloom: apparently rau is a bot that just tells people to stop pressing return....

12:24 Shayanjm: classic

12:24 thanks for the help bbloom

12:24 I'll think about this a little more and probably come back here with the solution

12:24 i-blis: Fare: the jar should land automatically in $HOME/.m2 (your local Maven repository cache) after `lein install`

12:25 Shayanjm: bbloom: last question, is it a bad thing to assume a certain structure for an atom?

12:25 bbloom: Shayanjm: what do you mean "assume a certain structure"?

12:25 Shayanjm: I'm like, not sure where to draw the line between 'too general' and 'pure' functions

12:25 bbloom: Shayanjm: your data will have some structure, your functions will operate on that structure

12:25 welcome to programming

12:25 not sure what you expected :-)

12:26 Shayanjm: bbloom: Just needed a definitive answer one way or another.

12:26 TimMc: I'm not sure it's a meaningful question.

12:26 Fare: I see a ~/.m2/repository/leijure/delta-position

12:27 TimMc: Is there a different way you could ask it?

12:28 i-blis: Fare: once you did `lein install`, you need only add a line to the :dependencies of the other project

12:29 dbasch: Shayanjm: you decide what structure you want your atom to have, e.g. a map of maps

12:29 Fare: I added it, but it says: Could not locate leijure/delta_position__init.class or leijure/delta_position.clj on classpath:

12:29 i-blis: Fare: you see it, meaning it is locally installed ; now, treat it as any dependency :)

12:29 Fare: my dependencies include [leijure/delta-position "0.1.0-SNAPSHOT"]

12:30 but I still get Could not locate leijure/delta_position__init.class or leijure/delta_position.clj on classpath:

12:30 Shayanjm: Yeah okay basically I guess my question was: "Should I be building functions that can work on ANYTHING (or most things), or should I be designing stuff directly in the code as you do in other languages"

12:30 OscarZ_: Shayanjm: can you have transform functions from those custom APIs to a common structure and then have a single analysis function that understands the common structure?

12:30 Shayanjm: OscarZ_: Yeah its looking like that's what I'm going to be doing

12:31 i-blis: Fare: do you have a directory named 0.1.0-SNAPSHOP inside ~/.m2/repository/leijure/delta-position?

12:31 Shayanjm: I'll just integrate one API at a time then

12:32 OscarZ_: in Java you'd probably have some interface for those parsers that understand the custom format and then different implementations for each of them.. I guess protocols could be used for that type of thing in Clojure?

12:32 i-blis: Fare: remove whatever symlink you add in checkouts btw

12:33 bbloom: Shayanjm: https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)

12:34 Shayanjm: you will not be equipped to write general code until you've written the specific code three times

12:34 Shayanjm: do the three APIs by hand, then maybe you'll see some commonalities you can abstract

12:34 clojurebot: I don't understand.

12:34 Shayanjm: ah I see

12:34 that does help quite a bit actually

12:34 thanks bbloom

12:34 bbloom: Shayanjm: you'll get to a better result more quickly than if you try to predict the outcome up front

12:34 OscarZ_: I'm a clojure newbie myself.. how is that type of thing generally done in Clojure.. is protocols somehow better or would you just have a function that takes a parser function etc..

12:35 Fare: same after removing the symlink in checkouts/

12:36 i-blis: Fare: what subdirs do you have in ~/.m2/repository/leijure/delta-position?

12:37 Shayanjm: bbloom: much appreciated. That helped me with my mental block on a proper clj fn development cycle hahaha

12:38 i-blis: Fare: and what message do you get when you `lein deps` in project B?

12:44 OscarZ_: Shayanjm: not sure if this is what you ment but maybe this answers your questions about those general/specific functions: http://stackoverflow.com/questions/6016271/why-is-it-better-to-have-100-functions-operate-on-one-data-structure-than-10-fun

12:44 TimMc: bbloom: Solid advice. And I think that's why I err on the side of explicitness and redundancy at first.

12:44 bbloom: OscarZ_: i don't think that helps Shayanjm

12:46 OscarZ_: he's not struggling with the design of a pool of components, he's struggling with complecting data transformation with stateful result aggregation with effectful network calls. he just needs to get some practice decomposing systems in to simpler parts before trying to glue them together

12:48 OscarZ_: yeah maybe i didnt understand what the problem is

12:49 bbloom: OscarZ_: his struggle to explain his problem was a hint to the problem that i just described :-)

12:52 Fare: i-blis, lein deps doesn't print anything (!)

12:53 OscarZ_: if you want to scrape stuff in parallel and then aggregate those results into the same result (atom?), whats a good way to do this sort of thing in Clojure? can you use core.async for that? I listened to some podcast about it

12:54 bbloom: OscarZ_: core.async would be one reasonable route

12:54 Fare: i-blis, ~/.m2/repository/leijure/delta-position/0.1.0-SNAPSHOT/

12:58 dbasch: Fare: try lein deps :tree

13:00 OscarZ_: hmm.. maybe ill try to make a small program like that to get an idea of core.async.. it seemed interesting, didnt understand much except that its supposed to feel like you're doing sync calls and the library does some magic with threads under the hood

13:00 Fare: dbasch: thanks, it prints all my transitive dependencies, including [leijure/delta-position "0.1.0-SNAPSHOT"]

13:01 is the issue one of :aot or some such?

13:02 (inc dbasch)

13:02 lazybot: ⇒ 8

13:02 Fare: (inc i-blis )

13:02 lazybot: ⇒ 1

13:07 koreth__: OscarZ_: If core.async doesn't seem like a good fit, also look into futures -- they are a bit less magical than core.async which may be a good thing or not depending on what you're after.

13:09 OscarZ_: koreth__: i was just thinking of learning a bit of core.async and whats it about with some small test app.. but maybe I should learn futures first before jumping into that stuff :)

13:10 i-blis: Fare: do you still get the error on missing classpath?

13:10 Fare: yes

13:11 i-blis: Fare: could you pastebin your project.clj?

13:11 dbasch: Fare: are the missing files inside the jar file?

13:11 Fare: the jar file ~/.m2/repository/leijure/delta-position/0.1.0-SNAPSHOT/delta-position-0.1.0-SNAPSHOT.jar does have leijure/delta-position.clj

13:11 oh, underscore vs dash!

13:12 i-blis: Fare: :)

13:12 Fare: so should I rename the directory delta_position ? or just rename everything deltaposition ?

13:14 bbloom: Fare: just _ in the directory should do it, - is fine in namespaces

13:14 Fare: what is the standard practice?

13:15 do people shun dashes in names because of this limitation?

13:15 bbloom: Fare: i don't think so

13:15 i've been bitten by it myself tho

13:15 ,munge

13:15 clojurebot: #<core$munge clojure.core$munge@1c00791>

13:15 bbloom: ,(munge 'some-name)

13:15 clojurebot: some_name

13:15 bbloom: ,(munge 'some+name)

13:15 clojurebot: some_PLUS_name

13:16 bbloom: i think that function is also used for directoyr names

13:16 TimMc: &(namespace-munge "a.b-c_d/e")

13:16 lazybot: ⇒ "a.b_c_d/e"

13:16 bbloom: or that one, *shrug*

13:17 TimMc: a.b-c turns into a/b_c.clj -- I don't think there are any other transformations.

13:17 (Fun fact: The JVM accepts arbitrary unicode in class and package names!)

13:19 bbloom: lol, and clojure just decided to munge away, fun :-P

13:39 PigDude: how do you test core.async code? the test runner exits before my (go) blocks run

13:39 bbloom: PigDude: use <!!

13:40 PigDude: bbloom: it is not available in clojurescript

13:40 bbloom: PigDude: oh, then you need to do the same bullshit that other js test frameworks do

13:40 PigDude: for example: http://api.qunitjs.com/expect/

13:40 PigDude: i'm not sure about bullshit, but i would prefer to write a single test and not one for cljs and one for clj

13:41 there is no way to defer end of test run until some signal is given (from within a go block)?

13:41 bbloom: PigDude: asynchronous testing is hard. you can do all your testing asynchronously and write a small wrapper driver once per platform to reuse the tests in clj and cljs

13:41 PigDude: what is this qunit example?

13:41 bbloom: PigDude: read what it says

13:41 their test runner has a timeout and waits that amount of time before reporting failure

13:42 PigDude: this offers another way to make my tests fail?

13:42 bbloom: tests in this style assert how many async assertions that they will create

13:42 PigDude: ick that's not a good approach, what if the test takes longer than that?

13:42 i see that

13:42 bbloom: *shrug*

13:43 PigDude: so the answer appears to be to use cljs.core.async.test-helpers

13:43 whodidthis: https://github.com/cemerick/clojurescript.test

13:43 PigDude: thanks bbloom for looking though

13:43 obscure stuff

13:45 lxsameer: Hey guys, is scala better than clojure in performance manner ?

13:45 bbloom: lxsameer: difference is far less than negligible for optimized code

13:46 lxsameer: both are capable of getting effectively java-level performance from the jvm. both produce reasonably efficient naive code. don't believe anybody who tells you otherwise

13:47 lxsameer: bbloom: I never used any jvm based languages, except of jruby and jython which is different ofcourse, but can you please explain your reasons a little more

13:48 bbloom: lxsameer: both are statically compiled to jvm byte code without wrapper objects or other dynamic goo like jruby or jython

13:48 PigDude: core.async has separate cljs and clojure tests, using <!! and >!! for the clojure tests and the async hlpers for the cljs tests

13:49 i hope not too many other people have to write clj/cljs stuff, it is a bear :)

13:49 to target both thoroughly for something complex

13:49 lxsameer: bbloom: which one do you suggest me to learn (for fun) , I have strong background in python/ruby, and some experiences in elisp .

13:50 bbloom: lxsameer: you're asking a biased audience, this being #clojure and all

13:50 lxsameer: if you want to learn about type systems, skip scala and learn haskell, or preferably, an ML-variant

13:50 lxsameer: otherwise, learn clojure

13:50 lxsameer: have fun :-P

13:51 OscarZ_: lxsameer: maybe a lisp would be a bit different as scala, ruby and python are all OO languages

13:52 lxsameer: bbloom: thasnk

13:52 OscarZ_: I also experienced in C/C++

14:06 hotcore: ,(+ 1 1)

14:06 clojurebot: 2

14:06 hotcore: &(+ 1 1)

14:06 lazybot: ⇒ 2

14:13 Fare: when releasing to I replace -SNAPSHOT by -FINAL, or do I just remove -SNAPSHOT ?

14:14 bbloom: Fare: just remove the -SNAPSHOT

14:15 alloyed: Fare: an example: https://github.com/technomancy/leiningen/blob/stable/project.clj

14:17 Fare: bbloom, alloyed, thanks!

14:20 * Fare backtracks from writing his python parser by writing an instaparser for the grammar in which the python spec describes its ast.

14:45 eraserhd: Yay, some hack time for Avi.

15:08 lxsameer: what resource do you recommend for learning clojure ?

15:09 magopian: lxsameer: I'm starting with "Programming clojure" ;)

15:09 it's been fun so far (I've gone through a lot of 4clojure.org exercices also, really fnu)

15:09 fun

15:14 arrdem: Fare: throwing grammars at instaparse is fun :D

15:14 Fare: I'm a bit disappointed at the error messages provided by lein

15:15 it could have told me about this - vs _ mismatch

15:17 arrdem: Fare: http://dev.clojure.org/jira/browse/CLJ-1297

15:22 technomancy: Fare: unfortunately that's out of the jurisdiction of lein

15:23 but it is really disappointing how little effort the clojure compiler makes towards usability =\

15:24 wink: lxsameer: you can skim through https://pinboard.in/u:winks/t:clojure - maybe something interests you

15:24 technomancy: Fare: btw the whole "bump the version number, commit, and deploy to clojars" steps for libraries is automated in the new `lein release` task in 2.4

15:28 Fare: arrdem, that would have saved me much trouble

15:43 arrdem: technomancy: so I don't need my (slurp "VERSION") and bump.sh anymore?

15:45 huh. it looks like I don't..

15:47 gfredericks: technomancy: I have soured on this test-helpers-in-separate-directory approach and am scrutinizing the leiningen.test code for an escape hatch

15:47 in particular I'm wondering if blacklisting a namespace via test-selectors ought to prevent its being reloaded?

15:48 I suspect that should be true but the current code doesn't do it, so just wondering if I'm wrong or the code is buggy

15:48 (i.e., test-selectors applied to namespace metadata)

15:49 technomancy: arrdem: ideally not... try it and see =)

15:50 gfredericks: the test selectors stuff kinda got rewritten since I last looked at it

15:50 it used to be solely about vars

15:50 but I vaguely recall that what you want might have been added

15:50 gfredericks: okay maybe I'll spelunk through blames & commit msgs

15:51 technomancy: spoiler: it was Raynes

15:51 gfredericks: `technomancy blame test-selectors ;; => Raynes`

15:51 technomancy: thanks for the tips

15:52 * arrdem considers writing a ~/bin/technomancy

15:52 gfredericks: arrdem: it could tweet its args @technomancy

15:52 arrdem: gfredericks: I was considering using exponential backoff with a cap and retrying across IRC and twitter...

15:56 technomancy: clojurebot: technomancy is eventually consistent.

15:56 clojurebot: Ok.

15:57 arrdem: ,1

15:57 clojurebot: eval service is offline

15:57 gfredericks: the `git blame` for the relevant section of code is striped with nothing but me phil and raynes

15:59 technomancy: careful what you wish for

16:06 gfredericks: huh.

16:09 this is a strange feature.

16:11 well this suffices to solve my problem but it is strange and I have a hard time imagining it was explicitly designed to work like this.

16:14 technomancy: it's basically retrofitting a feature that was designed to work with vars to simultaneously also apply to namespaces

16:14 gfredericks: it doesn't really work with metadata though

16:14 technomancy: I've never tried it on namespaces

16:14 gfredericks: afaict the only straightforward use is selecting based on the name of the namespace

16:14 technomancy: oh, also it is a monkeypatch, because jira

16:14 gfredericks: I twerked it to work with metadata by using require and (comp meta the-ns)

16:15 what?

16:15 clojurebot: what is cells

16:15 gfredericks: clojurebot: cells?

16:15 clojurebot: cells is http://gist.github.com/306174

16:15 technomancy: cells is pods!

16:16 gfredericks: clojurebot: pods?

16:16 clojurebot: No entiendo

16:17 gfredericks: I think I've sufficiently imagined what the monkeypatch comment means

16:17 technomancy: gfredericks: because how else are you going to change clojure.test?

16:18 gfredericks: yeah I didn't follow that at first because the stuff I'm looking at isn't directly related

16:18 * gfredericks digs into bultitude

16:20 gfredericks: okay okay okay okay so I think this could be embettered without much haxery

16:21 ideally the namespace selectors should have access to the metadata on the ns sym without having to load the namespace

16:21 and when bultitude returns its list of namespace symbols they do indeed have metadata on them

16:21 the problem is it doesn't get printed on the eval-in-project form for lein test

16:23 technomancy: aha

16:23 gfredericks: doing print-meta on everything would be a bit excessive?

16:23 noncom: how do i push a java jar to clojars with leiningen ?

16:23 it is a 100% java jar, no project.clj

16:24 gfredericks: you can make your own pom.xml and upload that with the jar

16:24 technomancy: noncom: lein doesn't care what source is in the jar

16:25 noncom: but instructions say "first do pom" and it doesnt pom w/o project.clj

16:25 luxbock: is there a way to tell Emacs/cider to use a certain profile from my project.clj when launching the repl?

16:27 eraserhd: subseq is not a generic version of subvec. <-- just discovered.

16:28 arrdem: is there a groupthink best practice with respect to defining an interface vs defining a bunch of functions over a custom type?

16:28 noncom: so here is my result: https://www.refheap.com/87917

16:28 an NPE

16:31 so why do i get an npe ?

16:35 technomancy: noncom: so you're using lein to deploy something that's not a lein project?

16:35 you need to tell it what the files are, it can't just figure it out

16:39 noncom: technomancy: yes, thats true, i am deploying a 100% java jar, no project.clj

16:39 amalloy: technomancy: feature request: imbue leiningen with psychic powers

16:39 noncom: you mean i must create a clojure project with java source files to do that ?

16:39 arrdem: amalloy: jvm doesn't support psy until 1.8

16:40 technomancy: noncom: 100% java doesn't imply no project.clj =)

16:40 noncom: no, I mean you need to tell lein what files to use when deploying

16:40 `lein help deploy`

16:42 dbasch: technomancy: amalloy how about Super Cow Powers?

16:42 amalloy: dbasch: no need; just install a debian VM

16:42 dbasch: amalloy: but it could be done more easily with a plugin

16:43 noncom: so i did lein deploy clojars minim-2.2.0.jar pom.xml

16:43 it says java.lang.IllegalArgumentException: Must provide valid :files to deploy-artifacts

16:44 technomancy: noncom: read the docstring again =)

16:45 you just tried to deploy version "pom.xml" of the "mimim-2.2.3.jar" artifact

16:45 noncom: yes

16:45 names must match ?

16:46 oh i got it

16:46 ok

16:46 wrong args

16:49 arrdem: ugh... so how do I define <, > and = on numbers with tolerances..

16:49 technomancy: interval arithmetic?

16:49 maybe just use frinj?

16:50 * arrdem is not a frinj fan

16:50 noncom: so it workred at the end, thank you

16:50 gfredericks: arrdem: what's a tolerance?

16:50 arrdem: gfredericks: 1±3

16:51 gfredericks: this weird things engineers do because they don't live in integral words

16:51 technomancy: arrdem: haven't tried it myself, but it sounds like what you want is to just reinvent it?

16:52 oh, but if you only want a limited set of operators it's probably a lot simpler

16:52 gfredericks: arrdem: I have a library to help with the algebra tedium :)

16:52 bbloom: i still haven't found a generic operations mechanism that i truly like :-/

16:52 arrdem: gfredericks: do share... so do I. I'm cleaning mine up atm :P

16:53 gfredericks: arrdem: https://github.com/gfredericks/lib-4395

16:53 arrdem: gfredericks: that name :P

16:54 gfredericks: yes it's quite googleable isn't it

16:54 arrdem: very googleable, not very memorable

16:55 gfredericks: say that again after you've used it on ten projects

16:55 arrdem: don't worry my new naming method is the first people-name I encounter on wikipedia's "random article"

16:57 technomancy: gfredericks: does this kind of article count? https://en.wikipedia.org/wiki/List_of_awards_and_nominations_received_by_Brandy_Norwood

16:57 * arrdem scripts a hostile takeover of com.gfredericks.*

16:58 gfredericks: technomancy: I wasn't thinking so but I'm open to arguments

16:59 technomancy: List of R&B artists named after alcoholic beverages

17:00 arrdem: y u no just uuid libraries...

17:07 technomancy: thanks for mentioning interval arithmetic. It looks like what I'm doing is implementing a domain specific and equally complex subset of it.

17:12 technomancy: cool

17:14 bbloom: arrdem: is it a subset? or just similar/related ?

17:14 i saw something long ago about estimating floating point error

17:14 arrdem: bbloom: I'm revamping https://github.com/arrdem/imprecise atop algo.generic

17:15 bbloom: where they did symbolic execution with (value, error) fixed point pairs

17:15 arrdem: bbloom: it was originally a tool I built to do physics problems for me :P

17:15 bbloom: yeah that's what this was for essentially.

17:16 bbloom: there's probably a complete algebra defined for error analysis

17:18 arrdem: probably

17:23 noncom: anyone used clojurewerkz quartz ?

17:51 joegallo: ~anyone

17:51 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

17:51 gfredericks: technomancy: should I commit a disabling of this failing test so travis starts being helpful again?

17:52 the assumption being I don't have time right this moment to figure out why it's failing

17:59 koreth__: Is it considered bad form to wrap a computationally expensive lazy-sequence function in memoize, assuming you're willing to pay the memory cost of keeping the realized elements around forever?

18:06 technomancy: gfredericks: which test is it; I haven't taken a look?

18:07 gfredericks: technomancy: the regression test for the mirror bug

18:07 passes logally, fails on travis

18:07 travis has been red for a week or two or something

18:14 sandbags: It's been a long time since I did anything with Java, I'm trying my hand at a little interop and failing with - what seems like - an obvious class being missing, anyone see where I went wrong? https://gist.github.com/mmower/301059faaead726285b5

18:15 i'm wondering if i got the import wrong somehow?

18:18 you have to be invited to #java ??

18:18 lazybot: sandbags: Definitely not.

18:19 sandbags: that's a bit inscrutable

18:22 nathan7: sandbags: are you sure it doesn't just require registered nicks?

18:22 arrdem: Okay. why on earth am I getting an error that `min` isn't defined in any of the interface... https://www.refheap.com/87920

18:22 *interfaces

18:22 sandbags: nathan7: i got a +i required for #java, ##java is complaining i'm not registered although i could have sworn i am

18:23 nathan7: sandbags: are you *logged in*

18:23 sandbags: ah, looks like my copy of LimeChat has a faulty password

18:23 nathan7: sandbags: otherwise being registered does little good

18:23 sandbags: odd, i should have thought it would have booted me from the nick by now

18:26 Bronsa: arrdem: definterface methods don't take "this"

18:29 nbeloglazov: sandbags: FileInputSteam -> FileInputStream

18:29 sandbags: okay so java.io.FileInputStream still seems to be a thing... i'm confused about why i'd get a class not found... do you have to somehow include the JDK as a dependency to use Java classes? I kind of assumed they were there given strings are java.lang.String etc...

18:29 arrdem: Bronsa: cheers

18:29 sandbags: nbeloglazov: really? fuck... thanks man

18:29 jeez

18:29 and i looked at it to see if i mistyped it too!

18:33 dbasch: sandbags: everything in java.lang is already imported

18:33 sandbags: oh, you'd typed Steam :)

18:41 sandbags: dbasch: sadly ;-)

18:43 unfortunately now i am getting the same error but for one of the Mime4J classes and this one i am sure i have spelled right

18:46 or maybe i am butting up against a dependency issue

18:47 according to the Apache James site the latest version is actually 0.7.2 but that doesn't seem to be available from maven.org

18:48 i assume there must be some other repo i'm supposed to configure somewhere, somehow

18:59 anyone take a look at https://gist.github.com/mmower/82d693a87c3ef4699e58 for me?

18:59 it seems like this should be working

18:59 according to my search of maven.org

19:10 nbeloglazov: sandbags: try apache-mimej-core: http://mvnrepository.com/artifact/org.apache.james/apache-mime4j-core/0.7.2

19:11 sandbags: a ha

19:11 thanks nbeloglazov that seems to have done the trick

19:11 can you tell me what i was missing there?

19:13 nbeloglazov: Looks like apache-mimej is not a library, but rather assembly of different maven projects and you can't use it in project.clj. That why you have to use apache-mime4j-core, which is a library.

19:14 If you compare http://mvnrepository.com/artifact/org.apache.james/apache-mime4j/0.7.2 and http://mvnrepository.com/artifact/org.apache.james/apache-mime4j-core/0.7.2

19:14 You'll see that the latter has "Download JAR" button and a size of the library.

19:15 sandbags: ah, so my misunderstanding was to think if it was searchable here that it is ~ a library

19:15 thanks nbeloglazov

19:16 nbeloglazov: I agree, that it is confusing. I think I saw some apache projects with similar structure before so it helped.

19:17 sandbags: you're welcome :)

19:19 sandbags: okay, seems i am now able to parse at least some stuff from a GMail export file, neat!

20:42 arrdem: technomancy: `lein release :patch` didn't just work when I tried it, I'll play with it some tomorrow.

20:48 gfredericks: arrdem: is it supposed to replace the lein-release plugin?

20:49 arrdem: gfredericks: AFAIK

20:58 gfredericks: now I need a project that needs changing I can try it on

21:58 sritchie: anyone using om here?

21:58 amalloy_: and for my real question… :)

21:58 curious about patterns for writing reusable components that need config options

21:58 react’s props are good for this

21:59 just checking if there are any different om conventions that have popped up

22:00 ah, om-sync gives a nice example: https://github.com/swannodette/om-sync/blob/master/src/om_sync/core.cljs

22:49 technomancy: arrdem: definitely interested in a bug report for that

23:21 Frozenlock: Noooo.... uberjarpocalypse!

23:21 'Lein run' works flawlessly, but 'lein uberjar' gives me this error: Exception in thread "main" java.io.FileNotFoundException: Could not locate...

23:21 Any idea what might be causing this?

23:22 I already did 'lein clean' multiple times, along with manually deleting the 'missing' library to force lein to redownload it.

23:28 Oh.. nevermind..

23:28 I added my dependency in my :dev profile.

23:28 (dec Frozenlock)

23:28 lazybot: You can't adjust your own karma.

23:55 robink: I finally managed to coerce an nginx-clojure LazyRequestMap to an ASeq w/ the .seq public method. How can I turn the resultant ([:uri "/baseurl"] [:body nil] [:headers {"user-agent" "Mozilla/5.0"}] [:server-port 80] ...) into a nice PersistentArrayMap?

23:56 It's gotta be doable, since LazyRequestMap apparently implements IPersistentMap, and Ring obviously is able to turn nginx-clojure's weird map object into something it can work with since I can do routing and responses with Compojure.

23:56 Is there a way to immediately coerce something that implements IPersistentMap into a PersistentArrayMap (or something analogous) without having to first make it a seq?

Logging service provided by n01se.net