#clojure log - Dec 23 2012

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

0:00 abp: Having a blast watching http://skillsmatter.com/podcast/home/the-refined-clojurist and coding along in light table instarepl. :)

0:00 wingy: abp: yeah filter is pretty good

0:00 TimMc: Hmm, there's no filter-kv?

0:01 abp: I can't stand the lack of paredit. :-/

0:01 abp: TimMc, there are a lot of -k and -kv, probably -v function variants missing. ;)

0:01 tomoj: filter-kv: https://www.refheap.com/paste/3bdd717b8d399a657230d0ab4

0:03 I think filter should be filter-v

0:03 abp: TimMc, if I've already learned emacs I would probably miss it, too. But since I'm just coding along it's not that bad.

0:03 tomoj: I mean, it should stay named 'filter but it should mean filter-v. then we should add filter-k and filter-kv

0:03 TimMc: tomoj: There is one.

0:04 tomoj: And it should automagically detect map seqs? :-/

0:04 abp: tomoj, wouldn't make any sense anytime to filter to get the kv tuples in a map?

0:04 tomoj: er, no, I'm thinking of only reducers

0:05 abp: Hm has anyone run some cljs via Nashorn by now?

0:05 tomoj: that clojure.core/map and clojure.core/filter on maps run f on each kv pair seems unfortunate

0:06 abp: tomoj, probably, but everything else would be strange.

0:07 tomoj: yeah, what seems unfortunate is really the burden of compatibility for clojure.core.reducers/map, if there is one

0:08 abp: tomoj, why? I'm not very familiar with reducers.

0:10 tomoj: I want (reduce-kv rf init (r/map f {1 2 3 4})) to work, and having r/map call f on kv pairs seems silly

0:12 abp: tomoj, more like inconsistent but fixable, not?

0:12 ,(seq {:x 1 :y 2})

0:12 clojurebot: ([:y 2] [:x 1])

0:12 abp: Is the reason for it and -kv-fns in the first place. So moar.

0:13 tomoj: what's inconsistent but fixable?

0:15 abp: Not having all functions with -kv suffix?

0:15 tomoj: that's fixable, but what about r/map?

0:16 abp: Isn't r/map-kv possible as well?

0:17 tomoj: sure, but, what, also add r/map-v ? and then r/map is just an r/map-v that doesn't work for reduce-kv?

0:19 abp: tomoj, no r/map is r/map, r/map-v is mapping like r/map second from tuples

0:19 *but with second

0:20 tomoj, probably short naming k, v, kv at that point gets ugly. Or at least a litte confusing. ;)

0:22 tomoj: so r/map-v would return something that can only be reduce-kv'd, but not reduce'd?

0:22 z3phyr: how to choose a platform for clojure?

0:23 tomoj: or maybe it would return something that reduces over kv pairs :(

0:26 z3phyr: jvm is recommended now, but what about alternate platforms like python?

0:28 tomoj: hmm.. say you have (into [] (r/map inc [1 2 3])), but later the vector is changed to a map. now not only do you have to go change your code to (into [] (r/map (fn [[_ v]] (inc v)) {0 1 1 2 2 3})), but your code now loses some of the potential perf benefits of reducers

0:29 if both (into [] (r/map-v inc [1 2 3])) and (into [] (r/map-v inc {0 1 1 2 2 3})) worked and didn't involve kv pair {con,de}struction, that would seem nice

0:30 but (r/map-v inc [1 2 3]) looks suspiciously like r/map when applied to vectors

0:34 abp: tomoj, when you only want to have the vals of a map, wouldn't it be better to take em? (into [] (r/map inc (vals {0 1 1 2 2 3})))

0:36 tomoj: no, because vals returns a seq, and because an IKVReduce in general might not support vals anyway

0:37 e.g. the return value of map-kv probably won't support vals

0:37 plus, you may want the keys later

0:39 e.g. I think (->> {:foo 1 :bar 2 :baz 3} (r/map inc) (r/filter-k #{:bar :baz}) (into-kv {})) should work and should be {:bar 3 :baz 4}

0:40 Raynes: &(tomoj 1 2 3)

0:40 lazybot: java.lang.RuntimeException: Unable to resolve symbol: tomoj in this context

0:40 Raynes: tomoj: You don't exist.

0:40 abp: lol

0:41 Raynes, pointed your laser a little to long at him? :P

0:41 Raynes: I may have.

1:04 z3phyr: Why does Rich state's that Clojure is only designed for the jvm?

1:06 abp: z3phyr, I would say because a lot of the innards, compiler, reader etc. are implemented in Java. ClojureScript is what get's more and more host independent and implemented in ClojureScript, so that it's easier to port for different hosts.

1:07 z3phyr: Clojure Py is the one I like, though it is not mentioned in the website.

1:08 abp: z3phyr, which website? Clojures?

1:08 z3phyr: abp, yeah

1:09 abp: z3phyr, well thats probably because it's not very mature. But I don't know for sure.

1:11 z3phyr: Is there a clojure implimentation which does not require a JVM, and uses lien too?

1:12 oh, does lieningen requires a jvm?

1:12 abp: z3phyr, yes.

1:17 z3phyr: there's java, but there seems to be no primary implimentation of clojure.

1:18 I have an idea.

1:19 pppppppppaul: Tell me

1:19 z3phyr: Why not fork a jre, make some changes specefic to clojure, rename it ClJvm, and distribute the compiler, the vm and lieningen in one single install?

1:20 that would 1) give an identity to clojure, what beam gives to erlang.

1:21 pppppppppaul: Sexy

1:21 bbloom: z3phyr: what would be the advantage of having it's own runtime?

1:21 z3phyr: 2) the new vm will be what lieningen is to maven

1:21 bbloom: z3phyr: there is a "primary" implementation of clojure: it's the JVM one

1:21 z3phyr: no.

1:21 even if it is

1:22 bbloom: there would be little benefit to maintaining our own vm

1:22 and some high maintenance costs

1:22 there are lots of high quality VMs out there and there isn't a really good justification for them to each be language specific

1:23 z3phyr: That VM is actually a jvm, with Clojure as the main language. Java could use clojure librarys.

1:24 imeredith: but why...

1:24 bbloom: java *can* use clojure libraries....

1:24 imeredith: why not the jvm as it currently stands

1:24 z3phyr: yeah it can. but its still jvm and not cljvm

1:24 imeredith: mv jvm cljvm

1:24 fixed

1:26 z3phyr: what benefits would having a "cljvm" bring?

1:26 z3phyr: it can help in giving out a single install WITH the vm and the Build tools

1:26 imeredith: cant you do that with openjdk anyway?

1:26 if you wanted

1:26 tomoj: I think most developers would rather hear "you need a jvm" than "here, download and install this bundle which includes, among other things, our own custom jvm!"

1:27 z3phyr: java is cross platform that, it runs on dalvik as well as openJDK

1:27 imeredith: on linux generally installing a jvm is trivial. I seem to magically have one on mac somehow

1:28 z3phyr: both are different but both are the same.

1:28 And forking dosen't cost much

1:29 imeredith: feel free to do it

1:29 z3phyr: The clojureVm will also have some java compatible but clojure specefic tweaks

1:29 technomancy: z3phyr: forking openjdk means oracle will sue your pants off

1:29 the patent protection they offer for openjdk doesn't apply to forks

1:29 imeredith: technomancy: what license is openjdk under?

1:30 technomancy: imeredith: GPL2+classpath exception

1:30 imeredith: ah

1:30 technomancy: if it were v3 we would be safe

1:30 but v3 didn't exist at the time

1:30 it's not a good idea to begin with, but it saves time to point out that it's impossible =)

1:31 imeredith: technomancy: there is nothing stopping you from bundling openjdk with stuff though right? (unlike oracle jdk)

1:32 technomancy: imeredith: right, as long as you haven't changed it

1:32 bbloom: thus defeating any purpose, should you figure out some purpose

1:32 imeredith: installing jvm seems like a non issue to me

1:32 the only platform which it *might* make sense for is windows

1:32 afaik

1:32 err

1:32 as far as i can see

1:33 technomancy: i was more annoying a few years ago when openjdk lagged behind the Sun one

1:33 it

1:33 imeredith: well, a few years ago you could install sun jdk from apt

1:34 technomancy: sort of

1:34 you had to add non-free repos and manually click through a license agreement

1:34 imeredith: sure, it was still farily trivial though

1:35 technomancy: also the sun version didn't ship with a proper crypto implementation

1:35 imeredith: oh? didnt know that

1:36 technomancy: they were still complying with ridiculous 90s export laws as of jdk6

1:36 imeredith: oh right

1:36 z3phyr: Can they still sue someone if that person will not use it as a java vm?

1:37 technomancy: z3phyr: sure

1:37 z3phyr: hmmm

1:37 technomancy: it would be a patent lawsuit, not a trademark one

1:39 z3phyr: Can clojure devs make changes in the VM so that it can run clojure in "better way"?

1:39 technomancy: the JVM already has features that would make clojure run better that clojure isn't even using

1:39 bbloom: z3phyr: there is far more low hanging fruit in compilation strategy and optimization than we'll have in the foreseable future for vm optimizations

1:39 technomancy: like invokedynamic

1:40 bbloom: z3phyr: if you feel pasionately about this, you should study how you can help with clojurescript

1:40 z3phyr: any help getting the cljs compiler to be self hosting and less dependent on the jvm is welcome

1:40 ibdknox: what's this about invokedynamic in cljs?

1:40 Raynes: invoveIbdknox

1:40 technomancy: ibdknox: http://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine)

1:41 just released yesterday

1:41 z3phyr: So will the JVM remain the primary platform for Clojure in the future?

1:41 bbloom: ibdknox: nothing, go back to work. don't you have investors to please? :-)

1:41 ibdknox: lol

1:41 bbloom: z3phyr: for the foreseable future, yes

1:41 technomancy: designed around InDy from the ground up

1:41 ibdknox: interesting

1:41 bbloom: z3phyr: however, clojure-in-clojure compiling to jvm is a reasonable next step

1:41 z3phyr: clojure is about pragmatism. let's tackle one step at a time, rather than shooting for the moon all at once

1:42 z3phyr: yeah :)

1:42 bbloom: cljs provides that opportunity

1:42 z3phyr: It seems cljs requires a jvm too?

1:43 bbloom: z3phyr: currently

1:43 ibdknox: not for long, I hope! :D

1:43 bbloom: z3phyr: there are some forks that don't

1:43 z3phyr: of varying levels of quality

1:43 z3phyr: if you want to contribute, spend some time studying the cljs compiler, maybe take on a bug fix or two. when you get a good understanding for the implementation and the design decisions, i'd be happy to discuss with you enhancements

1:44 Raynes: ibdknox: Where's my light table plugin system?

1:44 z3phyr: bbloom: I will.

1:44 Raynes: How dare you give me free software without the features I desire.

1:44 bbloom: ibdknox: how dare you not give me free software! i didn't contribute to the kickstarter program...

1:44 * bbloom reaches out hand and makes grabby motion

1:48 ibdknox: lol

1:48 bbloom: you know it's all publicly available right now, right? :p

1:48 Raynes: I have a very basic one implemented

1:48 bbloom: ibdknox: heh, yeah i know. i just like to jump on Raynes' joke trains

1:48 technomancy: it's on github?

1:49 Raynes: technomancy: No

1:49 technomancy: oh

1:49 Raynes: technomancy: If ibdknox put it on Github, he'd have huge problems.

1:49 ibdknox: once it goes public beta, I'll go down that (scary) route :)

1:49 Raynes: technomancy: The problem with software like this is that he has big ideas and people would just go and pound through it with stuff that doesn't work with what he wants to do.

1:49 technomancy: Raynes: because letting people contribute goes against the clojure way?

1:49 Raynes: He could decline the pull requests, but he'd piss people off.

1:49 ibdknox: in terms of plugins, I need to talk to David about adding another compiler option that lets you exclude certain deps via regex or something

1:50 actually

1:50 Raynes: And he'd likely end up with forks that are the antithesis of what he light table is supposed to be.

1:50 ibdknox: the main problem is time

1:51 Raynes: I think you might think that would be your main problem, but I think the real problem would be what I just said.

1:51 I'd keep it closed source until you've got your fundamental ideas fleshed out.

1:51 ibdknox: I think it has to be a little bit

1:51 Raynes: You want something that people will try to build *on*, not something people will try to *build*.

1:52 ibdknox: that is certainly true :)

1:52 Raynes: technomancy: So, remember how excited I was that I got that clojure.test issue+patch vetted?

1:52 technomancy: Apparently that doesn't mean anything. Vetted just means Rich thinks the issue is okay. Nobody has looked at the code.

1:53 technomancy: woooo

1:53 you cracked the code

1:53 Raynes: So apparently you have to have permission to even report an issue?

1:53 I think I at least understand the process.

1:53 technomancy: here I was thinking that it was related to veterinarians

1:53 Raynes: The purpose for parts of it I do not understand.

1:54 technomancy: your patch is up on all its rabies shots

1:54 ibdknox: the plugin system will go a long way

1:55 you can completely redefine LT in plugins, so it's more or less a way to contribute lol

1:55 Raynes: ibdknox: You should include my refheap plugin by default.

1:55 * Raynes files his nails

1:55 ibdknox: haha

1:57 bbloom: i feel like java leaks into the clojure open source process, far more than it leaks into the clojure language

1:58 technomancy: bbloom: heh; the perils of jira.

1:58 Raynes: ibdknox: You don't have to include a refheap plugin by default, but if you include a gist plugin without a refheap plugin, I *will* beat you down.

1:58 technomancy: violence is not the answer raynes

1:59 bbloom: Raynes: is your api compatible with the gist api?

2:00 ie he can just say (def refheap-plugin (assoc gist-plugin :endpoint "https://api.refheap.com"))

2:00 Raynes: God no

2:00 I hate the gist API.

2:00 bbloom: ibdknox: i've got your back here, i'll negotiate for you

2:00 :-P

2:00 Raynes: It's part of the reason I made refheap.

2:01 ibdknox: lol

2:01 Raynes: The multiple-file support makes it all super craptastic.

2:01 Protip: a multi-file gist = a github repository.

2:01 ibdknox: I wouldn't include a gist plugin by default anyways

2:01 I'm sure there *will* be one though

2:01 Raynes: If you're going the route of "Let's include nothing." you need to make it super easy to discover and install those plugins.

2:02 Stuff like gist and refheap plugins are pretty necessary for some people.

2:02 Like me.

2:02 ppppppppaul: Multi file gists are great

2:02 ibdknox: Raynes: absolutely, that's going to be a big thing

2:02 Raynes: ppppppppaul: The concept is great, I don't care for the implementation.

2:02 ppppppppaul: I'll be implementing something similar in refheap. It'll be better.

2:03 ppppppppaul: Got any stats on refheap?

2:04 Raynes: Stats?

2:04 ibdknox: I kinda want there to be something less this bl.ocks.org but for LT: http://bl.ocks.org/mbostock

2:04 Raynes: ppppppppaul: Like language usage stats, number of users, etc?

2:05 ppppppppaul: All the info is in the db, I just haven't written an interface for it.

2:07 tomoj: shoot, (:require [foo :as f]) (:require-macros [foo :as f]) is an error now?

2:08 ppppppppaul: How much space does your 8000 posts take up?

2:08 Raynes: I'm not dissing gist or anything. I just don't like the way they did multi-file pastes. They use a git repo under the hood, so they literally have files in that repo. All of the files are associated with that one paste. I don't do the whole git repo stuff, I'd like to implement in refheap in such a way that each paste is standalone, but you can associate pastes with another paste and it'll appear alongsi

2:08 de that paste just like how it works in git.

2:08 Good question. I haven't checked in a while.

2:09 tomoj: dnolen: did you intend to break that? or just (:require [foo :as f] [bar :as f]) ?

2:10 Raynes: ppppppppaul: Looks like tha tpart of my database uses a total of 77.74MB.

2:10 ppppppppaul: Note that I store highlighted pastes as well as the original source of the paste so I am effectively storing pastes * 1 + the substantial HTML required to highlight it.

2:10 It's a space tradeoff for speed.

2:12 ppppppppaul: I have 496MB of storage.

2:12 For free, anyways.

2:13 When I hit that I'll probably move my DB to my VPS.

2:13 I pay $20 a month on Heroku just for the SSL stuff because technomancy won't give it to me for free.

2:13 * Raynes puts a checkmark beside his name in his frenemy list.

2:16 Sgeo: Someone should port Racket's for/fold to Clojure

2:16 Should be fairly simple

2:22 tomoj: what's the deal with jira thinking it's 2020?

2:22 Rich_Morin: I'm trying out Clooj and seeing unexpected behavior. Let's say I enter a form in the Source editor (eg, (* 3 4) ), then select it and use "REPL > Evaluate here". The form appears in the Clojure REPL output, but not the result. Help?

2:25 ibdknox: Rich_Morin: you should try light table :)

2:26 Rich_Morin: ibdknox: I plan to, but right now I'm interested in checking out Clooj.

2:28 Scriptor: how big is the download for clooj?

2:28 Rich_Morin: 8 MB

2:28 Scriptor: damn

2:29 Rich_Morin: have you tried ctrl+enter at the end of the form?

2:30 Rich_Morin: ctrl+enter does nothing. cmd+enter acts the same as using the menu item

2:31 I'm on a Mac, which prolly explains the difference.

3:02 tomoj: hmm.. do we need proxy to get stacktraces on ex-info in cljs?

3:05 alex_baranosky: sgeo: what's the for/fold?

3:05 Sgeo: alex_baranosky, just some syntactic sugar around reduce

3:05 tomoj: proxy wouldn't even work

3:05 alex_baranosky: sgeo: link?

3:06 Sgeo: http://docs.racket-lang.org/guide/for.html?q=for/fold#(part._for/fold)

3:09 Rich_Morin: Apparently Clooj is broken for Clojure 1.4 - https://github.com/arthuredelstein/clooj/issues/100

3:10 ibdknox: speaking of LT, is it known to fail for Snow Leopard, or simply untested on it? I run 10.7.5 on my MB Air, but (by preference) use 10.6.8 on my desktop (Mac Pro).

3:13 ibdknox: Rich_Morin: it's 10.7+ only right now

3:13 Rich_Morin: owell

5:01 bawr: Do I need or want a strong Java ecosystem background in order to use Clojure effectively, or am I good to just drop in? C/C#/Python/Lisp guy here, I've toyed with Java the language, but that's about it.

5:05 hyPiRion: bawr: No, little knowledge with Java is needed. There are many libs/wrappers for working with about anything

5:07 bawr: Is it a good idea to try Clojure-clr, or is that lagging behind / not used much, and would just confuse me eventually?

5:08 Since if the language works the same, I'd gladly use it over F# for some of my .NET stuff.

5:22 borkdude: bawr I would like to know that also

5:41 augustl: is there a "lein test" command to run just one single deftest?

5:43 callen: augustl: lein test -h

5:47 augustl: so the only way is to edit my test to include some metadata that leiningen can pick up?

5:47 I can't run a single deftest by name?

5:47 also got to update project.clj for the metadata method it seems

5:48 currently doing some big refactoring and finding myself using comments in the test cases

5:50 Bergle_1: clojure CLR - http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/ - search for 'clojureCLR' has some comments about state of CLR i thought.

5:57 bawr: whaa, there's clojre-py?

5:57 Joy.

5:58 Bergle_1: heh :)

6:49 asina12: I can't use user/clojuredocs whenever I start nrepl from a project

6:49 I get the following error:

6:50 CompilerException java.lang.RuntimeException: No such var: user/clojuredocs, compiling:(NO_SOURCE_PATH:1)

6:50 please help

6:51 ivan: asina12: try cdoc

6:52 asina12: ivan: do you mean (cdoc lazy-seq)?

6:52 because that did not work too

6:52 ivan: yes

6:53 how are you starting nrepl?

6:53 asina12: nrepl-jack-in

6:55 * ivan remembers that cdoc is a reply thing. plain nrepl doesn't include that initialization afaik

6:58 asina12: starting it using run-lisp works though...

10:40 yedi: reducers are somewhat difficult to wrap my head around

10:49 hyPiRion: It's very abstract

10:49 Try to use it with an actual problem, then it gets better

11:05 yedi: i can get most of the individual parts of hickey's article, but I'm having trouble seeing the big picture

11:06 like why does using reducers help with performance

11:06 frozenlo`: I watched the video yesterday. After 15 min my brain was fried.

11:06 Bronsa: lol

11:06 yedi: is it because it's not doing a loop after map/filter/reduce, but instead merging all those iterations into one

11:07 llasram: yedi: Essentially. Instead of each function in a chain of sequence operations independently iterating over intermediate sequences produced by each previous operation

11:08 yedi: A chain of reducers generates a single function which represents the composition of all the chained operations

11:08 So you just walk the source data structure once and apply the function in each iteration to generate the reduction

11:09 This not only avoids the overhead of creating the intermediate conses

11:09 yedi: and then hooking it up with fold allows you to parallelize it

11:10 because fold uses fork/join

11:10 llasram: but with the JVMs primitive/reference duality, allows for chaining functions which directly produce and consume primitive types w/o un/boxing at each step

11:10 yedi: Exactly

11:10 Well, mostly exactly. The fold implementation for vector uses fork/join :-)

11:11 The `fold` operation is just a protocol which presents an interface which *is* parallelizable

11:12 yedi: because of the associativity

11:14 what did he mean when he talked about 'getting rid of the null/empty values'

11:20 llasram: Had to dig up the blog post to see what you meant :-)

11:20 He's talking about other approaches to defining how to perform sequence-like operations in parallel

11:20 One approach would be to have every parallel step return a concrete sequence representing its part of the computation

11:21 But if you're e.g. filtering, you can get a lot of empty lists, which still need to be returnend and concatenated together

11:21 The function composition model used by the reducers library avoids that

11:27 ravster: hello all

11:27 will using the ring.utils.response wrapper interfere with the ring.wrap-sessions wrapper?

11:32 ppppaul: hey guys

11:32 i'm having trouble with with-redefs

11:33 i'm using a ring mock lib, and it seems to not be using my redefs, anyone have similar problems?

11:33 https://gist.github.com/4364133

11:33 i'm using peridot

12:04 amalloy: llasram: i'm not convinced that reducers will enable combining operations on unboxed primitives anytime soon

12:06 xeqi: ppppaul: I'd be somewhat surprised if that worked, its defining the test with the redefs, but when ran I'd expect it to use the original definitions

12:06 llasram: amalloy: Hmm, good point. Right now the hint metadata is lost by the time the function composition is occurring

12:06 xeqi: ppppaul: does it work if you move the with-redefs inside the deftest?

12:08 amalloy: llasram: that's not a good way to think about it. the metadata only exists at compile time, to tell the compiler to generate an implementation of, say, the LL protocol (long->long). at runtime, the implementation of LL really is there, and could be called

12:08 xeqi: also think you might need it to add ":request :body" to the end of the ->

12:09 amalloy: the problem is that the reducer "sources", like vectors and lists and so on, implement CollFold/Reduce by a loop/recur over an Object. there's no obvious way to get them to loop over any sort of primitive instead

12:09 reducer transformers (eg, r/map) present a similar problem

12:11 llasram: amalloy: I was more thinking there's no pathway via which the return value of a particular function could be identified as a primitive. But right -- the issue is that at compile-time only one version of the transformers which handles references all the way through is generated

12:13 Although -- if the functions involved all implement the right primitive interfaces, the info is available

12:13 xeqi: err, ":response :body"

12:13 llasram: It's just not convenient or automatic (or done by the current implementation)

12:14 squidz: so can we use fold already?

12:24 ppppaul: xeqi, i moved the with-redefs around into a few different places, nothing works

12:24 even when i put it outside of the test and have it assign to a (def) it doesn't work

12:25 xeqi, i wasn't really caring about the test failing, but i fixed that part. i cared more about the test not hitting couchdb first

12:26 i would really like to better understand why my redef isn't working and how i would use it correctly

12:29 xeqi: ppppaul: does your login route call (api.routes.login/couch-auth-proxy) ?

13:10 Rich_Morin: yedi: yt?

13:50 ppppaul: xeqi, no, that was just for testing... login route calls couch/authenticator

14:38 xeqi, except for me having a lot of trouble mocking out fns with your lib, it is great! :D makes functional testing very easy

14:39 xeqi: ppppaul: glad to hear it

14:40 wish I had more advice for the with-redefs

14:53 borkdude: does ccw support :java-source-paths in a project.clj?

15:09 apparently it does

15:21 zilti: Does nesting (str) give lazy sequences, is that possible? That's my code: https://gist.github.com/4365734

15:21 I'm trying to build an SQL statement and it gives me errors because the put-together string contains "clojure.lang.LazySeq@cee40fd8"

15:22 amalloy: &(str (for [x (range)] x))

15:22 hm, bad example

15:22 lazybot: Execution Timed Out!

15:22 amalloy: &(str (for [x (range 10000)] x))

15:22 lazybot: Execution Timed Out!

15:22 amalloy: &(str (lazy-seq))

15:22 lazybot: ⇒ "clojure.lang.LazySeq@1"

15:23 zilti: &(str "Begin " (for [x (range 100)] (str x)))

15:23 lazybot: ⇒ "Begin clojure.lang.LazySeq@aadb0c53"

15:23 zilti: That's exactly my problem

15:23 amalloy: you want to call str with 100 arguments, but you're not

15:23 zilti: No, I don't want

15:23 Oh wait, somehow I do want, yes, but... I can't write:

15:24 hyPiRion: ,(str "begin " (seq (for [x (range 100)] (str x)))) ;?

15:24 clojurebot: "begin (\"0\" \"1\" \"2\" \"3\" \"4\" ...)"

15:24 zilti: &(str (for [x (range 100) y (range 100)] x y))

15:24 lazybot: clojure.lang.ArityException: Wrong number of args (3) passed to: core$for

15:24 zilti: &(str (for [x (range 100) y (range 100)] (str x y))

15:24 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

15:24 hyPiRion: heh.

15:24 zilti: &(str (for [x (range 100) y (range 100)] (str x y)))

15:24 lazybot: Execution Timed Out!

15:25 zilti: You see my problem?

15:25 &(str (for [x (range 10) y (range 10)] (str x y)))

15:25 lazybot: ⇒ "clojure.lang.LazySeq@86672e53"

15:25 amalloy: well i don't know why lazybot is timing out

15:25 ,(hash (range 10000))

15:25 clojurebot: 1722319241

15:26 amalloy: &(hash (range 10000))

15:26 lazybot: ⇒ 1722319241

15:26 amalloy: ,(str (range 10000))

15:26 clojurebot: "clojure.lang.LazySeq@66a88189"

15:26 amalloy: &(str (range 10000))

15:26 lazybot: ⇒ "clojure.lang.LazySeq@66a88189"

15:26 hyPiRion: amalloy: It's the `for`. Clojail does some black magic nobody understands.

15:26 zilti: &(str (for [x (range 100) y (range 100)] x y)) ;My problem is that this - for obvious reasons - doesn't work, but putting x y in a str gives that lazy seq.

15:26 lazybot: clojure.lang.ArityException: Wrong number of args (3) passed to: core$for

15:26 amalloy: ugh. that didn't used to be a problem, hyPiRion. someone send Raynes a stocking full of coal

15:27 llasram: &(str "begin(" (clojure.string/join "," (for [x (range 10)] (str x))) ");")

15:27 lazybot: ⇒ "begin(0,1,2,3,4,5,6,7,8,9);"

15:27 hyPiRion: amalloy: That has been 4clojure.com's problem for quite some time. I had to swap out my `for`s in order to get it running fast enough.

15:28 amalloy: hyPiRion: yeah, i only heard about that recently. we seem to have traded very-slow interop for very-slow checking of the large forms generated by for

15:28 &(macroexpand-1 '(for [x (range)] x))

15:29 lazybot: ⇒ (clojure.core/let [iter__4468__auto__ (clojure.core/fn iter__107432 [s__107433] (clojure.core/lazy-seq (clojure.core/loop [s__107433 s__107433] (clojure.core/when-let [s__107433 (clojure.core/seq s__107433)] (if (clojure.core/chunked-seq? s__107433) (clojure.cor... https://www.refheap.com/paste/7829

15:30 zilti: Hmm so is this a bug in str, or did I miss the point of how it's working?

15:30 llasram: zilti: It's not a bug

15:30 amalloy: if there were a bug in str, you wouldn't be the first to find it :P

15:30 llasram: zilti: ##(str "begin(" (clojure.string/join "," (for [x (range 10), :when (even? x)] (str "'" x "'"))) ");")

15:30 lazybot: ⇒ "begin('0','2','4','6','8');"

15:31 zilti: Hm and clojure.string/join only takes two arguments...

15:31 llasram: zilti: You need to pass `str` a flat sequence. You can either turn the `for` result into a single string w/ something like `str/join`, or turn the entire sequence of strings into a flat sequence to pass to `str`

15:31 zilti: Right. It takes the character to join with and the collection of elements to join

15:36 s,character,string,

15:36 zilti: Ok. Thanks! That makes the whole string manipulation thing a lot more difficult, though...

15:36 llasram: zilti: How so?

15:37 zilti: llasram: Because one has to do additional stuff just to conjoin some strings together

15:38 amalloy: no you don't. you just need to be clear (to the compiler, and in your head) about what's a string and what's a collection of strings

15:38 you can't just drop a collection of strings anywhere a string is expected - it would be crazy if that worked

15:38 zilti: Something wrapped in str is supposed to be a string

15:38 llasram: (inc amalloy)

15:38 lazybot: ⇒ 37

15:39 amalloy: zilti: no counterexample of your statement exists

15:39 ie, everything wrapped in str is a string

15:39 zilti: So why does it still give me a lazyseq?

15:39 amalloy: it doesn't

15:39 &(str (range 10))

15:39 lazybot: ⇒ "clojure.lang.LazySeq@9ebadac6"

15:39 llasram: If you want something that turns collections into string by recursively turning all of their elements into a string, you could write that. I'm not sure I'd recommend it, but it wouldn't be difficult

15:39 amalloy: that's a string

15:39 zilti: https://gist.github.com/4365734 <- it kinda does

15:39 amalloy: first character is \c, next is \l, ...

15:41 AimHere: llasram > wouldn't it be as simple as (str (seq (flatten ...))) ?

15:42 llasram: AimHere: Was just checking how `flatten` treated strings :-)

15:42 amalloy: AimHere: calling str on sequences is never* a good idea. (*) almost never

15:42 AimHere: Well the seq there is just to unlazify the results of flatten

15:43 amalloy: that only makes a difference by coincidence

15:45 the sequence is still lazy, except the first element, and it's a bit odd that LazySeq chooses to print differently based on whether the first element is realized; that's certainly not a guarantee across clojure version

15:45 but more importantly, str is not a good idea on anything sequential. wouldn't you like to know the difference between the symbol 'a and the string "a"? ##(str '(a "a"))

15:45 lazybot: ⇒ "(a \"a\")"

15:45 amalloy: well shoot, when did those start printing differently?

15:46 AimHere: ,(str 'a "a")

15:46 clojurebot: "aa"

15:46 llasram: zilti: this is probably bad, but if you really wanted to: ##(let [rstr #(apply str (flatten %&))] (rstr "begin(" (for [x (range 10)] (str x ",")) ");"))

15:46 lazybot: ⇒ "begin(0,1,2,3,4,5,6,7,8,9,);"

15:47 amalloy: AimHere: sure, obviously. but it used to be the case that ['a "a"] printed as "[a a]"

15:47 AimHere: If you want your clojure objects recoverable from the output from the stringification, then you use whatever the appropriate print function uses

15:47 amalloy: which is why using pr-str was recommended

15:47 AimHere: Sometimes you just want to print an 'a', and don't care if it's a string, a char, or a symbol

15:49 hyPiRion: huh

15:49 bawr: AimHere: if you don't care, you're doing it wrong.

15:49 hyPiRion: ,(str 'a '"a")

15:49 clojurebot: "aa"

15:49 zilti: llasram: That's not bad, that's perfect, thanks.

15:49 ,(inc llasram)

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

15:50 zilti: (inc llasram)

15:50 lazybot: ⇒ 5

15:50 AimHere: I thought the point of a dynamic language was that I didn't have to care about types ;)

15:51 llasram: zilti: I meant "bad" in that it's potentially obfuscatory. And uses `flatten` to boot

15:51 ~flatten

15:51 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

15:52 bawr: AimHere: Yeah, I prefer to use the right type for the job.

15:52 zilti: llasram: But for putting together a string where parts of it are built differently it's perfect.

15:53 hyPiRion: The right function to use here is obviously...

15:53 ~amalloy

15:53 clojurebot: amalloy is <amalloy> just use juxt, it'll be great

15:54 amalloy: hah. you know, not *all* of the snippets clojurebot has on me are about juxt

15:54 except i guess that's not true, because the others got removed? lame

15:55 hyPiRion: hm

15:57 Raynes: amalloy: Okay?

15:57 amalloy: I mean, I'm not sure what else to do, man.

15:58 I completely rewrote the tester stuff for the sole purpose of making it fast for the cases that we had.

15:58 I don't know how to make it faster.

16:04 And this is not the channel we were talking about that in.

16:04 * Raynes yawns

17:18 callen: this is the hardest rain I've seen in the bay area since I moved here.

17:20 Raynes: callen: You should visit Alabama. We're looking at a mean tornado outbreak on Christmas.

17:21 Rich_Morin: I prefer to live where the weather isn't trying to kill me...

17:22 callen: Raynes: I'm from Ohio, awful weather is the norm there. I've only been to 'Bama during the summer.

17:22 Rich_Morin: The usual Bay Are response is "we need the water", followed by "of course, it's the snow pack that counts".

17:22 callen: Rich_Morin: snow pack?

17:22 amalloy: it's not, say, freezing cold outside, Rich_Morin? that sounds like attempted murder too

17:22 Rich_Morin: Where do you think SF gets its water?

17:23 callen: Rich_Morin: I assumed the yuppies were stealing it from poor people in South America.

17:23 Rich_Morin: http://en.wikipedia.org/wiki/Hetch_Hetchy_Reservoir

17:24 http://en.wikipedia.org/wiki/Hetch_Hetchy_Aqueduct

17:28 callen: Between storms, Sonoma County is really gorgeous this time of year. Everything turns GREEN for a few months.

17:29 abp: Wow I'm approaching common sense in slaying 4clojure problems short with core fns.

17:29 callen: Rich_Morin: I'll have to ride the motorcycle up there next week.

17:30 Rich_Morin: It's more pleasant during the week (aside from rush hour) - less tourists :-)

17:36 callen: here's a nice route - 101 (N) to Santa Rosa, River Road (W) to Guerneville (stop off at Armstrong Woods), River Road (W), Hwy 1 (S) to Mill Valley, 101 (S) to SF.

17:36 Have lunch at one of the coastal restaurants and enjoy the view...

17:36 * gfredericks is suddenly reminded of the californians on recent SNL episodes

17:36 abp: Just sad my 4clojure solutions from a year ago weren't saved. Would be funny for them to see how I solved things when starting out vs them now. Must stop giving hims so they screw up too. :x

17:37 hey gfredericks, I'm solving 4clojure and your 4core.logic interleaved. Great fun. :)

17:37 gfredericks: abp: oh nice :)

17:38 amalloy: abp: surely we were saving solutions a year ago

17:38 abp: amalloy, yeah more like one and a half. Embarassing how long I took to grok fp. :P

17:39 And get around to know core fns

17:41 * gfredericks still doesn't know any core fns

17:42 abp: gfredericks, how shall I call em? Stop making fun of me. :P

17:43 gfredericks: abp: oh that's fine verbage. I was making fun of myself, not you.

17:44 abp: gfredericks, ok, thought because you know a thing or two, you know.

17:44 gfredericks: yeah sometimes ain't do communicate to good

17:44 mehwork: C-M-q in emacs says "undefined". How can i make it so it auto formats my clojure code?

17:45 abp: me too, but I'm no native english speaker.. writer.. err ;)

17:45 bawr: abp: communicator? ;)

17:45 abp: well

17:45 yes

17:45 gfredericks: abp: you have all my sympathy

17:46 abp: gfredericks, those are the worst.

17:46 mehwork: I was born in America. So I guess I'm not really a native english speaker either

17:46 gfredericks: abp: sympathies?

17:47 bawr: I adopted myself as a citizen of the English-speaking world. So I'm, uh, retroactively native? ;)

17:47 technomancy: alex_baranosky: I think you got the location of the problematic slamhound behaviour right. I think the fix won't be localized to that particular method though.

17:47 abp: gfredericks, no, I was relating to phrases.

17:47 amalloy: fwiw abp, you made me curious so i did a little digging: we added that feature in may 2011

17:48 Raynes: amalloy: What feature?

17:48 abp: amalloy, ok, I think I did some in march and april

17:48 amalloy: Raynes: saving users' solutions on 4clojure

17:48 bawr: any recommended way of learning Clojure well? or do I just read the standard docs and the code behind Clojure itself?

17:49 gfredericks: bawr: hay libros

17:49 alex_baranosky: technomancy: yeah, I"m spending more time just thinking about it. And once side-benefit, si that I can still run the old slam hound on my code at work, by changing the require aliases to match the final segment of the namespace

17:49 amalloy: bawr: don't try to mimic clojure.core. read code, write code

17:49 bawr: gfredericks: wha?

17:49 technomancy: alex_baranosky: heh; yeah if you contort your code to fit its requirements =)

17:49 alex_baranosky: technomancy: I seem to be seeing failures also occur when there are multiple possible namespaces that have the same ending

17:50 technomancy: alex_baranosky: yeah, the current logic is easily confused

17:51 it needs to accumulate more data about past failures to be able to make the correct decisions down the line, particularly about aliased vars

17:51 alex_baranosky: technomancy: we'll see what we can do, but at minimum, the require/refer change appears to work

17:51 technomancy: cool. that should be pretty straightforward.

17:51 gfredericks: bawr: there are books

17:52 alex_baranosky: if you have a well-defined algorithm in your head that you think will work that'd be useful to have sent over email or something

17:52 technomancy: yep, tests pass creating require/refer instead of use/only

17:53 technomancy: nothing really well-defined. actually I realized keeping a list of failures could make it find the right candidates faster but isn't technically even necessary for a correct implementation.

17:53 maybe just focus on getting it working first before you get fancy =)

17:54 alex_baranosky: technomancy: sounds good, I'll keep you posted

17:54 technomancy: great

17:54 would be really happy to see this working again =)

18:00 abp: bawr, probably reading Clojure Programming and The Joy of Clojure, solving problems on 4clojure.com, solve some excercise programs that require a little program structuring and functional thinking. Watch some talks on Clojure and its philosophy. For example Simple Made Easy and Thinking in Data.

18:00 And I'm out.

18:07 amalloy: okay, google impresses me. accidentally searched for "jpirs": they realized my right hand was misplaced, and showed me the results for "hours" instead

18:07 * gfredericks tries it with dvorak

18:08 * technomancy too

18:08 technomancy: doesn't work =(

18:08 gfredericks: but now I know about Toul

18:11 muhoo: trying to figure out how to paste into refheap from an android browser on a tablet. neither ffx nor chrome seem to like it

18:12 maybe refheap is eating the long-presses that usually pop up a "paste" menu

18:16 though, lein works on debian chroot on an android asus transformer tablet

18:16 technomancy: muhoo: sweet =)

18:16 how long does `lein version` take?

18:20 IceD^: wondering here how lein makes suggestions to commands. e.g. try `lein server`

18:21 technomancy: IceD^: you can see the suggestion algorithm in leiningen.core.main

18:21 IceD^: yeah, I'm there already :)

18:22 muhoo: technomancy: like 20 seconds with 2 cores at 75% cpu :-)

18:23 actually 7 seconds according to time

18:23 using the oracle embedded jvm for armel

18:23 technomancy: that's not so bad

18:28 muhoo: not at all, considering it's basically a phone

18:28 with a big screen

18:30 wow, this is like an El Nino rain.

18:33 hyPiRion: It's just levenshtein with an edit distance of 3-4 or less, isn't it?

18:39 mehwork: is there a linux cli tool that can auto reformat clojure to be in a decent lisp indentation style?

18:39 muhoo: mehwork: emacs :-)

18:39 mehwork: aside from emacs

18:40 it's taking way too long to figure out how to install the right tools in emacs since i'm not an emacs user and this is the only thing i want to do

18:41 muhoo: oh, then you might want to try lighttable

18:41 not a cli tool though.

18:41 dottedmag: mehwork: el-get helps a lot

18:41 That is, M-x el-get-install foo, M-x foo-mode

18:42 callen: mehwork: they're not going to stop telling you to use Emacs.

18:43 bawr: >Simple Made Easy

18:43 >Emacs

18:43 callen: takes 2 seconds to run lein version on a Macbook Air

18:43 bawr: I still have no idea how the former connects with the latter.

18:44 callen: bawr: it doesn't really matter. When it comes to something like Emacs it's an incumbent ecosystem that is unlikely to ever be displaced.

18:44 dottedmag: Well, it doesn't.

18:44 mehwork: callen: lein version?

18:44 callen: bawr: it's only things like LightTable that really bring anything new to the table.

18:44 mehwork: da

18:44 gfredericks: \forall_{x,y} emacs complects(x,y)

18:44 bawr: gfredericks: xD

18:44 callen: GET IT? NEW! TO THE TABLE! HAAAAAAAAAAAAAAAAAAAAAAAAAAA

18:44 * callen composes himself

18:45 bawr: I just refuse to believe that Emacs is the best we can do for Lisp-editors.

18:45 Because that would be pretty sad.

18:46 mehwork: i don't think anyoe else has put in one millionth as much time into another lisp editor though

18:46 so i'm sure it is the best there is right now

18:46 gfredericks: things can usually be better; that's not a good reason not to adopt the best thing unless you're in the mood to build something better

18:47 callen: bawr: Zmacs was pretty great. LightTable has promise.

18:47 you could evaluate code in Emacs to change the state of the enclosing operating system. Sigh Symbolics Genera.

18:47 xeqi: waiting for my direct neural interface

18:48 callen: xeqi: you'll keep waiting then :)

18:48 zilti: I don't know what they're up to with LightTable, though. I thought it's written in Clojure/Java, so why isn't there a platform independent package anymore?

18:48 bawr: callen: Ahh, Lisp Machines.

18:49 callen: Raynes: so I like the code in Laser, but if you get the sort people using Enlive to switch, they're going to complain incessantly.

18:49 mehwork: lighttable looks cool

18:49 callen: zilti: pretty sure he makes it using node-webkit.

18:49 clojurebot: It's greek to me.

18:49 callen: clojurebot: you weren't asked.

18:49 clojurebot: I don't understand.

18:49 callen: I know, that's why I didn't ask you.

18:50 zilti: lol

18:50 * gfredericks always has to look up which of ex-data and ex-info is which

18:51 pipeline: there is always movitz

18:51 common lisp on raw x86

18:52 callen: pipeline: only CL'ers are that crazy.

18:52 gfredericks: oh man ex-data on the repl is nice

18:52 (ex-data *e)

18:54 bawr: Well, LIghtTable seems interesting.

18:57 I wish it was better documented, though.

19:02 callen: bawr: it's pretty nascent. If you have a feature request, bug ibdknox.

19:03 gfredericks: I wonder how much content could be gathered for a clojure Wat talk

19:04 amalloy: gfredericks: headlining: contains?

19:05 gfredericks: is that #_%2 bug still out?

19:06 and there is clojure.core//

19:06 amalloy: i doubt #_%2 will change anytime soon

19:06 bbloom: gfredericks: i'm pretty sure 1.5 fixes /

19:06 gfredericks: right; cljs needed it

19:08 &(-> 42)

19:08 lazybot: ⇒ 42

19:08 gfredericks: &(->> 42)

19:08 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$--GT

19:08 gfredericks: wouldn't be a very dramatic talk :/

19:09 Bronsa: wtf

19:09 bbloom: most of the "wat?"s in clojure would require a pretty deep understanding of the implementation of lisps to really say "wat" about

19:09 :-P

19:09 gfredericks: ,(+ [] {})

19:09 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>

19:09 gfredericks: haha WAT

19:10 bbloom: gfredericks: try that here: http://himera.herokuapp.com/index.html

19:10 WAT

19:10 gfredericks: haha why do we have assoc/assoc-in/update-in but no update amirite WAT

19:11 bbloom: "[object Object][object Object]"

19:11 gfredericks: bbloom: ermagherd WAT

19:11 that's CUHRAZY

19:11 muhoo: gawd, cljs is still js

19:12 so i'd expect the best WAT-hunding would be in cljs

19:12 bbloom: if somebody can figure out how to make polymorphic + fast on all platforms without absurd amounts of type hints, please do :-)

19:12 muhoo: hunting

19:12 amalloy: that's the nice thing about clojure being hosted. you can choose between a weak type system, or an aggressive, hostile, weak type system

19:13 gfredericks: ~rimshot

19:13 clojurebot: Badum, *tish*

19:13 bbloom: i prefer my type systems as hostile as possible. and armed to kill

19:13 muhoo: bbloom: haskell user?

19:13 bbloom: no :-P

19:13 i just like the mental image of a type system armed to kill with a mean look on it's, um, face

19:13 Bronsa: 6oh i see

19:14 muhoo: what's the type system of the CLR like? never used it

19:14 amalloy: haskell's type system is like a puppy bringing you your slippers

19:14 bbloom: muhoo: the CLR's type system is marginally more sophisticated than Java's

19:14 ChongLi: yeah how about javascript?

19:14 muhoo: clojurebot: javasccript

19:14 clojurebot: Pardon?

19:14 ChongLi: killer in a different way

19:14 muhoo: clojurebot: javascript

19:14 clojurebot: javascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p

19:14 bawr: So. What's the current recommended way to get Clojure to start up faster for scripting/etc?

19:14 muhoo: hahaa

19:14 bbloom: muhoo: most interestingly, the CLR supports value types and true generics

19:15 muhoo: as well as much better native call interop

19:15 Foxboron: bawr, Linux or Windows?

19:15 brainproxy: bawr: drip maybe?

19:15 Bronsa: that weirt ->> error is caused by https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L437

19:15 weird*

19:16 bawr: I seem to remember reading about a) something that keeps loaded Java stuff in memory not to compile it again; b) some small java/closure? patch that someone made while investigating main bottlenecks.

19:16 Linux.

19:16 Foxboron: bawr, drip it is

19:16 Thats the A) you mention.

19:16 https://github.com/flatland/drip

19:16 bawr: Oh, thanks.

19:16 Bronsa: I got a bigger wtf though

19:16 >ArityException Wrong number of args (-1) passed to: core$map clojure.lang.Compiler.macroexpand1 (Compiler.java:6478)

19:16 ChongLi: clojurescript can be used for command line utilities

19:17 muhoo: Bronsa: how is -1 args even possible?

19:17 Bronsa: eheh

19:17 muhoo: you thought i was going to give you an arg, but NO, i took one away instead! muaaahahah!

19:17 zilti: ChongLi: Who would ever do that?

19:17 Bronsa: i know what's bugged but i have no idea on how to fix it

19:17 bbloom: i feel like, in order to qualify for being a WAT, it needs to be something that you simply can not change about the language

19:17 you can fix an error message

19:17 you can't fix [] + {}

19:17 gfredericks: -1 args is usually calling a macro like a function, isn't it?

19:17 ChongLi: zilti: who knows, it's sort of an esoteric thing

19:17 Bronsa: nope gfredericks

19:18 bawr: Foxboron: Oh, seems it's not really a standalone JVM, which is interesting.

19:18 gfredericks: Bronsa: fooey

19:18 Bronsa: it's when you get an arityexception from a function evaluated in macroexpansion-time

19:18 like

19:18 >(defmacro [] (map +))

19:18 and the bug is https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6472 here

19:18 gfredericks: the macroexpander just subtracts 2 from all arity exceptions regardless?

19:18 ChongLi: generally I think most people are served by shell, perl or python

19:18 Bronsa: yep

19:18 gfredericks: well...great.

19:19 zilti: "clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap" That's strange, too.

19:19 amalloy: ah! i knew there was a way to get -1 args but i couldn't remember/find it

19:19 brainproxy: ChongLi: there seems to be a bit of renewed interest in tcl of late too

19:19 bbloom: Bronsa: that seems like a really easy fix: can't you just move the arguments to v.applyTo out of the try/catch?

19:19 amalloy: zilti: #({})

19:19 brainproxy: i keep seeing mention of it on HN and other places

19:19 bawr: CLojure scripting can be really powerful when done right.

19:20 zilti: ,#({})

19:20 clojurebot: #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@28f056a7>

19:20 amalloy: &({}) ;; is what i meant

19:20 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap

19:20 hyPiRion: ,({} [] ())

19:20 muhoo2: that's 0, not -1

19:20 clojurebot: ()

19:20 amalloy: you probably wrote something like (#({:a %}) 1)

19:20 brainproxy: zilti: when you use the #(...) notation for lambdas

19:20 ChongLi: brainproxy:hmm, strange

19:20 gfredericks: ,~foo

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

19:20 brainproxy: you should't use the reader literal notation for hash-map, vector as the first block inside the labmda

19:21 err expression

19:21 gfredericks: ,~42

19:21 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>

19:21 brainproxy: zilti: try this instead, #(hash-map ...)

19:21 hyPiRion: ,`~42

19:21 clojurebot: 42

19:21 zilti: brainproxy: No, my problem was (@db-struct) instead of writing @db-struct...

19:22 brainproxy: okay

19:22 ,#({:a 1})

19:22 clojurebot: #<sandbox$eval156$fn__157 sandbox$eval156$fn__157@76b047f0>

19:22 Bronsa: bbloom: that way you get an arityexception on n+2 parameteres if you invoke the macro v with the wrong number of args

19:23 brainproxy: ,(#({:a 1}))

19:23 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

19:23 brainproxy: ,(#(hash-map :a 1))

19:23 clojurebot: {:a 1}

19:25 brainproxy: ChongLi: maybe not too strange, after seeing the announcement about tcl 8.6, i decided to work through the tutorial and play a little bit; seems like a nice glue-language for quick prototyping and building on top of the shell

19:26 ChongLi: brainproxy: oh yeah? perhaps I'll check it out

19:26 Bronsa: bbloom: the thing is, you have no way to know if the ArityException is of the macro, or of the body of the macro

19:26 ChongLi: I thought it was mainly used for writing GUIs or something

19:26 brainproxy: I don't think I'd use it for more than that, personally, since clojure/script is so close at hand for serious application development

19:27 but it's kind of neat how portable it is, and you can even whip up guis super fast if you use the Tk libs for tcl

19:27 zilti: brainproxy: seesaw is pretty awesome, too.

19:28 ChongLi: hmm

19:28 what about tcl/java

19:28 ?

19:28 brainproxy: zilti: neat, hadn't seen that, will play with it

19:29 ChongLi: Jacl is a self-contained implementation of a Tcl interpreter, written entirely in Java

19:29 zilti: brainproxy: Yes, indeed. It adds a lot on top of swing which it uses in the background, and you can modify the UI "live" e.g. from the REPL.

19:29 ChongLi: this seems kinda cool

19:30 Tcl Blend as well

19:30 hmmm

19:31 you could write a program in clojure that calls out to Tcl/Tk to do its GUI

19:31 that would be weird

19:32 brainproxy: ChongLi: probably not worth it

19:32 ChongLi: yeah

19:32 just interesting to think about

19:32 brainproxy: i mean might as well use swing or this seesaw thing zilti mentioned

19:32 oh sure

19:33 ChongLi: so I've been reading Paul Graham's On Lisp

19:33 it's been my first exposure to CL code

19:33 what I don't get is how people can put up with all that sharp-quoting and funcalling

19:35 can anyone explain to me what the advantages of that are? that is, having a separate namespace for functions?

19:35 hyPiRion: Knowing what is vars and what is defuns

19:35 vars may change, defuns (usually) don't

19:36 zilti: ChongLi: I never understood that, too, but I've been told that this question can start wars

19:36 ChongLi: zilti: I don't want to start a war here :)

19:37 brainproxy: ChongLi: http://www.nhplace.com/kent/Papers/Technical-Issues.html

19:37 that turned up when I googled lisp-1 vs lisp-2

19:37 ChongLi: brainproxy: thanks

19:39 abp: I'm still not sure if I should use namespaces or maps for my functions.

19:40 ChongLi: maps?

19:40 clojurebot: maps are functions

19:40 abp: You see. :P

19:40 No, in a control flow library.

19:42 Basically putting fns into maps would require documentation tools that look on fn-meta for docs etc, because no vars there.

19:42 ChongLi: you want to use the maps to dispatch or something?

19:42 hyPiRion: Putting fns or vars into maps?

19:43 I mean

19:43 ,(ns-publics 'clojure.core)

19:43 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}

19:44 abp: ChongLi, actually to build computation graphs.

19:45 https://gist.github.com/4142595

19:45 hyPiRion, thanks now I have even more to think about. ;P

19:46 hyPiRion: abp: You're welcome :p

19:47 abp: Do you have the cgf-library on github yet? Sounds interesting

19:48 Or is it too early?

19:49 abp: hyPiRion, not by now. Probably not too early, but I wanted to get more things done before releasing something. Also there are lots of things I want to be sure about before putting it up. Could be the wrong approach.

19:51 hyPiRion, since the presentation of prismatics graph at strangeloop there are a few of those libs out there.

19:51 hyPiRion: In clj?

19:51 abp: yes

19:52 hyPiRion: I have apparently missed that, thanks for telling

19:53 abp: https://github.com/stuartsierra/flow https://github.com/doo/process

19:53 Probably more I don't remember now.

19:55 I found prismatics approach quite compelling, allthough I'm acting on other needs. I'm aiming for telling what changed and transitioning states, not pulling specific outputs.

19:56 Despite planing to provide that as well.

19:57 hyPiRion: cool

19:59 zilti: Did I understand that right that it's like pipes-on-steroids? Is interprocess communication possible with it? I discovered Aleph/Lamina recently and think it's a great library.

20:00 abp: I think it can be a lot. Transport between nodes could be arbitrary.

20:03 hyPiRion: It's like dataflow variables from what I can see

20:03 Except it doesn't sound lazy

20:06 abp: I don't know dataflow variables. Prismatics graph has different compile-modes. Depending on those, it is eager, lazy or parallel. Mine is just eager updating dependents of what changed by now.

20:33 hyPiRion, ok, I know some things about dataflow variables. But didn't know that name.

20:41 hyPiRion: It's not often used

20:42 Dataflow variables, I mean, not the name

20:42 abp: By now I don't undestand why.

20:43 hyPiRion: Yeah, it's a bit sad I think. It's one of the features I miss in Clojure

20:43 abp: I've written such a system in Java. It worked like a charm despite being Java.

20:43 hyPiRion: heh

20:44 abp: It was a little special and a lot of code. With custom compile steps to integrate Properties with the system. But it worked and saved a ton of work.

20:47 hyPiRion, have you worked with such systems? Because you've said you miss it in Clojure.

20:47 callen: can you do an "update ... returning" in Korma?

20:47 zilti: returning?

20:48 callen: zilti: yes, returning.

20:48 zilti: as in, wait until finished?

20:49 callen: zilti: http://www.postgresql.org/docs/9.0/static/sql-update.html

20:49 zilti: real SQL databases have something called RETURNING for their UPDATE queries.

20:50 zilti: just ctrl-f "RETURNING" and yo'll see.

20:50 OracleDB, MSSQL, and PostgreSQL all have it.

20:50 hyPiRion: abp: I've used the programming language Oz

20:50 callen: as is typical, MySQL does not because it's a sad pale imitation of a SQL database.

20:51 p_l: *SNRK*

20:51 you meant ISAM dataset with SQL emulation layer ;)

20:54 zilti: So a "UPDATE table whatnot-values RETURNING *" returns all rows that have been updated?

20:54 harob: Hi all, is there way to attach metadata to a record class? (such that I can retrieve the metadata from any instance of the record)

20:55 callen: p_l: yeah, old wounds there for me. I've had to write entire libraries to work around MyISAM limitations.

20:56 zilti: the reason it's important is that it enables one to perform a write followed by a read atomically and safely.

20:56 zilti: callen: Isn't that just syntactical sugar for wrapping this in a transaction?

20:58 p_l: callen: I finally dropped it after being burned one time too many by MySQL weirdness with encodings

20:58 callen: zilti: MyISAM doesn't have transactions, either.

20:58 p_l: oh right, it's not UTF-8 by defaulr rightt right?

20:59 pardon mistypes, terminals are being eirweird.

20:59 p_l: and query planner in MySQL is... shit

20:59 zilti: callen: I'm not talking about MySQL. I'm right now working with H2

20:59 p_l: callen: and has iirc three different points at which encoding conversion can happen in a connection, and implements unicode incorrectly

21:00 lucian: p_l: it's awesome compared to mongodb's

21:00 p_l: lucian: ... you knolw how to pick your insults

21:00 *know

21:00 lucian: :)

21:01 (mongodb always does a table scan, except if you define an index (except for anything but a small subset of all queries it can do))

21:01 * lucian is a little bitter

21:06 p_l: My favourite was when a friend of mine, pretty good programmer et al (understatement), tells me one day how he ended up writing half of the query in PHP instead of SQL, because it was faster to run two queries than use a subquery

21:08 lucian: yeah, if you value your sanity you don't want to know what tricks i do to keep mongodb from doing table scans

21:27 harob: Is there any way to access a record class's basis from an instance of the record? `(Baz/getBasis)` and `(. Baz getBasis)` work fine, but `(let [b (->Baz 1 2)] (. b getBasis)` throws a cryptic exception.

21:31 amalloy: (.getBasis (class b))

21:31 (but, why are you looking at basises anyway? surely that's an implementation detail

21:32 no, what i just suggested won't work at all

21:33 you'd have to do reflection, i guess

21:33 harob: amalloy: that also throws an exception. I wanted to attach metadata to certain of the fields of a record class, and access that with (map meta (Baz/getBasis))

21:34 I'm guessing this is not a great way to it. Is there a better way to achieve that?

21:35 amalloy: i can't say, because you've only said what your implementation plan is, not what your goal was

21:35 why would you attach metadata to record definitions? there's a better way to do that (probably), but what it is will likely depend on what you want

21:36 harob: Fair enough :) I want to have records that have certain keys that are flagged as "relations", and be able to know which those keys are elsewhere.

21:37 callen: harob: http://meta.stackoverflow.com/questions/66377/what-is-the-xy-problem

21:37 ,xy

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

21:37 callen: $xy

21:37 amalloy: well, as usual i'll caution you against using records prematurely - maps are more flexible and easier to work with

21:37 callen: ~xy

21:37 clojurebot: xy is http://mywiki.wooledge.org/XyProblem

21:37 callen: good bot.

21:37 $botsnack

21:37 lazybot: callen: Thanks! Om nom nom!!

21:37 callen: wrong bot. sigh.

21:37 amalloy: but you could, for example, define a multimethod get-relations, and create methods of it with each of your record classes

21:38 harob: e.g. (defrecord Baz [a b c d]), and [:b :d] are "relation" keys. There are several such record types.

21:38 amalloy: that sounds good. I was thinking of using a protocol, but I assume that if there's just one method then a multi method is simpler.

21:39 amalloy: meh. a protocol is liable to be less typing, but it ties you to records so that you can't really change your mind and go back to maps

21:39 harob: The reason I though metadata might be a better solution is that this data is effectively "static"

21:39 ok

21:39 callen: I'd say this is another example of why Clojure should be a like video game where you unlock new powers.

21:40 protocols and records would be inaccessible initially ;P

21:40 bbloom: callen: you're welcome to steal that idea if you promise to do it justice

21:40 callen: Haskell by its design has this built in by making everything difficult.

21:40 bbloom: I've got a different game design problem I am working on. After I finish an ongoing...concern of sorts, I'd like to make the first game that makes you feel like an actual wizard.

21:41 harob: thanks for the help amalloy!

22:00 muhoo2: the secret i've found is, if i can't figure out wtf something does, then don't use it :-)

22:01 amalloy: that's the trouble with records. they look easy to use

22:04 muhoo2: well that's the corrolary, if i can figure out what something does, but not WHY i'd actually need it, then i don't.

22:05 dnolen: breaking change coming to core.logic unification - I think not too many people are hooking into the details and it should only require some minor restructuring.

22:06 http://github.com/clojure/core.logic/commit/bbc4e820128d5a0745ce3d79cd3bbd9401a1bf55

22:09 loliveira: clojure_csv or clojure/data.csv?

22:09 bbloom: dnolen: looks nice. i didn't dig in that deep to core.logic yet, but the boatload of protocols was setting off some spider senses

22:11 dnolen: bbloom: it did provide some flexibility - but it's becoming a hassle, especially now that we're starting to understand how unification might just become a normal constraint.

22:11 it was becoming a hassle I mean.

22:11 bbloom: dnolen: one other thing that sets off my spider sense: negations in identifiers. like NON in non-storable. what about a word like "ephemeral"?

22:13 dnolen: who is "we"? just you? you and other core.logic contributors? the logic programming community?

22:13 dnolen: bbloom: "ephemeral" has a different connotation to me.

22:14 bbloom: myself and Will & Nada really.

22:14 Guest24989: How do I use a variable with repeat?

22:14 bbloom: dnolen: cool. like i said, i'm a totally ignorant, but curious observer: could you elaborate on how unification collapses into a normal constraint?

22:15 Guest24989: (map mod (repeat 9) [3 5])

22:15 How can I turn that into (repeat x)?

22:15 dnolen: bbloom: part of the realization is arising from how context sensitive unification really is.

22:15 bbloom: i figure if i learn logic programming a step behind you, i can get 30% of the knowledge transfer for 3% of the effort :-)

22:16 dnolen: bbloom: unification as is done in Prolog is pretty straightforward. Recursive decent add the logic var bindings to the substitution map.

22:16 bbloom: dnolen: lexical context?

22:16 dnolen: bbloom: (== [1 x] [y 2])

22:17 brainproxy: gah... tried again setting up lein-ritz / ritz-swank so I can move past deprecated lein-swank ... last try was a few months ago

22:17 still no joy, just doesn't work

22:17 bbloom: yeah, the prolog world makes sense to me. it's where all the various different constraitn satisfaction fancy things start coming to some interesting more fundamental law of the universe

22:17 dnolen: bbloom: y has to be 1, x has to be 2. This is easily done via recursion.

22:17 brainproxy: followed instructions in the repo to the letter

22:17 bbloom: that's what i find interesting, so your realizations are interesting

22:18 dnolen: bbloom: but that doesn't work for forms unification that are Prolog, nominal unification actually requires adding side conditions which much be checked later when we have more information.

22:18 bbloom: but that's just like constraint solving over finite domains.

22:19 bbloom: i started to read the nominal unification paper, but wasn't in the right mind set to handle it... let me see if i understand this:

22:19 dnolen: "forms of unification that aren't Prolog like" is what I meant

22:19 bbloom: basically, finite domain solving involves iteratively reducing the domain of vars

22:19 rather than backtracking

22:19 Guest24989: How do I use repeat with a value?

22:20 bbloom: ie process of elimination vs trial and error

22:20 dnolen: bbloom: yes, but you can think of the domain as kind of side condition. (infd x (domain 1 2 3))

22:20 we don't know what x is really

22:20 bbloom: what's an example of a side condition?

22:20 dnolen: bbloom: that it's something as long it's 1 2 or 3 :)

22:21 bbloom: ah, heh

22:21 but what about in the (== [1 y] [x 2]) situtation?

22:21 dnolen: bbloom: to give a different kind of example, in nominal logic programming you can say thing like, this name is shall not appear free in some term.

22:21 bbloom: or rather something with multiple solutions

22:21 dnolen: (# x y)

22:22 so x can never appear free in y, where y is some lambda calculus term

22:22 but imagine we unify y with (lam y z), where z itself is a logic var

22:22 well we need to make sure (# x z) then

22:23 bbloom: dnolen: i'm not quite getting it and i'm gonna have to run. i'll just force myself to give the nominal logic programming paper another try

22:23 dnolen: so you can unification here needs to push these side conditions (constraints) along

22:23 bbloom: more than happy to explain more later

22:23 bbloom: dnolen: thanks. cheers

22:38 seangrove: Is there a cross clj/cljs way to parse an int from a string?

22:38 cljs has (js/parseInt %) obviously

22:39 muhoo2: is :repl-options {:init (foo)} only supposed to work in the :user profile in profiles.clj, or is it supposed to work inside a :repl profile too?

22:46 dnolen: seangrove: there isn't a way that works in both places.

22:46 seangrove: I'm starting to become more and more partial to feature expressions...

22:47 Although I don't quite like them, even so

22:54 muhoo2: seangrove: i saw this thing lynaghk created called cljx

22:54 it supposedly unifies some stuff like that, so you get the same code for both platforms.

23:09 pipeline: callen: well, you could always port clojure to jnode

Logging service provided by n01se.net