#clojure logs

2015-01-08

00:00lodinFor some reason, records do not implement function invocation. Don't ask me why.
00:00sdegutisha
00:00sdegutislodin: wow you know Clojure pretty well; been using it long?
00:01lodinLooked at it two years ago. Been using it more the last half year.
00:01lodinBut no, I don't know it that well.
00:01lodinI just happened to know this.
00:02sdegutis:)
00:15ToBeReplacedi see a few edn readers in python -- anyone ever used one in production (with tagged literals)? trip reports?
00:15lodinsdegutis: I tried it out. It works. But I wouldn't use it. :-)
00:16sdegutisPromise worked! https://gist.github.com/sdegutis/a331db340c6cc3e94b67
00:16sdegutislodin: hwy not?
00:17scottjToBeReplaced: I think the bitemyapp guy used to always complain about the edn support in python
00:17sdegutisHe left to use Haskell.
00:17sdegutisI forgot his nick, started with "c".
00:17sdegutisI keep wanting to say ciarran but I know that's not right.
00:18lodinsdegutis: I'd opt for being specific.
00:18sdegutislodin: you mean explicit?
00:18lodinsdegutis: Yes.
00:18sdegutislodin: I've done that for 2 years now. It's not as ideal as I'd hoped.
00:19sdegutislodin: I've been working on a Clojure web app full time since late 2012.
00:19lodinsdegutis: Explicit it what way? You mean passing arguments around?
00:19sdegutislodin: "self", yeah
00:20justin_smithsdegutis: callen
00:20ToBeReplacedscottj: it's a hard problem for a number of reasons, notably not having an immutable mapping, nor a named collection type other than namedtuple in standard library... too many decisions to make
00:20justin_smithsdegutis: he is still bitemyapp on twitter
00:20lodinsdegutis: I meant explicit as in having a function that transforms a method into a function.
00:21ToBeReplacedi luckily don't have any kind of speed requirement; but tagged records are necessary
00:21sdegutisah right callen
00:21sdegutissuch a colorufl character
00:21sdegutislodin: oh
00:21sdegutislodin: nah I want to avoid as many :requires as possible
00:22sdegutisIdeally nearly all of them.
00:22sdegutisThat is, all of them in most files.
00:22lodinsdegutis: How does that relate to your problem?
00:23sdegutisIf I have method->func, I need to :require some file that defines it.
00:23sdegutisIf it's just (:greet bob) and I'm given bob, then I'm all set.
00:23sdegutis:)
00:24sdegutisI think reify with IFn might eventually be a cool alternative, but (bob :greet) isn't much better than (:greet bob)
00:25sdegutisGreat, my OOP thing works. Now to add basic inheritance.
00:25lodinsdegutis: basic inheritance = merge. :-)
00:26sdegutisGood idea :D
00:26sdegutisThis is what I've got so far: https://gist.github.com/sdegutis/d0c431a124d4d17f7cc2
00:26lodinsdegutis: Why do you want to avoid :requires?
00:26sdegutislodin: because reasons.
00:26lodinI see.
00:27sdegutislodin: I was thinking of just doing (merge imethods (some-superclass imethods)) but then I extracted (construct) into a function which takes both imethods and state.
00:27sdegutisNow I'm wondering if I should somehow do, like, auto-init-superclass-calling or something.
00:28lodinAnd you really don't want (call obj :method ...)?
00:28sdegutisWhere would "call" symbol come from?
00:28lodinA require, of course.
00:28lodin:-)
00:28sdegutis;)
00:29lodinI think that one thing that Clojure gets right, in constract to many other popular OO language, is method qualification.
00:29lodinBut you wouldn't like that, since it would involve require.
00:29ben_vulpesi'm having trouble getting cider mode to turn on when i open a .clj file in emacs - where should i start finding the appropriate hook? clojure-mode turns on just handily, but...not cider mode, and not paredit.
00:29sdegutiswhts that
00:29sdegutislodin: whats that
00:30lodinsdegutis: When you use either multimethods or protocols you can have two completely different methods that have the same name.
00:31sdegutislodin: oh yeah thats pretty cool
00:31sdegutislodin: i have found them to be troublesome though
00:31sdegutissorry for bad capitlization and typos, my fingers hurt a lot from rsi given to me by emacs
00:31lodinHow's that?
00:31sdegutis(fingers and wrist and hand)
00:31sdegutiswell, i forgot how. i just know.
00:32sdegutisthey lacked some feature that my use-case needed
00:33lodinCould it have been that you wanted to reuse parts of an implementation?
00:34sdegutisdoesnt ound famir
00:34sdegutisdoesnt sound familiar
00:35cflemingsdegutis: reify with IFn is kind of ugly because you have to implement all the arities. proxy with AFn would be better depending on how much you care about speed.
00:35sdegutiscfleming: thanks although i'm just doing it much simpler now
00:36sdegutisahhhh, (merge imethods cmethods) is biting me now that im trying to make inheritance work
00:36sdegutisnamely because an instance has only imethods but a class has both imethods and cmethods, thus the class is defined as a merge between then
00:37sdegutisbut since the imethods by itself is lost once the class is created, this doesnt allow me to access them by themselves later on when i constuct an instance of the base class
00:38underplankhi all. what would be the tradeoffs in using a agent vs and atom for a global counter from multiple threads?
00:39lodinsdegutis: Do you really need to make this distinction between classes and objects?
00:40sdegutislodin: no, this could totally go the ruby way and have classes be instances of "class" class
00:40sdegutislodin: but then that makes for a bootstrapping issue
00:41lodinsdegutis: I think your requirement/desire to not having requires is peculiar.
00:41sdegutislodin: yet firm
01:07lodinsdegutis: So you decided on not using the "arrow map" I mentioned above?
02:35SagiCZ1lodin: i think records dont implement looking up the key (as maps do) because you may want to let them implement entirely different interface
02:38lodinSagiCZ1: You have a point. It has the unfortunate effect of not making records a drop-in replacement for maps though.
02:45SagiCZ1lodin: true.. thats why it is prefferable to use keys as functions to acces the values of maps
04:23sm0ke_hello all, so i have this webapp written over edn
04:24sm0ke_now people want to use it from javascript, is there a library for this?
04:25Empperihttps://github.com/shaunxcode/jsedn
04:28sm0ke_Empperi: is this still maintained?
04:28EmpperiI have no idea
04:28Empperibut that's the one linked here https://github.com/edn-format/edn/wiki/Implementations
04:34sm0ke_guess it too stable to be maintained :D
04:34sm0ke_:P
04:38sveriHi, any of the boot developers here?
04:39svericfleming: ping
04:42cflemingsveri: pong
04:43hellofunkcfleming: what's the best way to learn about new Cursive updates and get and install them?
04:43svericfleming: Hi, do you plan to integrate boot support in cursive anytime soon?
04:43sverihellofunk: intellij has an auto update feature which informs you about new cursive updates
04:44cfleminghellofunk: IntelliJ will check for updates once a day, I think
04:44sverihellofunk: and the homepage of cursive has an extensive list of versions + features
04:44hellofunkok cool
04:44cfleminghellofunk: I send a longer mail with info about each release to the mailing list, too
04:45cfleminghellofunk: I'm planning to publish those in a blog too since currently only subscribers see those
04:45cflemingsveri: Yes, but I'm not sure when. It's very interesting to me, and I'd like to use it for building Cursive itself.
04:45hellofunkcfleming: awesome. hey what functionality in Cursive different between the free IntelliJ edition vs premium?
04:45cflemingsveri: But my to-do list is very long.
04:46cfleminghellofunk: None, only IntelliJ features are different.
04:46hellofunkhaving never used IntelliJ before, sometimes it is not clear where the line is drawn between Cursive and intelliJ
04:47cfleminghellofunk: Depending on what you're doing, some of that might be useful - their web tech is really good. I'm discussing with them at the moment how to integrate Cursive with that.
04:47svericfleming: cool, if I get boot working on windows I will try to have a project.clj parallel to the build.boot file and use it to let intellij grab all the needed information
04:48cflemingsveri: Yeah, that's the recommended approach at the moment. You can set up your source dirs etc like that, and then use this in your boot script to get deps from project.clj: https://gist.github.com/bsima/88969126962803a6500f
04:49cflemingsveri: You can use External Tools to run boot tasks too, I believe
04:49svericfleming: ah, thats a nice gist, thank you
04:49cflemingsveri: Yeah, I need to put this in a single page somewhere - a lot of people are asking about it.
04:50svericfleming: I have to see how it goes, right now some thing seems to be broken on windows -.-
05:01cflemingsveri: Cool, if you manage to get it working it would be interesting to know what you had to do, either here or on the Cursive mailing list - there's a lot of interest.
05:23slipsethmm, the pmonks is here as well!
05:31Kristienperl monks?
05:36dysfuni suppose you could loosely describe me as a perlmonk
05:37KristienI like Perl
05:38dysfunas do i
05:39dysfunthe 'keep it simple' philosophy is one it shares with clojure
05:40dysfundid you see the chaos computer club announcing perl's list folding was an exploit? that was amusing.
05:41Kristienno
05:42dysfunhttp://www.perlmonks.org/?node_id=1111750
06:00Ninerian_Hello
06:01Ninerian_I have a list of directories as java.io.File, How can I filter the list, excluding entries with a specific folder name?
06:13dysfun(filter #(= (.whatever %) "foo") dirs) where .whatever is the relevant java.io.file method
06:14dysfunor not= perhaps
06:14SagiCZ1you may want remove, which is the opposite of filter
06:20Ninerian_great, thanks
06:43hellofunkshould I expect any overall performance issues on my 3-year old laptop if I run multiple REPLs simultaneously
06:43SagiCZ1hellofunk: i would expect you run out of RAM very soon
06:44SagiCZ1I have 4GB and 2 REPLs, my IDE and Chrome kill it in a few minutes
06:44hellofunkanyone know how much RAM a typical REPL uses up? Is it a standard number associated with JVM defaults or something?
06:44hellofunkSagiCZ1: which IDE do you like?
06:46SagiCZ1Yes it is a standard Java process so you can even set the heap size with arguments..
06:46SagiCZ1I use IntelliJ with cfleming's amazing Cursive plugin.. although I have to note that I have been unhappy with performance of the new 14 version.. Feels like the 13 version was faster..
06:48hellofunki'm using intellij 14.0.1 and liking it, but cannot compare it with previous version
06:48hellofunkjust started using it. it's awesome
06:49hellofunkit def does all the things i wish Cider could do
06:49SagiCZ1hellofunk: yeah it is.. and even after years of experience with it I still find new cool features..
06:51luxbockhellofunk: what things does Cursive do that Cider doesn't?
06:52SagiCZ1luxbock: isnt cider in emacs?
06:52hellofunkluxbock: watch cfleming's conj presentation on youtube for the first round of examples
06:53luxbockSagiCZ1: yep
06:53luxbockhellofunk: alright
06:53hellofunkluxbock: but in short, it offers a lot of great tools that unlike Cider do not require REPL to offer all the editing coolness because it analyzes syntax directly
06:53SagiCZ1luxbock: well the main difference would be, that people dont need to learn emacs to use Cursive.. IntelliJ is similar to NetBeans or Eclipse only faster and less convoluted..
06:54luxbockyeah I'm pretty deep into Emacs already so I doubt I'll ever switch to using anything else :P
06:54luxbockwas just wondering if there was something I was missing out
06:54hellofunkluxbock: there is a big philosophical difference in how it handles editing. Cider uses a REPL for access to docs, arity hints, other things. Cursive, especially for clojurescript code, allows all these same tools
06:54hellofunkwithout relying on a REPL (though the REPL is available of course)
06:54SagiCZ1luxbock: i think there might be things you are missing out on, but maybe not enough to bother with changing your tool-chain.. not that i do not have experience with cider
06:55luxbockI always have a REPL open though
06:55hellofunkluxbock: because Cursive is operating at a syntax-only layer, it can mangle your code in ways Cider does not. lots of refactoring tools, and the structural editing and navigation features surpass emacs in my opinion
06:56luxbockI'll watch that video now and see if there's something my Emacs can't do :)
06:57hellofunkluxbock: out of the box, it does a lot Cider does not do. But emacs is certainly capable of doing these things, but no one has or is likely to develop a whole new approach to editing clojure in emacs
06:57hellofunkluxbock: also, that video whetted my appetite but i've discovered much more awesomeness after using it for about a week, stuff that is not in the video
06:58luxbockso Cursive doesn't use a middleware like Cider does?
06:58hellofunkluxbock: i sure ain't no IDE engineer so I don't know. but it does not at all require a connection to a REPL whatsoever
06:58cflemingluxbock: No, it doesn't
06:59SagiCZ1and here he is!
06:59cflemingcfleming: Most of the functionality is provided by analysing source code, so doesn't need a REPL
06:59cflemingOops, talking to myself again, sheesh
06:59hellofunkluxbock: i will say this: if someone developed a tool with Cursive's features for emacs, i would still prefer to use emacs, because I love it. and i know emacs is capable of just about anything. but i would certainly never hold my breath that it's going to happen anytime soon, or ever.
07:00hellofunkcfleming: lol
07:00luxbockI was under the impression that well configured Clojure environment for Emacs still had more features than Cursive
07:00cflemingYou can get pretty close to cursive's features if you're an emacs power user and have your IDE totally tricked out with clj-refactor etc
07:01cflemingAnd there are still features in Emacs that Cursive doesn't have yet - I'm working on macroexpansion right now, for example
07:01luxbockyeah projectile and clj-refactor helps a lot
07:01hipsterslapfightare you telling me the last three weeks i've spent trying to learn emacs to write clojure in has been pointless?! :v
07:01SagiCZ1hipsterslapfight: YES! dont learn clojure in emacs if you dont know either of those! too hard
07:02hipsterslapfighthahaha, okay then
07:02cfleminghipsterslapfight: It's not pointless - now you really understand you don't want all that pain just to write some code :)
07:02hipsterslapfighthttps://www.youtube.com/watch?v=vt1y2FbWQMg is this the video that was talked about earlier?
07:02SagiCZ1hipsterslapfight: check this out.. its a guide for instalilng beta version of Cursive https://cursiveclojure.com/userguide/
07:02hellofunkhipsterslapfight: i cherish being forced to learn emacs a year ago, it's awesome for so many things that i now rely on (irc, shell interaction, all kinds of stuff). but for editing clojure, if you don't want to learn emacs that is absolutely no need to now that Cursive is out there.
07:03hipsterslapfightcool, thanks SagiCZ1 hellofunk cfleming
07:03hipsterslapfightwill check this out
07:03luxbockI learned how to touch-type (with Colemak, which I since stopped using), use Emacs and Clojure at the same time :P
07:03cflemingluxbock: that must have hurt
07:03luxbockhaving not much of a programming background
07:03luxbockyeah was a bit rough at first
07:04scottjluxbock: how long did you use colemak and why did you stop?
07:04clojurebotIt's greek to me.
07:04luxbockscottj: I used it for a year and stopped when I started using evil with Emacs
07:05cflemingclojurebot: I know how you feel
07:05clojurebotPardon?
07:05cflemingYou heard me
07:05hellofunklol
07:05luxbockI started using evil because my wrists started hurting from the regular Emacs keybinds
07:05hellofunkclojurebot: just, thank you for being you
07:05clojurebotHuh?
07:05hellofunkoh, clojurebot
07:07scottjluxbock: (non-evil non-colemak user here), was there some annoying mismatch (other than hjkl)?
07:09luxbockscottj: I tried to make it work at first, but then I also started using Pentadactyl with Firefox, and I realized I coulnd't be bothered to customize everything that uses the Vim keys
07:09scottjluxbock: ahh, ty
07:10scottjluxbock: btw, is it just hjkl or is there something else about colemak that's annoying with vim?
07:10luxbockscottj: mostly just hjkl, the rest of the stuff is reasonably close
07:12luxbockdoes anyone know if Batsov, the maintainer of Cider, hangs around in IRC?
07:13puredangerI don't think so
07:14cflemingluxbock: I think there's a clojure/emacs channel
07:15luxbockcfleming: yep I'm in there, but I didn't see his nick there, but wasn't sure if he just used a different nick
07:15cflemingluxbock: I'm not sure - I don't think I've ever seen him around
07:16luxbockI was wondering if it would be possible to build a macroexpand for functions, where it would work by looking up the symbols and expanding them with the body of the function wherever it can. it would stop when it reaches a clojure.core function
07:18luxbockI think for functions defined in the REPL one would need to use a nREPL middleware that would attach the function body as meta-data on the function though
07:19slipsetcfleming: just curious, why would you develop clojure without having a REPL running?
07:20cflemingslipset: You don't have to, Cursive fully supports the REPL, it just doesn't rely on the REPL for editing functionality
07:20SagiCZ1slipset: in Cursive I actually have REPL up and I execute blocks of code from my editor window via shorcuts and then maybe edit them, tweak them and then copy paste them back to the editor..
07:21cflemingslipset: Analysing source rather than using the REPL has pros and cons, but I think ultimately it will be a more powerful solution
07:21slipsetcfleming: I understand that Cursive lets you have the REPL running, but I can't see why you'd ever want to program Clojure without having the REPL running, so the advantage of being able to do stuff without the REPL seems moot?
07:21slipsetcfleming: I'm not critizing nor trolling, just wondering.
07:22cflemingslipset: Sure, no problem, no offense taken :)
07:22cflemingslipset: It's more that analysing the source allows a lot of functionality that you can't get via a REPL
07:23slipsetcfleming thanks
07:23cflemingslipset: For example, you can create an index of your whole project - that's very hard to do from a REPL
07:23slipsetWhat constantly seems to be a problem for me, is that I end up with something in the REPL which is not in my source files
07:24cflemingslipset: Also, all Cursive's functionality has worked for a long time for ClojureScript - that's only starting to come to REPL based systems now
07:25cflemingslipset: That's fine, if you're working in the REPL editor Cursive uses the REPL much like Cider would. If you're working on your project files it uses the project indexes.
07:26slipsetcfleming: out of curiosity, I used to use IntelliJ for JS development, but I never trusted their refactoring tools in such a dynamic language, since rename-thingy basically becomes a global search-replace.
07:26slipsetDo you have such problems with Clojure as well?
07:27cflemingslipset: To a certain extent, but Clojure is more regular than JS. It can never be 100% accurate in some cases, but it's pretty close for most cases.
07:27cflemingslipset: It's certainly much better than global search/replace.
07:27slipset:)
07:28SagiCZ1when intellij isnt sure what you wanted to refactor it shows quite handy filterable/groupable view that lets you easily decide what you had in mind
07:28cflemingSagiCZ1: True, although Cursive doesn't do that much yet. I'm definitely going to add that for ambiguous cases though (like renaming keywords)
07:29slipsetcfleming: I guess (keyword "foo") could trip you up when renaming :foo to :bar?
07:30SagiCZ1slipset: well generally you dont want to rename literals
07:30cflemingslipset: Sure, or cases like (defrecord Record [field]) (:field (->Record x))
07:31cflemingslipset: You're never sure if that :field use really refers to the record field or not, and even if you are the developer might have used :field in some other context elsewhere
07:31slipsettrue
07:31hipsterslapfighti've never used an IDE before, would i still be able to get the most out of cursive/find it useful?
07:32SagiCZ1hipsterslapfight: definitely
07:32cflemingslipset: That said, Cursive now provides find usages for keywords which finds :keys destructurings and allows you to rename them in one go, it's really awesome for refactoring map-based code
07:32hipsterslapfightcool, will finish watching cfleming's video then download everything and get it set up :3
07:32SagiCZ1hipsterslapfight: if you have any trouble, feel free to ask for help
07:33slipsetcfleming: yes, I saw that in your conj talk, great talk BTW and quite impressive stuff!
07:33hipsterslapfightthanks SagiCZ1!
07:33Emppericfleming: oh shit, really?
07:33Empperiawesome
07:33cfleminghipsterslapfight: Sure, there's a learning curve like everything but IntelliJ is generally easier to get your head around than emacs/vim - it works like a "normal" app
07:33Empperiand I guess ::foo is only refactored in that namespace?
07:33cflemingslipset: Thanks!
07:33hipsterslapfightcool, thanks cfleming
07:34cflemingEmpperi: Yeah, Cursive provides completion and renaming for keywords, and it's namespace aware
07:34Emppericfleming: that being said, I've been facing a frustrating problem lately with Cursive in Windows
07:34Empperifor some reason the keyboard shortcuts for REPL interaction don't seem to get through most of the time
07:34Empperisometimes they do
07:34Empperidoesn't happen in OsX o_O
07:34Empperiand I mean operations like load current namespace into repl etc
07:34cflemingEmpperi: That's really weird - you mean that sometimes they just don't work?
07:34Empperiswitch repl to current namespace
07:34Empperiyeah
07:34SagiCZ1cfleming: oh and in intellij 14 the REPL menu disappeared from Tools
07:34Empperinothing just happens
07:35Empperiit's like the commands don't get through the nrepl
07:35cflemingEmpperi: And you definitely have a REPL running?
07:35Empperiabsolutely
07:35Empperiwhat always works is "evaluate form before cursor in REPL"
07:35cflemingSagiCZ1: It won't be there until you have a REPL running
07:35Empperithat hasn't failed even once
07:35hellofunkhipsterslapfight: one thing I will say is that it is really nice to customize your work environment in Cursive compared to emacs. you don't have to "code" your work environment like you do in emacs. now once you get it setup, you may never change it, but it's nice to be able to make changes quickly and easily.
07:36EmpperiI did not have this problem earlier, but it's been there in the last few versions
07:36SagiCZ1cfleming: oh.. nevermind then, no bug, it works, sorry
07:36Empperihave it both at my work desktop computer and at home desktop
07:36hipsterslapfighthellofunk: i was really happy when it only took me half an hour to figure out how to get `#` to come through properly (M-3 on british keyboard) in emacs :v
07:36hipsterslapfightso yes, that sounds pretty good to me
07:36Empperihome mbp and work mbp don't have that problem
07:36cflemingEmpperi: That's very strange, I've never heard of that. If you look in your Tools menu, do the menu items have the shortcuts beside them?
07:36Empperiyes
07:37cflemingEmpperi: Huh
07:37Empperiit's such a vague problem I haven't even bothered to write an issue out of it
07:37Empperibut it such a pain in the ass
07:37cflemingEmpperi: I have no idea what could cause that
07:37hellofunkslipset: for starters, clojurescript dev doesn't use a REPL like clojure does. so Cursive allows you to have access to all these cool editing tools because it does so without a REPL and puts cljs and clj on the same plane for editing prowess
07:37Empperiit is
07:37cflemingEmpperi: yeah, no doubt.
07:37Empperihave had that problem both in intellij 13 and 14
07:37SagiCZ1Empperi: isnt there a difference having the keybindings defined in the Other Settings/Clojure/Keybindings and in regular IntelliJ keybiundings?
07:38EmpperiSagiCZ1: yes
07:38Empperibut anyway, those do work sometiems
07:38Empperisometimes
07:38cflemingEmpperi: Do you have problems with any other actions? Any normal IntelliJ ones, or structural editing?
07:38Empperiit seems to be related to how long the REPL has been running
07:38Empperiusually if I start a fresh REPL it'll work for a while
07:38Empperino, everything else works just fine
07:38Empperiit's just the REPL interaction from the editors
07:39cflemingEmpperi: Any exceptions in your log?
07:39Empperinone
07:39Empperiit's just like the keybind was not there
07:39SagiCZ1Empperi: I have all of them defined in AppearanceBehavior/Keymap.. and the Clojure keybindings is empty.. and it works well.. maybe try that
07:39hellofunkcfleming: you said: Cursive now provides find usages for keywords which finds :keys destructurings and allows you to rename them in one go, it's really awesome for refactoring map-based code.
07:39hellofunkcfleming: where can i read more about this?
07:39Empperiyeah, I've configured my keybindings myself since most of those operations don't have default keybindings anyway
07:40cfleminghellofunk: Only in IRC unfortunately :-)
07:40cfleminghellofunk: My doc is woefully out of date
07:40cfleminghellofunk: I demoed that in the video though
07:40Empperiit works just like any other "find references" etc does
07:41Empperijust tried it, never even tried to do that before with keywords
07:41Empperiseems to work just fine
07:41Empperiwhich is awesomesauce
07:42Emppericfleming: one possible lead I do have though with that problem
07:42cflemingEmpperi: Can you send me a mail at cursive@cursiveclojure.com? I'll send you a dev version with some debugging to figure out what's going on
07:42cflemingEmpperi: Shoot
07:42hellofunkcfleming: i'll have to watch again to remember. what am i to do? there are just way too many incredible things about Cursive to keep in my memory.
07:42EmpperiI've sometimes seen that the commands are queued
07:42Empperilike I've hit load file in repl several times in frustration
07:43Empperithen I go and use the menu to do that and then boom, it loads it several times
07:43EmpperiI'd like to point out that using the menu with mouse works every time
07:43Empperiit's just the keybindings which are funky
07:43EmpperiI have no idea at all if it is even Cursive's problem
07:43cfleminghellofunk: Find usages (Cmd-Option-F7) on a keyword should find all usages of a keyword
07:44cfleminghellofunk: If that keyword is used in a :keys destructuring, you'll be shown those usages too
07:44hellofunkcfleming: thanks but the first thing i did with Cursive is setup a wholly custom keymap for everything, so i probably disabled that. i'll find that command somewhere though.
07:44SagiCZ1hellofunk: check out extracting and inlining variables.. so cool!
07:44Emppericfleming: and I'll send the mail
07:45cfleminghellofunk: You can also find usages from the :keys binding too, so if you have {:keys [field1 field2]} you can find usages on field1 and field2
07:45cfleminghellofunk: And it will show usages of that keyword and it's destructured vars everywhere
07:46cflemings/vars/bindings/
07:46cfleminghellofunk: Renaming from any of those points will rename the keyword and all the bindings
07:46cflemingEmpperi: Ok, it might me some difference in IntelliJ's key handing on Windows, but no-one else has reported it
07:47cflemingEmpperi: Send me a mail and we'll see what we can do
07:47Empperiyeah, if it was just one computer I'd say it is my computer
07:47Empperibut it's two totally different computers
07:47Empperiwith two different Ideas (at work using Ultimate edition, at home Community edition)
07:47cflemingEmpperi: Got the mail, thanks. It's past my bedtime but I'll look at making a build tomorrow and get back to you
07:47Empperiyeah, no worries
07:48EmpperiI do have my macbook too :)
07:48cflemingEmpperi: Clearly the solution is just to use a mac :)
07:48Empperiboth have their perks
07:48cflemingYeah, no doubt
07:48EmpperiI like to stay using actively both
07:48Empperimakes me see things in a wider perspective
07:53cfleminghellofunk: Definitely enable "Show Usages" though, it's one of the commands I use most
07:56hellofunkcfleming: sweet. i found it easier to setup a new keymap rather than learn any of the existing ones. allowed me to leverage my opinions on editing and do so quite easily
08:03hellofunkmy paredit and structural tools, as well as basic navigation around a source file are all non-standard key command now in Cursive, i feel like i'm playing a piano when i code rather than making my fingers play a game of Twister
08:33luxbock,('foo {'foo "bar"))
08:33clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
08:33luxbock&('foo {'foo "bar"))
08:33lazybotjava.lang.RuntimeException: Unmatched delimiter: )
08:33luxbock('foo {'foo "bar"}))
08:33luxbockgrrr
08:34luxbock&('foo {'foo "bar"})
08:34lazybot⇒ "bar"
08:34Ninerian_(defn get-XML-files
08:34Ninerian_ "Search files after a regex match.
08:34Ninerian_ Returns a list with java.io.files excluding Backups"
08:34Ninerian_ [searchDirectory pattern]
08:34Ninerian_ ((filter
08:34Ninerian_ #(not= (re-find #"_BACKUP" (str %)) "_BACKUP")
08:34Ninerian_ (fs/find-files searchDirectory pattern))
08:34luxbockdidn't know that symbols are functions as well
08:34Ninerian_ ))
08:34Ninerian_I have a function '
08:34Ninerian_I have a function `(defn get-XML-files
08:34Ninerian_ "Search files after a regex match.
08:34Ninerian_ Returns a list with java.io.files excluding Backups"
08:34Ninerian_ [searchDirectory pattern]
08:34Ninerian_ ((filter
08:34Ninerian_ #(not= (re-find #"_BACKUP" (str %)) "_BACKUP")
08:34Ninerian_ (fs/find-files searchDirectory pattern))
08:34Ninerian_ ))
08:35foodooMy memory claims that there is a counterpart to "filter" in Clojure. Something like "filter-false". Is there such a function in clojure.core?
08:35clgvNinerian_: use refheap.com or similar
08:35luxbockfoodoo: `remove`
08:35clgvNinerian_: nobody can ready you multiline code paste on irc
08:35foodooluxbock: thanks :)
08:35Ninerian_sorry.
08:38Ninerian_https://www.refheap.com/95874
08:38Ninerian_Could you explain me, why the first throws the exception and the second not?
08:40slipsetninarian: skip the extra parens
08:40slipset((filter doesn't make sense
08:40slipsetuse (filter ...)
08:40SagiCZ1Ninerian_: btw instead of .. filter not(= ... you can use .. remove =
08:44Ninerian_Thanks the extra parens caused the error. What do you mean with remove = filter not( ?
08:44slipsetremove removes elements from the list for which the predicate is true
08:44SagiCZ1remove does opposite of filter..
08:45SagiCZ1,(remove odd? (range 10))
08:45clojurebot(0 2 4 6 8)
08:45SagiCZ1,(filter odd? (range 10))
08:45clojurebot(1 3 5 7 9)
08:45Ninerian_ah okay
08:54SagiCZ1cfleming: around 38 minutes into your conj talk Cursive lets you refactor nested lambda functions which are incorrect in clojure into either (fn #(.. ) ) or #( .. (fn .. )) .. is this feature in the current Cursive version? doesn't seem to work for me
08:56slipsetNinerian_: Just out of curiousity, you filter the result from (fs/find-files ..)
08:56slipsetNinerian_: a function which takes a regex to match files against.
08:58slipsetah, you could probably use (fs/find-files* dir p)
09:27Ninerian_Thanks, i will look into this later. Now I go further into the xml. :-)
09:27slipsetdo that :)
09:37sdegutisHi. I am working on an OOP library. I would love any feedback on the interface: https://gist.github.com/sdegutis/4ca0645798e6647fac53
09:38tbaldridgeWell the first question should be, what does this offer over defprotocol and defmulti?
09:39clgvsdegutis: isnt there another lib already that explores OOP on top of clojure? something similar to CLOS afair
09:39sdegutisFirst, it lets you add methods to a a class via mixins, which I'm not sure how to do that.
09:39sdegutisclgv: CLOS is pretty complex, whereas mine aims for simplicity.
09:39tbaldridgesdegutis: protocols can do that, you can extend them to any Java class.
09:40sdegutistbaldridge: This one lets you extend them to any class using this system.
09:40sdegutistbaldridge: Second, this one has a very convenient shortcut for partialling an instance method with "self" and getting a 1-less arity
09:40sdegutisIf you have an instance 'bob' with a method :greet, you can do (:greet bob) and get the 0-arity function with bob already bound to it.
09:41tbaldridgeor I could just do (partial greet bob) with protocols and not have to include a new dep. Anyway, that's my feedback.
09:42sdegutistbaldridge: I don't expect you to agree with the philosophies behind my library at all, in fact I think you'll probably strongly consider it an anti-pattern -- and I won't take offense at that.
09:42sdegutisok
09:43clgvtbaldridge: what's new in pixie since mid december?
09:43sdegutistbaldridge: I'm not seeing how you can combine behavior in a "mixin-like" way using Clojure protocols
09:44tbaldridgeclgv: FFI support is pretty much what I'm working on these days. The current state is this: https://github.com/pixie-lang/pixie/blob/master/pixie/math.pxi should get even more elegant in a month or so.
09:45sdegutistbaldridge: other than that, do you consider pixie stable/mature enough for daily private use yet?
09:45tbaldridgesdegutis: with extend and extend-type you can modify any existing class to extend a protocol.
09:46tbaldridgeEh, we're not going to be stable for about another half a year, but I do plan on releasing something by the end of Q1 of this year.
09:46sdegutistbaldridge: but afaict you can't take an implementation of something and combine it with another implementation in order to share behavior, which is what mixins do
09:46clgvtbaldridge: great :)
09:47sdegutistbaldridge: the "mixins" in my library are basically like "multiple inheritance" but without any inherited initializers or the ability to override inherited functions
09:49sdegutistbaldridge: thanks for providing me with a good idea of what kind of questions people will ask about my lib and what kind of things they will be confused about that I'll need to clarify up-front
09:50tbaldridgesdegutis: take a look at clojure.core/extend. That function takes a type and a hashmap of functions. You can easily create mixins with something like that http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/extend
09:51sdegutistbaldridge: right, but that inverts the solution, since can't describe a thing that accepts mixins, you add mixins onto a thing -- in order to get what I want, I'd have to write a wrapper around that anyway
09:51sdegutistbaldridge: so basically I might use extend/defprotocol/deftype in my library's implementation
09:51sdegutisBut it's still a unique interface in its own right.
09:51puredangerDavid McNeil did something when we were working together that's in the ballpark of this - http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure
09:53sdegutisOne primary opinionated aspect of my library that's sure to be disagreed with strongly is that methods can be accessed without any special functions -- an object is just a Clojure map and its bound-methods are just keys within it.
09:53sdegutisThus if you have an object, you don't need any requires to use it, you just access its methods and call them.
10:25justin_smith$mail sm0ke edn and js? you should look at transit
10:25lazybotMessage saved.
10:54sdegutisCan macros really not make use of private functions?
10:56clgvsdegutis: they can use those at macro expansion time, but you cant include those private functions in the generated code that is returned
10:56sdegutisI see.
10:56sdegutisThanks.
10:56ordnungswidrigclgv: even not if they exapand in the same namespace?!
10:57sdegutisNot ideal but meh.
10:57Bronsaordnungswidrig: that'll obviously work but in that only makses sense for a private macro
10:58ordnungswidrigBronsa: Now I get it, yes, the macro is expanded on the caller side, of course
10:59ordnungswidrig...in the caller's namespace
11:00clgvas Bronsa said ;)
11:01tbaldridge(inc clgv)
11:01lazybot⇒ 42
11:01tbaldridgeheyo!
11:01clgvuh, that came unexpected
11:01ordnungswidrigclgv: they free you from thinking about the interface and documentation!
11:02clgvordnungswidrig: a unified metadata that is supported by all those api doc generators would suffice for that
11:03clgv*metadata tag
11:03ordnungswidrighmm, never use them.
11:03ordnungswidrigI never use them. Just (doc some-fn) or maybe the dider integration
11:05clgvbut (defn ^:api some-fn ...) would be pretty obvious as well, though information in the output of (doc some-fn) would be nice as well then
11:28LesteIm giving my first steps into programming using this as a resource. http://iloveponies.github.io/120-hour-epic-sax-marathon/training-day.html.
11:29Lestewhys this doesn't evaluate 2728? (- 2 (* 78 35))
11:29Lesteand results a negative number?
11:30tbaldridgebecause 2 - something large is a negative number.
11:30hfaafbbecause 2 - 2730 is -2728
11:30tbaldridge,(- (* 78 35) 2)
11:30clojurebot2728
11:31Leste@tbaldridge thank you. makes sense now
11:31Lesteim embrassed with my noob question now:)
11:42puredangerwe are all noobs sometimes!
11:44hfaafbnot me
11:51daniel``nor me
12:00EvanRok
12:01EvanRso by using clojure.java.io/input-stream i get a java.io.BufferedInputStream. how do i use this in clojure?
12:01EvanRis it like a lazy seq of bytes
12:02llasramEvanR: What are you trying to read / what do you want to get it as?
12:02EvanRim trying to split it to get a vector of byte-strings
12:03llasramAnd by "byte string" you mean?
12:03EvanRbyte[]
12:04stuartsierraEvanR: I'd suggest starting with the Java tutorials on Basic I/O http://docs.oracle.com/javase/tutorial/essential/io/index.html — the interop isn't difficult once you know the conventions.
12:04llasramOk. Welllll, you can certainly use the Java InputStream methods to read bytes directly
12:04EvanRi see that in the java docs
12:04EvanRi "just" pass in byte array objects which it will fill
12:04llasramEvanR: Where are these bytes destined?
12:05EvanRthey will be separated into a data base transaction and zero or more files to be written to disk
12:05EvanRwell uploaded to cloud storage
12:06EvanRafter being validated and converted etc
12:06llasramIf the data itself has structure, you could use https://github.com/ztellman/gloss to parse them
12:06llasramI think there's another similar library about, but I can't recall its name off the top of my head
12:07llasramOtherwise, you can either use the InputStream methods, and/or use nio ByteBuffers
12:08puredangerBuffy the ByteBuffer slayer?
12:08llasramAh, yes
12:08puredangerhttps://github.com/clojurewerkz/buffy/
12:08ssideristhere is also gloss
12:08ssiderisa similar library
12:09EvanRgloss and buffy
12:09clgvThat library is missing the mandatory image that goes along when a reference is used as library name ;)
12:10llasramA picture of Professor Pangloss would quite liven it up
12:10clgvllasram: you had to pick the wrong one! :P
12:10llasram</humor>
12:11clgvrecognized, but I wanted to complain anyway :D
12:11EvanRgloss looks more likely to work
12:13EvanRnow if i could only figure out how to use it
12:16EvanR(decode-all frame bytes) i guess bytes means BufferedInputStream
12:17EvanRor ByteBuffers...
12:18llasramEvanR: I believe it will work
12:18llasram(with the InputStream)
12:19llasramIt uses https://github.com/ztellman/byte-streams to coerce the input to a sequence of bytes
12:19llasram*sequence of byte buffers
12:19clgvEvanr nio.ByterBuffer it seems
12:20ssiderisEvanR: with gloss you need to define the format of the bytes using the DSL and then you pass it the format and the bytes
12:20ssiderisssideris: but it expects all bytes to be accounted for, you can't do a partial "parse"
12:20EvanRdoes the common "sequence of bytes" support streaming?
12:21llasramEvanR: See `lazy-decode-all`
12:21EvanRwhere?
12:21clojurebotwhere is your source code
12:21llasramEvanR: gloss.io/lazy-decode-all
12:21EvanRok its not listed here http://ideolalia.com/gloss/gloss.io-api.html
12:21llasramOh, or `decode-stream` really
12:22EvanRalso not there
12:22llasramYep. The generated API reference appears to be well out-of-date
12:23EvanRjust for my information, if i wasnt dealing with java right now, what would be the clojure way to deal with io handles that take and return chunks of bytes at a time
12:23llasrammu
12:23EvanRnone of the above?
12:23llasramYeah, pretty much
12:24EvanRthat simpliest things
12:24EvanRsimplifies
12:24llasramgloss, buffy, etc exist to fill the otherwise-absence
12:24seangroveIn cljs, I have a (deftype Chainable [coll] ...), is there a way to add a method to the Chainable prototype?
12:25seangroveI can add it to the object created, but deftypes don't seem to instantiate objects with an intermediate prototype
12:25llasramEvanR: Or to slightly-differently understand your question, all JVM Clojure IO uses the underlying Java classes, so you're using Readers, InputStreams, and/or nio
12:26EvanRok but these involve mutable buffers
12:27llasramEvanR: Same situation. For strings, Clojure just uses the (immutable) Java String class
12:27llasramBut Java has no immutable byte-sequence class, and Clojure itself does not provide one
12:27EvanRyes strings seems more fortunate
12:27llasramSo you are in mutable land with byte arrays or nio ByteBuffers or the netty etc equivalents
12:28llasramIndeed (re: more fortunate)
12:28thhellerseangrove: the JS prototype i presume?
12:28EvanRyeah i have NettyBufferedStreamCache at the moment, when a minute ago it was a RemoteFile
12:28thhellereg. add an instance method the Chainable. instances?
12:28EvanRhopefully the input-stream magic works in both cases
12:29llasramWorst-case you'll need to do some interop to get at something which can generate byte/buffers
12:30EvanRdecode-stream returns a "channel"
12:31EvanRjava.nio.Channel...
12:31EvanRwhats this?
12:33llasramI thought it returned a manifold channel, but I haven't looked at manifold in detail yet -- maybe that's what it uses under the good?
12:33seangrovethheller: Yeah, exactly
12:33llasramEvanR: lazy-decode-all might be more appropriate. It's honestly been a while since I last used gloss, and I don't have the code for the project handy at the moment
12:33llasramAnd alas ztellman doesn't seem to be around at the moment
12:33thhelleryou can do that in deftype via Object
12:34thheller(deftype Chainable [coll] Object (someFunction [this] ...))
12:34thheller(.someFunction (Chainable. []))
12:34thhellerwould work after that
12:34seangrovethheller: Sorry, yes, doing that, but it adds it to the object, not its prototype
12:34thhellerhmm nope?
12:35seangroveI need to add a .toString method to the prototype so the chrome dev console can print out a string represetation by default
12:35EvanRit does return a manifold.stream... rather than whats advertised
12:35EvanRmanifold/stream
12:35thhellerdev console doesnt use toString AFAIK
12:36thhellerif you check Chainable.prototype.someFunction in the console its all there
12:36weavejesterHas anyone experienced issues with cljx recently?
12:37weavejesterI updated to 0.5.0 and it keeps excepting with "namespace 'cemerick.piggieback' not found"
12:37seangrovethheller: Thanks, I'll check that out again, I must have been mistaken about it
12:38thhellerI wanted to change the way console prints objects too some time ago
12:38thhellereventually gave up though :P
12:38seangrovethheller: Ah, never got it?
12:39sdegutisNever mind, I figured it out.
12:40thhellerwell sort of. I now have a helper function+macro that first runs its arguments through (console-friendly val)
12:40thhellerconsole-friendly checks whether an object satisfies IPrintWithWriter, if it does it prints that
12:41thhellerexcept for some special cases (basically the types console already likes)
12:41EvanRok so, before i dive into whats necessary to do all this... how do you "just" decode the contents of a InputStream and get a string
12:41thhellergot tired of not being able to log clojure maps
12:41EvanR(str just gives "BufferedInputStream@..."
12:41seangrovethheller: Very nice - does that handle lazy infinite sequences nicely? I'd be concerned about locking up the console whenever it tried to pretty-print some custom cljs object
12:42thhellerno it will blow up
12:42thhellerbut I don't have those ;)
12:42seangrovethheller: Heh, awesome, thanks for the head sup
12:42seangroveheads up, even
12:43thhellermight be possible to extend the dev tools to support more objects
12:43thhellerbut not sure how to
12:43EvanRslurp
12:44weavejesterLooks like the latest cljs version doesn't work well with cljx...
12:44sdegutisGiven [[:a 1 10] [:a 3 20] [:b 4 80] [:c 2 90] [:b 5 30]] what's a reasonable way to get {:a [[1 10] [3 20]] :b [[4 80] [5 30]] :c [[2 90]]} ?
12:44dnolen_thheller: re: CLJS-948, faster to discuss here
12:44sdegutisBtw this is not a homework problem.
12:44thhellerhey, sure. whats up?
12:44sdegutisI know it looks like it but trust me it's really not.
12:45dnolen_thheller: seems like this is just a problem w/ the patch no? in the cached case we invoke parse-ns with :load-macros true and :analyze-deps true
12:45dnolen_thheller: line 1876 in analyzer.clj, so I do not understand why we aren't covered
12:48sdegutisgroup-by might work here, but then the values would need to be stripped of the first argument which is ugly.
12:48sdegutis*first element
12:48thhellerchecking, I'm not too familiar with the core caching code
12:48dnolen_thheller: that's the point of that line and why caching works at the moment
12:49dnolen_thheller: perhaps we don't propagate those options through
12:49thhellerI ran into the described issue with shadow-build, roughly following the cljs code I presumed it would have the same issues
12:51OscarZim trying to learn about macros here: http://learnxinyminutes.com/docs/clojure-macros/ .. this is weird stuff.. is it that when macro is run in code, it does some kind of bytecode generation / compilation at that time so it will be quite slow?
12:51OscarZjust thinking about what macro actually compiles to
12:51OscarZwhat is fixed at that point
12:52hellofunkOscarZ: macros do not run at runtime, the run at compile time and they output code that is then compiled and run at runtime
12:52hellofunk\
12:52dnolen_thheller: testing should only be about ClojureScript - shadow-build is separate concern
12:52hellofunkOscarZ: they are like writing a program that runs before your program runs
12:52lodinsdegutis: Use (fn [[k & vs]] {k [vs]}) and then merge-with concat.
12:53dnolen_thheller: if there's something that make using the functionality difficult to use from shadow build that can addressed too but that's not the first thing to test
12:53sdegutislodin: sounds clever! I'll try it :)
12:53dnolen_s/make/makes
12:53lodinsdegutis: Adjust accordlingly if you really want vectors everywhere.
12:53sdegutisnah
12:53thhelleryeah of course. strill trying to understand the code path of caching
12:54thhelleranalyze-deps is confusing
12:54dnolen_thheller: it's just bottom up
12:54thhellerlet me try a plain CLJS example and see if I can reproduce the problem
12:54dnolen_thheller: analyze-deps always goes through analyze file
12:54hiredmanBronsa: does tools.reader have some kind of thing where it can read in a clojure map, but tell me what order the keys appeared in the source?
12:54dnolen_thheller: caching, reading caches only happens in analyze-file
12:55thhelleryeah I mean analyze-deps and how it relates with cache
12:55thhellerthere is a :restore option
12:55dnolen_thheller: analyze-deps just defers to analyze-file
12:55dnolen_thheller: don't confuse `parse-ns` w/ anything else :)
12:55hiredmanwe have this big map of stuff at work, and I would like to enforce that entries added to it are sorted
12:56dnolen_thheller: `parse-ns` is a utility for parsing namespaces, you normally want to backtrack side-effects to compilation enviroment
12:56thhellerwait parse-ns doesn't actually read the cache?
12:56postpunkjustinOscarZ: try playing around with the macroexpand function to see some examples in action
12:56Bronsahiredman: the source logging reader keeps the string source around
12:56dnolen_thheller: absolutely not
12:56postpunkjustin,(macroexpand '(when-not true :body :body))
12:56OscarZok, will do
12:56clojurebot(if true nil (do :body :body))
12:56dnolen_thheller: I think you keep getting tripped up about parse-ns, it's just a utility used for extra ns-info
12:57dnolen_thheller: it defaults to never mutate the compilation environment, never analyze dependencies
12:57dnolen_thheller: only when we read a cache file do we disable the defaults
12:57hiredmanBronsa: seems like that would leave me back were I started (having a string that contains a clojure map that I want to check the order of keys in)
12:57Bronsahiredman: http://sprunge.us/eUfd?clj not sure if that'll be much helpful though
12:58dnolen_s/used for extra ns-info/used for extracting ns-info
12:58Bronsahiredman: yeah..
12:58sdegutislodin: beautiful, thanks :)
12:58thhellerah, alright.
12:59hiredmanmaybe I can use parsley's parser
12:59Bronsahiredman: at the moment there's nothing else that would help you, a parser would probably be a better help
13:00thhellerdnolen_: then there should be no problem, totally got that wrong
13:00dnolen_thheller: so the patch should be fine as is?
13:01thhellerI would think so
13:01thhelleras long as *load-macros* is true there is no problem
13:02thhellerwhich it seems to be unless one manually calls parse-ns without
13:02thhellerIt is kinda difficult to write a test for this since you'd have to unload the macro namespace
13:04cemerickweavejester: please file an issue
13:05sdegutis(inc lodin)
13:05lazybot⇒ 1
13:05weavejestercemerick: I will when I isolate the problem :)
13:07lodin:-)
13:28arnaudsjhi, is there a particular IRC room for the numerical clojure? (such as core.matrix and/or incanter)
13:33mikerodWho can explain why all over the clj Java source there are calls of this form: Util.ret1(arglist.first(),arglist = null)
13:34mikerodI'm guessing it has something to do with ensuring the reference is null'ed out for gc or something
13:34mikerodbut it is strange to me. I don't see why that is necessary.
13:34tbaldrid_mikerod: yeah, that has to do with locals clearing.
13:34mikerodit may be called "locals clearing" I think from some digging, but I haven't really seen that explained anywhere in anything I've searched for
13:34tbaldrid_It passes the arg in, while at the same time setting the arg to null.
13:35mikerodtbaldrid_: yes, I always hear this "locals clearing", but I can't find anything about it
13:35mikerodSo here I was looking at AFn#applyToHelper
13:35mikerodI don't get why you'd have to manage that reference setting to null
13:35mikerodseems like when the method exited, the hard reference would be gone
13:35tbaldrid_Without it, if you passed a lazy seq into a function and that function called into another, and the inner function walks the seq, the outer call frame would hold onto the head, exhausting memory
13:36hiredmancompiled java code generally puts local variables in slots provided for such in the method, and unless you null those out, they count as a gc reference
13:36tbaldrid_mikerod: right, but that allows the GC to clean it up before the method exists
13:36mikerodor something like that. I just haven't written Java where I always have to worry about null'ing out my params, locals, etc
13:36tbaldrid_mikerod: how often do you write Java code that uses a lazy seq? ;-)
13:37weavejesterHm, there's no way of extending a protocol with another protocol, right?
13:38tbaldrid_weavejester: not in CLJS but in CLJ you can I think.
13:38stuartsierramikerod: In theory, the JVM could determine that the references aren't used after the tail call and GC them. But since it's not a common pattern in Java, it doesn't.
13:38weavejestertbaldrid_: That makes sense, because you can extend interfaces
13:38stuartsierras/tail call/return/
13:39hiredmanweavejester, tbaldrid_: nope
13:39hiredmanweavejester: yeah, you will be extending the protocol to the interface that backs another protocol
13:39hiredmanwhich is not the same thing
13:39weavejesterHm, right...
13:39stuartsierraYou can extend a protocol to an interface, but it gets confusing because you can end up with multiple inheritance.
13:39hiredmanand stop using the interface that backs a protocol
13:40hiredmanunless you are careful you are going to have a bad time
13:40mikerodtbaldrid_: hiredman thanks!
13:40tbaldrid_right, that's what I was thinking of.
13:40mikerodI feel enlightened
13:40mikerodit is a lazy seq thing
13:40hiredmanreally the only time to use the interface that backs a protocol is if you have a java type you control you want to extend the protocol to
13:40tbaldrid_If I really needed that I guess I'd consider definterface + extend.
13:40mikerodI remember reading some old old clj mailing lists posts
13:40weavejesterSo how would I extend an ISeq with a protocol... I guess I can't
13:41weavejesterI'd have to use a multimethod.
13:41mikerodabout holding onto the head and how "locals clearing" was being done all over
13:41mikerodthat makes sense to me now
13:41tbaldrid_weavejester: ISeq is a interface....
13:41weavejestertbaldrid_: Not in cljs
13:41tbaldrid_oh yeah, well CLJS is a whole different beast
13:41weavejesterI'm currently writing a Functor protocol, but I've just realised it won't work in cljs.
13:42tbaldrid_"I'm currently writing a Functor protocol" Well there's your problem ;-)
13:42weavejestertbaldrid_: Is there a reason not to?
13:43tbaldrid_no, I'm just giving you a hard time about writing category theory stuff.
13:44mikerodstuartsierra: I'm guessing you ar referring to TCO here right?
13:44mikerodoh, just tail-call clearing
13:44mikerodtail-call locals clearing
13:44mikerodnot necessarily removing the stack frame completely
13:44weavejestertbaldrid_: I just want an efficient way of mapping over a collection without changing it. Functors seemed the logical way to go about it :)
13:45tbaldrid_like transducers?
13:45weavejestertbaldrid_: Do transducers retain the collection type?
13:45weavejesterI didn't think they made that guarantee.
13:46stuartsierraThere's an fmap implementation in https://github.com/clojure/algo.monads
13:46tbaldrid_no, but I'm pretty sure you could fake it with conj!, and empty.
13:46hiredmanobviously you need a lens
13:46weavejesterstuartsierra: Yep, but it uses multimethods. I wanted something a little more efficient.
13:46tbaldrid_hiredman: we need a clojurebot response for that ^^
13:47stuartsierraIf you know the result type you want you can always build it with a transducer.
13:48weavejesterHm... I could redesign it to use transducers. Does cljs have them yet?
13:48mikeroduse `into` w/ transducer
13:48tbaldrid_yep
13:48mikerod`into` <what-type-i-want> <transducer>
13:48tbaldrid_transducers were ported to CLJS within about a week of them being reduced
13:49dnolen_weavejester: cannot extend protocols to protocols unless you catch them in default case
13:49tbaldrid_,(let [v [1 2 3]] (into (empty v) (map inc) v))
13:49clojurebot[2 3 4]
13:50tbaldrid_,(let [v #{1 2 3}] (into (empty v) (map inc) v))
13:50clojurebot#{4 3 2}
13:50weavejestertbaldrid_: I wanted to make use of more efficient functions, like reduce-kv, transients and mapv.
13:51weavejesterI might just put this aside for now and wait for transducers...
13:51tbaldrid_weavejester: well into will use transients, as well as collection specific reduce, and all that exists in CLJS today.
13:51weavejestertbaldrid_: Oh, hm, that's right.
13:53weavejesterI guess I'll shelve this and wait until 1.7.
13:55tbaldrid_lol, yeah I forget that 1.7 isn't out yet.
13:56tbaldrid_that's why we should keep languages in perpetual alpha, like CLJS
13:57hiredman*snort*
14:02sdegutisI keep forgetting or not knowing what types my bindings are.
14:03sdegutisHow do you usually deal with this problem?
14:05weavejestersdegutis: What do you mean by bindings? Bound symbols, or dynamic vars?
14:05justin_smithsdegutis: I like to use prismatic/schema to declare the shapes of incoming data (at least the important parts, ie. the keys I care about in a given map)
14:05sdegutisweavejester: Symbols bound by lets & friends, and function parameters.
14:05sdegutis*by let
14:06sdegutisjustin_smith: do you mean in the context of within an app's source code, or just when an app receives data from an external service?
14:06postpunkjustinsdegutis: I second justin_smith's recommendation of prismatic/schema. I've also been using core.typed lately.
14:06postpunkjustinOtherwise docstrings
14:06justin_smithsdegutis: within the source code, where the bindings are declared
14:07justin_smithsdegutis: for data internal to the app, using it as a type declaration
14:07justin_smithI think the name "schema" hides how generally useful its assertions / descriptions are
14:08sdegutisHm.
14:08postpunkjustinschema makes for great code documentation, even if you turn it off at runtime
14:09justin_smithit's not going to enforce the rigour that core.typed does, but then again it doesn't demand the rigour that core.typed does, which is nice
14:17zB0hsis there a function to get a subset from a set using indices, so if i have #{1 2 3 4 5} i want to return 3 and 4
14:18justin_smithzB0hs: sets are not ordered
14:18zB0hsjustin_smith i had a feeling. thanks
14:19justin_smithyou can sort them and then do something like that with the sorted result
14:19justin_smithor use sorted-set / sorted-set-by
14:20zB0hsjustin_smith if i convert to a vector is the order guaranteed?
14:20tcrayford____no
14:20tcrayford____sets don't have defined order
14:20tcrayford____if you convert to a vector, then sort it, sure
14:21justin_smithif you want a specific sorting based order, sorted-set is likely what you want (just remember they don't do the pr-str / read round trip
14:21tbaldrid_zB0hs: if you seq over the same set more than once, the order will be the same
14:21tbaldrid_zB0hs: but if you add/update/remove an item from the set the order may change
14:22zB0hsthanks tabldrid_
14:22zB0hstbaldrid_
14:22justin_smithtbaldrid_: or serialize to edn, and read from a different clojure version the order may change too (odd scenario, I know, but worth considering)
14:22statanStarted using Clojurescript with NodeJS but I find myself doing more (. setProperty jsObject "value") than (cljsfunc [args] body) so I'm wondering .... what's the point? I'm not really programming in values if most of the time I'm get/setting properties in JS objects. Or maybe I'm missing the obvious.
14:23justin_smithstatan: if most of what you are doing is using existing libs, you will see a lot of interop, but the more logic you actually implement, the more native cljs, I would guess
14:24justin_smithstatan: similar comes up in jvm clojure - if what I am doing is mostly using java libs, then my code is a bunch of interop
14:24mfikesstatan: I've ended up feeling the same way when driving UIKit from ClojureScript.
14:24statanjustin_smith: There are very few cljs libs so you end up using a ton of Node libs.
14:24justin_smithstatan: yeah, I would imagine
14:25justin_smithbut I guess "the point" is that for whatever amount of unique logic you implement, you get the benefits of immutability and functional design (as much as you leverage these at least)
14:26statanUnless we replicate the masses of Node/JS libs that's not going to happen.
14:26statanjustin_smith: Rewrite node libs in cljs I mean.
14:27statanjustin_smith: ie. a LOT of work which probably won't happen
14:28postpunkjustinsatan: right, I wouldn't hold my breath for node libs to be rewritten (or even wrapped) in cljs
14:28justin_smithstatan: I bet the java standard libs compare well in size to node and the usable libs for it
14:28mfikesstatan: As justin_smith says, when I look at some imperative code that interacts with UIKit, there's lots of little functional nuggets I can extract and put off to the side.
14:28statanjustin_smith: I'm not sure a small amount of cljs code interop-ing with a mass of mutable/oo js is much of a win.
14:28postpunkjustinI also don't think the cljs/node combo is that great
14:29justin_smithstatan: and sure I end up using interop, but a fair amount of what I implement is logic that isn't just some calls to an existing lib
14:32dnolen_http://mullr.github.io/micrologic/literate.html
14:36justin_smithdnolen_: cool
14:58sdegutisHi. I wrote an OOP library. Any feedback? https://github.com/sdegutis/oops
15:02thearthursdegutis: i like the name :-)
15:02AimHereI thought the lack of OOP was supposed to be a clojure selling-point!
15:02sdegutisthearthur: :)
15:03sdegutisAimHere: OOP has its place just like FP does; they're not mutually exclusive
15:03thearthurwhich is why the name is great!
15:03sdegutisthearthur: yeah it's a nod to the common misconception that OOP is lesser than or incompatible with FP
15:04sdegutisAll the library mostly does is allow you to bind an implicit first argument to a function, containing state and other functions with the same implicit first parameter.
15:04tbaldrid_complecting state with code
15:05sdegutisI'm not sure it can rightfully be called "state" since it's immutable.
15:06sdegutisThis is for those times when you have a group of functions which act on the same data.
15:07tbaldrid_so a few bits of feedback (ignoring my aversion to OOP):
15:07tbaldrid_1) this is going to be super, slow, perhaps even slower than multimethods
15:08tbaldrid_2) unless you're namespacing methods and fields, it's going to be pretty easy to accidentally include two mixins with the same name or a mixin could override a field.
15:09sdegutisRegarding #2, that's a good point; I'll make a note of it in the readme that people should take care to avoid name collisions.
15:09sdegutisI don't know how to fix #1, although I'm not sure it'll be *super* slow.
15:10tbaldrid_well it won't be jitted properly since the JIT doesn't have a way to promote the method bodies to constants. And you'll also have the overhead of a hashmap lookup on every callsite.
15:11sdegutisI imagine it's still faster than Ruby :)
15:11tbaldrid_probably not, since Ruby at least caches method lookups, as does ObjectiveC
15:11tbaldrid_you might be able to add that, but it'd take some magic
15:12sdegutisBut Clojure is already significantly faster than Ruby.
15:13tbaldrid_that's partly because the JIT can inline, you're removing that with this programming model
15:14sdegutisHmm. I don't know how to allow the JIT to promote method bodies to constants.
15:15tbaldrid_that's why defprotocol exists vs. multimethods, and why protocols are about 100x faster
15:16tbaldrid_but benchmark it and see, I could be wrong
15:16sveritbaldrid_: Uh, I didnt know that, is that 100 times made up or from some real benchmarks?
15:17puredangerI don't believe that diff
15:17puredangerI have not measured it recently but that seems improbable
15:19amalloyeven 10x seems improbably high
15:20tbaldrid_https://searchcode.com/codesearch/view/26894602/
15:21tbaldrid_that was the research done my the core.matrix project awhile back ^^
15:21turbofaili suspect that would depend a lot on the dispatch function
15:21turbofailand the calling pattern
15:21tbaldrid_231.00 us for multimethods, 7.95 us for interface based protocol dispatch, 13.81 us for non-interface protocol dispatch
15:22tbaldrid_so no, not 100x, that's only 33x, my bad :-)
15:22sveritbaldrid_: thanks, good to know that
15:23tbaldrid_that being said, I use multimethods all the time. I just wouldn't use them inside a tight inner loop.
15:24puredangerthe 231 is for double-multimethod, should be comparing to the class-multimethod I think? that was 89 us
15:25gfredericksprotip: a multimethod that uses a multimethod that uses a multimethod as its dispatch function as its dispatch function
15:25TimMctbaldrid_: Only half an order of magnitude off, good enough for gov't work.
15:25TimMcgfredericks: StackUnderflowError
15:25gfredericksTimMc: what
15:30puredangerI just re-ran those on 1.7.0-alpha4 locally and I got 7.4 us for protocol, 39.9 us for multimethod
15:30puredangerso 5x
15:30gfredericks5 is O(100)
15:31puredangernot sure if serious or joking. if serious, not sure what you mean. ;)
15:32gfredericksI meant something that is technically true and completely irrelevant to the situation
15:32puredangerok, then I'm in agreement :)
15:33gfrederickswell it might be relevant but it's at least not at all helpful
15:33puredangerthere were some perf changes in multi methods in 1.6, not sure when those numbers were run
15:34seangrovednolen_: I need this for the mori.chain ns I'm working on http://dev.clojure.org/jira/browse/CLJS-698 - if there's still interest, I can take a stab at a patch
15:35sdegutisThe whole point of Clojure is expressiveness and building the language you need for your situation. If efficiency is a primary goal then Java would be better suited.
15:36puredangeractually I'd say the whole point of Clojure is expressiveness WITH efficiency
15:36seangroveHrm...
15:36seangroveI didn't think expressiveness was as important as containing complexity
15:36dnolen_seangrove: I'm kinda meh on that, why can't you just use it goog.exportSymbol directly, sees trivial to macroize too
15:36dnolen_s/sees/seems
15:37turbofaili'm with puredanger on that one
15:37seangrovednolen_: So after the deftype, just manually invoke goog.exportSymbol for all of the symbols?
15:37turbofailit's nice that clojure makes it possible to have abstractions that don't necessarily cost you much at runtime
15:38dnolen_seangrove: yep
15:38AimHereIsn't that the case with C++ too? Templates are entirely compile-time
15:38seangrovednolen_: I'm fine with that
15:38puredangerseangrove: I think expressiveness and "containing complexity" are squishy enough that they may have overlap. but my point is that Rich is generally not interested in changes that make Clojure more expressive at the expense of performance
15:38dnolen_seangrove: cool
15:38turbofailAimHere: well that's where the extra expressiveness comes in as well
15:39AimHereWell templates do make C++ more expressive
15:39turbofaili suppose they can
15:39mi6x3m-altAimHere: never seen templated C++ code which is expressive for a human being
15:39sdegutispuredanger: I've never considered or heard of efficiency being a primary reason for Clojure -- it was always entirely expressiveness
15:40turbofailthat said clojure is still a lot more expressive than C++ for most purposes
15:40sdegutispuredanger: I think Rust would be better suited for expressiveness WITH efficiency
15:40seangrovepuredanger: That's fair, definitely
15:41turbofailmore like the expressiveness of many other high level languages, while still being much more efficient than said languages
15:42gfrederickssdegutis: I hear about clojure + efficiency all the time; e.g., compared to jruby
15:42puredangersdegutis: efficiency drove (and continues to drive) many design decisions around Clojure
15:43puredangerlike it should probably be fast enough to like write a database in for example
15:44puredangerif the language designer wanted to do such a thing :)
15:44sdegutisI know of two camps using Clojure -- one that uses it mostly for very comp-sci problems requiring efficiency, and one that uses it mostly as an alternative to Ruby and were drawn to it primarily due to its expressiveness and discouragement of Rails-like magic
15:45sdegutisYou half-dozen belong to the first camp. Everyone else I know belongs to the second.
15:45sdegutis(Rich and the Datomic team belong mostly to the first also.)
15:45mi6x3m-altsdegutis: I cannot agree there. As an alternative to Ruby? Please
15:45sdegutismi6x3m-alt: you sound like you're from the first camp
15:45puredangerthose are definitely two of the major paths to clojure
15:46sdegutismi6x3m-alt: you also sound like you haven't met anyone from the second camp
15:46mi6x3m-altsdegutis: I am not and most clojure software I've seen is very far from comp.sci. and very practical
15:46sdegutispuredanger: what are the others?
15:46turbofailmeh. i like clojure for both of those reasons. they're not two separate camps
15:46sverihow about an alternative to java?
15:46puredangersome people come to it from js via cljs
15:46mi6x3m-altyou should listen to sveri
15:46puredangersome come to it via java
15:46sdegutisWhat benefit does it give over Java?
15:47sveriI mean, JVM is one of the big selling points for clojure
15:47mi6x3m-altreadibility sdegutis
15:47puredangerabstraction, concision, expressivity
15:47sdegutisI would probably rewrite our site in Java 8 if I was allowed.
15:47hfaafbbe careful or you'll end up in one of sdegutis's camps
15:47turbofailalso, functional data structures
15:47gfredericks"comp-sci" is kind of a vague term here
15:47puredangerwe've got hot dogs at my camp
15:47mi6x3m-altsdegutis: could it be you belong to a third, very negative camp?
15:47sdegutisOh right. I'm in #clojure, I forgot.
15:47sdegutisNo criticism of Clojure allowed at all (as an unwritten rule).
15:47puredangerI heard they've got volleyball at the one next door
15:48puredangerI'm just glad we're out of school
15:48turbofailwas there criticism? i didn't really see any
15:48sdegutisNot that I'm even criticizing Clojure, but painting a picture about who uses it that nobody wants to believe.
15:48puredangermaybe there's a knot-tying clsas
15:48mi6x3m-altI didn't catch any neither
15:48puredangeror actually for Clojure, maybe a knot-untie-ing
15:48jarjar_primehow do you return values from a recur?
15:49gfrederickssdegutis: people don't tend to react well to being put in boxes
15:49puredanger(recur val1 val2 etc)
15:49jarjar_primei am getting nil :(
15:49mi6x3m-altjarjar_prime: (recur foo)
15:49sdegutisAll I know is, there are many (many) people who are coming to Clojure from Rails as refugees.
15:49puredangerbut of jarjar_prime but of course those don't "return"
15:49mi6x3m-altjarjar_prime: to be exact, you return a value from loop
15:49mi6x3m-altwhen you don't call recur
15:49jarjar_primepuredanger: that passes the value to the next loop
15:49sdegutisAnd they really don't care much about performance, they're just trying to make maintainable web apps.
15:49puredangerjarjar_prime: yes, my point. *don't* recur to return
15:49jarjar_primeah, okay, so outside of the loop
15:50tbaldridgejarjar_prime: use a if to only call recur if you want to recur
15:50gfrederickssdegutis: I know people who came to clojure from rails for performance
15:50sdegutisAnd none of those people ever come in #clojure.
15:50puredangerit's almost like people use general purpose languages for all sorts of things
15:50turbofailalso i didn't really see much criticism of your supposed criticism, so i don't really see where the "help i'm being repressed" thing is coming from
15:50gfredericks(inc puredanger)
15:50lazybot⇒ 26
15:50puredangerdid anyone catch my knot joke above? that was pretty good I thought.
15:51llasram(inc puredanger)
15:51lazybot⇒ 27
15:51llasram(for the knot joke)
15:51sdegutis(inc puredanger)
15:51lazybot⇒ 28
15:51sdegutishere let me increase your karma for you
15:51sdegutis(inc puredanger)
15:51lazybot⇒ 29
15:51mi6x3m-altpuredanger: I laughed my ass off!!!!
15:51puredangerbasks in karma
15:51tbaldridgepuredanger: it was okay, but the analogy started to unravel after awhile.
15:52sdegutis(inc puredanger)
15:52lazybot⇒ 30
15:52puredangeranyhow, I love you all and pssst I think we're all in one big camp
15:52sdegutisThere now your karma is more than my age.
15:53puredangerlater all.. gonna go finish writing HTML(!!!) to finish the new Clojure/West site
15:53arohnertbaldridge: puns are almost deserving of (dec), IMO :-p
15:53sdegutisWhat's an efficient way to create a simple Java class from within Clojure?
15:53llasramtbaldridge: I was a-frayed someone would say something like that
15:54turbofailooh, clojure/west. where is that going to be this year?
15:54gfrederickssdegutis: depends what it's made of
15:54gfrederickssdegutis: cemerick made a great interop flow chart for answering that question, it should be googleable
15:55puredangerturbofail: Portland
15:55turbofaildoh. might be a bit far for me
15:56gfredericksI had no regrets about portland
15:56turbofailthough i've been looking for an excuse to visit portland anyway
15:56llasramI occasionally regret not living there, because it is so awesome
15:57ystaelspeaking of interop, am I wrong to wish it were possible to define an alternative constructor for a defrecord? sometimes what i want to expose to java callers could be exactly a defrecord, except that they have no way to create it with the intended contents, so i need to expose a separate factory class that makes them the right way
15:57cflemingSagiCZ1: It should be, yeah - I'll check that's not broken somehow
16:00sdegutisWhat's the current opinion on using deftype?
16:01puredangerit's fun
16:01llasramsdegutis: for?
16:03sdegutisI don't know, I just remember one of these things wasn't strictly deprecated but was discouraged by The Community.
16:03tbaldridgedefstruct
16:04gfredericks~defstruct is the goto of clojure
16:04clojurebotIk begrijp
16:05puredangerit's not at all deprecated
16:05llasrampuredanger: So you'd recommend using it in new code?
16:06puredangerif it was the right tool, sure
16:06puredangerif you're making data, use the existing collections
16:06tbaldridgewhen is defstruct the right tool?
16:06cflemingdeftype, that is, not defstruct
16:06puredangerwe're talking deftype
16:06cflemingI'm assuming
16:06tbaldridgeoh ok
16:06puredangerif you're making an information entity that represents part of your domain, use a record
16:06puredangerif you need a custom data type that does special stuff, use a deftype
16:07puredangerin practice, I think that's comparatively rare
16:07turbofaili mostly use deftype for interop things
16:07cflemingYeah, I use deftype quite a lot
16:07llasramOh, I thought we were talking about destruct
16:07llasram*defstruct
16:07puredangerthe original question was "What's the current opinion on using deftype?"
16:08puredangerI've literally never used defstruct ever
16:09dnolen_probably goign to have to add them to ClojureScript just as sugar over defrecord just to simplify porting clojure.pprint
16:09justin_smith... scrollback ... PORTLAND! I look forward to meeting all you lovely people when you come to my fair city
16:09puredangerdnolen_: yuck
16:10puredangerjustin_smith: we're all staying at your place
16:10puredangerkeep meaning to tell you
16:10dnolen_puredanger: yeah, but in the end it does help with portability
16:10turbofaili guess most of those interop things would work just as well with defrecord. i just happened to have no need for the record stuff
16:10cflemingpuredanger: Are there dates for Clojure/West yet?
16:10justin_smithawesome
16:10puredangercfleming: Apr 20-22
16:10cflemingnice
16:11justin_smithI actually do have a spare room, but only the one
16:11sdegutisIs :gen-class discouraged except for in the "main" namespace?
16:11puredangerno?
16:11clojurebotno is tufflax: there was a question somewhere in there, the answer
16:11turbofailit's not "discouraged," it's just a pain in the ass
16:11llasramsdegutis: I'd personally say :gen-class is discouraged wherever it is unnecessary, which is generally everywhere
16:12sdegutisOh.
16:12turbofailwell some interop things require it
16:12sdegutisI'm looking for ways to use basic OOP features without dropping down to Java.
16:12sdegutisI think deftype is what I want, although I can't get it working.
16:12turbofaillike if you want to make clojure work with spark, you have to do a named subclass
16:13sdegutis,(deftype Person [] (greet [this] (prn "sup")))
16:13clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)>
16:13llasramturbofail: Oh, are you one of the people doing one of the Clojure-Spark integration libraries?
16:13puredangeryou need an interface or protocol in there
16:13puredangerdeftype can't just have methods
16:13turbofailllasram: no, just using them
16:13sdegutisWhat's the basic interface that has no methods?
16:13llasramturbofail: And not really, -- it just causes a class to be created for the namespace itself, which is almost never what you need
16:13tbaldridgesdegutis: no but you can use definterface to create a interface
16:13sdegutisThanks.
16:14llasramturbofail: For anything depending on e.g. AOT for individual function-classes, :gen-class for the namespace is irrelevant
16:14cflemingllasram: Actually you can use gen-class to create multiple classes in a single namespace and call them whatever you want
16:14SagiCZ1sdegutis: don't you want clojure.typed?
16:14sdegutisAre definterface and defprotocol the same now?
16:14sdegutisSagiCZ1: no.
16:14cflemingsdegutis: No
16:14SagiCZ1sdegutis: ok nevermind then
16:14llasramcfleming: Sure -- I assumed the :-prefix on the original :gen-class mention was for specifically the `ns` form helper
16:15seangrovednolen_: Trying to figure out how to get my mori.chain ns exposed/usable via require('../mori-chain'), or via require('../mori').chain - whichever is more idiomatic - is there some documentation in the cljs work about how to do that, or is it all on the js side?
16:15sdegutisSagiCZ1: I want a way to have a partial'd first "self" argument on my functions, and for them to each have access to instance variables.
16:15turbofailllasram: yeah that's true, :gen-class in the namespace is usually not necessary
16:15cflemingsdegutis: defprotocol creates an interface under the hood, but also creates a protocol
16:15sdegutisOh.
16:15SagiCZ1sdegutis: yeah i am wondering what will you come up with in the end
16:15sdegutisSagiCZ1: I did this: https://github.com/sdegutis/oops
16:15llasramcfleming: But yeah, definitely no argument -- you can use `gen-class` to create an number of classes.
16:15llasramI personally even then find it to be actively worse than other options, but YMMV
16:15gfredericks(def ^:dynamic *this*)
16:15llasramturbofail: OOC which one?
16:16dnolen_seangrove: pretty sure we just export one object
16:16llasramturbofail: (Spark API, that is)
16:16cflemingllasram: Yeah, currently I just write a java class rather than use gen-class, which makes me want to scratch my eyes out
16:16dnolen_seangrove: so `var chain = require("mori").chain;`
16:16llasram(inc cfleming)
16:16lazybot⇒ 7
16:16llasram:-)
16:17turbofailllasram: i was using flambo. but they all work pretty much the same way under the hood
16:18llasramturbofail: ok. I was hoping there was one I hadn't heard about... I'm hopefully getting Spark deployed soon at my company,
16:18llasrambut I'm not a so-far a fan of certain design made by all the Clojure integration libs I'm currently aware of :-/
16:18turbofailyeah. spark is a lot more pleasant to use than hadoop, which is what we were using before
16:20llasramturbofail: Well, I wrote Parkour and have pretty full cluster-REPL integration with it. I'm hoping for faster multi-stage job-execution time with Spark, but
16:20llasramam currently worried the level of interactivity will drop until I give it some love
16:20turbofailwell the existing clojure spark libraries do let you do a decent amount of REPL-integration
16:21turbofaila lot more so than using spark from scala
16:21llasramThat's good to hear
16:21turbofailonly problem is you have to make sure you use their serializable function macros for every function you're going to call
16:21llasramAh, yeah
16:21llasramThere's the philosophical difference :-)
16:21turbofailand hope you don't capture anything in the environment that's not serializable
16:22turbofailalso toplevel defs won't get transmitted...
16:22turbofailetc.
16:22llasramCool. Cool. So then some time this year there will be a new Clojure-Spark integration library appearing :-)
16:23TimMcystael: Or static methods on defrecords, that would also work.
16:23zanesllasram: https://gorillalabs.github.io/sparkling/
16:23TimMcThose are reasonable substitutes for constructors.
16:25sdegutisSo far it looks like deftype with an identical definterface is exactly what I want.
16:25sdegutisJust need to macro them together into "defclass" for convenience.
16:25turbofailah, looks like sparkling avoids gen-class by providing a bunch of java stubs
16:26llasramzanes: Has exactly the same problems
16:27zanesAh, I wasn’t reading closely enough. Thought I saw you hypothesizing the existence of a Clojure/Spark integration lib.
16:30llasramzanes: Well, if you know of any others which don't share sparkling's heritage, then I am interested :-)
16:30zanesI don’t, sadly.
16:32seangrovednolen_: Thanks, I'll try that. Wasn't working beforek, but if that's supposed to work then I'll keep digging
16:43[blake|I'm trying to use ring.middleware.defaults but when I try to redirect I get a "Invalid anti-forgery token".
16:44weavejester[blake|: By default, anti-forgery protection for POST requests is turned on
16:44weavejester[blake|: If you don't have any sessions you can turn it off
16:47[blake|weavejester: I can probably turn it off anyway (I do have sessions, but it's an internal app), but I wish I knew how to use it.
16:47weavejester[blake|: There's a more detailed explanation here: https://github.com/ring-clojure/ring-anti-forgery
16:48weavejesterIt's also linked from the ring-defaults README>].
16:48sdegutisI find it problematic that certain libraries are de facto simply because people don't know about any other options, and so they continue to spread the word that this library is great, not considering its pros and cons correctly.
16:49tbaldridgewelcome to software development.
16:49tbaldridgeThat's pretty much true of the entire .NET platform, or or any language platform
16:49mi6x3m-altlet's make survey, which is currently your favourite clojure library?
16:49mi6x3m-altI vote for humanize
16:53[blake|weavejester: Thank you.
16:54[blake|(inc weavejester)
16:54lazybot⇒ 12
17:01expezwhat does 'could not find artifact <my-artifact> in clojars' usually mean when trying to do lein deploy?
17:26justin_smithexpez: that's weird
17:28sdegutisIs calling a method on an instance of a deftype exactly as fast as calling a normal Clojure-function?
17:30justin_smithsdegutis: could be faster or slower, when you factor in var lookup vs. method reflection
17:32tbaldridgesdegutis: if you type hint it, yes
17:33tbaldridgedo (set! *warn-on-reflection* true) to make sure
17:34sdegutisShould I do that in -main?
17:35tbaldridgeactually you probably want that at the top of your main namespace so that it's run before everything compiles.
17:36sdegutisThanks :)
17:38srrubyAny job leads? I'm a good Clojure coder. Ruby on Rails veteran.
17:39sritchieanyone notice that cursors in Om 0.8.0 are coming as as PersistentArrayMaps?
17:52amalloytbaldridge: set! only applies to the current namespace. i think you know that already, but from what you said sdegutis might get the impression that setting *warn-on-reflection* in the main namespace makes it apply to all namespaces
17:52tbaldridgeit does apply to all namespaces, as long as you set it before you load those namespaces
17:52tbaldridgeset! is global
17:54tbaldridgeamalloy: *warn-on-reflection* is referenced during compilation, so it only takes effect for future requires
17:54amalloytbaldridge: *warn-on-reflection* is dynamically bound, and i thought it was re-set at the start of each file
17:55tbaldridgenope
17:55amalloyset! of course only applies to the innermost (binding), but you're saying it's only bound once
17:57ben_vulpeshow would i go about writing a function that does different things based on its argument type? similar to multiple arity, but multiple *type*.
17:57amalloytbaldridge: what is up with the Var.pushThreadBindings in Compiler/load, then? does that not get run when you require, or is it not equivalent to a binding or something?
17:57ben_vulpes(if (= (class arg) int) ...) ?
17:57sdegutistbaldridge: Thanks for all your feedback. Based on your valuable input, I've made good use of definterface and deftype :) https://gist.github.com/sdegutis/c0e5cafee6add52c4bd9
17:58mgaareben_vulpes: protocols are for taht
17:59tbaldridgeamalloy: compiler line number?
18:00Bronsasdegutis: I honestly can't understand if you're trolling or what but how is that an improvement over deftype? :|
18:00sdegutisBronsa: first of all, it combines deftype and definterface; secondly, it gives an implicit self; thirdly I'm adding mixin functionality as we speak
18:00sdegutisWhen I'm writing Clojure-only classes that don't need to inter-op with Java, I don't want to have to declare the interface separately.
18:01sdegutisAnd in that situation, writing the 'this' parameter in one place but not the other is confusing.
18:01sdegutisPlus mixin functionality is useful in its own right.
18:01amalloyoh whoops. i'm looking at RT/load, not Compiler/load. i was thinking of https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L426, tbaldridge
18:01amalloybut https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7163 looks similar
18:03Bronsasdegutis: there are already libraries out there that provide you with extend-like traits/mixins support for inline deftype methods (e.g. https://github.com/Bronsa/neurotic, I think ztellman has one too)
18:03sdegutisBronsa: that only addresses #3, what about the other two?
18:03Bronsasdegutis: so you feel like trading writing a "this" for "defmethod" is a worthwile improvement?
18:04sdegutisYes.
18:04Bronsawell then go on with your macro.
18:04sdegutisThanks :)
18:05sdegutisIs there any way to get the current value of a symbol during expansion time without passing it as the result of your macro?
18:06tbaldridgenope, that's not how lisp works
18:06tbaldridgecompile time vs runtime
18:06turbofailunless you're using picolisp or something
18:07tbaldridgeI'll say this, whenever I've tried something different in a language, and it's not exactly working out, or it's awkward, I have to stop and ask myself it it's something I should be doing. Or if its a bad fit for the language
18:08tbaldridgesdegutis: I guess that's why you're getting so much push-back on stuff like this. You're trying to do something that doesn't exactly fit with the language you're using. The questions you are asking imply that you don't fully understand the ramifications of what you're trying to do.
18:19[blake|OK, maybe I'm doing this wrong. Recommended way to get session info (e.g., username) into the web page?
18:25sdegutistbaldridge: yeah I totally get that what I'm doing is not idiomatic
18:25sdegutistbaldridge: but I don't fully agree with idiomatic Clojure, so that's why I'm doing it in the first place.
18:26sdegutisWhat I'm trying to do is store something in one macro during compile-time so that I can use it in another macro.
18:26sdegutisI was hoping to just leave a quoted form somewhere and later eval it when it's used in the other macro.
18:27sdegutisMaybe I can manipulate &env.
18:33sdegutisIt works!!! https://gist.github.com/sdegutis/c0e5cafee6add52c4bd9
18:37sdegutisAnd here's a readme: https://github.com/sdegutis/oops
18:41postpunkjustin...
18:41seangroveIs there anyway to add a property to a (deftype ... [coll] Object )? Seems like it's only possible to add functions
18:42amalloyseangrove: you mean a field?
18:42tbaldridgesdegutis: in cljs?
18:42seangroveamalloy: Ah yes, that's it
18:42sdegutistbaldridge: I doubt this works in cljs.
18:42tbaldridgebleh, seangrove in cljs?
18:42amalloythat's the [coll] arg
18:42sdegutisha
18:42sdegutiswrong person :)
18:42amalloythose are the fields
18:42seangrovetbaldridge: Yes, in cljs
18:42seangroveamalloy: haha, thanks
18:42tbaldridgeseangrove: if this is in cljs you can just use (set! (.-bar foo) 42)
18:43tbaldridgethere's no way to do it in deftype specifically, but they're just JS objects at the end of the day, so have at it
18:43seangrovetbaldridge: That's an interesting idea as well, thanks
18:48mearnsh[blake|: are you looking for a way to do authentication?
18:50mearnsh[blake|: "...handles things like retaining authentication details in the user session" => https://github.com/cemerick/friend#authentication
19:10[blake|mearnsh: I've got an LDAP thing working. I'm just having trouble displaying the user name and retaining the session info.
19:11[blake|Well, one or the other, probably not both.
19:15[blake|I'm trying to pull apart what everything does, since the defaults don't seem to be working for me.
19:17mearnshalright, i'm still learning too but have used cemerick/friend recently to good effect for managing :session
19:18[blake|Well, maybe I can use it to figure out where I'm going wrong, thanks.
19:20mearnshit has a number of "workflows" that make it easy to integrate with http-basic, forms etc.
19:22[blake|Looks like it's just using handler/site, which is what I'm doing.
19:24seangroveDo I have to require/import anything to use (goog/exportSymbol "mySymbol") in cljs?
19:33dnolen_seangrove: should not pretty sure it's declare in base.js
19:33dnolen_s/declare/declared
19:34julianlevistonIs this a better room to ask cljs questions than #clojurescript/
19:36julianlevistonHow do I control an Om input whose type is file? I have a function attached to onchange, and every time I change the file, it disappears.
19:36julianlevistonOrdinarily, I’d hook some component local state up to value, but it’s not the value that’s being controlled, if I understand it correctly, it’s the files attribute. If I try to set the files attribute to some component local state it doesn’t alter its behaviour. Neither files nor value work.
19:41dnolen_julianleviston: don't think this can be done w/ React not an Om issue https://groups.google.com/forum/#!topic/reactjs/sqfVJqlQc2E
19:41dnolen_julianleviston: there's a #clojurescript channel btw for questions like this, people ask Om/Reagent etc questions there
19:45julianlevistondnolen_: thanks
20:03underplankHi all. So I want to be able to exec a long running process from a clojure app. say like a python webserver. I found the “sh” command and also (.exec (Runtime/getRuntime ….) …is there anything else?
20:04underplankAlso with the getRunTime the code example I found used (read-lines ).getInputStream process) which I think comes from an old contrib lib. How is the normal way to read from a java stream
20:08exapticunderplank: i've used conch a bit, which provides some nice abstraction
20:08exapticunderplank: there's also clojure.java.shell if conch is too high level
20:09underplankyeah. So I saw the shell thing. and it seems like its for running “ls” or something like that. I wasnt sure how it handled long running processes that continue to output data
20:11exapticunderplank: well i think, you can opt to get streams back i think
20:12underplankahh, cool. I’ll have a look at that
20:13exapticunderplank: hmm, nm -- can't find that option now
20:13exapticunderplank: check out conch https://github.com/Raynes/conch
20:13underplankcool just lein installed it :)
20:13exaptic"Conch is more flexible than clojure.java.shell because you have direct access to all of the streams and the process object itself."
20:21exaptici've had success with it
20:32jarjar_prime:)
20:33jarjar_primehow would I merge a sequence of vectors into one.... ([:a] [] [:b]) -> [:a :b]
20:34jarjar_primei've come up with... (into [] (apply concat (for [b x] (into [] b))))
20:34jarjar_primebut i'm wondering fi that will not be performant
20:35tbaldridgejarjar_prime: I'd do something like reduce + into
20:35tbaldridge,(reduce into [] '([1 2 3] [4 5 6]))
20:35clojurebot[1 2 3 4 5 ...]
20:35jarjar_primehaha, thanks clojurebot :D
20:36jarjar_primetbaldridge: thanks, that definitely reads better
20:37jarjar_primeis reduce doing something similar to apply concat?
20:58exapticit's evaluating (into [] [1 2 3]), then (into [1 2 3] [4 5 6]) and returning the result of the second
20:59exaptic(it evals one "into" for each element of its third argument)
21:11julianlevistonwhat about vec concat?
21:11julianleviston(vec (concat [1 2 3] [ 4 5 6]))
21:12julianlevistonohhhhhh a sequence of vectors…
21:14julianlevistonThen I guess (vec (apply concat '([1 2 3] [4 5 6]))) would work.
21:52atratusdoes anyone know what the subscript S on crossclj means?
22:07scottjatratus: where? I'd guess it means it runs on clojure and clojurescript
22:09dnolen_seangrove: everything merged
22:09dnolen_seangrove: I think the smartest thing to do is next is partitioned builds through Google Closure modules
22:10scottjatratus: based on http://crossclj.info/ns/org.clojure/core.async/0.1.346.0-17112a-alpha/clojure.core.async.html I'd say the s means it's clojurescript
22:10dnolen_seangrove: we could write a custom script for this of course, would be a bit tedious - the right way to do would be to fix the outstanding ClojureScript ticket so everyone can benefit
22:11dnolen_seangrove: then we could ship a core which is just data structures and basic ops, then addons (full standard lib, chaining operations)
22:40dnolen_seangrove: anyways I got some cycles to work on CLJS tomorrow perhaps can spend some time on this myself. thanks for the PRs, night