#clojure log - Jan 05 2014

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

0:03 john2x: hello, how do I fix "Could not find artifact org.clojure:clojure.core.cache:jar:0.6.3 in central"? my network is fine and I'm not behind a proxy..

0:03 when doing lein deps

0:09 ah it's a typo. my bad.

0:14 TEttinger: bvvd, heh thanks

0:31 devn: .toString vs str

0:31 the epic battle

0:31 ...for perf

0:34 gfredericks: hi

0:50 color me confused. why does https://github.com/dgrnbrg/spyscope show (take 20 (repeat (+ 1 2 3))) as blowing up in the examples?

0:50 ,(take 20 (repeat (+ 1 2 3)))

0:50 clojurebot: (6 6 6 6 6 ...)

1:00 bellkev: Is there an easy way to figure out how some stale artifact is on my class path?

1:01 Like, a way to check where the class/src file is that some function/ns came from?

1:04 technomancy: bellkev: check the metadata of a var; it'll have :file/:line entries

1:04 anildigital: Guys feel free to contribute http://clojurebyexample.com/

1:05 I think great opportunity here..

1:05 Kleptocracy: technomancy, you're back

1:05 anildigital: https://github.com/anildigital/clojurebyexample

1:06 technomancy: Hi Sir.. if possible can you give me suggestions for this.. thanks :)

1:06 bellkev: technomancy: sweet, thanks

1:06 TEttinger: devn, for spyp, the one that just prettyprints something, no checks for blowing up?

1:11 technomancy: anildigital: you've got ... a marginalia page or something? not sure what you're asking.

1:11 anildigital: technomancy: I mean.. I am trying to setup something very similar to https://gobyexample.com/

1:11 I used marginalia for generating docs..

1:11 hope to fill up all types of examples soon

1:12 marginalia is docs so .. it will look different .. like docs

1:12 technomancy: oh, ok; cool

1:12 anildigital: technomancy: do contribute if you think you have something in mind.. I am open to it

1:13 technomancy: sounds like a lot of work but could be a good resource

1:13 anildigital: basically I am clojure noob.. so won't be that good at examples first.. but will try my best to add good examples there

1:22 if someone here helps me to list down top name spaces that must be present in http://clojurebyexample.com/ .. that would be so good.. thanks already

1:32 ddellacosta: anildigital: a non-exhaustive list of places to review before starting out on a new documentation project: http://clojure.org/cheatsheet, http://clojuredocs.org, http://clojure-doc.org, http://www.clojureatlas.com, http://www.clojureatlas.com. I would urge you to see if you can contribute to one of those (clojure-doc.org seems like the best candidate) before starting a new documentation project. However, I don't want to dissuade yo

1:32 from trying something new--your project could be really great.

1:33 anildigital: ddellacosta: it's definitely not documentation... but example snippets .. where a new developer can refer to write the code

1:33 It can have more specific examples

1:34 ddellacosta: anildigital: ...call it what you will, examples abound of the same exact sort of thing in some of the resources I linked to above.

1:34 TEttinger: anildigital, get everything you can off rosetta code's clojure section for just pure snippets.

1:34 clojure-docs has example snippets for most functions

1:36 ddellacosta: anildigital: all I'm saying is, if you are a Clojure newbie, and you want to provide something useful to the community, it's important to review what is already present and see how what you are providing could fit within that. What would be worse is creating yet another half-baked Clojure docs site that is infrequently updated and/or inconsistent. We have enough of those.

1:37 anildigital: ddellacosta: the thing is that... it's opensource and on github.. hope to get some other contributors and keep it up to date

1:37 ddellacosta: anildigital: my point stands.

1:37 anildigital: ddellacosta: I am writing this for my own use

1:37 ddellacosta: if it is helping me.. it should help others..

1:37 ddellacosta: anildigital: great, then there you go--I've given you some examples to use. Good luck!

1:37 anildigital: ddellacosta: definiltely goal is not to be the best there.. but useful

1:47 noprompt: dnolen: *finally* got the chance to play with om. it is beyond legit. :-)

1:48 dnolen: noprompt: cool, you're jumping in at the right time :) quite a few issues ironed out - frankly surprised at how many people are using it and reporting bugs

1:49 noprompt: been putting together a non-trivial generic sortable example and I'm kinda blown away how solid the React conceptual model is.

1:49 noprompt: basically FP/OO the good parts

1:50 noprompt: dnolen: well, it's *really* nice. right now i'm rewriting an app i originally did with angularjs/coffeescript and i'm shocked. it's significantly shorter and much easier to refactor.

1:50 dnolen: noprompt: awesome! :)

1:52 noprompt: dnolen: it's not terribly complex but it might serve as an example.

1:53 dnolen: noprompt: you should post about it

1:53 xnil: noprompt: that tends to be the case coming from any toolkit

1:53 s/toolkit/alternative workflow/

1:53 dnolen: noprompt: I was worried for a while that people were discussing something so in flux, but I think I've settled on some ideas I don't think are going to change much in the near future.

1:56 noprompt: dnolen: that's one of the reasons i kinda avoided jumping in when you first started on it. but i'm still keeping an eye on it.

1:56 xnil: is clojure usable on android? i need performance, scalability, and stability

1:57 dnolen: noprompt: wise :) but the undo / app-state history stuff and this sortable thing is starting to convince me that Om approach can really work and really work well

1:57 noprompt: dnolen: the cursor work you've done is absolutely wonderful.

1:58 TEttinger: xnil: try a clojure repl for android, there's some in the google play store for free

1:58 dnolen: noprompt: heh yeah I was kinda skeptical about it

1:58 noprompt: but I really don't see how the app state approach can work w/o it efficiently

1:58 noprompt: dnolen: everything is so clean. normally that's plumbing you end up having to do yourself.

1:59 xnil: TEttinger: i'm talking about for application development; i'd like to know if any significant apps have been developed for android using at least almost exclusively clojure

1:59 dnolen: noprompt: yeah early on the path stuff was explicit and I didn't like it

1:59 noprompt: I kinda dig the specify stuff a bit too, so you can have cursors on primitive values

1:59 kind of a corner case, but cool that it can be handled

2:00 TEttinger: xnil, I haven't tried, but the repls are very slow to eval clojure code... not sure if it's the runtime eval that's slow or clojure in general on android

2:00 xnil: alright

2:00 noprompt: dnolen: sablono is nice too. r0man has done a nice job with that.

2:00 xnil: i'll do some benchmarking

2:01 dnolen: noprompt: yeah I like it! I hope Om inspires people to really run w/ a truly CLJS-centric approach to client side development

2:04 noprompt: dnolen: i finally started using source maps too. it's funny, i got so used to debuging the compiled javascript it's weird seeing cljs in the chrome dev tools.

2:05 dnolen: noprompt: oh man, I do not miss staring at the generated JS at all

2:05 noprompt: dnolen: i do miss the laser fast compile times though.

2:05 dnolen: noprompt: yeah source maps are a bit more expensive, but so far not lame

2:06 ddellacosta: dnolen: related to OM, I have a simple question about the etymology of the term "cursor--" is that referencing the meaning of cursor as in DB cursor (http://en.wikipedia.org/wiki/Cursor_(databases))?

2:07 dnolen: ddellacosta: yes, it's also kind of like a zipper too

2:07 ddellacosta: dnolen: okay, gotcha, that's helpful.

2:07 dnolen: ddellacosta: I honestly didn't have a good name, and I just needing something to point out that it's a bit special

2:07 noprompt: definitely feels like a zipper

2:09 dnolen: noprompt: as I've said several times already, I think the really cool stuff will happen when people start making instrumentation components for development

2:10 noprompt: like hover over the UI and see the EDN data backs it up

2:10 anildigital: TEttinger: thanks for rosetta code site

2:10 dnolen: noprompt: but the real gold will be VCR, so you can refresh much less, just revert app state re-evaluate via Austin or whatever, and keep going

2:14 noprompt: dnolen: yes, yes, yes. the record/playback stuff is one of the really neat features from pedestal i liked.

2:15 dnolen: noprompt: but note it's not really like pedestal at all, pedestal was delta oriented which is limiting.

2:15 noprompt: in Om you can do real queries over the entire app history, compute delta, patch timeline, branch etc.

2:17 noprompt: dnolen: is that baked in or soon to come?

2:17 dnolen: noprompt: it's just implicit in the model

2:17 noprompt: I'm planning on building an example library separate from Om that shows how it can be done

2:18 noprompt: dnolen: that's if you're saving the snapshots right?

2:18 dnolen: noprompt: yep

2:18 noprompt: once people can see how to do it, they'll just do it, no need for a library at all

2:25 arrdem: so I know we have *ns* for getting a namespace from a macro, is there a way to get the outermost bound fn?

2:25 or am I just hosed here.

2:26 noprompt: dnolen: the part about this whole style of development that i find interesting is that it seems to mock several "best practices". ie. single location for app state, full re-renders (although not really), on* attributes, etc.

2:26 dnolen: noprompt: yep

2:27 noprompt: and less model controller boilerplate, data -> view -> done

2:27 noprompt: dnolen: it's very dwim (do what i mean).

2:28 alew: anyone use emacs helm?

2:28 dnolen: noprompt: I was somewhat concerned about component composition, but passing functions and core.async ... it works

2:29 noprompt: also mad props to the React guys, the life cycle methods really make it easy to figure out where to put stuff

2:32 noprompt: dnolen: i still don't know 100% of the life cycle api but overall i really feel like they nailed it. the whole vdom concept; brilliant.

2:33 dnolen: are any of them experimenting with om?

2:33 dnolen: noprompt: not that I know of, most of their users are JS users and we use React in a unorthodox way

2:34 noprompt: the React devs are down with immutable data structures so I'm sure they'll push those since that gives them a lot more leverage / freedom

2:35 noprompt: but I think Om can blaze a trail and show what's possible if you have efficient access to app state history

2:36 noprompt: I think once people grok that, they won't want to go back to whatever they were doing before

2:36 noprompt: it only takes a cursory look at existing Undo solution in JS to realize it's a joke

2:36 granted it's a joke every where else too

2:39 noprompt: dnolen: completely cloning application state?

2:41 dnolen: noprompt: well no one does that. but the command pattern and recording inverses and all the madness.

2:41 noprompt: but we can just clone the app state because it's not expensive for us.

2:42 noprompt: dnolen: oh yuck. heh, i completely forgot about that.

3:34 wafflepilot: is sandbar pretty commonly used to abstract sessions?

3:35 it seems that it isn't a very active project

4:26 alew: hrm, did the behavior of indention change in clojure-mode? example: https://www.refheap.com/22489

4:40 Clome_: I have a record which has many propreties (defrecord Fo [a1...a10]). Is there an easy way to instantiate it with fewer arguments? Now if I want to instantiate it with 2 args I would have to do something like this (Fo 1 2 nil...nil) with 8 nils.

5:06 t3soro: Is it possible for a (dosync (future ...) (alter some-ref)) to have the future execute twice during a transaction intersection, or does the lang guard against that

5:09 shock_one: Everything in dosync can be executed multiple times, that's why you mustn't put there anything with side-effects. But since future caches its results, its body will run only once.

5:12 xificurC: can anybody help me why is this happening? https://www.refheap.com/22491

5:17 shock_one: xificurC: should be (osci [f v] ...

5:17 Sorry '(f v)

5:18 No, I misunderstood what it does.

5:19 xificurC: shock_one: its a 4clojure problem, its like iterate but should apply the provided functions in a cycle

5:19 ryanf: I think it's because in your recursive call you're doing (osci (f v) [array of fns]) instead of (osci (f v) fn1 fn2 etc)

5:19 so you need to apply it or something

5:19 or else make osci take a seq of functions to begin with

5:20 xificurC: ryanf: I see it now, thanks!

5:28 shock_one: I want to execute a couple of functions concurrently with delay. Right now the code looks roughly like this https://gist.github.com/anonymous/aaed7ff0b206c5fddcb7 . When I execute it from the REPL, it finishes right away (because I don't dereference futures), but when I run it inside the main- function of my project, all the futures execute, and the process continues running forever? Can somebody explain me what's going on?

5:31 Ha, I just had to call (shutdown-agents). RTFM, stupid!

5:34 But still, what's so special about -main that it changes behaviour?

5:38 amalloy: shock_one: nothing. -main returns immediately; it's just that the jvm doesn't shut down until all non-daemon threads are finished

5:38 the fact that the jvm doesn't shut down surprises you when you run -main, but it doesn't surprise you at all from the repl

5:42 shock_one: Thank you. I tried to run this script with lein exec plugin, and it did shut down execution. Maybe it's just because lein-exec does some weird things.

5:47 logic_prog: tbaldridge: you should do more youtube videos

5:47 tbaldridge: it increases average IQ of clojure programmers

6:11 anildigital: logic_prog: link pls

6:22 logic_prog: anildigital: ?

6:22 anildigital: logic_prog: I mean the videos you were talking

6:23 logic_prog: $9.99 please

6:23 http://www.youtube.com/watch?v=R3PZMIwXN_g

6:23 I will take bitcoin + litecoin + dogecoin

6:23 much knowledge, so clojure

6:23 :-)

6:24 is there a goog dutotirla on how nrepl middleware works?

6:24 I need to understand how cljx middleware + nrepl middleware work together

6:27 pepijndevos: Do sorted maps allow getting the first/last item?

6:30 (they are red-black trees, no?)

6:31 ered: pepijndevos: it should, sorted-map is just a subclass of map

6:31 ,(first (sorted-map :z 1, :b 2, :a 3))

6:31 clojurebot: [:a 3]

6:31 ered: ,(last (sorted-map :z 1, :b 2, :a 3))

6:31 clojurebot: [:z 1]

6:31 ered: ,(sorted-map :z 1, :b 2, :a 3)

6:31 clojurebot: {:a 3, :b 2, :z 1}

6:31 amalloy: ered: last is very expensive, though

6:32 you want (first (rseq some-sorted-map))

6:32 pepijndevos: ered, ok, let me restate that, can it e *efficiently* do that. first and last cast to a seq

6:32 amalloy, ah, smart

6:32 amalloy: pepijndevos: first is fast, of course

6:32 pepijndevos: yea, and rseq ins O(n) right

6:32 erm 1

6:33 so that'd be O(2) :P

6:34 is rseq lazy? Must be...

6:35 cool. exactly what I want

6:37 amalloy: it's as lazy as seq: it just allocates an ISeq object with a different iteration order (unless the map is empty, of course, in which case it returns nil)

6:38 alew: does rseq only work for vector and sorted-map?

6:38 Glenjamin: why isn't last implemented as (comp first rseq) for seqs in that case?

6:40 amalloy: it works for anything that implements Reversible

6:41 in the clojure language core, the only such things i know of are vector, sorted map, sorted set

6:41 but of course you can implement Reversible yourself, so it can't "only" work for any list of things

6:51 mischanix: Is there a fn form of and?

6:52 pepijndevos: #(and %1 %2)?

6:52 mischanix: ,(apply and '(true false true))

6:52 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)>

6:53 amalloy: &(doc every?)

6:53 lazybot: ⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

6:53 pepijndevos: &(reduce #(and %1 %2) '(true false true))

6:53 lazybot: ⇒ false

6:54 pepijndevos: $findfn {:a 1 :b 2} :a [:a 1]

6:54 amalloy: :(((( pepijndevos

6:54 lazybot: [clojure.core/find]

6:54 amalloy: reduce and is really bad. that's what every? is for

6:54 mischanix: Yeah, every? works nice. Thanks

6:54 pepijndevos: True

6:55 I keep forgeting about every? and some and what they do.

6:55 mischanix: Heaps of idioms to remember, yeah

6:59 Glenjamin: would you do (every? true? x) or (every? identity x) ?

7:00 mischanix: I was mapping to to get the booleans, so I managed to just do (every? #(% c) ...

7:00 pepijndevos: Glenjamin, depends if the seq is pure booleans or other stuff.

7:01 amalloy, other thn that it looks a lot nicer, what makes reducing with and slower?

7:01 ohwait, you said bad, not slow

7:02 amalloy: &(reduce #(and %1 %2) (repeat false))

7:02 lazybot: Execution Timed Out!

7:02 amalloy: &(every? identity (repeat false))

7:02 lazybot: ⇒ false

7:02 pyrtsa: reduce is greedy unless you use reduced to return the short-circuited result.

7:02 amalloy: it's much slower too, in cases like that, har har

7:02 mischanix: slight difference between much and infinitely

7:03 pyrtsa: (def all? (partial every? identity)) is a good idea IMO.

7:03 (In case it's needed often.)

7:04 (def any (partial some identity)) likewise.

7:05 mischanix: I feel like I'm going to end up rewriting everything multiple times as I learn nicer ways to do stuff

7:08 Glenjamin: the biggest annoyance i have left from when i learnt clojure while writing this app

7:08 is that my namespaces are holding state

7:08 not much state, but enough to be annoying

7:08 pyrtsa: I agree.

7:09 Glenjamin: https://github.com/stuartsierra/component/ seems like a good approach to having a module-like construct that sits alongside namespaces

7:10 but i'm procrastinating refactoring over to it

7:11 sveri: hi, has anyone here experience with pedestal and caribou, what would you prefer for future web development?

7:11 pyrtsa: I dislike the fact in component/Lifecycle that there ends up being separate construction and start steps. A much simpler model would be one where there's just a reset step that disposes of all resources.

7:11 Glenjamin: ^

7:12 pepijndevos: What would be a nice way to get a sane default from (key (first ()))

7:12 Glenjamin: pyrtsa: would that mean you could only have one "instance" ?

7:13 pyrtsa: Glenjamin: That would be the base case, yes. Then you could have an extension of the base case where you can register a stack full of nested resources that get reset recursively (and in reverse order).

7:13 Glenjamin: pyrtsa: i think it's useful to be able to have multiple instances around

7:13 for example, my testsuite runs with "production" settings, but my dev server doesn't

7:14 pyrtsa: Oh, sorry, nothing like a singleton.

7:14 Glenjamin: at the moment i need two JVMs

7:14 oh, so you'd have (def system (create-system)) and (reset-system system) ?

7:14 pyrtsa: So yeah, you could have several instances. And you could nest them. I'm just saying that the current protocol interface of Lifecycle is not well thought. It gets too complicated.

7:15 Glenjamin: Yes. And create-system would both initialize and start.

7:15 Glenjamin: my assumption was the separation of init from start was something to do with circular dependencies

7:16 but i'll have to see how it feels when i try it

7:16 pyrtsa: Because what good is a system in a not-yet-started state? You could as well just introspect your arguments to create-system.

7:16 Circular dependencies: bad idea. :)

7:19 Glenjamin: i suppose this approach lets you build a default system, then replace bits, then "start" it

7:19 pyrtsa: You could as well have a set of default arguments that you can replace bits of, before calling create-system.

7:20 Glenjamin: yeah, you're making a lot of sense

7:20 pyrtsa: With the two-step initialization of the system, you just end up having logic that belongs together in two separate places (two differnt functions anyway).

7:23 pepijndevos: Somehow underscores have become invisible in vim when typing clojure...

8:04 freetonik: Hey, guys! I'm a JS developer and I was digging into Clojure for the past month. I think I'm in love and I want to start my next project with Clojure. The project is an educational platform for programmers (courses, tests, interactive tutorials, homework, etc). The problem is: my colleagues don't really share my new passion and prefer to stick with PHP and

8:04 Python. The only switch they are willing to make is one to Scala. Could you recommend something to convince them?

8:06 justin_smith: freetonik: well, both scala and clojure would be big changes from php/python, but some of the reasons are different

8:06 klokbaske: freetonik: what are their reasons to want Scala?

8:07 freetonik: Scala: bigger community, wider acceptance and use in production, less painful switch from traditional OOP

8:08 justin_smith: probably the best arguments clojure has for it (compared to scala) is being concise and mostly staying uncomplicated

8:08 the hard part to sell with clojure is the syntax, but the syntax is actually extremely simple, just unfamilair (as you probably know by now)

8:09 freetonik: syntax is not really the issue for them, it's the warm feeling of "more big companies are using it" what matters for many people

8:12 justin_smith: well, more big companies won't use it until more big companies use it

8:12 kzar: freetonik: I would expect getting a whole company to switch to Clojure when they're against the idea would be harder than getting a new job

8:12 mrhanky: how can i change the working dir if using "lein run" where the main method does a (load-file "resources/foo/bar.clj")? i want the working dir to be "resources/foo"

8:12 is this possible?

8:13 freetonik: kzar: haha :) unfortunately, I'm not in a position to do that, but I'll write this down for the future

8:13 justin_smith: mrhanky: java sucks regarding environment variables, working directory happens to be an environment variable

8:13 mrhanky: i already read that there's no simple "change dir" command :/

8:13 justin_smith: I guess because there is no portable way to do setenv, the jvm does not provide setenv, kind of sucks

8:13 as far as the OS is concerned, the "working dir" is just an env dir your process has

8:14 see above regarding non-portability of setenv

8:14 if you know you will always be on posix, there are hacks that work on posix

8:15 mrhanky: no, should be plattform independ. i though about just symlinking my two files to the project dir where i run lein, but i dont know if symlinks will work on a non-posix system if pushing everything to git

8:16 justin_smith: mrhanky: are you familiar with clojure.java.io/resource?

8:16 you could ensure that the files are in classpath under a unique directory name

8:16 and set :resource-paths in project.clj to include the parent dir

8:17 s/and set/by setting

8:17 mrhanky: no, i'm a bloody clojure-beginner with some java knowledge

8:17 justin_smith: :resource-paths is a key in project.clj which adds non-source / non-java directories to the classpath at runtime

8:17 clojurebot: Alles klar

8:18 mrhanky: sounds like this could solve my problem

8:18 justin_smith: I wonder if :resource-paths can use absolute file paths, if so that would be sufficient for you I think

8:18 the trick is, after that you use clojure.java.io/resource to resolve the location

8:19 if it will always be a true file path, you can do (io/file (io/resource "name"))

8:46 jtoy: are there any libs for building restful api libraries on existing web apis

8:46 like faraday in ruby

8:58 shriphani: Hi, I have an expression: (reduce (fn [acc [x y]]) (merge-with concat ......)) which leads to a stackoverflow. Is there anything quick I can do (short of a refactor) to fix this ?

9:10 ambrosebs: shriphani: is the merge-with inside the reducing function?

9:10 shriphani: ambrosebs, yes.

9:11 ambrosebs, is a group-by better than the merge-with ?

9:12 ambrosebs: shriphani: not sure. What's causing the stackoverflow?

9:14 shriphani: ambrosebs, the stack trace: https://www.refheap.com/22495

9:14 and I have exactly 1 call to concat in my function

9:15 so my hypothesis is that there is a large chain of concats

9:16 ambrosebs: shriphani: all I can think of is trying an eager concat

9:16 ,((comp doall concat) [1 2] [2 3])

9:16 clojurebot: (1 2 2 3)

9:17 shriphani: ambrosebs, let me try that out.

9:17 ambrosebs: if there are lots of dups in the maps, that might be the issue

9:18 shriphani: ambrosebs, I convert a large vector of [[k1 v1], [k2 v2], [k1 v3]] format to a map

9:18 and in this case yes, there are a lot of dups.

9:19 ambrosebs, nah stackoverflow still

9:20 I increased the stack size to 1g.

9:20 ambrosebs: shriphani: can you see the bottom of the stacktrace?

9:20 shriphani: is there a way to make clojure.stacktrace print that ?

9:20 ambrosebs: (pst e 100000)

9:20 *e rather

9:20 sorry, (clojure.repl/pst *e 1000000)

9:21 not sure about clojure.stacktrace

9:21 shriphani: ambrosebs, its concats all the way through

9:22 and my own ns doesn't appear at all

9:23 ambrosebs: shriphani: ok that's common IME

9:23 shriphani: ambrosebs, it looks like that stacktrace I sent you repeated over and over again

9:25 I guess I can prune the list a bit, after 100 concats, refuse to accept more.

9:26 ambrosebs, do you have a better solution ?

9:26 ambrosebs: shriphani: not sure if using a set would help

9:27 shriphani: hmm, I changed the merge-with concat to a merge-with union

9:27 and it still shows a call to concat in the stacktrace

9:28 ambrosebs: shriphani: right, seems like the problem is elsewhere?

9:28 shriphani: hmm, I don't see another call to concat

9:29 let me paste my function

9:29 ambrosebs: shriphani: thanks

9:29 shriphani: ambrosebs: https://www.refheap.com/22496

9:30 ambrosebs: shriphani: try sticking a doall around your lazy sequence processing functions

9:30 like filter and map

9:31 perhaps there's too many nested lazily

9:32 shriphani: StackOverflowError clojure.core/concat/fn--3923

9:32 is it in one of the libraries ?

9:33 ambrosebs: have you tried sprinkling prn's to narrow the source down?

9:34 shriphani: no not yet.

9:38 Glenjamin: have you tried a smaller input?

9:38 if you can find the breaking point it may shed some light on the problem

9:38 shriphani: Glenjamin, it works fine with smaller input

9:40 Glenjamin: maybe try replacing the merge-with with a manual loop..recur?

9:40 shriphani: ok I found the bug

9:40 I was performing a cross product using a (reduce concat (map ....))

9:40 instead of a (for [x l1 y l2] [x y])

9:42 ambrosebs, thanks for the help

9:44 ambrosebs: shriphani: np

9:44 shriphani: ambrosebs, is there any way to find my ns in those stacktraces ?

9:45 ambrosebs: shriphani: I think java loses the bottom of some SOE's

9:45 shriphani: ah.

9:45 ambrosebs: shriphani: I think your message being "null" didn't look like a good sign

9:46 shriphani: just from experience, I don't really know what's going on underneath

9:54 kzar: Having a go at this puzzle http://www.4clojure.com/problem/85 . I have some code that works but it's too slow to pass the last test. Any ideas? https://gist.github.com/kzar/4be355c7f3b026cd22d5

10:04 rovar: it can't run on a set of 4 items in 2 seconds?

10:05 or 8 items

10:05 err the 10 item one below it..

10:05 kzar: ,(count (range 10))

10:05 clojurebot: 10

10:06 kzar: I get why it's inefficient I just can't see how else to implement it

10:08 rovar: kzar: you're recursively building a set

10:08 which is a log time operation at best

10:08 how about recursively build a list of elements, which is a constant time operation, then call set on it.

10:09 so basically have (defn power-set [inval] (set (loop [acc] ... (recur updatedacc)))

10:09 so the inner loop builds the list

10:11 btw I mean conj-ing onto a list is a constant time op, the actual building of the list is not :)

10:14 kzar: rovar: I don't follow

10:15 llasram: rovar: `conj`ing to a hash-set is also constant-time

10:17 noonian: it's more expensive to add to a set because the set needs to maintain the property that each element is unique

10:18 rovar: I assumed the hash-set was a tree

10:19 llasram: rovar: that would be a TreeSet :-) which you can create via `sorted-set` in Clojure

10:19 rovar: ah

10:19 thanks for the clarification

10:33 shock_one: In Haskell I can pattern match on function parameters in a definition. But it looks like in Clojure it's only possible to match on arity. Can I do something like (defn foo ([nil] []) ([param] "result")) ?

10:35 joegallo: i think https://github.com/clojure/core.match offers something like that, but it wouldn't be at the top-level function definition

10:35 TEttinger: shock_one, I think multimethods can do that

10:35 joegallo: you'd have (defn foo [x] (match [x] [nil] [] [_} result))) or something like that

10:36 oh yeah, a very good point.

10:36 multimethods.

10:36 TEttinger: ,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))

10:36 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No method in multimethod 'print-dup' for dispatch value: class [D>

10:36 TEttinger: ,(defmethod print-dup (Class/forName "[D") [a out] (.write ^java.io.FileWriter out (str "#=" `(double-array ~(vec a)))))

10:36 clojurebot: #<MultiFn clojure.lang.MultiFn@1ceaced>

10:36 TEttinger: ,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))

10:36 clojurebot: "#=(clojure.core/double-array [0.0 1.1 2.2])"

10:36 TEttinger: that's a multimethod for double arrays

10:37 ,(defmethod print-dup (Class/forName "[C") [a out] (.write ^java.io.FileWriter out (str "#=" `(char-array ~(vec a)))))

10:37 clojurebot: #<MultiFn clojure.lang.MultiFn@1ceaced>

10:37 TEttinger: ,(binding [*print-dup* true] (print-str (double-array [\a \b \2])))

10:37 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number>

10:37 TEttinger: ,(binding [*print-dup* true] (print-str (char-array [\a \b \2])))

10:37 clojurebot: "#=(clojure.core/char-array [\\a \\b \\2])"

10:44 shock_one: TEttinger: here's what I've got with multimethod and without. I think it's a little bit overkill https://gist.github.com/anonymous/69b1079de64750b4f0b5

10:46 joegallo: yeah, i'd go with the former...

10:46 if you can tolerate nil ~= empty collection punning you could single branch the if.

10:49 shock_one: Thank you, but it should definitely be an empty collection.

10:52 sveri: hi, has anyone here experience with pedestal and caribou, what would you prefer for future web development?

10:52 shock_one: How much time do you program in Clojure? I started learning it like a week ago. I know a great deal of popular languages, and I absolutely in love with Clojure.

10:53 sveri: compare the amount of stars on github.

10:55 sveri: shock_one: funny idea, i guess that one goes to pedestal

10:55 jumblerg: sveri: i'd suggest taking a look http://hoplon.io/.

10:56 kzar: sweet I figured it out https://gist.github.com/kzar/4be355c7f3b026cd22d5

10:57 sveri: jumblerg: why would you suggest hoplon instead of pedestal/caribou?

10:59 jumblerg: sveri: i can't speak to caribou. but i started with pedestal and found that it was designed to solve problems that were different from mine before transitioning to holpon, which was just released a couple weeks ago.

11:00 shock_one: sveri: what is web development? I guess there is no silver bullet, and the choice depends on what you need.

11:01 sveri: jumblerg: i see that, it makes sense, however, pedestal ist just a new way to go and as a developer for years i find it hard to adapt myself to that style and i wonder if i can easily integrate existing libraries into frameworks like pedestal

11:02 one thing i dont like to care about is authentication, for instance, for clojure there is the friend library and it would be nice if a framewok would support the integration of it

11:04 jumblerg: sveri: pedestal's current design (it is going through a major rewrite now) was designed to solve scalability problems by using an abstraction known as an interceptor on the server that allows threads to be released while an http requests is parked and thereby allow the server to handle more requests. this complexity comes at a cost, however, for a problem you're unlikely to have as someone getting started.

11:06 sveri: the app/browser part of the framework hasn't been finished yet and isn't ready for prime-time.

11:10 sveri: re authentication, friend doesn't play nicely with the interceptors on the server (been there). but if you do go the pedestal route, there's https://github.com/propan/geheimtur.

11:14 sveri: but this library also seems to have difficulty with service interceptors. all functions are all called on the :enter stage and it doesn't implement any of the others such as :leave on the way out, which caused problems i had to refactor around.

11:16 sveri: you might want to try talking to the guys on #hoplon; they're pretty helpful.

11:25 sveri: just noticed your previous comment - on a starbucks network with the usual connectivity issues. are your existing libs written in java, clojure?

11:37 sveri: jumblerg: i am not to sure which libs i might use, normally on the java route its just easy to use some java libs in a traditional web application and i cannot see if its similar in pedestal or not, i just dont really get a grasp on it, part of the problem might be that i am new to clojure at all :D

11:39 jumblerg: sveri: unless your existing libs have specific http dependencies, i can't imagine that your choice of a web development framework will make any difference.

11:40 sveri: jumblerg: so basically one could say that on the backend i might still use whatever i want

11:41 jumblerg: sveri: clojure's java interop should allow you to use all of them.

11:41 sveri: jumblerg: :-) thanks for that geheimtür hint

11:43 jumblerg: sveri: with respect to your java lib interop requirement, yes

11:43 sveri: jumblerg: a friend of mine wants to use pedestal, he likes the way pedestal builds everything around messages, which is nice, but i just cannot get warm with it

11:44 jumblerg: sveri: np! just be aware that, while i think geheimtür is on the right track, i believe it incorrectly implements the service interceptor interface as well.

11:45 sveri: jumblerg: hm, thats another point, it all seems to be so unmature compared to everything that is build around ring

11:46 jumblerg: sveri: it solves different problems with the service and doesn't have a full solution on the client yet.

11:48 sveri: jumblerg: what do you mean with "doesn't have a full solution on the client yet."?

11:53 jumblerg: sveri: last time i checked (a couple months ago) they were working on the clojurescript app model but didn't have the idioms worked out yet for the redering layer, and were relying on third-party libs to fill the gap.

11:53 sveri: jumblerg: ok, thank you very much

11:55 jumblerg: sveri: np! i did find the pedestal team to be quite helpful, so if you have specific questions, i'd suggest directing them there in the google group; i know there are some significant changes underway, and my experience is a bit dated.

11:56 sveri: jumblerg: yea, they are, like every clojurian i met so far

12:02 jumblerg: sveri: i'd recommend taking a serious look at hoplon. it relies on ring for most of the service stuff, but abstracts the http protocol away so you can just call clojure functions across the network. it also puts a layer over the dom to give you a solid client-side development platform.

12:02 sveri: jumblerg: did you do some authentication with hoplon already?

12:05 jumblerg: sveri: yes. using the approach used in the demo apps. it doesn't handle things like oath yet for you, but think you'll find the primitives it does provide more manageable to build on.

12:06 sveri: jumblerg: i see, do you know if they build this themself or if they use something already existent?

12:07 jumblerg: sveri: i'd direct any questions you have about it to octagon in the #hoplon channel, i think he's there now.

12:08 sveri: jumblerg: thank you again very much, i will do it then in a few minutes :-)+

12:08 jumblerg: sveri: i can tell you my company is using it quite successfully, without the ability to go into too much detail.

12:09 sveri: jumblerg: who do you work for? my company has built a pretty large stack of java solutions and i do clojure only for my private projects so far

12:11 rovar: is there a function to remove the nth item of a seq?

12:12 jumblerg: sveri: a startup.

12:14 bbloom: rovar: no, intentionally

12:15 rovar: you can make one with concat, take, & drop, but it's something you can only do O(N), so it's not in core to guide you away from that

12:16 rovar: usually there is a better way, but it's totally OK to do the O(N) thing if you've got a short seq (less than 30ish items, probably)

12:19 rovar: bbloom: I'm working on the power-set problem, I'm trying to figure the most data-structure efficient way to create the permutations..

12:19 or the subsets, and the permutations of subsets

12:20 I guess if I split the set up into singles, I could recombine them in constant time ops

12:21 is conj ing a vector a constant time operation?

12:21 or better than O(n) ?

12:21 shock_one: Yes. Almost.

12:22 bbloom: rovar: conjing on to anything is an "effectively constant time" operation

12:23 rovar: it's actually constant time on to persistent lists & it's basically log30(N) or log32(N) for vectors, maps, etc

12:23 rovar: so I could conj two subvecs and get the result I'm after..

12:23 shock_one: How do you plan to permute sets it they're unordered?

12:23 rovar: I plan to do everything in vectors and then convert back to sets

12:23 bbloom: rovar: conj adds an item, if you conj a sub vec on to a vec you'll get [something like [this]]

12:24 rovar: right..

12:24 and concat is linear..

12:24 for vectors?

12:25 shock_one: I would just write a permutation function by myself. Like a one that takes an array and returns an array of arrays.

12:26 rovar: the permutation part is the easy, it is quickly creating all of the subsets that is proving difficult..

12:27 pyrtsa: rovar: concat is fast, but AFAIK it returns a lazy seq that isn't random-accessible anymore. (into vec1 vec2) is O("(count vec2)").

12:27 jowag: rovar: concat is constant time

12:30 hyPiRion: concat is not constant time, it's linear in the length of the second collection. It is, however, lazy

12:30 shock_one: rovar: if you have a function that creates permutations, you just have to concatenate all the permutations for k Є {1 ... n-1}.

12:30 pyrtsa: hyPiRion: Is it? If you don't traverse the result?

12:31 rovar: because it's lazy, you're both right..

12:32 hyPiRion: pyrtsa: Then the concat function hasn't finished, but sure

12:32 rovar: shock_one: I looked at the combinatorics/combinations implementation, I'd really not like to replicate that if I can avoid it.

12:33 bkolobara: Hi. I'm trying to learn clojure by building a toy project. I'm a bit stuck now and hoped to find help here. I would like to connect from a clojurescript application running in browser to a nREPL instance. When I run lein repl I can see the port that the nREPL is running on. But I can't find information what protocol is nREPL using to talk over this port. Or maybe there is already an existing ClojureScript library that can be used for

12:33 rovar: bkolobara: check out frodo

12:34 it is a wrapper around a project called austin which does what you want

12:34 just makes it easier, IMO

12:39 freetonik: Guys, is a lot of nested maps a bad sign? I'm trying to describe a large entity and end up having 5-9 levels of nested maps...

12:39 assoc'ing them becomes pain in the ass too

12:40 rovar: freetonik: sometimes it's necessary, most clojure apps seem to have a single map of maps for their main data set.

12:40 also, assoc-in and get-in are your friend

12:41 freetonik: so, I shouldn't really worry about performance in my case?

12:41 pyrtsa: Measure first, then worry.

12:41 freetonik: yeah, assoc-in and get-in help a lot

12:41 okay, thanks a lot!

12:42 pyrtsa: Also, update-in.

12:42 llasram: 5-9 levels of distinct semantic entities, where your code is actually needs to reach in 5-9 level deep? That sounds like a design issue in any language

12:42 hyPiRion: Performance shouldn't be a consideration unless you notice the app is slow. Obviously don't overdo the "premature optimisation is bad" thing, but if it's not slow, don't worry too much

12:43 I see 5-9 levels rather deep, as llasram pointed out. But I don't really know your use case, so heh

12:44 freetonik: llasram: yeah, I think I need to reconsider the design of that part of the app..

12:45 clojure community seems to be very nice even with stupid questions like mine ;-)

12:55 justin_smith: sveri: if still have any questions about caribou I am one of the caribou devs, and also I hang out on #caribou

12:55 *if you still

13:10 kzar: ,(Integer/toString 100 100)

13:10 clojurebot: "100"

13:10 kzar: Shouldn't that return "10"? ^^

13:11 ,(map #(Integer/toString % %) (range 100))

13:11 clojurebot: ("0" "1" "10" "10" "10" ...)

13:14 llasram: From the javadoc: "If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the radix 10 is used instead. "

13:14 So surprising, but documented

13:14 radix: :(

13:14 llasram: heh

13:15 Just state in range, radix, and everything will be fine

13:15 s,state,stay,

13:15 kzar: Puzzle I'm doing required I handle things out the rang

13:15 e

13:17 llasram: How do I eval Character.MIN_RADIX at the repl?

13:18 llasram: ,Character/MIN_RADIX

13:18 clojurebot: 2

13:18 kzar: ,Character/MAX_RADIX

13:18 clojurebot: 36

13:18 kzar: ty

13:19 boo back to work tomorrow, I've been enjoying messing with some Clojure again

13:20 llasram: Just use Clojure at your work. Problem solved!

13:22 kzar: llasram: Well aim is to get somewhat productive this year, that being the ultimate aim

13:22 goal*

13:26 llasram: I see... Well, nothing gets you productive faster than working with something on a regular basis :-)

13:33 seangrove: I'm seeing a huge delay serving static files when developing locally with ring, about ~1s delay between each file being requested and served (sequentially). Developing cljs with {:optimizations :none} this way makes it pretty painful, since it includes dozens of files (one for each dep).

13:43 mrhanky: does clojurescript have (char?) ?

13:53 yeoj___: I'm trying to learn enlive through the tutorials.... can anyone tell me what :> does inside a vector? I can't seem to find it on the cheat sheet...

13:54 marcopolo`: yeoj___: It's like the css selector

13:55 i.e. "div > #foo"

13:56 fredyr: mrhanky: nope i don't it exists

13:57 mrhanky: chars don't really exist in clojurescript at all

13:57 yeoj___: marcopolo`: ok, ok so : says "symbol" and then > is the actual name bit to the symbol?

13:58 marcopolo`: :> is a keyword, and the > part refers to it's equivalent css selector

13:59 yeoj___: maybe i have to read up on what a CSS selector actually is... this whole space in new to me.

13:59 last website i built was perl cgi 15 years ago.

14:01 kzar: With defn you can specify a function that takes different optional arguments, can you do the same with fn or letfn?

14:05 I want to do something like (defn example ([i] (example i "")) ([i s] ...)) but with letfn or let and fn.

14:06 gfredericks: ,(letfn [(example ([i] (example i "")) ([i s] {:i i :s s}))] (example 12))

14:06 clojurebot: {:i 12, :s ""}

14:06 kzar: oh cool

14:06 fredyr: btw there isn't a clojurescript bot is there? or a way to eval cljs

14:07 (like a cljs mode for clojurebot)

14:07 rhg135: fredyr, challange accepted

14:07 fredyr: :D

14:08 rhg135: but first i need some help with this

14:08 https://bitbucket.org/rhg135/jimjure/src/c96e5858eef45e424ca1afc07797a6349234f4f0/src/jimjure/json.clj?at=dev#cl-21

14:09 i need a way to make that seq not end on the first bad json

14:09 it hangs up the server

14:09 well that connection

14:10 as in it drops the client if you send bad json

14:10 should be easy, but i don't see it

14:13 seangrove: fredyr: They're cljs-fiddle

14:13 Could probably be made into a bot

14:14 fredyr: seangrove: right

14:15 gfredericks: there is over a foot of snow here and the high tomorrow is -12F

14:15 ...and it's snowing

14:30 rovar: bwahaha

14:30 I have my partition based superset generator working. And it is slow as balls

14:31 actually, I could make the partition logic much more efficient, right now it is a cartesian set of the count..

14:39 technomancy: I think the spammers are on to me

14:40 gfredericks: wat oh no

14:40 technomancy: gfredericks: only two @ClojureMarkov RTs in the past three days!

14:40 or maybe they're on vacation

14:41 gfredericks: whaht is this tooter

14:41 technomancy: https://mobile.twitter.com/ClojureMarkov

14:41 gfredericks: I'm immediately disappointed with humanity

14:42 technomancy: it's so weird; there are no links

14:42 pjstadig: technomancy: you need to just stop using your saved search for "clojure"

14:42 technomancy: just some base64-encoded junk like pCZCXe at the end of each

14:42 gfredericks: what percentage of tweets are human-composed?

14:42 technomancy: pjstadig: nevar

14:42 gfredericks: technomancy: probably somebody tunnelling messages over toots, eh?

14:43 technomancy: gfredericks: before christmas there were like 5 or so of these a day

14:43 sometimes they get truncated so the bytes aren't even in the tweet https://mobile.twitter.com/NatalieGimson/status/418548865134886912?p=v

14:43 which I guess is just sloppy?

14:43 gfredericks: not a very subtle kind of stegaography

14:44 technomancy: right now I'm just collecting them

14:44 once I have a big corpus maybe we'll do analysis for a seajure hack night or osmething

14:44 pjstadig: what are they even getting out of these things? is there like a link in the twitter profile?

14:45 rovar: Gratuity in preference to triumphal clojure twist growth: MzCKZd

14:45 full of wisdom

14:45 andyf: Bronsa: Would I be interfering with your work on Eastwood if I committed changes for linting namespaces in dependency order?

14:45 technomancy: pjstadig: no links! that's the mystery

14:45 well

14:45 occasional links

14:45 TEttinger: I think the base64 at the end is a t.co link

14:46 that they stripped out to avoid spreading spam

14:46 technomancy: TEttinger: oh that would make more sense

14:46 TEttinger: $title http://t.co/MzCKZd

14:46 lazybot: Page has no title.

14:46 Bronsa: andyf: not at all, I haven't done anything yet for a lack of time, feel free to commit what you've done :)

14:47 technomancy: TEttinger: hm, or maybe not

14:47 pjstadig: TEttinger: yeah i tried one an the link doesn't exist

14:47 maybe it *is* some kind of message transmission

14:47 andyf: Bronsa: Good. I'll assign the ticket to me. Should be ready to commit something later today.

14:47 TEttinger: https://twitter.com/BobbyPorter6

14:47 yeah

14:47 looks like it

14:48 Bronsa: andyf: cool, thanks

14:48 TimMc: "Gravid bridal buff tips"

14:48 That's some gooood markov right there.

14:48 pjstadig: some kind of one-time pad made out of a corpus of words, and the hex at the end is a checksum

14:48 andyf: Bronsa: I have at least one definite example of a project where linting in the current semi-arbitrary order causes exceptions during analysis, but doing it in dependency order makes those go away.

14:49 gfredericks: oh time to google "two-time pad" to see what happens

14:49 pjstadig: n-time pad

14:50 gfredericks: the 0-time pad is so secure it causes other things to be secure

14:51 TimMc: 0-time pad: The only way to be sure.

14:51 gfredericks: e.g., "We used a 0-time pad and HTTPS" is a common use case.

14:52 andyf: Three people can keep a secret, if two of the are dead. -- Benjamin Franklin

14:52 pjstadig: technomancy: you've stumbled into some international spy ring, time to drop off grid and disappear

14:53 gfredericks: 0-time pad reminds me of http://www.supersimplestorageservice.com/

14:54 gfredericks: pjstadig: nice

15:00 10,000 GET requests to an abacus results in eye strain

15:00 alew: anyone use clojure-mode in emacs? I'm getting new indentation behavior after an update. Looks like this: https://www.refheap.com/22489/edit

15:01 mheld: anybody here use cursiveclojure?

15:01 pjstadig: alew: i heard another recent complaint about that, and I think it has to do with https://github.com/clojure-emacs/clojure-mode/commit/492455c3737fe66993c34df2143d6a8ccce4e74b

15:02 technomancy: the weird thing is they used to consistently get the genders of the avatars to mismatch the fake names

15:02 alew: ah, that must be it

15:04 pjstadig: did you figure out a workaround or fix?

15:05 pjstadig: revert the commit?

15:05 i haven't actually run into it, since i haven't upgraded since before the Great Cider Change

15:06 technomancy: one of the links is to http://enigmamar.axfree.com/page-2330/262076?utm_medium=twitter&utm_source=twitterfeed which doesn't seem like much of a revenue source

15:13 TimMc: pjstadig: For some reason that reminds me of http://devnull-as-a-service.com/ but I can't think why...

15:15 pjstadig: TimMc: it's webscale!

16:13 gfredericks: http://dev.clojure.org/jira/browse/CLJ-207?focusedCommentId=28133&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-28133

16:14 arrdem: sweet

16:15 gfredericks: I suppose it's not too important that I understand everything rich says

16:17 tbaldridge: that's a really odd use case

16:18 hiredman: (let [...] (for [...] ...)) ?

16:18 tbaldridge: hiredman: that's not, but trying to patch up for to support (for [:let ...]) is.

16:18 gfredericks: doseq allows it

16:19 tbaldridge: all for the sake of reducing nesting...and I'm not sure that's a good reason.

16:19 hiredman: well, his example use case in the ticket is really weird

16:19 gfredericks: is there a good reason not to support that though?

16:19 bbloom: gfredericks: because "negative 100 points"

16:19 gfredericks: it's kind of simpler that way

16:19 clojurebot: It's greek to me.

16:19 tbaldridge: probably not, but there is a good reason not to do it the way mentioned in the patch

16:20 gfredericks: bbloom: ?

16:20 bbloom: clojurebot: -100 points is http://blogs.msdn.com/b/ericgu/archive/2004/01/12/57985.aspx

16:20 clojurebot: You don't have to tell me twice.

16:20 tbaldridge: the whole (for [a [1]]) is a kludge

16:24 rovar: man, I thought I was going to end up with the most elegant power set and austintaylor beat mine

16:24 gfredericks: bbloom: I don't really see this as an additional feature; it really does make for simpler from an API perspective

16:24 hiredman: random patch in jira, rich doesn't like it, film at 11

16:25 bbloom: gfredericks: it's not just about features, it's a change

16:25 it's a change that adds little to no value

16:25 just wrap the damn thing in a let & be done with it

16:25 it's such an uncommon occurrence

16:25 gfredericks: you don't put a for inside a let very often?

16:27 hiredman: "(detect the :let and then have the macro) just put the for in a let please"

16:27 gfredericks: I don't mind the idea that change is inherently costly

16:27 bbloom: gfredericks: i put a for in a let all the time, but usually it's like a chain of lets anyway, but still... now i have a question for you:

16:28 is that first let evaluated lazily?

16:28 the first :let i mean

16:28 gfredericks: that's an interesting question

16:28 the point being it's just not obvious?

16:28 bbloom: ,(take 0 (for [x (repeatedly #(println 1))] x))

16:28 clojurebot: ()

16:28 bbloom: ,(take 2 (for [x (repeatedly #(println 1))] x))

16:28 clojurebot: (1\n1\nnil nil)

16:29 bbloom: clearly that's a dirty contrived example

16:29 gfredericks: this is interesting because it distinguishes for from doseq, which is the primary inconsistency

16:29 bbloom: doseq is eager

16:29 gfredericks: exactly

16:29 so I can see this as a sensible justification for the difference

16:30 bbloom: i'd argue that the fact a leading let works in doseq is a side effect of the implementation & that a leading let should be disallowed in both cases, as it's potentially inconsistent with respect to laziness and offers zero expressivity benefits over a let/for pair

16:31 unless you want that as a lazy/force situtation

16:31 but that seems insane to me too

16:31 gfredericks: what does laziness have to do with disallowing in doseq?

16:31 bbloom: i dunno, i'm gonna stop thinking about this now b/c it seems like value of change is at most 5 points, leaving this patch at -95 points :-)

16:32 gfredericks: bbloom: mind if I mention you in a comment on a recent duplicate of that ticket?

16:32 in an attributive way

16:32 bbloom: *shrug* go for it

16:32 gfredericks: I'm just looking through tickets this afternoon

16:33 bbloom: just don't use my name to help your lobbying case one way or another :-P

16:33 gfredericks: oh I don't have a strong opinion about it

16:33 bbloom: feel free to use the -100 points system, however, heh

16:33 gfredericks: made

16:33 just trying to understand how judgments get made*

16:34 I have this thing where 50% of the time when an authoritative clojure person makes a value judgment I can't understand their reasoning

16:35 bbloom: that's why i mentioned the point system. i think it basically explains 99% of decisions :-)

16:35 hiredman: are you familiar with greek tragedies?

16:35 gfredericks: not in detail

16:36 bbloom: there are lots of decisions besides just feature/change rejections

16:36 but I do like the -100 points thing

16:36 bbloom: gfredericks: i enjoy the "what were they thinking?!" game. feel free to ask me to try to rationalize stuff :-)

16:37 TimMc: It doesn't matter if it's a "weird" use-case, or can easily be worked around: Warts and inconsistencies can cause pretty nasty effects for metaprogramming.

16:38 That's why it *matters* if = can take 0 or 1 arguments -- you might use apply.

16:38 hiredman: gfredericks: in a tragedy mortals are flung about via the capricious will of the gods

16:39 TimMc: Someone might have a macro that emits a 'for construct, and there might be a switch for whether to have some other clause in the first slot.

16:39 bbloom: TimMc: clojure.core/for isn't an ideal metaprogramming target outside of simple template expansion. it's got sytnax

16:39 TimMc: Hmm

16:40 s/$/?/

16:40 gfredericks: TimMc: oh no where did my dollars go

16:40 TimMc: :-P

16:40 technomancy: that's why I like the Oresteia

16:41 bbloom: TimMc: macros don't compose for a lot of reasons. the main reason is that they are not first class, but they also don't compose b/c syntax doesn't compose (in general)

16:41 TimMc: if you wanted to metaprogramatically generate a lazy sequence, you wouldn't target the syntax of a for-comprehension, you'd target the primitives of such a comprehension

16:41 technomancy: gods pulling shit, someone gets killed; someone else gets killed in revenge; someone else gets killed in revenge-revenge, then one of the gods is all "this has gotta stop, yo. how about a system of justice instead of just killing people"

16:41 bbloom: TimMc: ie map & mapcat

16:41 TimMc: Man, I'd do whatever the hell I wanted.

16:41 gfredericks: (inc bbloom) ;; lucidity

16:41 lazybot: ⇒ 20

16:42 TimMc: Point is, this would be a fucked-up bug to run into when building macros.

16:43 bbloom: TimMc: right, so don't build a big macro ;-)

16:43 tbaldridge: (inc bbloom)

16:43 lazybot: ⇒ 21

16:43 bbloom: tbaldridge: lol the builder of the biggest macro of us all

16:44 gfredericks: what what macro did he build

16:44 bbloom: tbaldridge: core.async :-P

16:44 TimMc: bbloom: Anyway, 'for appears to emit more optimized code than a stack of mapcats would.

16:44 tbaldridge: to be fair, only the last 10 lines are actually a macro, the other 600 are just data manipulation.

16:45 bbloom: tbaldridge: heh, i know. just kidding

16:45 gfredericks: clojurebot: a stack of mapcats |would be| a great name for a rock band

16:45 clojurebot: In Ordnung

16:46 bbloom: gfredericks: lol

16:46 arrdem: is there any sort of convention in using defn- and - prefixing function names?

16:47 it seems like both are techniques for hiding implementation details and both are considered antipatterns.

16:47 gfredericks: my convention is to not use defn-

16:47 S11001001: isn't defn- deprecated now or something?

16:47 bbloom: TimMc: maybe so, but you can achieve a "stack of mapcats" in an efficient way if you happen to need to produce a data driven list comprehension of any appreciable size

16:47 TimMc: otherwise, it's probably not a big deal

16:48 TimMc: and if it was, i'd extract the internals of map cat & expose that just like datomic has the queries in vector/syntax form and in structured/map form

16:48 TimMc: targeting syntax is convenient, but gets messy.... quick

16:49 arrdem: the - prefix convention is for protocol methods that have a normal function that wraps them

16:50 Bronsa: I've been using that for multimethods aswell

16:50 bbloom: it's also worth pointing out that with clojure macros (but not cljs macros) you can return stuff other than syntax

16:50 gfredericks: who started that one?

16:50 bbloom: ,(defmacro foo [] (range 10))

16:50 clojurebot: #'sandbox/foo

16:50 bbloom: ,(def bar (foo))

16:50 clojurebot: #<CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn, compiling:(NO_SOURCE_FILE:0:0)>

16:50 Bronsa: gfredericks: first time I saw that was in the cljs source

16:50 bbloom: ,foo

16:50 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'sandbox/foo, compiling:(NO_SOURCE_PATH:0:0)>

16:51 bbloom: ,(foo)

16:51 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

16:51 bbloom: weird... i just tried that locally

16:51 gfredericks: Bronsa: me too; or core.logic

16:51 bbloom: ,(defmacro foo [] (Object.))

16:51 clojurebot: #'sandbox/foo

16:51 bbloom: ,(foo)

16:51 clojurebot: #<Object java.lang.Object@1934946>

16:51 bbloom: ^^ there

16:52 seangrov`: What's the cljs shortcut for drilling down into javascript objects?

16:52 mischanix_: ,((apply comp (map #(partial + %) (range 10))) 1)

16:52 clojurebot: 46

16:52 seangrov`: (.. event -target -value) ?

16:52 tbaldridge: seangrov`: (-> (aget o k1) (aget o k2))

16:52 mischanix_: is there a builtin shortcut for apply comp?

16:53 tbaldridge: (partial apply comp) ?

16:53 mischanix_: Heh, feel like it's so common

16:53 alright

16:53 seangrov`: tbaldridge: Ah, yes, I support I would have to be careful about mangling

16:53 munging*

16:54 bitemyapp: akurilin: not bad.

16:54 tbaldridge: true

16:54 bitemyapp: akurilin: catching me on the wrong side of a headache for this though.

16:55 tbaldridge: you should probably mark clojure-py as unstable/alpha btw.

16:55 tbaldridge: butemyapp: I thought that was assumed by the fact that all the work on it is about 1 year old.

16:55 * bitemyapp

16:58 akurilin: bitemyapp: yeah I know, a bit intense, no rush :)

17:01 For UI-heavy functional MVC, has anybody here played around with a pattern where a user action essentially generates this big snowball map of actions to display on the screen, which you process only once the result map has been fully accumulated? Think of a game where you need to display 3-4 different notifications / UI updates to the user, and you postpone making them until the very last step.

17:02 seangrov`: Hahaha, I can't tell if you're trolling or not, akurilin

17:03 akurilin: seangrov`: well I'm just trying to figure out how to minimize the spaghettiness of this really thick View/Controller I have which has a ton of visual updates / analytics updates interspersed in it.

17:03 seangrov`: akurilin: I thought you might just be slyly trying to talk about monads

17:03 akurilin: So I'm thinking that if I were to make it as pure as imaginable, things might get a lot saner.

17:03 seangrov`: essentially that's what I'm thinking of

17:04 seangrov`: except I don't know if people actually do this on client-side MVC in JS

17:04 seangrov`: akurilin: There was a good talk by Chouser (I think) about this

17:04 akurilin: I'm kind of tempted to.l

17:04 seangrov`: But yeah, it makes sense. It's also how React/pedestal work in some sense

17:05 akurilin: The really big advantage I see here is that you can unit test the crap out of this, unlike pretty much any other UI pattern.

17:05 Unless you like faking mouse clicks.

17:05 bitemyapp: akurilin: not particularly intense, I just get awful headaches.

17:09 tbaldridge: still, phew. it fell apart fast once I applied some pressure.

17:12 tbaldridge: well your conversation about clojure-py started by talking about the reader, iirc, I mentioned at that time that the reader could be lifted and used as-is. clojure-py has been discontinued for quite some time.

17:15 mrhanky: fredyr, no chars in cljs? umpf

17:17 gfredericks: I like how the clojure tests have a special.clj file that is ostensibly about testing special forms but it only tests destructuring

17:18 mrhanky: how can i check a string for beginning with "\n" in cljs?

17:19 noonian: ,(= (first (str \n \f \o \o)) \n)

17:19 clojurebot: true

17:19 noonian: ,(= (first "\nfoo") \n)

17:19 clojurebot: false

17:20 alandipert: mrhanky: (= \newline (.substring x 0 1)) is another way

17:20 noonian: ,(cons \n "foo")

17:20 clojurebot: (\n \f \o \o)

17:20 noonian: ,(apply str (cons \n "foo"))

17:20 clojurebot: "nfoo"

17:20 noonian: ,(fisrt (apply str (cons \n "foo")))

17:20 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: fisrt in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:20 noonian: ,(first (apply str (cons \n "foo")))

17:20 clojurebot: \n

17:20 noonian: 'yay

17:22 mrhanky: ,(= \newline (.substring "\newline" 0 1))

17:22 clojurebot: false

17:23 mrhanky: ,(= \newline (.substring "\n" 0 1))

17:23 clojurebot: false

17:23 mrhanky: huh

17:24 ,(= \newline (.substring "\n" 0 2))

17:24 clojurebot: #<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 2>

17:24 mrhanky: ,(= \newline (.substring \n 0 1))

17:24 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: substring for class java.lang.Character>

17:24 mrhanky: i dont get it

17:25 alandipert: mrhanky: it's a clj/cljs difference - on cljs, \newline is "\n" as there is no Character type

17:26 mrhanky: ,(= "\n" (.substring "\newline" 0 1))

17:26 clojurebot: true

17:38 mrhanky: i'm totally confused about handling chars in cljs

17:40 bbloom: mrhanky: they are just strings of length 1

17:40 ,(class \x)

17:40 clojurebot: java.lang.Character

17:41 bbloom: try that in your cljs repl

17:45 mrhanky: dont have any cljs repl bbloom

17:46 bbloom: mrhanky: check out the cljs source, then run ./script/bootstrap & then run rlwrap ./script/repljs

17:46 :-)

17:47 mrhanky: i did "lein trampoline cljsbuild repl-rhino"

17:47 bbloom: that works too

17:47 mrhanky: "Error evaluating:" (class \x) :as "cljs.user.class$.call(null,\"x\")"

17:47 org.mozilla.javascript.EcmaError: TypeError: Cannot call method "call" of undefined (<cljs repl>#1)

17:52 bbloom: mrhanky: er try "type"

17:53 (type \x) => #<function String ...

17:55 mrhanky: #<function String() { [native code for String.String, arity=1] }

18:04 well, what i really need is a replacement for (char?) in cljs

18:05 bitemyapp: tbaldridge: sure, but the reader isn't super useful without working collections - and they don't ;)

18:06 considering replacing those collections and trying to use the reader as-is.

18:06 tbaldridge: I'd recommend you don't, Python just isn't a good fit for Clojure. If you want reader, write one from scratch or something.

18:07 mrhanky: how can i check if a string equals \newline, \space, \tab, etc in cljs?

18:09 shep-home: mrhanky: does blank? work for that case?

18:09 mrhanky: i have no blank?

18:10 shep-home: clojure.string/blank?

18:10 bbloom: mrhanky: why do you need a char predicate? not saying there is no good reason, but there is likely a good workaround

18:10 shep-home: that's a shame

18:11 ,(map clojure.string/blank? ["\t" "\n" " "])

18:11 clojurebot: (true true true)

18:13 shep-home: mrhanky: That `map` works ok on http://himera.herokuapp.com/index.html (I don't have CLJS here)

18:15 mrhanky: bbloom, i'm porting a clj script of my professor to cljs. there's a function which checks if a string is a char (\newline, \space etc.)

18:15 and the original clj shouldnt be modified if possible

18:15 bbloom: mrhanky: unlikely to be possible. that's not a goal for cljs

18:15 mrhanky: >if possible :)

18:16 bbloom: mrhanky: you can (defn char? [x] (and (string? x) (= (count x) 1))) if that helps

18:16 could hurt too

18:16 alternatively, if you care about PARTICULAR chars, like \newline or \space, you can just use a set as a predicate:

18:17 (defn interesting-char? [x] (contains? #{\newline \space ...} x)

18:17 mrhanky: and what if i care about all chars?

18:18 shep-home: I think you'll have to go up a level of abstraction - why does it need to be a char

18:18 and what does it mean to be a char

18:19 mrhanky: the given script outputs \newline and \space and they need to be displayed correctly on my web project

18:21 shep-home: And \newline and \space are embedded in a string?

18:21 mrhanky: the string only contains \newline or \space

18:23 shep-home: so, then does comparing exactly to that work? -- (= \newline the-string)

18:23 since in CLJS \newline *is* a string

18:25 mrhanky: nope, will be false shep-home

18:27 shep-home: mrhanky: OK, I guess that the CLJS REPL on http://himera.herokuapp.com/index.html must be lying to me then.

18:28 mrhanky: (.log js/console (= \newline "\newline"))

18:28 gives me false

18:28 oh wait

18:29 shep-home: \newline == "\n"

18:32 At least in CLJS, I guess

18:33 mrhanky: oh this is drivin me crazy

18:33 shep-home: ,(= \newline "\n")

18:33 clojurebot: false

18:44 johnwalkergh: is there currently a way to add libraries to all new projects with lein?

18:45 for example, if i wanted to have core async available each time i did lein new x whatever

18:45 llasram: johnwalkergh: You can create your own project template

18:45 johnwalkergh: so theres no way to keep this in the profiles or something?

18:46 templates would work, but it's usually more trouble to add libraries than remove them

18:46 llasram: You can add stuff to your `:user` profile in profiles.clj, but that only makes it available to you, doesn't add it to the project

18:48 johnwalkergh: Re: trouble -- maybe you want the help of the "lein ancient" plugin?

18:49 johnwalkergh: actually, i have that too

18:49 i guess what i'd really like is to have a :default-libraries [[org.clojure/core.async ...]]

18:49 fgallina: what do Emacs people use nowadays as a clojure debugger? ritz seems to have stalled and not followed the nrepl->cider rename.

18:52 johnwalkergh: hmm. thanks for the help though

18:53 llasram: np... BTW, I believe your custom template could use a profile-provided :default-dependencies

19:01 seangrov`: Would be nice to be able to use update-in on strings

19:14 bitemyapp: seangrov`: gag gag

19:16 seangrov`: Data.Text in Haskell has good utilities for that sort of thing but you really have to be quite careful what you mean when you decompose "human" strings into sub-elements.

19:16 arrdem: bitemyapp: meh... as long as the equality semantics are retanined could be OK.

19:16 bitemyapp: arbitrary update-in is a slippery concept.

19:16 arrdem: that's not the problem, what's a character?

19:17 arrdem: is it a byte? a logical glyph/mark? a rune-in-total-with-modifiers?

19:17 arrdem: bitemyapp: it's a byte in the unicode vector constituting a string.

19:17 bitemyapp: no, it's not a byte.

19:17 it's not a byte at all.

19:17 arrdem: bitemyapp: that's the joke

19:17 bitemyapp: unicode is multi-byte.

19:17 but my point is that even unicode codepoints aren't necessarily what you want.

19:17 in many cases what you want is runes unified with modifiers.

19:18 CJK is total hell.

19:18 arrdem: you can demand a pretty penny for your services if you have a knack for CJK text processing.

19:18 seangrov`: bitemyapp: Could be, could be

19:18 bitemyapp: arrdem: http://i.imgur.com/W95z8Pi.png

19:19 * arrdem braces himself and clicks

19:19 bitemyapp: seangrov`: but I get your meaning, I guess what I'm complaining about is that you couldn't have a type-safe update-in that understands Text vs. arbitrary vectors.

19:19 seangrov`: bitemyapp: Yeah, I hadn't thought about that difference

19:19 bitemyapp: seangrov`: you really want a type system keeping you honest when you're chucking text modifications around.

19:19 seangrov`: I thought that we already can map over strings, might as well go whole-hog and update-in

19:20 arrdem: brb upvoting all of r/insanitywolf

19:20 bitemyapp: I don't really like that Strings are seqable either. Should be a bloody type error.

19:20 * seangrov` *thinks* that's the expression

19:20 bitemyapp: seangrov`: well the problem is update-in isn't part of the Seqable interface, it's a property of being "associative"

19:20 seangrov`: Heh, yes

19:20 bitemyapp: associativity implies the ability to identify discrete sub-elements

19:20 which is uh...slippery in text.

19:20 and implies making some kind of concrete decision with regards to what a "rune" is.

19:21 seangrov`: Well, it's possible with Javascript strings anyway "abc"[0] => "a"

19:21 bitemyapp: yes but that doesn't mean I'm happy about it :(

19:21 arrdem: seangrov`: for once I agree with bitemyapp. Just because you can make a sequence of it doesn't make it a good idea.

19:21 seangrov`: Well, cljs being the hosted language that it is, it seems fair enough to extend the associative protocols to it

19:21 arrdem: ... wat no why. that's a reason _not_ to.

19:27 bitemyapp: It's important to make the distinction between allowing things to be used in an associative way, but type-safe (separate types and functions) vs. glomming everything into the same interface.

19:28 map assumes Seqable, fmap assumes Functor. The former should only be used on actual sequences. If you intend a more generic/less specific notion of reach into containers (understanding that it doesn't necessarily mean "collection") then fmap is fine.

19:28 seangrov`: there are proper ways to do all of this and Clojure/CLJS have successfully ignored all of them.

19:32 seangrov`: making map into a pseudo-Seqable-cum-Functor is not the right way to do this and leads to more time wasted tracking down type errors from spurious/accidentally-semi-valid inputs.

19:32 it also makes code reuse harder because when you overload "intent" that much, the libraries can't be very precise or explicit about what sort of inputs are intended/kosher.

19:33 so given a set of functions in a library that are all expecting roughly the same kind of input, they'll have varying degrees of specificity in the types of their inputs and it'll be utterly lopsided and inconsistent.

19:33 Terrible.

19:41 alew: Clojure has no generally accepted fmap interface/implementation, correct?

19:43 coventry: Does korma have support for postgres arrays?

19:43 alew: or Functors rather

19:45 akhudek: alew: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/functor.clj

19:45 Raynes: alew: Not built in, but any seqable data structure is mappable fwiw.

19:46 arrdem: Raynes: not that there's any consensus on the fwiw part...

19:46 Raynes: arrdem: ?

19:53 alew: but when you map you always get back a seq right?

19:54 Raynes: Right, I didn't say it was functors :p

19:57 bitemyapp: alew: Fluokitten would be more to the point

19:58 alew: it's still senseless without a type system.

20:02 splunk_: silly q? does (defn foo [bigseq] (map f bigseq)) hold onto the head of bigseq?

20:04 relatedly, do all non-head-holding operations on bigseq need to happen inside (doseq [x (make-bigseq seq-precursor)] ...)

20:04 which means you pass around seq-precursor, rather than bigseq

20:06 ehabs: I'm trying to call a java function that writes to one of its arguments. is it possible to do this from clojure? In the following example I want svm/svm_cross_validation to write to `results`. (let [results (double-array (count y))] (svm/svm_cross_validation (make-problem y (map sparse-map x)) (make-params) 3 results))

20:07 or do i have to write a java function to do this?

20:08 alew: bitemyapp: perhaps being rigorous about it is pointless, but I think having the idiom would be nice instead of having to funnel into one interface

20:10 bitemyapp: alew: you can have your cake and eat it too, if you have a type system that isn't utterly tedious.

20:10 alew: it isn't just about safety either, you saw how nice Haddock documentation is.

20:12 coventry: Is there any way to operate on the return value of a korma query before the db connection is closed, or do I have to resort to jdbc for that?

20:14 bitemyapp: coventry: why would you need to?

20:16 akhudek: ehabs: if you are just passing a primitive array it should work fine

20:16 coventry: I'm experimenting with postgres arrays. I'm getting back a Jdbc4Array. When I try to call .getArray on it, I get a complaint that the connection has been closed. A solution for this in terms of jdbc was posted here: http://stackoverflow.com/a/6062708 . Was wondering whether there's a way to translate that into korma.

20:17 bitemyapp: ^

20:17 akhudek: coventry: does korma have a :row-fn like clojure jdbc?

20:18 it's easy to do in raw jdbc

20:19 coventry: akhudek: It seems as though I could use exec-raw-with. Thanks. https://github.com/korma/Korma/pull/151

20:20 Oh, except I guess that PR wasn't accepted. :-)

21:38 Mandar: hi, is there a shortcut for (val (find ...))

21:39 hiredman: ,(doc get)

21:39 clojurebot: "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."

21:39 Mandar: hiredman, thank you!

21:46 andrew__: hello

21:46 i'm seeking a short insightful explanation of the difference between a seq and a list

21:46 the REPL reports them as the same class and as identical, and equality tests work between them

21:46 so what's the difference?

21:47 hiredman: a linked list can act as it's own seq, because it trivialy fulfills the seq first/next contract

21:48 andrew__: are seqs returns from functions like (seq) just linked lists?

21:48 hiredman: no

21:48 gws: andrew__: a seq is roughly an "interface", a list is a concrete implementation (one of many possible)

21:49 hiredman: seqs are not lists, but (clojure's default) lists are seqs

21:49 gws: andrew__: http://clojure.org/sequences

21:49 andrew__: i see, so a list has the interface of a seq, while other collections must "adopt" that interface by calling seq on them, is that correct?

21:50 hiredman: a seq is basically a possibly lazy list

21:51 ered: http://stackoverflow.com/questions/4586562/in-clojure-how-can-i-implement-standard-clojure-collection-interfaces-on-my-own

21:51 hiredman: a (seq [1 2 3]) returns a seq over the contents of the vector, which is a lazily generated list of the values

21:51 andrew__: and I assume then that it would be meaningless to call seq on an existing list?

21:51 hiredman: it may or may not be

21:52 seq returns a seq

21:53 andrew__: so if you wanted to make an existing finite list lazy, you could call seq on it, that would be the primary advantage only. unlike a real seq that might be returned from an expression, a literal list cannot be infinitely large, so converting a list to a seq would only provide lazy access to a finite collection

21:58 Dolfje: AimHere, everyone alwys hates me.

21:58 No one likes me.

22:23 gfredericks: andrew__: if your list is already realized, then "converting it to a lazy seq" adds nothing

22:23 and in fact a clojure list (proper) is already a seq

22:23 andrew__: ok, thanks

22:23 gfredericks: clojure distinguishes (via the interfaces ISeq and Seqable) between things that _are_ seqs and things that can be converted to seqs

22:24 andrew__: so a list is a seq, but a seq is not a list (since it offers other features)

22:28 gfredericks: no a seq doesn't offer features, it's an abstraction

22:29 a list is one kind of seq, a lazy seq is another kind

22:29 noonian: ,(seq? [1 2 3])

22:29 clojurebot: false

22:31 gfredericks: bbloom: here's a good one for you -- why is cons part of ISeq?

22:47 bbloom: gfredericks: let me look/think

22:47 gfredericks: more particularly I suppose, why would a seq ever have an impl-specific way of consing?

22:48 (since I assume that's the only reason to include it)

22:48 Bronsa: gfredericks: ISeq.cons is actually.. conj

22:48 bbloom: Bronsa: no, it isn't

22:48 gfredericks: Bronsa: sure; I don't think that changes the question though

22:48 bbloom: Bronsa: that's IPersistentCollection#cons

22:49 Bronsa: bbloom uh, really?

22:49 bbloom: Bronsa: yup, look at the signature of RT/conj

22:49 ,(conj 5 10)

22:49 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

22:49 tbaldridge: Bronsa is right, it's a odd "bug" of clojure

22:49 bbloom: ^^ see ?

22:50 gfredericks: but ISeq extends IPersistentCollection

22:50 bbloom: yeah, i suspect that you can simply remove the cons from ISeq & nothing will cahnge

22:50 gfredericks: I think ISeq repeats the method so it can narrow the signature to return an ISeq

22:50 bbloom: my java isn't as good as my C#, where that would have to have either an "override" or a "new" modifier, lest it be a compiler error

22:50 gfredericks: and maybe that's the point?

22:51 Bronsa: oh, right. that's the point gfredericks

22:51 bbloom: ah, yes, that's precisely what's happening. signature narrowing

22:51 Bronsa: I keep forgetting about that

22:51 gfredericks: so kind of a java type-system detail I guess

22:51 bbloom: yeah

22:52 in theory, IPersistentMap could do that too

22:52 gfredericks: does cljs include cons on ISeq?

22:52 Bronsa: it includes -conj on IPersistentCollection

22:52 bbloom: anyway, you could remove that interface method & nothing would change except new programs could pass the type checker :-)

22:53 gfredericks: well a bunch of the java code would break I'm sure

22:54 refuse to compile, I mean

23:33 bbloom: gfredericks: nothing should break b/c anybody else who implements it will be simililarly narrowing the type

Logging service provided by n01se.net