#clojure logs

2012-11-23

00:03mroweflying_rhino: emacs/slime/swank works very well, but there's a fair learning curve if you haven't used emacs before
00:03flying_rhinomrowe: never used emacs before
00:03mroweflying_rhino: it's definitely worth learning. but not really a "beginner's ide" :)
00:03akhudekflying_rhino: I use IntelliJ with the La Clojure plugin
00:04flying_rhinoakhudek: intellij isn't free (not that I am aginst piracy)
00:04akhudekflying_rhino: there is a free version
00:04mrowetheir "community edition" is free
00:04akhudekthere is also eclipse + counter clockwise
00:04mrowe(and partly open source I think?
00:04mrowe)
00:04akhudekbut I've always found eclipse to be too slow and clunky
00:04flying_rhinoakhudek: me too
00:05ToxicFrogI've been using IntelliJ. Not sure I'd call it a beginner's IDE, but it's more discoverable than vim/cream or emacs, at least
00:06flying_rhinobut seriously you guys should have one click setup.exe that installs lein, along with some sort of starter-kit emacs. Even getting lein to work was PITA
00:06muhooflying_rhino: i think that's lighttable
00:06akhudekhttp://www.lighttable.com/
00:06akhudekat least that's the goal
00:07flying_rhinoalthough now that I have lein, I just need IDE
00:07muhooseriously, look at lighttable. i think the goal of it is a one-click dev env, and it has some very cool smalltalk-ide-like ideas in it
00:07muhoonow, a mundane question: is anyone using bishop for web services, with friend?
00:08muhoobishop looks interesting, but i'm scratching my head on how to integrate the two.
00:08flying_rhinolighttable has rainbow parens? Neat
00:09akhudekflying_rhino: it's still a work in progress, though I know Chris (the author) uses it full time already
00:10flying_rhinoakhudek: once I download the thing, how I hook it up with lein?
00:10akhudekthere is a command "connect" that you feed your project directory
00:10akhudekit does everything else automatically
00:12UrthwhyteI found vim+vimclojure to be quite easy to get going
00:12Urthwhyteslimv was another story
00:15flying_rhinoso I create project vie lein
00:15flying_rhinoand then I tell it connect
00:15flying_rhinoand it connects?
00:15flying_rhino*via
00:25flying_rhinohey this lighttable seems to work
00:26atom_flying_rhino: +1 for intellij
00:26flying_rhinodoes intellij uses lein, too?
00:26atom_yes, you can
00:27atom_flying_rhino: are you using some sort of source control to monitor your progress?
00:28flying_rhinono
00:28flying_rhinoyou think I should?
00:29atom_flying_rhino: I've found it to be a useful tool in helping me study/learn clojure. It's each persons own preference. I keep my notes on their as well using markdown.
00:30ToxicFrog<3 version control
00:31flying_rhinoI'll need all these tools to sneak as much mutable state into clojure as I can so you'll curse me for all eternity. :P
00:31flying_rhinookay not really
00:31Bergle_1ive been using lighttable a little, notthing serious, seems to work ok.
00:31atom_ToxicFrog: What's your flavor of choice?
00:32ToxicFrogatom_: git
00:33atom_ToxicFrog: Popular choice! I'm a Mercurial man myself
00:33flying_rhinookay I have connected to project via lighttable. What now
00:33flying_rhino?
00:33ToxicFrogAlthough I wouldn't hesitate to recommend hg as well, git's my personal pref
00:35atom_ToxicFrog: IMO they're both excellent and neither offers a huge featureset or advantage over another except in terms of adoption %
00:37atom_ToxicFrog: GitHub is probably the biggest benefit to Git. Personally I am a self-confessed FogCreek fan and so I use Kiln.
00:39ToxicFrogHg, from what I've used of it, is more polished and has better windows support, but I find git more flexible.
00:39ToxicFrogAnd yeah, github is lovely.
00:48flying_rhinolighttable repl is totally badass
00:48flying_rhino(still not sure how it works with projects)
00:48flying_rhinothanks for recommendation
00:50flying_rhinomuhoo, akhudek thanks for recommending me lighttable
01:47hakujinexit
01:56muhooany experience with bishop? is it useful? worthwhile?
02:00brainproxymuhoo: I've been using liberator, which I think was partially inspired by bishop
02:22muhoobrainproxy: thanks. how w well is it working out?
02:41yediwhats the fn to append two vectors?
02:43foodooyedi: concat
02:43andrewmcveigh&(concat [1 2] [3 4])
02:44lazybot⇒ (1 2 3 4)
02:51yedithanks
02:51yedican someone help me with this: https://gist.github.com/4134413
02:51yedithe map function doesn't seem to be getting called on the first item of the vector
02:52jyuwhy (map #(print (val %) (key %)) {:a :b :c :d}) have 2 additional nil in the result?
02:52ivanprint returns nil
02:53ivanmapping with print like that returns a seq with two nils
02:54yedialso concat doesn't seem to be working
02:55jyuivan: thanks
02:56jyuivan: would I get rid of the nil to print string
02:58ivanI think you're always going to see the return value in the REPL
02:58ivanyou can avoid using print if you want to see the returned seq instead
02:59ivansomething like (dorun (map #(print %) [1 2 3])) will only print one nil in the REPL
03:21flying_rhinocan you have inner function in clojure?
03:22jakubHletfn ?
03:22p_lor since clojure is (at least claims to) a lisp-1, normal let with lambda should be enough
03:28rbxbxyup, either form should work fine
03:28flying_rhinowhy my factorial function doesn't work
03:28flying_rhinothis works
03:28flying_rhino(defn fac [n]
03:28flying_rhino (if (> 2 n)
03:28flying_rhino n
03:28flying_rhino (* n (fac (- n 1))) ))
03:29flying_rhinobut when I replace fac with recur it doesn't work at all
03:29flying_rhino*recur with fac
03:29AimHereThat's because your call to fac isn't in the tail position
03:29flying_rhinoit is last call
03:30AimHereNo, you're actually multiplying it by n afterwards
03:30flying_rhinoI see
03:30flying_rhinoso how to fix this thing
03:30flying_rhino?
03:30AimHereAnd because you're doing something to it, you can't tail optimize it
03:30AimHereYou have to rewrite it slightly more radically
03:30jakubHthe typical solution is to pass n into the recursive call and multiple there
03:32AimHereIf you do that, You might want to use 'loop' since otherwise you'd have to pass that temporary 'n' to fac along with the initial n parameter
03:32jakubHgood point
03:33AimHereI'd rewrite it to something like like (defn fac [n] (loop [n n a 1] (if (> 2 n) a (recur (dec n) (*' a n)))))
03:34AimHereBut bleah, got to go work :(
03:36flying_rhinoit worked
03:37Mr_Bondloop/recur can be used for so many things :)
03:38flying_rhinoit is annoying that when using lightable instarepl it doesn't tell you where the problem is, it just doesn't work
03:48yedirhyme-finder.core> (map test-prons (clojure.string/split poem-line #"\s"))
03:48yedi(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"])
03:48yedirhyme-finder.core> (concat (map test-prons (clojure.string/split poem-line #"\s")))
03:48yedi(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"])
03:49yediconcat doesn't seem to be doing anything
03:50yedioh, I had to (apply concat ...)
03:50andrewmcveigh|w&(apply concat (["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))
03:50lazybotclojure.lang.ArityException: Wrong number of args (5) passed to: PersistentVector
03:50andrewmcveigh|w&(apply concat '(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))
03:50lazybot⇒ ("ih" "t" "ih" "z" "n" "aa" "t" "k" "w" "ay" "t" "dh" "ah" "b" "eh" "s" "t")
03:52andrewmcveigh|w&(reduce concat '(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))
03:52lazybot⇒ ("ih" "t" "ih" "z" "n" "aa" "t" "k" "w" "ay" "t" "dh" "ah" "b" "eh" "s" "t")
04:32mammothone thing
04:32mammothgenerally the biggest complaint about clojure is that it doesn't have debugger that is any good.
04:32mammothis that complaint valid?
04:33mammothhow do you debug large clojure codebase?
04:33borkdude valid, but the way of development is also very different from other languages, more interactive
04:33borkdudeREPL-oriented
04:34borkdudemammoth and more debugging support is being worked on (I think)
04:35borkdudemammoth furthermore, writing a good suite of tests always helps
04:35mammothI am concerned for example I played around in lighttable instarepl and sometimes it doesn't tell me at all where is a bug, it just doesn't work
04:35jakubHlighttable isn't best for that, it still feels quite "alpha"
04:36mammothyeah
04:36p_lborkdude: any comparison with SLDB under SBCL/CCL?
04:36jakubHI had similar problems there; but Eclipse+Conutercloclwise or Emacs+nRepl shall be much better
04:36mammothjakubH: I actually like lighttable, it has great feel to it. But yeah it is alpha.
04:37borkdudep_l I'm no expert on that, but I saw a tweet from the conj about "better restarts than common lisp on the way" or smth, you should def. ask someone else who has been there
04:37p_lborkdude: somehow I doubt the claim... at least as long as it runs on JVM ;P
04:37jakubHYes, it has high "coolness factor" :-) I am looking forward it being more mature
04:38p_llighttable for is disqualified by nature of the platform it's implemented on
04:38p_l*for me
04:39jakubHyou mean clojurescript?
04:39borkdudeif you disqualify clojure because of its host platforms, you shouldn't be looking at clojure in the first place
04:40p_ljakubH: browser
04:40p_lborkdude: I don't disqualify clojure itself.
04:41jakubHCome on, where do you live? If it doesn't run in the cloud, it isn't cool anymore! *just kidding*
04:41p_ljakubH: Chrome is a synonym for "Six Gigabytes and Constantly Swapping"
04:41jakubH:)
04:41p_lthat's on light use
04:42mammothso far my complaints about clojure are:
04:42jakubHWell, if you are used to Java + Websphere + IBM Software Developer as I was, you would certainly miss not to have that & swapping :)
04:43p_ljakubH: I'm used to having >200 tabs open
04:44p_lChrome dies at 15
04:44augustlfirefox is apparently much better at having a gazillion tabs open
04:45p_lfirefox has big up-front memory cost, but low memory use on top of that
04:45augustlp_l: then there's 32 bit vs 64 bit though, not that I know anything about the details there
04:45p_lChrome noms memory like crazy and for long time was incapable of rate limiting its plugins
04:46p_l(I got 100% across multiple cores with about:blank as the only tab in Chrome once)
04:46augustlbut I would assume chrome "solves" it by having multiple 32 bit processes. IIRC V8 has a limit of around 1gb of JS allocations per VM anyway.
04:47rojeppWho cares about 64-bit in a browser? If it needs more address space, time to find another browser`?
04:47p_lrojepp: I care about not having to support much 32bit software on my install
05:13thorwili guess there is no "private, but still accessible for tests"?
05:14augustlrojepp: a gazillion tabs might need more than 4gb ram
05:32thorwiltechnomancy: i guess https://github.com/technomancy/leiningen/wiki/Upgrading should contain a note about using :profiles {:dev {:dependencies ... instead of :dev-dependencies. at least that fixed an issue i had, so i assume it's mandatory
05:44oddyladys, gents, given that lein project definition is correct and has aot + main specified, under what conditions it won't find my class from aot namespace?
05:52mpenetoddy: missing gen-class in your main ns maybe?
05:53oddympenet: na, it's there. Runnable gets precompiled, but aot clases don't...
06:03AnderkentAny easier syntax for printing to stderr than (binding [*out* *err*] (prn ...)) ?
06:10augustlAnderkent: not that I'm aware of
06:25wingywhat is the idiomatic style in https://www.refheap.com/paste/6927
06:26alexnixonwingy: the second
06:26wingyalexnixon: ok
06:29wingyis it idiomatic to indent the values so they start at the same line?
06:30wingyhttps://www.refheap.com/paste/6928
06:30wingymaybe not .. since that is house keeping work i perhaps don't want to spend time in
06:32alexnixonwingy: I'd generally not, as it's a maintenance burden and makes diffs nasty (imagine if you later added a :something-else-which-is-long key)
06:32pellishey guys. I'd like to add a 'metrics' module (or what would be class?) to my project. what would be the idiomatic way to write it?
06:32wingyalexnixon: yeah
06:33alexnixonwingy: there are some guidelines here (although the issues you've just raised aren't covered): http://dev.clojure.org/display/design/Library+Coding+Standards
06:36pellisi'm wondering if to implement as a record or just a bunch of functions in a file
06:39wingyalexnixon: would the indentation style be an exception in https://www.refheap.com/paste/6929
06:40wingyor like this: https://www.refheap.com/paste/6930
06:40alexnixonwingy: you mean lining up the elements of the :providers array?
06:40wingyyeah
06:40wingylook at the latest one
06:41wingywhich one is preferred .. the second one follows the first recommendation
06:41wingyand you don't end up with them too far to the right if the :key is long
06:43alexnixonI can see arguments for both, though personally I'd prefer the first as I find it easier to read
06:44wingyyeah
06:44wingyill just stick with the first one then
06:46Anderkentwingy: there's no hard rule. Do whatever looks right. I like to align values as long as key are similar length, and split keys and values on separate lines if keys are very long
06:47Anderkentwingy: on the other hand your 1-space indent looks really weird to me :P
06:48wingyAnderkent: one space indent where?
06:48wingyyou mean for the first [
06:48Anderkenteverywhere, pretty much? The first { for example
06:48wingygot it from datomic examples
06:48Anderkentwell, to each his own. As long as you're consistent, it's fine.
06:49AnderkentAnyway, anyone have any tips for debugging Midje tests? I'm having issues with prereqs - it's not calling the prereq even though the arguments seem to match.
06:49wingyhttps://www.refheap.com/paste/6931
06:49Anderkent(i.e. it says 'You never said __prereq__ would be called with these arguments:...')
06:50wingythe first one defintely looks weird .. so perhaps the second one? or the "datomic" one?
06:50wingyi'll stick to the second one .. one space indent looks weird
06:50Anderkentwingy: yes, you definitely should align the :keys
06:56Anderkent(nevermind my midje question, I'm just bad at eyeballing strings)
07:19ChironHi , I generated pom file via lein pom . what are the equivalent lein's command for mvn ?
07:31AnderkentChiron: which commands do you want?
07:32Chironlein repl , lein deps , lein test
07:32Anderkentlein test will be mvn test, you don't need to do deps (it does it automatically), don't think there's a repl by defualt unless you add a plugin (maven-clojure-plugin or zi)
07:34Chironwhat about lein compile >
07:34Chiron?
07:34Anderkentmvn compile
07:34Anderkenthm, i suppose for that to work it has to add some clojure plugin already, so you can try mvn clojure:repl for a repl
07:35Anderkentah, it doesn't. Then you can't use mvn to compile it, I guess
07:36Anderkentunless you hack on the pom yourself
07:36AnderkentI think the purpose of lein pom is just so that you can expose your lein project in a maven repository
07:36Anderkentnot to give you a maven dev setup
07:36Chironi have a clojure project and we want to add it to jenkins . the team is employing pom files . yes there is jenkins-plugin for lein
07:37Chironoh, so lein pom is to jenkins-fiy the project?
07:37Chironif yes, then I'm done :)
07:37AnderkentI don't know, sorry! I suppose you can just shell out in jenkins if nothing else helps
07:38Chironok, thanks for help!
07:39bbloomin case anybody is up early and is looking for a nice long blog post to read over their coffee...
07:39bbloomhttp://blog.brandonbloom.name/2012/11/templating-clojures-backtick.html
07:44augustlbbloom: early is relative :)
07:45p_l1241 UTC, The One Time Zone
07:45bbloomaugustl: true, my apologies for addressing the US populous
07:46bbloomaugustl: afternoon coffee is also a good time to read a long blog post :-)
07:46AnderkentSoooo, compiling midje tests seems to take forever (good 20 seconds on some files). Any reason for that?
08:01Bergle_1bbloom 1. im a noob to clojure (worked through one book), 2. that backtick write up was interesting.
08:02bbloomBergle_1: glad you liked it! as a noob, was it helpful for understanding syntax-quotes?
08:02Bergle_1yeah somewhat, i think i understood them mostly anyway. book ive worked through is Pragmatics "Programming Clojure 2nd Ed"
08:03Bergle_1i liked the context in clojure and hte why of it.
08:03bbloomcool :-) well backtick is just the first stable piece of some larger cool bits i'm planning on open sourcing
08:05bbloomI usually use outlining as a way to help myself understand things. basically write the outline of explaining it to someone else. unfortunately, it takes a long time to fully flesh out thoughts into a real post, but i decided it was time i started to do that.
08:06Bergle_1explaining verbally or written helps me think through stuff a lot.
08:06Bergle_1been writing software in assorted context for 20+ years here ;)
08:07bbloomYeah, I often must look like a crazy person talking to myself in gibberish. people walking by generally have no idea what a syntax quote is :-)
08:08Bergle_1get a wilson for your desk :)
08:08Bergle_1thats a reference to movie Castaway :)
08:08Bergle_1friend was solo at company doing dev for quite a while, so actually setup a wilson to talk to.
08:09bbloomBergle_1: tried that. I've got a little yellow platypus with a microfiber screen cleaning cloth on his belly
08:09Bergle_1heh
08:09bbloomBergle_1: doesn't help much.
08:09bbloomand it's a terrible screen cleaner :-P
08:09Bergle_1actually verbalising helps me sometimes.
08:09bordatoue`Could anyone please helpme to identify what is actually wrong with a simple binding , I am getting unmatched delimiter exception (defn check-fn [arg1 arg2]
08:09bordatoue` (let [check-arg2
08:09bordatoue` (if (= (.indexOf arg2 '@') -1)
08:09bordatoue` "-1"
08:09bordatoue` (.indexOf arg2 '@'))]
08:09bordatoue` (println check-arg2)))
08:09bordatoue`
08:09bordatoue`http://hastebin.com/vepovubiqe.lisp
08:10bordatoue`sorry about that i pressed the wrong key, really sorry..
08:10bbloombordatoue`: apostrophe is not how you represent a character
08:10bbloombordatoue`: use a backslash:
08:10bbloom&(class \@)
08:10lazybot⇒ java.lang.Character
08:11bordatoue`bbloom: thanks very much , the error was misleading
08:11bordatoue`bbloom: would you be able to tell me why i got an unmatched delimiter exception when i used wrong representation for char
08:12bbloombordatoue`: because ' consumes a token
08:13bbloombordatoue`: it's probably not precisely the right error message, but apostrophe acts like a prefix operator
08:13bordatoue`bbloom: thanks , so it might have taken it as a symbol
08:13Bergle_1i should have known better, tried intellij 12 eap version leiningen plugin project open stuff didnt work, and the La Clojure plugin isnt letting me run s-expressions in the clojure console, v11 seems fine :)
08:14bbloombordatoue`: yeah, it's basically as if you had written (x +y+) in a C-style language. that second addition operator needs an operand
08:14bordatoue`bbloom: thanks very much for clarification .
08:33Chironguys, I installed clojure-maven-plugin and run mvn clojure:repl but i got Exception in thread "main" java.lang.ClassNotFoundException: jline.console.completer.Completer
08:33Chironany ideas?
08:38andrewmcveigh|wChiron: missing dependency?
08:38Chironfrom my code or plugin's code ? because i don't use jline
08:40andrewmcveigh|wno idea? Somewhere in your deps?
08:41andrewmcveigh|wmvn tries to compile everything before putting you into a repl, iirc, unlike lein.
08:41AnderkentChiron: clojure-maven-plugin dynamically selects which repl backend to use depending on available jars
08:41AnderkentChiron: apparently it thinks you have jline available while you don't
08:41Anderkenttry adding reply or iclojure to your projects dependencies, see if it works then
08:41Chironok, thanks fellas !
08:42Anderkenthttps://github.com/talios/clojure-maven-plugin#jlineiclojurerepl-y
08:42Anderkent(if you can post your pom somewhere we might be able to trace the bug down and fix it ;P)
08:52Nocabanyone here using sublime-text and sublimerepl with clojure?
08:53Nocabwhen I try to start the repl, I get a new editor tab with the repl, Im able to write text there, Im able to transfer code tehre
08:53Nocabbut it seems like whatever I do, the code never gets executed
08:53NocabI just get the one first "current-namespace=>" prompt and thats it
08:55hcumberdaleHi, lein compile starts jetty
08:56hcumberdaleSo it never ends
08:56hcumberdaleHow can I change that?
08:56gfrederickshcumberdale: you're probably starting jetty at the top level of your file
08:56gfrederickshcumberdale: this is for a ring server?
08:56Anderkenthcumberdale: stop your code from starting jetty when compiled
08:56NocabAnderkent: that sounds like the advice I was given when debugging some multi-threaded code
08:57AnderkentI know, sorry
08:57Nocab"stop writing buggy multi-threaded code"
08:57Nocabto be honest, the response made me grin :D
08:57hcumberdaleit is actually aleph
08:57Anderkentnot much more that can be said though, the issue is obvsly in his code not usage of lein :P
08:57Nocabmhm
08:57hcumberdale(defn -main [] (start-http-server (....
08:57gfrederickshcumberdale: that looks reasonable -- so it must be that -main is being called somehow on compile?
08:57Anderkenthcumberdale: does it tell you which file it's compiling when it starts the server?
08:57hcumberdalein project clj >> :main projectname.core
08:58hcumberdaleIt's only one file in the project
08:58hcumberdale'core'
08:58Anderkentcan you upload it perhaps?
08:58hcumberdalewhich contains -main
08:59gfredericksfor sanity checking you could wrap the start-http-server call in (when-not *compile-files* ...)
08:59Anderkentlein question: I have an old project that depends on clojure 1.2 and clojure contrib 1.2. When I do lein deps; lein test, it complains about contrib not being on classpath, but when I do lein uberjar the contrib jar is there. Ideas?
08:59hcumberdaleI've found 2 solutions on google
08:59Anderkentlein deps also doesnt seem to be doing anything
09:00hcumberdale(defonce server (atom nil)) (reset! server (ring.adapter.jetty/run-jetty ,...
09:00gfredericksAnderkent: lein 1 or 2?
09:00Anderkent2
09:00hcumberdalelein2
09:00AnderkentI can see the contrib jars in my .m2/repository
09:00gfredericksAnderkent: `lein deps` I think just checks that you have the relevant jars in your ~/.m2; I also don't think there's normally any need to call it directly
09:01FoxboronMorning Clojurians
09:05pellishow can i make an atom from a string?
09:05pellisi.e. "production" to :production ?
09:05gfrederickss/atom/keyword/
09:05gfredericks,(keyword "production")
09:05clojurebot:production
09:05gfredericksatoms are reference types
09:06pellisthanks
09:16FoxboronSO getting The Joy of Clojure, Clojure Programming. Any recommended LISP/Clojure book?
09:17gfredericksSICP has probably been recommended for decades now
09:17Foxboronugh, a little expensive for me atm :/
09:18Foxboronohwait, the hardcover costed a lot more.
09:20NocabFoxboron: iirc SICP is available as a free e.pub or .mobi
09:20Nocaband if you ahve to pay for, it's probably one of those books where it's REALLY worth it
09:21NocabI mean, it's the only programming book which has wowed me
09:21Nocabit's on another level than most other books out there. it focuses on computing, problem solving in a very educational, academical manner.
09:21Nocabthat it uses lisp for its demos is just a bonus ;)
09:22Nocabgfredericks: its next on your list now :P
09:23gfredericksNocab: it's been in the back of my head for a few years
09:23gfredericksI have an automatic hesitancy to learn anything related to other lisps
09:23Nocabah well. just saying. its one of those books which just makes you want to read more :)
09:23Nocabits very focused on problem solving
09:23Nocablisp oriented problem solving
09:23gfredericksthough now that I say it I remember abedra recently convinced me to learn scheme
09:24Nocabthat it uses scheme is just an implementation detail ;)
09:24NocabI find myself reading the book thinking "i want to try this out in clojure"
09:24Nocabmakes it doubly educational
09:25Nocabits (IMO) fundamentally different from all other programming language books I've read
09:25Nocabmost books gives you "learn how to program language X"
09:25Nocabthis book gives you "learn how to solve lots of computing languages in language X, including how to make a language X interpeter in language X"
09:26Foxboroninteresting
09:26FoxboronI will look at it :D
09:26Nocabs/computing languages/computing problems/
09:26Nocabbut yeah
09:27NocabFoxboron: joy of clojure is also recommended btw
09:27Nocabso not saying you shouldnt read that
09:27Nocabclojure has a ton of specifics which is best learned in a clojure-specific book
09:28Chousukelately I've had a rekindled interest in learning haskell. lisps are cool but some of the abstractions they have in haskell-land are mindblowing
09:28FoxboronNocab, i have actually red Joy of Clojure... 1 and a half chapter
09:28Foxboron(ebook)
09:28Foxboronalso read Clojure programming a tad.
09:28Nocabah ok
09:28FoxboronSo i read protions of them before buying, always.
09:28Foxboronportions*
09:28NocabChousuke: yes. but... its just too much magic. there are too many leaps of faith for my taste
09:28Chousukejust a couple days ago I encountered something that the author called a TARDIS :P it's a combination of the state and reverse state monads
09:29FoxboronWhat thre mew off SICP is that on amazon.co.uk it got 14 1 star reviews and 16 5 star
09:29ChousukeNocab: nah, that's the thing. there's no magic.
09:29Chousukethere are just bloody awesome abstractions
09:29NocabI find haskell too different from other languages to bother
09:29NocabI mean... thats a good thing for a lanaguge, to be differnt, not to be a complete rehash of something already out there
09:30Nocabbut I only have so much time, and I just cant bother investing time in it :)
09:30Chousukeso, with this tardis monad you could model an algorithm that recurses over a list and sends data from the latter recursions to the earlier ones and vice versa
09:30Chousukeit was crazy
09:30Chousukeall purely functional, of course
09:31Nocabyes yes
09:31Nocabthere are lots of cool things Ive seen you can do
09:31Nocabbut all the explanations of HOW things works seems to pre-suppose that you already understand it
09:31Nocabwhich sorta defeats the point :P
09:31Chousukeif anything, I think everyone should take the time to read typeclassopedia.
09:32Chousukeit does a good job in explaining some of the core ebstractions and why they are awesome
09:32Nocabhttp://www.haskell.org/wikiupload/d/df/Typeclassopedia-diagram.png
09:32Nocabyou mean this? :P
09:33NocabIve tried reading up on category-theory instead of haskell, to get a higher level understanding on the subject
09:33Nocabit failed :P
09:33Foxboronlol
09:34borkdudeis it possible to write filter with reduce somehow?
09:34ChousukeNocab: honestly, category theory is not needed to understand anything that exists in haskell.
09:34FoxboronSo if i order Joy of Clojure, Clojure Programming and SICP from amazone.com, it costs 77 dollar, aka 435 Norwegian Kroner, if i just order Clojure Programming and Joy of LCojure from amazone.co.uk it costs me the same :P
09:34Chousukewell, maybe except some of the crazier thing
09:34Chousukes
09:34Foxboronthats one heck of a difference
09:35HolyJakFoxborn: sa du norsk kroner? Flott :-)
09:35FoxboronHahahaha
09:35FoxboronNeimen, sku du ha sett :D
09:35Nocabjaja
09:35Nocabdette er en engelsk kanal :P
09:35Foxboroni know :3 you started .3
09:36Foxboron:3*
09:36Negdayenborkdude: do you mean implement filter by using reduce, or combine filter and reduce into one function? either way, the answer is yes :-P
09:36borkdudeNegdayen implement filter by using reduce
09:36HolyJak:-) Hope to meet you in the ^{Oslo "Socially Functional Programmers" if you're in Oslo
09:36NocabIm sure it can be said that filter is a special implementation of reduce :P
09:37gfredericksNocab: though it's lazy while the reduce version wouldn't be
09:37FoxboronHolyJak, i am actually in Bergen :P Going to a Beer and Programming session soon :)
09:37FoxboronSHould note i started CLojure last week, and still don't know much about Functional programming yet ^^
09:38HolyJakgood luck then :)
09:38gfredericksanybody awake at this time of day have any guesses about why ##(.seq {2 2})
09:38lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap
09:40ambrosebsWas thinking of proposing Typed Clojure for contrib. Thoughts?
09:41Chousukecool.
09:41gfredericksas some who hasn't tried typed clojure yet, I am all in favor of that.
09:41ChousukeI'll actually have to try typed clojure someday
09:42Chousukesee what I can do with it.
09:43ambrosebsCool. was thinking a name like core.types or core.typed.
09:44gfrederickscore.picky-compiler
09:44Chousukewhat's the status of the library atm? can you only do type checking or is it possible to eg. make macros that have different results depending on the types of the objects?
09:44gfredericksambrosebs: I did spend half of a day reading half of your thesis and got fully excited about it
09:45ambrosebsChousuke: It's very much a 0.1 prototype atm. But so far Typed Clojure has no effect on compilation.
09:45ambrosebsFocus on safety
09:46ambrosebsIMO TC is a basic framework that people can build such things out of.
09:47qrocChousuke, what I feel the problem is with the films of the Wachowskis is that they are like 'just barely not good'
09:47ChousukeI think core.typed is the better name
09:47qrocWhich is worse than bad, because you're watching them and you're like 'Well, this is a decent concept, if this and this was different it would've been a good flick' and it keeps nagging you
09:47Chousuketypes kind of implies it will define some types that you can then use, instead of defining an actual static type checker.
09:47gfredericksChousuke: agreed
09:48ambrosebsRight. My concern is that "Typed Clojure" implies "a version of Clojure that is typed". Which is totally incorrect.
09:48Chousukeambrosebs: or you could just make it core.typechecking
09:48ambrosebscore.typed is perhaps less susceptible to that misconception.
09:49pellisany idea how to make my redis instance available to all modules? *cough*global variable?*cough*
09:50ambrosebsSeems a bit watered down, since it's a "type system"
09:50Chousukecore.silverbullet :>
09:51ambrosebspow
09:51gfrederickscore.scala
09:51ambrosebscore.typed-clojure
09:51Chousukewell, if it's a typesystem... it could just be core.typesystem
09:51andrewmcveigh|wcore.tysy
09:51ambrosebshaha that just sounds so cold and dead.
09:52ambrosebscore.typed allows you to keep informally calling it Typed Clojure
09:53Chousukecore.want-a-haskell :P
09:53ambrosebstough act to follow :)
09:53qrocAre we talking about a fully fledged type hierarchy
09:53Chousukebut yeah, I think typed is fine
09:53qrocspecfically, do we get that (if cond then else) is typed as the union of then and else?
09:54qrocAnd if a continuation demands a certain type, it can consume that type and all its subtypes.
09:54qrocAnd do we get type variables?
09:54qrocElse Chousuke doesn't approve.
09:54qrocOnly the finest type systems for the finest finn in this channel, 'tis as eating less than top quality reindeer.
09:54Chousuke:P
09:55qrocChousuke, how does one pronounce Chousuke?
09:56Chousukehm, I don't have a way of typing IPA
09:56qrocHmm
09:56gfrederickslet's just say chouSOOkee and let everybody interpret that how they will
09:56qrocWell, tiousukei, tiousookii?
09:56qroctiousuuk?
09:56Chousukethe su and ke are short.
09:57ambrosebsqroc: lol? Sounds like Typed Clojure
09:57qrocgfredericks, Chousuke is the finest finn in this channel built from the finest of ruisleipä
09:57qrocambrosebs, is that bad?
09:57Chousuke:P
09:58qrocBehold how fine he is: Chousuke: istu, koira.
09:58ambrosebsqroc: haha I just missed the relevance of listing those features :)
09:58qrocWell, I'm asking if it has them
09:58qrocnot listing them.
09:58ambrosebsyes!
09:58qrocExcellent
09:58Chousukeambrosebs: now I want to test if I can bend TC to implement monads so that I can choose the monad operations to use without actually explicitly choosing the monad like in contrib monads
09:59qrocso we're not talking about some kind of stupid hindly-milner like system that Crapskell has?
09:59ambrosebsChousuke: that would be badass
09:59ambrosebsqroc: we're talking Typed Racket.
09:59qrocAh yes
09:59qrocexcellent
09:59ambrosebsindeed
09:59Chousukebut alas, I am required to be elsewhere right now, so it will have to wait.
09:59qrocAs expected from the finest of Finns in this channel, nyt istu, koira.
10:00Chousuke:P
10:00qrocSiis mä syötän sut ruisleivällä
10:01qrocsyötän suomalaispäähäsi
10:01ChousukeI still fail to understand what you are trying to accomplish with your random Finnish
10:02hughfdjacksonwhat determines what gets in core?
10:03Chousukerhickey, mostly.
10:03hughfdjacksonmakes sense ^^
10:03qrochughfdjackson, the finest les miserables fan in this channel.
10:03Chousukecontrib may have an easier process, dunno.
10:03qrocChousuke, learning to speak the finest Finnish in this channel of course.
10:04ChousukeYou should join Finnish channels for that instead.
10:04qrocThere is one, it has 4 users.
10:04Chousukejoin and spectate
10:04qrocOh, in that way
10:04qrocYeah, I am in #starcraft2.fi on quake
10:04qrocthere too, I speak the finest finnish
10:04qrocAnd they are like 'this guy is insane, let's not ban him because it's hilarious'
10:04Chousukeyeah, well, that's what you make yourself look like most of the time.
10:05hcumberdaledoes rhickey join #clojure frequently?
10:05Chousukebut I have to be going now, so later :P
10:06qrocChousuke, what is insanity but a square man's term for interesting?
10:07qrocChousuke, jos olisin kissa, mulla olisi pyörät ja olisin robokissa.
10:07qrocnopeain kissä maailmalla
10:20brainproxyChousuke: you get something like that with protocol-monads
10:22gfredericksif you try to define monads with protocols don't you run into an issue with pure?
10:23brainproxygfredericks: i'm not sure what you mean, can you elaborate?
10:23gfredericksbrainproxy: (pure 42) should return what type?
10:24gfredericksor I guess the haskell term is (return 42)
10:24brainproxyso, if I understand correctly, w/ protocol-monads that's basically inferred or made explicit with a factory function
10:25brainproxye.g. (monads.core/plus [(list 1) (list 2)]) will use the monad defined on clojure.lang.PersistentList
10:25brainproxybecause list returns type clojure.lang.PersistentList
10:25gfrederickssure
10:25gfredericksbut with return you don't have an instance on hand whose type you can dispatch on
10:26brainproxyright, so that is a limitation but also "feature" of how p-m works
10:26gfredericksso you define a separate return for each monad?
10:26brainproxyyep, called "do-result"
10:26gfredericksgotcha
10:26gfrederickskthx :)
10:26brainproxythere is also "do" notation
10:27brainproxy(m/do list [...] expr)
10:27brainproxyand optional return-type checking
10:27gfredericksI wanted the writer monad the other day
10:28brainproxy(binding [m/*check-types* true] (m/do list [x (list 1 2) y (into #{} (list 2 4))] [x y])
10:28brainproxywill throw an exception
10:28brainproxysince #{2 4} doesn't satisfy java.util.List
10:29brainproxytrivial example, but anyway that's the idea
10:29gfrederickscool
10:29brainproxyand the writer monad is available
10:29brainproxyas is writer transformer
10:29brainproxyI ported over the examples from algo.monads, here: https://github.com/michaelsbradleyjr/protocol-monads/blob/master/src/monads/examples.clj#L248
10:30brainproxythere are two writer monad examples in there
10:30brainproxybut no writer-t examples
10:30brainproxybtw, my work is not merge back into the parent project, but my 1.1.0-SNAPSHOT is available on clojars
10:31brainproxyjust search for monads
10:32brainproxyall in all, i'd say the library is still pretty rough around the edges, but usable
10:34pellisim stuck
10:34pellisif I implement an abstraction, as a protocol, lets say Engine
10:34pellisand now i implement a concrete defrecord V8Engine
10:34pellisand now I want the V8Engine to be available to every module in my code - what should I do? usually in Java i'd put it in an IoC container
10:39lucianpellis: what's wrong with importing it?
10:40pelliswell it would make a new instance of it every time - i want what would appear as a singleton
10:41lucianpellis: then you can make an instance of it in a module and import that
10:41pellisi wouldn't know how to configure it until runtime
10:42pellisi have the 'core' application, loads up the configuration, and then its responsible to set up all of the database connections, etc.
10:42lucianyou can make the instance at runtime
10:42pellisthat's what i'm trying to do
10:42luciansimplest way might be a get-engine function that caches in a private var
10:43pellisyea, but I can't seem to be able to do that mutation on a private var (def)
10:43lucianyou only bind it once
10:43lucianyou can be careful about how you bind it
10:44pellisbut if I bind it from within a function, won't it be avalable to the function scope only?
10:44pellislike a (def instance 1) from within a functoin, and then I expect to be accessing it from module/instance ?
10:44lucianpellis: in the function engines/get-engine, you can bind engines/engine-singleton and return it
10:45pellishow
10:45pellis?
10:45gfredericksyou can use an atom
10:45pellisyea, i've tried using an atom, ref etc. but it seems i have to maintain quite a bit (map) for a simple instance
10:45gfredericks(let [engine (atom nil), make-engine (fn [config] ...)] (defn get-engine [] (or @engine (reset! engine (make-engine some-config)))))
10:46pellishmm.. ill look at that one
10:46gfredericksor probably a delay would be even simpler
10:46ambrosebsok I proposed core.typed on clojure-dev.
10:46AnderkentIs there a difference between `(my list contents) and '(my list contents) if i'm not in a macro?
10:46gfredericks(let [engine (delay ...do stuff with config...)] (defn get-engine [] @engine))
10:46gfredericksAnderkent: yeah
10:47gfredericks,'(my list contents)
10:47clojurebot(my list contents)
10:47gfredericks,`(my list contents)
10:47clojurebot(sandbox/my clojure.core/list sandbox/contents)
10:47Anderkentright thanks
10:47gfredericksAnderkent: also you can unquote with `
10:48gfredericksAnderkent: backquote is independent of macros; macros are merely its 99% use case
10:50Anderkentright. It's hard to search for these, and obviously (doc ') does not work :P
10:51pellisany idea why this happens: Parameter declaration clojure.core/deref should be a vector
10:51tgoossensanyone already played with the java 8 lambda syntax? I just figured out that they are planning to support it in the next java version.
10:52gfrederickspellis: you left out the arglist from a function?
10:52lucianpellis: this sort of works too https://gist.github.com/52584d0c240fa9399702
10:52lucianpellis: it's similar to how java singletons work, with the same problems
10:53gfredericksvars are a bit nicer than singletons for global stuff, since you can rebind them locally if you like
10:54pellislucian: how can this define a root binding?
10:54pellisi tried that before and it blew up on me
10:54gfredericksdef works inside functions
10:54lucianyeah, gfredericks's example is nicer overall
10:54gfredericksit just makes people angry
10:55pellisso is there any way i can not do (work (get-engine)) but (work get-engine) ?
10:56lucianpellis: i don't know. but the explicit call is nicer. it makes it clear what's going on
10:56gfredericksyou can do what lucian does, which should work, or equivalently try (alter-var-root #'engine (constantly (make-engine)))
10:57pellisok
10:58gfrederickswhich makes fewer people angry
10:58pellisi'd like to have (engine/set-instance ... ) (engine/method1 ...) etc
10:59gfredericksset-instance can perform the alter-var-root for you
10:59pellisyea... hmm i'm trying to avoid duplicating all of the method signatures though, because engine is also a protocol Engine
10:59gfredericksif this were me, I'd have a slightly more functional approach of making the var dynamic, and setting it at the entry-point to the application
10:59pellisso i will have a protocol Engine, and then i will have that many methods in the engine.clj file so that i can require and do engine/method
11:04gfredericksthe dynamic var option makes testing a lot easier
11:05tomoj(defonce ^:dynamic *engine* (make-engine)) ?
11:05pelliswell, im kinda stuck now infront of having to duplicate a ton of code just to have an (engine/work) kind of flow
11:05pellis(engine/work) will delegate #work to the current engine instance
11:06pellisand it will call (work @engine-instance)
11:07ucbI recall a discussion about agents using a pool of threads of size 2 * number of cores, where's this stuff documented? And what's a good library for multithreading in clojure?
11:08pelliswow i feel like i'm working so hard to implement such a wrong code. i haven't done a set-instance and global singletons since i've been young and stupid.
11:13tgoossensHow do you document that the function you expect has certain properties. Like: two parameters, first a coll and second a vector
11:13bbloomtgoossens: generally with careful prose
11:13bbloom,(doc reduce)
11:14clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
11:14bbloomtgoossens: there are lots more examples in core
11:14tgoossensok
11:15tgoossensI have a mixed feeling about it. Maybe because its only recently that my only experience was Java.
11:15tgoossensEg:
11:15tgoossensFunction1<Integer,Integer> increment
11:15tgoossensand you know there will be
11:16tgoossensan .apply(int)
11:16tgoossensi think that that is a good api.
11:16tgoossensI'm still struggling with that
11:16tgoossensin clojure
11:17tgoossensbecause i cannot enforce that you accept only a function with certain properties
11:17tgoossenshow do programmers in clojure cope with this?
11:17tgoossensto write robust api's?
11:17bbloomtgoossens: by running smaller pieces of code much more often
11:17bbloomtgoossens: the result is that you're more likely to get an error closer to it's source
11:18bbloomIt's a very different style of working
11:18bbloomIn a statically typed language, such as Java, and to a lesser extent a language like Haskell, you'll write a large program and rely on the type check to validate many properties of your program
11:18tgoossenscorrect
11:19bbloomin a dynamic language, and especially true of one with a powerful REPL, you generally run each new little bit of code as you implement it
11:19bbloomand you test a bunch of inputs
11:19Wild_Catactually, I'd argue that you rely on it *more* in Haskell, simply due to the immense power of its type system
11:19Wild_Cat(which manages to do a lot of it automatiacally, and is much harder to subvert than Java's)
11:19bbloomWild_Cat: *shrug* not really interested in debating, just trying to explain the overall style
11:19tgoossenspart of my confusion perhaps is that this is the first time i work with a dynamically typed language
11:19Wild_Catbbloom: I agree with the core of your explanation, though.
11:19bbloomtgoossens: for sure
11:20bbloomtgoossens: if you wait until your program is structurally complete to run it, you'll be in for a world of hurt in clojure
11:20bbloombecause you'll need to debug a deep call stack with limited insight
11:20tgoossensso what you are saying
11:20Wild_Cattgoossens: a nice property of dynamically-typed languages is that it allows people to reuse your code in interesting ways you didn't initially plan for
11:21bbloomif you run very small pieces of new code as you write, you'll get a stack trace and you can IGNORE the stack trace b/c 9 out of 10 times, the bug is in the code you JUST WROTE
11:21tgoossensprogramming style is very close to the TDD paradigm?
11:21bbloomtgoossens: yes, feels like TDD
11:21bbloomit's very common for people to put a big (comment ……… ) form at the bottom of a file filed with expressions
11:21bbloomand people use evaluate expressions as they work
11:21Wild_Cat(for example, Python's "file-like objects" allows you to take most function/methods initially written with files in mind and apply them to network streams, in-memory StringIO objects and whatever else, without needing to refactor the initial API)
11:22bbloomrather than running a full test suite, you run just the expressions that are relevant to the changes you just made
11:22Wild_Catand yeah, write lots of tests.
11:23bbloomthe primary difference, i'd say, between what most people do with clojure, and true TDD, is that TDD expects you'll have a fully automated test suite. you can run all your tests at once. where as clojure devs tend to run just one or two tests at a time
11:23tgoossenshmmm
11:23bbloomwhen coupled with pure functions, you can run your tests in any order you like
11:23bbloomif your number of tests eventually gets large, you can start to automate suites of them
11:24tgoossensso far in clojure i had a big file full of tests, testing every function for different input (using jayc expectations lib)
11:24Wild_Catbbloom: leiningen offers a nice repeatable testing framework, though
11:24bbloomWild_Cat: yes, which i highly recommend that people use once their programs start to grow :-)
11:25Wild_Catagreed ^^
11:25bbloomgenerally, my code and test suites look like this: (defn double [x] (* 2 x)) (comment (double 5))
11:25tgoossensOk lets try this: So when i'm using a clojure library. And i've just written a function that does something with that library. Then afterwards i make a test for it
11:25tgoossensoh
11:25bbloomi just eval (double 5)
11:25bbloomi know it's supposed to be 10
11:25tgoossensnow i see
11:26bbloombut if it's complex, i'll add a comment ; 10
11:26tgoossensnever saw the comment before
11:26bbloomtgoossens: a great example is at the bottom of zip.clj https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj
11:27tgoossensreading..
11:27bbloomnotice how there's just a bunch of code that rich was using to test things out
11:27bbloomno assertions or anything
11:27bbloomif you change the zip library, then a human needs to validate those test cases by evaluating them
11:27bbloomfor a small library, that's totally OK!
11:29tgoossensthose expression in the comment
11:29tgoossensare that the things he tested in the repl then
11:29bbloomtgoossens: yup
11:29tgoossensso you write a piece of code and you test it in a few ways using the repl
11:29bbloomyou got it
11:30tgoossensand then you put those "tests" in a comment
11:30tgoossensalmost there i guess. but
11:30bbloomyup, and then automation of tests is a separate concern
11:30tgoossenswhat can other developers do with those expr. in the comment
11:31bbloomwell, if i wanted to change zip.clj, i would have some test cases to try :-)
11:31bbloomgenerally, clojure development happens side by side with a REPL and an editor
11:31bbloomyou write some code in the editor and send it to the repl as you write it
11:31bbloomevery time you change a piece of code, you send it to the editor
11:31tgoossensyes. But what i mean is. Nowhere in that comment there is written what de the developer was expecting to happen if he executed it
11:32bbloomtgoossens: well, it's usually obvious for most simple functions
11:32bbloomtgoossens: but if it's not, you can write it down :-)
11:32bbloomi usually just tack on a comment ; [5 :foo]
11:33tgoossensok
11:33bbloomif you're more comfortable with explicit assertions, then use one:
11:33bbloom(assert (= 10 (double 5)))
11:34tgoossensok
11:35tgoossensi noticed this in certain functions in zip.clj
11:35tgoossens(defn remove {:added "1.0"} ...)
11:35tgoossenswhat does that mena?
11:35AnderkentIdiomatic way to change a value in a map? I.e. {:a 1} -> {:a (f 1)}. Best I came up with was (assoc (dissoc map key) key (f (get map key))), which is highly meh
11:35tgoossensanderkent: (assoc map key newvalue)
11:35Anderkenttgoossens: functions can have metadata
11:35bbloomAnderkent: update-in
11:35Anderkentbbloom: thanks
11:36bbloom,(update-in {:a 1} [:a] inc)
11:36clojurebot{:a 2}
11:36Anderkentyes it's exactly what i was looking for, just didn't know the name :P
11:36tgoossens,(assoc {:a 1} :a 2)
11:36clojurebot{:a 2}
11:37tgoossensok
11:37bbloomtgoossens: that's just saying what version of clojure the function appeared in. it's structured documentation. sorta like /** @author */ comments in java
11:38tgoossensok cool
11:42tgoossensbblooms: thanks!
11:43iosicadoes anybody know how is it possible to dump REPL compiled statements to class file?
11:46antares_iosica: it is not possible
11:46iosicawhy?
11:46clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
11:47antares_iosica: to start with, because .class format has pretty strict structure and what you enter in the REPL is completely free form
11:47antares_iosica: another reason is that nobody needed it badly enough to implement it. REPL history is supported.
11:48iosicabut if I'd write history of repl to a user.clj and compile that
11:48iosicait would compile
11:48iosicaalso repl is compiling on the fly
11:48iosicaso it is jvm bytecode
12:10tgoossensanyone experience with sublimeREPl with clojure?
12:18FrozenlockHow does one push a java library jar to clojar?
12:18gfrederickssame as a regular jar
12:19FrozenlockWell regular jar I just do lein push :P
12:19FrozenlockIt's magic!
12:19gfredericksdoesn't clojars have instructions for scp?
12:19Guest75802what do you think about slingshot?
12:20FrozenlockI found this: https://github.com/ato/clojars-web/wiki/pushing, but I'm not sure where and what I should put in the pom.xml
12:21gfredericksoh you don't have a pom?
12:21gfredericksyou could run `lein pom` for your project and adapt that
12:23FrozenlockThat's the thing, it's a simple java library (not clojure), so there's not any project.clj.
12:23Guest75802Should I use slingshot or avoid it?
12:23gfredericksGuest75802: I think its good
12:23Guest75802Last commit is 4 month ago
12:23Guest75802People reporting problems to catch all exceptions
12:23Guest75802more dependencies
12:24Guest75802Don't know about the native clojure exception handling and it's drawbacls
12:24Guest75802drawbacks,...
12:24antares_Guest75802: 4 months should not worry you. I find Slignshot not worth using.
12:25antares_some projects simply get to the point when they work and there isn't much you can add or really improve
12:25AnderkentAny way to get a symbol from a var? I.e. the opposite of resolve?
12:25Guest75802antares_ , thx
12:25gfredericksFrozenlock: `find ~/.m2 -name '*.pom' | shuf | head -1 | xargs cat`
12:25Guest75802I'll have a look at the native exception handling
12:26Guest75802what would you suggest for validation of input data?
12:27gfredericks,(-> #'clojure.core/first meta :name)
12:27clojurebotfirst
12:27gfredericksAnderkent: ^
12:27Anderkentthanks
12:27Guest75802I don't get the point about when to write things by myself and when to use libs. The Java world is full of bad libs full of bugs. The 'feeling' when to write things by your own seems not to be adoptable to the 'native' clojure libs
12:28gfredericksGuest75802: asking in #clojure is a reasonable way to sanity-check :)
12:28Guest75802I'm also missing discussion about what is really worth using on my google adventures ;)
12:29Guest75802gfredericks, a page with 'verified worth using libs' would be a great thing
12:29gfredericksthat sounds controversial
12:30Guest75802There is a http://clojure.org/libraries , only listning contrib, lein ,...
12:33Frozenlockgfredericks: Thanks, I'll try to fiddle with this :)
12:40Guest75802If I use a fn to resolve all entries with a specified extension in a dir and pass them to a second fn, should I test them for file?
12:40Guest75802And absoulte?
12:41Guest75802Or take the afford to test it while filtering the list of files for a specified extension?
12:51maleghastEvening All
12:51gfredericksgood evening europe
12:53Anderkentgeh, now getting bit by the lack of .toString on lazy seqs... Annoying!
12:53antares_maleghast: hi
12:53maleghastantares_: Hi there...
12:53antares_maleghast: I pushed core.cache implementation to Spyglass, 1.1.0-SNAPSHOT should have it
12:53gfredericksAnderkent: maybe you want pr-str instead?
12:53maleghastI saw your commit on the SpyGlass code - thanks :-)
12:54maleghastI am going to have to try and get my head around how to use it now :-)
12:54maleghastDid you find a way to limit the re-try policy as well, by any chance?
12:55Anderkentgfredericks: thanks again
13:01cheezeyhow can i get the Class object of a certain class ?
13:01cheezeylike Object.class equivalent in java
13:02maleghastI gotta go - see you all around!
13:03alexnixoncheezey: (class x)
13:04Anderkentthat's on an instance, I think he ment statically
13:04alexnixonah
13:04edlothioljust write the class name
13:04edlothiol,Object
13:04clojurebotjava.lang.Object
13:05cheezeyOh okay
13:05cheezeythnx
13:16iosicauser=> (type Object)
13:16iosicajava.lang.Class
13:16iosicauser=> (type Integer)
13:16iosicajava.lang.Class
13:16iosicauser=> (class 1)
13:16iosicajava.lang.Long
13:17iosicauser=> Object
13:17iosicajava.lang.Object
13:17iosicauser=> Integer
13:17iosicajava.lang.Integer
13:17gfrederickso_O
13:19yedilearning by doing is such a superior strategy
13:33yediis there a function that returns the key(s) of a given value in a map?
13:35gfredericks,(let [m {:foo 7 :bar 8 :baz 7}] ((group-by m (keys m)) 7))
13:35clojurebot[:foo :baz]
13:36gfredericksI guess that's not the most efficientest though
13:37gfredericks,(let [m {:foo 7 :bar 8 :baz 7}] (->> m (filter (comp #{7} val)) (map key)))
13:37clojurebot(:foo :baz)
13:40Chousukebrainproxy: I actually have a gist somewhere that implements monads using protocols with a couple dozen lines of code :P
13:42yedistill need to figure out how the ->> works
13:42yedimacro works*
13:43Chousukeheh, found it. I like the docstring on lift.
13:43Chousukehttps://gist.github.com/312137
13:45ambrosebslol
13:53ambrosebsa few more Typed Clojure contrib names: core.static-types, core.optional-types, core.gradual-types
13:55HolyJakcore.types or .typed sounds best to me :)
13:55bbloomambrosebs: shorter is better
13:55bbloomi like core.types
13:57ambrosebscore.types is easiest to say also. :)
13:58ambrosebsthere was a previous contrib IIRC called something similar to core.types
13:58ambrosebsas in , nonmodular contrib
13:58ambrosebshad nothing to do with static type checking
13:59ambrosebshere's hoping in a few years we'll get clojure.types :)
13:59lynaghkwhaaa worst cljs bug ever: function parameter name overwrites global namespace in scope of fn.
14:01yediany help with this: https://gist.github.com/4136844
14:01bbloomlynaghk: gah! i thought that was fixed
14:01bbloomlynaghk: what version are you using?
14:01lynaghkI'm using lein cljsbuild 0.2.7
14:02bbloomah, have you tried using clojurescript master? you can easily set that up
14:02lynaghkbbloom: I'm waiting for the 0.3.0 to drop, because there are some regressions in cljs r1503 and r1513 that blow my shit.
14:03bbloomlynaghk: which ones? i dunno because i just always work agains thead
14:03bbloomer master
14:03lynaghkbbloom: which regressions? Not sure---something goes wrong with my reflex library, which is nasty to debug as it is
14:04lynaghkbbloom: so I just tested against master and saw that it was fixed---I didn't try to isolate the underlying regression.
14:04bbloomlynaghk: if you isolate it, maybe dnolen or I would fix it for you :-)
14:04bbloomfree work!
14:05lynaghkbbloom: it's fixed in master, I just don't know where or how
14:05lynaghkbbloom: if I tried to track down the underlying cause of every single bug I ran into, I'd never get any work done =)
14:05bbloomah, ok misread you a second ago
14:05bbloomglad it's working :-)
14:06bbloomhow's the graphics lib coming?
14:06thorwilyedi: i don't think you're doing yourself a favor with having classify-lines group the lines
14:06yedithorwil: why's that
14:06lynaghkbbloom: pretty well, dnolen has been awesome in getting core.logic stuff cut out
14:07lynaghkbbloom: waiting for some constraint stuff + lvar "if-not-unified-with" defaults to drop, then I'll throw down a ton of rewrite rules and roll out to alpha folks
14:08thorwilyedi: rather classify the first line, note it's an "a". check next line, if it's the same class, append "a", else "b" ...
14:08bbloomlynaghk: cool!
14:08thorwilyedi: so you have to walk the poem only once and don't need complicated mechanism to make sense of the grouped lines
14:08lynaghkbbloom: yeah, it's pretty rad. How is your stuff coming along?
14:09gfredericksI'm thinking I want some sort of low-level clojure library for assembling SVG images
14:09gfredericksmaybe by passing in a hiccup-like data structure, and with a lot of helper functions
14:09bbloomlynaghk: pretty well. i've been making some good progress on bits and pieces of my clojurescript libs
14:09gfredericksam I describing something that already exists anywhere?
14:09bbloomgfredericks: you should listen to what i'm about to say to lynaghk
14:10bbloomso i wanted a more declarative way to work with the dom
14:10bbloomhiccup is cool for static html, but not great for dynamic stuff
14:10bbloomso i had the realization that a postfix notation is perfect for creating and manipulating dom trees without ever having to refer to elements by name
14:10bbloomexample would be this code that would create a button and append it to the screen:
14:11bbloom"body" select first "div" tag "button" class "i am a button" text append
14:11bblooma little hard to read on one line
14:11bbloomanyway, the same general idea would work splendedly for SVG
14:11gfredericksmy use case is more static than dynamc
14:12gfredericksI just want a functional data-driven way to describe an SVG image
14:12bbloomstill, the resulting code is kinda halfway between hiccup and enlive
14:12gfredericksI forget does hiccup officially support generic xml generation?
14:12bbloomdunno
14:12bbloomi'll keep svg in mind with the work i'm doing tho
14:13lynaghkbbloom: I saw you making noise about that. The merits of that over the existing approaches aren't immediately clear to me. It's a total trope at this point, but it'd be helpful if you put together a todoMVC implementation to show it off.
14:13bbloomlynaghk: heh, was considering it
14:13lynaghkbbloom: I am kind of tempted to start a todoFRP project with the same goal.
14:13lynaghkespecially since "FRP" is about as meaningless at this point as "MVC" = )
14:13bbloomlynaghk: I've studied the FRP stuff a bunch and i'm just not sold yet
14:14bbloomlynaghk: seems like something that demos well but sucks in reality
14:14bblooma lot of FRP systems seem to do signals and transformers and some other stream-oriented metaphore
14:14bbloombut i think that the identity/value split makes more sense
14:15lynaghkbbloom: yeah, me too. Though most of the time it's not clear what people mean by "FRP". I think the way I use C2/Reflex is "FRP"ish and that works out pretty well. My big issue now is translating DOM events back into the data space. Doing data->DOM mapping is pretty straightforward with my stuff (though not always super performant).
14:15bbloomi've been thinking about doing a property model where you send it property changes, just like you send EAVs to datomic, but then a constraint solver propegates the property changes via bindings
14:15gfredericksfibre-reinforced plastic is what google says
14:16lynaghkbbloom: that sounds like it might be cool. Please submit a todoFRP =P
14:16bbloomlynaghk: yeah, i haven't deeply considered dom events deeply
14:16bbloomlynaghk: i just kinda am assuming that if no one but me touches the dom, i can listen to a subset of events that are "complete" ignoring people fucking around in the web inspector
14:16bbloombut that might just be wishful thinking
14:17lynaghkbbloom: that assumption is not tenable for the kind of work I do. We use things like "FastClick" and Cordova to do mobile stuff, and they shim the browser and patch into the native event system sometimes
14:19bbloomlynaghk: *sigh* damn browsers
14:20yedithorwil: thanks for the advice, i'll try that out
14:20bbloomlynaghk: hmmm fastclick says it creates a synthetic click event
14:20bbloomthat shouldn't be an issue
14:20lynaghkbbloom: also, after writing/using Hiccup-based stuff for the past year, I'm not convinced the benefits (primarily, "YAY, it's Clojure!") outweigh the costs (all designers hate it; takes a lot of discipline to separate logic/view)
14:21tomojwhat's the problem listening to a subset of events?
14:21bbloomlynaghk: well if you have designers and want them to do templates, then you use a designer friendly template language… preferably one that you can open in a browser just renders reasonably
14:21thorwilyedi: on further thinking, try to seed reduce with [] and build the list of rhyme-types. only afterwards map that to "a"s and "b"s
14:21lynaghkbbloom: the bigger issue is that "no one but me touches the DOM". That's one thing if you can scope everything by element/selectors, but there have been times where we've needed to use some external JS to manipulate bits of the DOM but still want to do most of the handling in cljs.
14:22bbloomlynaghk: that's fine as long as the external JS only manipulates bits of the DOM in ways you can understand
14:22yedithorwil: so instead of grouping it by the rhyme-types, I should just build a list of the rhyme types and reduce over it
14:22lynaghkbbloom: right, but then you can't use something like Singult to do dom updates/merging without hella duplication.
14:23lynaghkbbloom: anyway, I find this very difficult to talk about without the context of a particular application. Maybe if you're in PDX for Clojure/west we'll have some working next-generation cljs+DOM systems to show off = )
14:24thorwilyedi: almost. build the list of rhyme-types via reduce. the mapping to a/b might be another reduce or something else entirely
14:24bbloomlynaghk: i've deferred a lot of thinking for now. i'm trying to work up from the bottom…. i've gotten side tracked by implementing a concatenative language layer :-)
14:24lynaghkbbloom: classic nerd trap =P
14:24bbloomlynaghk: heh, well i have a working prototype and it's < 30 lines or so
14:25bbloomlynaghk: and i copy pasted the gmail dom into a file, ran a script to convert it to my little DSL, and then ran that: 350ms!
14:25bbloomwhich is pretty good for totally unoptimized interpreter
14:25bbloombuilds the whole gmail UI from a little postfix notation program :-)
14:25thorwillynaghk: i vaguely recall a html->hiccup project. does or would that help with the designers?
14:26lynaghkthorwil: No; maintaining hiccup would just be another slowdown step during iterations, and it's likely the two sources would diverge.
14:27lynaghkthorwil: the tools most web designers are familiar with are optimized around html/css. Editors have good intergation with the base, as well as more established DSLs like HAML, SASS, and so on.
14:28lynaghkthorwil: ultimately my issue with hiccup comes down to a problem representing markup in the application code. Sometimes that is what you want and it makes things cleaner/shorter, but other times it is a huge pain.
14:28bbloomlynaghk: gotta run for a bit, but i promise a cool demo soon :-)
14:28lynaghkthorwil: I think Angular.js's approach is very interesting, but how to integrate it with cljs is still up in the air: https://gist.github.com/3856153
14:28lynaghkbbloom: looking forward to it!
14:31thorwillynaghk: i understand that hiccup is a problem when working with others. enlive becomes problematic because of the tightly couple code you need. template languages with placeholders and such suck if there's no support in the editor and if a "unique" language ends up integrated
14:32lynaghkthorwil: agreed on all points. My feelings go back and forth on "semantic templates" with mini languages
14:35Guest75802lynaghk I do not use hiccup and I do not use enlive
14:36Guest75802Thinking enlive is just to complicated and does not work with 'designers', to choose CSS classes for template mechanisms seems wrong
14:36Guest75802hiccup is mixing code and design, which is bad
14:36Guest75802you can seperate hiccup code in own namespaces, but it still feels wrong
14:37thorwilsounds like dogmatic thinking
14:37Guest75802thorwil, y?
14:38thorwilcleanly separating "code" and "design" seems a good idea, until you arrive at those cases where both touch and intermingle
14:38Guest75802Provide use-cases
14:38thorwiland enlive is not limited to selecting by css class
14:39Guest75802For example Mustache is language agnostic
14:39Guest75802Works like string-template
14:39Guest75802and clearly seperates logic from presentation because the templates are logicless
14:40lynaghkGuest75802: one of the reasons I've written so many libraries around hiccup is because I do data visualization, where there is quite a bit of logic related to the markup. I.e., passing a ton of parameters via a single map would be unrealistic.
14:40Guest75802'stencil' and 'clostache' are good frameworks for clojure
14:40lynaghkGuest75802: it couples markup/code in the same way that, e.g., D3 couples the two.
14:40Guest75802D3?
14:41lynaghkD3.js
14:41Guest75802ahh
14:42Guest75802when you use D3 providing the raw data behind a 'ajax' service may be the best idea?
14:43lynaghkGuest75802: I'm not sure what you mean. I've got to run at the moment, though. sorry!
14:44Guest75802lynaghk when you do so much in javascript, there should be a better alternative to hiccup like just providing raw data for D3.js
14:44yedi(ns rhyme-finder.core
14:44yedi (use [clojure.contrib.seq-utils :only (positions)]))
14:44yedii'm getting this error: java.io.FileNotFoundException: Could not locate clojure/contrib/seq_utils__init.class or clojure/contrib/seq_utils.clj on classpath:
14:45Guest75802yedi tried 'lein clean && lein deps'
14:45Guest75802?
14:45thorwilyedi: do you really have "use" there, not ":use"?
14:45lynaghkGuest75802: my point is that I'm using Hiccup in the same way that people use D3---to generate markup from "raw data"
14:46gfredericksthorwil: I think it works either way
14:46Guest75802lynaghk, ahh okay.
14:46lynaghkGuest75802: that is inherently coupling code and markup.
14:46yediGuest75802: I just ran it in my terminal, but I still get the error when executing C-c C-n in emacs
14:46Guest75802Never seen hiccup in such a combination
14:46yedithorwil: I'm not sure of what the distinction is, gimme a sec
14:47lynaghkGuest75802: I wrote C2 (a D3 port to clj/cljs) that does exactly that. So my typical use case maybe be very skewed compared to how most people use Hiccup =)
14:47thorwilyedi: use and require are functions. :use and :require a keys that the ns form will translate
14:47yediah
14:48yediyea, still getting the same error
14:49Guest75802lynaghk, sorry then. Just thought about the common hiccup using projects at github
14:50Guest75802yedi clojure-version in project.clj? Dependency to seq-utils included?
14:51yedi :dependencies [[org.clojure/clojure "1.4.0"]])
14:52yedii have to include a dependency to seq-utils in my project.clj file?
14:52gfredericksyes
14:52gfredericksto clojure-contrib
14:52thorwilisn't clojure contrib dead, only for pre 1.4 clojure?
14:52Guest75802yedi in clojure 1.4 yes
14:52Guest75802contrib isn't a part of clojure since 1.3...?
14:53yediif it's deprecated, should I avoid using fns from there?
14:53Guest75802thorwil, yes. Not included anymore. A lot projects are now existing as own github projects
14:53gfredericks~contrib
14:53clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
14:54gfredericksI don't remember contrib ever being packed in the same jar; only that `lein new` automatically included it in the project.clj
14:57thorwili wonder how i could write a test for my routing (moustache, not compojure), without checking what the actual handlers deliver. i.e i only want to test which handler is called and that everything that should go 404 goes 404
14:57gfredericksare "handlers" vars?
14:58thorwilgfredericks: moustache expects functions taking one argument, just like compojure(?)
14:59TehranForeverChousuke is the finest Finn of this channel.
14:59Iceland_jackTehranForever: what about me?
14:59gfredericksmore finn comments?
15:00thorwilcould/should my test define all the handler names to fns specific to the test?
15:00Guest75802Is there a good way to clean up my (:use ... by any tool?
15:00Guest75802like java import optimizers?
15:00gfredericksGuest75802: slamhound _might_? I haven't tried it
15:01Guest75802gfredericks, have tried it. It can't work with a lot of things
15:01Guest75802produced a lot of quirx
15:01Guest75802;)
15:01pjstadighas slamhound been updated for (:use [... :refer [...]])?
15:08yediis there a fn to append to a vector? instead of having to do (assoc vec (count vec) <new item>)
15:08Guest75802pjstadig had similar problems with :use ... :only ...
15:08gfredericksyedi: conj
15:08Guest75802yedi conj
15:08yedioh duh right
15:08RaynesWow.
15:09RaynesYou knew that you could assoc to a vector, but you didn't know about conj?
15:09Raynes:P
15:10gfredericksI guess most people who do it wrong prefer (vec (concat my-vector [x]))
15:17yedithorwil: here is how I implemented rhyme-scheme: https://github.com/yedi/rhyme-finder/blob/master/src/rhyme_finder/core.clj#L96
15:18yedithorwil: I decided not to use classify-lines at all like you suggested
15:21yediare there any general practices for organizing code? right now I just have a ton of fns and a few global defs in my core.clj file
15:21yediseems like it's probably the equivalent of spaghetti code in clojure
15:21gfredericksbreak them into namespaces by functionality?
15:21gfrederickssimilar approaches to organizing code in other languages
15:22pellisis there a way to destructure within anonymous function? like #(foo %1) but want to destructure %1 ?
15:23gfredericksuse the normal fn syntax
15:23hcumberdale;)
15:23gfredericks(fn [[a b c]] ...)
15:27tomoja while back I wrote several utility functions that seemed sort of nuts to me. today I went back to the semantic editor combinators blog post to try again to understand them, and now realize that I ended up with several of those combinators independently :)
15:29Guest75802How to add a section <abc>elem1</abc>\n<abc>elem2</abc> from a seq '(elem1 elem2) under a specified structure of a xml file ?
15:30lypanovanyone know if the cljs in cljs compiler thang is already somewhere on github?
15:32lypanovfound it (https://github.com/kanaka/clojurescript)
15:36Guest75802hm
15:38clojure-newbhey guys… if I were to use a clojure library giving me content negotiation, caching, API versioning etc and nice REST support, which ones are people using ? Its kinda hard to choose, and particularly API versioning is not well documented
15:38technomancyclojure-newb: nobody has implemented generalized content-negotiation yet
15:39technomancybut you should use compojure
15:39clojure-newbtechnomancy: how is it's API versioning support ?
15:39technomancyclojure-newb: as good as you want to make it?
15:40clojure-newbtechnomancy: oh I see… roll your own ?
15:40Guest75802what is the most simple way to add elements to xml files
15:41Guest75802is it right that no native Clojure lib deals correctly with XML namespaces?
15:44ChongLihmm
15:44ChongLi4clojure ought to have a "next problem" link after getting the answer correct
15:45ChongLioh
15:45ChongLiit does, it's just not called next
15:45Guest75802what's the prefered API to handle XML ?
15:45Guest75802clojure.contrib.zip-filter.xml ?
15:46thorwilwhy doesn't with-redefs-fn like me? https://www.refheap.com/paste/6935
15:46borkdudehave you ever seen an implementation of filter using reduce like this? https://www.refheap.com/paste/6936
15:47gfredericksthorwil: I think it expects the body to be a function
15:48gfredericksso instead of (root-routes ...) you give (fn [] (root-routes ...))
15:48gfredericksthorwil: with-redefs is a macro that lets you avoid that
15:50thorwilgfredericks: works, thanks! but for with-redefs, something else must change, because: https://www.refheap.com/paste/6937
15:51gfredericksthorwil: yeah I think it also wants a vector of bindings like let
15:51gfredericksI don't remember if you need the #' syntax either
15:51gfredericks,(doc with-redefs)
15:51clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...
15:51gfredericksyeah just the symbol
15:52gfredericksclojurebot: with-redefs is useful for mockin...
15:52clojurebotYou don't have to tell me twice.
15:52thorwilaha: (with-redefs [h/journal (fn [r] "plop!")] (root-routes {:request-method :get :uri "/"}))
15:53gfredericksyep
15:53gfredericksalso that function is (constantly "plop!") :)
15:53thorwilphew, headache avoided, ty
15:53gfrederickspor eso estamos
15:54thorwilhmm, i don't think my replacement handlers have to be valid ring handlers
15:59borkdudeoh of course, I'm the only one who didn't know about difference lists
16:02Guest75802Anyone used data.xml already?
16:22Guest75802How to insert elements in a structure like: https://github.com/clojure/data.xml#examples
16:23romanandreghey need some help with clojurescript macros
16:23romanandregI'm trying to use the try macro inside a macro definition, but it won't work
16:23romanandregthe result javascript just has the body of the try
16:23tomojhuh, I never realized that on the jvm, all protocol fns share a name/sig space
16:23romanandregany suggestions
16:23gfredericksromanandreg: can we see the code?
16:25kmicu__Are there any contraindications for putting lazybot @ heroku?
16:26gfrederickstomoj: I never realized that in cljs they don't :)
16:26romanandreggfredericks: there you go https://gist.github.com/4137377
16:26tomojdidn't mean to imply that, although I suspect that's true. do you now know?
16:26gfrederickstomoj: I....think?
16:26tomojditto
16:27tomojto avoid the problem on the jvm I named my seq protocol fn -seq
16:27romanandreggfredericks: the client code runs that, but only returns what is in body (without the actual catch)
16:27tomojbet I'm going to regret that when I go to cljs..
16:27tomojhopefully not!
16:28hugoddnolen, lynaghk : would be grateful if either of you could have a look at this. If I use prep I get what I think is an erroneous result https://gist.github.com/4137374/a8361de5ff2e78609f99dbc521ff53e52b192a2b - maybe linked to use of c.c.l/not-found?
16:29dnolenromanandreg: patch applied http://github.com/clojure/clojurescript/commit/ee25599abb214074cbeefe37b399038d70c6ab89
16:29romanandregdnolen: awesome! thanks :-)
16:30gfredericksromanandreg: I do not know :(
16:30gfredericksromanandreg: oh try e# for the error name
16:30romanandregdnolen: do you have some minutes to spare? if someones knows macros on clojure, that must be you :-p
16:30gfredericksI bet the compiler bails when it sees the qualified e
16:30romanandreggfredericks: went there, the gclosure compiler actually throws a warning
16:30romanandregsaying
16:31romanandregthat I'm not using
16:31romanandrege__auto__number_number
16:31gfrederickschange it in the body too?
16:31romanandregsorry no "not using" but rather, not defined
16:31gfrederickso_O
16:32gfredericksthen I _really_ don't know what's going on
16:32gfredericksbut you definitely want e# instead of e
16:33romanandreggfredericks: Ok, will change that then...
16:33dnolenhugod: which behavior are you expecting?
16:33lypanovdnolen: random q any clue where the clojurescript-lua guy went? was anything heard of him?
16:33dnolenromanandreg: looking
16:34dnolenlypanov: raphael amiard, he's around - tho I'm not sure if he's actively working cljs-lua
16:34lypanovdnolen: *nod* no commits for 4+ months
16:35dnolenlypanov: yeah I think he's been busy w/ his other OCaml LLVM project
16:35lypanovdnolen: gonna read over his repo in the coming weeks and that of kanaka would be great to get a -> lua generator in lua
16:35lypanovdnolen: *nod* lots of commits to that
16:36lypanovbummer but ya his GSOC was long over
16:37hugoddnolen: I was expecting both expressions to yield the same result
16:37dnolenlypanov: yes but goal was achieved - he helped make the analyzer/compiler more modular. still cljs-lua is probably a solid starting point for anyone wanting to carry it forward
16:37dnolenhugod: but which one are you expecting?
16:38hugoddnolen: I was expecting a single term - ie, the result without prep
16:39romanandregdnolen: updated gist with more code, just in case
16:42dnolenromanandreg: still not really following - what are you expecting to see?
16:42dnolenhugod: so the second one is unexpected?
16:42lypanovdnolen: *nod* wouldn't it make more sense to base it on kanaka work tho?
16:42romanandregdnolen: I'm expecting to see the assert from the catch clause
16:42lypanovi have so little experience not sure how modular the actual generation parts of things are
16:43lypanovbut i'd expect more cljs -> less work ;)
16:43dnolenlypanov: yes, is kanaka?the self compiling cljs project?
16:44dnolenromanandreg: gimme a second looking more closely at hugod's issue.
16:44tomojwhat the hell? https://www.refheap.com/paste/2909721cacda1bfafd7a20a8c
16:45romanandregdnolen: no worries… let me know when you are available, thanks
16:45lypanovdnolen: thats just the guys github name - https://github.com/kanaka/clojurescript
16:45lypanovdnolen: so figured i'd call it that ;)
16:45tomojguess clojure doesn't like initial hyphens in protocol fn names
16:47lypanovdnolen: btw your video intro to c.l was awesome thank you looking forward to playing with it in near future for some constraint problems
16:47dnolenlypanov: thx
16:48hugoddnolen: for me at least - the ?a in the second result implies it hasn't unified doesn't it? the second pattern calls for a match on the :a key, which isn't satisfied. But I could have my wires crossed.
16:48Guest75802How to work with such structures: https://github.com/clojure/data.xml#examples
16:49Guest75802like #clojure.data.xml.Element ...
16:49dnolenhugod: to be honest I hadn't realy intended prep to be used from w/in a run, so you may just be running into a case I did not account for.
16:50hugoddnolen: ok, I was trying to get a simple repro case - I'll hoist the prep calls and see if it still differs
16:52wingyi have a folder with a dot .. how will the namespace be like?
16:52wingythe folder is called context.io and it has a file client.clj in it
16:52wingythe ns looks weird now: (ns myapp.context.io.client)
16:53hugoddnolen: gist updated - no change, there are still two terms produced
16:53dnolenhugod: it just seems like a bug to me, (run* [q] (== (partial-map (prep {:a '?a :c :clojure.core.logic/not-found})) {:x 1})), succeeds - does not w/o prep - feel free to open a ticket and I take a closer look in a bit. thanks.
16:54hugoddnolen: ok, thanks - I'll also close the one I opened yesterday re recursive partial-map
16:57wingyanyone?
16:57clojurebotJust 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 ..."
16:57wingyclojurebot: i have already asked the question
16:57clojurebottufflax: there was a question somewhere in there, the answer is no
16:58wingyclojurebot: you are a little annoying girl
16:58clojurebotIt's greek to me.
16:58egghead:3
16:59hugoddnolen: I would close http://dev.clojure.org/jira/browse/LOGIC-72 but I don't seem to have permissions to do it
17:00raekwingy: dots in namespace names have to correspond to forward slashes in paths
17:00wingyraek: so in other words you can't have a dot in a folder name
17:00dnolenromanandreg: I'm still having trouble figuring out what you're expecting to see since some context is missing.
17:01raekwingy: yes. not if you want to use ns/require/use anyway...
17:01dnolenromanandreg: the multimethod is clearly part of some larger macro
17:01raekwingy: if you want the namespace to be called myapp.context.io.client, then put the code in myapp/context/io/client.clj
17:02romanandregdnolen: yes, it is part of the is macro for testing, this code follows the same scheme as in clojure.test
17:02romanandregbut for some reason the resulting javascript doesn't contain the try/catch
17:02romanandreglet me do one more thing, and if it doesn't work, I'll push the complete code for you to check it out, thanks in advanced for offering to help :-)
17:03tomojit seems somewhat weird to me that (extend-type default IFoo (...)) will cause (satisfies? IFoo x) to be true for all x
17:03dnolenromanandreg: yes I can't see what's going on - there's clearly something wrong w/ is.
17:03tomojrequires a marker protocol I guess if you want to differentiate
17:03wingyraek: yeah .. but that would feel like a hack just for not breaking how namespace is working .. contextio will suffice
17:03dnolentomoj: what else would you expect?
17:04tomojI guess that is what I expected
17:04raekwingy: hyphens are usually used to separate words: myapp.context-io.client ~ myapp/context_io/client.clj
17:05tomojthe other possibility I entertained was that objects having the default impl would not satisfy the protocol
17:05wingyraek: i should do that
17:05raek(and they correspond to underscores in paths, as you might have heard)
17:05wingylooks much better
17:05wingyyeah
17:05tomojwhich wouldn't make sense. I just wanted a marker protocol and didn't know it
17:07Guest75802struct-map
17:07tomoj(..or my current choice is to just not extend to default)
17:08Guest75802https://refheap.com/paste/6939
17:08dnolentomoj: yeah extending to default is usually more trouble than it's worth unless you really, really need it. core.cljs only does that on 2 protocols IHash & IEquiv
17:09Guest75802how can I add (element :test) in :tag :b's :content ?
17:09dnolentomoj: initially CLJS did that for ICounted and IIndexed - which was painful
17:09dnolen(counted? 1) -> true
17:09tomojheh
17:09tomojbut (count 1) is an error?
17:10raeknickOnClj: you could use update-in
17:10dnolenit is in Clojure & ClojureScript
17:11lynaghkhugod: do you need two colons for a namespaced keyword?
17:11raekhrm, wait
17:12nickOnCljraek, don't know how
17:12hugodlynaghk: only if your not using the full namespace name
17:12nickOnCljcan you provide an example?
17:12raeknickOnClj: sorry, what I had in mind didn't work
17:12strczprstskrzkrkSo widow mines are a pretty horrible unit.
17:12strczprstskrzkrkTHey just make you afrad to move out and split your army up because they could be basially everyhwere.
17:13raeknickOnClj: are you going to change just this element or more elements?
17:13nickOnCljI want to add a element under :b :content
17:14nickOnCljthought about assoc-in
17:14nickOnCljor assoc? with juxt?
17:14raekyou can't really use assoc-in or update-in here because you need to find the map with the correct :tag value in a :content sequence.
17:14raekthe -in functions require data structures with keys
17:15raekif the sequences were vectors, you could have used the "-in" functions though
17:15nickOnCljyes... how to find them?
17:15nickOnCljI need them to be records to write them back
17:16nickOnCljusing data.xml
17:16nickOnCljokay, starting by 'finding' the elements
17:16nickOnCljthat's hard enough
17:16raeknickOnClj: you could use the Enlive library for this
17:17nickOnCljUhhh more dependencies,...
17:17raekor you could write a simple function that just transforms this particular tree
17:18nickOnCljthat's what I try to do
17:18raekbut if you generalize that function, you will end up with something like enlive, I think
17:18nickOnCljbut I just don't get it
17:18raekwhat do you want to do if there are multiple :b elements?
17:19nickOnCljI don't know. Just searching for a solution
17:19raeknickOnClj: I can show you a specialized function if you want to
17:20nickOnCljhow can I write such a function to find a element? Is there any search/access method? [[:tag :xml] :content]
17:20nickOnCljraek, please ;)
17:22dnolenhugod: ping
17:22raeknickOnClj: ok, hang on a minute...
17:25raeknickOnClj: https://www.refheap.com/paste/6940
17:25hugoddnolen: pong
17:25cmajor7what is the way to convert JS list to a Clojure one? e.g. "No protocol method ISeqable.-seq defined for type object: [object FileList]"
17:26raeknickOnClj: Enlive is a library for dealing with specifically these kind of trees. with it you can just write (defn f [root new-node] (at root [:b] (prepend new-node)))
17:26dnolenhugod: so this is what is happening - prep converts ?symbols to logic vars
17:27dnolenhugod: partial-maps always "control" the unification since we only are about a certain set of keys.
17:27raekhere the [:b] selector will match any :b element in the tree. you can of course make the selector more specific if you want to
17:27nickOnCljraek i'll try it
17:27dnolenhugod: partial map looks up a key, ::not-found is returned if the key does not exist
17:28dnolenbut the map's entry in the partial map is a logic now - of course that will unify w/ ::not-found.
17:28raeknickOnClj: [enlive "1.0.1"]
17:30nickOnCljraek does it work with lazy streams and >20GB XML ?
17:30raekprobably not
17:31raekis the stream a single xml tree?
17:31cmajor7should "js->clj" convert JS list object to Clojure seq?
17:31raekor is it a sequence of root elements?
17:31hugoddnolen: you're referring to the unification for the first rule?
17:31nickOnClja data.xml tree
17:31nickOnCljhttps://github.com/clojure/data.xml#examples
17:31dnolenhugod: I'm assuming the behavior you want is that some value for that key is present but you don't car ewhat? correct?
17:32hugoddnolen: for the second rule, yes
17:32raeknickOnClj: ah, it says there in the docs that it is lazy. then it should be able to do it
17:33raeknickOnClj: there are multiple parsers that generate xml trees that look like this, and the ones I have used the most were not lazy
17:33dnolenhugod: fixing
17:33raekbut that doesn't mean that data.xml isn't lazy
17:33hugoddnolen: the first rule should match if there is no :a key, the second if there is an :a key
17:34hugoddnolen: thanks :)
17:34nickOnCljdoes enlive work with namespaces?
17:34raekno
17:34raekit is not namespace aware
17:34raekand I don't know if enlive is lazy...
17:35nickOnCljand it's written for html
17:35nickOnCljhmpf
17:35nickOnCljis there no native way to access the elements?
17:35raeknickOnClj: yes, but it has two parts: an html parser and a tree transformation library
17:36raekthe tree transforms work perfectly well for xml (don't know about the laziness, though)
17:36raekwhat do you mean by "native"?
17:36nickOnCljlike it is possible to get the :content
17:37nickOnClj(:content (parse input))
17:37raekyou could use 'some', I guess
17:37nickOnCljis there no way to ([:tag :b] :content (:content (parse input)))
17:37raekbut you also need to record were that element were, so that you can replace it
17:38raeknot in clojure.core
17:38dnolenhugod: fixed
17:38dnolenhugod: http://github.com/clojure/core.logic/commit/9a964d6c744433825332dd82370cb46eac7919da
17:39raeknickOnClj: also, 'at' in enlive does precisely that
17:40raeknickOnClj: perhaps you could use some function in clojure.walk
17:41nickOnCljhttp://stackoverflow.com/questions/9989818/clojure-recurs-strange-behavior
17:41nickOnCljsomebody has written a filter-tags
17:43wingyanyone here having experience with oauth in http requests? i am using context.io which needs me to authenticate requests using oauth http://context.io/docs/2.0/authentication but im not sure how to do that in clj
17:43raekwhat your function needs to do is to create a new root not like the old one, but with updated :content
17:43raekthe :content should be a sequence like the old one, but with one element replaced
17:43nickOnCljyes !
17:44raekthe replacement element should be like the old one, but with one more child in its content
17:44raekas you can see this involves many steps
17:44nickOnCljraek that shouldn't be a problem since i can (merge old_b (element :new))
17:45nickOnCljbut the 'navigation' in the structure is the major problem for me
17:45raeknickOnClj: another way is to use a "zipper"
17:45Rayneswingy: There are some libraries for doing it, but oauth is pretty horrible to use.
17:45wingyRaynes: why
17:46wingya lot of services are using it
17:46raekyou can use it to "imperatively" navigate through the tree and "change" elements in place
17:46RaynesIt's complicated and annoying.
17:46raekwhen you are done you get a new updated tree
17:46RaynesEspecially for desktop applications that need to work with oauth.
17:46wingyI need to generate a token I think that I send through OAuth header
17:46wingybut i don't know how to generate it
17:46nickOnCljreak, how to use zipper on https://www.refheap.com/paste/6939 ?
17:47wingyhttps://github.com/mattrepl/clj-oauth
17:47wingyhttps://github.com/r0man/oauth-clj
17:48raeknickOnClj: I know what zippers do and how they work (basically), but I haven't used them myself
17:48raeknickOnClj: there are a few examples here: http://clojuredocs.org/clojure_core/clojure.zip/xml-zip
17:48hugoddnolen: thanks for the quick fix! working well here :)
17:49raeknickOnClj: do you need to update :b elements in a specific location in the tree, or do you want to update any occuring :b?
17:50nickOnCljno specific location
17:50raek(zippers go hand in hand with specific locations, enlive goes hand in hand with arbitrary locations)
17:51nickOnCljsemms zippers are my friends
17:51nickOnCljhow to use them?
17:52wingywhy can't they support basic auth :)
17:53wingyi know how that one works :)
17:53dnolenhugod: great :)
17:53elendalClojure devs might be interested: IBM Java PackedObjects http://www.slideshare.net/mmitran/ibm
17:58raeknickOnClj: https://www.refheap.com/paste/6941
17:59nickOnCljclojure.contrib.zip-filter << only zip-filter?
17:59nickOnCljor a build-in in clojure 1.4 ?
18:00raekor a slightly updated one: https://www.refheap.com/paste/6942
18:00raeknickOnClj: clojure.contrib is pre 1.3 stuff
18:01raekhttp://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
18:01raeksee that page for where the namespace went
18:02raekclojure.contrib.zip-filter seems to be here now: https://github.com/clojure/data.zip
18:10nickOnCljthx raek
18:10yediis there a function that does the equivalent to this: https://github.com/yedi/rhyme-finder/blob/master/src/rhyme_finder/core.clj#L101
18:11yediremoves duplicate items from a vector
18:12raekyedi: you could use (vec (distinct some-vector))
18:12raekyedi: ...or simply use sets :)
18:15borkdudemy first encounter with the haskell community http://stackoverflow.com/questions/13534676/is-it-possible-to-implement-filter-using-foldl-instead-of-foldr#comment18536354_13534676 - my god, no wonder I love clojure
18:15raek:(
18:16Raynesborkdude: That's ridiculous.
18:16raekI have found the Haskell community (mostly via the IRC channel) to be very friendly, though
18:16Raynesborkdude: That isn't Haskell though, that's stackoverflow syndrome. Ask in #haskell.
18:17RaynesFWIW, I voted to reopen your question.
18:17xeqibecareful of confusing haskell conmmunity with stackoverflow mods
18:17borkdudeRaynes tnx
18:17raekI think it was a perfectly resonable question
18:18Raynesborkdude: Second what xeqi said. I've asked brain dead questions to exceptional answers in #haskell before.
18:18RaynesThey have a really good community.
18:19borkdudewell ok, it wasn't my first encounter with haskell, I entered their IRC today before, and yes, they are nice. maybe it's SO specific, let's hope
18:20Raynesxeqi: Can I have a veggie burger with fries?
18:20RaynesNot fries fried in animal fat though, of course.
18:20nickOnCljraek, it is nearly finished
18:20nickOnCljhttps://refheap.com/paste/6949
18:21nickOnClja one-liner ;)
18:21xeqiRaynes: sure, but not sure if they serve that in alabama
18:22xeqiwait till you get to LA
18:22RaynesI've been to LA.
18:22RaynesGot a big fat burger at The Counter.
18:22RaynesEnjoyed every bite.
18:23nickOnCljRaynes awesome story.
18:23nickOnCljOrdered 30 chicken nuggets at mc donalds
18:23nickOnCljwill never do it again
18:23raeknickOnClj: neat!
18:24nickOnCljcan't believe how sick I felt
18:27gfredericksis nobody targeting go with the cljs compiler yet?
18:28dnolengfredericks: haven't heard of anything yet.
18:31pandeirohow do i get lein to include cljs files in a src-cljs dir when doing `lein install`?
18:39wingylets target clojure with clojurescript
18:43borkdudewingy clojure all the way down?
18:44AimHereWrite clojure in clojurescript, and clojurescript in clojure
18:45AimHereHave them mutually recursing all the way down
18:45wingyborkdude: all the way
18:46wingylike inception .. we just need a good stabilizer
18:47pandeiroso is the only choice for making a cljs jar either using the jar command or lein cljsbuild?
18:48borkdudewingy we need a clojure machine that has all the special forms baked into the processor
18:49dnolenpandeiro: doesn't lein package up anything on :source-paths ?
18:52hcumberdaleIt's horrible
18:53hcumberdalespending hours on one line clojure
18:53hcumberdaleIn java you have pages full of syntax and text in the same time,... without another result but it feels like you have done more
18:54Foxboronhcumberdale, imagen when you finally get it :D
18:54alanzoppaHi, noob here. Can someone tell me how to run unit tests from the REPL in a standard lein project?
18:55borkdudehcumberdale if it helps, you can always type extra spaces and comma's in clojure, they are ignored
18:57hcumberdalealanzoppa lein test
18:57alanzoppafrom the REPL, not CLI
18:57hcumberdaleborkdude that's way not enough
18:57hcumberdaleIn java I can write so much more nice stuff ;)
18:58hcumberdaleImagine parsing XML,... one line in Clojure... a few hundered in java
18:58hcumberdaleObjects, Factories, Conversions, ...
18:58hcumberdaleBloat everywhere
18:59hcumberdaleAnnotations for Dependency Injection, Configuration of the XML Factory and XML providing instance
18:59hcumberdaleCode to 'make it working in every application server'
18:59hcumberdaleCode to 'omg, does not work in every application server'
19:02hcumberdaleborkdude and spaces are invisible. Filling up everything with "," looks stupid and not like hard work
19:03borkdudehcumberdale you can always add some extra function calls to identity or smth to fill up your lines
19:04hcumberdaleidentity?
19:04borkdude,(identity 1)
19:04clojurebot1
19:04borkdudeinstead of just writing 1
19:04clojurebotHuh?
19:05pandeirodnolen: thanks hadn't realized :source-path became :source-paths :/
19:06hcumberdaleis there any version for clojure of https://github.com/airblade/acts_as_enterprisey
19:10alanzoppaanyone? what's the equivalent of `lein test` from the REPL?
19:14dnolenalanzoppa: http://richhickey.github.com/clojure/clojure.test-api.html
19:14lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.test-api.html and try to stop linking to rich's repo.
19:14dnolenalanzoppa: oops I meant http://clojure.github.com/clojure/clojure.test-api.html
19:15flying_rhinohello guys
19:16hcumberdalehi flying_rhino
19:16alanzoppa@lazybot @dnolen Thanks. (disclosure: totally new to lisp, etc). I've been through this, I'm just not sure what I need to require or what namespace to run this in.
19:16flying_rhinoone question: When I do map or other function on hash table is it slower than doing map on vector? If it is, how to make it the same speed?
19:17flying_rhinois there hash/vector hybrid?
19:18dnolenalanzoppa: (require 'clojure.test), (clojure.test/run-tests 'some-namespace-with-tests)
19:21dnolenflying_rhino: there is no provided hybrid - there are probably data structures you could implement with some of the properties you want.
19:22flying_rhinoI am actually surprized that doing map and reduce work at all on hasth table. But they do.
19:22flying_rhino*surprised
19:23dnolenflying_rhino: well maps are sequable, so maps get converted into a sequence so it can be mapped over.
19:23alanzoppa@dnolen thanks for being so patient while i bumble through this. Do i have to require the test file or something? Running that for my core ns finds 0 tests.
19:23dnolen,(seq {:foo 1 :bar 2})
19:23clojurebot([:foo 1] [:bar 2])
19:23dnolenalanzoppa: yes you may need to require your namespace first - it's been a while since I tried running tests at the REPL
19:24alanzoppa@dnolen oh damn, there we go
19:37gfredericks,(.seq {2 2})
19:37clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap>
19:37gfredericks^ does anybody understand that?
19:43gfredericksas far as I can tell from the java code, calling seq on something that is not an ISeq but is Seqable results in callign .seq on it
19:49flying_rhinoI need data structure that acts a bit like database table with primary key. This means that all items are numbered, like vector. However, when you remove item from the middle (or rather create new table w/o that item), other items won't reduce number by one.
19:50flying_rhinothat's in short what I need
19:50flying_rhinoHash table where numbers are keys is a candidate
19:51flying_rhinobut I witsh it returned only value when mapped instead of key value pair.
19:51flying_rhino*wish
19:51gfredericksyou can call vals on a map
19:54flying_rhinogfredericks: what is speed penalty when iterating hash instead of vector?
19:54gfredericksassymptotically none I'm sure
19:56flying_rhinoI just worry about too much overhead. Since that table like structure is a backbone of what I am trying to create so it is worth optimizing.
19:56flying_rhinohence caution
19:57gfrederickswrite a protocol, implement it for map, code to the protocol, write your own type if it's too slow?
19:57flying_rhinogfredericks: thanks, I'll try
19:57gfredericksI guess that doesn't solve the seq problem though
19:58flying_rhinogfredericks: well hash table can be iterated.
19:59flying_rhinogfredericks: things like map and reduce work on it.
19:59gfredericksright I meant your "I wish it just returned values" complaint
19:59flying_rhinogfredericks: yeah
19:59flying_rhinogfredericks: I guess I can just create some macros so ithides implementation
19:59flying_rhino*it hides
20:01flying_rhinoit would be t-map and t-reduce
20:01flying_rhinoor something
20:02flying_rhinoand t-filter
20:03flying_rhinoyeah that's probably a way to go
20:07Guest92674can somebody see if there is something wrong with my namespace definition. Im getting a 'unable to resolve symbol' error http://cljbin.com/paste/50b01cece4b0490da5c95e40
20:10Guest92674here's the whole file http://cljbin.com/paste/50b01d89e4b0490da5c95e42
20:14gfredericksGuest92674: you use sidebar-snippet before defining it
20:14gfredericksyou can (declare sidebar-snippet) at the top if you want to keep them in that order
20:16Guest92674gfredericks: oh, i thought like haskell, the order of the function definitions didnt matter
20:16Guest92674thanks
20:16gfredericksclojure is single-pass; equivalent to entering the forms at the repl
20:17Guest92674what does single-pass mean
20:18gfredericksit just reads through the file once
20:18aperiodicGuest92674: most of my malformed ns statements result in an error about not being able to create sequences from symbols
20:33flying_rhinogfredericks: but even if it is single pass, the annoying thing is that wen you call function a from function b, and function b calls a it immediately screams an error. Even if it is single pass, it should only scream error if you actually call function a before defining function b.
20:34flying_rhinoall in all that's one thing that I find extremely annoying about clojure
20:34gfredericksI don't do that often enough to be extremely annoyed by it
20:34gfredericksI appreciate clojure behaving the same way whether it's reading code from a file or the repl
20:35flying_rhinoit would still behave the same way. There is no reason for repl to complain either when you feed it function, as long as you don't try to call it
20:35gfredericksit has to compile the code, which means it has to resolve the symbols
20:36gfredericksalso if the compiler didn't complain when you referenced things it didn't know about, a heckuva lot more typos wouldn't get noticed right away
20:36romanandregdnolen: still over there?
20:37dnolenromanandreg: hey
20:37romanandregdnolen: the code with the macro trying to use try is over here => https://github.com/BirdseyeSoftware/buster-cljs, in case you are still interested
20:38flying_rhinothe far bigger problem is that from repl map get's called immediately while normally it is lazily evaluated so result may warry if var changes for some reson. (say due to binding)
20:39dnolenromanandreg: you have to watch out w/ cljs macros espcially macros that emit further macros
20:39romanandregyeah, also the try macro is really magical
20:39dnolenromanandreg: you need to fully quality otherwise it'll get resolved to the wrong thing - i.e. your JS namespace and not your macro namespace.
20:40gfredericksromanandreg: I believe try is a special form
20:40romanandreggfredericks: is actually both… try uses try* which is an special form
20:40dnolenromanandreg: line 11 in macros.clj looks wrong to me.
20:40romanandregthat the emitter check
20:40gfredericksromanandreg: ah ha
20:40dnolenromanandreg: same w/ line 96
20:40romanandregdnolen: that one works well actually
20:40flying_rhinogfredericks: also compiler could throw a warning or something in case function contains symbol that's yet undefined. It still doesn't have to throw an error.
20:41romanandregdnolen: that one works (not for the thrown? thrown-with-message? though
20:41dnolenromanandreg: I don't see how it could, fully qualify those symbols.
20:43romanandregdnolen: hehehe, well it does, as long as thrown?, thrown-with-message? are not there
20:43romanandregit compiles correctly and run buster.js tests correctly
20:43romanandregruns*
20:44romanandregdnolen: are you familiar with busterjs?
20:44dnolenromanandreg: well they look suspicious to me based on my experience w/ porting core.match & core.logic to CLJS
20:44dnolenromanandreg: I am not
20:45romanandregwell yeah, they might be a bit "stretchy", not an expert on macros myself…
20:45romanandregmaybe they work as long as I don' do crazy stuff, the tests are not that extensive
20:46romanandregbuster.js, I could give a child to the guy that created it, is the best js test server I've found out there so far
20:47dnolenI wouldn't be surprised if your issues go away if you qualify, there's no other reason I can think of why your macros don't work.
20:48romanandregdnolen: should I stick to single quote instead of syntax quote and qualify everything by hand?
20:48dnolenromanandreg: no just your macros.
20:48clojurebotBarking spiders!
20:50dnolenromanandreg: oops sorry I'm actually wrong I think - http://github.com/clojure/core.logic/blob/master/src/main/clojure/cljs/core/logic/macros.clj
20:50dnolenromanandreg: I had to quality runtime calls to lib - not the macros.
20:51romanandregdnolen: ok… I shouldn't qualify the functions that are actual cljs right? just the clj ones
20:51dnolenromanandreg: yes you need to qualify your CLJS fns, otherwise they get resolved to the macro ns.
20:52romanandregdnolen: ok
20:52romanandregdnolen: thanks for the enlightening on there
20:52tomojyou can manually (alias 'x 'the-cljs-ns) in clj
20:52romanandregdnolen: how about cljs macros
20:52romanandreg?
20:52tomojto avoid having to fully qualify
20:53dnolenromanandreg: what do you mean?
20:53romanandreglike, I'm using the and macro inside a macro, should I put cljs.core/and
20:53romanandreg?
20:53tomojI got confused doing that with a cljs ns that has the same name as a clj macro ns, but I guess it's confusing no matter what
20:53romanandreghow does it tell the difference btw cljs.core on clojure and cljs.core on cljs?
20:54dnolenromanandreg: no
20:54dnolenromanandreg: sorry for the confusion, you shouldn't have to qualify macros - just runtime functions
20:54romanandregok ok
20:54hugoddnolen: I'm now getting lb and ub called on ::not-found https://gist.github.com/4138017
20:55romanandregdon't worry, you won't be the last who will apologize for macros confusion :-p, there is no way around it
20:56dnolenhugod: go ahead and make a ticket + the code that triggers it.
20:56hugoddnolen: trying to create a simple repro case...
20:57romanandregdnolen: thanks for the feedback man, I owe you a beer
21:00dnolenhugod: wow I really need to start using ritz, being able to see locals like that in stack trace ... I NEED THAT
21:00dnolenhugod: it looks like somehow a logic var got unified w/ ::not-found
21:00hugoddnolen: makes life much easier ;)
21:00dnolenhugod: there's an assumption w/ the FD stuff that a FD constrained var will only take on integer values
21:01hugoddnolen: right, but somehow it's getting unified with ::not-found, as you say
21:01dnolenthat's been violated - so it blows up trying to call lb/ub which only apply to the integer types or the domain types.
21:01dnolenhugod: are you explicitly unifying with ::not-foudn?
21:02dnolenhugod: oops I see it fixing
21:02hugodI have some rules that unify with ::not-found, and some that unify with an onteger
21:02hugodI assume some cross-talk between rules
21:04hugodthe substitution map is even easier to work with when you can pretty print the values in the stack frames using 'd'...
21:07dnolenhugod: try master
21:09dnolenhugod: looks like you're doing some fun stuff w/ core.logic :)
21:10hugoddnolen: pretty similar to what lynaghk is doing, and I've add guards for my rules
21:11dnolenhugod: nice! constraints really open the door for this use case I think.
21:11hugoddnolen: looks like I'm still getting the exception
21:12hugoddnolen: constraints are fantastic for this :)
21:12Sgeo__o.O dnolen where are these awesome almost CL-looking exception stuff coming from?
21:13Sgeo__Just saw you link it on your Twitter
21:13dnolenSgeo__: hugod's ritz
21:13Sgeo__Ah
21:13Sgeo__I should set that up at some point
21:14bbloombwha? is that working now?
21:14bbloomhow can i get me some of that goodness? :-)
21:14dnolenhugod: the last commit should prevent unification w/ ::not-found from w/in core.logic itself.
21:14dnolenhugod: is it some how slipping through because of the way you've written your code?
21:15hugoddnolen: it's possible - though I have gone through the logic a few times
21:15Sgeo__Oh, it starts another JVM?
21:15Sgeo__I might not be able to do that on this POS computer
21:16hugodSgeo__: attaching to a remote jvm is on the todo list
21:16Sgeo__Not what I meant
21:16Sgeo__I meant, if... oh, now I'm confused
21:16Sgeo__But if I'm running 2 JVMs instead of 1, not sure how my computer can handle that
21:16bbloomhugod: is https://github.com/pallet/ritz the homepage? where should i be looking?
21:17hugodbbloom: indeed - follow either the ritz-nrepl or ritz-swank links from there
21:18bbloomhugod: does it depend on emacs? or does it work with the normal nrepl too?
21:18seancorfieldjust noticed clojure-mode (1.11.5) enables slime for all clojure buffers (as a slime-connected-hook) - this plays havoc with nrepl... anyone else run into that problem?
21:19hugodbbloom: the only clients at the moment are nrepl.el and slime, so yes, depends on emacs
21:19hugodbbloom: it would be possible to extend to other clients though
21:20bbloomhugod: I'm a vim guy… I generally run nrepl in a tmux session
21:20bbloomhugod: i have a pretty lowtech send-text-from-vim-to-tmux hotkey
21:20aperiodictim pope is working on an nrepl client for vim
21:20hugodbbloom: a cdt type interface for lein repl would be possible, which would also work in vim once middleware support is in vimclojure
21:21dnolenhugod: try master now
21:22bbloomhugod: aperiodic: thx. i hope i get to play with it via vim land soon :-)
21:23dnolenseancorfield: it is a bit annoying - it's been that way for a long time I think. I have to turn clojure-mode on/off in order to use inferior lisp w/ CLJS for example.
21:24aperiodicbbloom: for now, you can get a pretty sweet setup with either slimv or vimclojure that's IMO loads better than the blitting text around w/tmux approach
21:24bbloomaperiodic: i'm using vimclojure but have all the nailgun stuff turned off. i found neither that nor slimv to really work correctly at all for me
21:24bbloombut it's been a while since i tried
21:26seancorfielddnolen: good to know i'm not crazy... i just removed the hook and have commented the add-hook call out of clojure-mode.el for now
21:27seancorfieldif slime/swank is deprecated for clojure now, and nrepl preferred, then that should be fixed - who maintains clojure-mode.el? is it technomancy ?
21:27dnolenseancorfield: yep
21:27aperiodicbbloom: oh, unfortunate. what sort of problems were you seeing?
21:28bbloomaperiodic: i forget, but i'm also doing a bunch of cljs stuff, so i've been finding it easier to just have a consistent experience, even if it's consistently bad
21:30hugoddnolen: still looking the same https://gist.github.com/4138096
21:31hugodthe rule it is complaining about is [{:pallet.vm.ram ?r :kernel.fs.file-max ::not-found} {:kernel.fs.file-max 10240} (< ?r 2048)]
21:33dnolenhugod: yeah I'm confused as to how ?r is getting unified w/ ::not-found
21:33seancorfielddnolen: I opened an issue against clojure-mode
21:35DestonI must be doing something stupid here, but I haven't been able to figure out what. Would someone please enlighten me? http://pastebin.com/rVdCjHU1
21:36gfredericksDeston: your filter function needs to accept one arg
21:36gfredericksit will be a pair, but one arg nonetheless
21:36gfredericksyou can use (fn [[a b]] (not= a b))
21:36hugoddnolen: it could be due to how I'm applying the guard? https://gist.github.com/e44877d0a1b69fa3ed89
21:37Destonoooh, right, derp.
21:37Destonthanks. I kept thinking it was the actually call to hamming-distance that it didn't like.
21:37Sgeo__Has to be an easier way
21:37gfredericks(partial apply not=) will also work
21:37Sgeo__No idea wh... oh
21:38Sgeo__I was thinking in terms of composition for some reason
21:38gfredericks(comp #{2} count set) if you want to be clever
21:38gfredericksalso (partial apply distinct?)
21:39gfredericksthis discussion will not be complete until somebody figures out a way to use juxt
21:39Destonhaha
21:41erewhonhugod: what are you using core.logic for?
21:42erewhon(just curious seeing the kernel.fs.file-max bit)
21:43dnolenhugod: I've made unification w/ ::not-found impossible in master - try now.
21:46hugod(defn hamming-distance [dna1 dna2] (count (remove identity (map = dna1 dna2))))
21:48hugoderewhon: doing some software configuration...
21:49Destonha, I like that one...
21:50hugoddnolen: still getting the exception - I have to go read to the kids - will try again in a while
21:51erewhonhugod: ok. a module / add-on for pallet, pallet itself, or something else?
22:08bbloomdnolen: are you using a query selector library with your clojurescript code? jquery? the goog.dom.query thing from dojo? something else?
22:09dnolenbbloom: not using anything since I mostly just hack on the compiler ;) but if I was going to use something I would look at domina
22:10dnolenhugod: hmm very weird - feel free to open a ticket. I'd be curious to see the stack trace now.
22:10bbloomdnolen: ok yeah that's using goog.dom.query
22:11bbloomdnolen: for some reason, i'm getting an exception in Compiler.java:903 com.google.javascript.jscomp.Compiler.newTracer when trying to require that
22:11dnolenbbloom: yeah dunno - tho that seems weird.
22:12bbloomdnolen: yeah, i'm not even sure how to go about debugging that now :-/ problem for another night, i'm headed out :-P
22:19hugoddnolen: hasn't changed any, afaict https://gist.github.com/cce071ec95aeef87e20a
22:27tomojdumped brain, appreciate thoughts but know it's a lot to read: https://www.refheap.com/paste/bcc50aafcf1188b102b33cd21
22:27tomoj..plus haskell-ish. but the clojure at the bottom may help some
22:28dnolenhugod: go ahead and open a ticket - I must be missing a case somewhere - the locals in the second frame of the stack trace should not possible.
22:29dnolengetting closer and closer on source maps for CLJS ...
22:29erewhonwoo-hoo!
22:30tufflaxWhat are source maps? :p
22:31dnolenso we can debug ClojureScript directly in our browsers
22:31tufflaxok :)
22:31erewhonit'll be awesome (at least i hope so)
22:32erewhondnolen: i was actually thinking about asking you about that again at the conj. had actually thought about volunteering to help it along but, uh, forgot.
22:33hugoderewhon: this is for something on top of pallet
22:34dnolenerewhon: I'm pretty sure it'll be awesome.
22:35erewhondnolen: :-)
22:35erewhondefinitely looking forward to it
22:52flying_rhinocan you in clojure have reference from one record to some other record?
22:52gfredericksjust like with maps? {:foo {:bar 7}}?
22:53seangroveI'm seeing clojurescript objects that are never getting GC'd in the browser
22:53seangroveLet me just double check that I'm using atoms correctly...
22:56seangroveIs this the correct use of atoms? https://gist.github.com/ad13e5d068b32a6349c3
22:56flying_rhinogfredericks: I mean for example you have several vectors of records. You want some of them to reference other records (like foreign key in database). Only way I can think of is to make them hashes and use numbers as primary keys.
22:57seangroveSwapping to add items to the atom, and then clearing out the atom with a function that returns [], it seems all the controls stick around in memory and never get GC'd
22:58erewhonhugod: cool.
22:58seangroveTo the point after a medium stress-test, it's taking up 67% of the browser's memory, or ~250MB or so
22:59hugoddnolen: my initial repro case (where I had an extra term using prep) was wrong - I was calling prep separately on the pattern and on the production so they were getting different logic vars.
23:00dnolenhugod: gotcha
23:02seangroveAny ideas why these persistent vectors are being kept in this list? http://dl.dropbox.com/u/412963/Screenshots/aj.png
23:03seangroveRight now the atom is a PersistentVector with 0 items, so it shouldn't have any references to the outstanding objects
23:05Sgeo__Could that PersistentVector be referencing old versions that have references to the outstanding objects?
23:06dnolenseangrove: that map to dispose objects won't do anything tho right? map is lazy?
23:06dnolenseangrove: in destroy-widget
23:06seangrovednolen: Yeah, that's a separate piece, but you're absolutely right
23:06Sgeo__I didn't look at the code, sorry
23:07seangroveI should be using doseq
23:07seangroveSgeo__: Well, the PersistentVector is put into an Atom, and when swapping, I'm creating a new PersistentVector obviously, so there shouldn't be any references lingering around - so the GC should be able ot clean up
23:07seangroveUnfortunately, there are references to it somewhere preventing it from being collected
23:08dnolenseangrove: I'd curious to know if you can recreate this issue w/o involving the DOM at all - it's definitely something we haven't looked at closely enough.
23:09seangrovednolen: I can certainly give it a try, it may be an interplay between closure and cljs
23:10seangroveMore likely I suspect I'm doing something wrong, but as I do more mem/perf tests, I'm having a hard time tracking this down
23:10dnolenseangrove: so you can't always reproduce it?
23:10yedihow does incanter compare to just using something like R or maybe a numpy equivalent?
23:11seangrovednolen: Oh no, I can reliably repro it every time
23:11seangroveI'm just having a hard time figuring out where the references to these objects are coming from
23:11dnolenseangrove: so issue isn't related to using doseq? or is?
23:11dnolennot using
23:11seangroveNo, not at all
23:12seangroveOh, wait, maybe
23:12seangroveGoodness, let me check..
23:12seangroveThe lazy reference could be the problem
23:12dnolenseangrove: yeah
23:17seangroveAlright, running the test again with doseq, will let you know if it didn't solve it...
23:21brainproxyChousuke: cool gist! sorry was gone all day
23:22brainproxyseems like the same ideas for sure
23:34tomojseangrove: are you aware of what *1 etc point to?
23:34tomojI had the same problem because I didn't think about those
23:35seangroveNot sure what *1 is?
23:35tomojif you're in the repl
23:35tomojthe 1'th 2'th etc result
23:36tomojer, *1 is the last evaluation result in the repl, *2 the one before that, and *3
23:36seangroveAh, no not working from the repl right now
23:36seangroveHave a more sparse setup right now, while I get a grip on it piece by piece
23:45yediis next == rest
23:47dnolenyedi: no
23:47antares_yedi: http://clojure-doc.org/articles/language/collections_and_sequences.html#first_rest_next
23:48yedii see
23:51Raynesantares_: That isn't the only difference.
23:52dnolenyedi: rest is lazier
23:52antares_Raynes: ok, what are other differences? (so I can document them)
23:52tomoj(= next (comp seq rest)) ?
23:53dnolentomoj: pretty much, tho for perf reasons that's not actually done.
23:53Raynesantares_: rest has to know if there are more elements in order to return nil, which makes it more eager than next. I guess that doesn't necessarily have to be explained though.
23:53tomojthat's backwards
23:54dnolennext has to know, rest doesn't
23:54RaynesThen I guess clojure.org is wrong.
23:55RaynesOh, right, I was reading the old section.
23:56Raynes&(rest ())
23:56lazybot⇒ ()
23:56dnolenah lazy-cons
23:57RaynesAnyways, I don't know if this actually matters to antares_ because I'm not sure a beginner reading that will even know what it means or care, or have to care for that matter.
23:57RaynesBut it might ought to be mentioned if you're going for a complete reference.
23:57antares_good to know for the guide on laziness
23:58yedii think beginner readers probably should know about laziness
23:58tomojlazy seqs complect laziness and seqness :(