#clojure log - Dec 03 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

1:04 arohner: why does lein2 call lein deps on every lein command?

1:04 seangrove: ?anyone

1:04 clojurebot: ping

1:04 clojurebot: PONG!

1:04 seangrove: clojurebot: ?anyone

1:04 clojurebot: Pardon?

1:04 seangrove: ffs

1:04 anyone?

1:04 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

1:05 muhoo: arohner: just in case something changed?

1:05 arohner: muhoo: it's not helpful when I *know* nothing has changed :-)

1:06 seangrove: arohner: That wasn't for you, just a demonstration for a friend, sorry ;)

1:07 muhoo: well you know, and i know, but it doesn't know. i've seen this in makefiles for years. it's checking stuff it doesn't need to check, because it's in its list of dependent tasks. but if it's annoying, maybe ask technomancy if there's some reason it can't be optional

1:08 arohner: just saving the last time a deps was run, and looking at project.clj modification time would be a big win

1:09 seangrove: hey sean, how's it going?

1:10 seangrove: Good, good, almost finished about ~50% of the frontend re-write in cljs/closure

1:10 arohner: wow! cool

1:10 seangrove: Closure has been by far the biggest bastard, but coming to grips with it now

1:10 We should grab drinks soon, again

1:10 arohner: yes

1:10 seangrove: With you non-drinking friend :)

1:11 arohner: :-)

1:12 I'm porting lein plugins to lein2

1:12 muhoo: arohner: sounds like maybe worth opening an issue for, and see if he'll take a patch to do that.

1:14 Raynes: arohner: Pretty sure it does that because it used to do the other thing and it was horrible.

1:14 Also, I'm pretty sure with aether it takes all of about a nanosecond to do it.

1:15 arohner: Raynes: and wasting a minute of my time on every lein command isn't horrible?

1:15 Raynes: I'm pretty sure it isn't wasting a minute of your time.

1:15 If it is taking a minute on the deps command on each lein call, open an issue cause that is definitely a bug.

1:19 arohner: `time lein2 help` takes 4 seconds. `time lein2 run -m clojure.core/println` takes 10s

1:19 it's definitely hitting the internet, I see a whole bunch of "cannot find artifact foo in central; cannot find artifact foo in clojars; cannot find artifact ..."

1:29 Raynes: arohner: I expect your problem is those snapshots.

1:29 But we'll see what technopants says.

1:29 :p

1:29 arohner: yes, it is

1:29 I've :excluded the first one, and things got faster

1:29 tracking down the second

1:35 Raynes: arohner: Looks like you can use the offline profile to prevent network access.

1:35 Might help for now.

1:36 lein with-profile offline whatevers

1:38 arohner: Raynes: thanks. :excluding solved all my issues

2:21 abp: A route of a web app is only a publisher of request data on that routes channel. So I need built in messaging and will get web app boilerplate as a byproduct.

3:14 wei_: what's the best way to serialize dates from clojure to clojurescript? implementation detail: I'm using fetch.

3:15 bbloom: wei_: what's fetch?

3:15 wei_: a Chris Granger production, https://github.com/ibdknox/fetch

3:15 abp: bbloom, wei_ fetch does what you asked for.

3:16 bbloom: wei_: if it's fetching EDN, then i suspect that #inst should be implemented or easily added

3:16 wei_: really. I guess I assumed it wouldn't work for dates since I get "Unreadable Form" on the js side when reading ObjectIds

3:16 clojurebot: dnolen: well feel free to throw some more in and send me a pull request. The format is pretty general

3:19 wei_: could you point me to an example of extending the reader in clojurescirpt?

3:20 bbloom: wei_: it's already extended for dates: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/tagged_literals.clj#L18

3:20 er well that's clojure, not clojurescript

3:21 wei_: it looks like clojurescript

3:21 thanks. I'd like to extend it for mongodb's ObjectIds.

3:21 bbloom: wei_: here's the cljs version https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs#L526

3:22 use register-tag-parser!

3:22 wei_: aha, perfect.

3:27 what about an example of extending the writer so that pr-str prints it correctly? e.g. #ObjectId "50b75c1d3004517be15e5301" instead of #<ObjectId 50b75c1d3004517be15e5301>

3:27 bbloom: wei_: search core.cljs for #inst

3:27 tomoj: that works in cljs, what about clj?

3:28 bbloom: tomoj: it's the same thing either which way, you just provide an implementation of the print protocol

3:28 tomoj: there's a print protocol in clj?

3:29 oh print-method maybe?

3:29 wei_: aha print-method

4:04 tomoj: anyone gotten clojurescript-mode to indent catch* like catch?

4:06 oh, (put-clojure-indent 'catch* 1)

4:20 sans: !lista

5:31 nicl: hey, wondering what is the best way to check if a map contains multiple keys

5:31 (rather than multiple contains?)

5:32 I guess I could write a helper function if something in core doesn't already do this

5:33 llasram: &(let [m {:foo 0, :bar 1}] (every? (partial contains? m) [:foo :bar]))

5:33 lazybot: ⇒ true

5:33 clgv: nicl: you could build something with `select-keys` but it wont be faster than `contains?`

5:35 nicl: llasram: thanks

5:35 clgv: ok, thanks

5:37 mpenet: nicl: or juxt

5:37 but same issue as select-keys I guess

5:39 ucb: anybody going to the clojure london meetup tomorrow evening?

5:39 augustl: ucb: got a link? Going to techmesh, and got nothing planned for the evenings

5:40 ucb: augustl: I'm going to techmesh too \o/

5:40 augustl: \o/

7:08 murphy_: good morning - is anyone in here right now ?

7:09 andrewmcveigh: sort of.

7:10 ambrosebs: :)

7:10 murphy_: haha good morning

7:11 I've eeb going through the 4clojure questions and occasionally running into sigils I don't understand

7:12 one of the solutions i saw had fn[c _] as its function header(?) what does the "_" mean ?

7:12 doing a doc "_" returns nil , and googling won't be of much use

7:12 vijaykiran: _ = don't care :)

7:12 "In Clojure, the underscore is used idiomatically to indicate that the argument it identifies is not subsequently used."

7:12 murphy_: hahahahah ok

7:12 that's fair enough

7:12 vijaykiran: btw, you can google for "clojure underscore" ;)

7:14 murphy_: ah, I could.

7:14 I wasn't sure if that would really return what I needed. It's still early!

7:14 :)

8:00 oskar_: Let's say I have this marcro. (defmacro somemacro [] (defn somefn [a b] (a b))) It does not work because a and b can not be qualified. Should I simply use a# and b# or what?

8:01 ops

8:02 forgot the ` before (defn ...)

8:02 (in the example)

8:05 andrewmcveigh: oskar_: Yeah, you can do that.

8:06 oskar_: andrewmcveigh, is there any alternatives? :P

8:06 are*

8:06 :P

8:08 andrewmcveigh: oskar_: you can do something like `(defn somefn [~'a ~'b] (~'a ~'b)), but I don't really know if that's a good idea (I'm no macro expert).

8:08 oskar_: I see

8:08 andrewmcveigh: Is there a reason you don't want to use a# ?

8:08 oskar_: No :P

8:09 Just wanna know what's idiomatic

8:10 clgv: oskar_: usually you shoud use a gensym like a#

8:12 oskar_: you can modify what's displayed in the docs via metadata `(defn ~'somefn ^{:arglists '([a b])} [a# b#] (+ a# b#))

8:12 oskar_: clgv, yeah I know what gensyms are for, but my example is not a typical gensym usecase

8:13 clgv btw what's the reason u did ~'somefn just now? does it really matter?

8:13 clgv: oskar_: huh why? it is a macro where you want to use localbindings - so pretty typical usecase for those gensyms ;)

8:14 oskar_: clgv maybe I'm wrong, but i said it was not a typical usecase because they are not really needed, because there are ~' too

8:15 clgv: oskar_: ~' adds a lot of noise

8:16 oskar_: yeah mayben

8:17 clgv but (as i asked above) coulnt u skip ~' for the function name?

8:17 clgv: oskar_: seems that you can. I thought `defn` would not like a fullqualified symbol as its name - but I just tried and it worked

8:17 oskar_: ok ;)

8:23 clgv: oskar_: oh but you can't omit then ~' anyway. try to call that macro in adifferent namespace and you'll see

8:23 oskar_: clgv, ah ok, thanks

8:25 gauravag: is there a easy way to setup lein in windows?

8:25 an*

8:33 abp: gauravag https://raw.github.com/technomancy/leiningen/preview/bin/lein.bat

8:34 gauravag, I usually put wget next to it

8:36 gauravag: all right..

8:36 abp thank you

8:38 oskar_: I've noticed some problems with lein.bat (not sure which version) like it did not work if the path contained spaces

8:45 hyPiRion: oskar_: Try wrapping the path with ""s

8:45 Though it's been years since I've used Windows, so I may be mistaken. Worth a try at least.

8:55 oskar_: hyPiRion, I mean the path where lein is

8:55 just running "lein" would fail

9:06 gauravag: I guess the easiest way was to install chocolatey in windows! :D

9:10 sergey`: hey there

9:16 gauravag: hello sergey`

9:33 gunjibee: is there a better way to find if a map has all keys in a list than: (every? #(contains? mp %) kys))

9:35 andrewmcveigh: &(= (keys {:a 0 :b 1}) '(:a :b))

9:35 lazybot: ⇒ true

9:37 pyrtsa: Just (every? mp kys)

9:38 andrewmcveigh: gunjibee: pyrtsa's is better.

9:40 pyrtsa: Indeed.

9:40 &(= (keys {:a 0 :b 1}) '(:b :a))

9:40 lazybot: ⇒ false

9:40 andrewmcveigh: yeah, didn't think about that first off.

9:42 oskar_: but gunjibee's is best if the vals can be nil and false

9:42 pyrtsa: True!

9:43 oskar_: and you shouldn't have functions that make assumptions about the environment, that's complecting!

9:46 gunjibee: thx for the help

9:52 hcumberdale: Hi ;)

9:53 I store a lot of files on my file-system. Now I need to assign meta-information to them. What's a good way to do it?

9:53 A database may be a solution. SQL is okay with sqlkorma

9:54 nDuff: hcumberdale: POSIX xattrs is probably the canonical thing.

9:54 hcumberdale: that way the metadata lives/moves with the files.

9:54 hcumberdale: But a database is another dependency ;(

9:54 nDuff: hcumberdale: ...if your operating system supports them, of course. What are you running?

9:54 hcumberdale: nDuff: is POSIX xattrs supported on linux&windows?

9:55 nDuff: Modern Linux filesystems, yes. Windows, not so much; though Microsoft had plans to implement something similar but incompatible, I don't know that they ever went through.

9:55 hcumberdale: nDuff: I've the free choise but the resulting software should be as portable as possible

9:55 nDuff: (that was one of the headline features of their "Cairo" project)

9:55 ...if I'm not confusing them. *shrug*.

9:55 hcumberdale: NoSQL may be a solution, but again another dependency. No single backup point like in the file system

9:56 nDuff: "NoSQL" is a buzzword, not a solution. :)

9:56 hcumberdale: nDuff: i meant mongodb or redis

9:56 thx

9:56 nDuff: ...which are dramatically different datastores with dramatically different semantics

9:56 lumping them under one name is silly.

9:57 hcumberdale: What I need is a lot of Information attached to the documents

9:57 Is there a way to stay with the file system?

9:58 nDuff: *shrug*. MacOS has given you that for ages (resource forks); Linux and modern UNIXlikes have given you that for a long time (POSIX xattrs)... but if you want to know what the state of the art is on Windows, you'll have to go find someone who knows Windows to ask.

9:58 ##windows, perhaps?

9:58 hcumberdale: MacOS is bad, because apple hates your freedom

9:58 * nDuff does an eyeroll

9:58 nDuff: Apple doesn't hate freedom; they're just rent-seeking and don't actively think about freedoms.

9:59 cemerick: NTFS (and probably FAT, too, with certain limits) supports xattrs

9:59 though obviously not POSIX variety

9:59 see: cygwin? :-P

10:00 nDuff: Ahh; cute. (http://en.wikipedia.org/wiki/Extended_file_attributes#Windows_NT)

10:01 Ugh, though -- the BackupRead and BackupWrite syscalls used to access that information are privileged-access-only

10:01 ...and I gather that what they handle and return is an opaque blob not intended to be open to parsing and modification

10:03 cemerick: nDuff: ha-ha: "Since OS X 10.6, user space extended attributes are not preserved on save in common Cocoa applications (TextEdit, Preview etc.)"

10:03 That's amazing.

10:04 hcumberdale: What's Cocoa?

10:04 cemerick: The app framework all Apple apps are written in.

10:04 Finder, Preview, XCode, iTunes, Safari, etc.

10:05 hcumberdale: cemerick: do you use a apple device?

10:05 cemerick: s/all/most

10:05 Yeah.

10:05 This particular device is called a 'laptop', I think. ;-P

10:05 hcumberdale: No iphone?

10:05 * nDuff ponders the level of topic-drift

10:06 hcumberdale: I thought about buying a new notebook. The apple laptops are very good, hard to find something comparable

10:06 But writing free software on an unfree system feels bad

10:07 mpenet: hcumberdale: almost 100% of laptops are unfree

10:07 the few that arent seems to have poor specs

10:08 hcumberdale: mpenet: depending on what parts you mean. There is a lot unfree firmware

10:08 mpenet: but still, I don't like apple hw

10:08 hcumberdale: But a whole unfree operating system ;(

10:08 mpenet: true

10:09 hcumberdale: I can't find any alternative :( Maybe Samsung is building Laptops with hd display and more than 4gb ram next year

10:11 mpenet: ram is extremely cheap anyway

10:11 I paid 30$ for 8gb upgrade a couple of days ago

10:12 cemerick: hcumberdale: No, I quite dislike iphones. I won an ipad in a contest some years ago, which I sometimes browse the web on.

10:12 hcumberdale: mpenet: samsung series 9 are only 4GB !soldered on mainboard!

10:12 cemerick: still using mac os x? Or moved to linux?

10:13 cemerick: OS X. Linux still appears to be in shambles for anything other than headless servers.

10:13 mpenet: hcumberdale: well, that sucks, I wouldn't buy that then

10:13 hcumberdale: Why the hell do apple/samsung solder ram to their mainbaords?

10:14 mpenet: hcumberdale: go lenovo, and you get a half decent keyboard with it

10:14 cemerick: Depending on how badly apple screws things up in the near future, I may or may not take a flyer on Windows 8.

10:14 mpenet: and everything is upgradable (I hope it's still the case)

10:14 pyr: hcumberdale: cheaper design, you get to buy a new box in 2 years: WINWIN (or is it ? :))

10:14 hcumberdale: mpenet: with crappy displays, more weight, ...

10:14 pyr: the new dells (xps14 & friends) look alright

10:14 mpenet: hcumberdale: if you stare at emacs all day I dont think having retina style display makes a diff

10:15 hcumberdale: cemerick: I use gnu/linux (gentoo | ubuntu) & i3.

10:15 I like that things are so simple there

10:15 alexnixon: I'm having trouble with laziness - specifically, producing a one-at-a-time lazy sequence (i.e. one which doesn't look ahead). Any ideas? https://www.refheap.com/paste/7243

10:15 mpenet: pyr: the new dells look ok, a bit worried about quality though

10:16 cemerick: hcumberdale: Sounds nice. I like binaries, and never having to twiddle system level stuff I don't care about. :-)

10:16 hcumberdale: pyr: I also thought about the XPS. But terrible displays too. And the overall quality

10:17 cemerick: me2. I just don't like to politics of apple (screws, screwed up people,...)

10:17 Tested XPS13, MacBook, Asus Zenbook and Samsung Series 9,... have to buy a new laptop in JAN/FEB.

10:18 Nothing is comparable to S9 & MacBook

10:18 I'm not willing to buy S9 with soldered 4GB ram and I'm not going to buy a MacBook because it is from apple ;(

10:21 alexnixon: tired to replace promise with future?

10:22 alexnixon: hcumberdale: this is a minimal example to illustrate my problem - my application needs it to be a promise

10:22 cemerick: alexnixon: mapcat is chunking, which you almost always do want. https://gist.github.com/4195657

10:26 alexnixon: cemerick: I thought I'd checked that already and was still confused (having read http://clojurian.blogspot.co.uk/2012/11/beware-of-mapcat.html)

10:27 cemerick: turns out I had a typo in my experiments. Thanks!

10:27 cemerick: Yeah, chunking is one of the most mysterious corners of Clojure.

10:28 alexnixon: (incidentally, are there any other chunking seq functions in core to beware of?)

10:29 hcumberdale: alexnixon: thx, that is new to me

10:35 How to ensure parallel writes to the same file will not end up in a corrupted file?

10:35 Like 10 instances of my application writing on a file on NFS

10:36 Mr_Bond: hcumberdale: it's usually done with file-locking. Also rename(2) is atomical.

10:36 or a mutex

10:36 but file-locking is still a good idea

10:37 hcumberdale: Mr_Bond: but a mutex isn't shared by my applications

10:37 and file-locking may rise some issues. Remembering JDK does not handle locks very well

10:38 JDK meaning Sun/Oracle Java Runtime

10:38 Mr_Bond: you could use IPC, and have a seperate file-writing process

10:39 or each process could write it's own log, and have housekeeping process to combine them into one file/log

10:39 hcumberdale: IPC to share the mutex and having only one process writing the file...

10:40 Mr_Bond: message-queue is also possible

10:49 hcumberdale: Mr_Bond: what format would you recommend to store clojure data structures?

10:50 Mr_Bond: I don't know specific about clojure, but I often use json for serialization

10:50 hcumberdale: Even when you write to disk?

10:51 antoineB: hello, is it possible to have two protocols that as the same function name? and does it make sense?

10:52 Mr_Bond: hcumberdale: yes

10:52 HolyJak: antoineB: yes, you can do that. If they are in 2 different namespaces, you will even be able to implement both with the same record/...

10:52 antoineB: ok

10:52 HolyJak: since the names belong into the namespace of the protocol

10:55 antoineB: i have a (defprotocol ITranslatable (move-to [this x y])) and another (defprotocol IDonkey (attach-stuff [this stuff))

10:56 i have a type that use both of this protocol, and because it use IDonkey i will modifiate the behavior of move-to (not only moving the object but also moving the stuff attached)

10:57 does it make more sense to do (defprotocol IDonkey (attach-stuff [this stuff]) (move-to [this])) ?

10:59 clgv: antoineB: you could try it like that. if it does not fit it is easy to factor out the ITranslatable protocol again

11:00 hcumberdale: When I want to write an abstraction against my datastore, I'll use interfaces in java. What is the way in Clojure to deal with it? Protocols?

11:00 Or is it a bad idea to build such modules in clojure?

11:01 clgv: hcumberdale: if you need types and/or records, it's protocols

11:01 hcumberdale: clgv: I don't need types or records

11:01 clgv: hcumberdale: so where does the interface/protocol come from?

11:02 hcumberdale: clgv: What's the best way in clojure to describe it?

11:03 clgv: hcumberdale: what exactly do you mean by "When I want to write an abstraction against my datastore"?

11:03 hcumberdale: clgv: I want to implementation to work like plug&play.

11:03 oskar_: I have this macro https://gist.github.com/4195917 and I hope you see what I'm trying to do. The problem is that the `sub# etc is not the same as the other sub#'s. What is the best way to solve this? Maybe I need to use gensym somehow?

11:04 hcumberdale: In Java&Spring I can use interfaces and IoC wiring with spring

11:04 antoineB: clgv: i will use the 2 protocols solution, but the thing that using IDonkey imply modifying move-to implementation is programmer carry

11:04 hcumberdale: So to store things in a database, the filesystem or mongodb is just a property in the spring configuration file

11:04 I you provide an implementation for all these stores

11:05 clgv: hcumberdale: in clojure you can just pass along functions. so you could have the fullqualified variable symbol in the configuration

11:06 hcumberdale: clgv: not sure what that means regarding my implementation

11:06 clgv: hcumberdale: if you really need something that implements a given java interface for interop with a java lib, then you can use deftype, defrecord, reify, gen-class to implement that interface

11:07 hcumberdale: clgv: I do not want or need java interop

11:07 I just want a similar behaviour when it is about 'building modules'

11:08 antoineB: hcumberdale: (defprotocol IStore (store [db data]) (restore [db name])) ?

11:08 clgv: hcumberdale: e.g. config "my.storage = my.project.storage/store" - after reading the config you can load that namespace and resolve the function and use it

11:09 hcumberdale: ahh!

11:09 clgv: hcumberdale: if you want a some artifact that stores a database connection for several oprations you would go for defprotocol and deftype/defrecord

11:09 hcumberdale: how to load the namespace?

11:10 clgv: `require` loads the namespace, `resolve` gets you the variable

11:11 hcumberdale: clgv: that means that there is no 'rule'/'specification' what methods should be implemented? They are just dynamicly resolved after loading the namespace?

11:11 antoineB: clgv: (ns some.name (:use other.name [specific-db-store :as store]) is that you mean for hcumberdale?

11:12 hcumberdale: antoineB: that would not work because it is at the beginning of the file and configuration files have to be parsed before

11:12 clgv: hcumberdale: it is one way. I use it for an experiment framework which has a configuration DSL. it might not be optimal for you. that depends on your requirements....

11:13 antoineB: hcumberdale: you can probable modify the *ns* map on rutime

11:13 *probably

11:13 clgv: antoineB: that sounds very hacky

11:13 antoineB: yes

11:15 clgv: hcumberdale: if you just want different operations that belong together semantically, you can go for a protocol as well. thats very similar to the interface approach from java that you mentioned

11:25 dribnet: question: is there a way to crawl all namespaces + public vars and return the result in a clojure data structure?

11:25 cemerick: dribnet: all-ns + ns-publics

11:34 piranha: hm, how do I publish ClojureScript library on clojars properly? I did publish my library, which uses lein-cljsbuild to build, to clojars, and added it to dependencies of an app, but it is not included in resulting js-file when I build my app

11:37 mpenet: I don't think there's anything special to do, are both projects public?

11:38 piranha: mpenet: yes

11:38 mpenet: piranha: if you are "testing" that, and you are compiling in adv mode and not actually using your lib, it wont show in the js app

11:39 piranha: can you show me where they are?

11:39 piranha: yes

11:39 https://github.com/piranha/mesto/blob/master/project.clj

11:39 here is project.clj of a library

11:39 here it is on clojars: https://clojars.org/solovyov/mesto

11:40 mpenet: your clojurescript source files must end in .cljs

11:40 piranha: and... well, application's project.clj with this dependency is not pushed to github, since it's not working, but it looks like this: https://github.com/piranha/cj-locations/blob/master/project.clj

11:40 oh right

11:40 mpenet: but I've changed that locally already

11:40 forgot to push :\

11:41 done

11:42 mpenet: as you can see, it's 0.2.1 on clojars, which is when I changed extension to .cljs...

11:43 mpenet: I dont see any of your projects in the dependencies

11:43 if that is what you want

11:43 piranha: well I haven't pushed it to github, because it's not working

11:43 I've added it as [solovyov/mesto "0.2.1"] in deps of cj-locations

11:46 mpenet: I dont see a saw single import of mesto, so it' s normal it wont show

11:47 piranha: oh

11:47 mpenet: hang on, I'll push it

11:48 mpenet: https://github.com/piranha/cj-locations/blob/master/project.clj

11:48 here it in deps

11:48 mpenet: ok: require [solovyov/mesto :as me] wont work

11:48 you need to use . instead of /

11:48 piranha: https://github.com/piranha/cj-locations/blob/master/src/locations/core.cljs here it's imported and used

11:48 oh

11:48 why...

11:49 S11001001: piranha: 42

11:49 mpenet: just because it's how it work in clojure

11:49 works*

11:49 piranha: Could not find artifact solovyov.mesto:solovyov.mesto:pom:0.2.1 in clojars (https://clojars.org/repo/)

11:50 oh well!

11:50 mpenet: thanks a lot!

11:50 mpenet: np

11:50 piranha: I have to use / in :dependencies, but then :require it with dot

11:50 that's a bit strange, but anyway, it works now :)

12:06 Fjdsurewjdfshdkj: Hi, just wanted to know if there are any libs for isometric game dev in Clojure?

12:40 Anderkent: Soo... (cons 1 '()) == '(1) , but (list? (cons 1 '())) == false

12:40 can anyone explain that to me?

12:40 ucb: anybody going to either techmesh or the london clojurians meet up tomorrow?

12:42 mdeboard: ,(type (cons 1 '()))

12:42 S11001001: Anderkent: A list always has a list as its tail.

12:42 clojurebot: clojure.lang.Cons

12:42 cemerick: Anderkent: lists aren't made up of conses

12:42 sqiudz: I want my clojure program to run via recursion. While running it should println every recursion. When using loop-recur, it seems as if clojure is trying to not run it lazily. It is not printing out any of the steps.

12:43 mdeboard: Anderkent: I agree that it's confusing without knowing the internals of Clojure's types

12:44 cemerick: Isn't it only confusing if you assume Clojure is like Common Lisp or Scheme?

12:44 sqiudz: I basically need my program to loop endlessly calling itself with a result it returns. So I thought recursion would be fine. Is this not possible?

12:44 S11001001: Anderkent: good example of differences: a list is guaranteed to be finite, have its size in O(1) time, and completely realized (no lazy bits)

12:44 Anderkent: ,(class `(1))

12:44 clojurebot: clojure.lang.PersistentList

12:44 Anderkent: ,(class `(1 2 3))

12:44 clojurebot: clojure.lang.Cons

12:44 mdeboard: cemerick: Two types that implement different interfaces but having the same literal is a little confusing

12:44 s/having/have

12:45 Anderkent: mdeboard: indeed, the same issue with vector / mapentry

12:45 S11001001: ` isn't literal

12:45 Anderkent: it makes debugging *really painful*

12:45 squidz: Is this not a common way of looping the main program?

12:45 cemerick: Anderkent: Code that purposely distinguishes between lists and conses is a bit crazy.

12:45 Really, it's a rare Clojure program that uses cons at all.

12:46 mdeboard: squidz: It's possible

12:46 Anderkent: I was simply using list? thinking it would return true for both lists and conses

12:46 mdeboard: squidz: There are many ways to do it

12:46 S11001001: squidz: https://www.refheap.com/paste

12:46 Anderkent: guess I should use seq?, as long as it's falsy for vectors etc.

12:46 S11001001: Anderkent: Also available are sequential?, and seqable? in core.incubator. Compare their results to figure out which one you want.

12:47 squidz: https://www.refheap.com/paste/7251

12:47 mdeboard: Anderkent: If this var you're type-checking against is an arg to a fn, you could also use type-hinting

12:47 Anderkent: no, I'm making a code walker

12:48 and I need to know whether a form is a list

12:48 but list? is apparently not what I need :P)

12:48 cemerick: mdeboard: clojure.lang.Seq is the common interface

12:48 mdeboard: cemerick: I see

12:48 squidz: What's the error you're getting?

12:48 cemerick: i.e. lazy seqs of all types print the same way as well

12:48 squidz: no error, it just isnt println'ing

12:48 which should be done at (display-petri petri)

12:49 cemerick: though, from a reader/literal perspective, they're all lists

12:50 S11001001: squidz: put a plain "(prn 42)" in.

12:50 squidz: S11001001: that works

12:50 S11001001: squidz: you get lots of 42s?

12:51 squidz: yes

12:52 S11001001: squidz: then your display-petri isn't printing anything; you may need to check your output stream, insert flushes at right places, &c

12:53 squidz: hm how can I annotate at refheap? I will post my display-petri function

12:53 Anderkent: Can anyone explain why this works?

12:53 ,(into {} (list (map identity {1 2 3 4})))

12:53 clojurebot: {1 2, 3 4}

12:53 S11001001: Anderkent: because ##(conj {} {1 2 3 4})

12:53 lazybot: ⇒ {3 4, 1 2}

12:54 S11001001: it's silly

12:54 mdeboard: cemerick: Yeah, that's the thing that contributes to confusion, at least in my opinion. Like to understand why `(list? (cons 1 '()))' returns false you have to understand what is really happening with that `list?' check, and understand what interfaces are being implemented which requires some Java knowledge.

12:54 Anderkent: S11001001: but it's doing (conj {} ([1 2] [3 4]))

12:54 not (conj {} {1 2 3 4})

12:54 S11001001: Anderkent: ah, I see.

12:55 Anderkent: (where the [] things are map entries, not vectors, though they render the same

12:55 squidz: S11001001: here is the display functoin

12:55 S11001001: https://www.refheap.com/paste/7252

12:55 S11001001: squidz: yeah, map is lazy

12:55 squidz: Side-effects and laziness mix like...two unmixy things.

12:56 squidz: use doseq on petri instead.

12:56 mdeboard: lol

12:56 `(defn unmixify [thing1 thing2] ...)'

12:57 squidz: S11001001: use doseq in the print function=?

12:57 AimHere: (mixy? thing1 thing2)

12:57 S11001001: squidz: yep

12:57 cemerick: (instance? java.util.Map$Entry (first {:a :b}))

12:57 ,(instance? java.util.Map$Entry (first {:a :b}))

12:57 clojurebot: true

12:57 cemerick: ,(vector? (first {:a :b}))

12:57 clojurebot: true

12:58 cemerick: ...and maps quite conveniently will conj in any 2-element vector.

12:59 squidz: https://www.refheap.com/paste/7254

12:59 that still doesnt print anything

12:59 mdeboard: why are you using map?

13:00 S11001001: squidz: what mdeboard said.

13:00 squidz: oh sorry forgot about that

13:01 okay that did the trick

13:01 forgot to take the map out

13:02 Anderkent: cemerick: but (empty (first {:a :b})) gives nil, which breaks lsp

13:02 so while it might technically be a vector, it doesnt behave like one

13:03 cemerick: Anderkent: lsp?

13:03 Anderkent: liskov substitution principle

13:04 mdeboard: my boy's wicked smart

13:04 cemerick: Anderkent: Yeah, that should throw an exception.

13:04 Bronsa: ,(doc empty)

13:04 clojurebot: "([coll]); Returns an empty collection of the same category as coll, or nil"

13:05 mdeboard: Is there a chart of Clojure class hierarchies?

13:05 Anderkent: for example (into {} (map #(into (empty %1) (map (partial + 1) %1)) { 1 2 3 4 })) should work but doesn't

13:06 cemerick: Anderkent: vectors are implementations of a particular set of abstractions. It's totally acceptable for implementations to opt out of certain inapplicable operations.

13:06 Anderkent: ,(into {} (map #(into (or (empty %1) []) (map (partial + 1) %1)) { 1 2 3 4 }))

13:06 clojurebot: {2 3, 4 5}

13:06 Anderkent: ,(into {} (map #(into (empty %1) (map (partial + 1) %1)) { 1 2 3 4 }))

13:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>

13:08 cemerick: Interestingly, ClojureScript does not have a unified IPersistentCollection protocol. Each operation is broken out, including empty, defined by IEmptyableCollection in cljs.

13:08 I suspect Rich would do much the same in Clojure, if given the opportunity.

13:09 ucb: does anybody know if there's going a couchdb backend for datomic?

13:20 Anderkent: gah

13:21 ,(`#{~@(map identity [1 2 3 4])})

13:21 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentHashSet>

13:21 Apage43: ucb: it's more amenable to something that stores raw binary blobs, which CouchDB is kind of not the best for

13:21 ucb: Apage43: interesting

13:21 Anderkent: curious, that works for me in repl :O

13:21 ah

13:21 ,`#{~@(map identity [1 2 3 4])}

13:21 clojurebot: #{1 2 3 4}

13:21 Anderkent: ,`{~@(map identity [1 2 3 4])}

13:21 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>

13:22 Anderkent: this was what I was trying to show :P

13:22 cemerick: Apage43: it stores binaries just fine

13:22 Apage43: that is, even if it did, you wouldn't be able to do CouchDB views off your datomic data (in much the same way you can't if you use it with Couchbase, which it does support)

13:22 cemerick: I know, but they're all associated with a JSON document

13:22 possibly that isn't used

13:22 but the document itself is always JSON

13:22 mdeboard: Anderkent: (map #(identity %) [1 2 3 4])

13:22 Apage43: and can have one or more binary attachments

13:22 cemerick: Apage43: you can get and put the attachment data without touching json

13:23 mdeboard: Anderkent: That error doesn't really have anything to do with quote/unquote

13:23 Anderkent: mdeboard: that's not what I'm trying to do

13:23 I'm trying to splice into a map literal

13:23 cemerick: insofar as datomic works with (IIRC) 64k chunks of data, putting a dummy minimal json document to hold attachments wouldn't be onerous.

13:23 Apage43: cemerick: yeah, but it's creating and modifying it under the hood when you do that

13:23 probably not

13:23 *shrug*

13:23 feels weird to me =P

13:24 cemerick: Apage43: it used to be so; the documents and attachments are no longer comingled in storage

13:25 Apage43: it does lots of smart stuff with attachments

13:28 * Apage43 worked at couch.io/Couchone for a while, so I've messed with that code. It'd probably work fine to do that, I would just never think to.

13:29 foobar_: Please could someone give me a hint how to fix my immutant deploy. Im getting my attempt to deploy to immutant is giving me java.io.FileNotFoundException: JAR entry public/ not found in .m2/repository/noir/noir/1.3.0-beta3/noir-1.3.0-beta3.jar

13:31 tcrawley: foobar_: come join us in #immutant and we'll try to get you fixed up

13:58 mmitchell: ibdknox: Hey there. We just started using Korma and I have a question about sharing a where clause... how do you do this?

13:58 anyone else here use Korma? ^^

14:03 hcumberd`: mmitchell: thinking about it

14:03 is it possible to ddl with korma?

14:08 mmitchell: how do you feel with it so far?

14:13 twopoint818: So I have a hiccup form like [:script {:type "text/javascript"} "var list = [" (clojure-function-generating-js-list) "];"] But the value that I get in the resulting HTML is "clojure.lang.LazySeq@81abaea4" what's going on with that?

14:16 hcumberd`: twopoint718: have a look at javascript-tag and realize your seq to a string

14:16 Chousuke: twopoint718: wouldn't that be generating a list that contains a lazy seq

14:17 twopoint718: Chousuke: I wrapped it in a doseq and the result is the same. I haven't looked at 'javascript-tag'.

14:17 err: doall

14:17 hcumberd`: ...or... you use cheshire to generate json und write "var list = " jsonhere " ;"

14:18 twopoint718: doseq does not help since you are not wanting to repeadly do smth. with the collection

14:18 what you want is to serialize a clojure seq to a javascript object

14:18 =>json

14:19 piranha: oh, cljs' PersistentVector has no indexOf method :\

14:19 Chousuke: twopoint718: no, I mean if you return a list from the function and then wrap it in [], that would create a list containing a single element, no?

14:19 hcumberd`: you can use cheshire and (generate-string ...)

14:19 mmitchell: hcumberd`: so far so good, but can't figure out this composable where thing

14:20 hcumberd`: mmitchell: is it doing ddl for you?

14:20 or how does it handle all the definition things?

14:21 mmitchell: hcumberd`: well, you can define your "models" and relationships between them using a nice interface

14:21 hcumberd`: and does it modify existing tables

14:21 what is happending after you define your "models"

14:21 what is happending to existing data if you change your model?

14:43 * josteink is writing a leiningen-plugin which accepts a parameter.

14:43 josteink: if I provide the parameter when invoking leiningen, it seems to run fine

14:43 however, if I omit it, it seems like leiningen skips 99% of my program code

14:44 could this be some lazy args-seq pending evaluations, or am I lookup up the wrong tree?

14:44 and how would I move about getting it eval'd?

14:50 trmsw: is there a way to get *1 *2 and *3 to work with nrepl?

14:50 I miss slime

14:52 nDuff: trmsw: nrepl supports middleware, so you can always add something to do that (if it's not already available somewhere, which would surprise me a bit).

14:53 trmsw: oh great.

14:55 cemerick: trmsw: it doesn't already?

14:55 trmsw: they just return nil

14:56 cemerick: I presume you're talking about nrepl.el. nREPL certainly supports *1 etc, as long as your client supports sessions.

14:56 trmsw: yes, I'm using Emacs with nrepl.el

14:57 cemerick: trmsw: well, it certainly looks like it supports sessions; either there's something wonky with your config, or you're hitting a bug

14:58 Best to find someone here that uses emacs to help. :-)

14:59 josteink: Im in emacs

14:59 but Im not using nrepl from emacs

14:59 Im using it in another screen session. too much trouble getting reliable repl-integration going in any editor ;)

15:00 thorwil: strange, here i was under the impression that using nrepl.el just does work

15:01 * nDuff is using nrepl.el very, very happily -- but that's through Emacs Live; no idea what local customization happened to make that Just Work.

15:01 cemerick: Stuff as simple as sessions *should* Just Work.

15:01 thorwil: do you not have *1 etc. either?

15:02 trmsw: I'm using Emacs Live too

15:02 thorwil: cemerick: i have to admit that i don't even know what that refers to

15:02 cemerick: value of last evaluated expression

15:03 thorwil: *1 does work here

15:03 cemerick: Same as _ in python, etc.

15:03 ah, ok

15:04 thorwil: but what should *2 and so on do? as it looks like they all return the same

15:04 trmsw: maybe I shouldn't be using nrepl-jack-in

15:05 thorwil: nm, trying *1 *2 *3 in a row is not the most celver thing :)

15:05 clever, even

15:06 trmsw: or maybe it's a problem with ritz

15:06 tomoj: huh, in my repl evaluating *1 doesn't change anything

15:06 that is, *1 then *2 makes sense

15:06 and *1 then *1 is the same thing

15:08 cemerick: tomoj: evaluating *1 sets *1 to the value of *1. :-) It's an expression, too.

15:09 trmsw: depends. Some implementations won't update *1 until you evaluate a "new" expression

15:09 hcumberd`: ahhh I see Korma does no ddl

15:09 tomoj: if I evaluate in order 1, 2, *1, *2, the last one is 1

15:10 cemerick: tomoj: In what REPL? Not in the default Clojure one.

15:10 tomoj: swank

15:10 cemerick: interesting

15:11 trmsw: useful too :)

15:12 thorwil: that suggests that swank excludes the *n, while nrepl counts them, too

15:12 the former behavior would have been my expectation

15:12 cemerick: perhaps. I don't think I'd make it the default, though nREPL could be pretty easily tweaked to match swank's behaviour.

15:14 trmsw: coming from slime & lisp, I don't expect just evaluating *1 to update it

15:14 though right now I'd be happy with anything other than nil, dammit

15:15 cemerick: Changing that would be a pretty easy first nREPL middleware, if anyone wants to give it a try.

15:20 kovas: has anyone tried to use fressian? https://github.com/Datomic/fressian

15:25 cemerick: kovas: I fiddled with nippy a while back

15:25 kovas: cemerick: yeah I saw your tweet :)

15:25 cemerick: I keep rediscovering it :-P

15:26 kovas: Looks cool, i would use it if there wasn't advanced open source technology from the datomic team

15:26 may end up playing with both

15:27 cemerick: I'm a slow turtle when it comes to picking up libraries that involve data formats, etc. ;-)

15:28 kovas: and here I had no idea you were on twitter :-P

15:28 Hope all's well since the Conj.

15:30 mudge: Anybody know of a Clojure library that wraps the java.util.jar library?

15:30 kovas: cemerick: been super busy. just got back to NYC, time to get back to session :0

15:31 cemerick: getting the nrepl thing working is on my list..

15:32 cemerick: kovas: it should be a piece of cake to capture expression/result pairs

15:33 kovas: cemerick: yeah, simple formats for the win

15:35 no abstract factory factory that i need to implement

15:35 cemerick: actually, you could do it either client-side (using a delegating transport) or server-side (using a bit of middleware)

15:35 kovas: theres probably a variety of ways to set it up.. i'll try doing one, and then accept contributions :)

16:11 solussd_: why can't 'case' dispatch on type?

16:13 egghead: solussd_: are you looking for multimethods? Case can certainly dispatch on :type ;)

16:13 AimHere: Isn't 'case' the optimized version that's designed to be fast because it's checking constants?

16:13 If you need somethingmore sophisticated, try 'cond'

16:15 solussd_: meh, nevermind, I'll just use a protocol like I should. :)

16:16 Raynes: Literals, not constants.

16:17 AimHere: ,(doc case)

16:17 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...

16:17 AimHere: Well they're called 'test-constants'

16:18 That's my excuse

16:19 dcjackson: ode

16:35 mudge: how do i find the position of a substring in Clojure?

16:36 S11001001: mudge: don't use numbers, use splitting and groups

16:37 mudge: say goodbye to off-by-ones

16:37 mudge: i get it

16:37 groups from matchers?

16:37 S11001001: ,(re-matches #"h(.)" "well hi there, hi")

16:37 clojurebot: nil

16:37 S11001001: er

16:38 ,(re-seq #"h(.)" "well hi there, hi")

16:38 clojurebot: (["hi" "i"] ["he" "e"] ["hi" "i"])

16:38 S11001001: re-{matches,find,seq} are essentials

16:39 mudge: about 42 times more convenient than the stateful api offered by java.util.regex

16:39 mudge: thanks

16:55 black_joe: I've actually never compiled a Clojure project.

16:55 If I have two namespaces, and they both depend on one another, is it possible to compile them?

16:56 Namespace 1 has a function that Namespace 2 uses, but Namespace 2 has a function that Namespace 1 uses.

16:57 apwalk: circular dependency, not to my knowledge

16:57 pisketti: If anyone has an answer for that, I'd be very interested as well!

16:58 black_joe: Alright. I will split up my files based on levels of abstraction rather than topic.

16:59 S11001001: black_joe: it is possible, but extremely annoying. Better to not do it.

17:00 black_joe: Well, I could just get rid of the function. It was needless abstraction anyway.

17:22 mmitchell: ibdknox: yt? I've got a question about Korma, can't figure out how to "shared" where constraints?

17:22 s/shared/share

17:25 ibdknox: aye nvm, i *just* figured it out!

17:59 weavejester: I have a slightly technical question...

17:59 It seems like you can have a namespace like foo.bar+baz

17:59 And I can't find any circumstance where this doesn't work...

18:00 But nor can I find anything about which characters are allowed in a namespace

18:01 bbloom: weavejester: namespace names and symbols are somewhat permissive because they don't do any validation

18:01 I'm not sure what, if anything, can be treated as official behavior other than "the public API of core uses that character, so it should be OK"

18:02 weavejester: bbloom: Yeah, I was largely wondering about whether it would affect AOT compilation, but it seems to be fine...

18:02 bbloom: there is a somewhat undocumented munge function

18:02 ,(munge 'foo.bar+baz)

18:02 clojurebot: foo.bar_PLUS_baz

18:02 weavejester: Yeah, so that would suggest it would work

18:02 bbloom: weavejester: I'd guess that the EDN spec is your best bet

18:02 https://github.com/edn-format/edn

18:03 weavejester: When I AOT compile it, I get: foo+bar__init.class and foo_PLUS_bar$loading__4784__auto__.class

18:03 akhudek: can anyone explain why dispatch on type is so slow in this example? https://gist.github.com/4198891

18:06 bbloom: akhudek: you don't show the definition of the Fragment type

18:07 akhudek: left that in there by accident, it's just (defrecord Fragment [t p1 p2])

18:08 I'm more curious about why the bottom two examples involving TypeFragmentA and TypeFragmentB are so different.

18:08 the only real difference is that one uses a type keyword + case, and the other uses protocol based dispatch

18:09 bbloom: akhudek: can you simplify this? it's not clear to me what you're trying to accomplish

18:12 akhudek: Not sure I can make it any simpler. :-( Essentially, I have a lot of core code that dispatches on the "type" of a fragment record. Currently it uses a record + case statement as in the first of the three examples. I would have thought that having different class types + dispatch via protocol would be much faster, but it seems not.

18:13 weavejester: bbloom: Thanks for your advice, btw

18:15 akhudek: aka using case on a field seems much faster than dispatching via protocols + unique deftypes

18:18 seangrove: Did I head that lamina was "hopeless"?

18:19 Thought someone here had mentioned that, was curious why - just got a chance to look at it

18:20 cpetzold: ibdknox: hey, what is the binding stuff in crate? do you have any examples of that?

18:21 or does anyone else know?

18:24 devinus: anybody use sublime with sublimerepl for clojure?

18:33 Raptum: devinus: if you find an answer, i'm interested as well

18:33 OH WAIT it's built in :P

18:33 nvm

18:34 devinus: Raptum: yeah, i was only going to ask how to connect to a project

18:34 and not just a generic clojure repl

18:34 Raptum: lol i originally got it for common lisp but then i migrated; how do you tell it to eval a command?

18:35 devinus: Raptum: there is a way to "Eval in REPL"

18:35 from the menu

18:36 and it even has a keybinding

18:36 Raptum: ah ok

18:36 devinus: but i don't know what ^,, s is

18:41 Foxboron: devinus, i do.

18:41 devinus: Foxboron: ah, i'm using your sublime clojure stuff :)

18:42 Foxboron: do you know how to invoke Eval in REPL?

18:42 Foxboron: Hah, comming out with a new plugin soon ;P you'll love it.

18:42 devinus: what is ^,, s ?

18:42 Raptum: devinus++

18:42 Foxboron: well

18:42 devinus, i assume Windows?

18:42 devinus: Foxboron: OS X

18:42 Raptum: linux for me

18:42 Foxboron: ah, well. The keybinds on OSX aint broke.

18:42 But if you wanna connect to a project you need to use the Clojure-Telnet

18:43 then you can sepcify a port in the project files.

18:43 devinus: ah

18:43 Foxboron: But just open a repl inside the project using lein

18:43 then connect at the given port.

18:43 Raptum: ...so what is ^,, s

18:43 devinus: i se

18:43 Foxboron: However, on lein 2 they use nrepl, which SublimeREPl does not support currently

18:44 Been some developing on a new branch, but its broke on windoze.

18:44 dunno about OSX

18:45 devinus, this is the plugin i have been working on tho:

18:45 https://github.com/Foxboron/ClojureDoc-Search

18:45 not on the package manager yet, but prolly pushing it up there tomorrow.

18:47 devinus: Foxboron: i just did an Add Repository on it

18:48 but couldnt find it listed after that

18:48 weird

18:49 Foxboron: meh. Just download the zipfile and add it :P

18:49 mdeboard: not too late to drop by north side of Indianapolis for my Clojure talk tonight

18:50 I'm pretty sure i'm going to nail some record for errors-per-minute

18:50 per-slide

18:54 solussd: mdeboard: good luck!

19:10 Raynes: aaelony: Hey, you around?

19:15 aaelony: Raynes: how're things?

19:16 Raynes: aaelony: I was looking into your issue https://github.com/Raynes/refheap/issues/94

19:17 aaelony: raynes: thanks, you can close it if you wish

19:17 Raynes: aaelony: Can you describe how you'd like this to work? I see the usefulness, but here is my problem: I can add a link for you to click that opens a prompt for a URL and then grabs the content from that URL and throws it in the pastebox for you, but you still need to select a language for it to know what to do with it. By time you've done all that, you probably could have just select-all'd the contents of the page and pasted them faster.

19:17 Thoughts?

19:18 I was thinking browser extensions would be nice.

19:18 So I might look into that.

19:18 aaelony: i like the way google translate handles it.

19:19 Raynes: Oh, so literally how google translate does things.

19:19 That could be possible.

19:19 That'd be a neat little side-service.

19:19 aaelony: i think it's pretty well thought out on their end

19:19 yeah, neat and tidy :)

19:19 Raynes: Okay. I'll leave the issue open, but don't expect it done in less than 3 years. :P

19:20 aaelony: If you promise 3 years, I might hold you to it.

19:20 Raynes: lol

19:20 aaelony: heheh

19:20 by that time, clojure will compile to Haskell

19:20 Raynes: aaelony: You can word wrap the code box now. Printing from it might be nice.

19:21 aaelony: cool, man!

19:21 Raynes: I'm going to look into word wrapping the actual pasted code blocks too.

19:21 aaelony: sweet

19:28 Foxboron: aaelony, Clojure to Haskell. Damn

19:30 aaelony: foxboron: my crystal ball is high bias ;)

19:30 Foxboron: aaelony, 3 years.

19:30 Clojure to Haskell

19:30 I am expecting it now.

19:30 aaelony: high bias :)

19:30 Foxboron: nonom you said it.

19:30 Now, go do it.

19:30 can't just bias everything you say.

19:31 aaelony: only some things...

19:32 Bahman: Hi all!

19:32 mdeboard: hi

19:41 basicsensei: hey guys how do I set *use-context-classloader* to false by using java code(in java)?

20:10 nvm don't need that anymore

20:10 devn: howdy folks

20:13 Raptum: ahoy

20:43 alexyk: is there a good library to specify UML diagrams or some such as Clojure data and then visualize those? I want to keep our AWS devops setup in an editable text form like that

20:44 e.g., @cemerick, what to you use for clojure atlas?

20:45 cemerick: alexyk: that's a hand-rolled ontology massaged into a particle simulation drawn via raphaeljs

20:45 alexyk: cemerick: oh gawd, js

20:45 cemerick: In hindsight, the particle simulation (a heavily-modified fork of arborjs) was a bad decision.

20:45 Yeah, it was built months before clojurescript was out.

20:46 alexyk: I'm surprised folks draw graphs in Omnigraffle etc instead of editing text files

20:47 cemerick: well, automatic layouts often suck

20:47 alexyk: btw, on the subject of clojurescript. As a cofounder of a startup with a RESTful API (in Scala, sorry) and a JS front-end, I have an itch to write the following integration testing system. Click on JS in a browser like PhantomJS from ClojureScript, and somehow poke in a JVM responding to it from Clojure, all in concert. Doable?

20:47 cemerick: text files almost always suck

20:48 akhudek: omnigraffle can also do automatic layouts :-)

20:48 brehaut: dont forget text editors always suck

20:48 cemerick: (inc brehaut)

20:48 lazybot: ⇒ 7

20:48 alexyk: akhudek: does Omnigraffle have API?!

20:49 cemerick: alexyk: its files are a well-documented XML schema

20:49 alexyk: cemerick: this is interesting

20:49 akhudek: alexyk: think it can read .dot files too

20:49 brehaut: alexyk: i am a visual thinker; i'd use omnigraffle or similar just because it lets me be visual

20:51 alexyk: brehaut: true. But then I draw a region of AWS and want to copy it with minor changes as VA or OR, and I wish it were a line of clojure

20:51 so, on cljs: is it possible to have a single driver which will see both inside the guts of a browser and a JVM providing a RESTful API to it?

20:52 brehaut: alexyk: that is indeed the tradeoff

20:53 cemerick: alexyk: doable

20:54 alexyk: cemerick: how?

20:54 cemerick: In REPL we trust

20:55 alexyk: cemerick: which REPL would it be? if cli, then how would we see JS; vice versa, how would we poke in JVM?

20:55 s/cli/clj/

20:55 cemerick: if you want to tickle a browser environment (e.g. DOM et al), then clojurescript browser-repl will do it. If you want to poke at a Clojure environment, REPL-ing in via an nREPL endpoint is cake.

20:55 I'm working on making it so that doing either is transparent from a client perspective.

20:55 alexyk: now I want a meta-repl with BOTH

20:56 i.e. I want an integration test which will poke in a browser and then in the JVM checking that stuff is indeed done

20:56 METAREPL> js (click …) || METAREPL> cli (verify ...)

20:58 cemerick: You don't need a special "metarepl" thing.

20:59 akhudek: which visualvm would tell me where most of the expensive "clojure.lang.RT.seqFrom" was being called in my code

20:59 cemerick: e.g. (reval cljs-connection (some-fn a b c)) vs. (reval clj-connection (some-fn a b c))

21:00 frozenlock: I didn't touch cljs for quite some time.. is their some new REPL utility that give access to autocomplete and docs?

21:04 bbloom: frozenlock: not that i know of

21:05 frozenlock: :(

21:05 seangrove: What's the threading macro that stops if the first result is nil?

21:06 (-?> (some-fn-that-may-return a value or nil) (some function to call only if the first one isn't nil))

21:06 bbloom: frozenlock: cljs' entire compiler toolchain is disjoint, and in clj not cljs. the repl only offers functionality that would be available at runtime and under advanced compilations

21:06 seangrove: Basically (let [value (some-fn)] (when value (new-fn value)))

21:07 bbloom: seangrove: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L21

21:08 seangrove: bbloom: Is there one in core, like ->, that'll stop on false as well?

21:08 nil/false are the same in my case

21:09 bbloom: seangrove: not that i know of, but it's easy to make your own

21:09 seangrove: Sure, was just wondering. I'll stick with the let form for now :)

21:12 alexyk: cemerick: where can I clone your reval-uitonary plumbing?

21:13 muhoo: the problem with doing away with text files is... what do you replace it with? a database? a registry?

21:14 windoze tried this, and then gnome did too. i'm not sure it was a great idea.

21:15 echo-area: muhoo: What does Gnome use as registry?

21:17 rkz: gconf

21:17 nightfly_: dconf

21:18 echo-area: Oh

21:18 nightfly_: (wrapped in gsettings, which can use multiple backends)

21:18 muhoo: gconf actually

21:19 nightfly_: gconf was the text file based registry, dconf is the new binary registry with fancy memory mapping and notifications

21:27 bbloom: muhoo: the windows registry is just a poorly implemented file system with bad semantics

21:27 muhoo: granted there are binary values for integers, etc, but generally, people store plain text for most real configuration

21:27 muhoo: right. so when cemerick talks about replacing text files with something better, i se the point, but i get a little nervous, having seen what the alterntatives have been in the past.

21:28 see, alternatives, typing :-/

21:29 cemerick: muhoo: text files were replaced decades ago for everyone except programmers.

21:30 muhoo: everyone except programmers don't usually care about seeing source code of things though.

21:30 bbloom: plain text has *many* advantages, but only a subset of them are unique to text

21:30 most, but not all, also apply to s-expressions :-P

21:31 but fundamentally, line-oriented file protocols are just so brain dead simple to work with and SO MUCH STUFF uses them that it's practically impossible to improve upon them without making your own EVERYTHING to go with them :-/

21:33 also, most people trying to replace pragmatic, but imperfect systems, tend to lack fundamental understanding about what makes the pragmatic systems beautiful…. *cough* object shells

21:36 muhoo: it's an interesting problem. programmers use text files because we want to be able to read and edit the source of things, and that means text. and text sucks, but, how else do you obtain the readability and openness? maybe there's an answer somewhere.

21:37 akhudek: bbloom: depends on the usage, special case "shells" like mathematica and R are pretty useful!

21:37 hughfdjackson: in clojure/clojure, where is the hasing algorithm actually defined?

21:37 if anyone knows off the top of their heads

21:37 * hughfdjackson is missing something here

21:39 muhoo: hughfdjackson: src/jvm/clojure/lang/PersistentHashMap.java ? (wild guess)

21:40 hughfdjackson: that's where i am atm .. it seems to be using the hashing algorithm from elsewhere

21:40 brehaut: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L23 i'd start there, its the guts of = i think

21:40 hughfdjackson: :D thanks

21:41 brehaut: hughfdjackson: you'll see that it falls back to using jvm hashing (equals)

21:41 crease: Hey, certain dependencies (not the clojure version) in my project.clj file seems to change my clojure version… is this normal? Can arbitrary dependencies downgrade the version of clojure? The version specified in my project.clj is 1.4.0, and lein2 repl launches 1.2.0…

21:41 brehaut: hughfdjackson: which from memory should be consistent with the hashCode method of Object (if you override oen, you should be overriding both?)

21:42 cemerick: crease: Yes, it's possible. Try using https://github.com/xeqi/lein-pedantic to find the culprit.

21:43 hughfdjackson: brehaut: that makes sense.. my java-fu's weak to the point i didn't realise that was directly on java objects

21:43 cemerick: hughfdjackson, brehaut: there's a variety of special-casing for numerics and collections though

21:44 brehaut: cemerick, hughfdjackson: and identity equivalence

21:45 hughfdjackson: this article looks reasonable http://www.ibm.com/developerworks/java/library/j-jtp05273/index.html

21:47 hughfdjackson: Awesome stuff :D

21:49 muhoo: i've been meaning to study and understand dnolen's persistent hash map implemented in protocols and pure clojure for clojurescript, but haven't gotten around to more than skimming it so far.

21:51 crease: cemerick: thanks a lot, I'll look into that :)

21:55 akhudek: is there a way to get leiningen to set *assert* before compilation?

21:56 crease: cemerick: that did the trick, thanks!

22:02 cemerick: crease: np; thank xeqi next time you see him ;-)

22:11 seangrove: I have an atom in my-ns.mock.data. It's passed through a series of functions. Eventually one of the functions gets it as a parameters [my-data] and wants to watch it for changes. Later, another function updates my-ns.mock.data directly via a swap! operation. The atom is updated successfully, but the watcher is never notified.

22:12 Just to be sure, I'm probably doing something wrong, and the intended behavior is that the watcher should be notified even though it subscribed to a local variable and the second function is updating a global def (within the my-ns.mock ns), because they're both referencing the same atom

22:15 Sorry, forgot to make it a question - Is that second paragraph correct?

22:17 cemerick: seangrove: Yes, if you've attached a watcher to an atom, and its value changes, the watch fn should be invoked.

22:17 Whether it's held by a var or ten, does not matter.

22:18 seangrove: Ok, thanks, just wanted a reality-check

22:28 frozenlock: Aw cmon... I've done a IE warning message... but it's not compatible with IE.

22:29 brehaut: frozenlock: conditional comments?

22:30 hughfdjackson: Just to see if i have this right; hashcodes are used against the properties just to bucket them, so properites can cache their own hash values, and use those for quick lookups

22:30 then if there's more than one value, a deeper equality check is performed?

22:31 s/hashcode/hash value/

22:31 frozenlock: brehaut: Based on a conditional comment, yes

22:32 brehaut: frozenlock: the versions of IE that dont support conditional comments are at least not-complete-arse

22:33 frozenlock: No; it's my cljs cute little popup message that doesn't seem to work on IE. Irony is, the popup was to ask the user to stop using IE.

22:34 The conditional comment works fine.

22:45 oskarth: writing macros for clojurescript, how can I print-debug the clojure macro to make it show up somewhere useful?

22:47 bbloom: oskarth: (defn dbg [x] (binding [*out* *err*] (prn x) x))

22:49 oskarth: bbloom: thanks! so, err, where would that print? :p using lein cljsbuild and chrome console

22:50 bbloom: oskarth: if that doesn't print to your lein console, i'm not sure

22:51 oskarth: generally, i just macroexpand-1 to test my macros

22:51 muhoo: frozenlock: i'd bet there's some boilerplate js that does that somewhere, which you could plug in and use instead if you wanted.

22:51 oskarth: bbloom: with lein console, do you mean the lein cljs-build?

22:52 bbloom: oskarth: i mean wherever you're running cljs-build auto or whatnot. i use a terminal, but i have no idea how it behaves if you're an emacs guy

22:52 oskarth: bbloom: using in the terminal too (inside emacs). I see, thanks!

22:55 frozenlock: muhoo: there is one.. but it's too intrusive to my taste.

Logging service provided by n01se.net