2013-12-20
| 00:26 | tmallen | is this the place for clojurescript discussion? |
| 00:27 | tmallen | there are 37 people in #clojurescript but no topic so i thought maybe it had a different channel |
| 00:28 | technomancy | we tried to make #clojurescript happen, but I think it was a failed attempt |
| 00:28 | technomancy | go for it |
| 00:28 | ddellacosta | tmallen: people certainly talk about it a lot here, I didn't even realize there was much different in #clojurescript |
| 00:28 | tmallen | hehe |
| 00:28 | tmallen | ok thank you |
| 00:28 | ddellacosta | that is, didn't realize there was a different group |
| 00:28 | technomancy | not that I'll be any use |
| 00:28 | ddellacosta | technomancy: haha, why?? |
| 00:28 | lazybot | ddellacosta: Definitely not. |
| 00:28 | technomancy | ddellacosta: I've never[1] used clojurescript |
| 00:28 | tmallen | what is the best book for learning clojure, this new clojurescript library called Om looks interesting so i was going to learn clojure to learn a lisp and use this library |
| 00:29 | tmallen | hm, there should be a ? in there somewhere |
| 00:29 | ddellacosta | technomancy: ah, okay. I'll do my best then. :-) |
| 00:29 | technomancy | [1] for more than a hello world |
| 00:29 | tmallen | the oreilly book looked really good when i saw it in the store a while ago |
| 00:29 | ddellacosta | tmallen: if you're unfamiliar with Clojure, I would recommend Clojure Programming: http://www.clojurebook.com |
| 00:30 | tmallen | ok, yea, that one looked great, i'll pick it up |
| 00:30 | technomancy | I don't know if there's anything out there that does a thorough job of covering clojurescript |
| 00:30 | ddellacosta | tmallen: oh yeah, that's the same one |
| 00:30 | tmallen | eh clojure script is just js libraries on clojure |
| 00:30 | technomancy | I suspect potential book authors are waiting for the tooling people to get things more polished |
| 00:30 | technomancy | uuuuuuh |
| 00:30 | ddellacosta | yeah, I think Stuart Sierra put one out a while back, but not sure it is still relevant. However, your best bet is to start with Clojure and then play around |
| 00:30 | tmallen | i have helped a lot of cljs users in ##closure-tools surprisingly |
| 00:31 | ddellacosta | tmallen: yes, definitely, a strong knowledge of Google Closure helps tremendously |
| 00:31 | technomancy | there are a lot of differences |
| 00:31 | tmallen | (i use closure compiler so it is a small change for me) |
| 00:31 | tmallen | ddellacosta: i know way too much about the lcousre tools :p |
| 00:31 | ddellacosta | technomancy: certainly, there are a ton of differences--but wouldn't you say that learning Clojure itself (leaving aside Java inter-op) is the best first step, or no? |
| 00:32 | tmallen | ddellacosta: thats good to know :0 |
| 00:32 | tmallen | er :) |
| 00:32 | technomancy | ddellacosta: I'm probably not qualified to say =) |
| 00:32 | ddellacosta | BTW, the new edition of Joy of Clojure contains a section explicitly on ClojureScript: http://www.manning.com/fogus2/ |
| 00:33 | tmallen | is that out yet |
| 00:33 | technomancy | people used to say they'd learn CL in order to learn Clojure because it had better books, which I think is silly |
| 00:33 | ddellacosta | technomancy: haha, okay. Well, your point certainly stands, there is a lot different in terms of JS- vs. Java-inter-op specifics |
| 00:33 | technomancy | not that this is the same thing |
| 00:33 | tmallen | if i use clojure will i have to use ant and maven and crap like that |
| 00:34 | ddellacosta | technomancy: ah, I see what you're saying. Well, in this case, I can honestly say that a solid knowledge of Clojure helps tremendously in grokking ClojureScript, at least in terms of the core language. There is always inter-op specifics |
| 00:34 | technomancy | ddellacosta: mostly just the tooling and getting started story seems to be really rough. weavejester was just in here a few hours ago with a big pile of questions and ended up giving up on cljs for the time being because he couldn't get a repl going. |
| 00:34 | tmallen | do clojure projects often use java tools |
| 00:34 | tmallen | *clojurescript |
| 00:34 | technomancy | tmallen: no one's gonna make you us emaven =) |
| 00:34 | tmallen | or clojure in general, or is there full tooling written in clojure? |
| 00:34 | ddellacosta | technomancy: oh man, yeah...it is still rough. That's a bummer to hear regarding weavejester though. :-( |
| 00:35 | technomancy | tmallen: basically the only people using maven for clojure are the clojure/core folks |
| 00:35 | tmallen | technomancy: yea but if lots of open source clojure projects use ant or maven, i'll have to lear nthem |
| 00:35 | ddellacosta | tmallen: I don't touch much Java tooling--we use technomancy's lein |
| 00:35 | tmallen | oh o |
| 00:35 | tmallen | k |
| 00:35 | technomancy | been years since I've seen a project using ant |
| 00:35 | ddellacosta | tmallen: and that seems to be the case for a lot of folks, in my experience |
| 00:35 | tmallen | oh he wrote leiningen/ |
| 00:35 | tmallen | ? |
| 00:35 | ddellacosta | yes, the other guy you're talking to wrote leiningen. ;-) |
| 00:35 | tmallen | technomancy: cool :) |
| 00:35 | technomancy | with lots of help =) |
| 00:36 | tmallen | where is standard vim stuff for clojure? |
| 00:36 | ddellacosta | it's definitely a significant part of why using Clojure is great |
| 00:36 | tmallen | is it in some misc part of the clojure distribution? |
| 00:36 | ddellacosta | tmallen: vim stuff for Clojure, um, whatsitcalled |
| 00:36 | technomancy | aw shucks |
| 00:36 | ddellacosta | technomancy: :-) |
| 00:36 | ddellacosta | tmallen: are you looking for this? https://github.com/tpope/vim-fireplace |
| 00:37 | tmallen | i bet most clojure users use emacs |
| 00:37 | tmallen | hehe tpope is a clojure user ? |
| 00:37 | ddellacosta | tmallen: ah, and here: https://github.com/guns/vim-clojure-static |
| 00:37 | tmallen | neat |
| 00:37 | ddellacosta | tmallen: yah! |
| 00:37 | tmallen | tpope is a minor idol of mine because most of my open source projects are vim plugins |
| 00:37 | ddellacosta | tmallen: I think there is a subset of Clojure folks also using emacs + evil |
| 00:37 | ddellacosta | tmallen: ah, cool. :-) |
| 00:38 | tmallen | what is "static editing"? |
| 00:38 | tmallen | from https://github.com/guns/vim-clojure-static |
| 00:38 | technomancy | tmallen: tooling is divided into that which needs a connection to a clojure process and that which doesn't |
| 00:38 | tmallen | oh |
| 00:38 | ddellacosta | gotcha, didn't know what that meant either |
| 00:38 | tmallen | has somebody written about this separately from that oreilly book? |
| 00:39 | tmallen | like in a blog post |
| 00:39 | ddellacosta | tmallen: which, vim? |
| 00:39 | ddellacosta | + clojure? |
| 00:39 | tmallen | oh i dunno |
| 00:39 | tmallen | so that's the only place somebody usese that termi guess |
| 00:39 | tmallen | but coding never requires connection to the running process right? |
| 00:39 | tmallen | and building |
| 00:39 | tmallen | i can't see how it would |
| 00:40 | ddellacosta | tmallen: coding Clojure? no, certainly not--but using a repl is very handy |
| 00:40 | tmallen | so "static eidting" seemed redundant |
| 00:40 | ddellacosta | tmallen: you'll find a lot of folks using Clojure often will do a lot of stuff in the repl as a first pass |
| 00:40 | tmallen | anywho :) ok this is great, i've got everything i need |
| 00:40 | technomancy | tmallen: most people develop with a repl open |
| 00:40 | technomancy | constantly compiling and trying functions out as you go |
| 00:40 | ddellacosta | what he said ^ |
| 00:40 | tmallen | emacs is a lot friendlier for pushing repl stuff to a file |
| 00:41 | tmallen | not many vim plugin authors write stuff like that |
| 00:41 | technomancy | vim's infrastructure for that kind of thing is pretty limited, but somehow people are able to make it work |
| 00:41 | ddellacosta | tmallen: yeah, I think the emacs integration tends to be better...but I just don't know, I'm not a vim guy unfortunately |
| 00:41 | technomancy | coding clojure without a repl is pretty cumbersome since launch times are so slow |
| 00:41 | tmallen | all vim needs is support for background processes and it would be really strong for these sorts of things |
| 00:41 | technomancy | but IMO coding *anything* without a repl is pretty terrible |
| 00:42 | tmallen | technomancy: google cc takes so long too because java |
| 00:42 | ddellacosta | tmallen: btw, if you are getting started in ClojureScript, I would recommend checking out a few things in particular to start: first of all, check out this post by dnolen: http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/ |
| 00:42 | tmallen | yea i'm always popping in a repl in py or js |
| 00:42 | ddellacosta | tmallen: then check out some of his other posts--this one is especially useful, methinks: http://swannodette.github.io/2013/11/07/clojurescript-101/ |
| 00:42 | tmallen | heh |
| 00:43 | tmallen | "Open the provided index.html (at the root of the project directory) in Google Chrome." weak |
| 00:43 | technomancy | tl;dr you are about to embark on a magical voyage of discovery; best of luck |
| 00:43 | tmallen | everyone knows to ctrl-shift-k in firefox |
| 00:43 | ddellacosta | tmallen: this is also really useful: https://github.com/magomimmo/modern-cljs, and I wrote this recently which may be of use: http://davedellacosta.com/cljs-dom-survey |
| 00:43 | technomancy | it's dangerous to go alone; take this: https://github.com/tpope/vim-fireplace |
| 00:43 | tmallen | hehe thanks :) |
| 00:44 | ddellacosta | tmallen: well, I'm sure you could suggest to dnolen that he give more respect to FF users. ;-) |
| 00:44 | tmallen | :) |
| 00:44 | tmallen | ok thanks, i'm sure i'll be back |
| 00:44 | ddellacosta | tmallen: anyways, good luck, and you should feel free to ask whatever here...folks tend to be quite friendly. |
| 00:44 | technomancy | http://magicalgametime.com/post/48470399171 |
| 00:44 | tmallen | sure thing |
| 00:45 | ddellacosta | technomancy: love it |
| 00:45 | technomancy | <3 magical game time |
| 00:45 | ddellacosta | technomancy: but, I hope you're not comparing vim to a sword...hahaha |
| 00:45 | tmallen | vim is more like a switchblade |
| 00:45 | ddellacosta | yeah, and emacs like an uber multi-tool, kinda heavy and awkward at times |
| 00:45 | tmallen | vi is a razor blade |
| 00:46 | technomancy | ddellacosta: if a keyboard can be a lightsaber |
| 00:46 | tmallen | ed is a needle |
| 00:46 | ddellacosta | technomancy: fair 'nuff |
| 00:47 | ddellacosta | anyways, good luck tmallen, I gotta get back to work |
| 00:47 | technomancy | that whole blog though... I could read it cover to cover |
| 00:47 | technomancy | http://magicalgametime.com/post/54704162326 <3 |
| 00:47 | ddellacosta | technomancy: it's pretty great, didn't know it existed! |
| 00:48 | tmallen | ooh i'm gonna write some vim plugins now! |
| 00:48 | ddellacosta | technomancy: that last one you linked to reminds me a lot of this book I read as a kid, so many times...The Phantom Tollbooth |
| 00:49 | technomancy | oh man I love that book |
| 00:49 | technomancy | can't wait for my kids to get old enough for it |
| 00:49 | ddellacosta | yeah, I feel like that book gave me a really awesome feeling about learning and exploring that continues to this day. |
| 00:49 | ddellacosta | that must be awesome to think of your kids reading that book, very nice |
| 00:50 | ddellacosta | alright, now I'm serious, back to work...cheers technomancy |
| 00:50 | technomancy | later |
| 00:50 | technomancy | wait, are you in japan or something? |
| 00:50 | ddellacosta | technomancy: oh, yeah |
| 00:50 | ddellacosta | in Japan, I work remotely for a Canadian company |
| 00:50 | technomancy | nice! |
| 00:50 | technomancy | love the remote life |
| 00:51 | technomancy | (mostly) |
| 00:51 | technomancy | but I'll let you get back to work |
| 00:51 | ddellacosta | yeah, it's not bad...sometimes gets a bit lonely, but luckily my co-workers are night owls |
| 00:51 | ddellacosta | technomancy: no worries, see ya around! |
| 01:43 | ryantm | How do I parse out the metadata of a form? |
| 01:44 | zerokarmaleft | I think you're going to have to explain that further |
| 01:44 | ryantm | For example (some-function '(ns ^{:doc "docstring"}) => {:doc "docstring"} |
| 01:46 | ryantm | zerokarmaleft: Does that clarify my question? |
| 01:49 | zerokarmaleft | ryantm: yes, that clarifies it enough for me to know I don't have an answer for you :) |
| 01:49 | ryantm | thanks! |
| 01:56 | The_ | AAA |
| 01:57 | Tyrant | (defn all-paths [doc] (map #(str "/" (string/join "/" (map name %1))) (first (reduce (fn [[acc set] p] (if (contains? set p) [acc set] [(conj acc p) (conj set p)])) [[] #{}] (visit-nodes [] (xpath/$x "./*" doc) (fn [p n] p)))))) |
| 01:57 | guns | ryantm: Do you mean you want the metadata of a form without evaluating it? |
| 01:59 | TEttinger | ,(doc meta) |
| 01:59 | clojurebot | "([obj]); Returns the metadata of obj, returns nil if there is no metadata." |
| 02:02 | zerokarmaleft | that won't work on a quoted form |
| 02:03 | ryantm | Yeah, it does weird stuff like tell me I have unbalanced parens when I do not. |
| 02:04 | guns | ryantm: why can't you just use the Clojure reader? |
| 02:05 | zerokarmaleft | ryantm: quote doesn't delay evaluation of ^ since it's a reader macro |
| 02:08 | ryantm | zerokarmaleft: ah, that makes some sense. |
| 02:08 | ryantm | guns: Perhaps I can use the Clojure reader. I'll look into it. |
| 02:09 | guns | clojure.core/read |
| 02:14 | logic_prog_ | does cljs have a notion of "weak reference" ? I have a map of (id -> dom nodes), but I want this map to be a weak references -- i.e. if a node is only referenced by this map, then I want the node deleted |
| 02:17 | zerokarmaleft | ryantm: you may want to check out tools.reader |
| 02:21 | ryantm | zerokarmaleft: i'll look at it, thanks! |
| 02:22 | alandipert | logic_prog_: you can use a WeakMap if it's available; cljs shares GC and reference semantics w/ the platform |
| 02:23 | logic_prog_ | alandipert: so basically, study the docs of the browser (i.e. chrome/firefox/safari) ? |
| 02:30 | alandipert | logic_prog_: right. in your case, assuming id is a string, maybe a map of id -> WeakSet<dom nodes>, as keys can't be primitives in ES6 WeakMap or shims |
| 02:30 | logic_prog_ | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap#Browser_compatibility |
| 02:30 | logic_prog_ | so basically to use this, |
| 02:30 | logic_prog_ | I have to tell my users to go to chrome://flags |
| 02:30 | logic_prog_ | and turn on experimental javascfipt ? :-) |
| 02:31 | alandipert | yes! and they can take pride in living on the bleeding edge! |
| 02:31 | alandipert | or... you can figure out another way to accomplish what you want that doesn't need weak map ;-) |
| 02:33 | logic_prog_ | wtf |
| 02:33 | logic_prog_ | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet |
| 02:33 | logic_prog_ | doesn't even exist |
| 02:33 | ryantm | zerokarmaleft: read-string seems to erase the metadata (clojure.tools.reader/read-string "(ns ^{:doc \"a\"} foo.bar)") becomes the list (ns foo.bar) |
| 02:34 | alandipert | logic_prog_: oh, i was thinking just make one with a WeakMap of vals of all 'true' or something |
| 02:34 | alandipert | logic_prog_: (that's basically what clojure sets are) |
| 03:08 | zerokarmaleft | ryantm: right, the tools.reader impl of read-string mimics clojure's, but you can override the behavior of read-meta |
| 03:19 | jowag | Hi, what was the problem with equals in java so that a custom equiv had to be implemented? |
| 03:20 | clgv | jowag: different hashing in clojure I guess |
| 03:21 | clgv | jowag: since hashing and equality are coupled for determing non-equality via the hash fast |
| 03:25 | jowag | clgv: thanks, but both in equals and in equiv the hash must be same for two equivaleng objects |
| 03:27 | jowag | clgv: and one can always override Object.hashcode if different hashing strategy is needed |
| 03:28 | notofi | hi guys, I want to define a custom deftype wrapping a hash-map which implements clojure.lang.ILookup and throws an exception when the key is not present instead of returning nil, also it forces delay objects. My colleagues think this breaks the contract of keywords and 'get' which state that when the value can not be found it should return nil. Any opinions? |
| 03:28 | clgv | jowag: that seems to be the commit of the change https://github.com/clojure/clojure/commit/df0e4b677bdb563abdc2aa03cb8e6376eceaf8d5 |
| 03:29 | jowag | technomancy mentions in a mailing list that ".equals must follow broken Java equality semantics, where .equiv is free to follow correct one.". I was wondering what is broken in javas equals... |
| 03:30 | jowag | clgv: maybe it's about how the numbers are handled? |
| 03:31 | jowag | notofi: If you implement ILookup you should not throw if not found |
| 03:31 | jowag | notofi: either return nil or not found value, is it was provided by caller |
| 03:31 | logic_prog_ | how does clojurescript's meta data work? in particular, how is it that I can attach meta data to a dom node? |
| 03:31 | clgv | jowag: I was just thinking in that same direction. probably there is a closed jira ticket somewhere that explains this further |
| 03:32 | notofi | jowag: ok I understand. But Another thing were I am not so sure is when I want to have a lazy hash map were values are delays and lookup forces those. Would this be unidiomatic? |
| 03:32 | clgv | notofi: is the default arg for get no option? |
| 03:32 | clgv | ,(get {:a 1} :b 42) |
| 03:32 | clojurebot | 42 |
| 03:32 | alandipert | jowag: string equality is weird, i like that clojure = unweirds it |
| 03:33 | notofi | clgv: default arg is nil I guess |
| 03:33 | clgv | notofi: no, I mean you can supply what you want and forget about exceptios ;) |
| 03:33 | clgv | ,(get {:a 1} :b :not-found) |
| 03:33 | clojurebot | :not-found |
| 03:34 | notofi | clgv: yeah we want to make our code more strict and just throw everywhere when the value is not found, intead of adding :not-found manually |
| 03:34 | clgv | ({:a 1} :b :not-found) |
| 03:34 | jowag | ,(= 3 (java.math.BigInteger/valueOf 3)) |
| 03:34 | clojurebot | true |
| 03:34 | jowag | ,(.equals 3 (java.math.BigInteger/valueOf 3)) |
| 03:34 | clojurebot | false |
| 03:34 | clgv | notofi: are you sure that this is a good idea? that will probably break reusability of the functions on later occassions |
| 03:35 | TEttinger | ,(= 3 3N) |
| 03:35 | clojurebot | true |
| 03:35 | notofi | clgv: yeah I see that its not a good idea |
| 03:36 | clgv | notofi: maybe adding schema verifications in :pre/:post conditions when debugging is an option |
| 03:36 | jowag | notofi: get in lazy hash maps would force the value, so it would block until value is fetched |
| 03:37 | notofi | jowag: you think it would be unidiomatic? |
| 03:37 | jowag | notofi: if the fetching reveals that there is no value for a given key in the underlaying thing you fetch from, I would not throw but return nil/not-found |
| 03:37 | jowag | notofi: if however there was some error in fetching, like connection problem, I would definately throw |
| 03:39 | jowag | notofi: lazy maps are completely valid concept and are idiomatic, if you use them for the right problem. Here is one impl. of lazy maps, https://bitbucket.org/kotarak/lazymap |
| 03:43 | seriously_random | I don't understand what I am doing wrong with a simple for loop: http://pastebin.com/krxPduCX |
| 03:45 | jowag | seriously_random: ise defn instead of def in line 5 |
| 03:49 | cark | what jowag said, but furthermore, for isn't a looping construct, it's list comprehension |
| 03:49 | clgv | seriously_random: still implementing the permutationset? |
| 03:49 | logic_prog_ | is there a way to tell clojure edn read-string to use rrb-vectors rather than vectors ? |
| 03:50 | jowag | logic_prog_: only if you implement a custom data reader literal and use it in the .edn in places where you want rrb-vectors |
| 03:51 | jowag | logic_prog_: if you want rrb-vectors for all vectors readed from .edn, you have to change edn reader |
| 03:51 | logic_prog_ | so basically I'd have to change pr-str |
| 03:51 | logic_prog_ | so that rrb-vectors are output in a special form ? |
| 03:52 | jowag | logic_prog_: now you are talking about printing rrb-vectors in edn format |
| 03:52 | logic_prog_ | right |
| 03:52 | logic_prog_ | beacuse I have to ouput rrb-vectors in edn foramt to read them back in, no? |
| 03:52 | clgv | logic_prog_: yes. make sure they have a literal to read them back in |
| 03:53 | jowag | logic_prog_: well that depends on the printer. The default pr-str printer is very complicated and complected and it does not at all produce EDN |
| 03:53 | logic_prog_ | hmm, I've been using pr-str together wtih edn/read-string |
| 03:53 | logic_prog_ | what should I be using with edn/read-string instead? |
| 03:54 | jowag | logic_prog_: try to look at it differently. COnverting a normal vector into rrb is a fast constant time operation. I would suggest to read EDN usual way, and then in your code convert the vectors into rrb if needed. |
| 03:54 | clgv | logic_prog_: you could just alter print-method for rrb-vector to let them be printed with an apropriate literal |
| 03:55 | logic_prog_ | wait, what? vector -> rrbvector is constant time operation? |
| 03:55 | clgv | logic_prog_: imho that should be or become part of the rrb-vector lib |
| 03:55 | jowag | logic_prog_: and rrb-vector can print vector as it would be a normal clojure vector |
| 03:55 | opqdonut | wth, gen-class and gen-interface docstrings both say "When not compiling, does nothing." |
| 03:56 | opqdonut | however gen-interface is implemented as (if *compile-files* (doit) (dosomethingelse)) |
| 03:56 | jowag | logic_prog_: yes, constant time and very fast |
| 03:56 | opqdonut | whereas gen-class is implemented as (when *compile-files* (doit)) |
| 03:56 | clgv | logic_prog_: since you are using it, how mature is core.rrb-vector in your opinion? |
| 03:56 | logic_prog_ | clgv: I haven't ahd any problem so sfar |
| 03:56 | logic_prog_ | clgv: I like the fast splicing / concat |
| 03:56 | logic_prog_ | clgv: I think it should repalce standard vectors |
| 03:57 | clgv | logic_prog_: really, afaik some operations are faster on standard vector |
| 03:57 | jowag | clgv: in CLJ or in CLJS? |
| 03:57 | clgv | clojure jvm ;) |
| 03:57 | logic_prog_ | clgv: imho, for the imes where constant time access is important |
| 03:58 | logic_prog_ | I'd proably drop to something lower level than clja nyway |
| 03:58 | clgv | yeah right, I just meant for normal vector use cases |
| 04:00 | clgv | is splice + reverse + concat also supported efficiently? like in a_1, ... , a_n, b_1, ..., b_k, c_1, ..., c_m to a_1, ... , a_n, b_k, ..., b_1, c_1, ..., c_m |
| 04:00 | seriously_random | clgv, no. I am now at powerset |
| 04:00 | seriously_random | http://pastebin.com/8EHtEFDs <-- how to use cons properly? |
| 04:01 | clgv | seriously_random: if you do not build a lazy-seq simply dont ;) |
| 04:01 | seriously_random | clgv, sorry? I don't get it |
| 04:02 | clgv | seriously_random: do not use cons in this case. it seems you want `list` or `list*` |
| 04:03 | clgv | logic_prog_: is reverse efficient and is it possible to efficiently concat a reverse subvec with rbb-vectors ? |
| 04:04 | seriously_random | clgv, would you mind showing a sample code? |
| 04:04 | jowag | alandipert: BTW why yet another DSL in hoplon? I mean .hl files have custom syntax :( |
| 04:04 | logic_prog_ | clgv: hmm, I never used reverse (and thus did not spend time reading up on it) |
| 04:05 | logic_prog_ | clgv: I can imaigne an efficient way to do it, but I don't know if rrb-vectors implements it that way |
| 04:05 | clgv | seriously_random: (list a b c) instead of (cons a (cons b (cons c nil))) |
| 04:05 | jowag | clgv: there is no such concept as a reverse collection in a Clojure unfortunately |
| 04:05 | jowag | clgv: you can get reverse seq at most |
| 04:05 | clgv | logic_prog_: yeah. it is efficient on vectors. the question is if it works on rrb-vectors |
| 04:06 | clgv | ,(type (reverse [1 2 3])) |
| 04:06 | clojurebot | clojure.lang.PersistentList |
| 04:06 | clgv | oh |
| 04:06 | clgv | ,(type (rvec [1 2 3])) |
| 04:06 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rvec in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 04:06 | seriously_random | clgv, what if I need (() (1) (1 2)) then I add 2 to (() (1))? |
| 04:06 | clgv | $findfn [1 2 3] [3 2 1] |
| 04:06 | jowag | clgv: told you :) |
| 04:06 | clgv | still no lazybot? :( |
| 04:06 | lazybot | [clojure.core/rseq clojure.core/reverse] |
| 04:07 | clgv | ah^^ |
| 04:07 | clgv | damn |
| 04:08 | clgv | ok rrb-vector supports `rseq` but that's not sufficient for the mentioned use case |
| 04:10 | seriously_random | clgv, here is the code in python: http://pastebin.com/HB0EfE8F |
| 04:21 | seriously_random | clgv, getting closer: http://pastebin.com/iHyLZkwj |
| 04:23 | clgv | jowag: logic_prog_: well, I have created an enhancement ticket now... |
| 04:25 | seriously_random | clgv, done! http://pastebin.com/f7mT5kh3 |
| 04:26 | seriously_random | noob question, is clojure slower than python? |
| 04:27 | bitemyapp | I like his brand of diplomacy: http://www.sourceware.org/ml/libc-alpha/2000-08/msg00053.html |
| 04:27 | cark | i think clojure is faster than python, but python has many libraries that are faster due to these being done with c |
| 04:28 | jowag | clgv: as you cannot insert at the front of the vector, I doubt reverse vector will be implemented soon |
| 04:29 | jowag | seriously_random: what cark said |
| 04:30 | clgv | jowag: I do not want it for Clojure's vector, but for rrb-vector. it might be possible there because efficient concatenation is possible as well |
| 04:31 | jowag | clgv: rrb-vector has a very similar internal structure to the clojures HAMT vectors. Problem is that there are array chuks inside and you would have to reverse them |
| 04:32 | seriously_random | a way to quickly turn sequence '((1) (1 2)) into a set #{#{1} #{1 2}}? |
| 04:32 | alandipert | jowag: like rseq? |
| 04:32 | alandipert | ,(set (map set '((1) (1 2))) |
| 04:32 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 04:32 | clgv | jowag: ok. I'll see what the maintainers will answer ;) |
| 04:32 | jowag | clgv: or introduce a layer of logic determining the direction of the vector, which would be hard to do efficiently |
| 04:33 | jowag | ,(doc rseq) |
| 04:33 | clojurebot | "([rev]); Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil" |
| 04:33 | jowag | alandipert: result from rseq is nor a persistent collection |
| 04:33 | seriously_random | alandipert, thanks |
| 04:34 | jowag | alandipert: or to be precise, not the same type of persistent collection :) |
| 04:35 | alandipert | jowag: you could deftype a thing, backed bya vector, that implements ILookup and does the index arithmetic to present a vector-like thing in reverse perhaps |
| 04:36 | bitemyapp | arrdem: http://hydkyll.blogspot.de/2013/12/example-from-brml-in-haskell.html |
| 04:36 | alandipert | jowag: actually there's probably a billion interfaces you'd need to implement, but that's the basic idea :-) |
| 04:36 | jowag | alandipert: of course, but conj and subvec and converting it to the rrb-vectr (what clgv wants) would be very hard to do efficiently |
| 04:37 | clgv | jowag: well if it is O(log_{32}(n)) like concatenation that suffices ;) |
| 04:38 | jowag | clgv: if you desperately need reverse for vectors, consider a finger trees |
| 04:39 | alandipert | jowag: gotcha, i missed the context |
| 04:39 | clgv | jowag: well. reverse and concatenation is the needed feature set for 2-opt neighborhood on TSP |
| 04:40 | jowag | alandipert: anyway, about that hoplon, why the custom DSL for .hl files? |
| 04:40 | clgv | jowag: but I am not sure how well it scales since there will be arbitrary large and many slices reversed |
| 04:40 | jowag | clgv: There are finger trees for CLJS and CLJ as well, https://github.com/wagjo/data-cljs |
| 04:42 | alandipert | jowag: just part of what we needed to do to escalate markup to program in a way that made sense for the kinda apps we build |
| 04:42 | jowag | clgv: But the constant overhead on their operations is not usually feasible, thats why rrb-vectors were created instead |
| 04:43 | jowag | alandipert: I've skimmed through the getting started and thought, oh well yet another DSL to learn... |
| 04:43 | sveri | hi, is there a lib which helps me to access REST interfaces from clojurescript? |
| 04:45 | jowag | sveri: https://github.com/yogthos/cljs-ajax perhaps? |
| 04:46 | clgv | jowag: data.finger-trees only supports rseq as well ;) |
| 04:47 | sveri | jowag: thank you :-) do you know if it supports basic auth? i have not seen it mentioned on the github page |
| 04:47 | jowag | clgv: yes, but reversing them would be much simpler, log n perhaps |
| 04:49 | jowag | sveri: don't know |
| 04:49 | alandipert | jowag: if it makes you feel any better, the only DSL-ish parts are saying 'page' instead of ns, and ending your file with a call to a dom function. the rest is cljs and a macro or two |
| 04:50 | alandipert | jowag: our production stuff is namespaced html + regular .cljs, we show the single-file approach in getting started so that we can demo all the parts in the same file |
| 04:56 | jowag | alandipert: it's just a matter of taste, but I like hiccups approach more. You can see that what you are dealing with are clojures data structures and not a god-knows-what macros. |
| 04:57 | alandipert | jowag: i'd be curious to hear your thoughts on the "HTML Evaluator" section of http://hoplon.io/#/home/ |
| 05:01 | jowag | alandipert: do you keep holding a reference to the DOM object form CLJSs 'vars'? |
| 05:03 | alandipert | jowag: yes, but no dom objects are created when the page runs |
| 05:07 | jowag | alandipert: I have no problem with this but I'm wondering whether browsers generally guarantee that they do not fiddle with DOM objects in the background and that you can assume they will always point to the right element. Another thing is that you are preventing GC as long as you hold onto the DOM object, but you surely know that. |
| 05:12 | alandipert | jowag: afaik browsers don't do that. and yes the gc situation is OK because we only create dom nodes once, on load, and hang onto them forever |
| 05:20 | ddellacosta | simple question: how do I make a function from a list? |
| 05:20 | dav | ddellacosta: what's in the list? |
| 05:21 | ddellacosta | like, the actual resolved name + args: (+ 1 1) |
| 05:22 | ddellacosta | but I get: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn |
| 05:22 | Morgawr | do you guys know of any resources I could read about how dosync is implemented and how it manages delayed side-effect operations like sending to agents upon retrying? (Aside from reading the source code which I'm going to do now) |
| 05:23 | Morgawr | like interesting articles or stuff like that |
| 05:25 | ddellacosta | specifically, I want to return a function from the list--that is, I want to pass it around as a function, so it can be evaluated normally: (some-fn-made-from-list ...) |
| 05:25 | fredyr | Morgawr: http://java.ociweb.com/mark/stm/article.html |
| 05:25 | fredyr | Morgawr: and https://github.com/tvcutsem/stm-in-clojure |
| 05:26 | alandipert | ,((fn [op & args] (apply partial (resolve op) args)) '(+ 1 2)) |
| 05:26 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol> |
| 05:26 | Morgawr | fredyr: thanks! |
| 05:26 | Morgawr | will give them a read |
| 05:26 | fredyr | sure |
| 05:28 | alandipert | ,((fn [[op & args]] (apply partial (resolve op) args)) '(+ 1 2)) ;? |
| 05:28 | clojurebot | #<core$partial$fn__4198 clojure.core$partial$fn__4198@1cbab62> |
| 05:29 | ddellacosta | alandipert: thanks...I guess partial was what I was looking for! |
| 05:30 | alandipert | ddellacosta: np! |
| 05:32 | alandipert | ddellacosta: have you seen hoplon btw? as you're a purveyor of cljs dom stuff i'm very interested in your thoughts |
| 05:33 | ddellacosta | alandipert: I have only just seen it, but haven't had a chance to dig in yet...there is so much flying by lately! But I'll definitely take a closer look and let you know what I think. |
| 05:34 | alandipert | ddellacosta: cool thx! |
| 05:34 | ddellacosta | alandipert: that + OM is making my head spin...haha |
| 05:34 | alandipert | there are definite similarities |
| 05:34 | ddellacosta | alandipert: definitely psyched in general that people are putting this kind of cool stuff out there. I have this feeling lately like the CLJS world is miles ahead, and the rest of the world hasn't figured it out yet... |
| 05:34 | ddellacosta | but, I suppose I'm biased. ;-) |
| 05:36 | alandipert | ddellacosta: na you're totally right, we're the best ;-) |
| 05:37 | ddellacosta | alandipert: haha, okay. :-) |
| 05:37 | ddellacosta | alandipert: gotta go have dinner with my wife...cheers! Look forward to checking out hoplon in more detail. |
| 05:45 | jowag | alandipert: so looking at the compiler, the .hl file is just {:ns "...", :setup [] :html []} map with a nicer syntax |
| 05:52 | Profpatsch | Is there a way to send everything that comes out of System/out to *out*? That is, to connect Streams? |
| 05:52 | Profpatsch | Two outgoing streamst |
| 05:52 | Profpatsch | *streams. |
| 05:53 | hyPiRion | Well, yeah |
| 05:55 | hyPiRion | you'd have to replace System/out with an outputstream sending the values to both streams |
| 05:57 | Profpatsch | hyPiRion: How would I do that? The Java System of streams has a quite high value of *sucking ass*. |
| 05:58 | hyPiRion | You'd have to make a new class through e.g. reify, and replace that class with System/setOut |
| 05:59 | Profpatsch | Even better, *out* is a PrintWriter and System/out is a static PrintStream, which don’t even inherit the same base class. |
| 06:01 | hyPiRion | Profpatsch: Obligatory rant: http://hypirion.com/musings/how-to-cancel-a-blocking-read |
| 06:02 | Profpatsch | I can make a new PrintStream from an OutputStream, but there is no way I can see how to get an OutputStream from PrintWriter. |
| 06:04 | Profpatsch | Can I pipe all data from *out* to System/out somehow? |
| 06:05 | hyPiRion | hm |
| 06:05 | hyPiRion | ,(binding [*out* System/out] (prn "hello")) |
| 06:05 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.io.PrintStream cannot be cast to java.io.Writer> |
| 06:06 | hyPiRion | although that likely kills your purpose |
| 06:06 | Profpatsch | That’s the wrong direction. |
| 06:06 | Profpatsch | Wait … Ugh, I don’t get it. |
| 06:07 | Profpatsch | My original problem is that the REPL doesn’t display anything from System/out, but the java classes I want to wrap use it a lot. |
| 06:09 | Profpatsch | This *has* to be a known and fixed problem, I’m certainly not the first to stumble into this. |
| 06:11 | hyPiRion | that's a different problem though |
| 06:11 | hyPiRion | are you using emacs? |
| 06:12 | Profpatsch | hyPiRion: Yep, cider with nrepl |
| 06:12 | Profpatsch | Or the other way around. ;) |
| 06:13 | hyPiRion | Hmm, that's sort of a nREPL-problem I think. Check if *nrepl-server* contains the printed message. |
| 06:13 | hyPiRion | (It usually doeS) |
| 06:21 | Profpatsch | Uh, yeah, it does. |
| 06:21 | Profpatsch | Why is it sent there and not to the repl? |
| 06:25 | hyPiRion | I think it's related to emacs and no threading. It seems to happen when you fire up a new thread on the JVM |
| 06:26 | Profpatsch | Oh, okay. Thanks! |
| 06:49 | Profpatsch | How do I get the class Object (java: Object.class)? Object/class doesn’t work. |
| 06:50 | Profpatsch | Nor does (.class Object) |
| 06:51 | Profpatsch | Found it: (class Object) |
| 06:52 | Profpatsch | Wow, that was close. :) |
| 07:17 | clgv | Is there a possibility to clear java.lang.ThreadLocal values from a different thread, e.g. after finishing a parallel computation? |
| 07:35 | Profpatsch | Actually with (class) I get the class of an object, Object itself will do. |
| 07:47 | Morgawr | ,(let [map1 { :a 1 :b 2 :c 3 } set1 #{:a :b}] (apply dissoc map1 (keys (apply dissoc map1 set1)))) |
| 07:47 | clojurebot | {:a 1, :b 2} |
| 07:48 | Morgawr | what's a better way to do this? difference between a map and a set and obtain only the keys that are present in the set |
| 07:48 | clgv | Morgawr: clojure.set/select-keys |
| 07:48 | Morgawr | welp |
| 07:48 | Morgawr | thanks |
| 07:48 | Morgawr | every time I stumble upon this stuff haha |
| 07:49 | clgv | $findfn {:a 1 :b 2 :c 3 d:4} [:a :c] {:a 1 :c 3} |
| 07:49 | clgv | I like to challenge lazybot ;) |
| 07:49 | lazybot | [clojure.core/cond clojure.core/dosync clojure.core/import clojure.core/prn clojure.core/refer-clojure clojure.core/print clojure.core/newline clojure.core/comment clojure.core/or clojure.core/load clojure.core/await clojure.core/declare clojure.core/println clojure.... https://www.refheap.com/22068 |
| 07:49 | clgv | uff |
| 07:50 | clgv | thats plainly wrong dear bot ;) |
| 07:50 | Morgawr | wait, what's findfn? it looks for all possible combinations of functions that can produce a given output form the given input? |
| 07:50 | clgv | &(require 'clojure.set) |
| 07:50 | lazybot | ⇒ nil |
| 07:50 | Morgawr | from* |
| 07:52 | clgv | oh it's clojure.core/select-keys ;) |
| 08:16 | sbhuiyan | Hi there, I was wondering if anybody can answer a question about friend and configuring multiple workflows |
| 08:18 | sbhuiyan | I'm getting the behaviour where all workflows are run and if one of them throws and Exception, regardless of the result of other workflow, it still generates a 403 |
| 09:18 | seriously_random | create a new vector from first and second element in other vector? e.g. (magic (first '[1 2 3]) (second '[1 2 3])) |
| 09:20 | stuartsierra | ,((juxt first second) [1 2 3]) |
| 09:20 | clojurebot | [1 2] |
| 09:20 | seriously_random | how about a sequence? |
| 09:21 | stuartsierra | ,(vec (take 2 (range)) |
| 09:21 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 09:21 | stuartsierra | ,(vec (take 2 (range))) |
| 09:21 | clojurebot | [0 1] |
| 09:24 | seriously_random | (first '[1 2 3]) --> make it (1)? |
| 09:25 | mdrogalis | Walk into office after Christmas party - desk is missing. |
| 09:25 | mdrogalis | Must have been one heck of a party. :P |
| 09:25 | seriously_random | (cons (first '[1 2 3]) '()) |
| 09:25 | lumafi | ,(take 1 [1 2 3]) |
| 09:25 | clojurebot | (1) |
| 10:33 | gfredericks | (defmacro cond->-> [x & pairs] (if-let [[c form & more] (seq pairs)] `(let [x# ~x] (cond->-> (if (-> x# ~c) (-> x# ~form) x#) ~@more)) x)) |
| 10:33 | gfredericks | like cond-> but the conditions are threading forms as well |
| 10:34 | stuartsierra | bbloom: Do you have benchmark code for CLJ-1200 that shows performance improvement? |
| 10:34 | stuartsierra | I've tried half a dozen things, but any differences are lost in the noise. |
| 11:17 | coventry | Is there a right way to run a "CREATE DATABASE" SQL command in clojure/java, via jdbc or similar? |
| 11:36 | gfredericks | coventry: I'm not familiar with alternatives, but every time I've done it has been through jdbc/do-commands |
| 11:50 | coventry | gfredericks: Thanks. |
| 12:38 | lethjakman | hey, any recommendations on clojure web frameworks? I need threading and I'm a big fan of rails. I saw pedestal but I'm not sure what I think of it |
| 12:38 | `cbp | lethjakman: there's pedestal and caribou |
| 12:38 | mdrogalis | By threading, you mean you need an async web framework? Or a backend that uses extensive currency? |
| 12:39 | lethjakman | mdrogalis: backend that uses concurrancy. I don't want one person to get held up while other people are doing things. |
| 12:39 | lethjakman | `cbp: interesting I haven't seen caribou, I'm looking at pedestal right now |
| 12:39 | lethjakman | any experience with them |
| 12:39 | lethjakman | ? |
| 12:40 | mdrogalis | lethjakman: There's also Luminus. |
| 12:40 | `cbp | nope :D. I just usually combine compojure with ring + whatever else libs I wanna add in |
| 12:40 | mdrogalis | But really, those two concerns are orthogonal. |
| 12:40 | lethjakman | `cbp: ahhh ok. |
| 12:40 | lethjakman | mdrogalis: why's that? |
| 12:41 | lethjakman | hmmm haven't heard of that one |
| 12:41 | mdrogalis | lethjakman: Why would your concurrency concern intersect with your choice of web framework? |
| 12:42 | lethjakman | mdrogalis: because a web framework that doesn't allow for concurrancy tends to be a bit slow. |
| 12:42 | mdrogalis | lethjakman: I think we're talking about two very different things lol |
| 12:42 | mdrogalis | I'll let someone else field this one. |
| 12:43 | lethjakman | sorry. perhaps I'm wording something wrong. |
| 12:43 | technomancy | lethjakman: clojure doesn't have any frameworks/libraries that don't allow for concurrency |
| 12:43 | lethjakman | technomancy: really? |
| 12:43 | mdrogalis | It's okay. |
| 12:43 | lethjakman | that isn't something I was aware of |
| 12:43 | technomancy | if you tried to release one you would get raw tomatoes thrown at you basically |
| 12:43 | lethjakman | is clojure multi threaded? |
| 12:43 | technomancy | s/raw/rotten/ |
| 12:44 | gfredericks | lethjakman: yes |
| 12:44 | hiredman | runtimes are mutlithreaded, not languages? |
| 12:44 | lethjakman | I'm actually coming from a scheme background a few years back. how is clojure with memory management? |
| 12:44 | hiredman | automatic? |
| 12:44 | gfredericks | lethjakman: that's more a question about the JVM |
| 12:45 | lethjakman | ahhh ok. |
| 12:45 | lethjakman | does it put a lot of overhead on the JVM? |
| 12:45 | lethjakman | I guess that's a better question |
| 12:45 | lethjakman | sorry for all the n00b questions. |
| 12:45 | hiredman | lethjakman: that depends on what you are doing |
| 12:47 | gfredericks | lethjakman: from a web dev vantage point, I don't think so |
| 12:48 | cark | i think it's fair to say there is much overhead with the datastructures, everything being boxed and all |
| 12:52 | lethjakman | interesting. I'll have to play with it. |
| 12:52 | lethjakman | I've been hearing clojure is pretty effecient |
| 12:52 | lethjakman | I want to see it compared to ruby |
| 12:52 | lethjakman | which is my current framework. |
| 12:52 | cark | clojure is way faster than ruby |
| 12:52 | cark | _way_ faster |
| 12:53 | lethjakman | cark: can you support that? |
| 12:53 | lethjakman | I'm honestly worried about the concurrancy because that's somethign that wasn't handled well in ruby from the start. |
| 12:53 | cark | mhh, no real benchmark, just experience |
| 12:53 | hiredman | lethjakman: which ruby? |
| 12:54 | cark | the concurency story in clojure is very good |
| 12:54 | cark | it's one of its main selling points |
| 12:54 | hiredman | http://www.techempower.com/benchmarks/ |
| 12:54 | lethjakman | hiredman: 1.9 and rails belowe 4.0 didn't really do concurrancy. it's better now but a lot of the libraries aren't concurrant. |
| 12:54 | lethjakman | is there a clojure package manager? |
| 12:54 | `cbp | concurrency and parallelism are basically clojure's raison d'être |
| 12:55 | cark | in this benchmark it looks like jruby is doing better |
| 12:55 | lethjakman | `cbp: clojure isn't on this chart. |
| 12:55 | lethjakman | cark: I've heard that actualy. |
| 12:56 | technomancy | languages aren't fast or slow; programs are |
| 12:56 | lethjakman | `cbp: oooo. |
| 12:56 | lethjakman | interesting. |
| 12:56 | hiredman | lethjakman: which chart? |
| 12:56 | technomancy | well, to be pedantic: a given execution of a program is fast or slow |
| 12:56 | lethjakman | technomancy: of course. but some programs are better written in other languages. |
| 12:56 | cark | yes it isn't a language benchmark, it's an application stack benchmark |
| 12:56 | lethjakman | I've had an idea that clojure might be nice for a web framework for a whil and haven't looked into it. |
| 12:56 | technomancy | lethjakman: indeed |
| 12:58 | lethjakman | thank you all, I appreciate your advice/discussion. |
| 12:58 | lethjakman | I think I'm gonna do a bit more research. |
| 12:58 | hiredman | compojure is the only explicitly clojure thing on the techempower benchmarks, where it clocks in faster than rack, but for example, java servlets came in second in the whole thing, and you can use the serlet api from/in clojure (in fact compojure is generally used via a ring <-> servlet adapter) |
| 12:58 | lethjakman | ahh interesting. |
| 12:59 | hiredman | rack-jruby actually scores surprisingly high |
| 13:00 | hiredman | it looks like they are using torqbox, someone should submit and immutant based compojure version |
| 13:00 | technomancy | the tl;dr is that the JVM has the best GC and JIT in the world, and that Clojure imposes a lot less runtime overhead than JRuby since it's designed specifically for the JVM without the constraints of backwards compatibility |
| 13:01 | technomancy | Clojure is often slower than Java due to immutability creating higher load on the GC, (and a few other factors) but since it removes the potential for a large class of bugs generally no one minds |
| 13:02 | lethjakman | ahhh interesting. |
| 13:02 | lethjakman | but java is ugly... |
| 13:02 | cark | ugly but pretty damn fast |
| 13:02 | lethjakman | and tends to be slow to develop in. |
| 13:02 | lethjakman | cark: c++ is and always will be faster. |
| 13:02 | lethjakman | if I'm going for something optimized with slower dev time I'd probably use that. |
| 13:02 | lethjakman | especially with c++11 |
| 13:03 | technomancy | the best advice for writing concurrent code in Java is to use immutability anyway, and immutable data structures in Java are very clumsy and IIRC don't always exhibit the same structural sharing as clojure, so it can end up even slower |
| 13:03 | lethjakman | interesting. |
| 13:03 | lethjakman | very interesting. |
| 13:03 | lethjakman | did you guys learn clojure in school or for fun? |
| 13:04 | cark | i think the difference between c++ and java performances in the server space is vannishingly small |
| 13:04 | cark | specially for long running processes |
| 13:04 | tcrawley | hiredman: the next major version of Immutant will be based on the same underpinnings as the torqbox gem. I'm working on the foundations of that now |
| 13:04 | tcrawley | once I have something useful, I'll add it to the benchmark suite |
| 13:05 | tcrawley | though I dislike micro benchmarks |
| 13:05 | technomancy | lethjakman: I don't know of any schools that teach it |
| 13:05 | clojurebot | excusez-moi |
| 13:05 | cark | they should ! |
| 13:06 | lethjakman | benchmarks are a good starting point I think. |
| 13:06 | lethjakman | cark: like everything else it depends on what you're doing. anything with huge memory management is better done in C++. |
| 13:07 | lethjakman | I kinda want to try Go for servers as well. I've heard it's concurrancy is good. |
| 13:07 | technomancy | Go still has mutable data structures by default |
| 13:07 | technomancy | so I'm sure it's good compared to Ruby or JS, but... yeah |
| 13:08 | cark | go is fun |
| 13:08 | lethjakman | interesting. but it's not run on the JVM. is immutable still important? |
| 13:08 | cark | but yes, once you get used to persistent data structures, it's hard to go back, even in a single threaded context |
| 13:08 | technomancy | writing concurrent code without immutability is like tight-rope walking |
| 13:08 | technomancy | it's possible to do, and it can be spectacular when done well |
| 13:09 | technomancy | it can also be spectacular when done badly |
| 13:10 | cark | lethjakman: immutability and jvm are orthogonal |
| 13:10 | cark | the only thing required is a GC |
| 13:11 | Pupnik | is that actually true? |
| 13:11 | technomancy | concurrent code without immutability *or* a GC is like tight-rope walking while juggling flaming swords |
| 13:11 | technomancy | theoretically possible! |
| 13:11 | cark | you can't do persitent without garbage collection |
| 13:12 | lethjakman | lol.... |
| 13:12 | cark | be it a primitive reference counting or anything, but you need it |
| 13:13 | jcrossley3 | hiredman: the torqbox perf is due mostly to jboss' undertow, specifically switching the rack impl from servlets to undertow's HttpHandlers. |
| 13:15 | hiredman | jcrossley3: neat |
| 13:18 | hiredman | https://github.com/piranha/ring-undertow-adapter like magic, I look and it is there |
| 13:39 | logic_prog | DOM Nodes are trees, not DAGs. Clojure datat can be a DAG rather than just a tree. Thus, in Om, what happens when I have a certain piece of data repeated twice within the clojure data structure. DOes it correctly create two nodes, or incorrectly try to share 1 node? |
| 13:47 | dnolen | ,(let [m {:foo "bar"}] (identical? m (assoc m :foo "bar"))) |
| 13:47 | clojurebot | true |
| 13:47 | dnolen | love it |
| 13:48 | dnolen | logic_prog: 2 nodes |
| 13:48 | logic_prog | dnolen: how does it handle this? |
| 13:48 | logic_prog | dnolen: I was trying to re-invent this myself |
| 13:49 | dnolen | logic_prog: what do you mean? |
| 13:49 | logic_prog | dnolen: and wanted to tag each piece of clojure data with a meta data containing the html node |
| 13:49 | logic_prog | dnolen: but then when I copy a piece of clojure data, the html node also gets the same reference from the meta |
| 13:49 | dnolen | logic_prog: Om just takes a DAG of values to another DAG of values |
| 13:49 | dnolen | via React |
| 13:50 | logic_prog | dnolen: if OM is Dag -> Dag, how do we get a HTML DOM Tree ? |
| 13:50 | dnolen | logic_prog: the real one? React handles that |
| 13:50 | logic_prog | dnolen: nice, thanks! |
| 13:53 | logic_prog | dnolen: one more dumbass question: is the virtual dom a tree or a dag? |
| 13:55 | dnolen | logic_prog: pretty sure it's a tree if it mirrors the DOM |
| 13:58 | logic_prog | dnolen: the fog has been lifted. Thanks for answering all my questions! |
| 14:25 | justin_smith | lethjakman: regarding your "does clojure have a package manager" way up in the scrollback, the best thing to do is use lein, where you don't manage the packages on your system, but rather the dependencies + versions which will be used by each project |
| 14:25 | lethjakman | justin_smith: that's good to know. thank oyu. |
| 14:26 | justin_smith | lethjakman: this is project specific, so conflicts of versions only happen inside a project, never between projects (unlike many runtimes where only one lib version can be installed so you get into managing multiple "installations" etc.) |
| 15:08 | logic_prog | in cljs, is goog.dom get element by id an expensive or cheap operation? |
| 15:09 | logic_prog | is it just a "lookup this string in this map" |
| 15:09 | logic_prog | or is there somethign complicated going on? |
| 15:09 | logic_prog | i.e. is it taht much more expensive than just looking up in a hashmap? |
| 15:10 | dnolen | logic_prog: pretty sure it just delegates to document.getElementById |
| 15:10 | dnolen | and the performance will be browser dependent |
| 15:11 | logic_prog | dnolen: would you happen to know if document.getElementById happen to be any more costly than just a hash map lookup? |
| 15:11 | stuartsierra | It's one of the most commonly-used DOM functions; I'm sure it's as optimal as possible. :) |
| 15:11 | dnolen | logic_prog: I've never looked at how it's implemented in any particular browser |
| 15:14 | logic_prog | http://stackoverflow.com/questions/1854859/jquery-performance-wise-what-is-faster-getelementbyid-or-jquery-selector <-- hmm, looks like I can't get faster than this anyway |
| 15:15 | dnolen | logic_prog: step 1 don't use jQuery if you are concerned about performance. |
| 15:22 | dbell | I came across #js in several cljs projects lately---what does it mean? |
| 15:22 | gfredericks | dbell: reader literal for js arrays and objects |
| 15:22 | dbell | ah |
| 15:22 | dbell | ty gfred |
| 15:36 | emaphis | /join #part |
| 15:37 | egosum | what are people using for postgres in Clojure these days? Prefer to not have much of an ORM |
| 15:37 | `cbp | clojure.jdbc or korma |
| 15:38 | `cbp | you wont find much in the ways of ORMs in clojure |
| 15:40 | egosum | `cbp: nice, thanks |
| 15:42 | dobry-den | datomic |
| 15:43 | bitemyapp | datomic isn't a SQL abstraction library, it's a whole database. |
| 15:44 | egosum | bitemyapp: it's a data abstraction library, isn't it? it's not exactly a DB, since it uses other DBs to do DB-y things |
| 15:44 | elfenlaid | em, hi there, here is description of my problem https://gist.github.com/elfenlaid/8019408 ; tl dr i need to create 1kk tiny objects, but memory consumption going nuts, any suggestions or best practices ? :) |
| 15:44 | gfredericks | it uses other DBs to do file system things |
| 15:45 | egosum | gfredericks: a file system is just a type of database |
| 15:45 | gfredericks | egosum: now the word "database" is less useful |
| 15:46 | dobry-den | bitemyapp: i know it wasn't what egosum was looking for, but it still answers the question. |
| 15:46 | hiredman | egosum: how are you measuring memory usage, and is that 300mb all live data, or will some of it be cleared on the next gc? |
| 15:46 | dobry-den | i really like datalog |
| 15:47 | gfredericks | egosum: but seriously it uses them at a pretty low level; I think it's confusing to say it uses them for db functions; |
| 15:47 | egosum | dobry-den: same; i actually think I'll be using datomic |
| 15:47 | hiredman | oh whoops |
| 15:47 | dobry-den | clojure's sql abstractions i've tried still have me writing strings frequently. i'm done with that |
| 15:47 | hiredman | elfenlaid: how are you measuring memory usage, and is that 300mb all live data, or will some of it be cleared on the next gc? |
| 15:47 | gfredericks | dobry-den: honeysql is good for avoiding strings |
| 15:48 | egosum | gfredericks: I see what you're saying, but i'm not sure who it's confusing |
| 15:48 | bitemyapp | egosum: Datomic completely takes over the semantics of how you interact with your data. The way it uses Postgres et al is very low level and not accessible to an end user. |
| 15:48 | technomancy | I like c.j.jdbc but I hate not getting syntax highlighting for queries |
| 15:48 | bitemyapp | egosum: do not use Datomic assuming you'll be able to side-step the peer library. |
| 15:48 | gfredericks | egosum: I've had a lot of datomic conversations and it's a common point of confusion |
| 15:48 | egosum | bitemyapp: for sure |
| 15:48 | clojurebot | I don't understand. |
| 15:48 | bitemyapp | honeysql is decent and composable'ish. |
| 15:49 | egosum | technomancy: emacs doesn't make it easy to syntax highlight sections of a buffer :( |
| 15:49 | dobry-den | yeah, datomic is quite the leap from 'i want to use postgres from clojure', but it's a fun journey. |
| 15:49 | bitemyapp | that's a pretty common thing though. |
| 15:50 | bitemyapp | egosum: I use Datomic a lot at work and I'm very happy with it, but seriously, don't kid yourself. It's nothing like using PostgreSQL in the usual fashion. |
| 15:50 | egosum | bitemyapp: absolutely; i've been playing around with it a bit, and while i'm still pretty confused about some things, it's really enjoyable. i love writing datalog |
| 15:51 | egosum | gfredericks: interesting; my mental model of datomic is that it's an application that executes queries on an in-memory datastructure (ideally; else it pulls from the backing DB), and sequentially writes to that backing DB |
| 15:51 | gfredericks | I ended up not writing datalog too much; it often wasn't as efficient |
| 15:51 | bitemyapp | technomancy: Fascinating new ways in which Scala is horrifying: https://github.com/puffnfresh/wartremover/issues/29 |
| 15:52 | bitemyapp | gfredericks: as opposed to what, reducing across datoms? |
| 15:52 | egosum | gfredericks: how so? |
| 15:52 | elfenlaid | hiredman, the problem is that all is live data, that's kind of exercise in data mining and I try to do it as simple as possible. Right now the measurements consists of activity monitor observations, but it quite freaking me out |
| 15:52 | bitemyapp | egosum: datalog ain't fast, he isn't joking. |
| 15:52 | dobry-den | You want to query the raw datom index when you can |
| 15:52 | gfredericks | bitemyapp: yeah that sort of thing |
| 15:52 | egosum | bitemyapp: oh I buy it, i'm just curious how slow! |
| 15:52 | bitemyapp | I've fiddled with the datoms API, but it's not clear to me how to leverage the indexes. |
| 15:52 | hiredman | elfenlaid: just becuase all off your final data in the seq is live that doesn't mean everything created while creating the seq is live |
| 15:53 | hiredman | elfenlaid: how are you getting that 300mb number? |
| 15:53 | dobry-den | bitemyapp: http://www.infoq.com/presentations/datomic-use-case |
| 15:53 | gfredericks | egosum: I guess that's tough to quantify |
| 15:53 | bitemyapp | hum, you can select index. I don't remember that changing anything. |
| 15:53 | gfredericks | bitemyapp: and extra args for the index values |
| 15:53 | bitemyapp | I guess it must. |
| 15:53 | egosum | gfredericks: heuristically |
| 15:53 | hiredman | elfenlaid: tools like top which is generally what people reach for first are bad at measuring real memory usage |
| 15:53 | dobry-den | Craig does a good job illustrating the evat avet eavt indexes |
| 15:53 | bitemyapp | gfredericks: that must've been the part I was missing. |
| 15:54 | gfredericks | bitemyapp: yeah I was able to do pretty much whatever I wanted, just more tediously |
| 15:54 | bitemyapp | cool, learned something today already :) |
| 15:54 | gfredericks | bitemyapp: it's also nice cuz it's actually lazy |
| 15:54 | gfredericks | which for some reason datalog isn't |
| 15:54 | bitemyapp | gfredericks: wonder if it'd be worthwhile to make a simple, low-level wrapper to datoms? |
| 15:54 | bitemyapp | gfredericks: yeah the non-laziness of datalog was killing me. |
| 15:54 | hiredman | elfenlaid: there are lots of things to reduce memory usage, but the first thing is to determine if you have a real problem |
| 15:54 | gfredericks | bitemyapp: my guess was it was to be more java-friendly but java iterators are totally normal amirite? |
| 15:55 | bitemyapp | gfredericks: people use them, so I thought. |
| 15:55 | gfredericks | ,(instance? java.util.Collection (range 10)) |
| 15:55 | clojurebot | true |
| 15:55 | gfredericks | ^ and there's that |
| 15:55 | gfredericks | so I have no idea |
| 15:55 | dobry-den | i would think anyone that uses datomic ends up with a simple wrapper around d/datoms for most of their find-by lookups |
| 15:55 | gfredericks | laziness would've been great for pipelining for me |
| 15:56 | gfredericks | dobry-den: yeah I wrote a few helpers like that |
| 16:01 | elfenlaid | hiredman, thanks, it's really the right philosophy to follow :) so, a question is can objects from lazy-seq be cleared with gc if there aren't links to them? |
| 16:02 | dobry-den | has anyone implemented any sort of fuzzy matching for datomic fulltext search? i'm not sure of the exact concept i want to be googling for |
| 16:07 | elfenlaid | hiredman, htop shows 200mb(on fresh repl) => 400mb(after parse-cvs call) |
| 16:09 | logic_prog | , (+ 1 2) |
| 16:09 | clojurebot | 3 |
| 16:09 | logic_prog | is there any jvm as lightweight as beam? |
| 16:09 | elfenlaid | but memory consumption quite stable after several calls, so parse-cvs likely is not leaking |
| 16:10 | logic_prog | I'd like to have lots of little clojure processes on their own jvms |
| 16:10 | hiredman | elfenlaid: so there you go, you've already cut your memory usage by one third |
| 16:11 | technomancy | logic_prog: you can put a bunch of isolated classloaders into one JVM |
| 16:11 | technomancy | but anything calling native code can crash the whole thing |
| 16:11 | logic_prog | but I can't force kill threads in jvm, since stop is deprecated |
| 16:11 | logic_prog | I'd like "little jvms" that I can kill when they misbehave |
| 16:12 | logic_prog | rather than have one monolothic jvm |
| 16:13 | elfenlaid | hiredman, :) i'm new to gc environment, may be it is an idiomatic behavior and i'm not reaching the optimization and profiling part of the book yet :P but thanks for help anyway |
| 16:13 | technomancy | there's no such thing as a lightweight JVM, sorry |
| 16:13 | dobry-den | To answer my own question, TIL about quotation marks in fulltext search -_- |
| 16:14 | logic_prog | technomancy: dumb question: what is it about erlang vs java that allows erlang to have lightweight beam, but java to not have lightweight jvm? |
| 16:15 | bitemyapp | logic_prog: Azul is a thing, you know. |
| 16:16 | technomancy | logic_prog: partly because the JVM has really good JIT, they've chosen to optimize for one monolithic process that takes over the whole machine |
| 16:16 | technomancy | also BEAM evolved in that direction originally because early revisions were super unstable |
| 16:16 | logic_prog | luajit seems very lighweight |
| 16:16 | logic_prog | yet it has a decent jit |
| 16:17 | technomancy | so they *had* to have a design in which they were isolated and disposable |
| 16:17 | technomancy | much like a millionaire who is still careful about money because he grew up in the depression |
| 16:17 | tbaldridge | luajit is one of the best dynamic jits on the planet |
| 16:17 | tbaldridge | mostly because lua semantics are so simple. |
| 16:17 | technomancy | logic_prog: well no one really uses lua outside the context of embedding |
| 16:17 | technomancy | so their priorities are totally different |
| 16:18 | technomancy | Sun wrote the JVM to sell big-iron servers |
| 16:18 | stuartsierra | The JVM has evolved to be heavily optimized for throughput in large applications. BEAM / Erlang evolved to be optimized for high-availability. |
| 16:18 | logic_prog | staurtsierra: I have never seen you here. what do you know about clojure? |
| 16:18 | gfredericks | javascript evolved to be optimized for ___ |
| 16:18 | logic_prog | :-) j/k |
| 16:19 | tbaldridge | logic_prog: nah, it's okay. I work with stuartsierra and I wonder that too |
| 16:19 | tbaldridge | :-P |
| 16:19 | stuartsierra | :P |
| 16:19 | hyPiRion | haha |
| 16:19 | logic_prog | so suppose I really wanted killable clojure functions (say when they infinte loop), sounds like I should look into the cljs->lua backends |
| 16:19 | logic_prog | since lua processes are chepa |
| 16:20 | logic_prog | so I'm writing this large scale app, and I'd prefer to have interchangeable parts that can be killed w/o restarting the main server |
| 16:20 | stuartsierra | Boom! https://github.com/clojure/clojure/search?q=%22stuart+sierra%22&ref=cmdform |
| 16:20 | bitemyapp | `cbp: up to 83 stars :) |
| 16:20 | tbaldridge | logic_prog: lua processes are completely isolated. that is, they aren't connected at all. |
| 16:20 | tbaldridge | logic_prog: you have to run 1 VM per thread and come up with your own message passing. |
| 16:20 | logic_prog | yes, I'm okay with that, |
| 16:21 | logic_prog | "message passsing in cojure is just pr-str + edn/read-string + sockets" |
| 16:21 | logic_prog | so if I had clj -> lua, that'd be like 10 lines of code |
| 16:21 | tbaldridge | sure, if you want it to be slow. |
| 16:21 | hyPiRion | logic_prog: It's completely doable in Clojure to kill threads through. Futures and threads have .cancel |
| 16:21 | hyPiRion | or .interrupt |
| 16:21 | hyPiRion | Well, "kill" |
| 16:21 | logic_prog | .interrupt / .cancel depends on the thread itself checking for interrupts |
| 16:21 | technomancy | IIRC the whole "future cancelling is unreliable" thing is overblown |
| 16:22 | technomancy | un-cancellable operations are pretty rare; I think it's just native code |
| 16:22 | stuartsierra | And I/O. |
| 16:22 | hyPiRion | But you can't cancel I/O reads. |
| 16:23 | hyPiRion | On the JVM, anyway. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4514257 |
| 16:25 | technomancy | yeah, we ended up writing a cancellable-copy for our worker cluster at my last gig |
| 16:25 | hyPiRion | technomancy: I'm sorry. :( |
| 16:26 | technomancy | meh; wasn't bad: https://github.com/technomancy/die-roboter/blob/master/src/die/roboter.clj#L195 |
| 16:26 | technomancy | (for what we needed anyway) |
| 17:07 | Mandar | hi |
| 17:07 | Mandar | quick question: is destructuring the most idiomatic way to get a value in an "embedded" vector? |
| 17:07 | Mandar | (let [{{x 5} 1} my-vector] (println x)) |
| 17:07 | Mandar | i do this for instance |
| 17:07 | Mandar | is there anything more idiomatic? |
| 17:08 | Mandar | (what i could write in another language is: my-vector[1][5]) |
| 17:09 | alandipert | Mandar: (get-in my-vector [1 5]) is another way |
| 17:09 | Mandar | thank you! |
| 17:10 | technomancy | ,(let [myvec [1 [2 3 4[ 5]]]] (get-in myvec [1 3 0]) ) |
| 17:10 | clojurebot | 5 |
| 17:10 | technomancy | oh too slow |
| 17:10 | Mandar | it's way easier to read, thanks |
| 17:10 | hiredman | vectors of vectors are weird |
| 17:10 | hiredman | you will almost certainly at some point end up turning the outer vector in to a seq |
| 17:10 | TEttinger | also, update-in is useful for changing one value |
| 17:11 | technomancy | also destructuring a vector against a vector is more common, but ugly if you only need the fifth thing |
| 17:11 | hiredman | I would either switch to a matrix library, or look at some other data representation |
| 17:12 | Mandar | i just need to store a few values by group |
| 17:12 | Mandar | i don't need a key, i just want them to be ordered so vectors seemed like the right data structure |
| 17:13 | hiredman | Mandar: is the outmost vector logically a collection or logically part of the thing? |
| 17:14 | bitemyapp | technomancy: my poor coworker is trying to reproduce the different behaviors of my Emacs setup from scratch in a clean install. He's literally doing archaeology on my dotfiles the poor bastard. |
| 17:14 | bitemyapp | pretty funny though. |
| 17:14 | bitemyapp | feels a bit like Pham Nuwen... |
| 17:14 | Mandar | hiredman: it's just a collection |
| 17:14 | hiredman | if the outermost vector is logically a collection you'll have a better time assuming it is a seq |
| 17:15 | Mandar | but then wouldnt' be a bit harder to get the third column? |
| 17:15 | Mandar | i just need fast access to a specific column |
| 17:16 | technomancy | bitemyapp: hehe |
| 17:16 | TEttinger | ,(get-in {:a [0 1 2 3]} [:a 2) |
| 17:16 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 17:16 | TEttinger | ,(get-in {:a [0 1 2 3]} [:a 2]) |
| 17:16 | clojurebot | 2 |
| 17:16 | TEttinger | ,(update-in {:a [0 1 2 3]} [:a 2] inc) |
| 17:16 | clojurebot | {:a [0 1 3 3]} |
| 17:17 | hiredman | Mandar: ok |
| 17:17 | TEttinger | returns the whole collection, same collection types, with one element modified by inc |
| 17:17 | Mandar | i'm building a small app to handle conjugation actually |
| 17:18 | Mandar | so my values are forms of verbs for instance |
| 17:18 | Mandar | and my keys really are a conjugation number |
| 17:18 | TEttinger | ser -> soy eres es... |
| 17:18 | Mandar | with rules like "verbs of the 1st group end with ..." |
| 17:18 | hiredman | Mandar: I would switch to a map with pairs as keys |
| 17:18 | clojurebot | Excuse me? |
| 17:18 | technomancy | bitemyapp: how much do you know about how xmonad works? |
| 17:18 | hiredman | you have a database of things indexed by some value |
| 17:19 | hiredman | {[0 1] "foo"} |
| 17:19 | Mandar | this could also work |
| 17:20 | bitemyapp | technomancy: drips and drabs, from hacking on it in my .xmonad/* and reading what dons has said about building it. Why? |
| 17:21 | hiredman | and then you can get more complicated, {{:row 0} #{"foo"} {:column 1} #{"foo" "bar"} {:row 1} #{"bar"}} |
| 17:21 | hiredman | start doing set logic and implement sql |
| 17:22 | Mandar | haha, that's a bit far ahead |
| 17:22 | technomancy | bitemyapp: I have this crazy idea of a continuous spread of workspaces instead of discrete ones; something you could hook up to an HMD+digital compass to pan around in analog |
| 17:23 | bitemyapp | technomancy: oculus? |
| 17:23 | technomancy | and the only chance in hell I'd have of actually doing it (still slim) would be to hack it into xmonad |
| 17:23 | hiredman | technomancy: that is the same as having 1 big workspace |
| 17:23 | technomancy | bitemy |
| 17:23 | bitemyapp | I think the non-discrete nature would bother me. |
| 17:23 | technomancy | oops |
| 17:24 | technomancy | bitemyapp: something like that. I don't care about stereoscopic, but even modulo that it appears to be cost-competitive |
| 17:24 | technomancy | bitemyapp: you'd need the ability to lock it down or your neck would tire, sure |
| 17:25 | technomancy | hiredman: yeah, provided you can zoom to a particular spot |
| 17:27 | technomancy | I didn't say it was a good idea |
| 17:30 | bitemyapp | I think it's a neat idea. |
| 17:30 | bitemyapp | It'd just need to some work to work well |
| 17:32 | logic_prog | dumbass question: I know how to use clojure rrb-vector. How do I use rrb-vector in cljs? |
| 17:33 | technomancy | bitemyapp: that's why I'm asking now even though no studies have been made on the prolonged health effects of HMDs =) |
| 17:33 | bitemyapp | logic_prog: import this: https://github.com/clojure/core.rrb-vector/blob/master/src/main/cljs/cljs/core/rrb_vector.cljs |
| 17:35 | logic_prog | bitemyapp: what do I add to project.clj ? |
| 17:36 | bitemyapp | logic_prog: that's the $10,000 question on ClojureScript lately. |
| 17:36 | logic_prog | yeah how else am I supposed ot use this? |
| 17:36 | logic_prog | git clone and copy the entire cljs directory into my cljs directory ? |
| 17:37 | TEttinger | logic_prog: https://github.com/clojure/core.rrb-vector#releases-and-dependency-information |
| 18:21 | bitemyapp | noprompt: yo |
| 18:22 | noprompt | bitemyapp: hey buddy |
| 18:22 | bitemyapp | noprompt: A buddy should be joining us, so it might be 3. Saturday or sunday? |
| 18:25 | noprompt | bitemyapp: sunday should work for me. |
| 18:25 | bitemyapp | noprompt: sweet. time? |
| 18:27 | technomancy | Bronsa: https://github.com/technomancy/leiningen/commit/248362f2e72973eeeab8cb85e8ed1657b751e4fb |
| 18:33 | noprompt | bitemyapp: i don't see why 3pm wouldn't work but i'm open to whatever is convenient |
| 18:34 | Bronsa | technomancy: thanks! |
| 18:34 | technomancy | thank dsantiago =) |
| 18:40 | Bronsa | (inc dsantiago) ;; thanks :) |
| 18:40 | lazybot | ⇒ 1 |
| 18:42 | bitemyapp | noprompt: no, I meant 3 of us. |
| 18:42 | bitemyapp | noprompt: would you be up for starting around 1 pm? |
| 18:44 | bitemyapp | noprompt: we'll be working on frak++ right? |
| 18:53 | Mandar | is there a command in leiningen to rename a project? |
| 18:54 | logic_prog | isn't it just vim |
| 18:54 | logic_prog | s/old-name/new-name/ ? |
| 18:54 | logic_prog | s/vim/vim project.clj/ |
| 18:54 | Mandar | yes, but you also have to rename the directories |
| 18:54 | Mandar | i thought there might be something |
| 18:54 | logic_prog | you mean "mv" ? :-) |
| 18:54 | Mandar | :) |
| 18:54 | hiredman | you don't actually have to rename the directories |
| 18:55 | Mandar | it's cleaner, isn't it? |
| 18:55 | hiredman | *shrug* |
| 18:56 | hiredman | the point is the namespacing mirroring directory structure is orthogonal to the maven coordinates |
| 18:57 | hiredman | one does not → anything about the other |
| 18:58 | noprompt | bitemyapp: sure. we can do that. |
| 18:58 | Mandar | hiredman, ok thanks |
| 19:01 | bitemyapp | noprompt: sweet. |
| 19:12 | Mandar | hey, i can bother you some more now |
| 19:13 | Mandar | (sorry) |
| 19:13 | Mandar | here's some code: https://github.com/agolp/sangria/blob/master/src/sangria/core.clj |
| 19:13 | bitemyapp | Mandar: are you working on Sangria? |
| 19:14 | Mandar | my brain just might |
| 19:14 | Mandar | but i'm not aware |
| 19:14 | Mandar | i would like to check in the conjugate function if a word is composite and if so do some specific bindings in my let |
| 19:14 | bitemyapp | Sangria doesn't look like a proper NLP library, are you sure that isn't what you need? |
| 19:15 | Mandar | is sangria a library i was not aware of? |
| 19:16 | Mandar | it's just a dumb name i gave to my learning project |
| 19:16 | bitemyapp | no, that's what I was trying to determine when I asked you if it was yours. |
| 19:16 | Mandar | oh yes it is sorry |
| 19:16 | bitemyapp | You didn't give a clear answer, so I assumed it as something you were trying to leverage. |
| 19:16 | Mandar | english is not my first language (and i'm a bit tired) |
| 19:16 | bitemyapp | It's fine. |
| 19:17 | Mandar | so i'm just writing a smallish app to help my little sister learn her spanish |
| 19:17 | bitemyapp | Mandar: what's your native language? |
| 19:17 | Mandar | french |
| 19:18 | Mandar | so everything works fine for simple verbs, i can conjugate them at the present tense |
| 19:19 | Mandar | i'm trying to handle composite ones |
| 19:19 | Mandar | which end with "se" |
| 19:19 | Mandar | so (if = (clojure.string/join (take-last 2 verb)) "se") ... i need to cut the ending |
| 19:20 | bitemyapp | Mandar: I didn't know Spanish had consistent conjugation. |
| 19:20 | Mandar | and add a pronoun before |
| 19:20 | Mandar | i'm not sure whether it works for every verb |
| 19:20 | Mandar | i just checked the 15 verbs my sister gave me |
| 19:20 | bitemyapp | Mandar: you don't want to take-last a string. |
| 19:21 | bitemyapp | ,(.endsWith "base" "se") |
| 19:21 | clojurebot | true |
| 19:21 | Mandar | oh great, that's exactly the kind of things i need to learn |
| 19:21 | bitemyapp | ^^ The above is more declarative and idiomatic. |
| 19:21 | bitemyapp | Mandar: you should be extremely careful with processing human text on a character by character basis without the assistance of an NLP library. |
| 19:21 | bitemyapp | I realize your problem scope is limited, and that's okay, just be aware that it won't really work in the general case. |
| 19:22 | Mandar | sure |
| 19:22 | Mandar | i've done some stemming and basic word manipulation in other languages before |
| 19:22 | Mandar | but i just need to handle specific lowercase verbs here |
| 19:23 | Mandar | so what's the idiomatic way to rewrite these (take-last) ? |
| 19:23 | Mandar | when i want to actually get the termination, or the root |
| 19:23 | Mandar | a regexp looks overkill |
| 19:23 | bitemyapp | oh yeah, if you want to just slice it, then yeah, take-last. |
| 19:24 | bitemyapp | I was talking about the endsWith case. |
| 19:24 | Mandar | thank you! |
| 19:24 | bitemyapp | working with strings as lists will fall apart in any kind of high performance situation but I doubt it matters to you right now. |
| 19:25 | Mandar | is there a way to add an if clause inside a let? |
| 19:26 | bitemyapp | Mandar: well there's if-let and when-let. |
| 19:26 | Mandar | (hey it didn't like (.endsWith word "se") |
| 19:26 | bitemyapp | Mandar: there's also or/and based short-circuiting for values in a let expression. |
| 19:26 | Mandar | oh yes, i've read about those |
| 19:27 | Mandar | there's just so much to use i can't remember the right syntax for each situation |
| 19:28 | Mandar | (i had a syntax error sorry) |
| 19:28 | rovar_away | bitemyapp: won't the seq operations operate on the strings as vectors? |
| 19:29 | bitemyapp | rovar: https://github.com/clojure/core.typed/wiki/Strings |
| 19:31 | justin_smith | ,(map (comp class seq) [[0 1 2] "hello"]) |
| 19:31 | clojurebot | (clojure.lang.PersistentVector$ChunkedSeq clojure.lang.StringSeq) |
| 19:32 | rovar | bitemyapp: huh |
| 19:33 | rovar | so what is the recommended path to high performance string operations? |
| 19:34 | Mandar | java functions i guess? |
| 19:35 | AimHere | jVM bytecode! |
| 19:36 | justin_smith | string ops, whether clojure.string or via interop |
| 19:37 | bitemyapp | arrdem: http://i.imgur.com/aK4BUza.jpg |
| 19:37 | bitemyapp | rovar: depends on the operation. |
| 19:40 | bitemyapp | rovar: ropes are good for mass insert/delete, vectorized/array-based strings are good for cache-oblivious linear scans, inverted indexes for search... |
| 19:41 | TEttinger | ropes? |
| 19:41 | Mandar | is it idiomatic to imbricate let clauses? |
| 19:41 | TEttinger | is that the opposite of extricate? |
| 19:42 | Mandar | interleave |
| 19:42 | Mandar | put one inside the other? |
| 19:42 | bitemyapp | technomancy: my coworker is really taking to the Emacs "craft thine own lightsaber" thing. |
| 19:42 | hiredman | ,(let [a 1 b (inc a)] [a b]) |
| 19:42 | clojurebot | [1 2] |
| 19:42 | bitemyapp | technomancy: now he's diving into Helm, ag, the works. |
| 19:43 | technomancy | bitemyapp: are you relishing having a sith apprentice? |
| 19:43 | justin_smith | Mandar: more common to see (let [a (f x) _ (frob a) b (b x)] b) |
| 19:43 | bitemyapp | technomancy: yes, partly because there are so many vim/Sublime Text/PyCharm users here. |
| 19:43 | justin_smith | Mandar: so assinging to an unused var (_ by convention) instead of nesting lets |
| 19:43 | bitemyapp | technomancy: so having an Emacs user that isn't me or the other Common Lisp weenie is kinda cool. |
| 19:44 | Mandar | justin_smith, i would like to throw an if somewhere in there |
| 19:44 | Mandar | so i cannot rely only on destructuring |
| 19:44 | Mandar | would it be bad to have a let inside an if-let ? |
| 19:45 | justin_smith | no, not bad at all |
| 19:45 | Mandar | thanks, i'll try to show some code |
| 19:52 | bitemyapp | When did JVM become synonymous with Unix? I thought JVM users were trying to hide from the OS? |
| 19:54 | technomancy | I think it's more that "computers" became synonymous with Unix? |
| 20:10 | bitemyapp | tbaldrid_: are persistent array maps supposed to be broken in clojure-py? |
| 20:10 | bitemyapp | tree maps seem okay though. |
| 20:27 | bitemyapp | actually persistent tree map seems a bit fucked too/ |
| 20:29 | xeqi | technomancy: I think that happened around jurassic park time |
| 20:31 | technomancy | hehe |
| 20:53 | logic_prog | with apologies for my dumbass question: how do I modify https://github.com/clojure/core.rrb-vector/blob/master/project.clj so that (require [cljs.core.rrb-vector]) does not result in a good.require could not find cljs.core.rrb-vector |
| 20:57 | Mandar | https://github.com/agolp/sangria/blob/master/src/sangria/core.clj |
| 20:57 | Mandar | i've added support for composite verbs |
| 20:58 | Mandar | as expected, it's getting ugly |
| 20:59 | Mandar | it looks like i could remove some of these lets, but i don't know how |
| 21:00 | Mandar | i'd prefer find-root not to check for composite words again |
| 21:08 | logic_prog | what do I put in project.clj so that lein cljsbuild can have access to core.rrb-vector, from cljs land? |
| 21:26 | egosum | is lobos *the* way to go about migrations (without maintaining text/text files of SQL)? |
| 21:26 | egosum | and if so, is there some better documentation somewhere (i haven't found it yet), or is reading the code the expected way of learning how to use it? |
| 21:40 | danlentz | apologies for silly question but what is the proper way to "re-export" from one namespace symbols inherited ("used") from another? |
| 21:41 | danlentz | you might guess im coming at this from a common-lisp perspective |
| 21:41 | justin_smith | (def new-name other-lib/old-name) will work |
| 21:42 | justin_smith | but why not just let the end user refer to the other lib if they want it? |
| 21:42 | danlentz | i want to create a top level namespace that can be "used" containing the public api from a sub-namespace where the implementation lives |
| 21:43 | justin_smith | why not have private definitions instead? |
| 21:43 | justin_smith | and use is a bad idea anyway |
| 21:43 | justin_smith | better to require :as |
| 21:43 | danlentz | well thats a good question. |
| 21:43 | danlentz | rihght i meant that |
| 21:43 | danlentz | require |
| 21:44 | justin_smith | another common convention is to end a name with a * or - if you don't think it will be widely useful outside the lib itself |
| 21:44 | justin_smith | see let* vs. let |
| 21:45 | justin_smith | you almost always want the latter |
| 21:45 | danlentz | i guess the answer is that i was looking to re-export the public symbols from more than one sub-namespace |
| 21:45 | justin_smith | well def works for that |
| 21:46 | danlentz | ie i have clj-uuid.digest and clj-uuid.bitmop and was looking to create a single top level namespace to be required called clj-uuid |
| 21:47 | andyf__ | danlentz: And perhaps you are asking if there is a way to do this wholesale rather than one symbol at a time? |
| 21:47 | bitemyapp | arrdem: sub and I are doing DotA. you in? |
| 21:47 | danlentz | thks def will do |
| 21:47 | justin_smith | danlentz: for example in caribou.field we define a data structure that is going to be used by people using model - field is an implementation detail for model (def models field/models) |
| 21:48 | danlentz | kind of brittle in that the list will require to be maintained in sync with implementation namespaces |
| 21:48 | andyf__ | danlentz: You left and rejoined in the few seconds it took for me to ask: and perhaps you are asking if there is a way to do this wholesale rather than one symbol at a time? |
| 21:48 | danlentz | yes |
| 21:49 | danlentz | sorry colloquy is crap |
| 21:49 | danlentz | andyf__: yes wholesale |
| 21:49 | justin_smith | ns-publics will get you everything exported by an ns |
| 21:49 | justin_smith | if you want to do it in a wholesale automated way |
| 21:50 | danlentz | ah ok |
| 21:50 | danlentz | cool |
| 21:50 | justin_smith | ,(ns-publics 'clojure.core) |
| 21:50 | clojurebot | {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, cond->> #'clojure.core/cond->>, keyword? #'clojure.core/keyword?, ...} |
| 21:50 | danlentz | doing it this way worked very well in CL i guuess not quite ideal with clojure |
| 21:50 | justin_smith | it isn't really the design clojure has in mind |
| 21:51 | andyf__ | justin_smith: And then you would need to do ns-intern or something in the current namespace? Or can def be made to work in the loop one would do over ns-publics results? |
| 21:52 | andyf__ | er, that would be intern, not ns-intern |
| 21:52 | danlentz | also the def technique may interfere with proper docstrings in cider? |
| 21:52 | justin_smith | andyf__: you would need a macro to call def on the values returned one at a time, or use ns-intern I guess, I am less familiar with the latter but something like that should be possible |
| 21:52 | justin_smith | danlentz: def accepts doc strings, which you can get from the original via meta |
| 21:53 | danlentz | defing a var to be a function i read somewhere is not smiled upon |
| 21:53 | justin_smith | ,(-> 'clojure.core ns-publics first second meta :doc) |
| 21:53 | clojurebot | "keyval => key val\n Returns a new sorted map with supplied mappings. If any keys are\n equal, they are handled as if by repeated uses of assoc." |
| 21:53 | danlentz | maybe ns-intern is better |
| 21:57 | justin_smith | ,(doc intern) |
| 21:57 | clojurebot | "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var." |
| 21:57 | justin_smith | that is the one that should work |
| 21:59 | justin_smith | you would still have to manually copy over the metadata |
| 21:59 | justin_smith | with-meta to attach it, meta to grab it |
| 22:01 | danlentz | (map #(apply (partial intern (ns-name *ns*)) %) (ns-publics 'clj-uuid.api)) |
| 22:01 | danlentz | how bout that? |
| 22:01 | justin_smith | you still need to grab the metadata |
| 22:02 | danlentz | ugh |
| 22:02 | justin_smith | if you want doc strings etc. |
| 22:02 | danlentz | y time to rethink tyhis approach i think |
| 22:03 | justin_smith | if you apply the meta to the symbol based on the meta of the original that will work though |
| 22:04 | justin_smith | ,(-> 'clojure.core ns-publics ('cond->) meta) |
| 22:05 | clojurebot | {:macro true, :ns #<Namespace clojure.core>, :name cond->, :arglists ([expr & clauses]), :column 1, ...} |
| 22:12 | danlentz | although this approach does have benefit of "insulating" other ns's from the somewhat "contageous" nature of the primitive-math library |
| 22:26 | Mandar | hey, it's getting better: https://github.com/agolp/sangria |
| 22:26 | Mandar | i just have to look more into namespaces |
| 22:26 | Mandar | the repl didn't like me making up a name for my second namespace |
| 22:27 | Mandar | i had to (load-file ...) manually before requiring the namespace |
| 22:29 | Mandar | thanks for your help everyone |
| 22:33 | justin_smith | Mandar: the - needs to be changed to _ in the file name |
| 22:34 | justin_smith | though you can keep the name of the ns the same |
| 22:34 | justin_smith | common beginner tripup |
| 22:34 | Mandar | justin_smith, thank you! |
| 22:34 | justin_smith | np, that messed with my head when I started using clojure too |
| 22:36 | danlentz | friday night seems to be namespace night here on the #clojure channel! |
| 22:37 | justin_smith | thank you for subscribing to namespace facts! |
| 22:37 | justin_smith | did you know a clojure namespace is a hash map from names to values? |
| 22:37 | justin_smith | now you do!@ |
| 22:37 | Mandar | :) |
| 22:39 | Mandar | i'm really impressed with the community |
| 22:39 | Mandar | (but i need sleep - good night guys!) |
| 22:40 | justin_smith | good night |
| 22:40 | danlentz | i think the key, similar to the way i learned to love cl packages, is to develop a personal namespace practices that work and then stick to that template with religeous ferver |
| 22:41 | danlentz | justin_smith: thanks again for the tips |
| 22:41 | justin_smith | np |
| 22:41 | technomancy | Ain't no party like a namespace party because a namespace party requires no class. |
| 22:42 | danlentz | im finally invited to a party! |
| 22:42 | technomancy | yeah, we really needed a cleric. |
| 22:44 | danlentz | elf cleric rolls 1 and chokes on ns symbol re-exportation plans |
| 22:45 | justin_smith | bitemyapp is a high priest of Haskell |
| 22:47 | danlentz | scroll "bar" erupts in a tower of flames |
| 22:57 | bitemyapp | justin_smith: no no, just a deacon. I'm working my way up. |
| 22:57 | bitemyapp | good timing though, was about to dig into some hask. |
| 22:58 | technomancy | "hask"? |
| 22:58 | technomancy | do people actually say that? |
| 22:58 | bitemyapp | technomancy: that's the name of the category. |
| 22:59 | bitemyapp | technomancy: http://www.haskell.org/haskellwiki/Hask |
| 22:59 | justin_smith | I'm gonna code me up some cloj yo |
| 23:02 | bitemyapp | I was going to dig into some category theory. Come on guys :| |
| 23:03 | justin_smith | I still have category theory on my "to learn more" list |
| 23:03 | justin_smith | Generalized Abstract Nonsense 4 lyfe |
| 23:05 | bitemyapp | justin_smith: hum. I think that's a bit unfair to the field but okay. :) |
| 23:06 | justin_smith | http://en.wikipedia.org/wiki/Abstract_nonsense |
| 23:06 | bitemyapp | justin_smith: it's used self-deprecatingly and by outsiders. |
| 23:06 | justin_smith | yeah, I find it charming |
| 23:07 | justin_smith | "Note that referring to an argument as "abstract nonsense" is not supposed to be a derogatory expression, and is actually often a compliment regarding the sophistication of the argument." |
| 23:25 | technomancy | TIL |
| 23:34 | akhudek | justin_smith: that's abstract nonsense |
| 23:40 | justin_smith | indeed! |