#clojure logs

2013-11-17

00:00swarthygrncdr: Again I'm no expert but I would think about your problem as: I have this data and some items need to be active. How do I check that data and find the things that must be active vs. inactive. Creating a new set of data with those flags set properly. Rather than changing in place.
00:02swarthygrncdr: Sorry I don't have better answers. I'm still learning myself, I'm hoping if I keep talking you will have a Eureka! moment, lol.
00:02grncdrnp I appreciate the discussion even if it doesn't come in the form of direct imperatives :)
00:03coventrygrncdr: I don't see how you get away from having two modifications of some sort (the two assocs you complain about in the refheap in this case). Two operations seems pretty intrinsic to adding an item and making it the active item.
00:04grncdrcoventry: hm, I suppose that's the part i need to accept… that I'm "adding" an item and not "updating" it
00:05coventryHow would mutable data structures help you here?
00:05grncdrlike from the outside, I am updating the active item, but from inside the function that viewpoint doesn't make sense
00:05zeebrahI'm finding i have to call my function (function-point #(Math/sin %) 1) instead of just Math/sin. Is there a better way?
00:05grncdrwell if it was a JS object (for example) I would just have state.activeItem be the same object as what was stored in state.items
00:06grncdrso state.items[1] === state.activeItem, and any modifications would be reflected in both places with no extra effort on my part
00:08grncdrbut the only way I can see to do the (exact) equivalent in clojure is by wrapping each item in it's own atom (which is crazy and I wouldn't have considered it)
00:09grncdrI suppose I could've just wrapped active-item in an atom
00:09coventrygrncdr: Oh, I see. Make :items a map with uuids, make :active-item refer via the uuid.
00:09coventryOr maybe there are more informative keys you could use than uuids.
00:10grncdrwell, if I went that way, why not just vector indices?
00:10coventrygrncdr: Because you might reorder the list.
00:11grncdrare maps ordered? or would the ordering be a separate vector of UUIDs in this scenario?
00:11brainproxyI thought these might be helpful to other ClojureScript devs, so I gist'd them for your coding pleasure: https://gist.github.com/michaelsbradleyjr/7509505
00:12coventrygrncdr: Not sure what you mean. I have to turn in. Good luck.
00:12dnolenbrainproxy: nice
00:13grncdrthanks coventry :)
00:16brainproxydnolen: I was struggling with understanding what cljs.core.async.macros/go was doing to my expressions
00:17brainproxydev'ing those helpers lets me see more easily how things are getting transformed
00:17brainproxyand they're good for debugging macros for use in cljs projects in general
00:20coventrygrncdr: I was imprecise. In case it wasn't clear, I meant something like {:items {uuid1, {:title "Thingy" :description "etc etc"}} :active-item uuid1}
00:20coventry*poof*
00:27paomianhow to user flash in web app
00:37bitemyapppaomian: this is #clojure
00:37bitemyapppaomian: not #flash
00:43paomianbitemyapp: http://yogthos.github.io/lib-noir/noir.session.html#var-flash-get like this
00:45bitemyapppaomian: show the content in your web app.
00:49paomianbitemyapp: I try it ,but it is nothin
00:49bitemyappSegFaultAX: you've got a stiffy for the types too eh?
00:57paomianbitemyapp: ?
01:12paomian(defn flash-suc [msg url]
01:12paomian(do (session/flash-put! :success msg)
01:12paomian(response/redirect url)))
01:12paomian(session/flash-get :success "test")
01:12paomianwyh I do not get the value of :success
01:16bitemyapppaomian: probably because you redirected.
01:16bitemyapppaomian: you shouldn't use tools you don't understand, scale it back a bit and understand Ring, and then what this flash thing is doing for you.
01:20paomianbitemyapp: thanks
01:28logic_progis there a "core.async internals" paper anywhere? I'm intrested in things like: 1) what happens with a go thread throws an exception 2) how to get a list of all existing go threads 3) what happens to internal state if I force-kill a go-thread (given that force-killing java threads is deprecated)
01:30bitemyapplogic_prog: not a paper, but tbaldridge has put up rather thorough youtube videos on how the Go macro works
01:30bitemyapplogic_prog: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/
01:30logic_progjust found it
01:30logic_progstudying deep walking first http://www.youtube.com/watch?v=HXfDK1OYpco
01:31logic_progthanks!
02:35logic_progomfg, this is so awesome
02:35logic_progare there more resources like http://www.youtube.com/channel/UCLxWPHbkxjR-G-y6CVoEHOw/videos
02:35logic_progI'm not looking for rich-hikey style high-level talks (though those are nice too); I want talks of people writing code in emacs/nrepl and showing internals of clojure / cool things
02:38bitemyapplogic_prog: I'm not aware of many, mostly tbaldridge's awesome stuff.
02:38bitemyappThe only other material I know of is designed for people that are extremely new to Clojure.
02:39bacon1989what's a clojure?
02:39logic_progthat's unfortunate
02:39logic_progimagien if every one who had a popular github clojure repo made a few videos about their project
02:40logic_progI'd stop watching TV, cancel my netflix
02:40logic_progand be smarter
02:41bitemyapplogic_prog: well, I could make a brief video about the asynchronous connection strategy I used in Revise.
02:41bitemyappIt doesn't occur to me to make videos generally, because I actually hate A/V content
02:41bitemyappand prefer text to virtually everything else.
02:41bitemyapppartly because I read quickly and like efficiently reviewing select mateiral.
02:41bitemyapplogic_prog: http://github.com/bitemyapp/Revise/
02:42logic_progjust found it via google :-)
02:42logic_progrethinkdb, interesting
02:42bitemyappthis is mostly `cbp's baby, but I was brought in to make a thread-safe connection management strategy.
02:42logic_progI've been looking at datomic, mnesia, riak, and hbase recently
02:42bitemyapprethinkdb is nice for certain kinds of projects, vastly superior to MongoDB too.
02:42bitemyappwell those data stores all serve different needs.
02:42bitemyappRethinkDB and MongoDB are pretty comparable - and I favor the former.
02:43logic_progehg, looks overly complicated to me
02:44logic_progI like the simplicity of riak/hbase
02:44logic_progwith other databases, I have a hard time "counting" how many "fundamental ops" are being processesd
02:44logic_progI'm almost convinced the approach I want is {mnesia / datomic } + {riak / hbase}, where the metadata is in a database with tranasctions, and the actual data is in a k/v store
02:45bitemyapplogic_prog: Riak is a Dynamo based data store and Datomic supports DynamoDB as a storage backend.
02:45logic_progno way
02:45bitemyapplogic_prog: the real reason to use something like Riak isn't for "actual data", it's for when you need availability rather than consistency.
02:45bitemyappthat is an edge case.
02:46bitemyapp99% of applications need consistency, and that's where Datomic, SQL databases, RethinkDB, etc. shine
02:46bitemyappHBase is CP as well.
02:46logic_progyes, of the CAP theorem
02:46logic_proghowever, I think riak is the right approach
02:46logic_progit forces me to think about how to handle "conflicts"
02:46bitemyappthere is no single approach to anything
02:46bitemyappand I was offering to explain Revise's connection management strategy for reasons that are utterly separated from the database itself
02:47logic_progconection management strategy?
02:47logic_progwhat are those and why do they matter?
02:47bitemyappit's a semi-novel way of managing socket resources tied to a database connection
02:47bitemyappsigh. never mind.
02:47logic_progsuppose you made a youtube video
02:47logic_progwhat would be the blurb you put into the "description" field?
02:47logic_progI'm so clueless I do't even understand why this is important.
02:48bitemyapplogic_prog: "async methods for using connection resources more efficiently"
02:48bitemyappsubstantially more efficiently.
02:48logic_progbitemyapp: is this how you feel right now? http://www.youtube.com/watch?v=FL7yD-0pqZg
02:51bitemyappa little bit.
03:05logic_prog_http://www.youtube.com/watch?v=cUxYoNRW3VM <-- where is the actual code used in this demo?
03:57nonubyenlive/scraping given a node <p class="c1"> <a href="#">infoA</a>infoB</p> what selector should i use just to extract infoB it seems [:.c1 text-node] returns nothing
04:07echo-areaIs it possible to overlay two line charts together?
04:07echo-area(In incanter)
04:08bitemyappecho-area: http://data-sorcery.org/2009/06/04/linear-regression-with-higher-order-terms/ there's an overlay of two different kinds of charts here
04:09echo-areaLet me see
04:29metactushow does one go about mapping apply?
04:29bitemyappmetactus: just map it? sounds like an anti-pattern though. refheap it?
04:30metactusmap expects a seq, apply expects a function and a seq
04:31bitemyappseq of vector of function and args
04:31metactuswhen I map apply I need a sequence of function and seq pairs
04:31bitemyappso do that
04:32metactusI did do that
04:32metactusbut apply takes a function and args
04:32metactus*seq of args
04:32metactusnot a seq
04:32metactusso how do I break the vector? it's like I need to apply apply twice, which doesn't really answer my question about how to apply it once
04:34metactusbitemyapp: do you suggest something like: (map apply [[+ [args]]) ?
04:35bitemyapp,(map (fn [[fn args]] (apply fn args)) [[+ [1 2 3]] [+ [4 5 6]]])
04:35clojurebot(6 15)
04:35bitemyappI wouldn't be very happy if my code looked like that, but it appears to work just fine.
04:42metactusThank you!
04:43metactusHow would you do that in general though? Like, map a fn w/ arity > 1?
04:43metactusI mean, w/o using your supposed messy solution. Is there an easier way?
04:44bitemyappmetactus: try to restructure my code such that it wasn't necessary.
04:44bitemyappNot trying to be difficult, that's the real answer here.
04:45bitemyappI do use apply from time to time, but I try to be conservative about it.
04:45bitemyapp((nested data structures + HOFs + apply) - type system) == pain
05:08metactusbitemyapp: Got it, thanks!
06:27logic_progis there any "guidelines for structuring a large clojure application" ?
06:27logic_progI feel taht with my code, as I hit the 10K loc range, I have problem managing my clojure codebase
06:27logic_progI'd love to read a "heavily opiniated way on structuring lcojure codebases"
06:27logic_progthanks
10:15gfredericksis it intentional that the edn spec doesn't allow < etc.?
10:16gfredericksI was grumping about this haskell edn parser not parsing them and then noticed the spec didn't mention them
10:16gfredericksI think by "etc" I just meant >
10:22glosoliIs there some most used templating engine for Clojure ?
10:27joegallotemplating what?
10:27joegallocause, like, the answer might be different if you're templating HTML versus just plain text, or i dunno, fabric swatches
10:28glosolijoegallo: html templating, I have heard of clostache and i know there are many others
10:28glosoliKinda curious for some opinions
10:29joegalloenlive and hiccup are popular things
10:29glosolienlive is more of a transformation framework, or am I wrong ?
10:29joegalloclabango is also a thing
10:31samratglosoli: if you want something like Django's templates you should check out Selmer
10:32glosoliyeah Selmer is probably what i have been looking for, thanks
10:32samratglosoli: its the same deal as clabango but better maintained and more performant
10:33samratglosoli: that said, I myself prefer hiccup. You should check that out too
10:34glosolisamrat: I did use hiccup before, just wanted to check my options, I did enjoy it
10:36xcthulhuHello, I have two RESTful APIs: one in classic ASP and one in Compojure. People POST to them using a form, and otherwise they don't reply with anything interesting. We are trying to sunset the classic ASP API and replace it with Compojure, so we need to duplicate all of the traffic to it so that Compojure also gets it. Anybody have any idea how to do this?
10:44Kowboythey at least have to reply with a status code, no?
10:45Kowboyyou could do it 3 ways as I see it
10:45Kowboy1) In the browser with JavaScript
10:46Kowboyjust submit the form data to both URLs
10:46Kowboy2) In the ASP by sending the params in an Async HTTP request to the compjure service
10:47Kowboy3) By creating a proxy service that forwards the request to any number of backend or "downstream" servers and uses an "official" one for sending the response back to the client
10:49justin_smithanother option would be using the asp.net but serializing all requests in a reliable way, then running those against the clojure service to ensure that it gives the same responses
10:52rurumateWhy is core.typed not using core.logic (yet)?
11:00jcromartiethat's a good question
11:10rurumatejcromartie: maybe there's another project?
11:24the-anomehi
11:27danenaniahey all, i've got a ring-compojure-http-kit web app that's been running fine, but after a 'lein do clean' i'm now getting 'java.lang.ClassNotFoundException: clojure.tools.reader.reader_types.Reader' with anything involving compojure or middleware. any ideas what this could be? have been struggling for awhile
11:31seangrovedanenania: Are you using austin?
11:32danenaniaseangrove: yes i am
11:33seangrovedanenania: Take it out and try again
11:33danenaniaseangrove: trying now, thanks
11:36danenaniaseangrove: yep that did it... removing references (which i tried) wasn't enough. had to take it out of plugins
11:36seangrovedanenania: Probably worth noting it here https://github.com/cemerick/austin/issues/23
11:37seangroveI'm not sure why it would happen, but I lost a day or so to it
11:37danenaniayeah, had me totally puzzled as well
11:38danenaniawish i'd come here sooner
11:38danenaniathanks!
11:38seangroveNo problem, just add your case to the issue to help cemerick pinpoint the issue, please
11:38danenaniawill do
11:41danneuwow
11:42danneugotta love a shot in the dark that works out like that
11:42danneurespect that seangrove hustle
11:42seangrovedanneu: Spread the love.
11:48the-anomeanybody would have a piece of advice to me on what would be the correct way to validate function arguments in clojure? I mean, complex function arguments like maps that need to match some structure. Yeah, I know I can use validation libraries but what is the correct way to do it? Even more when the validation code and the function code seem to need to be maintained separately. Ideas?
11:48seangrovethe-anome: core.typed ?
11:49seangroveAlmost certainly the best route. Alternatively, there's prismatic's schema.
11:49the-anomeseangrove: I would go scala :D, then
11:49seangrovethe-anome: Sure, sounds like fun.
11:49the-anomejust kidding but you are right, for these kind of things it seems to be the right way
11:50the-anomejust wondering if there was some alternative way I had not thought about
11:51seangrovethe-anome: Yeah, I think it's best for complex maps especially to have some static verification (core.typed) which will help you not hurt yourself, or at least run-time verification (prismatic's schema) that can tell you when/where you've done it
11:51the-anomethanks seangrove. Much appreciated. I will have a look in depth
11:54seangroveUhg, dealing with imap, such a pain
11:54seangroveI feel for bbloom and what he did, and also feel jealous that he's free of it :P
12:04danneuMy app works with data that can be represented in many different ways like binary, hex, binary-compressed, hex-compressed, asn.1, asn.1-compressed. I tried to use meta-data to come up with an abstraction for converting between them
12:04danneuhttps://www.refheap.com/20974
12:04danneuis this an abuse of meta-data?
12:07danneuthe goal is to, without having to (compressed? priv) logic, I can just do (transcode-priv priv :binary) and it will convert it to binary or compressed-binary depending on if priv is already compressed or not
12:07danneuwith multimethods dispatching on ^{:compression _} priv.
12:08danneui.e. i read a blog-post about clojure meta-data last night
12:15justin_smiththe-anome: there is also pre-conditions
12:21the-anomehi justin_smith
12:21the-anomeyou are right
12:22the-anomeat the end, sometimes is useful to have types
12:22the-anome:)
12:22the-anomedespite of this, I felt in love with clojure because of the flexibility
12:23danneui don't think there's anything inflexible about typese
12:24danneuafter all, it turns out that there's a difference between Seqable bytes and an Array of bytes, so it makes sense to annotate what you need
12:25danneui mean, the cost of annotating of not inflexibility because you were already coupled with [B
12:25danneuis not*
12:33the-anomedanneu: good point.
12:53dee5Would anyone know how to connect to an nrepl server with sublime text or change where sublimeREPL starts from? I bascially want to load a project with sublimeREPL, and to my understanding, I'd have to start the repl in the project's directory, which sublimeREPL doesn't seem to do
12:56technomancynot a lot of people using proprietary editors on freenode
12:57dee5thought it would be worth a shot, thanks anyway though (:
13:02the-kennyIs there a cljsbuild configuration which allows me to use source-maps with :optimizations :whitespace (so that I don't have to include every single generated .js file in index.html)? All combinations I tried either generate absolute paths (which are useless when the stuff is served via ring) or relative paths which include the "resources/public" part.
13:11dnolenthe-kenny: i suppose what we need is a :source-map-path option
13:12the-kennydnolen: That would be a solution.
13:15the-kennyOkay, let's see if I can get leiningen's checkout feature to work with cljsbuild+clojurescript. Might be a worthy quest to get back into clojure(script)
13:17seangrovetechnomancy: That include LightTable?
13:19srrubyI tried using defrecord instead of maps and my code now fails in clojure.walk Any thoughts?
13:21dnolenthe-kenny: no need, ./script/build if all you want to do is use master
13:22i-blisdee5: ST cannot connect to a given port (no telnet support anymore) ; why not use emacs + cider/nrepl?
13:22the-kennydnolen: I want to add :source-map-path ;)
13:22dnolenthe-kenny: adding it now
13:23the-kennyaww you don't even give me the chance to do it!
13:23dnolenthe-kenny: :)
13:23the-kennyAnyway: Thanks :)
13:26dnolenthe-kenny: available in master
13:29the-kennyWohoo awesome :)
13:30the-kennyWorks nice
13:30dnolenthe-kenny: excellent
13:36fakedrakehello, i am trying to do `(-> 1 inc #(* % 2))' but if i do `(defn mul2 [x] (* x 2)) (-> 1 inc mul2)' it works, can someone explain this to me?
13:37fakedrakeah it just hit me what the documentation means by making it a list if it is not already
13:37fakedrakerubber duck debugging
13:39the-kennyfakedrake: -> is just a simple list manipulation. Your -> is equal to #( 1 * % s (inc 1))
13:39the-kennyeww no. Brain failure. It's equal to #((inc 1) * %)
13:59Raynesseangrove: Well, I don't think a lot of people are using light table, but not necessarily because it is proprietary.
13:59RaynesIIRC, Chris intends to open source it, potentially only keeping certain plugins closed source.
14:37francis_wolkednolen: Occasionally, when working with CLJS, I'll get an error like this: https://www.refheap.com/20960
14:37francis_wolkeIf I undo the changes 'responsible' and restart the cljsbuild process, the error persists.
14:37francis_wolkeTo fix this issue I am forced to comment out everything in the project excluding the ns forms and resart the cljsbuild process, which will begin to work again.
14:37francis_wolkeThoughts?
14:38technomancyseangrove: as far as I can tell there aren't many. maybe they are quiet.
14:38seangrovetechnomancy: I imagine there would be more of them in #clojure
14:38seangroveBut still, not many. Probably most interest comes from other, non-freenode devs
14:38dnolenfrancis_wolke: looks like a circular dependency issue to me
14:42francis_wolkednolen: Thanks.
14:42dnolenfrancis_wolke: http://dev.clojure.org/jira/browse/CLJS-684
14:43francis_wolkednolen: How do you deal with brepl instability when developing?
14:44dnolenfrancis_wolke: do you mean how it exits on errors?
14:45francis_wolkednolen: that and sometimes you cannot reconnect, even after restarting the application
14:45dnolenfrancis_wolke: haven't seen reconnection issues myself
14:45dnolenfrancis_wolke: you might want to take a look at cemerick's austin as well
14:46dnolenfrancis_wolke: patches also welcome, I've got plenty of things on my plate
14:47francis_wolkednolen: Adknowledged
14:52benediktI'm using lein droid and it has started a REPL on a certain port of my computer. How do i use Emacs to connect to the repl?
14:52benedikti've just used M-x nrepl-jack-in so far
14:53francis_wolkebenedikt: M-x nrepl
14:53benediktfrancis_wolke: well, that was simple
14:54mercwithamouthhi i'm trying to get clojurescript to work but for the last few days i've been stumped by this error https://www.refheap.com/03da750eb6e6a139b08b790b0
14:54mercwithamouthReflection warning, clojure/tools/reader/reader_types.clj:34:1 - reference to field get_file_name can't be resolved.
14:58benediktHow do i write this "(require '[clojure.data.json :as json])" in the namespace format?
14:58benedikt(ns projecte.core :require [ord.clojure/data.json "0.2.3" :as json]) doesn't work
14:59francis_wolkebenedikt: (ns projecte.core (:require [ord.clojure/data.json "0.2.3"
14:59francis_wolke :as json]))
15:00benediktfrancis_wolke: i just missed a parenthesis?
15:00francis_wolkebenedikt: Correct. You may find this tutorial: https://github.com/magomimmo/modern-cljs useful
15:00benedikt"java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.Named"
15:03francis_wolkebenedikt: Sorry, wasn't paying attention last time, but you don't include things that way in clojure. Your ns form should look like this: (ns projecte.core (:require [clojure.data.json :as json]))
15:03benediktfrancis_wolke: i had just figured that out :) this page is helpful http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
15:06benediktfrancis_wolke: "java.lang.Exception: lib names inside prefix lists must not contain periods" this happens when i git C-c C-c in emacs
15:07dnolenfrancis_wolke: circular dependencies now throw a sensible error in master instead of stack overflow
15:09mercwithamouthhas anyone gotten this error when trying to compile clojurescript? I seem to be the rare case Reflection warning, clojure/tools/reader/reader_types.clj:34:1 - reference to field get_file_name can't be resolved.
15:10francis_wolkednolen: You rock.
15:12benediktfrancis_wolke: solved it. i'm still wrpainng my head around the way you refer to other namespaces and import code
15:34the-kennyIs it me, or has the compilation speed of ClojureScript dropped massively since a few weeks/months ago?
15:34francis_wolkethe-kenny: Not just you.
15:36bbloomthe-kenny: i think dnolen improved incremetnal compilation at the cost of full recompilation
15:36dnolenbbloom: the-kenny: I have seen this at all
15:36dnolencompilation time is more or less unchanged
15:36dnolen"haven't seen"
15:37the-kennydnolen: Every change of a small test application takes about 12 seconds here
15:37the-kennywith :optimizations :whitespace
15:37dnolenthe-kenny: make sure you are using lein-cljsbuild 1.0.0-alpha2, also disable :source-maps, that'll never be fast with simple
15:38dnolener :source-map
15:38francis_wolkethe-kenny: What. I have .11 sec on a change w/whitespace
15:38francis_wolkealso, using source maps
15:38the-kennyfrancis_wolke: Ok, something is very wrong here
15:38francis_wolkethe-kenny: are you restarting the JVM each time?
15:39the-kennyNo, it's lein cljsbuild auto
15:39the-kennydnolen: No difference with or without source maps
15:39francis_wolkethe-kenny: Proof. https://www.refheap.com/20979
15:39dnolenthe-kenny: this sounds weird to me, and you are using alpha2 cljsbuild?
15:39the-kennyAh wait, successive compilations go down to about 7 seconds or so
15:40the-kennyDamn. I thought I was using alpha2
15:40the-kennyCopy/Paste Fail
15:40dnolenthe-kenny: ok good
15:40the-kennyOkay, please forget what I said. Trying again
15:41benediktif i declare a variable with def outside of all functions in core.clj
15:41benedikthow do i refer to it inside a function in the same namespace (and .clj file)
15:41benedikt?
15:41francis_wolkebenedikt: it's name.
15:42benedikti get a runtime exception when i do that
15:42benediktoh
15:42benediktnevermind, i never evaluated that line..
15:42benedikti'll go stand in the corner now.,
15:42the-kennydnolen: Okay, much better with alpa2, but I had to add an :exclusions entry for clojurescript
15:42the-kennyAbout 3 seconds now
15:42the-kenny(with source maps)
15:43dnolenthe-kenny: sounds more like it :)
16:03dnolenhrm, thinking about shortening the experimental ^not-native type-hint to ^clj and adding a ^clj-or-nil typehint
16:03dnolenand making it work on protocols
16:07dnolenthis would allow us to eliminate protocol overhead in many cases
17:15RaynesLazybot appears to have vanished.
17:16seangroveclojurebot: find lazybot
17:16clojurebotNo entiendo
17:16seangroveThe bots really need to be setup in a robin hood + john condition
17:17seangroveFriar tuck, actually, after looking it up
17:17seangrovehttp://www.netfunny.com/rhf/jokes/88q4/nonbook/secure.126.html
17:20birryreeHi everyone, I'm learning clojure and doing some exercises from Joy Of Clojure - I tried an example with anonymous functions and seeing different behavior if I use #() vs (fn), so I'm wondering if I'm just doing it wrong. Don't really know what I should be googling for: https://gist.github.com/birryree/7518985
17:21justin_s`(#()) is the equivalent of ((fn []))
17:21justin_s`you have them in different levels of nesting
17:22justin_s`so remove the extra () around (fn...) and your code will be fine
17:22llasramI don't think that's true..
17:22llasramI mean, that's some true, just not the last part :-)
17:22justin_s`wait
17:22justin_s`that wasn't the problem, you are right
17:22birryreeIf I do that, the arguments aren't passed, are they?
17:22justin_s`the problem is (x)
17:22llasramI don't see how this can match code -> exception
17:23llasramThe `fn` version is calling a function of 1 arg w/ 2 args
17:23birryreeSorry, I updated the gist, as I changed the example so that they both did the same thing.
17:23llasrambirryree: But if you did call w/ one arg, you'd get the exception you show, because
17:23llasramYou're passing it a number, then trying to call that number as a function
17:24justin_s`also you are passing two numbers, when it expects one callable
17:24justin_s`so the arity is wrong
17:24justin_s`birryree: they still don't do the same thing
17:25justin_s`one is only declaring a function
17:25justin_s`the other calls it
17:25birryreejustin_s`: So the #(/ 1 2) form doesn't actually call it yet?
17:25justin_s`nope, it just returns a function that will divide one by two when called with no args
17:25coventry,#(/ 1 2)
17:25clojurebot#<sandbox$eval29$fn__30 sandbox$eval29$fn__30@1930e3d>
17:26coventry,#((/ 1 2))
17:26clojurebot#<sandbox$eval59$fn__60 sandbox$eval59$fn__60@a03522>
17:26justin_s`,(#(/ 1 2))
17:26clojurebot1/2
17:26llasrambirryree: Exactly. In fact: ##`#(/ 1 2)
17:26lazybot⇒ (fn* [] (clojure.core// 1 2))
17:26coventry,(#(/ 1 2))
17:26clojurebot1/2
17:26llasrambirryree: What I wrote and coventry is (I think) trying to do shows what the #() syntax expands to
17:26llasramfn* is an internal thing, and there's the ns-expansion
17:27llasramBut it boils down to #(/ 1 2) <=> (fn [] (/ 1 2))
17:27llasramcoventry: BTW, nice meeting you at the Conj :-)
17:27justin_s`(fn [] (/ 1 2)) ~= #(/ 1 2)
17:27coventryYeah, you too, llasram.
17:28justin_s`or what llasram said
17:28birryreellasram: thanks, I was trying to figure out how to expand the @() when I ran into the problem. (fn [] (/ 1 2)) works as I expect it.
17:28birryreeTHanks too, justin_s`
17:29coventrybirryree: A typical way to get what you want in the second case is to do (defn throw-catch [f & args]) in the signature, then (apply f args) in place of (f), and (throw-catch (fn funcname [x y] (/ x y)) 1 2)
17:30birryreecoventry: thanks for that, I was also trying to determine how to do that. Guess I should definitely read more into the book rather than jump off rails. :)
17:59JaniczekIs there a way to hook (write-exception) from https://github.com/AvisoNovate/pretty (see the last image on that page) to lein repl?
18:10the-kennyHeh, some part of my code makes Clojurescript emit cljs.core.async.put_BANG_.call(null, dchan, java.util.Arrays.copyOf.call(null, rets, cnt));
18:20seangrovethe-kenny: Maybe old copy of core.async?
18:20coventryJaniczek: :repl-options can contain a :caught entry, which should be a function which takes an exception. That entry is passed to reply, which passes it to clojure.main/repl. I haven't experimented with this, just seen the source code for it.
18:21Janiczekcoventry: nice, I've read through sample.project.clj, but the :caught entry is not mentioned. I will try, thanks!
18:22the-kennyseangrove: yeah, seems like the bug was fixed on Oct. 09
18:23cYmenWhat happens if I try to call a function that has side effects from a function which I call with map?
18:24cYmenBecause I messed something up and now my side effects aren't happening.
18:24ksikkahey all - i'm starting to learn clojure mainly for the purposes of learning clojurescript. any tips on how i should start learning? i'm currently learning clojure and once i have a good handle on it i'll just switch to the clojurescript compiler. does this sound reasonable or do i have the wrong idea?
18:24the-kennycYmen: map returns a lazy seq. The returned sequence will be evaluated as needed (and maybe in chunks)
18:25the-kennycYmen: you likely want to wrap your map in a 'doall', or use doseq from the beginning (if you don't care about the results of the function calls)
18:25andyfcYmen: map is lazy, so the time when your side effects will occur is not in general easy to predict, unless you force it with something like doall
18:25cYmenthe-kenny: That would explain it. Is there something like an "(eager stuff)"? :)
18:25cYmenah doall...
18:25cYmensweet
18:26cYmenDamn, still doesn't work.
18:26andyfcYmen: Perhaps there are still problems in the rest of the "messed something up" actions you took :)
18:27cYmenpossibly :)
18:28cYmenah...everything was fine but apparently window coordinates include the title bar or something...just couldn't see where I am drawing
18:31logic_progdatomic and riak seem to be very different databases. why is mixing them a good idea? http://www.youtube.com/watch?v=FOQVWdG5e2s
18:32shaunxcodeit was implied on the mailing list there would be some pedestal ui related revelations at the conj... anyone have a synopsis?
18:36Janiczekcoventry: hmm, infinite wall of ArityException Wrong number of args (0) passed to: core$eval9107$fn ... I have :repl-options {:caught (fn [e] (io.aviso.exception/write-exception e))}. Maybe it wants it to be (fn [] ...) and for me to use the *e which holds the last exception? I don't really know, because I can't find :caught anywhere in leiningen repo on
18:36Janiczekgithub
18:38danneuI feel like we should have to either always ^{:doc _}, or always have a docstring? arg from clojure.core defs
18:38JaniczekSelf-answer: Yes it does (the (fn [] ...) solution)
18:38coventryJaniczek: No, it's not mentioned in leiningen, but :repl-options is passed to reply. See leiningen.repl/options-for-reply and reply.main.
18:40Janiczekmhm, [reply "0.3.0"] ... I see now
18:44Janiczekso, the way this works is http://cl.ly/image/0t2A0L0F1v1T ... maybe I could make lein plugin out of it?
18:45coventryNice!
18:46fakedrakehello
18:47fakedrakeIs there a better way to do the opposite of `some' than `(or (fn1 x) (fn2 x) (fn3 x) ...)'?
18:49metellusI can't think of a single command but (not (some ..)) would work, right?
18:49fakedrakehmm, my phrasing was bad i gue
18:50Janiczek"some other way to do `some`"? :)
18:50fakedrakeIs there a more elegant way to do (or (fn1 x) (fn2 x) ...)?
18:51metellusoh, that.
18:51metellusevery-pred
18:51coventry(doc some-fn)
18:51clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates."
18:51metellusnot every-pred either. that would be for and instead of or
18:52Janiczekso that would be ((some-fn fn1 fn2 ...) x)
18:53fakedrakeyay some-fn was it!
18:53fakedrakethanx
19:00ksikkahey all - i'm starting to learn clojure mainly for the purposes of learning clojurescript. any tips on how i should start learning? i'm currently learning clojure and once i have a good handle on it i'll just switch to the clojurescript compiler. does this sound reasonable or do i have the wrong idea?
19:03logic_prog_if I am using datomic pro starter, I am limited to 2 transactors. Am I allowed to fire up _multiple datomic instances, which do not comunicate with each other -- each with 2 transactors_ ? (I.e. imagine that I have a system that embrassingly paralllelizes into 50 "nodes" -- and I need a datomic instance for each node, but I don't need any transactions across nodes)
19:06bitemyapplogic_prog_: presumably.
19:06bitemyappyou can't make that work the way you're thinking though.
19:06bitemyappdatomic doesn't have cross-database replication.
19:15coventryWhat's the latest and greatest in clojure test-coverage measurement tools?
19:23JaniczekWhen I develop leiningen plugin, how do I test it? (It's just middleware, no tasks or hooks.) lein repl doesn't seem to put it into action.
19:24amalloyJaniczek: i think lein pprint shows you the post-middleware project map
19:26seangroveAh, this looks perfect https://github.com/emacsmirror/org-sync
19:27scottjksikka: clojurebook.com
19:29bitemyappseangrove: that looks pretty cool @ org-sync.
19:29bitemyappcoventry: all I'm aware of is cloverage. There are lists for such things.
19:29scottjlogic_prog_: the limit is 2 peers, not transactors (only one).
19:29bitemyappcoventry: I need a coverage tester that breaks your code and lets you know when none of your tests break as a result of the broken code.
19:29Janiczekamalloy: does that actually try to *use* the plugin? or should I be in other project having this one as in :plugins? (if yes, how is it going to find it if it's not on clojars etc? I don't have local maven and I'm bad at classpaths ... :) )
19:30bitemyappscottj: he understands that, he's trying, misguidedly, to sidestep the limit.
19:30bitemyappcoventry: this existed for Ruby, but I don't know of an equivalent for Clojure.
19:30coventrybitemyapp: What do you mean by "breaks your code"?
19:30`cbpi was considering that as a project but it sounded scary
19:31`cbplike heckle for ruby
19:31bitemyappcoventry: it breaks your shit and lets you know when your test coverage sucks.
19:32bitemyappI don't know what you're asking here, it can do anything it wants, like (assert false) or (throw (Exception. "Fuck yo code son"))
19:32bitemyapp`cbp: I don't think it'd be that hard, only reason I haven't implemented it is because I was sure it already existed.
19:32bitemyapp`cbp: I think it'd be easier than Revise was.
19:32bitemyappeasier and less laborious.
19:33coventrybitemyapp: Gotcha. Wow. Sounds computationally intensive if you want to check coverage of your entire codebase.
19:33`cbpi meant scary in the sense that it sounds dangerous
19:33bitemyappsome tricky parts maybe, but I don't think it'd be that bad.
19:33bitemyappcoventry: meh. I don't really think your code has been tested properly until it's been put through one of those at least once :P
19:33coventryI've been looking at cloverage. I think its macroexpansion is inaccurate. It appears to have the same problem as clojure.walk/macroexpand-all's.
19:34bitemyappI don't really believe in 1:1 test coverage for all functions, but something like Heckle is fuckin' awesome.
19:35coventrybitemyapp: Isn't it the same thing as checking whether every line of code gets exercised, except you have to run your entire suite for each line of code to get full information?
19:42bitemyappcoventry: the problem is things that check it statically don't cover everything
19:43coventryNo, but invasive instrumentation like cloverage's ought to.
19:43JaniczekHow do I create the directory structure the :repositories in Leiningen needs? Doing :repositories [["my-local" "file:///Users/test/Localhost/lein-prettyex"]], where that URL is to a project directory, doesn't fool the Leiningen. Do I need to somehow "deploy" it?
19:45Janiczek(I don't have maven installed, hoping to manage without it)
19:51Evelynnanyone wanna see my cam? http://instaflurt.com/evelyne92/
20:11logic_progI have a public announcement. sourcemaps = fucking awesome
20:23seangroveCool to hear, things are coming together for cljs, bit by bit
20:25seangroveSource maps don't work for incremental compiliation, right?
20:30xuserseangrove: can you get away with no JS?
20:31seangrovexuser: ? In what send?
20:31seangrovesense*
20:32xuserseangrove: Like are you being able to write your projects in full cljs or do you need to get down to JS in some parts?
20:32seangrovexuser: Haven't had to write any native js for awhile, but it's extremely important to have a good grasp of js first
20:33seangroveLike the early day for compilers for other languages, I suppose
20:34xuserseangrove: you don't find yourself reinventing the wheel much?
20:35seangrovexuser: Not really these days. I make heavy use of the closure lib obviously, and a few foreigh-libs
20:35seangrovexuser: Any area you're concerned about re-inventing specifically?
20:35xuserseangrove: the closure lib handles browser incompabilities?
20:36seangrovexuser: Yes, very well. It is google's main js library after all
20:36seangroveI imagine some other frameworks could be difficult to interop with, see lynaghk's (successful) experience with angular, and maybe something like react.js
20:37hammerandtongsany experiences with three.js so far?
20:38xuserseangrove: do you simulate angular's two way data-binding in cljs?
20:39seangrovexuser: No, I would have to think of the right way to do that. I haven't given it enough thought on how to do it smoothly.
20:42xuserseangrove: cool, I heard google is lowering resources on closure because of dart, you know if that's true?
20:43seangrovexuser: Nope, I've no idea. Would make sense either way. ClojureScript isn't permanently stuck to google's closure, but it's tied very closed to it right now
20:43xusergoogle is not listing it here anymore: https://developers.google.com/chrome/
20:43seangroveI wonder how they bootstrap the runtime for dartjs
20:43xuserlike is hard to find through menus
20:44seangroveWas it ever there?
20:44seangroveIt's not really related to chrome
20:44xuserwell, that's not really chrome but google web dev tools
20:44seangroveThat said, I could uderstand them moving away from closure
20:44xuserhttps://developers.google.com/products/
20:47xuserseangrove: yeah, it would make sense for them to move on I guess
20:48xuserseangrove: do you make heavy use of core.async in cljs?
20:48seangrovexuser: I don't know about 'heavy', but it's certainly prevalent
20:49xuserok, no more annoying questions ;) thanks
20:50seangrovexuser: No worries, questions are certainly welcome
20:50xuser;)
21:29seangrove,(keyword nil)
21:29clojurebotnil
21:29seangrovein cljs: (keyword nil)
21:29seangrove:
21:29seangrovenil
21:30seangrove,(type (keyword nil))
21:30clojurebotnil
21:30seangrovednolen: Looks like (type (keyword nil)) in cljs is cljs.core/Keyword. Worth opening a bug?
21:31logic_progwhat is the difference between xyz and #'xyz ?
21:32seangrovevar?
21:32seangroveGot to teach clojurebot that, it's a pretty common question...
21:33seangrovelogic_prog: Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around
21:33seangroveWhenever a reference is dereferenced, the current value is returned
21:34logic_proggiven that clojure values are immutable, why does this matter?
21:34seangroveIt allows you do do things like dynamically updating code in the repl, etc.
21:34seangroveNot everything is immutable, of course
21:34seangrove(def x 10) (def x 20)
21:34logic_progah, this is stuffed in ring
21:34logic_progso I can redefine my routes
21:34logic_progthis makes sense now :-)
21:34seangroveYeah, and you see it other places, but that's a common one
21:34seangroveGood stuff
21:34logic_prog(ring/blahblahblah/site #'all-routes)
21:35seangroveYup, see that a lot
21:35logic_progthus, if I redefine all-routes, ring "auto updates to use the latest all-routes" right?
21:35logic_progcool, thanks :-)
21:35seangroveExactly
21:36seangroveclojurebot: var is Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around. Whenever a reference is dereferenced, the current value is returned. It allows you do do things like dynamically updating code in the repl, change your ring routes, etc.
21:36clojurebotYou don't have to tell me twice.
21:36seangrovevar?
21:36clojurebotvar is Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around. Whenever a reference is dereferenced, the current value is returned. It allows you do do things like dynamically updating code in the repl, change your ring routes, etc.
21:36seangrovebotsnack
21:36seangroveclojurebot: botsnack
21:36clojurebotthanks; that was delicious. (nom nom nom)
21:38xuserseangrove: looks like the closure library doesn't have much to envy from jquery
21:39seangrovexuser: No, especially with dommy. It handles the jquery-basics stuff brilliantly
21:40seangroveFor jquery-ui and whatnot, probably best to go with closure, but dommy is a wonderfully sane and polished dom manipulation and templating library
21:41xusercool
21:42xuserseangrove: so using the closure library api is pretty straightforward from cljs right?
21:43seangrovexuser: Well... what area are you thinking about specifically?
21:43seangroveIt's a ridiculously imperative design, and that causes frustration sometimes, but overall once you get used to their patterns, it's very nice to use
21:43seangroveEventually libraries will more or less replace it, I think
21:44xuserwas of thinking of this http://docs.closure-library.googlecode.com/git/index.html
21:44xuserI see, doesn't sound that bad ;)
21:47seangrovexuser: The ui elements are atrociously difficult to get started with, and again, ridiculously imperative
21:47seangroveBut everything else is pretty straightforward and nice
22:24abaranoskyhas anyone noticed nrepl not being able to connect to the local nrepl server?
22:24abaranoskyit seems to start the server fine, but then hangs on "conencting to local ... server at localhost:12345"
22:27bitemyappabaranosky: are you using nrepl-jack-in?
22:30abaranoskybitemyapp: yeah...I just spent a bunch of time changing my emacs configuration to work across multiple machines (via Dropbox) and I might have borked something... *or* the package manager pulled down a newer buggy version of the nrepl package
22:31abaranoskyI was avoiding upgrading to CIDER for the moment, becuase I heard it wasn't 100% ready for prime time
22:31bitemyappabaranosky: don't do that via Dropbox :(
22:32bitemyappabaranosky: you need version control yo.
22:32bitemyappabaranosky: https://github.com/bitemyapp/dotfiles I use my dotfiles across multiple macs and linux machines.
22:32abaranoskybitemyapp: I push a version to github periodicly, but like the autosyncing
22:33abaranoskyits a lisp... ergo, can't be any bugs
22:33bitemyappwell regardless, I have a setup that works on Mac and Linux for a variety of programming languages + Emacs
22:33abaranoskylet me see urs... checking for any discrepancies
22:34abaranoskybitemyapp: nrepl is having this problem on both machines I run on one OSX one Linux
22:36bitemyappabaranosky: git diff
22:37abaranoskybitemyapp: yep... it may come to that... because when I think about it, there's not alot of good reasons that this would occur other than a bug
22:41aaelonydoes Cheshire's parsed-seq support keywordizing the resulting keys? Looking for the option that would ensure {"a" "1"} becomes {:a 1} instead of {"a" 1}
22:42abaranoskyaaelony: when in doubt M-. in and see
22:44aaelony19:44 abaranosky: didn't know about M-. will check that out
22:45abaranoskyaaelony: if ur connected to an NRepl server in Emacs... C-c M-j
22:45abaranoskycompile with C-c C-k and then you can click-through any symbol with M-.
22:45abaranoskythen pop the stack with M-,
22:47aaelonyabaranosky: I'm using nrepl. M-. presents me with prompt Symbol:
22:47abaranoskyweird. :(
22:48aaelonyabaranosky: yeah, not sure how to answer that...
22:48abaranoskyit isn't normal .. I' used M-. all the time, and never have I seen that
22:50aaelonyabaranosky: I must be doing something wrong. Nevertheless, the Cheshire doc suggests keywordizing is supported, but I don't see it say how... ;; parse a stream lazily (keywords option also supported)
22:52abaranoskyaaelony: (cheshire.core/decode "{\"foo\": 1}" keyword)
22:53aaelonyabaranosky: wow, thanks!! I must have tried everything but :)
22:54abaranoskyaaelony: np :)
23:04justin_smithI think with chesire/decode true means create a keyword and anything else is a function to call on keys
23:05justin_smithiirc
23:27abaranoskybitemyapp: I upgraded to CIDER and its working now. seems like some bug was hiding in the ewer nrepl
23:27abaranoskyor at least in how it interacted with my other packages
23:28Platzanyone read the 'functional programming for the object oriented developer' book?
23:39SeanCorfieldmarick's book? i've read bits of it... i think it's a good approach (and it's a reasonable price)
23:43Platzyeah - great price. I'm using it to introduce clojure to myself, beyond just understanding the syntax
23:44Platzwill see how it goes