#clojure log - Oct 10 2011

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

0:01 amalloy: and the exception seems to be coming from one of the String constructors, though i can't tell which one without the source handy

0:01 metajack: I'll bring it up on the list. I just wanted to make sure I wasn't missing something obvious.

0:01 brehaut: http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/lang/java/lang/String.java.htm

0:02 huh

0:03 its coming from the char[] implementation

0:04 (assuming that sort does line up with the errors)

0:30 Raynes: ibdknox: ping

0:32 ibdknox: Raynes: pong

0:53 halarnold: (+ 2 3)

0:53 clojurebot: *suffusion of yellow*

0:54 amalloy: nice work, clojurebot

1:34 duck1123: (inc clojurebot)

1:34 lazybot: ⟹ 3

2:32 ibdknox: quiet night

3:37 thorwil: it looks like the jvm is causing a click via a short disc access every few seconds here. can this be alleviated somehow?

3:38 amalloy: thorwil: you've made sure it has enough memory to not swap, i assume?

3:40 thorwil: uh, using clojure-jack-in, i may find that value in swank-clojure.el?

3:41 strike that

3:56 so it's -Xms and -Xmx, but there gotta be a mechanism to pass thos args to java when using clojure-jack-in?

3:57 Blkt: good morning everyone

3:58 amalloy: thorwil: options in project.clj somewhere. see the example lein project.clj

3:59 just to be clear, you probably want to give it less heap, not more; that will stop it from allocating more memory than it needs, getting it to gc more often instead

4:00 the jvm still uses up loads of memory regardless, so you'll still need a bunch of actual RAM if you want *no* swapping, but at least it won't grow without bound

4:02 eg, 4clojure runs with -Xmx60m, and the jvm's virtual-memory size varies between like 200MB and 600MB

4:06 thorwil: ^

4:07 and of course the disk accesses could be something other than swapping

4:08 thorwil: 0.o

4:11 amalloy: and if you *expect* your application to need loads of memory, then of course give it lots. my point is just that giving it more memory without a plan often makes performance worse, not better

4:13 thorwil: the performance is virtually uninteresting on this machine, it's just the regular short disc access driving me nuts

4:14 amalloy: that's an aspect of performance. i didn't say cpu-performance

4:14 thorwil: fun thing is, i only started noticing after getting rid of noisy fans

4:16 well, i will have to experiment. thanks, amalloy

4:37 Arafangion: GC-based languages tend to behave *badly* in low-RAM situations. :(

4:40 (There are GC algorithms to address that, but that requires VM and Kernel changes)

4:54 thorwil: well, the iotop entries that immediately preceed the noise are: http://paste.pocoo.org/raw/490282/

4:58 amalloy: thorwil: neat, i didn't know about iotop

6:40 fhd: Can I somehow avoid the "already refers to" warning in Clojure? I'm defining a function named "compile" and it conflicts with leiningen.compile, but I don't intend to use the latter.

6:40 pyr: fhd: yes

6:41 (ns your.ns (refer-clojure :exclude [compile]))

6:41 meh

6:41 (ns your.ns (:refer-clojure :exclude [compile]))

6:41 fhd: pyr: Brilliant, thanks :)

6:49 gu: is there a "zip" function on clojure that takes two seqs and return them paired? like (zip '(1 2 3) ('4 5 6)) -> [1 4] [2 5] ... ?

6:50 Chousuke: gu: (map vector [1 2 3] [4 5 6] ...)

6:52 gu: thanks :9

6:52 :)

6:53 no, wait

6:53 that's not what i need

6:53 it doesn't pair them

6:55 (for [r room m mask] [r m])

6:55 hmmm

6:55 no

7:02 babilen: gu: AFAICT (map vector [1 2 3] [4 5 6] ...) does exactly what you asked for. How does is differ from what you are really expecting?

7:05 thorwil: ,(map vector [1 2 3] [4 5 6] ...)

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

7:05 thorwil: ,(map vector [1 2 3] [4 5 6])

7:05 clojurebot: ([1 4] [2 5] [3 6])

7:06 gu: oh, it works, sorry, my mistake. thanks

7:07 babilen: Have fun :)

7:08 * thorwil wonders who's moderating clojure-web-dev

7:28 Blafasel: gu: interleave?

7:28 ,(interleave [1 2 3] [4 5 6)

7:28 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

7:28 Blafasel: oops

7:28 ,(interleave [1 2 3] [4 5 6])

7:28 clojurebot: (1 4 2 5 3 ...)

7:32 Blafasel: After playing with the basics of clojure and messing with 4clojure/project euler for a while: Can anyone suggest some good resources? I'm looking for blogs/mailing lists with examples for stuff that _aren't_ math challenges for a change. Maybe introductions to agents, stm, interfacing with the world maybe (good IO practices, both local/network, DB stuff).

7:33 Basically I want to move from 'neat toy to express fibonacci' to 'can use it for real work, albeit I'm still starting'

7:38 thorwil: on the way from simple puzzles to "useful" software, complexity explodes and describing it becomes so much work

7:39 Blafasel: Right, but I guess there will be something DB related, a couple web projects and a bunch of things about agents/stm at least

7:40 Maybe I'm just looking for decent blogs of people that are way ahead of me in the clojure learning graph

7:41 thorwil: Blafasel: maybe have a look through http://www.reddit.com/r/clojure

7:42 Blafasel: Hmm.. Good point, haven't even thought of reddit for a looong time.

7:42 Thanks!

7:43 thorwil: Blafasel: but also consider to just study code (via github), even if not accompanied by blog posts. and nothing will beat having your own project you actually care about getting done

7:48 babilen: Blafasel: I also like http://www.4clojure.com/ a lot. The "Practical Clojure" book might also come in handy ... If you find a good resource on I/O in Clojure let me know.

7:49 * babilen heard that http://nakkaya.com/2010/06/15/clojure-io-cookbook/ is not the recommended way

7:50 babilen: Blafasel: Another nice stream of clojure related information can be found on http://planet.clojure.in/

8:01 Blafasel: babilen: Thanks. Regarding hardcover books: Thinking about it right now. Need to learn to trust the mail here and find a good reseller or give Amazon a try.. :)

8:21 Arafangion: Hmm, this guy: http://www.philcalcado.com/2011/10/08/on_the_testing_in_clojure_debate.html

8:21 Can anyone suggest some more good websites that discuss that point he's making?

8:22 See, I'm practically a TDD fanatic, but it does seem that TDD doesn't work for all projects (There's no silver bullet, after all), but I'm interested in knowing why it tends to be less used for functional languages, or even in C.

8:23 Perhaps in functional languages (and C), TDD is still very useful but one has to be more aware of what defines a "unit" (Because it sure as heck isn't a function)

8:25 gfredericks: the foo# syntax in macros just does some obvious busywork with gensym, right?

8:26 I have something like `(foo# ~`(foo#)) and I don't think the foos match when you do that, so I'm considering doing it by hand

8:26 wait I can check if they match...

8:26 right so they don't

8:29 and doing it by hand with gensym worked just fine.

8:58 fhd: Is there a way of adding a JAR that is not a Maven/Leiningen project to the classpath in leiningen?

9:04 dbushenko: fhd: yep, just copi it to lib/

9:05 fhd: dbushenko: Thanks

9:05 dbushenko: add ":disable-implicit-clean true" to your project.clj

9:05 fhd: dbushenko: No declarative way?

9:05 dbushenko: what do u mean?

9:07 fhd: dbushenko: Something like :jar-dependencies "/wherever/some.jar"

9:07 dbushenko: no. but you may add your jar to maven repository

9:07 just add a dummy definition of your jar to project.clj

9:07 run lein deps

9:07 fhd: dbushenko: I guess I'll do that, thanks

9:07 dbushenko: and leiningen will tell you how to add your jar to m2

9:38 tfnico: any ideas how I can get 'lein pom' to generate a pom with <packaging>war</packaging>?

9:53 ian__: I'm looking for the de facto clojure.contrib/java.jdbc reference. When I navigate from clojure.org, I get to this page, https://github.com/clojure/java.jdbc#readme, which is not too helpful for a noob

9:53 lnostdal: ian__, https://github.com/clojure/java.jdbc/tree/master/doc/clojure/java/jdbc

9:54 ian__: lnostdal: thanks!

10:02 cemerick: tfnico: you might be able to hook into leiningen.util.maven/make-model

10:02 tfnico: what are you really trying to do?

10:03 tfnico: cemerick: I'm trying to deploy a war built with lein into a maven repository

10:04 cemerick: why?

10:04 clojurebot: why not?

10:05 cemerick: Maven repositories are fundamentally for housing dependencies; .war files are generally not useful as dependencies.

10:06 tfnico: cemerick: I find them fine for hosting deployable artifacts, whether they are jars or wars

10:07 cemerick: fair enough

10:07 hooking make-model to set the packaging as you like is probably your best bet at the moment

10:08 tfnico: anyhoo, I found a workaround: I use mvn deploy-file to upload into the repo. Specifying -Dpackaging=war overrides the (default packaging=jar) value in the pom.xml

10:08 cemerick: thanks anyhow

10:08 cemerick: heh, that's certainly simpler

10:16 ian__: I'm trying to run a simple test. I'm getting this error:

10:16 Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate java/jdbc__init.class or java/jdbc.clj on classpath:

10:16 Caused by: java.io.FileNotFoundException: Could not locate java/jdbc__init.class or java/jdbc.clj on classpath:

10:16 My project.clj has the following:

10:16 (defproject words "1.0.0-SNAPSHOT"

10:16 :description "test"

10:16 :dependencies [

10:16 [org.clojure/clojure "1.3.0"]

10:16 [org.clojure/java.jdbc "0.0.6"]

10:16 [mysql/mysql-connector-java "5.1.6"]])

10:16 Any tips on debugging this?

10:18 pyr: what's the protocol str uses again ?

10:18 (or println for that matter)

10:18 raek: ian__: the namespace you should require/use is clojure.java.jdbc, not java.jdbc

10:19 ian__: raek: Thanks. That did it

10:19 raek: but the readme fails to deliver this cruicial piece of information...

10:19 (why is this *so* common?)

10:19 devn: because people don't work on documentation

10:19 they work on features and bugs

10:20 raek: well, some readmes have tons of examples

10:20 but they often forget the ns line

10:20 devn: lots of readme's are written /from/ the project

10:21 not /to/ the project

10:21 also I should clarify I don't like weak docs or anything

10:21 I don't disagree with you raek

10:22 tomoj: raek: that one bugs me too

10:29 bsod1: what should I do to use clojure.contrib.string functions like string/partition instead of clojure.contrib.string/partition?

10:29 cark: (ns my-ns (:import [clojure-contrib-string :as string]))

10:30 err

10:30 clojure.contrib.string

10:30 of course =P

10:30 damn i'm bad today

10:30 it's :require instead of :import

10:31 sorry =/

10:31 karchie: does anyone know what happened to doc, find-doc, and source in 1.3?

10:31 There's a mention in the 1.3 changes that they've been moved to the repl

10:31 fliebel: karchie: moved to core.repl

10:31 cark: they're in clojure.repl now

10:32 ,(clojure.repl/doc reduce)

10:32 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

10:32 karchie: there it is. thanks!

10:34 raek: bsod1: clojure.contrib.string is available as clojure.string since clojure 1.2

10:34 http://clojuredocs.org/clojure_core/clojure.string

10:36 ian__: I'm seeing this warning now:

10:36 WARNING: resultset-seq already refers to: #'clojure.core/resultset-seq in namespace: words.model, being replaced by: #'clojure.java.jdbc/resultset-seq

10:36 bsod1: raek: thanks. I'm wondering which one is better, using java API or clojure for string operations and file IO?

10:36 ian__: Any tips figuring out what's going on?

10:36 clojurebot: Titim gan éirí ort.

10:39 stuarthalloway: ian__: don't :use clojure.java.jdbc, :require it

10:41 ian__: stuarthalloway: thanks! that did it. I will now re-read about :use and :require

10:41 stuarthalloway: ian__: np

10:43 raek: bsod1: you may need to use the java api for io if you read from streams directl. clojure.java.io has a lot of convenience functions that eleminates the biolerplate you'd need to write in java

10:45 for example, (io/reader "filename") corresponds to new BufferedReader(new InputStreamReader(new FileInputStream("filename"), "UTF-8")):

10:46 bsod1: I want to print a 80 character long line, is (println (apply str (take 80 (repeat "-")))) idiomatic way to do this?

10:49 cark: seems good to me =)

10:49 chouser: (repeat 80 "-")

10:49 tordmor: Why would you want to generate the line at runtime?

10:49 cark: oh nice

10:49 chouser: bsod1: but the rests seems fine.

10:50 Man, dart sure nails the easy-to-start-playing-with metric.

10:51 bsod1: tordmor: I don't want to generate the line at runtime, what is your alternative? (println "-----------------------------------------------------------") ?

10:51 rafl: is there a builtin or contrib function that'd provide me with what many other languages call "zip", i.e. going from the two lists ("a" "b") and (1 2) to the list (("a" 1) ("b" 2))?

10:52 tordmor: bsod1, yes.

10:53 cark: chouser: ah nice lambda syntax too, that's a major problem with javascript

10:54 ian__: I'm attempting to run a test that updates a database. The test is wrapped in a (sql/transaction (sql/set-rollback-only) ...) form. The function that the test is calling is wrapped in a (sql/transaction ...) form. The rollback is not happening. Any idea what I'm missing? The docs seem to say that this is only one outermost txn.

10:54 Chousuke: rafl: no, but you can use map in combination with list or vector

10:54 rafl: fair enough. thanks. just figured i might be missing the builtin function

10:55 ian__: Oh, maybe it's because I also have multiple sql/with-connection forms wrapping both sql/transaction forms

10:55 Is there a way to get the "current" connection or create a new one?

10:55 "current" could be tied to the thread

10:56 maybe (find-connection)?

11:12 When I try and use clojure.java.jdbc/find-connection it does not seem to work. I get an error saying

11:12 java.lang.IllegalArgumentException: db-spec com.mysql.jdbc.JDBC4Connection@5e89c116 is missing a required parameter

11:12 Any idea what's going on here?

11:18 gu_: how can i check if a function exists given its (eventual) name as a string?

11:19 stuarthalloway: ,(ns-resolve 'clojure.core '+)

11:19 clojurebot: #'clojure.core/+

11:23 Blafasel: ,(doc partition)

11:23 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

11:24 thoefer: what´s the easiest way to simply extract an element from a collection that fulfills a predicate? Almost like filter, but instead of filtering the original list I want to get the specific element...

11:24 Blafasel: some

11:24 thoefer: I think this is "detect" and "select" in ruby...

11:24 ok, I try :)

11:24 thanks!

11:26 No, it´s not some :(

11:27 some returns a boolean and not the element

11:28 Chousuke: (first (filter foo? coll))

11:29 arkh: thoefer: filter is lazy so it would be efficient to use (first (filter pred coll))

11:29 thoefer: yes that´s my current implementation :) is this the only way?

11:30 I think about sth like (detect pred coll)

11:31 zerokarmaleft: ,((comp first filter) odd? [1 2 3 4 5])

11:31 clojurebot: 1

11:32 arkh: I can't think of a common function that performs that but you could always write your own detect ;)

11:33 Blafasel: ,(some #{2} [ 1 3 5 7 2 ])

11:33 clojurebot: 2

11:33 thoefer: Of course I could but... I think this is a very common idiom and should therefore be implemented in clojure itself.

11:33 gu_: how about this? (defn callable? [fn-name] (try (eval (read-string (str "(fn? " fn-name ")"))) true (catch Exception e false)))

11:34 ipostelnik: thoefer, some returns the result of the predicate

11:35 thoefer: ipostelnik: but just a boolean, I want the element itself

11:36 ipostelnik: thoefer, make your predicate return nil for false, or element for true

11:36 Blafasel: thoefer: No, your predicate returns (that's why it's a predicate) a bool

11:36 ipostelnik: or do (first (filter ...)) like was suggested above

11:36 Blafasel: (some #(if (= 2 %) % nil) [1 2 4 6])

11:36 thoefer: ipostelnik: oh, moment but this sounds good :)

11:36 Blafasel: ,(some #(if (= 2 %) % nil) [1 2 4 6])

11:36 clojurebot: 2

11:37 thoefer: works

11:37 cool solution!

11:38 ipostelnik: thoefer, you should really use (first (filter)) that's effectively what some does

11:39 thoefer: thanks guys, will go on with some... still not as nice as (detect pred coll) but ok

11:39 zerokarmaleft: define detect then?

11:40 ipostelnik: thoefer, there's no reason why you can't write (detect) in about 3 lines

11:40 Blafasel: zerokarmaleft: Guess 'first element for that pred returns true or nil'

11:40 ThreeCups: The macros for composing functions that use DB connections and transactions described here: http://boss-level.com/?tag=clojure seem to be pretty common. Is there a de facto implementation of these?

11:41 thoefer: yes, like Blafasel said...

11:41 zerokarmaleft: ,((comp first filter) odd? [2 4 6 8])

11:41 clojurebot: nil

11:41 zerokarmaleft: ,((comp first filter) odd? [ 2 4 1 8])

11:41 clojurebot: 1

11:42 zerokarmaleft: thoefer: didn't you want the element or nil?

11:44 thoefer: (detect #(= % 2) (list 1 2 3 4)) --> 2

11:44 That´s the semantic I know from ruby

11:45 zerokarmaleft: using some is idiomatic in that case

11:46 ,(some #{2} [1 2 3 4])

11:46 clojurebot: 2

11:47 Blafasel: Used that above, I guess he just didn't use the map and went with (= ..) instead

11:55 cemerick: What is the equivalent of the assembly plugin in leiningen? e.g. I want to build a jar that has all the contents of directories X and Y, and contents of jars A, B, C.

11:56 (not looking for uberjar here)

12:03 chouser: cemerick: don't know about lein, sorry. But I do have a maven question for you. :-)

12:03 cemerick: chouser: ut-oh

12:04 :-)

12:04 chouser: cemerick: do you happen to know if it's possible to declare a dependency only for Java 1.5?

12:04 Java 1.6 has built-in the dep we need, but 1.5 doesn't.

12:05 cemerick: Yes

12:05 chouser: woo!

12:05 cemerick: Define a profile that is active only when the jdk version is XXX.

12:05 Include your 1.5-only dependency in that profile.

12:06 chouser: beautiful. thanks!

12:06 cemerick: Now, that's a *build-time* profile; has nothing to do with what happens at runtime, or in the build processes of dependent projects, etc.

12:06 chouser: right, but I think that's what we want

12:07 cemerick: nifty

12:07 chouser: an alternative would be to provide two artifacts, one that always has the dep, one that never does

12:07 this is for data.xml

12:07 cemerick: oh, the stax parser?

12:08 chouser: but if we did that, then any intermediate lib that depends on data.xml would have to choose one or the other, potentially providing two artifacts itself.

12:08 cemerick: yes

12:08 cemerick: OK, so profiles are not what you want.

12:08 chouser: oh

12:08 cemerick: You're hoping for a runtime or dependent-project-build-time determination of which dependencies to use.

12:09 chouser: I don't see how it could be runtime, but yes as late a decision as possible.

12:09 cemerick: Yeah, I was speaking generally there.

12:09 So does data.xml need stax all the time, or is it just a perf improvement?

12:10 chouser: we're discussing changing it to require some kind of pull parser all the time.

12:11 cemerick: presumably the jdk 1.5 stax parser is in a different package than the java 6 standard one?

12:11 chouser: cemerick: ah, probably.

12:11 hadn't thought that far ahead yet.

12:12 so would require at least a little bit of runtime code to create the right kind of factory.

12:12 runtime sniffing scares me

12:12 cemerick: well, simply declaring the hard dependency and then using the standard library implementation preferentially is a good first approximation

12:12 hah!

12:13 chouser: so maybe it's best to have two modules. a "legacy" version for 1.5 with a dep, and the standard lib with no dep but only works >= 1.6

12:13 cemerick: all of reflection is runtime sniffing

12:14 chouser: heh, well, that's true. But swapping out whole libs based on what's in the classpath is a whole different level of scary

12:14 that's what lazy-xml does and it continues to cause confusion and distress

12:15 cemerick: *shrug* that's what javax.xml.parsers has always done

12:15 not that that's much of a recommendation

12:16 JDK-specific dependency sets are tough

12:17 builds usually just reuse the JDK used to invoke the build tool, which rarely has anything to do with the state of affairs where you're deploying

12:17 chouser: two modules would allow most apps to just target >= 1.6, but people with specific customer requirements could still use 1.5

12:18 cemerick: Sure

12:18 It's all a question of where you want the complexity: build process (multiple modules) or runtime sniffing (with e.g. an optional dependency).

12:19 chouser: I think the way javax.xml is doing it is causing us problems on contrib hudson right now.

12:20 cemerick: I can absolutely believe that.

12:35 duck1123_: I've found that when I use pmap to parallelize a process, it will take up a whole bunch of virtual memory. Does anyone have any ideas what I can do to keep that down?

12:36 The resident memory is about where I would expect

12:39 technomancy: has anyone implemented a simple pdoseq?

12:39 seems like that comes up every so often

12:40 duck1123_: that would be cool, in this case I'm doing this for side effects

12:40 technomancy: yeah, it seems like 50% of pmap usages are for side-effects

12:40 and it takes a while before people realize what's wrong with doall+pmap

12:40 jamiltron: Is there an easy way to tell if an input is contained in the union or intersection of a variable-number of predicates?

12:40 technomancy: err-dorun rather

12:41 jamiltron: Something similar to comp but more like the 'or' or 'and' of several functions?

12:43 thorwil: technomancy: hi! do you know what these are about? http://paste.pocoo.org/raw/490282/ (running via clojure-jack-in, as reported by iotop)

12:44 technomancy: thorwil: there's a process for leiningen, and one for your project

12:44 thorwil: for some tasks you can use "lein trampoline $TASK" to make there only be one process, but I don't know if that works with jack-in.

12:45 Vinzent: jamiltron, every-pred and some-fn, no?

12:46 thorwil: technomancy: i had those appear every few seconds, causing very audible disc accesses, while letting the jvm idle

12:48 * thorwil puts an ssd on his wishlist

12:51 thorwil: technomancy: so i take it one can not infer why they access the disc

12:52 Bronsa: is there a way that permits me to do something like

12:52 (def a-map {:foo "bar" :baz (:foo a-map)}) ?

12:52 technomancy: thorwil: sorry, no. is it telling you that they're both causing io?

12:53 thorwil: technomancy: both entries make the top if iotop's list regularly, immediately before i can hear the disc access

12:54 technomancy: I could understand having the project JVM have some daemon that hits the disk, but having the outer lein JVM have disk IO is inexplicable

12:55 that process is literally doing nothing but blocking on the project JVM. if the JVM had exec like a real unix runtime, it wouldn't even be resident anymore.

12:56 thorwil: technomancy: well, thanks for the explanation so far, bbl

12:59 technomancy: sure

13:18 thoefer: can anyone take a short look at this macro https://gist.github.com/1275819... why doesn´t it print out 3? damn...

13:20 chouser: ~env-with-actions will cause all the args to be evaluated immediately

13:20 clojurebot: Titim gan éirí ort.

13:21 chouser: thoefer: I'm not quite sure what you're trying to do, but as written it could be done as a function instead

13:22 thoefer: you´re right as the function needs to be called... I´m aware of it, but thanks anyway. I want to try something for a moment...

13:25 chouser: another problem is that ~env-with-action is a list, so it expands to something like ("test" #(+ 1 2) ...) and complains it can't call "test" as a function

13:25 because it's a string

13:26 thoefer: damn you´re good, that was exactly the error message...

13:54 daniel___: how to i pass arguments to java -jar blah.jar ? i'm passing -> 20 string string and it complains string cant be cast to a number

13:54 does it take 2 as a string?

13:54 20*

13:54 '20 string string' 3 arguments

13:54 1 int, two strings

13:55 ibdknox: everything that comes from the commandline will be a string

13:55 daniel___: right

13:55 no way around that?

13:55 i have to convert the argument in my code

13:55 before i use it

13:55 ibdknox: as far as I know

13:55 daniel___: ok, thats alright

13:55 at least i know

13:55 cheers

13:59 thoefer: chouser: implemented it as function, fits much better. thanks for your help!

14:01 chouser: thoefer: quite welcome.

14:15 ibdknox: If anyone is looking for a Clojure job in the Bay Area, they should shoot me a message :)

14:22 amalloy: ibdknox: do you guys ever stop hiring?

14:23 ibdknox: only when we've found every one worth hiring ;)

14:24 chouser: ...that lives in the Bay Area. :-)

14:24 ibdknox: well

14:24 chouser: for someone awesome, that becomes less of a requirement ;)

14:25 chouser: ibdknox: who do you work for?

14:25 ibdknox: http://www.readyforzero.com

14:26 ignacio_: i work with Chris there. it's a great place to work! :)

14:50 kylpo: ibdknox: Is that a rails website?

14:51 ibdknox: kylpo: currently, it's a django site, but there's a Noir-based site (very nearly finished) that will replace all of that :)

14:54 kylpo: why?

14:55 kylpo: ibdknox: Ah, Noir! Very cool. Is that integration going pretty smoothly? I just like the looks, so was curious (and hopeful that it was clojure-based)

14:57 ibdknox: kylpo: Yeah it's been relatively straightforward. For the internals we went with a very JS heavy approach, using the server primarily for data retrieval and computation. That aspect has had some nastiness to it, simply because it's somewhat difficult to manage large javascript apps.

14:58 kylpo: In terms of the Clojure part, I think my only complaint is that I want a better SQL layer... so I started building that recently :)

14:58 kylpo: Oh, cool. The Noir creator is on your team!

14:58 amalloy: hah

14:58 * ibdknox chuckles

14:58 amalloy: kylpo: you're talking to him

14:59 kylpo: ibdknox: Aha! It all adds up :)

14:59 ibdknox: are you using clojurescript for the javascript, too?

15:00 ibdknox: kylpo: I would've liked to, but it was a bit too early to use CLJS

15:01 kylpo: ibdknox: understandable

15:01 daniel___: amalloy: ready to evolve hello world? :p

15:01 ibdknox: kylpo: we'll be using it internally though :)

15:02 daniel___: can anyone see what the problem is in https://gist.github.com/1276194 ?

15:03 kylpo: ibdknox: do you know of any attempts to make a blog using Noir? I'm trying to find an excuse to tinkering with it; a blog would be just that.

15:03 daniel___: i get a 'value out of range for char'

15:03 when not using a very low number of generations

15:03 hiredman: (char (inc (int (nth source i))))

15:03 amalloy: daniel___: you only ever increment the character value

15:03 hiredman: the resulting number is too large to be a character

15:04 ibdknox: kylpo: http://webnoir.org/tutorials at the bottom is an example I wrote of a blog

15:04 amalloy: eventually, it gets above 64k

15:04 kylpo: ibdknox: Sorry, just saw your github blog example: https://github.com/ibdknox/Noir-blog

15:04 ibdknox: I'll check it out.

15:05 daniel___: amalloy: yes

15:05 amalloy: oh, i see what you mean

15:05 lol

15:05 amalloy: or, i guess, above 32k, which would be the relevant barrier

15:06 daniel___: is there an elegant way of writing inc || dec

15:07 amalloy: #(+ % -1 (* 2 (rand-int 2))) probably works

15:07 &(map #(+ % -1 (* 2 (rand-int 2))) (range 10))

15:07 lazybot: ⇒ (-1 2 3 4 5 4 7 6 7 8)

15:08 daniel___: or raise -1 to rand-int 2

15:09 would give either -1^0 = 1 or -1^1 = -1

15:09 amalloy: sure

15:10 you'll really start to feel the pain of not using a candidate pool, though. ie, you're not really selecting based on fitness at all in your algorithm

15:10 daniel___: amalloy: i know, one step at a time :p

15:10 amalloy: daniel___: well, specifically, evolve should at least choose between the parent and the child based on which is more fit

15:11 daniel___: its more an exercise in clojure than a serious endeavour

15:11 amalloy: as it stands you're taking x, mutating it into y, and then continuing to evolve y even if it's a step in the wrong direction

15:12 daniel___: no, i have the filter statement which at least means the child is fitter than the parent

15:12 amalloy: daniel___: yes, but it's not an interesting filter at all

15:12 daniel___: agreed

15:12 amalloy: because you iterate mutate - within a single call to evolve, you continue evolving y

15:13 daniel___: yeah, i agree with you - as soon as it works like this, that's where ill go

15:13 amalloy: okay

15:14 daniel___: is there a way of raising to the power with a core library function?

15:14 ,(pow 2 2)

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

15:15 chouser: ,(Math/pow 2 2)

15:15 clojurebot: 4.0

15:15 daniel___: ,(** 2 2)

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

15:15 daniel___: ok cheers chouser

15:15 gfredericks: ,(.pow (biginteger 3) 99)

15:15 clojurebot: 171792506910670443678820376588540424234035840667BIGINT

15:16 ibdknox: lol

15:16 gfredericks: floats are wussy

15:24 daniel___: still get a value out of range for char -1

15:24 maybe instead of int, i do in fact need codepoints

15:24 maybe it handles the end cases better

15:25 no, its char thats the problem anyway

15:27 ,(rand-nth [-1 1])

15:27 clojurebot: -1

15:27 daniel___: i decided thats the best way of inc || dec

15:28 hiredman: have you considered treating the goal as a sequence of numbers, then you can just generate numbers and only care about characters one you've reached the goal and have to convert the numbers into characters

15:29 daniel___: hiredman: i hadn't, but it might be an idea

15:29 still might get the exception though, if it doesnt get close enough to the goal

15:30 ideally i want it to be able to run it for x generations

15:35 amalloy: (inc hiredman)

15:35 lazybot: ⟹ 4

15:36 daniel___: (inc daniel___)

15:36 lazybot: You can't adjust your own karma.

15:36 daniel___: oh

15:36 Bronsa: dum da tsh

15:49 gfredericks: (inc daniel_____________)

15:49 lazybot: ⟹ 1

15:49 daniel___: :D

15:50 ibdknox: lol

16:20 daniel___: is it <= or =< ?

16:21 ,(<= 2 2)

16:21 clojurebot: true

16:22 gfredericks: daniel___: don't you have a repl going yet?

16:22 daniel___: yeah, i do

16:22 i was just extremely lazy

16:22 :/

16:23 no idea why my **** won't work https://gist.github.com/1276401

16:24 now if i call (start x "bob" "jim") i end up with "bob" no matter how many generations i do

16:24 and i want "jim"

16:25 just because i made it filter <=

16:25 if the fitness gets down to 0 (= target), then otherwise it would iterate forever unless i had <=

16:27 amalloy: so uh...you could use some punctuation other than newlines. you're kinda filling up the whole scrollback now

16:28 daniel___: aye, that i could

16:43 alpheus: Hi, I'm back after about 6 months away from Clojure. What do people use now if they just want to connect to a relational database (postgresql) and do some queries?

16:45 grumpytoad: echo "select whatever from nojvm" | psql database

16:45 morphling: alpheus: https://github.com/clojure/java.jdbc

16:46 alpheus: morphling: "The library formerly known as clojure.contrib.sql." Exactly what I needed to know.

16:47 daniel___: (filter #(<= (fitness %) (fitness source))

16:47 alpheus: grumpytoad: Thanks for the shell 101 help!

16:47 grumpytoad: np ;-)

16:50 fliebel: So has ClojureQL fallen out of grace?

16:51 * gfredericks still uses it

16:52 brehaut: i don't think 'out of grace' but theres certainly been enough use that people have things that they'd prefer were different

16:55 fliebel: brehaut: My brain sleeps. You mean people don't like the syntax and are missing features?

16:55 brehaut: fliebel: more that some times it feels like its being too clever

16:56 personally i find myself fussing with it quite a bit to get it to generate a query that i could write easily in SQL

16:56 ibdknox: the focus on relational algebra is a fun idea, but I think it's distracting as opposed to useful

16:57 the queries it generates are often rather weird

16:57 gfredericks: I've found the composition element to be quite useful

16:57 ataggart: personally I find myself fussing with sql to get it to generate a query plan that I could write easily in clojure.

16:57 ibdknox: Has anyone written a "lazy" map?

16:58 ataggart: map is lazy

16:58 gfredericks: but I definitely keep c.j.jdbc around for the half the time that it's more natural

16:58 ibdknox: where a key's value would not be generated until accessed

16:58 sorry

16:58 brehaut: ibdknox: thats just a map with delays as values

16:58 ibdknox: map datastructure

16:58 brehaut: yes, but then you have to explicitly force them, right?

16:58 ataggart: ibdknox: sounds like memoize

16:59 brehaut: ibdknox: yes thats true

16:59 ibdknox: but surely not too hard to write a wrapper type for

16:59 ibdknox: the use case: let's say I specify a relation that would require a second query (like in a has-many situation)

16:59 ideally that query wouldn't execute until I actually accessed that key of the returned map

17:01 amalloy: ibdknox: map with delays as values is really the best you can do

17:02 ibdknox: amalloy: darn

17:05 kylpo: ibdknox: you're a vim user? Not emacs?

17:05 ibdknox: kylpo: yeah

17:06 chouser: There's should be a Clojure Vimmer's Anonymous group somewhere

17:06 s/'s//

17:06 kylpo: ibdknox: Do you have use an alternative to SLIME and swank?

17:06 gfredericks: (inc chouser)

17:06 lazybot: ⟹ 7

17:06 gfredericks: ~second

17:06 clojurebot: Motion seconded and carried. Next agenda item.

17:06 kylpo: Do you use*

17:06 ibdknox: chouser: haha, I'm always waiting for the stones to fly

17:07 kylpo: vimclojure with nailgun

17:07 brehaut: ibdknox: those off use not using vim don't live in the stone age; not so many rocks around here

17:07 ibdknox: haha

17:07 brehaut: i guess we could try throwing the future at you…

17:07 daniel___: ibdknox: im trying to get nailgun set up, could you share what you did?

17:07 brehaut: ;)

17:07 ibdknox: (inc brehaut)

17:07 lazybot: ⟹ 4

17:07 daniel___: i add vimclojure/server as a project dependency but it seems it has broken dependencies

17:08 ibdknox: daniel___: use a lein plugin

17:08 daniel___: lein-nailgun?

17:08 ibdknox: https://github.com/ibdknox/lein-nailgun

17:08 daniel___: ok, cheers

17:09 ibdknox: kylpo: http://blog.darevay.com/2010/10/how-i-tamed-vimclojure/

17:09 daniel___: that might be useful for you too ^

17:09 kylpo: ibdknox: thanks

17:10 gfredericks: ha: "Like windows users at a ruby conference..."

17:11 kylpo: I doubt this would be enough to get me off of emacs. I was just curious.

17:14 ibdknox: kylpo: probably a good call, I only use vim because of many years of muscle memory :)

17:14 brehaut: no text editor is good enough to make me change from the pile of crap I've currently acclimatized myself to

17:15 chouser: yeah, if you're at all comfortable with emacs, I think I'd have to recommend spending time investing in that rather than learning vim

17:16 daniel___: ibdknox: there is no avoiding downloading the ng client and adding it to your path right?

17:17 the dev-dependency is just for the server jar

17:17 ibdknox: daniel___: you don't need to add the ng client to your path, you just need to point VIM to it

17:17 daniel___: let vimclojure#NailgunClient = "/users/chris/.vim/bundle/vimclojure-2.3.0/lib/ng"

17:18 daniel___: ok ibdknox

17:18 brehaut: daniel___: i dunno about lein vim stuff, but lein swank can be installed as a plug in for lein itself, rather than as a dev dependancy, so that other people don't have to download it if they don't use swank

17:19 daniel___: lein plugin install foo

17:20 daniel___: i used vundle to install vimclojure

17:21 nvm, its still in .vim/bundle/vimclo...

17:24 the link to download ng no longer works

17:24 nvm, the link in the above blog post works

17:28 hiredman:

17:33 brehaut: how do i get lein's repl to use clj 1.3?

17:33 scottj: wait till there's a new lein release or run lein repl in a project?

17:34 daniel___: no such file or directory: ~/.vim/bundle/VimClojure/lib/nailgun/ng

17:34 brehaut: scottj: thanks

17:34 daniel___: yes there is

17:35 hmm, i need some classpath stuff

17:36 babilen: brehaut: Just use ":dependencies [[org.clojure/clojure "1.3.0"]]" in your project.clj and run "lein deps" ... Or am I missing something here?

17:39 brehaut: babilen: you can use the lein repl outside of a project

17:39 daniel___: ibdknox: how do you start the ng server? what classpath?

17:39 ibdknox: daniel___: you don't do anything other than lein nailgun

17:39 babilen: brehaut: Sure (wasn't sure what you are referring to)

17:39 ibdknox: daniel___: assuming you set it up as they suggest in that article

17:40 dafra: hi, i am struggling to append a div to window.document

17:40 (gdom/appendChild window/document (dom/element "p" {} []))

17:40 gdom = goog.dom, dom = twitterbuzz.dom-helpers

17:40 any idea ?

17:40 ibdknox: dafra: js/document

17:41 dafra: i got disconnected

17:41 js/document gives the same error

17:42 babilen: daniel___: I just use lein-nailgun personally. A new (i.e. for 1.3) version of it can be found on http://clojars.org/org.clojars.ibdknox/lein-nailgun -- Install it with 'lein plugin install org.clojars.ibdknox/lein-nailgun "1.1.1"' -- You can then start it with "lein nailgun &"

17:42 dafra: appendChild fails

17:43 ibdknox: dafra: with what error?

17:43 dafra: something like dom hierarchy error 8

17:44 also twitterbuzz.dom-helpers/element :p creates an invalid element name

17:44 babilen: ibdknox: Ah, did not realise that you are, in fact, you :) -- Do you have any intention of maintaining lein-nailgun? These 200 versions on clojars are just confusing and a maintainence/documentation mess.

17:44 dafra: i have to use element "p" instead

17:45 ibdknox: dafra: pinot takes care of this for you: http://github.com/ibdknox/pinot

17:45 dafra: ibdknox: appendChild fails

17:45 daniel___: babilen: still getting no such file or directory: ~/.vim/bundle/VimClojure/lib/nailgun/ng

17:45 dafra: not with pinot :)

17:45 ibdknox: daniel___: absolute path

17:46 daniel___: ibdknox: kk

17:47 no idea if it worked or not, no buffer appearing anymore

17:47 ibdknox: babilen: I can. There's really nothing to it and I'll need to keep it working since I use vim lol :)

17:47 daniel___: what command can i try

17:47 ibdknox: \sr

17:48 daniel___: error detected when buff auto command something or other

17:48 babilen: ibdknox: I know -- I did the same, but the problem is not that it is hard to maintain the problem is that nobody is really doing it. This just forces everyone to fork his/her own version ..

17:49 dafra: ibdknox: to use pinot, no need to put your cljs somewhere in the project ?

17:49 ibdknox: dafra: hm? To use pinot you just need the pinot jar on your classpath

17:50 dafra: ibdknox: and cljsc will find them ?

17:50 ibdknox: dafra: if you're using the compiler directly (which I don't suggest for web stuff), you need to put it in the CLOJURESCRIPT_HOME/lib dir

17:51 dafra: on my box (windows) leiningen clojurescirpt plugin and cljs-watch both fail :(

17:51 daniel___: so i ran make and my ng file is where it should be...i also did lein plugin install org.clojars....

17:51 ibdknox: dafra: someone has a cljs-watch that works for windows

17:51 daniel___: still not working

17:52 dafra: ibdknox: i misread clojurescript_home, ok

17:52 ibdknox: daniel___: you need the server jar next to ng as well

17:53 ls ~/.vim/bundle/vimclojure-2.3.0/lib/

17:53 ng server-2.3.0.jar

17:53 daniel___: ok, doesnt lein plugin install take care of that though :(

17:53 i dont like having all these manual dependencies

17:53 ibdknox: daniel___: I actually don't remember if that's important, but the first step is to get it working, then refine it :)

17:55 daniel___: got server-2.2.0.jar next to ng, still doesn't appear to work

17:56 i took it from my project/lib directory

17:57 i guess lein plugin install org.c..... put it there?

17:58 ibdknox: daniel___: running lein nailgun does I believe

17:58 daniel___: i tried setting up ng about a month ago and never got it to work, so i jsut reverted to using vimclojure offline

17:59 ibdknox: hm

17:59 All I did was drop vimclojure in my bundles, build ng, put that in bundles/vimclojure/lib

17:59 then added a bunch of lines to my .vimrc

17:59 daniel___: i have it in bundle/VimClojure/lib/nailgun

17:59 but that shouldnt matter

18:00 ibdknox: i think its those lines in your vimrc

18:00 ibdknox: gisting

18:00 daniel___: https://gist.github.com/1276688

18:01 dafra: ibdknox: should (dom/append js/document (html/html [:p [:em "hey"]])) work, with pinot.dom and pinot.html ?

18:01 ibdknox: dafra: I've never tried to append directly to the document

18:01 dafra: let me try

18:01 babilen: daniel___: What is the content or your ~/.lein/plugins/ ?

18:02 s/or/of

18:02 lazybot: <babilen> daniel___: What is the content of your ~/.lein/plugins/ ?

18:04 daniel___: org.clojars.ibdknox-lein-nailgun-1.1.1.jar

18:04 it's almost as though it works...slight pause when vim loads up, no errors

18:04 but \sr brings up two empty buffers and i get some error at the bottom

18:05 ibdknox: dafra: looks like the goog libs don't let you append to document

18:05 dafra: ibdknox: (dom/append (dom/query "#toto") (html/html [:p [:em "hey"]])) fails too: Undefined nameToPath for goog.dom.query

18:05 daniel___: arg, i had two nailguns running

18:05 now i get an error....connection refused :S

18:05 dafra: ibdknox: with <div id="toto"></div>

18:05 ibdknox: dafra: you need the goog-jar.jar that includes the third party extensions

18:05 daniel___: Error executing Nail! (230)

18:05 babilen: What are those errors? Did you run "lein nailgun &" ?

18:05 daniel___: connect: Connection refused

18:06 yeah, i did

18:06 i remember, this connection refused is where i gave up about a month ago

18:06 babilen: daniel___: What is the output of that? Something like " NGServer started on 127.0.0.1, port 2113" ?

18:07 ibdknox: dafra: the goog.jar that you get from clojurescript's bootstrap doesn't include the third party stuff, I created a special one that does

18:07 daniel___: nope, just [1] 17827

18:07 the ps id

18:08 ibdknox: don't run it in the background

18:09 daniel___: so just lein nailgun

18:10 * devn tries to come up with some way to move between haml and hiccup

18:10 dafra: ibdknox: this still doesnt work, but no error messages any more, i'm on the right track

18:10 ibdknox: thanks

18:11 ibdknox: dafra: you can just do (dom/append (.body js/document) (html/html [:p "hey"]))

18:11 daniel___: ok yes, NGServer started on 127...

18:11 ibdknox: devn: you could capture the output, and run clj-tagsoup ;)

18:11 dafra: ibdknox: INVALID_CHARACTER_ERR: DOM Exception 5

18:12 daniel___: opening vim....just a blank buffer as though its still loading the contents

18:12 aaah, here it is

18:12 contents eventually loads, press \sr, get two blank buffers again

18:13 ibdknox: dafra: something else is going on then, I know that works :)

18:13 dafra: ibdknox: when i replace :p with "p" it loops forever :)

18:13 ibdknox: haha

18:13 hm

18:14 dafra: ibdknox: i always get a wrong tagname

18:14 ibdknox: dafra: that works too

18:14 dafra: just did this: (dom/prepend (.body js/document) (html/html ["p" "woot"]))

18:14 daniel___: dunno, maybe i have a binding that is conflicting with another plugin

18:14 im gunna go to bed

18:14 night all, thanks for your help

18:16 dafra: ibdknox: i get the same error as with twitterbuzz, so it's not you :)

18:16 ibdknox: my tag name is "﷐'p" when i request a :p

18:17 ibdknox: invalid character, etc.

18:17 ibdknox: dafra: are you using HEAD?

18:17 dafra: ibdknox: clojurescript HEAD ?

18:17 ib ibdknox noidi

18:17 ibdknox: no

18:17 ibdknox: dafra: try it against head

18:18 dafra: ibdknox: build it ?

18:18 ibdknox: i'll try taht

18:18 ibdknox: dafra: huh? you just need to do git pull and run script/bootstrap

18:19 dafra: then go in there and delete that goog.jar it puts in there. You just want my goog-jar.jar

18:19 dafra: ibdknox: ok, that's what i did, but some weeks ago

18:19 ibdknox: dafra: I don't know that it'll fix your issue, but a lot of good things have happened in the past couple weeks, it can't hurt

18:21 dafra: ibdknox: thx, bye

18:22 devn: howdy all

18:22 gfredericks: devn: howdy.

18:22 devn: how goes the clojuring?

18:23 brehaut: devn: mind changing

18:35 devn: brehaut: in a positive way I hope

18:36 brehaut: devn: of course :)

18:36 devn: Yeah I sat down the other day and began a list of things I've learned about as a result of using other languages since I started with Clojure

18:37 brehaut: the results were pretty staggering -- I'm thinking that might make a good talk if anyone is reading this

18:37 brehaut: devn: i think so

18:38 devn: I didn't know a lisp before I started Clojure -- I had done a little elisp and read a tiny bit of the PCL

18:38 brehaut: one thing I've noticed since getting deeper into functional programming and clojure is that my brain has been rewired to focus on compositional code far far more pervasively than i did with procedural and OO

18:38 devn: yeah brehaut -- it's really a mind fsck. It's kind of a problem and a solution

18:39 brehaut: haha literally a mind fsck :P

18:39 checked and repaired

18:39 devn: I'm feeling like I'm sort of in this transition phase

18:39 it's like having one of those really "middle" beards

18:39 it's not a bear, and it's not stubble. it's just -- there.

18:39 brehaut: everything is itchy?

18:39 devn: I'm slowly developing the full-on philosopher beard

18:40 brehaut: excellent

18:40 devn: but that's exciting -- and it's why I think a lot of other languages just don't "do it" for me the way they used to

18:40 brehaut: likewise

18:40 devn: It's like the research on GUI environments versus the command line

18:40 there is a sharp learning curve on the command line compared to GUI environments

18:41 but the "dead end" states in GUI programs eventually creep up

18:41 there is a plateau where there isn't in a CL environment

18:42 Anyway, I'm ranting as usual, I've just really grown as a programmer since I started learning Clojure a couple of (maybe even 3 years?!) ago now

18:42 and when I wrote that list it was just a torrent of topics and lands I had never seen or considered before

18:43 brehaut: the bad old days of snapshot jars and no leiningen

18:44 devn: brehaut: :) let's not be all "those were the days"

18:44 that's going to make me feel like a snob

18:44 brehaut: haha

18:44 devn: (and potentially old)

18:46 brehaut: i don't think anyone can feel old by recalling the early days of clojure :P

18:47 (except maybe raynes i guess)

18:49 amalloy: heh, emacs knows what i like to complain about. `Il` offers to be completed as `IllegalStateException`

19:22 Raynes: brehaut: Yeah, man. I grew all sorts of new hair after I first found Clojure.

19:22 Could have been puberty, but I think it was the Clojure.

19:23 brehaut: its the result of a high concentration of lambda particles

19:23 see also http://homepages.inf.ed.ac.uk/wadler/Pics/philtiebig.jpg

19:27 Raynes: Bowties are cool.

19:27 brehaut: bow ties with lambdas are cooler

19:37 devn: I ordered a clojure license plate

19:37 My errands for the day

20:08 ignacio_: ibdknox: overriding lookup might help with your map question

20:08 eg:

20:08 http://stackoverflow.com/questions/5583841/overloading-keywords-in-clojure

20:09 ibdknox: ignacio_: yeah, I could wrap a map relatively easily, seems somewhat hacky to me though

20:11 ignacio_: well, at some level you want to change their behavior

20:12 zippy314: Has anybody here had any luck getting clojurescript to work with goog.ui.Select? I can't get it insert MenuItems...

20:12 ignacio_: and i agree that for what you're looking for, wrapping is probably not very elegant

20:12 zippy314: (or goog.ui.Options) for that matter either.

20:12 ignacio_: but modifying the behavior at a low level seems like the best way to accomplish what you want

20:13 unless you have a neat magical solution already :)

20:14 ibdknox: ignacio_: nope lol, I was thinking of just changing the expectation

20:15 ignacio_: basically saying that if you do (with some-has-many-rel) that relationship will be evaluated as soon as you consume the parent element

20:15 ignacio_: if that's not what you wanted, my argument would be that you shouldn't be using with, and you should just do it conditionally

20:16 ignacio_: but you may not know at query time that you actually want it

20:17 ibdknox: hm?

20:17 duck1123: ibdknox: wouldn't just about any operations on a map cause that value to be realized

20:18 I'm willing to bet that most of the function weren't written with the laziness of maps in mind

20:18 ibdknox: duck1123: lookups wouldn't, since this a database result set, I don't imagine you'll be doing too much else

20:18 duck1123: I'd be surprised if assoc caused lookups of unrelated elements, but I haven't looked into it

20:19 zippy314: Here's a gist with clojurescript to produce a select: https://gist.github.com/1276936 It includes the actual html produced which doesn't include the added menu items. Any ideas why?

20:19 duck1123: well, not assoc, but a lot of the other ones

20:19 ibdknox: duck1123: like?

20:20 duck1123: trying to think of examples, and you're right, the ones that realize you probably wouldn't do on a db result

20:20 ignacio_: ibdknox: if get some entity in the db

20:20 ibdknox: zippy314: I don't know that you're going to find a lot of help here on the gclosure lib stuff, sadly :(

20:20 duck1123: probably things like keys

20:20 ignacio_: i may not know what exactly i want to do with that element in the future.

20:21 ibdknox: ignacio_: yeah, and then when you need that extra information you could do something like (select my-has-many (for my-current-user))

20:21 zippy314: ibdknox: thanks anyways. I'll try the mailing list..

20:21 ignacio_: ic

20:22 but that would not populate a nested datastructure the way that (with ...) would

20:23 ibdknox: ignacio_: maybe for takes the current object and assocs to it, the difference *could* be transparent

20:23 duck1123: You're trying to achieve something like DataMapper's lazy loading of associations, right?

20:23 ibdknox: duck1123: What's DataMapper?

20:23 I see

20:23 it looks like it, yes

20:24 duck1123: DataMapper is what I use in Ruby. clj-record is no replacement though

20:26 ibdknox: duck1123: I'm trying to replace clj-record/ClojureQL with Korma

20:27 duck1123: watched

22:32 dnolen: anybody see any problems with true and false hashing to 0 and 1 in ClojureScript? fixes this - http://dev.clojure.org/jira/browse/CLJS-64

22:35 ibdknox: dnolen: If you had a map with true false 0 1 that would be a problem. Of course I can't think of any situation where you'd have that off the top of my head...

22:36 as keys that is

22:36 dnolen: ibdknox: not true, that just works, ClojureScript deals w/ hash collisions

22:36 ibdknox: oh?

22:36 hm

22:36 ah, right.

22:36 dnolen: then no

22:37 dnolen: k pushing it out then

22:38 amalloy: &(map hash [true false])

22:38 lazybot: ⇒ (1231 1237)

22:38 amalloy: huh. who knew

22:39 ibdknox: lol

22:40 ataggart: so long as hash is consistent with =, it shouldn't matter

22:41 are there any other codec people really use other than base64? Trying to decide what ns the base64 stuff should go into.

22:43 amalloy: ataggart: it won't cause incorrectness, but if every object hashed to 0 that would be a problem

22:43 just because of performance

22:43 ataggart: amalloy: true, but the inverse would be incorrect, i.e., different hashes for = values.

22:44 amalloy: right

22:44 ataggart: now I'm curious, if true/false can't be map keys in js, what is the actual key used in the map?

22:47 dnolen: ataggart: 1/0 w/ my patch

22:48 ataggart: so what happens with {true :bool 1 :num}

22:49 dnolen: ataggart: the map implementation handles hash collisions, so you get {true :bool 1 :num}

22:49 ataggart: but if the true is actually a 1, then it's not just a hash collision, but an equivalence collision (or is there some other magic going on?)

22:49 tomoj: hmm, I see cljs.core.HashMap.fromArrays([!0,!1],[1,3]) for {true 1 false 3}, with a pretty old compiler

22:49 what are those ! for? binary not?

22:50 dnolen: ataggart: true is not actually a 1 tho.

22:50 ataggart: heh, ok then back to my original question, what is the actual key when the ostensible key is true?

22:51 dnolen: true is the key.

22:53 amalloy: dnolen: i think the most interesting question is "why couldn't booleans be used as keys to begin with, and what did you do to remedy it"

22:53 dnolen: JS objects only supports string keys

22:54 so ClojureScript map implementation uses buckets when different keys hash the same. the arrays look like [k v k v …]

23:05 ibdknox: any opinions about this? http://dev.clojure.org/jira/browse/CLJS-50

23:05 or anyone else for that matter :)

23:05 solution would be to return a lazy seq with conj is called

23:05 s/with/when

23:05 lazybot: <dnolen> solution would be to return a lazy seq when conj is called

23:06 dnolen: huh actually that's probably not even necessary since we have cons

23:08 yup that works.

23:27 ibdknox: dnolen: cons was the way to go :)

23:27 dnolen: ibdknox: yep

23:55 scottj: is there a builtin function like group-by but instead of {true [a b] false [c d]} returns ([a b] [c d]) ?

23:56 amalloy: (comp vals group-by)? :P

23:57 scottj: ahh it's seperate from c.c.seq-utils that I was thinking of

23:58 amalloy: scottj: that is very different from group-by; separate is (juxt filter remove)

23:59 scottj: the "like group-by" was imprecise. thanks I'll have to note that juxt code it's shorter than writing my own or requiring something

23:59 amalloy: clojurebot: amalloy?

23:59 clojurebot: amalloy is <amalloy> just use juxt, it'll be great

Logging service provided by n01se.net