#clojure logs

2012-07-10

01:18yankovhm, is huge functions like that https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L54 considered as a good practice in clojure?
01:21scottjyankov: depends on the function. rhickey writes long functions with big incremental lets.
01:22yankovlooks crazy. is it easier to read when you know the language more?
01:24arohner_yankov: usually, that is not good style. However, this during the bootstrap of the core namespace, so we cut it some slack
01:24amalloyno. to read that, you probably need to study the language for a year, and the function for a week
01:24arohner_and it has to be crazy fast
01:25yankovja
01:25yankovha
01:25amalloyarohner_: that's part of the macroexpander - doesn't have to be that fast really, just acceptable
01:26scottjarohner_: upped your taxi comment on hn :)
01:26arohner_amalloy: I'm not so sure. Parts of that have to run at runtime
01:26arohner_scottj: ha! thanks
01:26amalloyarohner_: the generated code does, yes
01:30yonatanei see rich started implementing clojure without a parser. How did he know it even works?
01:31arohneryonatane: lisp is designed to be easy to parse. And Rich is pretty smart
01:31yonatane:)
01:31arohnerand he'd written a few other lisps before
01:31yonatanewhich lisps?
01:32yonataneactually he also doesn't like test driven programming, according to one of the talks
01:32arohnerI don't remember the exact names. Something like jFOIL and jFLI
01:32yankovgot a link?
01:33arohnerI don't know that the sites are up anymore
01:33scottj jfli, Foil, Lisplets, or DotLisp
01:33scottjgoogle
01:33yankovwhat are some examples of well-written clojure app?
01:34arohneryankov: https://circleci.com/ :-)
01:34arohnerthat's my site, BTW
01:34yankovarohner: oh, i was singed up. awesome idea :)
01:35scottjyankov: open source ones?
01:35yankovi think I received an email that you guys started testing, but haven't tried yet
01:35yankovscottj: yup
01:35yankovarohner: but circleci is not open-sourced though? so there's no way to check out the code P)
01:36arohnerI was being cheeky because you didn't specify
01:36scottjyankov: leiningen. almost all open source clojure are libraries.
01:36arohnerthere are lots of great OSS libraries
01:36yankovthanks, I'll check out
01:40mcohenlooking for some help with lein
01:40scottjyankov: I remember enjoying reading code for https://github.com/mjg123/pacman/tree/gh-pages
01:40mcoheni've got the preview7 version of lein 2.0
01:40mcohenbut it can't find leiningen.core.main once it's "booted" clojure in the repl
01:41mcohenso if i edit the lein script, to remove the "leiningen.core.main "$@"" at the end of the invocation to start the jvm, at about line 214, it works fine
01:41mcohenclojure starts up and i get the clojure repl
01:42mcohenbut if i include that last bit - "leiningen.core.main "$@" - then I get a Exception in thread "main" java.lang.NoClassDefFoundError:
01:42mcohenand if i look in the stnadalone jar, i don't actually see a main.class under leiningen/core
01:43mcoheni see a bunch of main_xxxx.class files
01:43mcohenbut no plain old main.class
02:14augustlhow can I make "lein test" keep the jvm running and only reload the files that change?
02:14augustlI don't want autotesting, I'd prefer to be able to manually tell it when to start running tests
02:23ivando I have to bother someone to get my messages to the Clojure list to go through?
02:24ivanor maybe someone else could also tell "critique my code!" guy about (pst)
03:00FNDhi - I've just started learning Clojure (I don't have much of a Java background), and can't quite make sense of some code samples I'm looking at
03:01FNDin particular, I don't understand leading and trailing dots: e.g. `let [dict (java.util.HashMap.)]` -- why the trailing dot?
03:02Nicanhttp://clojure.org/java_interop
03:02NicanThe dot is creating a new instance of the java object.
03:02FNDah, thanks!
03:13ro_stibdknox: 0.0.7 looks great!
03:14ro_sti'm just not sure how to update it. i've run both the installer command and the simple ./light table commands, but the ui i get doesn't look like the one in your announcement (no live button or bottom-right menu). and it tells me 0.0.8 is available ?
03:15ro_stah, just found ./light update 0.0.7. it's downloading.
03:25FNDah I see Light Table is a valid topic for discussion here - in that case: how can I add something to the class path (using v0.0.8, installed this morning)
03:27ro_stFND, looks like there is a channel #lighttable
03:28FNDroger, thanks
04:35michaelr525good morning :)
04:35michaelr525late morning
04:39ro_stlein ring server is supposed to reload clj files, right?
04:44michaelr525ro_st: it works for me.. but i
04:44michaelr525i'm not sure it works all the time
04:57ro_stme neither. it's also not clear what will be reloaded and what won't
04:57ro_stshould probably RTFM :-)
04:58FNDthere's a revolver joke in there somewhere
05:00ro_stso, i have a requirement for a vector of maps to be kept in a particular order. i see we have sorted sets and sorted maps. do we have sorted vectors?
05:02hyPiRionro_st: Like a red-black tree?
05:03hyPiRionI don't think so.
05:03ro_stthis is actually a question about clojurescript. i have a list of nodes (each with a viz representation). the user can add nodes to the end or anywhere in the middle. i'm trying to figure out how to model this with clojure's data structures
05:04ro_stan additional constraint is that there is a separate list of node templates that have a proscribed order. that order needs to be kept intact when nodes are created in the active list
05:04ro_stin good old js, this'd be an array and i'd use push or .splice as appropriate
05:07ro_sti'm thinking i'll start with sorted-set and see where that gets me
06:05the-kennysorted-set doesn't sound right
06:31wingyhow do i check what dep versions i have installed
06:31wingylein deps show nothing
06:33michaelr525wingy: ls lib
06:33wingymichaelr525: its empty
06:34wingyeg. in node i could just do "npm ls" and it would list all installed deps and their versions
06:34wingyso if i specified "2.1.x" in the package.json i could now see what version was installed
06:35wingyor "2.1"
06:36ohpauleezwingy: If lib is empty, you haven't pulled any deps at all
06:36ohpauleezyou can also look in ~/.m2 to see what deps you have previously pulled
06:36ohpauleez(your local maven cache)
06:38wingyohpauleez: how do i pull deps to the local project then?
06:38ohpauleezlein deps
06:39wingyhm .. nothing happened .. empty line returned
06:39ohpauleezare you using lein2?
06:39wingyfrom the help: deps Show details about dependencies.
06:39wingyyeah
06:40ohpauleezahh yeah, it'll happen automatic when you do something like `leon repl`
06:40ohpauleezlein repl
06:40ohpauleezand if you look at `target` you can see a dependency file
06:41ohpauleezbut your deps are always listed in project.clj
06:41ohpauleezso you can just view that file and find out
06:42wingyohpauleez: but i need to find out exact what version was installed
06:43ohpauleezwingy: It's in there
06:43ohpauleezyou have to specify the version in there
06:43wingybut what if i specified a range
06:44ohpauleezit uses the leading the version I believe. That usage is usually not used
06:49wingyhttp://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
06:49wingyhow do i specify a range correctly?
06:50wingythis didn't work: [compojure "1.0,2.0"]
06:50wingyor perhaps it did
06:52wingyno it didnt
06:53ohpauleezYou wouldn't do that with compojure, You'd specify the exact version you'd using (because the functionality changes between the versions). The only time people typically use the range in on the version of Clojure they depend on, but that's also very very uncommon. See this: http://grokbase.com/t/gg/clojure/126k0fxk67/wildcards-in-leiningen-dependencies-versions
06:53ohpauleezand the versions need to be in a seq (a list) I believe
06:56wingyohpauleez: i cant keep watching for new patches all the time manually
06:56ohpauleezwhich is why the leon outdated plugin exists
06:56ohpauleezand you don't want to watch for new versions
06:56the-kennywingy: are you on leiningen 2?
06:56wingythe-kenny: yeah
06:56wingyohpauleez: i c
06:56wingyill check on that one
06:57ohpauleezyou want to develop against concrete versions only, and update when you need new functionality
06:57ohpauleezso that you stay stable in your project
06:57the-kennywingy: lein deps :tree
06:57wingyohpauleez: yeah sounds pretty logical
06:57wingyohpauleez: but
06:57ohpauleezSometimes I setup my own SNAPSHOT release of a project on clojars
06:57ohpauleezwhen I want to apply new patches myself for my own projects
06:57wingythe last nr eg. 2.2.x tends to be for bug fixes and not change features
06:58ohpauleezthen before deployment, I might cut my own release or switch to an official release
06:59wingythe-kenny: thx
07:00wingyohpauleez: https://github.com/ato/lein-outdated ?
07:01ohpauleezthat'd be the one. Also you can also use `lein help COMMAND` for more info - the-kenny's suggestion is the first piece of help information on the `deps` command docs
07:02wingyok
07:02wingywow lein-outdated rocks
07:03ohpauleezthe plugin is mentioned in the previous link I gave you (with an argument against the multi versions you were asking about before)
07:03ohpauleezso I think you'll find it useful for sure
07:04wingyyeah i already find it better than auto update
07:17wingyohpauleez: something like outdated should be in the core of lein
07:18ohpauleezit could get merged in eventually, that's not uncommon, but Leiningen's plugin system is powerful and there are many great plugins
07:25ro_stwhat does it mean when someone does this: (def ^:dynamic var-name value)
07:25ohpauleezro_st: It's a dynamic var (and the name should have earmuffs - *my-value*)
07:25ohpauleezit can be rebound in a binding form
07:26ro_stand more importantly, can i use it to store captured config values from System/getenv?
07:26ohpauleezotherwise, standard (non-dynamic) defs are set for life
07:26ohpauleez(like constants)
07:26ro_steg so that i can override these values within midje's background
07:26nixnro_st: http://clojure.org/vars
07:27ohpauleezro_st: You can rebind them whenever you want
07:28ro_stso say i have a my.app.config ns which simply gathers values from System/getenv into a bunch of these ^:dynamic values. with midje, would i then have to put all my facts into a (binding) form?
07:29ro_stto override those config values
07:30ro_stdon't want to store config in the code, but for tests, where i want to control the env in which testing occurs, i do want to be able to override config values. trying to determine the simplest way to do this
07:30ro_stohpauleez: how's shoreleave coming along? :-) i've been playing with cljsbuild today, particularly the crossover stuff. works great
07:32ohpauleezro_st: re-dynamic vars - exactly, they're mostly used to store and redefine configs (or resources)
07:32ohpauleezshoreleave is coming along! Haven't had as much time to work on the demo apps as I've wanted, but it's getting there!
07:37ro_stohpauleez: is this how i'd do it? https://www.refheap.com/paste/3536
07:38ohpauleezUsually binding is a top-level form, like `let`
07:38ohpauleezbut not sure what the midge specific stuff is
07:38ro_sti want to avoid sticking all my facts into a binding because it messes with midje-mode
07:38ro_stif the facts aren't top level
07:38ohpauleezahh gotcha
07:39ro_stanyone know what brian marick's irc handle is? does he come on here?
07:39ro_stotherwise i'll tweetle at him
07:39haspakerI've sent my genetic algorithm out on a 200,000 iteration journey
07:40haspakerWe'll see if it comes up with anything useful after an hour or so
07:40ro_stneat! what is its output?
07:41haspakerI've feeded the algorithm a function - like (fn[x] (* 10 (+ x 2)))
07:41haspakerThe goal of the algorithm is to construct a function that is as close to the original function as possible
07:41haspakerWithout seeing the original function, it can only see what the original function outputs
07:42haspakerI've basically constructed to most cumbersome and impractical way ever to do preschool math
07:42clgvgenetic programming^^
07:43haspakerYeah :P
07:43ro_stgood luck with that
07:43ro_stis this using logic programming?
07:43haspakerDepens
07:43clgvunlikely
07:43ro_sti watched the euroclojure intro to core.logic the other day, very interesting
07:43haspaker*depends
07:43haspakerWhat is "logic programming"?
07:43clgvhaspaker: prolog
07:44ro_sthttps://vimeo.com/45128721
07:45haspakerclgv: Ah. Looked it up on wikipedia
07:45haspakerAnd you're right that I don't use it
07:46haspakerDidn't even know what it was
07:46clgvdo you use clojure symbols and constants as building blocks?
07:46clgvor more highlevel?
07:52haspakerclgv: I use symbols as building blocks
07:52haspakerIt's only simple math, so all the symbols I need are "+ - * / ) ( x"
07:52haspakerAnd some numbers
07:58wingyhaspaker: so cool
08:00tickingI'm wondering, when is it idiomatic to use multimethods, and when to use pattern matching in defn?
08:01wingyticking: with pattern matching you mean destruction?
08:01tickingwingy, yeah
08:01wingyor destructuring
08:01wingy:)
08:02wingyticking: the latter are used each time when you want to access some elements inside a collection (list, vector, set and map)
08:03tickingwingy, yeah I havent quite found a case where I'd use multimethods yet I guess, except for java interop
08:04wingy,(defn greet [{:keys [name]}] (str "Hello " name)) (greet {:name "Pete" :age 20})
08:04clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
08:04wingy:/
08:04tickinghrhr^^
08:05wingyticking: multimethods is something i read yesterday :) i think you will use it when you want something that resembles class system/polymorphism in oop
08:05clgv&(letfn [(greet [{:keys [name]}] (str "Hello " name))] (greet :name "Pete" :age 20))
08:05lazybotclojure.lang.ArityException: Wrong number of args (4) passed to: sandbox4972$eval17407$greet
08:05clgv&(letfn [(greet [&{:keys [name]}] (str "Hello " name))] (greet :name "Pete" :age 20))
08:05lazybot⇒ "Hello Pete"
08:06wingycat and dog is an animal .. but when you do (speak cat) and (speak dog) the former will say "miao" and the latter "woff"
08:07wingyoh yeah now i know what sandbox mean, no vars :)
08:11ticking(defn noise ([{:dog :type}] (print "woof")) ([{:cat :type}] (print "miau")))
08:11tickingthought this would work, so this is where you would need multimethods
08:13tickingdamn, I really hoped clojure would support this
08:13wingyyeah that one would be better refactored into multimethods i think
08:14tickingwell it doesn't work at all
08:14nixnthat should be a decision based on types, not on multi-methods
08:14tickingI had hoped it would do (noise {:type :cat}) => miao
08:15tickingnixn, yeah, it was only a very contrieved example, but clojure doesn't support literals in destructuring right?
08:15clgvticking: no not that way. destructuring is not pattern matching
08:15tickingclgv, thanks, that clears up some things, damn I like patter matching ^^
08:16nixns/patter/pattern/ ^^
08:16wingynixn: you mean protocols?
08:16clgvyou can do (defn noise {:keys [type]}] (case type :dog (print "woof") :cat (print "miau") nil)
08:16wingyhttp://stackoverflow.com/questions/8070368/clojure-multimethods-vs-protocols
08:17clgvticking: this is not extendable. implementing it via multimethod would make your noise function extendible to new kinds of animals ;)
08:18tickingclgv, right thats a good point, this helps see what multimethods can be used for :) thanks
08:18nixnwingy: I'm not quite sure ... a beginner yet
08:19tickingclgv, but I think patterns wouldn't hurt either ;)
08:20clgvticking: dnolen is implementing a pattern matching lib "core.match"
08:21wingyticking: seems that you could/should use protocols instead for this simple case: http://clojuredocs.org/clojure_core/clojure.core/defprotocol
08:21tickingclgv, awesome ^^
08:22tickingwingy, yeah I'm currently reading about those as well
08:22tickingI'm wondering if I have something like a rectangle
08:22wingycool im not the only beginner
08:22wingyticking: btw are you using light table to test things out?
08:23wingya good recommendation!
08:23tickingshould I represent them by doing a map {:x 0 :y 0 :width 5 :height 10} or a record
08:24clgvticking: start off with a map. if you need soething different you can change
08:24tickingwingy, currently I'm using clooj, until I get my swank running, once light table is out I'll use that but the playground is too limited for my image processing stuff ^^
08:25tickingclgv, thanks I'll do that ^^
08:26wingydidnt know about that one
08:29tickingwingy, what lead you to clojure^^?
08:30wingyticking: light table lol
08:30wingyi always felt that FP was cool .. read about haskell and clojure before the switch
08:31wingythen i saw the light table demo and felt that clj code looked cool and gave it a real shot
08:31wingyalso i used LiveScript on node.js which introduced many FP concepts including a std lib like the one in Haskell
08:32wingyso i was totally drawn to FP and wanted to use a real modern FP lang
08:32wingyticking: and you?
08:32tickingwingy cool ^^ yeah light table seems to draw a lot og folks towards lisp ^^
08:33tickingwingy, I wanted to use a lisp at work and clojure seemed like the one that would most likely get permitted ^^
08:34wingyyeah .. watch http://blip.tv/clojure/neal-ford-neal-s-master-plan-for-clojure-enterprise-mindshare-domination-5953926 .. he talks about different strategies to draw people to clj
08:34wingylight table is a good step
08:34tickinghrhr
08:35wingyticking: its modern and supported by heroku .. one of the criterias that must be fulfilled :)
08:35tickinghrhr
08:35tickingnormally I'm a joxa guy lisp on erlang, feels a bit cleaner than clojure but is by no way widespread^^
08:36wingyis there a lisp on erlang?
08:36tickingyeah ^^
08:36wingyhttps://github.com/rvirding/lfe
08:36tickingwell it's on beam (erlang vm) just like clojure is on the jvm
08:37tickingnope http://joxa.org/ ^^
08:37tickinglfe is a lisp 2
08:37tickingI find it annoying if vars and funs reside in different namespaces
08:37tickingclojure and joxa are a lisp-1 same namespace for both
08:37tickingwhich does clojure really nice ^^
08:43wingywhat's up with all that xml :)
08:43wingyis it an erlang thing?
08:43tickinghu xml ^^?
08:43wingyoh
08:43wingyno they were just placeholders
08:44tickingah those you mean, yeah thats just macro pattern annotation ^^
08:44tickingnothign you see besides the docs
08:44wingyticking: you know erlang?
08:44tickingwingy, yeah but I always hated its syntax ^^
08:45HodappI've never used Erlang but it sounds like it has one of the only models of concurrency that's actually known to scale well in practice
08:45wingyperhaps erlang is a better fit with lisp since they are both FP?
08:45tickingwingy , totally
08:46tickingHodapp, yeah also its system of concurrency is not only optimized on parallelism but also on robustness and fault tolerance^^
08:47tickingmakes the whole "let if fail" thing possible
08:47wingyticking: perhaps clojure could be run on erlang some day?
08:47wingyjust like it is run in .NET, Java and JavaScript
08:48wingythen we don't need to switch lang
08:48tickingwingy, possible people are creative, but I don't think it would be worth it
08:48tickingthe cool thing about lisp is that concepts are very uniform across dialects
08:48wingysince why would i make that switch to joxa if it only runs on erlang .. and erlang is not as supported as java
08:48tickingalso clojure has its quirks because its based on jvm, joxa has its quiks from beam
08:49tickingwingy, it depends on what you want to do, erlang has a huge supportive user base, but with a different focus than java
08:50wingyyeah
08:50tickingwingy, erlang is an infrastructure language
08:50wingyno matter what i use i will be certain it will be a lisp lang
08:50wingyits way ahead of it's time :)
08:50tickinghrhr yeah ^
08:52cshellcemerick: Is it correct that the openid workflow in friend assumes that the user types his openid identifier in and posts it and then gets redirected to the provider's login screen, rather than allowing the user to select his provider explicitly via chooser?
09:06bordatou`okay, i couldn't find how to disable autoupdate in lein, every time when i copy a local jar into lib folder and do a jar then everything gets deleted
09:07bordatou`what a mess
09:08bordatou`hello
09:08bordatou`]
09:10bordatou`]
09:10bordatou`]
09:11clgvbordatou`: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L59
09:11cshellhe's gone
09:12cshellbordatou`: why are you spamming ']'?
09:13bordatou`cshell: i am sorry not spamming
09:13wingydoes anyone else agree with my comment in here that it should be (do seq) and not (do coll) http://clojuredocs.org/clojure_core/clojure.core/doall
09:13wingyi mean doall
09:15cshellbordatou`: <clgv> bordatou`: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L59
09:15the-kennywingy: doall/dorun calls `seq' on its arguments. `seq's argument is a coll, it returns a seq, so I disagree
09:15bordatou`cshell: I know clgv did pointed me to that link, I tried most of the options and still couldn't prevent lein from deleting local jar in lib folder
09:16bordatou`cshell: i tried update online?
09:16wingythe-kenny: but that detail shouldn't be told to the users .. its implementation detail .. eg. you should pass a sequence to it .. but it is nice to you and would auto convert if you passed a coll
09:17wingycoll is not a seq .. so looking at the signature you can't pass a seq
09:17wingybut a seq would work
09:17wingy(its the only one that works but its auto converting for you in the background)
09:18wingyanother question: collections cant be lazy? they are concrete data structures right?
09:18the-kennyThe docstring could be clearer
09:18cshellbordatou`: line 59
09:19wingythe signature as well .. where can i post change requests like this?
09:19wingyfor clojuredocs and the original one
09:20cshellpull requests on github?
09:20wingyfor clojure or clojuredocs?
09:20bordatou`cshell: all this time i have been looking at https://github.com/technomancy/leiningen/blob/preview/sample.project.clj
09:21the-kennywingy: Clojure. You should open a ticket in JIRA for this
09:21clgv&(doseq [x [[] '() {} #{}] (println (doall x)))
09:21lazybotjava.lang.RuntimeException: Unmatched delimiter: )
09:21clgv&(doseq [x [[] '() {} #{}] (println (doall x))
09:21lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
09:22clgv&(doseq [x [[] '() {} #{}]] (println (doall x)))
09:22lazybot⇒ [] () {} #{} nil
09:22cshellbordatou`: yeah, that's for 2+
09:22clgvwingy: so "coll" is right
09:22bordatou`damm, thanks cshell.
09:22wingyclgv: ok since i can pass a coll then it should be like that i guess
09:23cshellnp
09:23wingybut since i can pass a seq as well shouldn't it at least be in the signature as well?
09:23wingy(doall coll|seq)
09:23clgvwingy: you stick too much to unimportant details...
09:24wingydetails are not unimportant :)
09:24wingyseq is not coll
09:24wingy,(seq? [1 2 3])
09:24clojurebotfalse
09:24ohpauleez,(sequential? [1 2 3])
09:24clojurebottrue
09:24ohpauleezwingy ^
09:25octagonis there a rich hickey chia pet available for purchase?
09:25octagonif not, can someone please get that going?
09:25ohpauleez,(seqable? [1 2 3])
09:25clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0)>
09:26ohpauleezwait, that's in contrib, use sequential
09:26michaelr`,(seq [1 2 3])
09:26clojurebot(1 2 3)
09:27wingyohpauleez: that means the correct thing is to have (doall sequential)
09:27ohpauleezno it does not
09:27ohpauleez,(sequential? (seq [1 2 3]))
09:27clojurebottrue
09:27ohpauleez,(sequential [1 2 3])
09:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sequential in this context, compiling:(NO_SOURCE_PATH:0)>
09:28ohpauleez,(sequential? [1 2 3])
09:28clojurebottrue
09:28wingy(doall coll) .. thats what i am saying
09:28wingyoh wrong
09:29ohpauleezyou can pass in anything that is sequential, seq, collection, etc -for the reason suggested above. But fundamentally, anywhere you see "coll" this is usually true
09:29wingyi mean (doall sequential) seems right since you can pass whatever that is sequential? .. a coll or a seq
09:29ohpauleezbut seq? and sequential? are not the same
09:29wingy(doall coll) means (doall (seq [1 2])) wouldn't work
09:30the-kenny,(coll? (seq [1 2 3]))
09:30clojurebottrue
09:30the-kenny,(coll? [1 2 3])
09:30clojurebottrue
09:30wingyok that was something new :)
09:30ohpauleezbecause collections implement sequential
09:30clgv(inc the-kenny)
09:30the-kenny\o/
09:31ohpauleezthey're all tries underneath, afaik
09:44wingyok made this i think would help me get it more: https://www.refheap.com/paste/3538
09:51clgv&(seq? (cons 1 nil))
09:51lazybot⇒ true
09:52wingyclgv: yeah
09:54wingyaccording to this one https://www.refheap.com/paste/3538 when it says coll in the doc it means all colls and seqs since seqs are colls .. i thought it wasnt
09:57wingyits updated if you (all beginners here) want the latest one :)
09:59michaelr`cool.. i replaced jetty with aleph and the percieved page loading speed seemed to improved noticeably
10:00wingymichaelr`: did you need to change your source code to fit aleph async style?
10:00michaelr`wingy: nope
10:00wingycool
10:00michaelr`wingy: it has ring-compatible sync mode
10:00wingynice
10:01michaelr`check here if you are interested: https://github.com/ztellman/aleph/wiki/HTTP
10:01wingythx
10:09minikomihi there
10:09cmiles74Good morning :)
10:09minikomigood evening (from tokyo!)
10:10cmiles74:P That's far from Western Massachusetts.
10:10minikomihaha
10:10minikomiI just tried to run this on 4clojure but keep getting a time out.. https://www.refheap.com/paste/3539
10:11minikomiis there something silly I missed?
10:11minikomi(problem 115..)
10:11cmiles74I pasted it in and it ran in 0.045 secs... I'm using Clojure 1.3
10:11locojay1hi i would like to apply multiple functions to a sequence using map. i could do (comp f1 f2 ...) but this would require that each function has same return value (elem of sequence). my function only do some monger update's. thanks
10:12minikomibummer
10:12minikomiseems the site is a bit wonky at the moment haha
10:12cmiles74Ah.
10:12minikomilocal repl is also 30~50 ms for me
10:13cmiles74minikomi: Here's a gist of the same code, https://gist.github.com/3083515
10:13minikomiall but the last one pass for http://www.4clojure.com/problem/115 haha.. it times out..
10:15tmciverlocojay1: how about using juxt?
10:15locojay1tmciver: thanks this is it.
10:15gfrederickslocojay1: can you give an example input and output?
10:19minikomibummer
10:19minikomiwell, guess I'll go to bed & try again tomorrow haha
10:21locojay1gfrederikcks : input is a sequence of integers, and i would like to apply multiple functions which update some stuff in mongodb given a integer . so there's no reall output.
10:22gfrederickslocojay1: ah ha, so it is side effects; I would use doseq; (doseq [n my-ints] (f1 n) (f2 n) (f3 n))
10:23gfredericksI think that's what you're asking for
10:23gfredericksalso (doseq [n my-ints] (doto n (f1) (f2) (f3))) would work too I think
10:25locojay1thanks
10:29locojay1that's what i was looking let each number supplied to multiple function instead of using comp and have each function return the same input
10:31gfredericksjuxt does something similar, but is more pure-function-style rather than side-effect-style
10:36locojay1since i m doing db plumming i guess doto is better as docs this.
10:36gfredericks,(doc doto)
10:36clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
10:36duck1123(doall (for [n my-ints f ['f1 'f2 'f3]] (f n)))
10:37gfredericksduck1123: doseq could do that too couldn't it?
10:37duck1123well, doseq won't save the result. Can doseq take multiple pairs?
10:37duck1123I guess I don't do that enough
10:38gfredericks&(doseq [a [1 2], b [:hey :ho]] (println a b))
10:38lazybot⇒ 1 :hey 1 :ho 2 :hey 2 :ho nil
10:38gfredericksduck1123: he said no output so I assume saving the result would be unnecessary and wasteful
10:38duck1123true
10:55edge86what's the term for extra keywords in arguments such as this here?
10:55edge86(for [x (range 100000000) y (range 1000000) :while (< y x)] [x y])
10:55edge86I want to learn about them but they're tricky to google. for clairity, I'm looking at the :while in the above line
10:57ohpauleezedge86: Optional keyword arguments
10:57edge86thanks!
10:57ohpauleezyou get them doing something like: (defn my-func [arg & opts] (let [optional-args (apply hash-map opts)] ..))
10:58ohpauleezedge86: np
11:03augustlhow do I "map" a map? Need to run all values through a function.
11:03nDuffaugustl: zipmap?
11:03augustlnDuff: looking it up, tnx
11:05nDuffaugustl: ie. (let new-map (zipmap (keys old-map) (map some-fn (values old-map)))
11:08michaelr`also:
11:08michaelr`,(into {} (map (fn [p] p) {:a 1 :b 2}))
11:08clojurebot{:a 1, :b 2}
11:14gfredericks,(into {} (map identity {:a 1 :b 2}))
11:14clojurebot{:a 1, :b 2}
11:14gfredericks,(into {} {:a 1 :b 2})
11:14clojurebot{:a 1, :b 2}
11:22ttimvisherwhat's the easiest way to get a reference to a private field on an object?
11:24gfredericksif there's nothing in the clojure Reflector class then probably just through the standard java reflection api
11:24gfredericksthe clojure Reflector might not be public-intended in any case
11:30davidHello.
11:31davidI have a map that I'd like to traverse and for each item I'd like to do a test and if that test is true I'd do some side-effect such as println. What would be the best construct to use for this?
11:32davidI meant *tree not map
11:33ttimvishergfredericks: thanks for the pointer
11:34locojay1what is the correct syntax for something link (defn play [elem & args] (doto elem args)) (play 3 println println) should output 33. but i get ArraySeq cannot be cast to Fn. thanks
11:35ttimvisheractually, my problem may be even more complicated. I'm getting a reference to an implementation of a service from a spring classpath context and the instance variable is obviously only in the implementation class
11:35ttimvisher:)
11:35gfrederickslocojay1: try (doseq [f args] (f elem)), or ((apply juxt args) elem)
11:39locojay1same issue its more why can i wrap inside a function ((juxt print print) 3) works and output is 33 but (defn play [elem & forms] ((juxt forms) elem)) will output error
11:42nDufflocojay: I'm wondering if perhaps you want (apply juxt forms) there.
11:42duck1123because forms is a sequence where juxt takes just functions. (you'll need to use apply)
11:43locojay1thanks
11:43nDufflocojay: I suspect that you want (play 3 print print) to become ((juxt print print) 3) rather than ((juxt (print print)) 3)
11:44sayyestolifeOk. My previous IRC-client bugged out so I'll try again.
11:44sayyestolifeI have a tree that I'd like to traverse and for each item I'd like to do a test and if that test is true I'd do some side-effect such as println. What would be the best construct to use for this?
11:45foxdonutany thoughts on having 'map' only once in (->> coll (map f1) (map f2) (map f3)) ?
11:47nickmbaileydo cljs projects handle javascript dependency management with lein somehow?
11:48foxdonutscore another one for the rubber duck. (map (comp f3 f2 f1) coll)
11:55_wingywhat would one use xml for in clojure land?
11:56duck1123producing or reading?
11:56RickInGA_wingy: probably interfacing with other systems
11:56duck1123namespace aware?
11:56_wingyor is the mentality to move away from it as far as possible
11:56foxdonutweb services perhaps
11:57_wingyRickInGA: yeah thats what i thought about. Do you think its ok to only provide JSON http api?
11:58_wingyduck1123: both i guess
11:58foxdonut_wingy: who is consuming your api?
11:58duck1123for producing, just hiccup works well enough for me
11:59_wingyno one atm. i need to know if xml is someone we should provide or is it ok to ditch it eniterely
11:59duck1123for reading, it depends on if you need ns-support
11:59nDuffHmm.
11:59_wingysome web services only have xml support others have only json
12:00_wingythey dont care about their users need they choose what feels right for them
12:01_wingyis that stupied since youl could have both the xml and json customers if you provide both
12:01duck1123I like xml-picker-seq if you need ns-support
12:04duck1123of course, now that I look over the relevant code. I'm wondering if I'm actually using that lib anymore or am completely using XOM
12:06kaoDhi
12:08uvtchi, kaoD
12:16dnolennDuff: I looked at the patch, looks OK, if you add some tests I'll apply.
12:23nDuffdnolen: *nod*. Will repost w/ a test case added shortly.
12:33dnolen_nDuff: yeah testing CLJS via Node not recommended.
12:33nDuff...hrm; we have some other tests that assume a default namespace of user.
12:37nDuffdnolen_: Updated patch attached.
12:44dnolen_nDuff: one thing I'm confused by is why we need the reader-ns dynamic var ... why can't we just create-ns w/ the *cljs-ns*
12:48droidboii am looking for work in london
12:49droidboiUK
12:50droidboiwhat are the type of jobs there
12:50nDuffdnolen_: ...oooh. Actually, in trying to fix things up, I broke some of the original intent.
12:51droidboibanking?
12:51nDuffdnolen_: ...if I'm following correctly, reader-ns was intended to be a gensym to distinguish it from any namespace the user might _intentionally_ be trying to refer to.
12:52droidboior more broadly, 'finance'.
12:52droidboiwhat is the typical job
12:53nDuffdnolen_: ...that said -- I don't know the code in question well enough to really be comfortable with the solution in question; this really was just a direct port of DSkarda's patch.
12:53dnolen_nDuff: I don't follow. this is about handling ::foo. not :alias/foo or :fill-ins/foo
12:53dnolen_nDuff: er :full-ns/foo
12:54dnolen_nDuff: so I don't see why we need any of those dynamic vars, could be missing something tho ...
12:56nDuffOooh.
12:57nDuffInvestigating that, found a bigger bug (places where the test suite was explicitly testing for wrong behavior)
12:59dnolen_nDuff: in the reader tests?
13:00nDuffin core.test, ie. (assert (= #{:user/shape} (parents ::rect)))
13:00nDuff...but that's within (ns cljs.core-test)
13:00dnolen_nDuff: ah right, yeah, probably copy and pasted old tests.
13:02nDuffdnolen_: ...so, reverting the non-test code and making the line "(if-let [form (binding [*ns* (create-ns ana/*cljs-ns*)] (read rdr nil nil))]" results in some of those being expanded to :cljs.user/* rather than :cljs.core-test/*, which isn't right...
13:03dnolen_nDuff: "some" ?
13:04nDuffPresumably all, but haven't explicitly validated contrary.
13:04nDuff(some (constantly true)) => true, after all.
13:05dnolen_nDuff: so worth investigating why *cljs-ns* doesn't handle this. seems to unexpected to me.
13:10dnolen_nDuff: ok I understand what's going.
13:10nDuffdnolen_: ...well, I don't really understand the logic here. We're setting up the *ns* for the reader just once, at the beginning of form-seq, right? So even if *cljs-ns* gets rebound partway through, it seems fully expected to me that the *ns* wouldn't change. If there's something in the code that's expected to handle that case correctly by intent, well I don't know it well enough to follow.
13:10dnolen_nDuff: read time vs. analyze time problem, still think the intention of the old patch could be clearer.
13:11dnolen_::foo -> :cljs-unknown-ns/foo, which we can fix when we encounter keywords via analysis.
13:12dnolen_nDuff: ^ this was the intention of the original patch.
13:12nDuff*nodnod*.
13:12nDuffthat's what I was intending (and failing) to describe earlier when I was talking about why there was a gensym in the first version.
13:13dnolen_nDuff: the original patch is good, it should be left alone, just updated for master. Would be nice to add a comment on what *reader-ns* is, a namespace that most be resolved at analysis time.
13:14nDuff...well, it's not quite good -- I was getting a test failure off it.
13:14dnolen_nDuff: I mean skarda's patch - what was failing?
13:15nDuffHmm -- runs fine now. *scratches head*
13:16dnolen_nDuff: skarda's patch updated for master + tests welcome and will be applied.
13:16nDuff*nod*. Generated, will be posted shortly.
13:16dnolen_nDuff: a comment around the role of reader-ns please if you don't mind.
13:17dnolen_nDuff: thx much.
13:18nDuffdnolen_: attached as CLJS-266-r3.patch
13:26dnolen_nDuff: applied to master
13:26wingyis there a reason for "get" to be a function when you can just use the collection as the function?
13:27wingyand they work exactly the same
13:28nDuff(oops -- missed the request for a comment 'til looking back at the channel just now)
13:28dnolen_nDuff: I added it, no problem.
13:32dnolen_nDuff: thx for the bump on that ticket.
13:49nDuffdnolen_: np; very much a scratching-my-own-itch thing. (Using a lot of watchers crossing namespaces, so wanted to have namespaced keys on them)
13:54kaoDhow can I put a lazy sequence inside another lazy sequence without the inner one being evaluated in the outer cons?
14:05wingyworking in FP style is like working with cards .. you shuffle them .. you sort them .. you mix them etc
14:06wingyeach collection is like a deck of cards
14:06wingypoker time!
14:09scriptorhow would you reduce a deck?
14:10wingysumming all values?
14:10TimMcscriptor: Fire.
14:13TimMc(reduce burn flame deck)
14:13ohpauleezInterview with Alan Kay by Binstock: http://www.drdobbs.com/architecture-and-design/interview-with-alan-kay/240003442
14:13ohpauleez"the web was done by amateurs"
14:13ohpauleezSO good
14:15ttimvisherwhat's the proper `class` test in a multi-method for `{}`?
14:18ttimvisheranyone have a preferred way to load up their entire source into swank so that something like `C-c <` works properly?
14:21bobo_when i have a running swank with emacs (jack-in). Kan i get it to fetch new dependencies without havint to restart?
14:22technomancybobo_: not really
14:23bobo_ok thanks =)
14:23technomancyyou can manually fetch new versions if you declare a runtime dependency on pomegranate, but there's no good way to apply updates to project.clj
14:24bobo_its not that much work to restart it. Just wanted to be sure im not missing something
14:24madsyAhh.. demoscene party coming up, and I'm all out of ideas for demo effects
14:24madsyStupid brain.. work!
14:29joegallottimvisher: IPersistentSet, probably.
14:30foxdonutmadsy: pound your head like an old TV
14:30joegallothat is, clojure.lang.IPersistentSet.
14:30ttimvisherjoegallo: referring to the class question? ended up using java.util.Map
14:31ttimvisherisa? and implements? continue to confuse me :(
14:31joegalloderp, i'm so dumb.
14:31joegalloi read that as #{}...
14:31wingyohpauleez: yeha nice article
14:31joegalloanyway, yeah, java.util.Map is probably just fine.
14:31ttimvisheri'm the dumb one, of course, because i forgot that i was wrapping it in a ref anyway
14:32ttimvisherso now i'm trying clojure.lang.Ref
14:32joegallottimvisher: and it seems that that's good enough for rhickey: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L77
14:32wingyohpauleez: reminds me about Bruce Lee who didn't believe in style as well .. he wanted you to forget style .. there is no style in fighting .. there is the shortest distance between you and the opponent
14:33wingyclojure seems pretty good in this aspect .. keep it simple
14:33ttimvisherany day Brue Lee comes up in #clojure is a good day
14:34ttimvisher:)
14:34foxdonutlol
14:35wingyprinciples are universal no matter what field you are in
14:36ttimvisherso i've got a multimethod defined with class as the dispatcher
14:36ttimvisheri have method defined with clojure.lang.Ref as the dispatch value
14:36ttimvisherand when i try to call it with a defined using (ref ...)
14:36ttimvisheri get no method found
14:37ttimvisherbut
14:37wingybut his advice on being formless would not be great in this channel :)
14:37ttimvisher,(isa? (class (ref {})) clojure.lang.Ref)
14:37clojurebottrue
14:37ttimvisherso what am i missing?
14:37ttimvisher,(class (ref {}))
14:37clojurebotclojure.lang.Ref
14:38ttimvisherinterestingly, the stacktrace i get references: clojure.lang.Ref@18ab088
14:38ttimvisherand the @ bit changes everytime
14:38zakwilsonPastebin a minimal version of your code.
14:39hiredmanttimvisher: @18ab088 is part of the hashcode, it is part of the .toString on refs I believe
14:40hiredmanttimvisher: are you trying to call a ref as a function?
14:40hiredmanoh
14:40ttimvisherzakwilson, hiredman: https://gist.github.com/3085419
14:41hiredmanwhat is class*?
14:41zakwilsonbeat me to it
14:41hiredmanit doesn't seem to be returning the class, it is returning the instance
14:42ttimvisherwhoops, not enough clipboard: https://gist.github.com/3085419
14:42ttimvisheri'm using that to ignore the other arguments to the function
14:42hiredmanttimvisher: run (def write-hotfix nil) then reload your code
14:43hiredmanmost likely you definied the multimethod with a different dispatch function, then changed it
14:43hiredmanbut defmulti behaves like defonce
14:43ttimvisherah that's right!
14:43ttimvisheri'm ashamed to admit that bites me more often than not
14:43ttimvisherbut you're exactly correct
14:43ttimvisherthanks!
14:44ttimvisheri keep trying to avoid compulsively `clojure-jack-in`ing but it seems like the right thing to do sometimes
14:49augustl"Could not locate leinmidje/midje_color__init.class or leinmidje/midje_color.clj on classpath" hmm
14:51augustlanyone seen that one before? Got `[lein-midje "1.0.10"]` in plugins and `[midje "1.4.0"]` in dev-dependencies
14:51mcohenwondering if anyone can help me figure out why lein repl works fine in an empty dir, but if i lein new app <name> then cd <name> and then lein repl again, i get a NoClassDefFoundError
14:52mcoheni've tried lein 1.7.1 and lein 2 preview7
14:53ToxicFrog'lein repl' tries to build and load your project so you can interact with it, I think
14:53ToxicFrogBut I also thought that the default 'app' configuration built out of the box, so that shouldn't be the problem
14:53ToxicFrogWhat's the actual error?
14:54augustlhmm lein-midje needs to be both a plugin and a dev-dependency
14:54mcohenException in thread "main" java.lang.NoClassDefFoundError:
14:54mcohenCaused by: java.lang.ClassNotFoundException:
14:54technomancymcohen: can you put the stack trace on gist or refheap or some such?
14:54mcohensure thing. thanks! one sec
14:55mcohenhttps://gist.github.com/3085504
14:57mcohenit takes a few seconds, maybe 10 or so, before you get the "Couldn't Connect" errors being printed
14:57technomancymcohen: what about in lein2?
14:57mcohensame thing, but one sec and i'll run it
14:58augustldoes lein-midje and/or midje have hooks so I can start a server before the tests start running?
14:58mcohenhttps://gist.github.com/3085516
14:58mcohennot exactly the same thing actually
14:58ohpauleezmcohen: OS, JVM version, and any sort of weird /etc/hosts or firewall/iptables setup?
14:59technomancymcohen: this is a brand new "app" project?
14:59mcohenOS X
14:59mcohenmcohen$ lein2 -v
14:59mcohenLeiningen 2.0.0-preview7 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
14:59technomancymcohen: try removing the :main line from project.clj
14:59mcohenyep, just ran lein new app and didn't touch anything
14:59technomancycrazytown
15:00technomancyit's possible lein1 populated ~/.m2 with some jars that were corrupted in download
15:00technomancylein2 will refuse to download them if the checksums don't match, but it will use them if lein1 already downloaded them
15:00technomancyif removing :main doesn't work try `mv ~/.m2 ~/.m2-bak`
15:01mcohenok, i'll try that. i removed the :main in project.clj but now the trace changed to https://gist.github.com/3085516
15:02technomancyok, it looks like probably the clojure jar wasn't downloaded correctly
15:02technomancyshouldn't happen with lein2 going forward with any luck
15:04uvtcOne great thing about lein is that you can so easily start over again from scratch. Just delete/rename your ~/.m2, ~/.lein, and your ~/bin/lein script, and just start fresh.
15:04foxdonutLFS=Lein From Scratch
15:04dybaCan anyone tell me why (= 'clojure.lang.PersistentArrayMap (class (hash-map))) is not true?
15:05mcohenwow, looks like it fetched everything, but still no joy
15:05mcohenhttps://gist.github.com/3085516
15:05hiredman,(type 'clojure.lang.PersistentArrayMap)
15:05clojurebotclojure.lang.Symbol
15:05hiredman,(type clojure.lang.PersistentArrayMap)
15:05clojurebotjava.lang.Class
15:05hiredman,(type (class (hash-map)))
15:05clojurebotjava.lang.Class
15:05dybaah, ok
15:05technomancymcohen: does it happen with projects using the default template?
15:06dybahiredman: I was working under a wrong assumption when I wrote the test
15:06technomancyit's somewhat unfortunate that they are visually indistinguishable
15:06foxdonut,(= clojure.lang.PersistentArrayMap (class (hash-map)))
15:06clojurebottrue
15:06dybasee i wanted to get the string of the class name and compare it to the result i get w/ (class (hash-map))
15:07mcohentechnomancy: yeah i think so. basically, lein repl runs fine in an empty dir, but if i type lein new app <name> and then cd into and run the repl i get the error
15:07augustlis there a way to get a hold of the "project" that you pass to a leiningen plugin? Want to write a script for initiating the test run myself, but to reuse existing code I need that "project" :)
15:07dybaoh, i see, I just got to get rid of the quote. :)
15:07technomancymcohen: what about in `lein new myapp`?
15:07technomancyaugustl: try the lein-pprint plugin
15:07dybathanks <hiredman>!
15:08foxdonutanyone else picture hiredman as an assassin?
15:08mcohenyeah, just tried. same thing
15:08augustltechnomancy: cool, thanks
15:08mcohendownload clojure-1.4.0.jar though that time
15:09augustltechnomancy: how do I invoke "lein pprint" without shelling out?
15:10technomancyaugustl: I don't know what that means
15:10augustltechnomancy: I want to write a .clj file to use as a script to start my test run. In it I want to invoke the lein-midje to initiate the test run. To do that I need the "project".
15:11hiredmanhttp://www.mylibrarybook.com/books/702/William-Gibson/Count-Zero-40.html
15:11augustlso I need to invoke "lein pprint" from that script, and I'm wondering if shelling out to call that command is the only way
15:11technomancywhat does "use as a script" mean?
15:12augustltechnomancy: invoke it via the command line
15:12technomancyyou mean like `java -cp [...]`?
15:12augustljava -jar path/to/clojure.jar run-tests.clj
15:12augustlor something like that
15:12technomancywhy do you want to do that?
15:13augustlso I can control the lifecycle of the test run, none of the testing tools I've found has the hooks I want
15:13augustlnamely, doing something before the entire suite starts running
15:13CheironHi. I want to send a POST request to Ring app. a basic idea how to do it?
15:13technomancyok, you can do it by hand, but you'll have a lot less wheel-reinventing if you write it as a leiningen plugin
15:13mcohencan't imagine what it could be, but i'm guessing something on my machine must be borked somewhere. thank you for the help technomancy
15:13technomancymcohen: sorry, I have no idea what's going on there. never seen anything like it =\
15:13augustltechnomancy: great, I'll investigate that
15:14augustlCheiron: a real one, or a mocked one?
15:14mcoheni'll report back what it was when i figure it out
15:14foxdonuthiredman: awesome
15:14technomancymcohen: feel free to open an issue on the leinigen github tracker
15:14Cheironaugustl: ?
15:14mcohenok, thanks
15:14augustltechnomancy: that means having the script in a separate project as far as I can tell (since the plugin needs to be a dependency), but it's better than nothing :)
15:15augustlCheiron: do you want to mount your ring app to a http server and do requests on it, or is in-process mocks OK?
15:15technomancyaugustl: you can put it in the tasks/ dir and then have a .lein-classpath file containing just "tasks"
15:15technomancyhm; I need to make that better-documented
15:15augustltechnomancy: oh, great
15:15Cheironaugustl: i will deploy it under immutant
15:15Cheironit will be mounted
15:15technomancyit would probably be better to fix the existing plugin to do what you want, but that's a good way to start out and experiment
15:16augustlCheiron: use any old http client then :) There are a few, I use clj-http.
15:16augustltechnomancy: got an example of such a task anywhere?
15:17technomancyaugustl: read PLUGINS.md in the doc/ dir of leiningen
15:17Cheironaugustl: I mean how to define a function in Ring that will accept POST requests (kind of REST API). forgive my ignorance but never did ring dev before
15:17augustlCheiron: oh, I misunderstood your question. Just check the method of the request?
15:17augustlCheiron: I've never used Ring directly for any "real" applications though, I tend to use compojure which is a routing DSL on top of Ring
15:18Cheironaugustl: will check that
15:18Cheironany tool to generate documentations such as the official Clojure libs docs?
15:19tcrawleyCheiron: those are generated by autodoc
15:19technomancyCheiron: yes, but please don't use them unless you have already written prose documentation
15:20technomancyhttp://jacobian.org/writing/great-documentation/what-to-write/
15:20augustltechnomancy: made tasks/run-tests.clj, put http://pastie.org/4233299 in it, added "tasks" to .lein-classpath, how do I invoke it?
15:20technomancyaugustl: should be tasks/leiningen/run_tests.clj
15:20technomancythen just `lein run-tests` should work
15:21Cheironmay I ask where is the "autodoc" ?
15:21augustlthen it shows up in "lein help" as leiningen.run-tests Problem loading: Could not locate leiningen/run_tests__init.class or leiningen/run_tests.clj on classpath:
15:21Cheirontechnomancy: that is a great reference!
15:21tcrawleyCheiron: http://tomfaulhaber.github.com/autodoc/
15:22augustlnvm, hyphens vs underscores in clojure file names ftw :)
15:22Cheirontcrawley: thanks!
15:22uvtcCheiron: there's also https://github.com/weavejester/codox , http://fogus.me/fun/marginalia/ , and https://github.com/dakrone/lein-clojuredocs .
15:22amalloytechnomancy: does my documentation have to be prose? verse sounds so much more interesting
15:23technomancyamalloy: I guess free verse could probably work.
15:23technomancyif you can fit it into a sonnet, I salute you
15:23scriptorno documentation epics?
15:24amalloyjiraph: a database in which to store your stuff ;; shakespeare-style
15:24technomancyamalloy: you're already in iambic pentameter; good start
15:24amalloythat was the idea, yes
15:24aperiodicdactyllic hexameter > iambic pentameter
15:24sduckettmmm...sea shanties...
15:24amalloyi forget what a dactyl is
15:25uvtcCheiron: for prose/verse/sonnet/novella documentation, I suggest just making a directory containing of .md files. Displays nicely on github and simple.
15:25aperiodicmenin paidea thea, peliadiao achileus
15:25uvtcs/of//
15:25technomancyterza rima for lyfe
15:25amalloywell, that would be useful if i knew how to pronounce latin
15:25uvtcLatin is all greek to me.
15:26technomancysing, muse, the rage of achileus, peleus' son
15:26scriptorfrom what I've heard, roman latin sounded a lot like italian
15:26aperiodic(inc technomancy)
15:26nDuffHeh.
15:26Cheironuvtc: what is prose/verse/sonnet/novella?
15:26technomancythat's about the limit of my greek =)
15:26aperiodicmine too! :)
15:28aperiodicstill doesn't have anything on Zeus
15:28aperiodicdude just could not keep it in his pants
15:28uvtcCheiron: just extending technomancy's joke there. I mean standalone docs, as opposed to API docs (in your docstrings).
15:28ToxicFrogaperiodic: let's face it, there are very few classical gods, demigods, rulers, or heroes who could~
15:28aperiodics/pants/toga/
15:28aperiodicToxicFrog: Odysseus
15:29aperiodicbut yeah, he is the exception
15:29scriptornah, Odysseus failed to temptation too
15:29scriptorit's in the first few pages he's in
15:31aperiodicclearly it's been a while since I read the epics
15:32rainerschusterhi all. I'd like to port some contrib libs over to .NET. I've read the articles from David porting the libs. Is there a central repo or list, or some kind of coordination?
15:34rainerschusterah ok, i've found a hint: http://www.myclojureadventure.com/p/clojureclr-ports-page-purpose-of-this.html
15:59augustltechnomancy: I'm getting "Could not locate leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:" when attempting to require leiningen.core.eval from my custom "task" thing, any ideas?
16:00antares_rainerschuster: http://dev.clojure.org/display/doc/Clojure+Contrib
16:00antares_rainerschuster: take a look and then ask on the mailing list
16:01rainerschusterantares_: thanks
16:17kennethhey all
16:17kennethso i've been struggling with using a native dependency but i finally figured my problem out
16:18kenneththe jar installed by lein is broken, but when installing it manually i can get it to work
16:18kennethis there a way to specify an external jar to include in lein?
16:31technomancykenneth: you can do `lein install` to get it in your local repo, but of course you should push your fixes upstream
16:31technomancyaugustl: not sure; it works for me
16:32kennethi didn't do any fixes—i just compiled from github source, as opposed to using the clojar which is broken
16:32kennethhow does lein install work?
16:32technomancyoh, well you should let the maintainer know their deployed version is broken
16:32technomancykenneth: it creates a jar and puts it in the local repository (~/.m2)
16:33kennethah! so you do `lein install /path/to/jar`?
16:33technomancyno, just `lein install` from the project directory
16:33kennethhow does it know how to get the jar?
16:34technomancyit just makes a jar out of the current project
16:48wingy"God created this world with Lisp" :)
16:48RaynesHe actually hacked it together with Perl.
16:51duck1123Which explains all the oddities in the universe
16:54TimMcWith a 6-day deadline, I wouldn't be surprised if it were mostly shell scripts.
17:04AWizzArdhiredman: ping (please look into your prv chat)
17:04wingyis core.logic used in Datomic?
17:04AWizzArdwingy: no
17:05wingyoh .. looked like it
17:09AWizzArdwingy: it is based on Datalog: http://en.wikipedia.org/wiki/Datalog
17:10drocamorHi
17:10wingyAWizzArd: what i meant is Datomic using core.logic under the hood?
17:11wingyhttps://github.com/clojure/core.logic/wiki they mention Datomic
17:12drocamorI have a lazy seq (an AWS SQS queue provided by cheshire) and I'm trying to process it 100 items at a time so I can bundle them together and put them some place.
17:12amalloywingy: dnolen's talking about teaching core.logic to read facts from datomic
17:12drocamorAnd this IRC client is garbage
17:12drocamorbrb
17:12dnolen_wingy: rhickey just asked that I create an example of wiring up Datomic indexes to core.logic.
17:12dnolen_wingy: you can provide any data source really tho.
17:18drocamorI'm having some trouble processing an SQS queue using bandalore. I need to group together 100 messages at a time to do something with them, but when i use partition on the lazy-seq it ends up not deleting the messages. Can anyone provide some insight?
17:19kennethhow would i convert a byte[] into a string?
17:19kenneth(utf8)
17:20pjstadignew String(bytes, "UTF-8")
17:20Raynes&(String. (.getBytes "foo") "UTF-8")
17:20lazybot⇒ "foo"
17:20RaynesRound tripping!
17:20pjstadigtrippy!
17:37wingycore.logic is very awesome
17:38wingycore.match as well .. clojure is too great compared to other langs ... learned like never before in just 2 weeks
17:47dikidoom> 1
17:47dikidoom-> 1
17:48dikidoom=> 1
17:49dikidooma quick question: (range 1 2.6 (/ 1.6 3)) returns a list of 4 elements, (range 0.1 1.7 (/ 1.6 3)) returns 3. is that to blame on floating point foo or on range? :)
17:50dikidoomah, i meant (range 0 1.6 (/ 1.6 3)) that second time.
17:51dikidoom&(range 0 1.6 (/ 1.6 3))
17:51lazybot⇒ (0 0.5333333333333333 1.0666666666666667)
17:52dikidoom&(range 1 2.6 (/ 1.6 3))
17:52lazybot⇒ (1 1.5333333333333332 2.0666666666666664 2.5999999999999996)
18:02gtrak``&[(eval ''1) (eval '''1)]
18:02lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
18:03scriptorThis incident will be reported
18:18aaelonyWhat's the best clojars lib for sending emails? (I don't need anything especially heavy, just something that can send out alert emails from time to time.) Simple-email? Funnel-mailer? mailfinger? I see many choices....
18:21jeremyheileraaelony: postal looks pretty good, https://github.com/drewr/postal
18:21andres-vaaelony: I don't if it's the best, but here is another one, https://github.com/drewr/postal
18:21aaelonyjeremyheiler and andres-v: cool, thanks
18:21jeremyheiler(at least until i get my act together with Lime lol)
18:23aaelonywish there were ratings/rankings for clojars libs to help discern
18:24amalloygoogle helpfully sorts results for "clojure mail library" by popularity :P
18:25aaelonynever heard of google
18:25amalloyit's like a www directory listing but with more features
18:25aaelony:)
18:25jeremyheilerI am glad my completely unfinished and unused library gets good google ranks then lol
18:26amalloyjeremyheiler: second place out of two, right? sounds about right if you're not done with it
18:27scriptorwell, it has an actual website
18:28scriptormaybe the algorithms like that
18:28jeremyheilerlol
18:28jeremyheilerthere are a few more, they jsut get lost after all the clojure.org pages that are in the results
18:29scriptorlet's see if adding -clojure.org helps any
18:38haspakerGod, LISP syntax actually starts to make sense to me now
18:38haspakerNever thought it would happen
18:41wingyhaspaker: since when?
18:41OlegYch|heh
18:41OlegYch|hnever thoought lisp had syntax
18:41scriptorjust wait, it'll all seem so simple that you'll want to make your own interpreter next
18:42scriptorlisp has syntax, just not much
18:42ChousukeI don't understand it when people say lisp has no syntax :/
18:42amalloyChousuke: it's an exciting tag-line; even if it's verifiably nonsense it almost does a good job of getting the point across
18:42Chousukeit actually has extensible syntax
18:43Chousukeit's just that there are very few syntactic elements so it mostly looks uniform
18:44haspakerwingy: Just sat down and realized I can actually _see past_ all the the god damn parantheses. I couldn't do that two days ago
18:44OlegYch|hit's just that lisp syntax is so minimal that it's negligible
18:44ChousukeOlegYch|h: the thing is, every macro has its own syntax
18:45OlegYch|htrue, but it's more of a form than syntax
18:45Chousukethey all make use of the same basic elements (in clojure, mostly lists, vectors and symbols) but the interpretation of those elements is left to the macro
18:45scriptornow we're just entering a debate on semantics :)
18:45amalloyOlegYch|h: no, that's nonsense. (let (asdff) (blah) (lol)) is illegal specifically because it violates the syntax (synonym: grammar) defined by the let macro
18:47Chousukeone thing I like about clojure is that it actually has more idiomatic and useful syntactic building blocks compared to CL and Scheme
18:47amalloyscriptor: i suspect you are trying to start a debate about the difference between semantics and syntax
18:47Chousukeso you can design more expressive and readable syntax for macros.
18:47nDuffHmm.
18:48scriptoramalloy: not quite, more on the difference between form and syntax
18:48scriptorso linguistic semantics
18:48Chousukeof course in CL or scheme you can always extend the reader but that has other problems
18:54dnolenChousuke: extend the reader in Scheme?
18:56dnolenChousuke: I suppose you mean that some popular implementations allow it
18:56dnolennDuff: another CLJS bug? or bug in another lib?
18:57nDuffdnolen: I reported this one earlier, you asked me to file a ticket, and I put it off.
18:57dnolennDuff: ah
19:00SegFaultAX|work2It absolutely floors me how expressive clojure is. I was just looking at clout... an entire route matching library in less than 150 LOC.
19:06mebaran151Hey #clojure, what's the best way to create an object to pass as options in Clojurescript?
19:07mebaran151I have a jquery library I need to interop with
19:08emezeskemebaran151: ibdknox/jayq has a clj->js function that does that
19:08yonataneis there any point in interoping with clojure's source?
19:08mebaran151thanks emezeske
19:09emezeskemebaran151: I think if you google "clj->js" there are a few different implementations floating around
19:09mebaran151I wish Clojurescript exported a native constructor (something like (js-map "a" 1 "b" 2) )
19:18mebaran151btw, emezeske, I'm working on a fileupload widget for this site (partially in bootstrap); any suggestions?
19:19emezeskemebaran151: None come to mind
19:26nDuffBlerg.
19:32SegFaultAX|work2Does anyone use Jetty + Nginx to serve their Clojure web applications?
19:33technomancySegFaultAX|work2: sure
19:34SegFaultAX|work2technomancy: Would you be willing to share your nginx configuration?
19:34technomancySegFaultAX|work2: oh, I don't set the nginx part up myself
19:35SegFaultAX|work2technomancy: I mostly just want to see how the proxy pass is setup.
19:35SegFaultAX|work2technomancy: Do you have access to it?
19:35technomancyno, it's just used in the heroku routing layer
19:35technomancyI mean I probably could but it wouldn't be anything like what you would want =)
19:36SegFaultAX|work2technomancy: Do you work at Heroku?
19:36amalloyyonatane: i don't think you'll get an answer to that question because it doesn't make sense. what does it mean to interop with clojure's source?
19:36technomancySegFaultAX|work2: yeah
19:36SegFaultAX|work2technomancy: Would it be in the build pack?
19:37amalloySegFaultAX|work2: i'll find 4clojure's nginx setup
19:37SegFaultAX|work2Probably not...
19:37technomancySegFaultAX|work2: that's the main thing, yeah
19:37SegFaultAX|work2amalloy: Thanks!
19:38technomancySegFaultAX|work2: oh, I mean that's the main thing I do at heroku. the build pack doesn't contain any nginx config.
19:38SegFaultAX|work2technomancy: What's the main thing you do? Manage the build pack?
19:39technomancyyeah, the Clojure buildpack plus some other general build infrastructure; also the heroku client installers
19:39amalloySegFaultAX|work2: https://gist.github.com/5e766a7ab6f1976eeeb0
19:39SegFaultAX|work2technomancy: That's pretty cool. I did see the talk from the guy who manages the Erlang buildpack at SF Erlang conf.
19:40SegFaultAX|work2technomancy: Kind of a neat way to handle deploying lots and lots of websites.
19:40emezeskenDuff: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler
19:40SegFaultAX|work2amalloy: That's it? Awesome! So all the other routing configuration is handled by Ring?
19:41SegFaultAX|work2amalloy: (Or whatever you happen to be using)
19:41amalloyyes
19:41amalloyfor higher performance, you could set up nginx to handle some static files for you
19:41SegFaultAX|work2amalloy: That's easy enough.
19:42SegFaultAX|work2amalloy: I really just wanted to see how the proxy pass was handled.
19:42amalloybut ring is fast, and 4clojure feels very snappy in every browser, from what i hear
19:42SegFaultAX|work2amalloy: For serving other types of Java web applications, the configuration is a bit more involved, eg http://wiki.nginx.org/JavaServers
19:42SegFaultAX|work2amalloy: Do you have to configure a context for your domain? Can I see that, too if you do?
19:43amalloyonly if you want to serve multiple applications out of the same jetty container
19:43amalloywe just run embedded jetty in the 4clojure process
19:43SegFaultAX|work2amalloy: Ah, so you use uberjar (or equiv) and bundle the application server in your war file?
19:44amalloylein run in production, baby
19:45SegFaultAX|work2amalloy: I don't see jetty in the deps for 4clojure, how do you bundle it with the application?
19:46ibdknoxlein run is for winners.
19:47amalloyi dunno, actually. we must get it transitively from something like ring
19:47ibdknoxring brings it in with the ring-jetty-adapter
19:47amalloyyeah
19:47SegFaultAX|work2amalloy: Oh, I see.
19:48SegFaultAX|work2amalloy: Sorry to keep bothering you, but how do you deploy the application? I imagine you git-push and have some post-receive-hooks do the rest?
19:48ibdknoxSegFaultAX|work2: http://toroid.org/ams/git-website-howto
19:48ibdknoxthat's a nice simple way of setting it up ^
19:49SegFaultAX|work2ibdknox: Isn't that what I just said? :D
19:49amalloyno, i just ssh in and deploy manually. none of us are terribly good at server admin
19:49ibdknoxSegFaultAX|work2: clearly it was for amalloy's benefit ;)
19:49SegFaultAX|work2amalloy: So is there downtime on every code upgrade, then?
19:49amalloyyeah, somewhere in the neighborhood of ten seconds i think
19:50ssutchsay i want to wrap forms in noir to add a csrf token validation, what would be the most sane way to approach that?
19:50SegFaultAX|work2amalloy: Is there a god/monit/other process that makes sure jetty doesn't die?
19:51ibdknoxssutch: write a new form function that takes the same stuff as hiccup's and just adds your csrf in there
19:51amalloythere's a cron job restarting it if it stops responding
19:51ssutchibdknox what about validation?
19:52amalloyif you figure out a better way to do all of this i'm sure we'd welcome the help. currently it sorta chugs along and works most of the time, and eventually repairs itself when it stops working
19:52ibdknoxssutch: do it as middleware
19:54ssutchibdknox i'll try it out, thanks!
19:54ibdknoxssutch: np, good luck :)
19:55ibdknoxssutch: oh, I forgot about this
19:55ibdknoxssutch: https://github.com/weavejester/ring-anti-forgery
19:55ibdknoxuse that
19:55ibdknoxeven better :D
19:55Raynesibdknox: Have you seen validateur
19:55Rayneshttps://github.com/michaelklishin/validateur
19:56ssutchhey that looks exactly like what i wanted to do
19:56RaynesNoir also has validation middleware. Not sure how these compare.
19:56SegFaultAX|work2Is there anything that weavejester hasn't already implemented?
19:58amalloyi hear he's still struggling on getting his traveling-salesman solution down from O(n^2)
19:59SegFaultAX|work2:D
20:00Raynesamalloy: Careful, that joke's an antique.
20:02ibdknoxRaynes: yeah, when I looked at it, it didn't really seem to serve the same purpose
20:04Raynesibdknox: It doesn't?
20:05ibdknoxRaynes: maybe it does now? I dunno. It is certainly order of magnitude more complicated
20:05SegFaultAX|work2How is that joke an antique?
20:05ibdknoxorders*
20:06RaynesSegFaultAX|work2: Implies it is an old joke that people have said before.
20:06SegFaultAX|work2Raynes: Oh, yea.
20:07SegFaultAX|work2Raynes: But so is "emacs is a great operating system... now all it needs is a decent text editor" but I still chuckle every time :)
20:08SegFaultAX|work2Raynes: Also, for your reading pleasure: http://www.gnu.org/fun/jokes/ed-msg.html
20:11carlo_auIs Light Table trying to do what Emacs + SLIME do?
20:11SegFaultAX|work2carlo_au: Not really.
20:13ibdknoxonly in so far as both let you write software :)
20:13ibdknoxinsofar*
20:14carlo_auSegFaultAX|work2: what'sthe main point of difference?
20:15ibdknoxcarlo_au: have you seen any of my videos?
20:15carlo_auibdknox: maybe, url?
20:15ibdknoxcarlo_au: http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/
20:16dnolencarlo_au: I don't see Emacs switching to WebKit for starters.
20:16SegFaultAX|work2carlo_au: It's just different.
20:16ibdknoxcarlo_au: http://www.chris-granger.com/2012/05/21/the-future-is-specific/
20:16SegFaultAX|work2carlo_au: Emacs is a text editor, slime is a lisp client.
20:16carlo_auibdknox: oh, you're Chris?
20:16ibdknoxI am indeed
20:16carlo_auah :)
20:19SegFaultAX|work2carlo_au: In my opinion the main "point of difference" is the change in perspective of what a code unit is. Traditionally IDE's force you to think of a file as an increment. Light table challenges this idea.
20:19SegFaultAX|work2carlo_au: There are some other novel (and not so novel) ideas at play, but for me the change in the way code is manipulated is a big factor.
20:20ibdknoxSegFaultAX|work2: before it's all said and done I hope to change the notion of what editing means
20:20SegFaultAX|work2ibdknox: That's the impression I've got from your talks etc.
20:20ibdknoxspeaking of talks
20:20SegFaultAX|work2ibdknox: And in general I like the idea.
20:20ibdknoxYou guys should come to my OSCON talk :)
20:20ibdknoxIt should be really neat
20:20lynaghkibdknox: when are you getting in to PDX?
20:20ibdknoxdnolen: everything was working for you again right?
20:21SegFaultAX|work2ibdknox: Most of the other functionality (quick access to docs, running code in real-time, etc.) are well covered by other power editors (vim, etc.)
20:21ibdknoxlynaghk: weds afternoon
20:21lynaghkibdknox: we should make some time to parrrty.
20:21lynaghkibdknox: oh, this Wednesday?
20:21ibdknoxnext
20:21ibdknoxI'm only coming to give my talk unfortunately :(
20:21lynaghkyou flying out Thursday?
20:21ibdknoxfriday
20:21ibdknoxso I have a little buffer
20:22lynaghkparty buffer, dude.
20:22lynaghkthough I bet a lot of people are going to be looking for you.
20:22ibdknoxlol
20:23ibdknoxlynaghk: we should definitely catch up while I'm there, you giving a talk?
20:23lynaghkibdknox: yeah, I have a talk on Friday at 10 a.m.
20:24ibdknoxC2 stuff?
20:24lynaghkibdknox: I'll probably be bumming around OSCON a fair bit though, since it's something like ten minutes from where I live
20:24dnolenibdknox: yes!
20:24lynaghkibdknox: yeah, though more of a higher level overview than what I gave at Clojure/West---in particular talking about some of the advantages and tradeoffs of using Clojure vs. JavaScript.
20:25SegFaultAX|work2lynaghk: What about ClojureScript vs CoffeeScript?
20:25ibdknoxdnolen: I wrote a launcher in java that should make all of this much more painless. Just need to test it out. The install/use will then just be download this jar, double click it
20:25ibdknoxlynaghk: cool
20:26ibdknoxlynaghk: well, as time draws near, I'll let you know my plans
20:26lynaghkIn particular I'm getting really excited about Clojure's soon-to-be-cross-platform domination---I looked into writing C2 for CoreGraphics (iOS rendering tech) via Lua ClojureScript this past weekend. And this morning I find out there's a solid looking Clojure -> project. So now I have options!
20:26carlo_auibdknox: that sql example is really nice (watching the video)
20:26lynaghkibdknox: sounds good, you've got my cell in your email somewhere I believe.
20:27lynaghkSegFaultAX|work2: CoffeeScript is JavaScript, so I don't think there's much of a distinction worth talking about. It's a bit better, but not wildly different (which is its big advantage/disadvantage)
20:27lynaghkibdknox: are you familiar with R at all?
20:27ibdknoxlynaghk: only at a very high level
20:28ibdknoxI've seen it used, never used it myself
20:28SegFaultAX|work2lynaghk: Is that different from using ClojureScript's JS backend?
20:28technomancyeliminating the statement/expression distinction places it at least above python
20:28SegFaultAX|work2lynaghk: The result is the same.
20:28lynaghkibdknox: ah. The "ggplot2" library for R is a really great exploratory data visualization library.
20:28ibdknoxSegFaultAX|work2: not really, CLJS has new semantics, coffeescript does not
20:29lynaghkIt's at a much higher level than C2. I'm toying with the idea of porting it to Clojure/C2 and maybe mashing it up with some of this Session stuff kovas has been working on.
20:29ibdknoxlynaghk: I might have to check that out. I was messing around with Incanter the other night making histograms of usage patterns :)
20:29SegFaultAX|work2ibdknox: Hmm, really? Can you cite some specific examples? I'd like to read up on this.
20:30lynaghkibdknox: R is a quirky language, but yeah. I only use it these days to play with ggplot2, which is great for doing initial visual analyses of datasets.
20:30ibdknoxSegFaultAX|work2: just think about truthiness
20:30technomancydoes session use nrepl?
20:30lynaghkhiredman: anything in particular? There's a lot of pieces he's working on as part of that project
20:30ibdknoxhiredman: what has you excited?
20:30hiredmantechnomancy: I have a pull request that switches it to nrepl
20:31technomancyhiredman: cool
20:31hiredmanibdknox: I like the idea of a computational document, sort of relaxed/more flexible spreadsheet
20:31SegFaultAX|work2ibdknox: Go on? Once the CLJS is compiled to javascript the broken truthiness is still there. How is CLJS making it less ugly different from, say, CoffeeScript making it less ugly?
20:32lynaghkSegFaultAX|work2: because you the programmer get to work with non-broken truthiness.
20:32SegFaultAX|work2Does CoffeeScript not provide that? TIL.
20:32ibdknoxIt didn't
20:32ibdknoxI dunno if it does now
20:32technomancycoffeescript does provide new semantics
20:32SegFaultAX|work2Any other particular examples?
20:32ibdknoxhiredman: yeah, absolutely. There's goodness to that idea
20:32technomancyeverything is an expression
20:32lynaghkSegFaultAX|work2: it has some nice things like the existential operator, but you can still find plenty of ways to shoot yourself in the foot
20:33hiredmanlynaghk: just progress really, I want to see what I think of his new stuff, there are some issues I have with the existing implementation, I don't think I completely understand why he thinks reader tags are super, so I am interested to see
20:33lynaghkSegFaultAX|work2: clj has immutable semantics, much richer data structures (e.g., sets), lazy sequences (so you can mess with infinite lists easily, &c. &c.
20:33ibdknoxhiredman: I think those concepts will fit really well into LightTable when it's ready for it
20:33SegFaultAX|work2lynaghk: I'm not yet familiar with the existential operator. Is it a similar concept to existentials in Haskell?
20:34hiredmanit seems to me the existing loop idea needs to be split, so you have a loop as a thing running in the clojure server, which is has a proxy loop in cljs in the browser
20:34lynaghkSegFaultAX|work2: it just lets you see if something is undefined vs. falsey, which is tricky to do right is JS because it's so flexible
20:34SegFaultAX|work2lynaghk: Ah, those are some good examples.
20:34SegFaultAX|work2lynaghk: Yea, that's a good point.
20:35hiredmaneither that, or the protocol between the server and the browser needs to be a little more complex than prn/read-string because somethings (like vars) prn in clojure but cannot be read in clojurescript
20:35hiredmanand somethings like #<Object> can be prn'ed but not read
20:35lynaghkhiredman: yeah. I think tagged literals are nice to read but I'm not sure how fundamentally there is any difference between them and, say, XML tags.
20:37ibdknoxI don't want them to start appearing in code :(
20:38lynaghkibdknox: tagged literals? Why not? I would have expected you to be all over that, so that Light Table could, e.g., read #color[:rgb, 1, 223, 39] in someone's codebase and render it as a colorpicker.
20:38hiredmanbut you can already embed incanter charts in session (chart -> image -> data uri) which is always the first thing I try to do with a gui repl
20:39lynaghkhiredman: are they dynamic?
20:39hiredmannope
20:39lynaghkhiredman: if you're into that kind of thing, after I watched his talk I spent a few hours putting together a "manipulate" demo that uses Himera to dynamically compile mathematical fns, extracts the free vars from them, and gives you sliders: https://github.com/lynaghk/c2-demos/tree/manipulate/manipulate
20:40hiredmanneat
20:40lynaghkit's super rough, and nothing really too exciting. What I'm interested in is how you generalize that in Clojure to cover the same kinds of things that Mathematica's manipulate covers---anything renderable, basically. Plots render as plots, text as text, shapes as shapes...
20:43hiredmanyeah, it is interesting, you need a set of rules for turning things in to "renderable datastructures" (tagged literals?) and then manipulate has to know how to manipulate those
20:43lynaghkhiredman: I think the open "IRenderable" protocol is something that Kovas is thinking about as part of Session.
20:45hiredmanyeah, but you don't want to have things taht know how to render themselves, you want things than can be translated in to a manipulatable/renderable data representation
20:45lynaghkhiredman: Since we're using Clojure I just assume that everything we get is an easily-manipulable data structure = )
20:47hiredmanlynaghk: that does help
20:49lynaghkhiredman: primarily I'm interested in seeing what a family of protocols will look like for different kinds of UI widgets, especially with some reactive stuff e.g. https://github.com/halgari/reactive
20:53ssutchanyone else tried the lein-light plugin? i am getting FileNotFoundException - could not locate leiningen/core/eval...
21:26beffbernardhow do you create an list initialized to 0 of size n?
21:27beffbernardI did it this way and I feel bad: (map (fn [a] 0) (take 24 (range)))
21:27gfredericks,(repeat 5 0)
21:27clojurebot(0 0 0 0 0)
21:28gfredericksbeffbernard: though if you're planning on making random updates to it you probably want a vector
21:28beffbernardthank you sir.. I feel dumb now
21:28beffbernardgfredericks: sure
21:33brehautwhy is clojure.core/repeat implemented with (take n (range)) rather than just (range n)? is it something to do with chunked seqs?
21:34brehautwait, ignore me
21:38gfredericksman #clojure needs some self esteem
21:40wkellylol
21:47gtuckerkelloggheh
21:56unnalibrehaut: you're the best!
21:57brehautlol
21:59madsyI see that atoms in ClojureScript call a function whenever it's referenced. Is it potensially faster to copy the dereferenced atom into a let if I need to read it multiple times?
22:10gfredericksmadsy: that sounds like a reasonable thing to say; and for clojure-proper probably safer
22:20locojay1hi how can i destruct in argument a nested map
22:22gfredericks,(let [nested-map {:foo {:bar 12}}, func (fn [{{bar :bar} :foo}] bar)] (func nested-map))
22:22clojurebot12
22:22locojay1cool thanks
22:23gfrederickslocojay1: if it were me I'd use get-in or -> instead of destructuring
22:25locojay1yeah just learned about get-in but just wanted to know how it would work.
22:26amalloy&(macroexpand-1 '(let [nested-map {:foo {:bar 12}}, func (fn [{{bar :bar} :foo}] bar)] (func nested-map))) ;; if you're curious
22:26lazybot⇒ (let* [nested-map {:foo {:bar 12}} func (fn [{{bar :bar} :foo}] bar)] (func nested-map))
22:26amalloyoh
22:27amalloy&(macroexpand-1 '(fn [{{bar :bar} :foo}] bar)
22:27lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
22:27amalloy&(macroexpand-1 '(fn [{{bar :bar} :foo}] bar))
22:27lazybot⇒ (fn* ([p__21478] (clojure.core/let [{{bar :bar} :foo} p__21478] bar)))
22:27amalloy&(macroexpand-1 '(let [{{bar :bar} :foo} x] bar))
22:28lazybot⇒ (let* [map__21486 x map__21486 (if (clojure.core/seq? map__21486) (clojure.core/apply clojure.core/hash-map map__21486) map__21486) map__21487 (clojure.core/get map__21486 :foo) map__21487 (if (clojure.core/seq? map__21487) (clojure.core/apply clojure.core/hash-... https://www.refheap.com/paste/3546
23:01madsylein-cljsbuild have ways to launch repls connected to the browser. Like lein cljsbuild repl-launch. Is it possible to make those work with slime/swank, instead of using them as lisp-inferior in emacs?
23:02madsyI mean, it is possible with clojurescript the manual way, but that requires me to launch swank first, and then initiate the cljs repl afterwards inside slime.
23:03madsyNot exactly a nice workflow
23:37ssutchis there a way to optionally-require
23:57ivanssutch: require inside a function and use (resolve '...) to reference the required thing