#clojure logs

2014-07-06

00:01ddellacosta_Janiczek: try instead [purnam.test :refer [fact]]
00:02ddellacosta_Janiczek: or I suppose that error indicates you could use a list? I dunno, I usually use :refer rather than :only
00:08Janiczekddellacosta_: thanks. it was actually cljsbuild not knowing what to with :use without :only a few rows above! :)
00:08Janiczekit's kind of annoying cljs doesn't know anything about :refer :all or use (all)
00:09ddellacosta_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.
00:10Janiczekprobably yeah - just the (ns) form now feels bloated
00:10ddellacosta_Janiczek: I'm pretty sure :use has been depricated exactly for that reason.
00:11ddellacosta_Janiczek: yeah, that's the tradeoff. I do have some files which start with an entire page of require statements. Not great I guess. :-(
00:11ddellacosta_Janiczek: but, on the flip side, easy to figure out what has been required and from where.
00:45Fareno, apparently I don't understand how dependencies work
03:03Frozenlock*cricket*
04:37unsafeCoerceDeraen
04:38unsafeCoerceDerander*
04:38unsafeCoercewhat is your opinion on this whole persistentvector thing
05:44m_m__Hi. Is there a possibility to mare reduce on range ? I need to sum all numbers from 1 to 1000.
05:45hyPiRionmare reduce?
05:45hyPiRionYou can do ##(reduce + (range 1 (inc 1000)))
05:45lazybot⇒ 500500
05:47m_m__hyPiRion: But why i cannot make something like that: (reduce + (range(1000)))?
05:47hyPiRion(range 1000) works fine
05:48hyPiRionbut it includes 0
05:48hyPiRion(and not includes 1000)
05:49m_m__strange...I had an error but now everything is ok. Thank you.
05: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?
06:01_KryDos_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.
06:04m_m__Is there anything wrong with: https://gist.github.com/anonymous/5d769d07b85d4305844d i have error that I cant canst LazySeq to Ifn.
06:07spradnyesh_KryDos_: i find them equal (true) in the program too
06:08spradnyesh_KryDos_: can you tell me "how" you are invoking the function?
06: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
06:10_KryDos_spradnyesh: get-opcode function returns list with 4 elements
06:11_KryDos_spradnyesh: oops. not list. vector I mean
06:11_KryDos_spradnyesh: I’m using (into [] opcode) as return value of the get-opcode funciton
06:13spradnyesh_KryDos_: equality in clojure looks at values (inside collection) and not at the collection itself, so (= [1 2 3] '(1 2 3)) => true
06:13_KryDos_spradnyesh ahh. wow. thank you. I didn’t know that
06:13spradnyesh_KryDos_: what is output of "(get-opcode rom-data registers)"
06:14spradnyesh,(= [1 2 3] '(1 2 3))
06:14clojurebottrue
06:14_KryDos_spradnyesh: it’s a vector with 4 elements
06:14_KryDos_spradnyesh: I will paste the get-opcode funcion… one second...
06:15spradnyeshcan you try doing "(println opcode empty-opcode)" just before your if and see the output? maybe they are different structures/values
06:15_KryDos_spradnyesh: here is - get-opcode.
06:15_KryDos_spradnyesh: sure. I will try
06:15_KryDos_spradnyesh: thank you.
06:16spradnyeshwhen 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 :( )
06:17_KryDos_spradnyesh: http://pastebin.com/BF8HnygW - here is the output of the (println opcode empty-opcode).
06:17_KryDos_spradnyesh: seems like it equal.
06:18spradnyesh_KryDos_: yes, they are same values
06:18spradnyesh_KryDos_: try replacing the System.exit w/ some println
06:18spradnyeshhow are you invoking the program? via repl? or from command line?
06:18_KryDos_spradnyesh: I know that get-opcode returned the lazy-seq and now I add the (into [] …) function for the get-opcode.
06:19_KryDos_spradnyesh: if I replace the system.exit println doesn’t work. «else» block is working.
06:19_KryDos_spradnyesh: it’s a magic for me :(
06:20_KryDos_spradnyesh: «into» function works well with lazy-seq?
06:20spradnyesh_KryDos_: you mean "(println "Executing opcode => " opcode "...")" gets executed?
06:20_KryDos_spradnyesh: sure
06:20_KryDos_spradnyesh: oops. It’s executed but it’s not a else block
06:20spradnyesh_KryDos_: ???
06:20lazybotspradnyesh: Yes, 100% for sure.
06:20_KryDos_spradnyesh: what you mean?)
06:21spradnyesh_KryDos_: i'm confused. you said "sure", then you said "oops...., not else block"
06:21_KryDos_spradnyesh: wait a second. I will show you…
06:21spradnyesh_KryDos_: did the "then" part get executed?
06:22spradnyesh_KryDos_: how are you invoking the program? via repl? or from command line?
06:22_KryDos_spradnyesh: «then» part executed. «else» part doesn’t. «Executing opcode => …» it’s not in else block
06:22_KryDos_spradnyesh: via command line. using «lein run»
06:22spradnyeshahh, i understand
06:23spradnyesh_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
06:23spradnyeshyou see?
06: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 :(
06:25_KryDos_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.
06:25spradnyeshwait, wait
06:25_KryDos_for me [0 0 0 0] [0 0 0 0] and opcode empty-opcode it’s a same
06:26spradnyesh_KryDos_: wait wait
06:26_KryDos_waiting :)
06:26spradnyesh_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)
06:27spradnyesh_KryDos_: replace your if code w/ this:
06:27spradnyesh(if (= empty-opcode opcode) (println "match") (println "does NOT match"))
06:27spradnyeshand see what is output
06:27_KryDos_spradnyesh: yes. it’s true. But when I add the else block it get executed
06:27_KryDos_spradnyesh: else required params?
06:27_KryDos_required parameter*
06:28spradnyesh_KryDos_: how about
06:28spradnyesh(if (= empty-opcode opcode)
06:28spradnyesh (println opcode empty-opcode "match")
06:28spradnyesh (println opcode empty-opcode "does NOT match"))
06:28_KryDos_spradnyesh: can I use only (if (= empty-opcode opcode) (println match))?
06:28spradnyesh_KryDos_: no, else is optional; but i'm not able to understand why the control is not going inside if
06:28spradnyeshtrying to debug
06:31_KryDos_spradnyesh: here is output with a little debug info - http://pastebin.com/tYCeBDfE
06:32_KryDos_http://pastebin.com/YbFTD3fk - it’s a same but with better formating.
06:32_KryDos_better format* excuse me
06:32spradnyesh_KryDos_: i'm sorry, i don't know what is going wrong here
06:33_KryDos_spradnyesh: me too :( thank you very much for you help and time :)
06:33_KryDos_s/you/your/
06:43visofhello
06:44zeebrahi 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
06:44visofhttp://pastebin.com/fhaxEZcA i got this error msg when using orientdb client
06:44visofhow can i fox this?
06:44visoffix*
06:45_KryDos_visof: are you sure about 127.0.0.1:2424 address?
06:47visof_KryDos_: tcp6 0 0 :::2424 :::* LISTEN 16751/java only tcp6
06:48visof_KryDos_: how can enable tcp v4 ?
06:49_KryDos_visof: I don’t know. How about 2480 port for tcp v4?
06:49visof_KryDos_: also tcp6 0 0 :::2480
07:41m_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!
08:32igorwhello, I ran into an edge case with core.logic's disequality that seems contradictory to me
08:32igorwhttps://gist.github.com/igorw/06cffdef743fbe97e477
08:33igorwit there any explanation for this? or is it a bug?
10:49winkigorw: unrelated to that problem: too bad I don't have much time right now, but really cool stuff you did lately
11:54ShayanjmIs it bad to use eval in macros?
11:54ShayanjmI know in most other languages, using eval is one of the deadly sins.
11:56TimMcShayanjm: It usually means you are doing something wrong, yes.
11:57ShayanjmI'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:58Shayanjmi.e: (update-all atom) => (do (update-atom-api atom) (update-sentiments atom))
11:58Shayanjmso if 'atom' was actually 'atomname', it would be 'update-atomname-api atomname'
11:59TimMcThe main problem with that is code readability.
12:00TimMcAny 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:00ShayanjmTimMc: 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:00Shayanjmso having a 'general' (update-api) function is out
12:01Shayanjmso I'm using the convention of <atomname> and update-<atomname>-api
12:01Shayanjmto differentiate between the various services
12:01Shayanjmhttps://www.refheap.com/724ab95f30e6750c4f47737d0
12:02TimMcTo me, having non-greppable var names is worse than using eval in a macro. :-)
12:03ShayanjmTimMc: Internally in the macro? should I be using different names for the vars?
12:03ddellacosta_Shayanjm: can't you just return a list, and call resolve on the symbol?
12:03radixDoes that really need eval anyway?
12:04ShayanjmI have 0 idea. Very very new to clojure. Very likely i'm doing this incorrectly
12:04ddellacosta_Shayanjm: doesn't need the do either as far as I can tell
12:04Shayanjmddellacosta_: I added the do because I needed to add another function inside the block
12:04FareI must do something obviously wrong with my project.clj, but I have no clue what
12:04ddellacosta_Shayanjm: ah okay
12:04ddellacosta_Shayanjm: but I'm with radix, I don't see why you need eval here
12:04bbloomShayanjm: you definitely do not need to call eval in there
12:04Fareso I have project A, called leijure/delta-position — I do lein install, it creates a .jar, so far so good
12:04bbloomShayanjm: but let's rewind a bit
12:05ddellacosta_Shayanjm: I think you just need resolve
12:05Shayanjmsure
12:05bbloomShayanjm: 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:05Shayanjmyep :\
12:05bbloomShayanjm: most likely what you really want is just a single atom with a map in it
12:05Farethen 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:05bbloomthen all you need is (swap! some-atom update-in [:some-key] some-fn and some args)
12:06Shayanjmbbloom: sure, that would probably make more sense. Out of curiousity, why that approach vs. multiple refs?
12:06Farebut 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:06bbloomShayanjm: are you doing any actual concurrency?
12:07Shayanjmbbloom: Yeah. There will need to be certain guarantees that information is 'up to date'
12:07Shayanjmarguably I could just do it in a single atom, but that would be a HUGE swap!
12:07Shayanjmultimately this project will be interfacing with some 30 or so different APIs
12:07Shayanjmand scraping data from all of the websites for analysis
12:08Shayanjmso the two most fragile parts of it are: handling the data from the different APIs in a unified manner, and dealing with scraping
12:08ddellacosta_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:08Shayanjmthe whole scope of the project is a newsreader + intelligence
12:08bbloomShayanjm: 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:08Shayanjmah I see
12:09bbloomShayanjm: 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:09bbloomdon't try to optimize, try to get it working first
12:09ShayanjmSure that's fair. If I wanted to go down the single atom avenue
12:09Shayanjmmy question is: how would I handle the various API interfaces?
12:09bbloomit'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:10bbloomi have no idea what you mean
12:10Shayanjmi.e: API1 returns data in a {:result {:data data :url url :thing thing}} format
12:10ShayanjmAPI2 might return data in a {:webURL url :webThing thing...} etc. format
12:10Shayanjmultimately they're providing the same/similar data
12:11Shayanjmbut I would have to know precisely how to identify the various pieces of data
12:11Shayanjmand I'd have to do that separately for all the different APIs
12:11bbloomhow does that have anything to do with atoms?
12:11bbloom(defn api1 [& args] (your-transform-fn (some-common-code-path ...)))
12:12ShayanjmSo the swap shouldn't actually happen inside api1?
12:12ShayanjmI transform all of the data from all of the APIs into a usable format, and then swap! after?
12:12bbloomyou haven't explained at all what you're trying to do to any degree in which anybody can provide actual advice to you
12:13ShayanjmOkay let me be clearer
12:13bbloomShayanjm: that's exactly what i told you days ago, isn't it? avoid swap!s, prefer pure functions
12:13Shayanjmbbloom: sure, which is what I did for the single API access for New York Times.
12:13ShayanjmThat gets slightly more complex when you're coordinating >5 API accesses and scraping for all URLs
12:13Shayanjmanyway
12:14bbloomi'm not sure where that complexity suddenly creates need for state in your data-transforming functions
12:14Farehow do I debug a project.clj and/or jar installation?
12:14Shayanjmhttps://github.com/shayanjm/Sentimental/tree/develop
12:14ShayanjmThat'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:15Shayanjmit grabs the URL of each article separately, scrapes the article-content, and then passes it to a sentiment analyzer function
12:15Shayanjmwhich returns a collection of 'sentiments' (integer from 0-4) for each sentence in the article
12:15Shayanjma mean of each collection is then calculated and stored in the same atom. This is all displayed on a webpage of sorts
12:17ShayanjmThe next steps for the project are to integrate with more news outlet sources (the guardian, AP, etc.)
12:17Shayanjmand scope out of just sentiment analysis
12:17Shayanjmstart grouping news articles by event/content, and provide more useful insights
12:17Shayanjmso ultimately, this will become a newsreader application that has some additional 'intelligence' tools
12:18bbloomso 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:18bbloomwrite pure functions from scraped content -> sentiment results
12:18bbloomthen write a pure function of database of results + new result -> new database of results
12:18ShayanjmSure. I guess my mental block is figuring out what a pure function is in terms of API access
12:19bbloomcontent -> result
12:19Shayanjmshould I figure out some way to write one 'fuzzy' API transform tool?
12:19Shayanjmand make it as general as humanly possible?
12:19bbloomno
12:19bbloomthe exact opposite of that
12:19Shayanjmor write a bunch of separate transform tools for each API i'm integrating?
12:19bbloomyou're thinking too hard and trying to do too many parts at once
12:19bbloomforget the web server for a moment
12:19bbloomforget the atom for a moment
12:19i-blisFare: jars should be in your .m2 after `lein install`
12:19Shayanjmsure.
12:19bbloomscrape the page once, save the results in a file
12:20bbloomin your repl, slurp in that file, test a function on it that does the analysis
12:20bbloomonce you have the analysis working, write down the format in a text file
12:20bbloommake a note of it for yourself
12:20bbloomthen go do the same thing again for a 2nd api
12:20raubbloom: Please stop abusing your return key, you daft loser.
12:21bbloomShayanjm: then figure out how to glue those things to your web service & the scraper later
12:22Shayanjmhmmk
12:23Farewhat'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:23bbloomapparently rau is a bot that just tells people to stop pressing return....
12:24Shayanjmclassic
12:24Shayanjmthanks for the help bbloom
12:24ShayanjmI'll think about this a little more and probably come back here with the solution
12:24i-blisFare: the jar should land automatically in $HOME/.m2 (your local Maven repository cache) after `lein install`
12:25Shayanjmbbloom: last question, is it a bad thing to assume a certain structure for an atom?
12:25bbloomShayanjm: what do you mean "assume a certain structure"?
12:25ShayanjmI'm like, not sure where to draw the line between 'too general' and 'pure' functions
12:25bbloomShayanjm: your data will have some structure, your functions will operate on that structure
12:25bbloomwelcome to programming
12:25bbloomnot sure what you expected :-)
12:26Shayanjmbbloom: Just needed a definitive answer one way or another.
12:26TimMcI'm not sure it's a meaningful question.
12:26FareI see a ~/.m2/repository/leijure/delta-position
12:27TimMcIs there a different way you could ask it?
12:28i-blisFare: once you did `lein install`, you need only add a line to the :dependencies of the other project
12:29dbaschShayanjm: you decide what structure you want your atom to have, e.g. a map of maps
12:29FareI added it, but it says: Could not locate leijure/delta_position__init.class or leijure/delta_position.clj on classpath:
12:29i-blisFare: you see it, meaning it is locally installed ; now, treat it as any dependency :)
12:29Faremy dependencies include [leijure/delta-position "0.1.0-SNAPSHOT"]
12:30Farebut I still get Could not locate leijure/delta_position__init.class or leijure/delta_position.clj on classpath:
12:30ShayanjmYeah 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:30OscarZ_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:30ShayanjmOscarZ_: Yeah its looking like that's what I'm going to be doing
12:31i-blisFare: do you have a directory named 0.1.0-SNAPSHOP inside ~/.m2/repository/leijure/delta-position?
12:31ShayanjmI'll just integrate one API at a time then
12:32OscarZ_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:32i-blisFare: remove whatever symlink you add in checkouts btw
12:33bbloomShayanjm: https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)
12:34bbloomShayanjm: you will not be equipped to write general code until you've written the specific code three times
12:34bbloomShayanjm: do the three APIs by hand, then maybe you'll see some commonalities you can abstract
12:34clojurebotI don't understand.
12:34Shayanjmah I see
12:34Shayanjmthat does help quite a bit actually
12:34Shayanjmthanks bbloom
12:34bbloomShayanjm: you'll get to a better result more quickly than if you try to predict the outcome up front
12:34OscarZ_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:35Faresame after removing the symlink in checkouts/
12:36i-blisFare: what subdirs do you have in ~/.m2/repository/leijure/delta-position?
12:37Shayanjmbbloom: much appreciated. That helped me with my mental block on a proper clj fn development cycle hahaha
12:38i-blisFare: and what message do you get when you `lein deps` in project B?
12:44OscarZ_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:44TimMcbbloom: Solid advice. And I think that's why I err on the side of explicitness and redundancy at first.
12:44bbloomOscarZ_: i don't think that helps Shayanjm
12:46bbloomOscarZ_: 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:48OscarZ_yeah maybe i didnt understand what the problem is
12:49bbloomOscarZ_: his struggle to explain his problem was a hint to the problem that i just described :-)
12:52Farei-blis, lein deps doesn't print anything (!)
12:53OscarZ_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:54bbloomOscarZ_: core.async would be one reasonable route
12:54Farei-blis, ~/.m2/repository/leijure/delta-position/0.1.0-SNAPSHOT/
12:58dbaschFare: try lein deps :tree
13:00OscarZ_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:00Faredbasch: thanks, it prints all my transitive dependencies, including [leijure/delta-position "0.1.0-SNAPSHOT"]
13:01Fareis the issue one of :aot or some such?
13:02Fare(inc dbasch)
13:02lazybot⇒ 8
13:02Fare(inc i-blis )
13:02lazybot⇒ 1
13:07koreth__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:09OscarZ_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:10i-blisFare: do you still get the error on missing classpath?
13:10Fareyes
13:11i-blisFare: could you pastebin your project.clj?
13:11dbaschFare: are the missing files inside the jar file?
13:11Farethe 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:11Fareoh, underscore vs dash!
13:12i-blisFare: :)
13:12Fareso should I rename the directory delta_position ? or just rename everything deltaposition ?
13:14bbloomFare: just _ in the directory should do it, - is fine in namespaces
13:14Farewhat is the standard practice?
13:15Faredo people shun dashes in names because of this limitation?
13:15bbloomFare: i don't think so
13:15bbloomi've been bitten by it myself tho
13:15bbloom,munge
13:15clojurebot#<core$munge clojure.core$munge@1c00791>
13:15bbloom,(munge 'some-name)
13:15clojurebotsome_name
13:15bbloom,(munge 'some+name)
13:15clojurebotsome_PLUS_name
13:16bbloomi think that function is also used for directoyr names
13:16TimMc&(namespace-munge "a.b-c_d/e")
13:16lazybot⇒ "a.b_c_d/e"
13:16bbloomor that one, *shrug*
13:17TimMca.b-c turns into a/b_c.clj -- I don't think there are any other transformations.
13:17TimMc(Fun fact: The JVM accepts arbitrary unicode in class and package names!)
13:19bbloomlol, and clojure just decided to munge away, fun :-P
13:39PigDudehow do you test core.async code? the test runner exits before my (go) blocks run
13:39bbloomPigDude: use <!!
13:40PigDudebbloom: it is not available in clojurescript
13:40bbloomPigDude: oh, then you need to do the same bullshit that other js test frameworks do
13:40bbloomPigDude: for example: http://api.qunitjs.com/expect/
13:40PigDudei'm not sure about bullshit, but i would prefer to write a single test and not one for cljs and one for clj
13:41PigDudethere is no way to defer end of test run until some signal is given (from within a go block)?
13:41bbloomPigDude: 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:41PigDudewhat is this qunit example?
13:41bbloomPigDude: read what it says
13:41bbloomtheir test runner has a timeout and waits that amount of time before reporting failure
13:42PigDudethis offers another way to make my tests fail?
13:42bbloomtests in this style assert how many async assertions that they will create
13:42PigDudeick that's not a good approach, what if the test takes longer than that?
13:42PigDudei see that
13:42bbloom*shrug*
13:43PigDudeso the answer appears to be to use cljs.core.async.test-helpers
13:43whodidthishttps://github.com/cemerick/clojurescript.test
13:43PigDudethanks bbloom for looking though
13:43PigDudeobscure stuff
13:45lxsameerHey guys, is scala better than clojure in performance manner ?
13:45bbloomlxsameer: difference is far less than negligible for optimized code
13:46bbloomlxsameer: 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:47lxsameerbbloom: 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:48bbloomlxsameer: both are statically compiled to jvm byte code without wrapper objects or other dynamic goo like jruby or jython
13:48PigDudecore.async has separate cljs and clojure tests, using <!! and >!! for the clojure tests and the async hlpers for the cljs tests
13:49PigDudei hope not too many other people have to write clj/cljs stuff, it is a bear :)
13:49PigDudeto target both thoroughly for something complex
13:49lxsameerbbloom: which one do you suggest me to learn (for fun) , I have strong background in python/ruby, and some experiences in elisp .
13:50bbloomlxsameer: you're asking a biased audience, this being #clojure and all
13:50bbloomlxsameer: if you want to learn about type systems, skip scala and learn haskell, or preferably, an ML-variant
13:50bbloomlxsameer: otherwise, learn clojure
13:50bbloomlxsameer: have fun :-P
13:51OscarZ_lxsameer: maybe a lisp would be a bit different as scala, ruby and python are all OO languages
13:52lxsameerbbloom: thasnk
13:52lxsameerOscarZ_: I also experienced in C/C++
14:06hotcore,(+ 1 1)
14:06clojurebot2
14:06hotcore&(+ 1 1)
14:06lazybot⇒ 2
14:13Farewhen releasing to I replace -SNAPSHOT by -FINAL, or do I just remove -SNAPSHOT ?
14:14bbloomFare: just remove the -SNAPSHOT
14:15alloyedFare: an example: https://github.com/technomancy/leiningen/blob/stable/project.clj
14:17Farebbloom, alloyed, thanks!
14:45eraserhdYay, some hack time for Avi.
15:08lxsameerwhat resource do you recommend for learning clojure ?
15:09magopianlxsameer: I'm starting with "Programming clojure" ;)
15:09magopianit's been fun so far (I've gone through a lot of 4clojure.org exercices also, really fnu)
15:09magopianfun
15:14arrdemFare: throwing grammars at instaparse is fun :D
15:14FareI'm a bit disappointed at the error messages provided by lein
15:15Fareit could have told me about this - vs _ mismatch
15:17arrdemFare: http://dev.clojure.org/jira/browse/CLJ-1297
15:22technomancyFare: unfortunately that's out of the jurisdiction of lein
15:23technomancybut it is really disappointing how little effort the clojure compiler makes towards usability =\
15:24winklxsameer: you can skim through https://pinboard.in/u:winks/t:clojure - maybe something interests you
15:24technomancyFare: 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:28Farearrdem, that would have saved me much trouble
15:43arrdemtechnomancy: so I don't need my (slurp "VERSION") and bump.sh anymore?
15:45arrdemhuh. it looks like I don't..
15:47gfrederickstechnomancy: I have soured on this test-helpers-in-separate-directory approach and am scrutinizing the leiningen.test code for an escape hatch
15:47gfredericksin particular I'm wondering if blacklisting a namespace via test-selectors ought to prevent its being reloaded?
15:48gfredericksI 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:48gfredericks(i.e., test-selectors applied to namespace metadata)
15:49technomancyarrdem: ideally not... try it and see =)
15:50technomancygfredericks: the test selectors stuff kinda got rewritten since I last looked at it
15:50technomancyit used to be solely about vars
15:50technomancybut I vaguely recall that what you want might have been added
15:50gfredericksokay maybe I'll spelunk through blames & commit msgs
15:51technomancyspoiler: it was Raynes
15:51gfredericks`technomancy blame test-selectors ;; => Raynes`
15:51gfrederickstechnomancy: thanks for the tips
15:52gfredericksarrdem: it could tweet its args @technomancy
15:52arrdemgfredericks: I was considering using exponential backoff with a cap and retrying across IRC and twitter...
15:56technomancyclojurebot: technomancy is eventually consistent.
15:56clojurebotOk.
15:57arrdem,1
15:57clojureboteval service is offline
15:57gfredericksthe `git blame` for the relevant section of code is striped with nothing but me phil and raynes
15:59technomancycareful what you wish for
16:06gfrederickshuh.
16:09gfredericksthis is a strange feature.
16:11gfrederickswell 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:14technomancyit's basically retrofitting a feature that was designed to work with vars to simultaneously also apply to namespaces
16:14gfredericksit doesn't really work with metadata though
16:14technomancyI've never tried it on namespaces
16:14gfredericksafaict the only straightforward use is selecting based on the name of the namespace
16:14technomancyoh, also it is a monkeypatch, because jira
16:14gfredericksI twerked it to work with metadata by using require and (comp meta the-ns)
16:15gfrederickswhat?
16:15clojurebotwhat is cells
16:15gfredericksclojurebot: cells?
16:15clojurebotcells is http://gist.github.com/306174
16:15technomancycells is pods!
16:16gfredericksclojurebot: pods?
16:16clojurebotNo entiendo
16:17gfredericksI think I've sufficiently imagined what the monkeypatch comment means
16:17technomancygfredericks: because how else are you going to change clojure.test?
16:18gfredericksyeah I didn't follow that at first because the stuff I'm looking at isn't directly related
16:20gfredericksokay okay okay okay so I think this could be embettered without much haxery
16:21gfredericksideally the namespace selectors should have access to the metadata on the ns sym without having to load the namespace
16:21gfredericksand when bultitude returns its list of namespace symbols they do indeed have metadata on them
16:21gfredericksthe problem is it doesn't get printed on the eval-in-project form for lein test
16:23technomancyaha
16:23gfredericksdoing print-meta on everything would be a bit excessive?
16:23noncomhow do i push a java jar to clojars with leiningen ?
16:23noncomit is a 100% java jar, no project.clj
16:24gfredericksyou can make your own pom.xml and upload that with the jar
16:24technomancynoncom: lein doesn't care what source is in the jar
16:25noncombut instructions say "first do pom" and it doesnt pom w/o project.clj
16:25luxbockis there a way to tell Emacs/cider to use a certain profile from my project.clj when launching the repl?
16:27eraserhdsubseq is not a generic version of subvec. <-- just discovered.
16:28arrdemis there a groupthink best practice with respect to defining an interface vs defining a bunch of functions over a custom type?
16:28noncomso here is my result: https://www.refheap.com/87917
16:28noncoman NPE
16:31noncomso why do i get an npe ?
16:35technomancynoncom: so you're using lein to deploy something that's not a lein project?
16:35technomancyyou need to tell it what the files are, it can't just figure it out
16:39noncomtechnomancy: yes, thats true, i am deploying a 100% java jar, no project.clj
16:39amalloytechnomancy: feature request: imbue leiningen with psychic powers
16:39noncomyou mean i must create a clojure project with java source files to do that ?
16:39arrdemamalloy: jvm doesn't support psy until 1.8
16:40technomancynoncom: 100% java doesn't imply no project.clj =)
16:40technomancynoncom: no, I mean you need to tell lein what files to use when deploying
16:40technomancy`lein help deploy`
16:42dbaschtechnomancy: amalloy how about Super Cow Powers?
16:42amalloydbasch: no need; just install a debian VM
16:42dbaschamalloy: but it could be done more easily with a plugin
16:43noncomso i did lein deploy clojars minim-2.2.0.jar pom.xml
16:43noncomit says java.lang.IllegalArgumentException: Must provide valid :files to deploy-artifacts
16:44technomancynoncom: read the docstring again =)
16:45technomancyyou just tried to deploy version "pom.xml" of the "mimim-2.2.3.jar" artifact
16:45noncomyes
16:45noncomnames must match ?
16:46noncomoh i got it
16:46noncomok
16:46noncomwrong args
16:49arrdemugh... so how do I define <, > and = on numbers with tolerances..
16:49technomancyinterval arithmetic?
16:49technomancymaybe just use frinj?
16:50noncomso it workred at the end, thank you
16:50gfredericksarrdem: what's a tolerance?
16:50arrdemgfredericks: 1±3
16:51arrdemgfredericks: this weird things engineers do because they don't live in integral words
16:51technomancyarrdem: haven't tried it myself, but it sounds like what you want is to just reinvent it?
16:52technomancyoh, but if you only want a limited set of operators it's probably a lot simpler
16:52gfredericksarrdem: I have a library to help with the algebra tedium :)
16:52bbloomi still haven't found a generic operations mechanism that i truly like :-/
16:52arrdemgfredericks: do share... so do I. I'm cleaning mine up atm :P
16:53gfredericksarrdem: https://github.com/gfredericks/lib-4395
16:53arrdemgfredericks: that name :P
16:54gfredericksyes it's quite googleable isn't it
16:54arrdemvery googleable, not very memorable
16:55gfrederickssay that again after you've used it on ten projects
16:55gfredericksarrdem: don't worry my new naming method is the first people-name I encounter on wikipedia's "random article"
16:57technomancygfredericks: does this kind of article count? https://en.wikipedia.org/wiki/List_of_awards_and_nominations_received_by_Brandy_Norwood
16:58gfrederickstechnomancy: I wasn't thinking so but I'm open to arguments
16:59technomancyList of R&B artists named after alcoholic beverages
17:00arrdemy u no just uuid libraries...
17:07arrdemtechnomancy: thanks for mentioning interval arithmetic. It looks like what I'm doing is implementing a domain specific and equally complex subset of it.
17:12technomancycool
17:14bbloomarrdem: is it a subset? or just similar/related ?
17:14bbloomi saw something long ago about estimating floating point error
17:14arrdembbloom: I'm revamping https://github.com/arrdem/imprecise atop algo.generic
17:15bbloomwhere they did symbolic execution with (value, error) fixed point pairs
17:15arrdembbloom: it was originally a tool I built to do physics problems for me :P
17:15arrdembbloom: yeah that's what this was for essentially.
17:16bbloomthere's probably a complete algebra defined for error analysis
17:18arrdemprobably
17:23noncomanyone used clojurewerkz quartz ?
17:51joegallo~anyone
17:51clojurebotJust 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:51gfrederickstechnomancy: should I commit a disabling of this failing test so travis starts being helpful again?
17:52gfredericksthe assumption being I don't have time right this moment to figure out why it's failing
17:59koreth__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:06technomancygfredericks: which test is it; I haven't taken a look?
18:07gfrederickstechnomancy: the regression test for the mirror bug
18:07gfrederickspasses logally, fails on travis
18:07gfrederickstravis has been red for a week or two or something
18:14sandbagsIt'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:15sandbagsi'm wondering if i got the import wrong somehow?
18:18sandbagsyou have to be invited to #java ??
18:18lazybotsandbags: Definitely not.
18:19sandbagsthat's a bit inscrutable
18:22nathan7sandbags: are you sure it doesn't just require registered nicks?
18:22arrdemOkay. why on earth am I getting an error that `min` isn't defined in any of the interface... https://www.refheap.com/87920
18:22arrdem*interfaces
18:22sandbagsnathan7: i got a +i required for #java, ##java is complaining i'm not registered although i could have sworn i am
18:23nathan7sandbags: are you *logged in*
18:23sandbagsah, looks like my copy of LimeChat has a faulty password
18:23nathan7sandbags: otherwise being registered does little good
18:23sandbagsodd, i should have thought it would have booted me from the nick by now
18:26Bronsaarrdem: definterface methods don't take "this"
18:29nbeloglazovsandbags: FileInputSteam -> FileInputStream
18:29sandbagsokay 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:29arrdemBronsa: cheers
18:29sandbagsnbeloglazov: really? fuck... thanks man
18:29sandbagsjeez
18:29sandbagsand i looked at it to see if i mistyped it too!
18:33dbaschsandbags: everything in java.lang is already imported
18:33dbaschsandbags: oh, you'd typed Steam :)
18:41sandbagsdbasch: sadly ;-)
18:43sandbagsunfortunately 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:46sandbagsor maybe i am butting up against a dependency issue
18:47sandbagsaccording 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:48sandbagsi assume there must be some other repo i'm supposed to configure somewhere, somehow
18:59sandbagsanyone take a look at https://gist.github.com/mmower/82d693a87c3ef4699e58 for me?
18:59sandbagsit seems like this should be working
18:59sandbagsaccording to my search of maven.org
19:10nbeloglazovsandbags: try apache-mimej-core: http://mvnrepository.com/artifact/org.apache.james/apache-mime4j-core/0.7.2
19:11sandbagsa ha
19:11sandbagsthanks nbeloglazov that seems to have done the trick
19:11sandbagscan you tell me what i was missing there?
19:13nbeloglazovLooks 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:14nbeloglazovIf 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:14nbeloglazovYou'll see that the latter has "Download JAR" button and a size of the library.
19:15sandbagsah, so my misunderstanding was to think if it was searchable here that it is ~ a library
19:15sandbagsthanks nbeloglazov
19:16nbeloglazovI agree, that it is confusing. I think I saw some apache projects with similar structure before so it helped.
19:17nbeloglazovsandbags: you're welcome :)
19:19sandbagsokay, seems i am now able to parse at least some stuff from a GMail export file, neat!
20:42arrdemtechnomancy: `lein release :patch` didn't just work when I tried it, I'll play with it some tomorrow.
20:48gfredericksarrdem: is it supposed to replace the lein-release plugin?
20:49arrdemgfredericks: AFAIK
20:58gfredericksnow I need a project that needs changing I can try it on
21:58sritchieanyone using om here?
21:58sritchieamalloy_: and for my real question… :)
21:58sritchiecurious about patterns for writing reusable components that need config options
21:58sritchiereact’s props are good for this
21:59sritchiejust checking if there are any different om conventions that have popped up
22:00sritchieah, om-sync gives a nice example: https://github.com/swannodette/om-sync/blob/master/src/om_sync/core.cljs
22:49technomancyarrdem: definitely interested in a bug report for that
23:21FrozenlockNoooo.... uberjarpocalypse!
23:21Frozenlock'Lein run' works flawlessly, but 'lein uberjar' gives me this error: Exception in thread "main" java.io.FileNotFoundException: Could not locate...
23:21FrozenlockAny idea what might be causing this?
23:22FrozenlockI already did 'lein clean' multiple times, along with manually deleting the 'missing' library to force lein to redownload it.
23:28FrozenlockOh.. nevermind..
23:28FrozenlockI added my dependency in my :dev profile.
23:28Frozenlock(dec Frozenlock)
23:28lazybotYou can't adjust your own karma.
23:55robinkI 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:56robinkIt'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:56robinkIs there a way to immediately coerce something that implements IPersistentMap into a PersistentArrayMap (or something analogous) without having to first make it a seq?