#clojure logs

2013-12-28

00:25yedi_what does the `@` represent in `@(d/transact conn schema-tx)`
00:26justin_smith@ is a reader macro for deref
00:27justin_smith(macroexpand-1 '@thing)
00:27justin_smith,(macroexpand-1 '@thing)
00:27clojurebot(clojure.core/deref thing)
00:27amalloyjustin_smith: you don't need to macroexpand reader macros
00:27amalloy,'@thing
00:27clojurebot(clojure.core/deref thing)
00:27justin_smithamalloy: nice, thanks
00:28amalloysince of course it's the reader expanding it
00:28justin_smithd'oh, I could have figured that out, of course
00:30ArafangionOut of curiosity, what's the overheads of using clojure on android?
00:30justin_smiththe sanity drain of dealing with a weird jvm
00:31ArafangionIs it turely that weird?
00:31Arafangion*truely
00:31justin_smithin all seriousness, like any other clojure use case, depends on what you need it to do and your coding style
00:31ArafangionI want to write a tiny application, the language is probably irrelevant, in all seriousness.
00:32ArafangionSo if the overheads for a minimal clojure support library is say, 50KB, then I'd consider it very minimal.
00:32justin_smithI have yet to hear any success story about clojure on android, but ymmv and it could be I only heard the whiners
00:32ArafangionThe whiners can whine... If nothing else, clojure apparently works on javascript.
00:33justin_smithspace overhead should be identical, because android is not a separate build target
00:33ArafangionYeah, just wondering what that space overhead is.
00:33justin_smiththough you could mitigate it with gen-class and compiling in such a way as not to include sources (which is not the default)
00:33ArafangionHmm.
00:34justin_smithI mean identical to the normal overhead with a desktop jvm
00:34justin_smithclojure is not lightweight in ram usage by any means
00:34ArafangionRAM is a separate concern.
00:34justin_smithadd to that persistance / immutibility and their added space usage
00:34justin_smithOK
00:34ArafangionI mean, RAM is a concern, but it's separate.
00:34justin_smithI meant "space" above, including ram and deployed size
00:35ArafangionI'm mostly concerned with "download size".
00:35justin_smithright - in that case you may actually want to avoid gen-class and only ship sources for libs. But clojure still can't do tree shaking, so it will be a large deploy.
00:36ArafangionNo tree shaking, curious. (Seems to be a new term for "stripping"?).
00:36justin_smithkind of
00:36justin_smithsince clojure has eval in it, and no way to explicitly say you won't use it
00:36justin_smithnothing can be ruled out as runtime accessible
00:37ArafangionSo, the overhead of my application, naively, would be the size of the clojure jar itself.
00:37justin_smithnot in an automated way at least
00:37justin_smithplus libs you use
00:37justin_smithyeah
00:37ArafangionNaturally.
00:37ArafangionHmm, so between ~900K and 3.5M. Tiny by modern standards.
00:37ArafangionBut not tiny by android standards.
00:38justin_smithand my app deploys are typically significantly larger than that. But I am not shipping something comparable to an android app at all
00:38ArafangionIndeed. Still, 900K is probably tolerable.
00:38justin_smithArafangion: it almost seems to imply a shared clojure base app that could be used for other apps would be called for
00:39ArafangionThat's very difficult in practice.
00:39justin_smithonce you have clojure, the individual app could be very small
00:39justin_smithmaybe an app that just ships clojure plus the code to download and bootstrap your 10k of code
00:39ArafangionThat shared clojure app would have to be 'frozen'.
00:39Arafangion(my term)
00:39ArafangionHmm, actually that is an idea, depending on how dynamic dalvik is.
00:40ArafangionBut avoiding the need to bootstrap and do additional downloads is something I'd like.
00:40justin_smithif alembic can be made to run on dalvik, you could take that and run with it
00:40Arafangionhttp://www.alembic.io/ <-- That?
00:40justin_smithand, actually, if you could bundle your app as source, you wouldn't need to hack class path, you could just use load
00:40justin_smiththough that's pretty ghetto
00:41ArafangionYeah, I'd rather compile.
00:41justin_smithload compiles
00:41justin_smiththere is no non-compiled jvm clojure mode
00:41ArafangionI'm considering either some scheme dialect, or javascript, for my app. (With is a trivial library/database app, but it's a nice example to try ideas in)
00:41justin_smithhttps://github.com/pallet/alembic <- this
00:42ArafangionThanks
00:42justin_smithI love clojure, but honestly it will be easier to get a small bundled deploy size with a scheme or javascript
00:43ArafangionI'm seriously considering doing most things in just javascript - I should know the langauge anyway (I can hack it as it is, but I don't truely know it).
00:43ArafangionAlthough there's a number of hates I have with it.
00:44justin_smithyou could use a clojurescript dev environment and target a js that runs on android
00:44Arafangionjs easily runs on android.
00:45ArafangionBut even that would still entail some overhead... But there are tools available to strip that down.
00:46justin_smithjvm clojure has no tree shaking, but clojurescript may (via goog)
00:47ryanfis there a commonly used way to make stuff (e.g. tests) start faster using something like nailgun?
00:47justin_smithryanf: you can run tests in a repl
00:47ryanfthere's an ancient lein-nailgun plugin but I think it's incompatible with current leiningen and it doesn't look like anyone ever used it
00:47ryanfyeah, I know, I'm using cljs though and it's really rickety
00:47justin_smithreload the code being tested (and the test if needed, and (test/run-test <optional ns arg>)
00:47ryanfI haven't had much luck finding a sane workflow for running tests in a repl and loading updated code
00:48technomancyif you don't run your tests in the repl (which you should but whatever) there's always grenchman
00:48ryanfoh, plus I'm using the node cljs repl, because I'm targeting node
00:48justin_smith(do (require my.ns :reload) (test/run-tests))
00:48ryanftechnomancy: thanks for the pointer
00:48justin_smithyeah, I can't help with the cljs testing
00:48ryanfjustin_smith: the cljs repl doesn't even support require :(
00:49Arafangionryanf: If there is no test framework, I highly suggest that when you decide to roll your own, you look around for some existing test frameworks other platforms have, and reproduce the best one.
00:49Arafangionryanf: As there are some fantastic, but non-obvious solutions.
00:49ryanfoh, I'm not doing that. I'm using this https://github.com/cemerick/clojurescript.test
00:49ryanfI got it working pretty well if I don't mind running "lein cljsbuild test" every time, but I unfortunately do mind that
00:50ryanfI just spent a while trying to get interactive test running working with https://github.com/bodil/cljs-noderepl, but haven't found a sane way to reload test code in that repl yet
00:50ryanfbut one might exist that I just haven't figured out yet
00:50justin_smithis there really no require in the cljs repl?
00:51ryanfas far as I can tell, there isn't
00:52ryanfalso looking at that node repl the wrong way makes it raise an unrecoverable exception, which requires restarting the whole thing, so that's fun :)
01:02bitemyapparrdem: another soul claimed!
01:02bitemyapparrdem: up fer doters?
01:06nmwswhats the easiest way to wrap a java class into clojure? for e.g. a Java class has 10 methods, and I want to create 10 clojure functions that correspond to those methods
01:25TEttingernmws: are you translating in some way? like ArrayLists <-> Vectors?
01:25TEttingerotherwise, you can just use the java class
01:26TEttinger,(.nextDouble (java.util.Random.))
01:26clojurebot0.290021386697762
01:34sritchiemagnars: around?
01:34sritchiehad a Q about optimus
01:38TEttingersritchie, the expensive keyboards?
01:38sritchiehaha, no, his front end optimization lib
01:41magnarssritchie: hi mate! I'm with my daughter right now. If you open an issue on GitHub, I'll get back to you as soon as I can.
01:41sritchieokay, for sure
01:45yedi_so im trying to use the console with datomic free: bin/console -p 8080 rhymer datomic:mem://rhymer
01:46yedi_i get this error: Removing storage with unsupported protocol: rhymer = datomic:mem://rhymer
01:46yedi_this is my application code so far: https://github.com/yedi/rhyme-finder/blob/master/src/clj/rhyme_finder/app/db.clj
01:46yedi_am i missing something?
01:58TEttingerok, I can't remember how to reload a ns in lein repl
01:59TEttingerand since I can't remember the words, I don't know what to search for...
02:09seancorf`do you mean (require 'some.namespace :reload) ?
02:10seancorf`or something more specific?
02:28magnarsyedi_: your code looks right. My guess is that console doesn't work with in-memory datomic from another process?
02:28TEttingerseancorfield, yeah that's it
02:28sritchiemagnars: https://github.com/magnars/optimus/issues/8
02:28sritchieboom
02:28magnarssritchie: I'll take a look! :)
02:28yedi_magnars: yea, that's what i realized
02:28yedi_ty tho
02:28sritchiemaybe just a misunderstanding of mine, but css urls don't seem to be getting rewritten with the hash-based prefix
02:28sritchiemagnars: or any base url
02:28sritchiemagnars: thanks!
02:43TEttingerhm, how do I tell whether a file by a given name exists or not?
02:44arrdemif you have a URI for the file then I think you can stat it with the File api...
02:44arrdemthat's probably the best way.
02:44TEttingerit's local, I'll take a look
02:46TEttingeryep, .exists
02:51yediwhats the complement to `read-string`? (tryna convert clojure data/edn to a string)
02:51magnarsstr
02:52magnarssritchie: I answered your issue with a question
02:52yediwow
02:52yediderp
02:52sritchiemagnars: maybe I have them in the wrong order
02:53magnarssritchie: order shouldn't matter - at least I've been trying hard to avoid that pitfall.
02:54sritchieresponded
02:54sritchiewith the optimizations - it's working great for the actual css file,
02:54sritchiemagnars: I added some printlns to replace-css-urls,
02:54sritchieand (replacement-fn file url) returned the url, unchanged
02:55sritchiemagnars: the tests don't seem to show a cache-busting rewrite? Just rewriting of relative URLs
02:55magnarssritchie: I think you must be looking at the load-css-asset code, because the cache-busting is in add-cache-busted-expires-headers
02:56magnarssritchie: https://github.com/magnars/optimus/blob/master/test/optimus/optimizations/add_cache_busted_expires_headers_test.clj#L50-L72
02:59sritchielet's see...
03:00sritchiemagnars: okay, found the bug
03:00magnarsexcellent
03:00sritchiemagnars: it seems that if I have a resource included twice -
03:00sritchiethe first time, referenced by the css, then again as the image by itself
03:00sritchie(concat (css-bundle) (image-assets))
03:01sritchieif there's a duplicate, the css rewriting stops working
03:01magnarsDoh. Good detective work. If you update the issue, I'll take reproduce and fix that this evening.
03:02sritchieokay, great
03:02sritchiethanks, awesome
03:02magnarsIn the meantime, removing the images referenced in CSS from (image-assets) should work around the bug.
03:02sritchieyeah, I'll move them over to the CSS folder for now
03:02sritchiesince I just slurp up all images
03:02sritchieloving the lib
03:02magnarsGlad to hear that :-)
03:05TEttingeryedi, pr-str is the real equivalent, since str doesn't always produce re-readable output (you can make str print anything by changing a type's .toString method)
03:05TEttingerpr-str is more equivalent, but still not perfect
03:05TEttingerI did use it to make save files, and clojure worked on the first try
03:05TEttinger(just now)
03:13sritchiemagnars: strange… even if I move those images out, if I include that image bundle as well, the rewrite fails
03:13TEttingeryedi, if you want to stringify arrays, it's more tricky, but I got it working with these lines https://github.com/tommyettinger/dungeon-kingpin/blob/master/src/dk/DKGame.clj#L21-L23 for char, bool, and double arrays
03:13sritchieno matter the location, including the following line kills the rewrite: (assets/load-assets "public" [#"/img/.+\.(png|jpg|gif|ico)$"])
03:14sritchieincluding this line, though, has no effect: (assets/load-assets "public" [#"/cljs/.+\.js$"])
03:14TEttingertry .+?
03:15TEttingerhm
03:15TEttinger,(clojure.string/replace "/img/hooray.gif" #"/img/.+\.(png|jpg|gif|ico)$" "yay")
03:15clojurebot"yay"
03:15TEttingerso that regexp will match
03:16sritchieah, false alarm
03:16sritchieI think I forgot a reload on the latest iter
03:16TEttingerphew
03:17yediTEttinger: ahh thanks, yea (str) was just printing out "LazySeq blah blah blah" but pr-str did the trick
03:18TEttingerthat print-dup thing I linked at my github -- it needs a binding to work, but you don't need to set print-dup usually for clojure data
03:18TEttingeredn should be pr-str and read-string capable
03:19yediTEttinger: hows that game goin a long btw
03:20TEttingergreat, I am very pleased that savefiles work on the first try
03:20TEttingerusing that method I mentioned, pr-str and slurp
03:29yediso im using emacs + nrepl. my handler.clj keeps failing to load (C-c C-l) because of this error: java.lang.Exception: namespace 'rhyme-finder.core' not found
03:29yediwhen i try to load rhymefinder's core.clj, it says its own ns can't be found
03:30yedii then (in-ns 'rhyme-finder.core) i try reloading, and it loads fine
03:30yedithen reloadin handler.clj also works
03:30yedidoes anyone know why handler.clj would fail to load successfully at first?
03:31yedii also get this error when starting the repl: #<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(rhyme_finder/core.clj:23:5)>
03:31yedi(but the repl still starts)
03:31TEttingeroh, it could be the - in the ns
03:31TEttingerthat causes problems sometimes
03:32TEttingersee how it says compiling:(rhyme_finder/core.clj:23:5)
03:32TEttingerwith an _
03:33yedii thought that was how it was supposed to work? the - in the namespace gets converted to _ when lookin up the file
03:33TEttingerbut if you have rhyme_finder and rhyme-finder as ns paths...
03:34TEttingerit may be expecting to be found as rhyme_finder even though your ns calls it rhyme-finder
03:34TEttingerI think it's kinda not a recommended practice?
03:34TEttingerbut I could be wrong
03:35yediyea, the folder name is called rhyme_finder though, so it should be able to find that path
03:35TEttingerright, nvm http://stackoverflow.com/a/8923092
03:46yedihere are the relevant files: https://gist.github.com/yedi/8157428
03:47logic_progwhere can I read about what characeters are valid function name ?
03:47logic_progI want to do apl style programming, so I can do shit like ($! /% (!! 20))
03:47logic_progand it'll get me the first 20 prime numbers
03:47yedithe compiler exception before the repl starts seems to complain about this line: https://gist.github.com/yedi/8157428#file-rhyme_finder-slash-core-clj-L23
03:55TEttingerlogic_prog, http://www.hypirion.com/musings/swearjure ?
03:56TEttingerlogic_prog, so in that, !! is iota in APL?
03:56logic_progTEttinger: the above is not valid apl code
03:56logic_progI just made it up
03:56TEttingerok
03:56logic_prognot like anyone can tell :-)
03:56logic_progsweajure looks ifasicnating
03:56TEttingerit uses no numbers!
03:56logic_progespecially given they made this professional pdf to present it
03:56TEttingerhyPiRion is here
03:56TEttingerhe's a pro
03:57TEttingerbut yeah, the APL chars are valid names
03:57logic_proghyPiRion: we meet again
03:58logic_progi'm thinking of using unicode characters
03:58logic_prog(apply concat ...) is too long
03:58logic_progI want this to look like (A B ...)
03:58logic_progwhere A, B are unicode cahracters
03:58clojurebotPardon?
03:58yediughhh... TEttinger i figured it out: https://gist.github.com/yedi/8157428/revisions
03:59yedifor some reason that fixes it
03:59TEttingerheh
03:59TEttingerhttp://www.unicode.org/charts/PDF/U2300.pdf
04:04logic_progà is now apply
04:05TEttinger["?" "⌈" "⌊" "⍴" "∼" "∣" "⍳" "⋆" "−" "+" "×" "÷" "," "⌹" "○" "⍟" "⌽" "⊖" "⍋" "⍒" "⍎" "⍕" "⍉" "!" "+" "−" "×" "÷" "⋆" "○" "?" "∈" "⌈" "⌊" "⍴" "↑" "↓" "⊥" "⊤" "∣" "," "\" "/" "⍳" "⌹" "⌽" "⊖" "⍟" "⍕" "⍉" "!" "<" "≤" "=" "≥" ">" "≠" "∨" "∧" "⍱" "⍲"]
04:06TEttingerthose are the chars used in APL
04:06TEttingerIBM APL anyway
04:06ArafangionI seem to have missed the era of special-purpose keyboards.
04:08logic_progTEttinger: someday, people will look back, and say, it was on Dec 28, 2013 that clojure went back to 1970s technology
04:08TEttinger["?" "⌈" "⌊" "⍴" "∼" "∣" "⍳" "⋆" "−" "+" "×" "÷" "," "⌹" "○" "⍟" "⌽" "⊖" "⍋" "⍒" "⍎" "⍕" "⍉" "!" "+" "−" "×" "÷" "⋆" "○" "?" "∈" "⌈" "⌊" "⍴" "↑" "↓" "⊥" "⊤" "∣" "," "\" "/" "⍳" "⌹" "⌽" "⊖" "⍟" "⍕" "⍉" "!" "<" "≤" "=" "≥" ">" "≠" "∨" "∧" "⍱" "⍲" "/" "⌿" "\" "⍀" "." "∘"] ; the real list
04:09TEttingerbut APL is very oriented towards arrays, there's no seq abstraction
04:10TEttingerI kinda think the best part of APL is not that everything is so short, but that everything can be expressed ever more cleverly
04:11TEttingerAPL has tons of stuff (operators) that changes the behavior of other functions or operators
04:12TEttingerJ calls them adverbs
04:13logic_progyeah
04:13logic_progand also the notion that all functions are either 1 arg of 2 args
04:13logic_progwhich removes the need for ()'s
04:13logic_progmore important question:
04:13logic_progon http://symbolcodes.tlt.psu.edu/bylanguage/mathchart.html#fractions ... what is a good representation of "apply" and "reduce" and "map"
04:15TEttingerit has to be a fraction?
04:16logic_progno no
04:16logic_progany symbol
04:17logic_progi was just so desperate I was looking throuhg all of them, even fractions
04:17logic_progright now, (apply concat (map :blah lst))
04:17logic_progreduces to ($a $c ($m :blah lst))
04:17TEttingerapply is one to many, map is many to many, reduce is many to one
04:17logic_prog??
04:17lazybotlogic_prog: Uh, no. Why would you even ask?
04:17TEttingerfind some symbols for those
04:19TEttinger≾ apply
04:22TEttinger≻ reduce ≈ map ≊ mapv
04:23progothose abbreviations make it easy to go over 80 characters per line :S
04:24TEttingeryeah, the unicode thing
04:24TEttingerbut clojure has no such restriction
04:26ArafangionTEttinger: Why is unicode so desirable?
04:27TEttingerit isn't, just wondering how to do APL stuff for clojure
04:27TEttingerof course the words are better
04:27ArafangionTEttinger: (Your IDE could easily convert words to symbols at the UI level, similar to how emacs can do http://www.emacswiki.org/emacs/PrettyLambda )
04:30ddimalogic_prog: do you want to make sure nobody else can understand the code? ;)
04:32logic_progddima: I work alone
04:34logic_progthose who say perl is unreadable has not seem bad clojure :-)
04:35ddimawould be nice if there was a site "badclojure" or something with examples ;)
04:37ArafangionBad code can be written in any language. :)
04:38ryanfhow do people feel about speclj?
04:43noneshow big overhead give agents?
04:43nonescan I make 10.000 agents?
04:44logic_progagents, afaik, are very chepa
04:47TEttingerbitemyapp: http://www.reddit.com/r/Coffee/comments/1abp48/question_i_swear_i_am_not_gonna_do_this_but_if/c8w18bw now I'm curious
04:47logic_progin emacs, what is the most dumbass way to have a certain keyword colored differetly?
04:47logic_progfor example, I want the word "foo" to be red always
05:03ddellacostaryanf: regarding how I feel about speclj, Stuart Halloway explains it well here: http://vimeo.com/77199361
05:23yedisomeone should write "the seasoned reasoned schemer"
05:24yedioh they were written by the same dude... makes more sense now
05:36TEttingerthe seasoned roasted schemer
05:38arcatanare there any other -easoned words?
05:38TEttingertreasoned
05:51dyresharkweasoned http://www.merriam-webster.com/dictionary/weason
06:59nonesis there ways to use in struct own property?
06:59noneseg.: (struct smth :arr [7 8 9] :length ???)
07:00roland_hi in datomic, could you use a rule within another rule?
07:01jcromartieseriously, screw protocols and records for use as "objects"
07:01jcromartieif your records are long lived
07:01jcromartierecompiling means recreating records before you see new behavior
07:01jcromartiebleh
07:02jcromartienones: what are you trying to achieve
07:02jcromartieAFAIK structmaps are all but dead
07:02nonesI have this struct:
07:03nones(defstruct unit :points :width :height)
07:03nonesI init unit:
07:05nones(struct unit :points (case type
07:05nones :medic [[0 1 0]
07:05nones [1 1 1]
07:05nones [0 1 0]
07:05nones [1 1 1]]
07:05nones :spy [[1]])
07:05nones :width
07:05nones :height
07:05nones )
07:05jcromartiecan width and height be a function of the points
07:05jcromartie?
07:05jcromartieor are they not necessarily related?
07:05jcromartieand why are you using a defstruct instead of just a map
07:06babilen(or record)
07:06noneswidth and height are constants
07:07jcromartieconstants?
07:07nonesthey calculated only in init
07:11jcromartieOK so anyway, what's your question? I am not sure
07:11jcromartienones: it looks like you're making a game?
07:12nonesjcromartie: yes, you right
07:12jcromartiecool! always happy to see game dev in Clojure
07:13jcromartienow, how well it works is yet to be determined :)
07:14nonesI want set width and height depending on points 2d array
07:19nonesok, I decided to go other way
07:21jcromartienones: are you sure you need to cache those values?
07:21jcromartierather than use a function?
07:21jcromartieis this a real-time game
07:22jcromartielike, high framerate? with lots of lookups of the height/width of these things?
07:22jcromartiethere are lots of ways you could optimize it: if there are just a few possible point vectors, then you could just memoize the height and width functions
07:23jcromartie(def height (memoize (fn [points] (count points))))
08:20augustldnolen: hey :) Any idea how well Om performs in IE9? Is mori reasonably fast? Is it still fast with setTimeout 16 instead of requestAnimationFrame?
08:54xsynThe pedestal docs and the pedestal tutorial look very different from each other
08:57jcromartiehow do you name your reference types?
08:58jcromartielike, an atom shouldn't be called "state"
08:58jcromartiebut that's the temptation
09:03jcromartieor naming futures that represent simple values
09:40pepijndevosWould it be possible to "rebase" a hash trie?
09:53jcromartieI wish Emacs clojure-mode had better logic for string fill, like it does for comments
09:54jcromartiecomments work flawlessly, but strings end up applying fill to the surrounding code
09:54jcromartieespecially awkward with doc strings
09:54roland_jcromartie: clojure-fill-docstring
09:55jcromartiedamn
09:55jcromartiethanks!
09:56jcromartieI guess I could rebind that to M-q
09:56roland_np :-) i remember when i was desperately looking for it
09:56jcromartieI dont see the need for standard fill mode anywhere in Clojure code
09:56roland_i had at one time stuck to using comments intead of docstrings
09:56jcromartiebut then what about comments… huh
09:57nonrecursiveroland_: thank you! that's driven me nuts
10:04pepijndevosHow does Clojures maps compare to b-trees with 32 leave nodes?
10:05peterdon`>>>/quit
10:10peterdon`xk
10:16hyPiRionpepijndevos: way faster on average
10:16hyPiRionbut it doesn't really make sense to compare maps to vector-like structures
10:17pepijndevoshyPiRion, you can turn any vector into a map by hashing the key and using as an index :)
10:18xsynugh pedestal confuses me
10:18pepijndevosBut ok, a clojure vecctor pretty much uses the same underlying structure as a map, lot lets use that.
10:19pepijndevosI know that CouchDB uses an append-only B+ tree with structural sharing for storage
10:19pepijndevosThat sounds an awefull lot like clojure vectors. So why a B tree if the clojure thing is faster?
10:20pepijndevosProbably something with disk seek time?
10:23pepijndevoshyPiRion, ?
10:25gfredericks(merge #{} #{}) ;; any guesses what this returns?
10:26hyPiRionpepijndevos: hmm, that's interesting. I would guess the B+-tree is inferior speed wise, but there may be some serialisation issues
10:26hyPiRiondisk seek time shouldn't be a concern
10:26hyPiRion,(merge #{} #{}) ;; Gogo clojurebot
10:26clojurebot#{#{}}
10:27gfredericksyaaay dynamic types amirite
10:27pepijndevoswat
10:27hyPiRiongfredericks: haha, it's using the ##(conj {:foo :b} {:bar :a}) trick
10:27lazybot⇒ {:bar :a, :foo :b}
10:27gfredericksof course what I wanted was either into or clojure.set/union
10:27gfrederickshyPiRion: yeah I know I hate that trick
10:27pepijndevoswaat
10:28hyPiRionOne of the few things stranger than when-first
10:28pepijndevoswaaat
10:28pepijndevosI though Clojure made sense...
10:29gfredericksconj has this weird inexplicable edge case
10:29gfredericks,(conj {1 2 3 4} {5 6 7 8})
10:29clojurebot{7 8, 5 6, 1 2, 3 4}
10:30gfredericksI have never heard an argument that that^ shouldn't throw an exception
10:30gfredericksbut it seems to have been at least mildly intentional
10:30hyPiRionthat's like, stranger than edge cases from IEEE-754
10:30pepijndevos$source conj
10:30gfredericksI actually haven't heard any comment on it at all from anybody on the core team even
10:30lazybotconj is http://is.gd/U6MjEm
10:30gfrederickspepijndevos: it's probably buried inside the cons method on APersistentMap
10:31pepijndevosI thought so...
10:31gfrederickspresumably it is too late to change now
10:31hyPiRiongfredericks: we can riot on the next conj
10:31pepijndevosclojure.lang.RT always
10:31gfredericksI wonder if they are opposed to changes like that for 2.0
10:32pepijndevosSo the question is what cons for a map does
10:33pepijndevoshttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24
10:33gfrederickspepijndevos: cons for any collection usually adds an "item" to that collection; for maps it only makes sense that you should be able to add a mapentry
10:33pepijndevosyes, but a map is a mapentry?
10:33gfredericksa quasi-map-entry at least
10:33gfredericksno
10:33gfredericksthat's the edge case
10:33gfrederickscons on maps also accepts a map
10:34gfredericksand merges them
10:34pepijndevos...
10:34pepijndevosOk, so what about the other 2?
10:34gfredericksthe other 2?
10:34pepijndevos#source merge
10:34pepijndevos$source merge
10:35lazybotmerge is http://is.gd/8qKYI3
10:35pepijndevosyea, merging 2 sets and when-first
10:35pepijndevosalso points back to cons
10:36gfredericksmerge is because of cons
10:36pepijndevosyea, so it's just ##(.cons #{} #{})
10:36lazybot⇒ #{#{}}
10:41hyPiRionpepijndevos: Yeah, the B+-tree in CouchDB uses removal, in which case a persistent vector is slower
10:41hyPiRionIt just does so internally
10:45pepijndevoshyPiRion, removal?
10:46pepijndevosLike, removing elements is slower from a vector?
10:47hyPiRionpepijndevos: yes, when they're in the middle of the vector
10:47pepijndevosWhy?
10:47clojurebotWhy is startup slow is busy compiling the `for` macroexpansion
10:48hyPiRionbecause a B+-tree nodes can be half the maximum size, whereas vectors must be the exact size
10:49pepijndevosoh. hmm, thinking about that...
10:50pepijndevosyes, that sounds right. But that doesn't apply to hash maps. And in dtabases and filesystems you're using a b-tree to look up keys, right?
10:51Vlad4Justicepepijndevos, hai pop.
10:51Vlad4JusticeVind jij Pim Fortuyn ook de grootste Nederlander?
10:51pepijndevosVlad4Justice, offtopic
10:52Vlad4Justicepepijndevos, mag hier.
10:52Vlad4JusticeLenient kanaal, ik zit hier al 5 jaar en ben nog nooit geband, kan je nagaan.
10:52Vlad4JusticeEn ik maak grappen over de holocaust
10:52Vlad4JusticeOp #haskell was ik er meteen uitgeknald na de eerste holocaust grap
10:52pepijndevosat least talk english so others can enjoy the jokes
10:52Vlad4JusticeIt is true
10:52Vlad4Justiceeveryone should be privy of holocaust humour
10:53Vlad4JusticeAll those jews would've surely died for nought if not everyone could enjoy the finest holocaust jokes.
10:54pepijndevoshyPiRion, or I'm misunderstanding something about how databases and filesystems work.
10:55pepijndevosI seem to remember maps use some clever bit twidling to have sparse child references packed together.
10:55hyPiRionpepijndevos: true, doesn't apply to maps. No idea what CouchDB does, but it has an element removal function.
10:56pepijndevosMaybe I should ask in #couchdb
10:57hyPiRionhmm, yeah, sounds like an idea
10:58pepijndevosWhat is the name of the thing that vector uses?
10:59hyPiRionstructural sharing? path copying?
11:01pepijndevosmap uses HAMT, and wikipedia says "A HAMT is an array mapped trie where the keys are first hashed [...]"
11:03pepijndevoshyPiRion, anyway, thanks for thinking along :)
11:04hyPiRionnp
11:18jcromartiewoah, I thought records were equal when their fields were equal?
11:19jcromartieis this more AOT bullshit or something?
11:19hyPiRionmaybe, or that the fields aren't equal
11:20jcromartiethey absolutely are
11:20jcromartieit's just when I print and read the record
11:21jcromartielook at this weirdness https://gist.github.com/anonymous/57fbb6f1637b30a2075d
11:21jcromartiee and e' are def'ed earlier as a record and (read-string (pr-str e)) respectively
11:22jcromartiethe class even appears to be the same
11:22jcromartiebut it's not
11:22jcromartiesame name? different class?
11:22jcromartieAOT
11:24jcromartieI am really frustrated with the way records and protocols have completely screwed me over in the REPL
11:26jcromartieyup
11:26jcromartieso get this
11:27jcromartiesince I have a -main, I have to AOT that namespace, which in turn AOTs the namespace that has a record type that is used to serialize events in the system
11:27jcromartieif I recompile my model which contains that defrecord, then the whole thing breaks when I do a certain sanity check for the serializability of events
11:27jcromartieyay
11:33roland_jcromartie: why is (class e) not equal (class e')
11:34jcromartieroland_: that's awfully confusing isn't it?
11:34jcromartiethey are not the same class
11:34jcromartiethey have the same name
11:35jcromartiebut I assume one is the AOT class and one is recompiled
11:35roland_same fqn yea
11:35roland_how is that possible if they are loaded with the same classloader?
11:35jcromartie,(instance? java.io.Serializable (fn []))
11:35clojurebottrue
11:35jcromartielies
11:35jcromartieLIES
11:36technomancyyeah, sothis is why I don't use records
11:37hyPiRionjcromartie: whoa, nice find
11:38jcromartietechnomancy: I'm starting to believe you
11:38jcromartie:)
11:39gfredericksclojurebot: so this is why I don't use records
11:39clojurebotYou don't have to tell me twice.
11:39jcromartieI know records were designed for where type-based-dispatch polymorphism is the only way to make it fast
11:40gfredericksrecords are what happened when deftype and APersistentMap had a baby
11:41jcromartiemy wife is hunting our 3 year old with a nerf gun… it's disturbing
11:47jcromartieI'm also beginning to like the sound of a single global database connection
11:55sritchieany enlive gurus around?
11:59zerokarmaleftcan friend wrap a set of routes with authentication?
12:00zerokarmalefti.e. (friend/authenticated some-big-defroutes)
12:00roland_more like (friend/authenticate routes config)
12:01zerokarmaleftroland_: isn't that just to enable the middleware?
12:01roland_oh yea
12:02roland_but you can enable the middleware on a selection of routes
12:03roland_and the for each handler, you have friend/authenticated ...
12:03zerokarmaleftyea, that's what I'm doing currently, I was just seeing if I could DRY out the friend/authenticated wrapping of the body of each handler
12:04roland_oh ok. I see, i just use a macro :-)
12:06hyPiRion$karma zerokarmaleft
12:06lazybotzerokarmaleft has karma 1.
12:07hyPiRionthe nickname lies
12:07dsrx$karma dsrx
12:07lazybotdsrx has karma 0.
12:08zerokarmalefthyPiRion: :(
12:52deadghostI just realized code golf is programming sudoku
12:54dnolenaugustl: I'd imagine Om works fine on anything that React works fine on
12:54dnolenaugustl: as far as persistent data structure perf, I can't imagine it being a problem on IE9 in many cases
13:01RaynesGuys. I might switch back to Emacs.
13:02RaynesJust thought you all should know.
13:02yediRaynes: what r u using
13:02RaynesI've been using Vim for quite a while.
13:02RaynesI tend to switch between editors a lot.
13:03RaynesThe motivation for switching back to Emacs is mostly because it is annoying to use Vim for everything *but* Haskell.
13:03RaynesAnd Vim is horrific for Haskell.
13:06deadghostI've been using evil and it's been great
13:08Raynesdeadghost: Yeah, I'm a fan. I used Emacs with evil mode for a long time.
13:09deadghostany reason for using vim as opposed to emacs + evil?
13:13Raynesdeadghost: At the time it was just because I was bored with staring at Emacs all day and wanted to switch things up a bit.
13:15pdkwhat's wrong with vim's haskell support
13:16Raynespdk: Horrible indentation, primarily.
13:16pdkare haskell's indentation rules that complicated
13:16pdki mean with lisp it's already more complex than say indenting c/c++
13:18RaynesLisp's indentation 'rules' are aesthetic. Haskell has significant whitespace and frequently 15 different ways to indent the same expression, some of which could make it mean different things.
13:18deadghostoh god what
13:18augustldnolen: cool, thanks
13:18deadghostI didn't know that
13:19RaynesVim just doesn't handle this sort of thing well, but someone could certainly write a better plugin. They just don't because Emacs is already good at it.
13:20Raynesdeadghost: emacs makes it easier by giving letting you toggle through possible indentations with tab.
13:21miltondsilvahi, I'm using emacs and I cant get 2 space indent working for all sexps in clojure-mode. I tried using (setq clojure-defun-style-default-indent t) but when I type (some-very-long-function-name arg1... it doesnt get indented as showned in the wiki (https://github.com/clojure-emacs/clojure-mode)under "whereas turning on the "always 2 spaces" option yields this:". Any ideias on how to solve this?
13:23miltondsilvaalso, in the scracth buffer indentation is also not "pretty printed" (2 space always) and the major mode is different lisp instead of clojure
13:24miltondsilvawith defun it works okay but other sexps it aligns with the first char of the first argument
13:25dsrxthe scratch buffer, afaik, is in lisp mode (emacs lisp) by default
13:26dsrx"defun" is an emacs lisp form, not a clojure one
13:29miltondsilvayes. I know. My problem is with the clojure indentation but I'm saying that in other lisp modes it also doesnt work as I expected.
13:30miltondsilvathat could provide usefull information for people that tried to help me ;)
13:33roland_anyone able to dangerouslySetInnerHTML with om?
13:33deadghosthmmm ehhhhhhh can I use a function literal with no function in it?
13:33deadghostfor example #(%2) instead of #(do %2)
13:34arrdem,(#(%3) 0 1 2)
13:34clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:35arrdemdeadghost: you should really be using first/second rather than trying to be cute like that..
13:35deadghostarrdem, I'm playing code golf on 4clojure
13:35deadghostand it's telling me to be cute by not using last
13:36jonasenBronsa: why do you macroexpand here? https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer.clj#L190
13:36deadghostso I'm using reduce #(do %2) instead
13:36deadghostand trying to shorten it
13:36arrdemhum... I don't think of anything.
13:36yediman, datalog / logic programming is so sexy
13:42roland_oh so #js tag isnt recursivve
13:43scottjroland_: yeah, was a bit bummed by that
13:43roland_scottj: interesting
13:43scottj(I'm guessing there's a good reason though)
13:44roland_yes, it would otherwise be impossible to embed clojure objects in a js object
13:44scottjwell, if that were less common couldn't you use metadata to escape the #js?
13:44Bronsajonasen: tools.analyzer.jvm's macroexpand-1 macroexpands Integer/MAX_VALUE in (.- Integer MAX_VALUE) for example, so that we only need to handle the host "." form and not the foo/bar form
13:45roland_scottj:how will that work?
13:45scottjroland_: no idea ;)
13:46roland_me thinking that that would require you to include deep paths in the metadata for escaping, which can easily become painful :)
13:47yedii have this datalog query that returns nothing, i'm tryna get a poem's analysis by the poem's title: https://gist.github.com/yedi/8162720
13:48yediwhen i put the query into the console, it works fine. but using it from my app code here doesn't work
13:50yedii think it has something to do with the fact the query data structure is quoted before being sent to (d/q)
13:50yedithough im not sure why that's necessary since i though vectors evaluated to themselves anyways
13:55yedinvm, figured it out
13:56devnhola
13:56devnwhere is monitor-enter and monitor-exit defined?
13:56devn,#'clojure.core/monitor-enter
13:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: clojure.core/monitor-enter in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:56Bronsathey are special forms, not var
13:57devnd'oh
13:57devnthanks Bronsa
13:58devnfunny that I don't think I've ever really used them, same with ,#'clojure.core/locking
13:58devnbut i guess the clojure.org description basically says don't use them, so not a huge surprise there
14:24nmwsI've read a lot about agents (Clojure Programming book, online etc.) but I'm still struggling to get a fully worked out example in my head
14:27Raynesarrdem: All of them! ALL of them!!!!
14:27Raynes(none of them, actually)
14:27arrdemRaynes: oh good. bullet doged.
14:27Raynesarrdem: Well, except for nrepl since I had to switch over to cider.
14:27arrdemI think I still have crap kicking around that (require 'nrepl)s
14:27arrdemyerp.
14:31jonasenBronsa: got it. Thanks
15:08technomancyhttps://twitter.com/ClojureMarkov
15:11hiredmanBronsa: I saw your datomic tweet, looks neat, have you done anything with core.logic on the analysis tree? I think with core.logic you could do queries over the tree without flattening it out as entities first (although doing that first may be a good idea anyway)
15:12dsrxhmm, won't be too long until ClojureMarkov retweets some of my thoughts about clojure :)
15:13arrdemtechnomancy: is that a bot that finds other bots using "clojure" or what...
15:14arrdemseems really good at picking out the spambots :P
15:14technomancyit's not a bot; they're hand-curated
15:14technomancyspam only
15:20Clomeis there a naming convention for constants? Like (my-method MY-CONSTANT) or (my-method my-constant)
15:20clojurebotIt's greek to me.
15:20technomancyClome: the convention for constant is (def whatever 12)
15:21technomancyyou use lower case with dashes
15:21Clomeis there a way to define keywords? like (def :my-constant 4) ?
15:21insamniacwaitwhat
15:21technomancyno, keywords always evaluate to themselves
15:22Clomedamn
15:22technomancythat's kind of the whole point of keywords
15:22insamniacdon't worry, you're not the only person scratching their head
15:22insamniaci'm a clojure nub too
15:22Bronsahiredman: not yet -- I haven't really played with core.logic much. That's something that I want to do but I need to find some time first. Might even consider rewriting some passes using core.logic if it proves to be fast enough/easier, but I need to get familiar with it first.
15:23Bronsatechnomancy: I've seen some CONSTANT in core.async impl code, made my eyes bleed.
15:23Clomei am not scratching my head, i just would like a better way to define constants, so i get dont confuse them with variables.
15:23technomancyoh dear
15:24arrdemClome: ... why would that ever be an issue?
15:24hiredmanClome: what variables?
15:24technomancythere are no variables
15:24technomancyso that should make it easy
15:24pdkyou could have a map from keywords to associated values
15:24pdk{:my-constant 4}
15:24pdkthen look up that map for the value you want for :my-constnat
15:24pdkconstant
15:24arrdempdk: if you ever write production code like that I will find you
15:25Clomepdk thats slow
15:25insamniaclulz
15:25Clomei need speed
15:25pdkwhy not just name them const-constantname then
15:25insamniacthat was going to be my suggestion too
15:25pdkor stick a - on them
15:25Clome(lwjgl/gl-create-shader lwjgl/gl-vertex-shader) vs (lwjgl/gl-create-shader :gl-vertex-shader), look how nicer the second example is, too bad it has drawbacks
15:26insamniacmole hill
15:27rovarwhat about a set of aliases?
15:27rovarthat someone would just :refer :all
15:27rovarso it would be (lwjgl/gl-create-shader gl-vertex-shader)
15:27rovarput your constants/aliases in a separate namespace
15:30Clomerovar: namespace prefix is not an issue, I would like to use clojure constructs so i get proper highlining
15:32ClomeWould people get mad if you use a custom neming convetion for constants? like MY-CONSTANT or _my-constant or should I just leave it normal my-constant. Feedback please?
15:32hiredmanpeople have given you feedback, you just don't like it
15:33arrdem(inc hiredman)
15:33lazybot⇒ 31
15:33gfrederickswhoever was saying yesterday that _ as the first arg in a protocol impl is smelly
15:33gfredericksI disagree
15:34gfredericksmainly because the deftype/defrecord fields are accessible directly
15:34hiredmangfredericks: sure, it happens a lot in my experience
15:34gfrederickshiredman: yeah mine too; I just hadn't thought of that exact point at the time it was being discussed
15:34hiredmangfredericks: or if you are using reify
15:35gfredericksgood old reify
15:41Clomehiredman: It is not that I do not like them. I like pdk`s suggestion about the prefixes "constant" or "-", just do not know if people using clojure do this type of stuff or just leave it normal. Would have liked more opinions but w/e, I will stick with normal naming convention.
15:42dsrx(def ^:const my-constant 42) ?
15:42dsrxi mean, that won't prevent it from being redefined...
15:43dsrxbut at least it's inlined, and the metadata is a good hint to not redefine it
15:44hiredmandsrx: I would recommend against using someone new to clojure using :const
15:44Bronsadsrx: once it gets inlines, even if you redefine it, you won't notice the value change
15:48gfredericksi.e., the semantics of code reloading get more complicated
15:53yedisaddest thing about cljs is how many js libs require jquery
16:00brainproxyis it possible to "dual license" a Clojure project under EPL with option of a commercial license? seems like the EPL doesn't prohibit that, but wondering if there are examples of companies/developers doing so?
16:01Clomedrsx: nice, I will probably use that, I have read on stackoverflow that it is much faster cuz it skips all indirect calls to that constant, if I understood it correctly it just replaces it at compile itme.
16:02Clomegfredericks: do you mean that if I define it with ^:const I won`t be able to redefine it at runtime?
16:02rovarbrainproxy: you are welcome to release your commercial product under whatever licence you like as long as you wrote it
16:03arrdemClome: correct. By using ^:const you are giving the compiler permission to play tricks with your constant value, because you are swearing that you won't change it ever. That's what Bronsa and gfredericks were on about.
16:04arrdemand when you start telling the compiler lies....
16:06Clomeawesome, thanks
16:08arrdemanyone got a cond-> example kicking around?
16:09Morgawrarrdem: I don't have code lying around but maybe this can be of help http://stackoverflow.com/questions/13830194/clojure-new-cond-macro
16:10gfredericksarrdem: I use cond-> all the time for any kind of conditional modification
16:10gfredericksit's less repetition than (if (foo) (bar x) x)
16:10gfredericksand less readable to beginners!
16:10[1]briani remember something on hacker news about a Clojure editor plugin/library used to transform Clojure code into idiomatic form, does anyone know what i'm talking about?
16:11arrdemgfredericks: right. I've recently fallen in love with as-> and I just tried to use cond-> with limited success, hence the question.
16:11roland_,(cond-> [] (even? 2) (conj :even) (odd? 3) (conj :odd))
16:11clojurebot[:even :odd]
16:12jkj_gfredericks: !
16:12arrdemgfredericks: I thought that the condition got ->'d with the value too, hence my confusion.
16:12jkj_i thing like that exists
16:12jkj_amaze, wow
16:12gfredericksarrdem: ah right; I want that too sometimes; I wrote such a thing and pasted it in here once
16:13gfredericksit must have been a one-liner
16:13arrdemgfredericks: feh. I'd bet so.
16:14roland_as-> is awesome as well
16:14gfredericksoh I think I called it cond->->, so that's searchable
16:15jkj_amazing. cond-> will shorten my code a lot
16:15arrdemjkj_: now check out as-> and be more amaze
16:15gfredericksquoting myself:
16:15gfredericks(defmacro cond->-> [x & pairs] (if-let [[c form & more] (seq pairs)] `(let [x# ~x] (cond->-> (if (-> x# ~c) (-> x# ~form) x#) ~@more)) x))
16:15arrdem$(do rant about lack of maintained paste library)
16:15Morgawrmmm... can someone provide an example of as->? I just found out about it and I can't quite understand how it works (seems cool)
16:16amalloygfredericks: fwiw the seq there isn't strictly needed
16:16roland_,(as-> 3 a (+ a 4))
16:16clojurebot7
16:16arrdem,(as-> 1 foo (inc foo) (+ 1 foo) (+ foo 5))
16:16clojurebot8
16:16Morgawrah!
16:16gfredericks,(as-> 42 <> [<> <> :foo <> (+ <> <>)]) ; unhelpful example
16:16clojurebot[42 42 :foo 42 84]
16:16Morgawramazing! thanks
16:16gfredericksamalloy: I think I wondered that and didn't know if there was a guarantee about it
16:16Morgawrgfredericks: most helpful of all haha
16:16arrdemMorgawr: the win of as-> is when you don't have a clear first or last parameter that you always want to thread too.
16:17arrdemgfredericks: I acutally have a -<n> macro kicking around that used <>.....
16:17jkj_amaze!
16:17gfredericksI'm always using as-> when I'm threading a thing that ends up being the second of 3 args to reduce
16:17Morgawrso it's pretty much like doing (let a (-> initial_value f1 f2 f3)) ?
16:17arrdemMorgawr: bingo.
16:17gfredericksarrdem: yeah I can't use anything besides <> after seeing the swiss arrows lib
16:18Morgawrman, this will prettify my code a lot, I always do some stupid stuff like (#(f1 p1 % p2)) when my parameter is the second one in a threading macro
16:18jkj_i use (-> (#(... % ...)) fubar things... or nested (->> (-> crapness
16:18Morgawr^
16:18arrdemgfredericks: I've had swiss arrows in my profile forever but I've never found them compellingly useful.
16:18jkj_i see waking up today wasn't for nothing
16:18gfredericksarrdem: I don't think I ever used it. but I loved <>
16:18gfredericks<_> would be interesting too
16:18arrdemlol
16:19gfredericksor ___
16:20decaf(javadoc) tries to load docs in a swing frame. google doesn't help
16:20gfredericks,(as-> 1.5 $1.50 (* 3 $1.50))
16:20clojurebot#<CompilerException java.lang.ClassFormatError: Illegal field name "$1.50" in class sandbox$eval122, compiling:(NO_SOURCE_PATH:0:0)>
16:20decafcause I want to set browser in java, not java plugin in browser
16:20arrdem,(let [ಠ_ಠ 3] ಠ_ಠ)
16:20clojurebot3
16:20arrdemgfredericks: ^
16:22gfredericksunicode is like cheating
16:23arrdemI use the tex input mode in all my markdown files, and I have an emacs macro that shortens fn to the \lambda symbol
16:23decafterminus has no 0CA0 and I don't care
16:23arrdemit's really confusing every time I start writing clojure because somewhere I'll try to write (\lambda [a b ]... ) and then catch myself
16:25gws[1]brian: could you be referring to https://github.com/jonase/kibit
16:25[1]brianyep found it. thanks
16:31pepijndevosIs there a way to serialize Clojure data maintaining structural sharing?
16:32pepijndevoslike (deserialize (serialize [universe (assoc universe :foo :bar)])) and not end up with 2 universes.
16:34arrdemhum... is there a unicode lparen/rparen?
16:35pepijndevosIs the ascii one not good enough?
16:36gwsarrdem: http://stackoverflow.com/questions/13535172/list-of-all-unicodes-open-close-brackets
16:36gwsheh MEDIUM LEFT PARENTHESIS ORNAMENT (U+2768, Ps): ❨
16:36arrdem(ing gws)
16:36arrdem(inc gws)
16:36lazybot⇒ 5
16:37arrdem❨^.^❩
16:37arrdem,(let [❨^.^❩ 4 ಠ_ಠ 3] (* ❨^.^❩ ಠ_ಠ))
16:37clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
16:37arrdemfack
16:38arrdemthat was almost really goo
16:38arrdemd
16:39gfredericksfind a unicode carrot
16:39pepijndevosWhat's the cool thing to write TCP servers in these days?
16:39gfrederickscarot
16:39gfrederickstarot
16:40gwscaret
16:40gfrederickspepijndevos: netcat
16:40arrdemcljcat!
16:40gwspepijndevos: node.js
16:40pepijndevos(use 'netcat)
16:40gwslol
16:41pepijndevosI suppose Aleph would be a decent choise, but I'm suprised noone did a Netty + core.async thing the day it was released.
16:41gfredericksnetcat is a nerdy superhero
16:41arrdemjust remember to set $LEIN_IRONIC_JURE kids
16:41gfredericksarrdem: of course I export it in my .bashrc
16:41technomancypepijndevos: raw Java ServerSockets are fine too for most things
16:42technomancyyou don't have to turn your program flow inside-out just because you're choosing raw TCP over HTTP, that is
16:43pepijndevos?
16:43pepijndevosinside out?
16:43technomancypepijndevos: async vs threads I mean
16:43pepijndevosOh I see
16:45technomancyI understand why it's necessary sometimes, but the assumption of "I want tcp sockets; better use aleph" leads to newbies getting thrown into the middle of stuff that's a lot more complicated than it needs to be
16:45technomancyjust throwing that out there
16:48pepijndevostechnomancy, yea, for most thinks a simple thead and a socket is more than enough
16:49technomancyyou and I know that, but with all the buzz and conf talks about core.async I wonder if newcomers are getting a different message
16:49pepijndevosIt's definitely fun to play with core.async
16:50technomancyboring sockets don't make the HN front page
16:50arrdemlol
16:50pepijndevosI should try
16:51pepijndevos"developer writes server using theads and sockets"
16:51technomancy"look how it's only 80% as many lines of code!"
16:52pepijndevosbut then I'd actuallly have to do something. For hello world, the boilerplate dominates the async/sync difference
17:05CaptainLexI have a few hashes of the form {:foo a :bar b} {:foo a :bar c} and I would like to combine them into a single hash of the form {:a [b,c]}. This doesn't quite seem like a job for map.
17:06CaptainLexBut it sounds exceedingly fnal
17:06JasonFeliceI keep wanting there to be a function in clojure.core where (= '([1 2 3 4] [2 3 4] [3 4] [4]) (f [1 2 3 4]))
17:07TEttingerCaptainLex, seems like an odd result value
17:07JasonFeliceCaptainLex: merge-with
17:07JasonFeliceOh, I didn't read the whole thing. Not merge-with.
17:08CaptainLexTEttinger: Well, the specific case is a bunch of hashes with dates and time; I'd like to combine then into a hash where times are keyed to their dates
17:08CaptainLexSo really you'd have a hash at the end that looks like {:a [b,c] :d [e,f,g]} etc
17:08JasonFeliceCaptainLex: clojure.set/index does something similar, maybe that's useful.
17:09TEttingerso CaptainLex, you want the :foo and :bar stripped out right?
17:10CaptainLexTEttinger: Well, as long as I'm grouping times by date, I'm neutral as to whether :foo and :bar are still present
17:10TEttingerok, uh I just woke up, do you have any sample data and sample results?
17:11CaptainLexHahah yeah, lemme mock something up
17:13CaptainLex{:date 2013/12/28 :time 19:30}
17:13CaptainLex{:date 2013/12/28 :time 21:30}
17:13CaptainLex{:date 2014/1/1 :time 19:30}
17:13CaptainLex{:date 2014/1/1 :time 21:30}
17:13CaptainLex
17:13CaptainLex=>
17:13CaptainLex
17:13CaptainLex[{:date 2013/12/28 :time [19:30, 21:30]}, {:date 2014/1/1 :time [19:30, 21:30}] ;;Something like this
17:14arrdem~paste
17:14clojurebotpaste is not gist.github.com
17:14CaptainLexWoops
17:14arrdemeez cool, just something to be aware of.
17:14arrdem~refheap
17:14clojurebothttps://www.refheap.com/
17:14arrdemis also acceptable
17:15CaptainLexhttps://www.refheap.com/22267 :{
17:15CaptainLex:P*
17:15arrdemCaptainLex: danke :D
17:15sritchiemagnars: hey, thanks for the help
17:15sritchieupgrading now
17:16CaptainLexI can see broadly how this works, but actually implementing it in the language is trickier
17:16magnarssritchie: my pleasure! I want optimus to be a really solid piece of software. So thanks for reporting issues :)
17:16arrdemCaptainLex: I suspect that you're gonna want some combination of reduce, contains and conj.
17:17sritchiemagnars: I think your new issue covers it, but just to make sure,
17:17sritchieI actually wasn't seeing a base URL for contextless paths
17:18sritchiemagnars: with a base-url of "https://cdn.paddleguru.com&quot;, for example, and an asset of "/img/logo.png", the images inside the CSS wouldn't get the base, though the CSS file itself would
17:19magnarssritchie: no, adding a :base-url to an asset won't fix its contents. Or the contents of any referencing assets either. If you want the :base-url in CSS files, you need to replace its :contents "manually" in the transformation function. However, it isn't necessary to do that if your :base-url doesn't have a context-path. In your case, even tho the CSS doesn't
17:19magnarsexplicitly link to http://cdn.paddleguru.com - the images will still be served from there when referenced with absolute URLs.
17:21sritchieabsolute URLs meaning, "/img/logo.ong"?
17:21sritchiepng*
17:21sritchiethat's the part I'm not clear on, on why it's not necessary without the context pathj
17:21magnarsyes - when the CSS is served from paddleguru, any absolute URLs in the CSS will also be served from there
17:21sritchieoh, interesting
17:22sritchieso the context bug doesn't affect me, then. accidental sleuthing
17:22sritchiemagnars: boom, awesome
17:22magnarsexcellent! :)
17:27TEttingerCaptainLex:
17:27TEttinger,(apply merge-with #(flatten (conj [%1] %2)) (mapv (fn [m] {(:date m) (:time m)}) [{:date "2013/12/28" :time "19:30"} {:date "2013/12/28" :time "19:31"} {:date "2013/12/28" :time "21:30"} {:date "2014/1/1" :time "19:30"} {:date "2014/1/1" :time "21:30"}]))
17:27clojurebot{"2014/1/1" ("19:30" "21:30"), "2013/12/28" ("19:30" "19:31" "21:30")}
17:27TEttingernot the right format, quite yet
17:28CaptainLexTEttinger: Thank you! :D I'll poke around with it :)
17:28TEttingerno prob
17:28TEttingergood wake-up task
17:30TEttinger,(mapv (fn [[k v]] {:date k :time (vec v)}) (apply merge-with #(flatten (conj [%1] %2)) (mapv (fn [m] {(:date m) (:time m)}) [{:date "2013/12/28" :time "19:30"} {:date "2013/12/28" :time "19:31"} {:date "2013/12/28" :time "21:30"} {:date "2014/1/1" :time "19:30"} {:date "2014/1/1" :time "21:30"}])))
17:30clojurebot[{:date "2014/1/1", :time ["19:30" "21:30"]} {:date "2013/12/28", :time ["19:30" "19:31" "21:30"]}]
17:30sritchiemagnars: actually, seeing java.lang.Exception: Two assets have the same path "/cljs/reset-codes.js", but are not equal.
17:31magnarsIt's a good thing it put that in there then.
17:31magnarsI wonder how they differ. That might be relevant information. :P
17:31sritchiemagnars: well, there's only one file, actually
17:31sritchiewith that names
17:31sritchiename*
17:32magnarsSomehow there's ended up with two assets with that path loaded. You could do a filter in the list of assets and see?
17:33sritchieokay, trying that out
17:34sritchieprobably one's inside a bundle
17:34sritchieand the other's not
17:35magnarsThat sounds very likely.
17:35magnarsBundled files are still available on the original paths, so there's no need to include them twice.
17:35magnarsI could add a specific error message for that case.
17:35sritchielet's see
17:38sritchiemagnars: so, here's what it is
17:38sritchiemagnars: I've got a bundle with some files, which I had thought was just a particular grouping of those files -
17:38sritchieand then another call to (assets/load-assets "public" [#"/cljs/.+\.js$"])
17:39sritchiemagnars: but I don't quite understand why the contents would be different.
17:40magnarsThe contents are the same - it's the :bundle property that's triggering the error.
17:40magnarsThere's also the case that you might want to have one file in two different bundles.
17:40sritchieyup
17:40magnarsSo while the exception has brought to light an issue, I'm not entirely sure what to think of it yet.
17:41sritchiecould you ignore the bundle property in the equality check?
17:41logic_progis there a way to tell "lein cljsbuild auto" that "whenever you rebuild, kill existing chrome, fire up a new chrome, and have it load up url __BLAH__ " ?
17:41magnarssritchie: I can do that for now.
17:45sritchiemagnars: https://github.com/magnars/optimus/pull/10
17:45sritchiemagnars: this is where type classes for custom equality comes in handy
17:46magnarsIndeed. But I don't think this is the solution going forward - since it will now collapse down to just one asset - losing any different :bundle definitions.
17:47magnarsI can merge your PR to fix your issue now, but it will have to be handled differently soon.
17:48sritchieyeah, that makes sense. I wonder if I should change it to pick the asset with a bundle definition, if either has one
17:48magnarssritchie: How about instead, I make sure assets are distinct on the juxt of :path and :bundle ?
17:48sritchiethat works for me
17:48magnarsok, I'll get on that
17:49sritchiemine's buggy anyway, since if the non-bundled version comes first, you lose the bundle information
17:50magnarsyeah, could be solved by doing a merge in the reduction tho
17:57magnarssritchie: 0.13.2 released
17:57sritchietrying now
18:02sritchieokay, works great
18:02sritchiethank you sir
18:02magnarsGood to hear :-)
18:04arrdem(inc magnars) ;; good mantainer points!
18:04lazybot⇒ 1
18:04magnarsMy first point! Thank you arrdem :)
18:08sritchiemagnars: it looks like Chrome actually does require a cache-control header
18:08sritchieeven though it's the same as the expires, technically
18:08magnarssritchie: That is weird, since I removed the Cache-Control header on information from Google :)
18:09magnarssritchie: I'll plop it back in again - not exactly the end of the world sending two headers that may or may not be overlapping / superflous.
18:10sritchieI think cache-control overrides expires, but apparently chrome needs the former
18:10sritchiegotta inc as well
18:10sritchie(inc magnars)
18:10lazybot⇒ 2
18:10sritchiecrazy inc rate
18:11arrdemif we project his karam out with linear approximation, in less than 24hrs he'll have the most in-channel karma!
18:11magnars:)
18:13magnarssritchie: Cache-Control is back in again in 0.13.3
18:13sritchiehaha, amazing
18:13sritchietrying now
18:14sritchieoptimus has been live at paddleguru.com for a while now, btw -
18:14sritchieif you want to see where we're using this stuff
18:14magnarsoh, very cool :)
18:17sritchieokay, looks great. chrome is still having trouble caching this one js resource when I revisit a page, but the headers all look good
18:23magnarssritchie: Now that Optimus adds Last-Modified headers, it should work well with ring.middleware.not-modified. I haven't gotten around to testing it yet tho. Will do so shortly. Anyhow, that might improve the situation you mention, since Chrome at least should only get a 304 Not Modified.
18:35magnarssritchie: Tested now, and that worked very well. Added example of how to respond with 304 Not Modified to the README. It's pretty much a no-brainer. :-) https://github.com/magnars/optimus
18:40sritchiemagnars: works great
18:40sritchiemagnars: ugh, chrome just won't look in its cache for this one bundle
18:40sritchieweird
18:41magnarsthe ways of the optimizer are mysterious to mere mortals
18:45mockerInstead of practicing 4clojure problems I started reworking 4clojure.el to allow me to submit authenticated answers
18:49volchok60:quit
18:49volchok60quit:
18:50hyPiRion/quit it is
18:50mrcheeksheh
18:50magnarsmocker: oh, if I could do 4clojure problems in my Emacs and submit authenticated answers, that would increase my joy of 4clojure by quite a bit. Should I be watching this repo, or somewhere else? https://github.com/joshuarh/4clojure.el
18:51mockerThat's the one, I'll submit a pull request when I finish it up.
18:51magnarsnice!
18:51mockerBut, submitted my first authenticated solution earlier!
18:51mocker:)
18:51magnars:)
18:52mockerJust couldn't imagine having to copy and paste all the time, that would annoy to no end.
18:53magnarsYeah, unbearable.
18:53akurilinbitemyapp: man, you have a serious mix going on there on Spotify \m/
19:01hiredman /win 15
19:15TEttingerok, if a java lib I use was compiled on JDK 7, but I use leiningen's :javac-options ["-target" "1.6" "-source" "1.6"], it won't recompile the library and I'll still be targeting 1.7, right?
19:15hyPiRionno
19:16hyPiRionif the library itself was compiled with 1.7, it won't be recompiled down to 1.6
19:16TEttingerbecause I'm getting an incompatible version error when someone runs my program on a mac with 1.6
19:16hiredmansure
19:17hiredmanbecause the library you use is 1.7 only
19:17TEttingerso should I rebuild the lib? I think JDK 7 uninstalled my JDK 6
19:17hiredmanTEttinger: *shrug*
19:18hyPiRionTEttinger: You don't need to use JDK 6 for it, as long as you pass in those parameters
19:18hyPiRionAlthough it is a good idea to check that it runs on 1.6
19:18TEttingerit doesn't
19:18hiredmanthat assumes the library doesn't use any 1.7 features
19:18TEttingerit doesn't
19:20TEttingerhow would I check what version a maven jar was compiled for?
19:42Clomeis there a function that applies a function on each element of a collection? I have tried (apply) but it seems like the function you are pasing to it needs to suport any number of arguments. I would like (apply fn coll) where it iterates over the coll and applies fn to each element, and fn is only able to accept one argument. Is there one, or do i have to implement it?
19:44magnarsClome: are you looking for map?
19:45TEttingerClome, yeah map or mapv
19:45TEttinger(doc map)
19:45clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
19:45TEttinger,(map inc [1 2 3])
19:45clojurebot(2 3 4)
19:49TEttingerClome, I'm kinda surprised whatever resource you're using to learn clojure didn't cover map, it's one of the most-used functions in clojure
19:49ClomeI will try map even though I dont need a collection back, all I need is to apply some side effects to the arguments and return nil.
19:49TEttingeroh, you mean reduce?
19:49JanxSpirittrying to use noir.response.json and getting java.lang.RuntimeException: No such var: clojure.core/noir.response
19:49ClomeI know about map
19:50logic_prog_in cljs, what is the closest thing to clojure.core.format ?
19:50TEttingerwell uh
19:50JanxSpiritI can't see to figure out the correct import
19:50logic_prog_wait, clojure.core.format is probably nil
19:50JanxSpiritnewb here obviously
19:50TEttingerthere's doseq, which is meant for side effects and returns nul
19:50TEttingernil
19:50logic_prog_in cljs, what is the closest thing to format ?
19:51TEttinger(doc doseq)
19:51clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
19:51TEttingernot very helpful that doc
19:51JanxSpiritI did (:require [noir.response])
19:52JanxSpiritand then (GET "/json" [] (json {:result "this is json"}))
19:52JanxSpiritam I requiring wrong?
19:53TEttinger,(doseq [e (repeatedly 5 #(java.util.Random.))] (print (.nextDouble e) " "))
19:53clojurebot0.2754962034583899 0.5572356845394634 0.010696014221999728 0.7035002207066564 0.7873626149862337
19:54TEttingerClome, does that help? repeatedly in there creates some mutable java objects, and it does side effects in the body
19:54ClomeTEttinger: thanks, doseq is what I was looking for
19:55TEttingerClome, I had trouble for a while with dorun, doall, and doseq... usually doseq is more-often used
19:56JanxSpiritany advice?
19:57TEttingerJanxSpirit, that's in your ns part right?
19:57TEttingerthe :requie
19:57JanxSpiritit is, yes
19:58TEttingerso, yes I think you are requiring wrong, maybe
19:59JanxSpiritI can pete it all somewhere if you're willing to take a look
19:59TEttingeryeah, gist or refheap, sure
19:59JanxSpiritI feel like Ive tried a lot of ways
19:59TEttingerI think a parenthesis may be in the wrong place
20:01JanxSpirithttps://www.refheap.com/22274
20:01ClomeTEttinger: do you maybe know how to extract the index out? Or is there another special form for this?
20:01JanxSpiritthat's the current incarnation
20:01JanxSpiritI've been thrashing ofr a bit and tried a variety of things though
20:07JanxSpiritalso sorry for my typing - broke my arm the other day and am one handed
20:09JanxSpiritTettinger anything glaring there?
20:11TEttingersorry just got back
20:11TEttingerClome, to get indices, it's probably better to use map-indexed
20:12TEttingerJanxSpirit, yes
20:12TEttingeryour ns is never closed
20:12TEttingeror it is closed at the end of the file, which is wrong
20:12JanxSpiritdoh!
20:13TEttinger[tango-luminus.util :as util]) should be [tango-luminus.util :as util]))
20:13TEttingeryep!
20:13JanxSpiritthink I just introduced that
20:13JanxSpiritok now I'm getting one I saw earlier
20:13JanxSpiritempty already refers to: #'noir.response/empty in namespace: tango-luminus.routes.home
20:13TEttingerah!
20:13ddimaTEttinger: javap -version
20:13TEttingeryou should generally require as
20:13TEttingerthanks ddima
20:14JanxSpiritthought Lighttable would ding me for the parens...
20:14ddimamy connection died and i didnt notice, so thus the delay ;)
20:14JanxSpiritok I'll try that
20:15JanxSpiritno love on require as
20:15JanxSpiritstill same error about empty
20:17TEttingerJanxSpirit, I mean
20:17TEttinger (:require [noir.response :as n-r]) and refer to empty as n-r/empty
20:18TEttingeror whatever name you choose
20:20TEttingerother names from noir.response would need to be similarly changed
20:21JanxSpirittettinger I don't use empty is the thing
20:21TEttingeryes
20:21clojurebotyes isn't is
20:21TEttingerbut there is a var empty in both files, and you are including both if you require without :as
20:23JanxSpirithere's my current - still the same error: https://www.refheap.com/22276
20:24TEttingeruhhhh I have no idea. try lein clean
20:24TEttingerI have to go, dinner with family
20:25JanxSpiritthanks for the help
20:27yediwhy does take! require a function to pass the value to?
20:28JanxSpirittettinger lein clean did it - thanks again!
20:30TEttingeryay
20:37ClomeGuys, what are you using for logging, timbre?
20:43yedidat feel when you can't figure out why the cljs compiler is hanging...
21:09rovaris there a way to execute something in one namespace from another?
21:11rovari know I could change a namespace.. so I guess I could just call in-ns .. not sure how to pop back out of it..
21:16Cr8rovar: what is the desired effect of executing the code in a different ns
21:18rovarCr8: I am making a collaborative MUD. I am experimenting with each room having its own verbs (fns) in their own contexts
21:19Cr8ah
21:19Cr8(binding [*ns* (create-ns 'the-namespace)] (eval '(code-to-eval-in-ns)))
21:19Cr8create-ns will return the existing ns if one exists
21:19rovarah so that's what the binding call does..
21:20Cr8binding rebinds dynamic vars and then pops the binding at the end
21:20rovarvery cool..
21:21rovarI am considering making all functions pure by requirement, then just taking their results and re-binding them back into the global state..
21:21rovarso just executing everything in one of several sandboxes.
21:22Cr8I mean, unless folks are actually typing clojure code
21:22Cr8are they?
21:22rovarthey could be
21:22Cr8mm
21:22Cr8okay
21:23rovareveryone that wishes to can contribute verbs to some scope
21:23rovaronly admins will be allowed to contribute to the global scope..
21:23rovaror write functions at the room scope which shadow those at the global scope..
21:23rovarbasically it's more of a multi-user lisp repl than a MUD..
21:24rovarthe effect I hope is something in-between...
21:25logic_progcljx is fucking awesome
21:25logic_prognot only does it make code sharing between clj + cljs easier
21:25logic_progit even makes using macros in cljs easier
21:25logic_progcljx is fucking awesome
21:25rovarI hope to learn cljx soon
21:26v4nIs it considered appropiate to use def as long as it is defined outside local scopes (e.g. namespaces)?
21:27v4nOr should def be overall avoided outside any REPL experimenting?
21:27rovardef at the namespace level seems fine..
21:27rovarsometimes its necessary.
21:27gfredericksv4n: you mean as opposed to defn?
21:28gfredericksit's a weird question because pretty much everything is a def
21:28v4nI mean in the first pages of programming with clojure, it is mentioned to avoid using def.
21:29v4nSo I am curious is if the warning is REPL and scope specific or for the overall language.
21:30rovarv4n: I think you should use let wherever possible, but if you want something to be available between function calls, its your only choice
21:31dnolenk Om is now a lot more draconian about forcing users to consider concurrency issues - a big improvement in my opinion
21:31v4nrovar: Makes sense
21:43gfredericksv4n: oh yeah; 99% of defs are constants or point-free function definitions or dynamic vars
21:53ivanyedi: maybe your cljs compiler has put your JVM into an endless GC loop due to not enough heap space?
21:54ivanyedi: connecting visualvm to it might help
21:54yediivan: no longer an issue, though i have no idea what fixed it
21:54yedithanks though
21:56grandy_hey just wondering if someone would mind doing a quick code review of some clojure i just wrote to "join" two CSV files... it's less than 20 lines of code
21:57grandy_i'm curious for someone to point out all the obvious things that are stupid or non-idiomatic about it
21:58arrdemgrandy_: drop a paste. if it's sketchy someone will loudly object :P
21:58grandy_https://gist.github.com/anonymous/055c885f955723401590
21:59grandy_i'm sure there is a ton wrong/stupid about it so don't hold back
22:00ArafangionI don't know any clojure, but that's not a streaming implementation, isn't it?
22:00grandy_Arafangion: correct
22:00ArafangionIt reads all from one file, then all from the other file, and then joins it?
22:01grandy_Arafangion: yep
22:01ArafangionI'd object to that! ;)
22:01grandy_Arafangion: it's possible the rows in the files might be in a different order
22:02ArafangionWell it's readable for someone who doesn't have lisp coding experience.
22:02grandy_Arafangion: hah not sure if that's a good thing or not
22:02Arafangion(Other than tiny emacs configuration files)
22:02arrdemI mean... you could read all of one file, then read the other file by lines and merge on the 2nd file..
22:02grandy_arrdem: true
22:03arrdemand there's nothing blatantly bad about it...
22:03Arafangionarrdem: Not sure if that would be an advantage unless you could also stream on the output.
22:03grandy_it seems that it would be possible to just join additional files using reduce
22:03arrdemArafangion: File.writeline?
22:04Arafangionarrdem: While streaming? Doesn't he have to re-order the whole CSV first?
22:04arrdemArafangion: why? as long as he can match ID pairs from one file to the other he can totally stream the output
22:04ArafangionSo he'd have to read at least one of those files in their entirety.
22:05arrdemArafangion: I mean he's already reading both files in their entirety.
22:05arrdemat the same time...
22:06arrdemArafangion: note the (doall) in open-csv.
22:08Arafangionarrdem: Yes, he could do it there, and I guess streaming one file would represent an advantage, but it's still reading the other file in the entirety so that he can match up ID's?)
22:09bitemyapparrdem: you need more risque french electro-pop in your life.
22:09grandy_any thoughts on naming or function argument structure?
22:10bitemyappgrandy_: order function arguments by increasing variance.
22:10bitemyappgrandy_: name the functions in a verby sort of way.
22:10grandy_bitemyapp: thanks!
22:11grandy_have i missed some much more elegant way to do anything this program does?
22:13Arafangiongrandy_: Some might find using lambda's more elegant, but as it stands, your defn's do some clearly defined task.
22:14TEttingerrovar, clojail might be handy for your purposes
22:15yediany cljs core.async afficionados wanna do a code review: https://github.com/yedi/rhyme-finder/blob/master/src/cljs/rhyme_finder/rhymer.cljs#L36
22:16grandy_Arafangion: ok makes sense, thought about using lambdas in a few cases actually but wasn't convinced it would improve readability
22:17rovarTEttinger: I am using it :)
22:17CaptainLexTEttinger: I just noticed you provided a complete solution! o_o Thank you so much!
22:17grandy_thanks everyone for the advice
22:17TEttingerhaha sorry I should have said your nick
22:17Arafangiongrandy_: Personally, it violates the do-one-thing principles.
22:17TEttingerno prob, CaptainLex
22:18rovarTEttinger: the trick is figuring out how and when to execute un-sandboxed..
22:18grandy_Arafangion: what does?
22:19rovare.g. all actual IO has to occur outside of the sandbox, so I have compute the results of functions inside a sandbox and then send the results in un-sandboxed code
22:19[1]brianwhat are your tricks to a faster jvm startup time for Leiningen, guys?
22:19rovarbut I also need to update the available verbs within a namespace from outside the sandboex..
22:19[1]briani experimented with drip without much success
22:21Clomeanyone here using mirc clinet? If so how do you hide all the notifications in the chat windows, I would like to see only the messages.
22:34Arafangiongrandy_: Ideally, each function should do one clear, distinct task.
22:34Arafangiongrandy_: However, detractors point out that by putting everything into one function, one can more easily see the "shape" of how the code operates.
22:35Arafangiongrandy_: But I'm new to clojure, haven't even downloaded it. (Actually, I've downlaoded it, that's it).
22:46marcopolo`Is there a way yet to handle libraries with different dependency versions? akin to this question: https://groups.google.com/forum/#!topic/clojure/q93CQSQ6Aeo
22:49ivanmarcopolo`: if the API changed, you basically have to fix all callers to work with the new version, or fix the library to support both the old and new API
22:56rovaris there a map that is not lazy?
22:56rovarI know there is doseq, but I'd prefer map semantics
22:56rovarless typing in this case..
22:56rovarah.. dorun
23:00dnolenrovar: doall is a bit more idiomatic if you want to force a lazy seq, also reducers are not lazy.
23:00rovardnolen: I don't care about the results, so not storing the seq in mem is fine..
23:09TEttingerrovar: mapv is not lazy
23:11rovarhuh
23:12rovarI find shift-up/down very convenient to switch between panes in emacs
23:13rovarexcept for the fact that alt-up/down deletes a chunk of my code
23:15arrdemrovar: minor inconvenience that
23:15arrdembitemyapp: links or it didn't happen
23:16arrdembitemyapp: also buying my 10/22 tomorrow :D
23:16bitemyapparrdem: awesome :)
23:16bitemyapparrdem: http://www.youtube.com/watch?v=Y99UqvgCmE8
23:16bitemyappRaynes: ^^
23:17Raynesbitemyapp: Oh boy do I have something for you!
23:17Raynesbitemyapp: https://www.youtube.com/watch?v=tolm-07if3c :p
23:18Raynesbitemyapp: Anyways, yes, I very much like girlpop :p
23:19rovarRaynes: speaking of youtube. I just watched your clojureconj talk on clojail. Very helpful
23:19rovarclojail is proving to be quite useful..
23:19Raynesrovar: It probably wasn't, actually. I basically rewrote the whole darn thing after that talk. :P
23:19RaynesAround technomancy's lovely serializable-fns.
23:20rovarthe sfns seem to be a small part of it..
23:20RaynesThat's a lie. The talk is still useful.
23:20rovaran important part..
23:20RaynesJust that the API has changed a bit and stuff.
23:20rovarI'm using the sfns too
23:20arrdemRaynes: what am I watching...
23:20Raynesarrdem: SHUT UP AND LET ME GO
23:20Raynes!
23:20rovarI just pulled the code out of try-clojure as it seemed to apply to what I'm doing..
23:20arrdem(ban! Raynes)
23:21arrdemRaynes: didn't work.
23:21bitemyapphum. I am satisfied this template library will work I think.
23:21Raynesrovar: Aye. I'm happy you enjoyed the talk. And my blue hair.
23:21RaynesI hope you enjoyed my blue hair.
23:21bitemyappRaynes: not enough gallic women in this music video you sent me.
23:21RaynesIt'd be a shameful waste of dye otherwise.
23:21Raynesbitemyapp: Tradeoffs, man.
23:21arrdembitemyapp: "such doge" is on the other team..
23:22bitemyappRaynes: dat text
23:23rovarthis video is sexually suggestive
23:23bitemyapparrdem: you're in DotA2?
23:23arrdembitemyapp: da
23:23bitemyapparrdem: gut. Grinding out dem games?
23:24arrdembitemyapp: I needed more flaming golems in my life
23:24bitemyapparrdem: also found a group that generally runs 4 and 5 man teams. Might be able to peel people off that to fill out a team periodically.
23:24arrdembitemyapp: so far I'm 3/0 in tonight's pug games..
23:24bitemyappEggscellent.
23:24bitemyapparrdem: hero?
23:24rovarI played the tutorial of Dota2 after someone here suggested that I try it
23:24rovarneed to get back to that..
23:24rovartoo busy clojuring
23:25bitemyapprovar: I'm off in MonadIO Typeable1 la-la land.
23:25bitemyappdem unsafe unitypes. yissss
23:26rovarbitemyapp: haskell?
23:26bitemyapprovar: yeah. I'm seeing how many pragmas I can mix before this code blows up in my face.
23:26bitemyappHaskell is a good mad-scientist language.
23:26rovarheh
23:27bitemyappI actually already figured out how to make this unsafe coerce stuff segfault.
23:27bitemyappNow trying to figure out if I can trick the compiler into letting me escape the IO monad. Probably not.
23:27rovarit's unsafe coerce, that's not a challenge, try to make the pure stuff segfault
23:28rovarunsafeExecIO
23:28rovarerr unsafeRunIO
23:28rovarI really did not enjoy wrangling monads in haskell, which is why I quit coding in it
23:29bitemyapprovar: I don't even know what unsafeRunIO is.
23:29bitemyapprovar: is that ST or IO?
23:29rovarone monad.. super awesome.. the problem is that any integrated app, like a web app, ends up requiring me to intermix 8 different IO monads
23:29bitemyapprovar: I don't really mind the monads because I only use them as much as I want.
23:29rovarthere's really no good way to do that..
23:29rovarit should be in IO
23:29rovarit does what you hope it might, run your IO monad and give you a result.. I might be misremembering the name..
23:30bitemyapprovar: a web app is what I'm tinkering with. My only real complaint at the moment is that the wacky template library thinks it needs IO for rendering a flat string.
23:30bitemyappthat's a pretty understandable decision, given that in the typical case you'd be reading the filesystem.
23:31bitemyapprovar: I can't find it on hackage or hoogle.
23:31bitemyapprovar: I haven't experienced the pain you're talking about just yet. Mixing the template lib with Scotty hasn't been an issue yet.
23:31rovarIO.Unsafe unsafePerformIO and unsafeInterleaveIO
23:31bitemyapprovar: next up is persistence. What stack were you using? HAppS?
23:31bitemyappgerd dermert hayoo.
23:32arrdembitemyapp: I'm killing lifestealer with my fatal bonds. wat.
23:33rovarI've mucked with both Snap and Yesod extensively
23:33rovarI actually contributed to AcidState a loooong time ago when it was part of HAppStack
23:33rovarI also wrote the original MongoDB drivers for Haskell
23:33rovarthen 10Gen hired a haskell guy who went and made them monadtastic
23:34bitemyapparrdem: ...
23:34bitemyapprovar: yeah, I like Haskell a lot, I just think the monad stuff merits restraint.
23:34rovarrovar, back to work, slave.
23:34rovaroh.. i had a real question
23:34rovarwith paredit
23:35rovarhow does one insert a function call into an existing set of parens?
23:35rovarit's not optional, man.
23:35bitemyapprovar: I have a problem I was working on that turned into an absolute horror in the absence of types so I decided a rewrite merited giving Haskell a shot at making my problem nicer.
23:35bitemyapprovar: that's really cool that you worked on that stuff. Yesod seems like a sure-fire path to monad Hell though. That's why I stay closer to WAI.
23:35bitemyappI might try Happstack or Snap but I'm not really going to benefit from a "framework" for what I'm doing.
23:37bitemyappwhat's not optional?
23:37bitemyapprovar: http://stackoverflow.com/questions/14170403/using-paredit-to-wrap-existing-expression
23:37rovarhttp://clojure.jr0cket.co.uk/perfect-environment/paredit-guide
23:37rovar<3
23:37rovarmonads
23:37rovarif you can keep your application away from IO as long as possible, you win
23:39TEttingerRaynes, bitemyapp, have some weird j-pop music video https://www.youtube.com/watch?v=yzC4hFK5P3g
23:40bitemyapprovar: I have a pure subset of my code and that's where I need the type system the most anyway.
23:40bitemyappI don't really care that much about tracking effects in a web app.
23:40rovarthat guide I found is actually quite nice..
23:40rovaralt-(
23:40rovaris the bees shit
23:40rovarit has already changed my life for the better
23:40rovarin the last 1.5 minutes that I discovered it
23:41bitemyappTEttinger: dafuq
23:42TEttingeri kno rite
23:42bitemyappit probably says something that my work desktop didn't even have Java installed.
23:43bitemyappTEttinger: enjoying this, thanks!
23:43bitemyappstill don't know what the fuck is going on though.
23:43bitemyappTEttinger: I guess J-pop isn't into music videos with a narrative?
23:43TEttingerhaha
23:43TEttingerit's some kind of cultural critique on that kind of girl that likes eldritch horrors
23:43TEttingeryou know, japan stuff
23:44arrdemwhy do I click on the links in here...
23:44TEttingerarrdem, I'm telling you, it could be much worse
23:46bitemyappTEttinger: wait what
23:46bitemyappTEttinger: the artist herself said she likes grotesque things
23:46bitemyappwhy would...what...why...oh god what is going on I don't know how to internet
23:46bitemyappthis is more confusing than that weird MonadIO thing earlier.
23:46TEttingerhahaha
23:47bitemyapprovar: also what in the shit is MonadIO for?
23:47TEttingerit's multi-layered, like an onion or reality
23:47arrdemKpop, it's weirder than monands!
23:47bitemyappI had to make a type expression for IO ByteString to get it to shut the fuck up about multiple possible specific instances of MonadIO - why would you even vary the monadic type?
23:47bitemyappseriously, why?
23:48bitemyappdo people make specialized IO monads to run their code in?
23:48bitemyapp :|
23:48bitemyappbrain a'splode.
23:48rovarbitemyapp: it lets you lift common (typeclass implemented) monads into the IO monad
23:48rovarbitemyapp: yes, it makes their life easier in the short run to do so
23:48rovarand harder (IMO) in the long run
23:49bitemyapprovar: well I could tell they were lazy when I saw all the Typeable1 flying around.
23:50bitemyappSaw that and said, "ah well fuck it then"
23:50rovarit allows you to do things such as make params implicit for functions that mutate that param
23:50bitemyapprovar: isn't the vanilla State monad like that?
23:50bitemyappI bumped into a use of StateT that was like that.
23:50rovarfor instance, lets say you have a database client, it obviously needs to run in IO because it needs TCP. So you could put it into an IO monad, and the param to your function and its return value will be the database client object.
23:50bitemyappI think in this case Hastache was using MonadIO to genericize their access against the fs.
23:51bitemyappCould be (very) wrong tho.
23:51bitemyapprovar: yeah but isn't that like...a closure?
23:51bitemyappyou could just make the db-client a curried first argument, couldn't you?
23:51rovarclosures are the only state you have in haskell :)
23:52rovaryou kind of can, but it still needs to run in the IO monad
23:52bitemyappwell I knew that
23:52bitemyappjust saying that I don't see a need for auto-baking the implicit param into it when currying would suffice.
23:52bitemyappunless the implicit param needs to be magically auto-swappable.
23:52bitemyappWould that be the point in this case or is it something else?
23:52rovaractually.. you might not be able to, .. because the return of your function is a mutated db client object, which you need to pass to your next call..
23:53rovarhence the whole reason for monads :)
23:53bitemyapphum. yes.
23:53rovarthey've created these things called monad wrappers, which help generalize all of your IO monads into a single one, but its still a pain, IMO
23:54rovarYesod's main "loop" was a StateT of like 8 monads
23:54bitemyappLOL
23:54bitemyapprovar: yeah, that's partly why I don't use Yesod :P
23:54TEttingerYesod?
23:54rovarthen I gouged out my eyes
23:54bitemyapprovar: I can at least understand WAI and Scotty.
23:54rovarscotty is great
23:54bitemyappbecause uh, you know, fuck *that* noise.
23:54rovarI am big fan
23:55rovarif you're doing math in a RESTful interface, Scotty will be your friend :)
23:55bitemyapprovar: well I'm exposing an analytics service over REST.
23:55rovarme, I'm writing a collaborative MUD against a graph database, NFW I'm doing this in haskell.
23:55bitemyapprovar: why "math"?
23:55rovari just meant pure code
23:56rovarall math is pure code and pure code is math
23:56rovartrue story
23:56bitemyapprovar: I don't see why a collaborative MUD couldn't be done in Haskell :P
23:56bitemyapprovar: also why a graph db?
23:56bitemyapprovar: in my case I'm generating queries against ElasticSearch.
23:56rovarmost maps are shaped like graphs
23:56rovarseemed like a good idea
23:56TEttingerindeed
23:56TEttingermost pathfinding algos work well on graphs too
23:56rovarTitanium is actually very nice so far
23:57rovarTEttinger: it's almost as if they were made for graphs..
23:57TEttingerhaha
23:58TEttingermy decidedly not-M-U-yes-D game uses dijkstra for pathfinding and AI
23:58TEttingerI have yet to do a proper version over a graph, mine uses arrays
23:59bitemyappTEttinger: probably faster anyway :P
23:59arrdem4/0...
23:59TEttingerbitemyapp, err just remembered, it actually uses transient vectors