#clojure logs

2012-12-23

00:00abpHaving a blast watching http://skillsmatter.com/podcast/home/the-refined-clojurist and coding along in light table instarepl. :)
00:00wingyabp: yeah filter is pretty good
00:00TimMcHmm, there's no filter-kv?
00:01TimMcabp: I can't stand the lack of paredit. :-/
00:01abpTimMc, there are a lot of -k and -kv, probably -v function variants missing. ;)
00:01tomojfilter-kv: https://www.refheap.com/paste/3bdd717b8d399a657230d0ab4
00:03tomojI think filter should be filter-v
00:03abpTimMc, if I've already learned emacs I would probably miss it, too. But since I'm just coding along it's not that bad.
00:03tomojI mean, it should stay named 'filter but it should mean filter-v. then we should add filter-k and filter-kv
00:03TimMctomoj: There is one.
00:04TimMctomoj: And it should automagically detect map seqs? :-/
00:04abptomoj, wouldn't make any sense anytime to filter to get the kv tuples in a map?
00:04tomojer, no, I'm thinking of only reducers
00:05abpHm has anyone run some cljs via Nashorn by now?
00:05tomojthat clojure.core/map and clojure.core/filter on maps run f on each kv pair seems unfortunate
00:06abptomoj, probably, but everything else would be strange.
00:07tomojyeah, what seems unfortunate is really the burden of compatibility for clojure.core.reducers/map, if there is one
00:08abptomoj, why? I'm not very familiar with reducers.
00:10tomojI 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
00:12abptomoj, more like inconsistent but fixable, not?
00:12abp,(seq {:x 1 :y 2})
00:12clojurebot([:y 2] [:x 1])
00:12abpIs the reason for it and -kv-fns in the first place. So moar.
00:13tomojwhat's inconsistent but fixable?
00:15abpNot having all functions with -kv suffix?
00:15tomojthat's fixable, but what about r/map?
00:16abpIsn't r/map-kv possible as well?
00:17tomojsure, but, what, also add r/map-v ? and then r/map is just an r/map-v that doesn't work for reduce-kv?
00:19abptomoj, no r/map is r/map, r/map-v is mapping like r/map second from tuples
00:19abp*but with second
00:20abptomoj, probably short naming k, v, kv at that point gets ugly. Or at least a litte confusing. ;)
00:22tomojso r/map-v would return something that can only be reduce-kv'd, but not reduce'd?
00:22z3phyrhow to choose a platform for clojure?
00:23tomojor maybe it would return something that reduces over kv pairs :(
00:26z3phyrjvm is recommended now, but what about alternate platforms like python?
00:28tomojhmm.. 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
00:29tomojif 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
00:30tomojbut (r/map-v inc [1 2 3]) looks suspiciously like r/map when applied to vectors
00:34abptomoj, 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})))
00:36tomojno, because vals returns a seq, and because an IKVReduce in general might not support vals anyway
00:37tomoje.g. the return value of map-kv probably won't support vals
00:37tomojplus, you may want the keys later
00:39tomoje.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}
00:40Raynes&(tomoj 1 2 3)
00:40lazybotjava.lang.RuntimeException: Unable to resolve symbol: tomoj in this context
00:40Raynestomoj: You don't exist.
00:40abplol
00:41abpRaynes, pointed your laser a little to long at him? :P
00:41RaynesI may have.
01:04z3phyrWhy does Rich state's that Clojure is only designed for the jvm?
01:06abpz3phyr, 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.
01:07z3phyrClojure Py is the one I like, though it is not mentioned in the website.
01:08abpz3phyr, which website? Clojures?
01:08z3phyrabp, yeah
01:09abpz3phyr, well thats probably because it's not very mature. But I don't know for sure.
01:11z3phyrIs there a clojure implimentation which does not require a JVM, and uses lien too?
01:12z3phyroh, does lieningen requires a jvm?
01:12abpz3phyr, yes.
01:17z3phyrthere's java, but there seems to be no primary implimentation of clojure.
01:18z3phyrI have an idea.
01:19pppppppppaulTell me
01:19z3phyrWhy 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?
01:20z3phyrthat would 1) give an identity to clojure, what beam gives to erlang.
01:21pppppppppaulSexy
01:21bbloomz3phyr: what would be the advantage of having it's own runtime?
01:21z3phyr2) the new vm will be what lieningen is to maven
01:21bbloomz3phyr: there is a "primary" implementation of clojure: it's the JVM one
01:21z3phyrno.
01:21z3phyreven if it is
01:22bbloomthere would be little benefit to maintaining our own vm
01:22bbloomand some high maintenance costs
01:22bbloomthere are lots of high quality VMs out there and there isn't a really good justification for them to each be language specific
01:23z3phyrThat VM is actually a jvm, with Clojure as the main language. Java could use clojure librarys.
01:24imeredithbut why...
01:24bbloomjava *can* use clojure libraries....
01:24imeredithwhy not the jvm as it currently stands
01:24z3phyryeah it can. but its still jvm and not cljvm
01:24imeredithmv jvm cljvm
01:24imeredithfixed
01:26imeredithz3phyr: what benefits would having a "cljvm" bring?
01:26z3phyr it can help in giving out a single install WITH the vm and the Build tools
01:26imeredithcant you do that with openjdk anyway?
01:26imeredithif you wanted
01:26tomojI 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!"
01:27z3phyrjava is cross platform that, it runs on dalvik as well as openJDK
01:27imeredithon linux generally installing a jvm is trivial. I seem to magically have one on mac somehow
01:28z3phyrboth are different but both are the same.
01:28z3phyrAnd forking dosen't cost much
01:29imeredithfeel free to do it
01:29z3phyrThe clojureVm will also have some java compatible but clojure specefic tweaks
01:29technomancyz3phyr: forking openjdk means oracle will sue your pants off
01:29technomancythe patent protection they offer for openjdk doesn't apply to forks
01:29imeredithtechnomancy: what license is openjdk under?
01:30technomancyimeredith: GPL2+classpath exception
01:30imeredithah
01:30technomancyif it were v3 we would be safe
01:30technomancybut v3 didn't exist at the time
01:30technomancyit's not a good idea to begin with, but it saves time to point out that it's impossible =)
01:31imeredithtechnomancy: there is nothing stopping you from bundling openjdk with stuff though right? (unlike oracle jdk)
01:32technomancyimeredith: right, as long as you haven't changed it
01:32bbloomthus defeating any purpose, should you figure out some purpose
01:32imeredithinstalling jvm seems like a non issue to me
01:32imerediththe only platform which it *might* make sense for is windows
01:32imeredithafaik
01:32imereditherr
01:32imeredithas far as i can see
01:33technomancyi was more annoying a few years ago when openjdk lagged behind the Sun one
01:33technomancyit
01:33imeredithwell, a few years ago you could install sun jdk from apt
01:34technomancysort of
01:34technomancyyou had to add non-free repos and manually click through a license agreement
01:34imeredithsure, it was still farily trivial though
01:35technomancyalso the sun version didn't ship with a proper crypto implementation
01:35imeredithoh? didnt know that
01:36technomancythey were still complying with ridiculous 90s export laws as of jdk6
01:36imeredithoh right
01:36z3phyrCan they still sue someone if that person will not use it as a java vm?
01:37technomancyz3phyr: sure
01:37z3phyrhmmm
01:37technomancyit would be a patent lawsuit, not a trademark one
01:39z3phyrCan clojure devs make changes in the VM so that it can run clojure in "better way"?
01:39technomancythe JVM already has features that would make clojure run better that clojure isn't even using
01:39bbloomz3phyr: there is far more low hanging fruit in compilation strategy and optimization than we'll have in the foreseable future for vm optimizations
01:39technomancylike invokedynamic
01:40bbloomz3phyr: if you feel pasionately about this, you should study how you can help with clojurescript
01:40bbloomz3phyr: any help getting the cljs compiler to be self hosting and less dependent on the jvm is welcome
01:40ibdknoxwhat's this about invokedynamic in cljs?
01:40RaynesinvoveIbdknox
01:40technomancyibdknox: http://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine)
01:41technomancyjust released yesterday
01:41z3phyrSo will the JVM remain the primary platform for Clojure in the future?
01:41bbloomibdknox: nothing, go back to work. don't you have investors to please? :-)
01:41ibdknoxlol
01:41bbloomz3phyr: for the foreseable future, yes
01:41technomancydesigned around InDy from the ground up
01:41ibdknoxinteresting
01:41bbloomz3phyr: however, clojure-in-clojure compiling to jvm is a reasonable next step
01:41bbloomz3phyr: clojure is about pragmatism. let's tackle one step at a time, rather than shooting for the moon all at once
01:42z3phyryeah :)
01:42bbloomcljs provides that opportunity
01:42z3phyrIt seems cljs requires a jvm too?
01:43bbloomz3phyr: currently
01:43ibdknoxnot for long, I hope! :D
01:43bbloomz3phyr: there are some forks that don't
01:43bbloomz3phyr: of varying levels of quality
01:43bbloomz3phyr: 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
01:44Raynesibdknox: Where's my light table plugin system?
01:44z3phyrbbloom: I will.
01:44RaynesHow dare you give me free software without the features I desire.
01:44bbloomibdknox: how dare you not give me free software! i didn't contribute to the kickstarter program...
01:48ibdknoxlol
01:48ibdknoxbbloom: you know it's all publicly available right now, right? :p
01:48ibdknoxRaynes: I have a very basic one implemented
01:48bbloomibdknox: heh, yeah i know. i just like to jump on Raynes' joke trains
01:48technomancyit's on github?
01:49Raynestechnomancy: No
01:49technomancyoh
01:49Raynestechnomancy: If ibdknox put it on Github, he'd have huge problems.
01:49ibdknoxonce it goes public beta, I'll go down that (scary) route :)
01:49Raynestechnomancy: 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.
01:49technomancyRaynes: because letting people contribute goes against the clojure way?
01:49RaynesHe could decline the pull requests, but he'd piss people off.
01:49ibdknoxin terms of plugins, I need to talk to David about adding another compiler option that lets you exclude certain deps via regex or something
01:50ibdknoxactually
01:50RaynesAnd he'd likely end up with forks that are the antithesis of what he light table is supposed to be.
01:50ibdknoxthe main problem is time
01:51RaynesI think you might think that would be your main problem, but I think the real problem would be what I just said.
01:51RaynesI'd keep it closed source until you've got your fundamental ideas fleshed out.
01:51ibdknoxI think it has to be a little bit
01:51RaynesYou want something that people will try to build *on*, not something people will try to *build*.
01:52ibdknoxthat is certainly true :)
01:52Raynestechnomancy: So, remember how excited I was that I got that clojure.test issue+patch vetted?
01:52Raynestechnomancy: Apparently that doesn't mean anything. Vetted just means Rich thinks the issue is okay. Nobody has looked at the code.
01:53technomancywoooo
01:53technomancyyou cracked the code
01:53RaynesSo apparently you have to have permission to even report an issue?
01:53RaynesI think I at least understand the process.
01:53technomancyhere I was thinking that it was related to veterinarians
01:53RaynesThe purpose for parts of it I do not understand.
01:54technomancyyour patch is up on all its rabies shots
01:54ibdknoxthe plugin system will go a long way
01:55ibdknoxyou can completely redefine LT in plugins, so it's more or less a way to contribute lol
01:55Raynesibdknox: You should include my refheap plugin by default.
01:55ibdknoxhaha
01:57bbloomi feel like java leaks into the clojure open source process, far more than it leaks into the clojure language
01:58technomancybbloom: heh; the perils of jira.
01:58Raynesibdknox: 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.
01:58technomancyviolence is not the answer raynes
01:59bbloomRaynes: is your api compatible with the gist api?
02:00bbloomie he can just say (def refheap-plugin (assoc gist-plugin :endpoint "https://api.refheap.com"))
02:00RaynesGod no
02:00RaynesI hate the gist API.
02:00bbloomibdknox: i've got your back here, i'll negotiate for you
02:00bbloom:-P
02:00RaynesIt's part of the reason I made refheap.
02:01ibdknoxlol
02:01RaynesThe multiple-file support makes it all super craptastic.
02:01RaynesProtip: a multi-file gist = a github repository.
02:01ibdknoxI wouldn't include a gist plugin by default anyways
02:01ibdknoxI'm sure there *will* be one though
02:01RaynesIf you're going the route of "Let's include nothing." you need to make it super easy to discover and install those plugins.
02:02RaynesStuff like gist and refheap plugins are pretty necessary for some people.
02:02RaynesLike me.
02:02ppppppppaulMulti file gists are great
02:02ibdknoxRaynes: absolutely, that's going to be a big thing
02:02Raynesppppppppaul: The concept is great, I don't care for the implementation.
02:02Raynesppppppppaul: I'll be implementing something similar in refheap. It'll be better.
02:03ppppppppaulGot any stats on refheap?
02:04RaynesStats?
02:04ibdknoxI kinda want there to be something less this bl.ocks.org but for LT: http://bl.ocks.org/mbostock
02:04Raynesppppppppaul: Like language usage stats, number of users, etc?
02:05Raynesppppppppaul: All the info is in the db, I just haven't written an interface for it.
02:07tomojshoot, (:require [foo :as f]) (:require-macros [foo :as f]) is an error now?
02:08ppppppppaulHow much space does your 8000 posts take up?
02:08RaynesI'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
02:08Raynesde that paste just like how it works in git.
02:08RaynesGood question. I haven't checked in a while.
02:09tomojdnolen: did you intend to break that? or just (:require [foo :as f] [bar :as f]) ?
02:10Raynesppppppppaul: Looks like tha tpart of my database uses a total of 77.74MB.
02:10Raynesppppppppaul: 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.
02:10RaynesIt's a space tradeoff for speed.
02:12Raynesppppppppaul: I have 496MB of storage.
02:12RaynesFor free, anyways.
02:13RaynesWhen I hit that I'll probably move my DB to my VPS.
02:13RaynesI pay $20 a month on Heroku just for the SSL stuff because technomancy won't give it to me for free.
02:16SgeoSomeone should port Racket's for/fold to Clojure
02:16SgeoShould be fairly simple
02:22tomojwhat's the deal with jira thinking it's 2020?
02:22Rich_MorinI'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?
02:25ibdknoxRich_Morin: you should try light table :)
02:26Rich_Morinibdknox: I plan to, but right now I'm interested in checking out Clooj.
02:28Scriptorhow big is the download for clooj?
02:28Rich_Morin8 MB
02:28Scriptordamn
02:29ScriptorRich_Morin: have you tried ctrl+enter at the end of the form?
02:30Rich_Morinctrl+enter does nothing. cmd+enter acts the same as using the menu item
02:31Rich_MorinI'm on a Mac, which prolly explains the difference.
03:02tomojhmm.. do we need proxy to get stacktraces on ex-info in cljs?
03:05alex_baranoskysgeo: what's the for/fold?
03:05Sgeoalex_baranosky, just some syntactic sugar around reduce
03:05tomojproxy wouldn't even work
03:05alex_baranoskysgeo: link?
03:06Sgeohttp://docs.racket-lang.org/guide/for.html?q=for/fold#(part._for/fold)
03:09Rich_MorinApparently Clooj is broken for Clojure 1.4 - https://github.com/arthuredelstein/clooj/issues/100
03:10Rich_Morinibdknox: 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).
03:13ibdknoxRich_Morin: it's 10.7+ only right now
03:13Rich_Morinowell
05:01bawrDo 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.
05:05hyPiRionbawr: No, little knowledge with Java is needed. There are many libs/wrappers for working with about anything
05:07bawrIs it a good idea to try Clojure-clr, or is that lagging behind / not used much, and would just confuse me eventually?
05:08bawrSince if the language works the same, I'd gladly use it over F# for some of my .NET stuff.
05:22borkdudebawr I would like to know that also
05:41augustlis there a "lein test" command to run just one single deftest?
05:43callenaugustl: lein test -h
05:47augustlso the only way is to edit my test to include some metadata that leiningen can pick up?
05:47augustlI can't run a single deftest by name?
05:47augustlalso got to update project.clj for the metadata method it seems
05:48augustlcurrently doing some big refactoring and finding myself using comments in the test cases
05:50Bergle_1clojure 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.
05:57bawrwhaa, there's clojre-py?
05:57bawrJoy.
05:58Bergle_1heh :)
06:49asina12I can't use user/clojuredocs whenever I start nrepl from a project
06:49asina12I get the following error:
06:50asina12CompilerException java.lang.RuntimeException: No such var: user/clojuredocs, compiling:(NO_SOURCE_PATH:1)
06:50asina12please help
06:51ivanasina12: try cdoc
06:52asina12ivan: do you mean (cdoc lazy-seq)?
06:52asina12because that did not work too
06:52ivanyes
06:53ivanhow are you starting nrepl?
06:53asina12nrepl-jack-in
06:58asina12starting it using run-lisp works though...
10:40yedireducers are somewhat difficult to wrap my head around
10:49hyPiRionIt's very abstract
10:49hyPiRionTry to use it with an actual problem, then it gets better
11:05yedii can get most of the individual parts of hickey's article, but I'm having trouble seeing the big picture
11:06yedilike why does using reducers help with performance
11:06frozenlo`I watched the video yesterday. After 15 min my brain was fried.
11:06Bronsalol
11:06yediis it because it's not doing a loop after map/filter/reduce, but instead merging all those iterations into one
11:07llasramyedi: Essentially. Instead of each function in a chain of sequence operations independently iterating over intermediate sequences produced by each previous operation
11:08llasramyedi: A chain of reducers generates a single function which represents the composition of all the chained operations
11:08llasramSo you just walk the source data structure once and apply the function in each iteration to generate the reduction
11:09llasramThis not only avoids the overhead of creating the intermediate conses
11:09yediand then hooking it up with fold allows you to parallelize it
11:10yedibecause fold uses fork/join
11:10llasrambut 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:10llasramyedi: Exactly
11:10llasramWell, mostly exactly. The fold implementation for vector uses fork/join :-)
11:11llasramThe `fold` operation is just a protocol which presents an interface which *is* parallelizable
11:12yedibecause of the associativity
11:14yediwhat did he mean when he talked about 'getting rid of the null/empty values'
11:20llasramHad to dig up the blog post to see what you meant :-)
11:20llasramHe's talking about other approaches to defining how to perform sequence-like operations in parallel
11:20llasramOne approach would be to have every parallel step return a concrete sequence representing its part of the computation
11:21llasramBut if you're e.g. filtering, you can get a lot of empty lists, which still need to be returnend and concatenated together
11:21llasramThe function composition model used by the reducers library avoids that
11:27ravsterhello all
11:27ravsterwill using the ring.utils.response wrapper interfere with the ring.wrap-sessions wrapper?
11:32ppppaulhey guys
11:32ppppauli'm having trouble with with-redefs
11:33ppppauli'm using a ring mock lib, and it seems to not be using my redefs, anyone have similar problems?
11:33ppppaulhttps://gist.github.com/4364133
11:33ppppauli'm using peridot
12:04amalloyllasram: i'm not convinced that reducers will enable combining operations on unboxed primitives anytime soon
12:06xeqippppaul: 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:06llasramamalloy: Hmm, good point. Right now the hint metadata is lost by the time the function composition is occurring
12:06xeqippppaul: does it work if you move the with-redefs inside the deftest?
12:08amalloyllasram: 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:08xeqialso think you might need it to add ":request :body" to the end of the ->
12:09amalloythe 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:09amalloyreducer transformers (eg, r/map) present a similar problem
12:11llasramamalloy: 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:13llasramAlthough -- if the functions involved all implement the right primitive interfaces, the info is available
12:13xeqierr, ":response :body"
12:13llasramIt's just not convenient or automatic (or done by the current implementation)
12:14squidzso can we use fold already?
12:24ppppaulxeqi, i moved the with-redefs around into a few different places, nothing works
12:24ppppauleven when i put it outside of the test and have it assign to a (def) it doesn't work
12:25ppppaulxeqi, 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:26ppppauli would really like to better understand why my redef isn't working and how i would use it correctly
12:29xeqippppaul: does your login route call (api.routes.login/couch-auth-proxy) ?
13:10Rich_Morinyedi: yt?
13:50ppppaulxeqi, no, that was just for testing... login route calls couch/authenticator
14:38ppppaulxeqi, except for me having a lot of trouble mocking out fns with your lib, it is great! :D makes functional testing very easy
14:39xeqippppaul: glad to hear it
14:40xeqiwish I had more advice for the with-redefs
14:53borkdudedoes ccw support :java-source-paths in a project.clj?
15:09borkdudeapparently it does
15:21ziltiDoes nesting (str) give lazy sequences, is that possible? That's my code: https://gist.github.com/4365734
15:21ziltiI'm trying to build an SQL statement and it gives me errors because the put-together string contains "clojure.lang.LazySeq@cee40fd8"
15:22amalloy&(str (for [x (range)] x))
15:22amalloyhm, bad example
15:22lazybotExecution Timed Out!
15:22amalloy&(str (for [x (range 10000)] x))
15:22lazybotExecution Timed Out!
15:22amalloy&(str (lazy-seq))
15:22lazybot⇒ "clojure.lang.LazySeq@1"
15:23zilti&(str "Begin " (for [x (range 100)] (str x)))
15:23lazybot⇒ "Begin clojure.lang.LazySeq@aadb0c53"
15:23ziltiThat's exactly my problem
15:23amalloyyou want to call str with 100 arguments, but you're not
15:23ziltiNo, I don't want
15:23ziltiOh wait, somehow I do want, yes, but... I can't write:
15:24hyPiRion,(str "begin " (seq (for [x (range 100)] (str x)))) ;?
15:24clojurebot"begin (\"0\" \"1\" \"2\" \"3\" \"4\" ...)"
15:24zilti&(str (for [x (range 100) y (range 100)] x y))
15:24lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: core$for
15:24zilti&(str (for [x (range 100) y (range 100)] (str x y))
15:24lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
15:24hyPiRionheh.
15:24zilti&(str (for [x (range 100) y (range 100)] (str x y)))
15:24lazybotExecution Timed Out!
15:25ziltiYou see my problem?
15:25zilti&(str (for [x (range 10) y (range 10)] (str x y)))
15:25lazybot⇒ "clojure.lang.LazySeq@86672e53"
15:25amalloywell i don't know why lazybot is timing out
15:25amalloy,(hash (range 10000))
15:25clojurebot1722319241
15:26amalloy&(hash (range 10000))
15:26lazybot⇒ 1722319241
15:26amalloy,(str (range 10000))
15:26clojurebot"clojure.lang.LazySeq@66a88189"
15:26amalloy&(str (range 10000))
15:26lazybot⇒ "clojure.lang.LazySeq@66a88189"
15:26hyPiRionamalloy: It's the `for`. Clojail does some black magic nobody understands.
15:26zilti&(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:26lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: core$for
15:26amalloyugh. that didn't used to be a problem, hyPiRion. someone send Raynes a stocking full of coal
15:27llasram&(str "begin(" (clojure.string/join "," (for [x (range 10)] (str x))) ");")
15:27lazybot⇒ "begin(0,1,2,3,4,5,6,7,8,9);"
15:27hyPiRionamalloy: 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:28amalloyhyPiRion: 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:28amalloy&(macroexpand-1 '(for [x (range)] x))
15:29lazybot⇒ (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:30ziltiHmm so is this a bug in str, or did I miss the point of how it's working?
15:30llasramzilti: It's not a bug
15:30amalloyif there were a bug in str, you wouldn't be the first to find it :P
15:30llasramzilti: ##(str "begin(" (clojure.string/join "," (for [x (range 10), :when (even? x)] (str "'" x "'"))) ");")
15:30lazybot⇒ "begin('0','2','4','6','8');"
15:31ziltiHm and clojure.string/join only takes two arguments...
15:31llasramzilti: 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:31llasramzilti: Right. It takes the character to join with and the collection of elements to join
15:36llasrams,character,string,
15:36ziltiOk. Thanks! That makes the whole string manipulation thing a lot more difficult, though...
15:36llasramzilti: How so?
15:37ziltillasram: Because one has to do additional stuff just to conjoin some strings together
15:38amalloyno 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:38amalloyyou can't just drop a collection of strings anywhere a string is expected - it would be crazy if that worked
15:38ziltiSomething wrapped in str is supposed to be a string
15:38llasram(inc amalloy)
15:38lazybot⇒ 37
15:39amalloyzilti: no counterexample of your statement exists
15:39amalloyie, everything wrapped in str is a string
15:39ziltiSo why does it still give me a lazyseq?
15:39amalloyit doesn't
15:39amalloy&(str (range 10))
15:39lazybot⇒ "clojure.lang.LazySeq@9ebadac6"
15:39llasramIf 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:39amalloythat's a string
15:39ziltihttps://gist.github.com/4365734 <- it kinda does
15:39amalloyfirst character is \c, next is \l, ...
15:41AimHerellasram > wouldn't it be as simple as (str (seq (flatten ...))) ?
15:42llasramAimHere: Was just checking how `flatten` treated strings :-)
15:42amalloyAimHere: calling str on sequences is never* a good idea. (*) almost never
15:42AimHereWell the seq there is just to unlazify the results of flatten
15:43amalloythat only makes a difference by coincidence
15:45amalloythe 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:45amalloybut 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:45lazybot⇒ "(a \"a\")"
15:45amalloywell shoot, when did those start printing differently?
15:46AimHere,(str 'a "a")
15:46clojurebot"aa"
15:46llasramzilti: this is probably bad, but if you really wanted to: ##(let [rstr #(apply str (flatten %&))] (rstr "begin(" (for [x (range 10)] (str x ",")) ");"))
15:46lazybot⇒ "begin(0,1,2,3,4,5,6,7,8,9,);"
15:47amalloyAimHere: sure, obviously. but it used to be the case that ['a "a"] printed as "[a a]"
15:47AimHereIf you want your clojure objects recoverable from the output from the stringification, then you use whatever the appropriate print function uses
15:47amalloywhich is why using pr-str was recommended
15:47AimHereSometimes you just want to print an 'a', and don't care if it's a string, a char, or a symbol
15:49hyPiRionhuh
15:49bawrAimHere: if you don't care, you're doing it wrong.
15:49hyPiRion,(str 'a '"a")
15:49clojurebot"aa"
15:49ziltillasram: That's not bad, that's perfect, thanks.
15:49zilti,(inc llasram)
15:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: llasram in this context, compiling:(NO_SOURCE_PATH:0)>
15:50zilti(inc llasram)
15:50lazybot⇒ 5
15:50AimHereI thought the point of a dynamic language was that I didn't have to care about types ;)
15:51llasramzilti: I meant "bad" in that it's potentially obfuscatory. And uses `flatten` to boot
15:51llasram~flatten
15:51clojurebotflatten 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:52bawrAimHere: Yeah, I prefer to use the right type for the job.
15:52ziltillasram: But for putting together a string where parts of it are built differently it's perfect.
15:53hyPiRionThe right function to use here is obviously...
15:53hyPiRion~amalloy
15:53clojurebotamalloy is <amalloy> just use juxt, it'll be great
15:54amalloyhah. you know, not *all* of the snippets clojurebot has on me are about juxt
15:54amalloyexcept i guess that's not true, because the others got removed? lame
15:55hyPiRionhm
15:57Raynesamalloy: Okay?
15:57Raynesamalloy: I mean, I'm not sure what else to do, man.
15:58RaynesI completely rewrote the tester stuff for the sole purpose of making it fast for the cases that we had.
15:58RaynesI don't know how to make it faster.
16:04RaynesAnd this is not the channel we were talking about that in.
17:18callenthis is the hardest rain I've seen in the bay area since I moved here.
17:20Raynescallen: You should visit Alabama. We're looking at a mean tornado outbreak on Christmas.
17:21Rich_MorinI prefer to live where the weather isn't trying to kill me...
17:22callenRaynes: I'm from Ohio, awful weather is the norm there. I've only been to 'Bama during the summer.
17:22Rich_MorinThe usual Bay Are response is "we need the water", followed by "of course, it's the snow pack that counts".
17:22callenRich_Morin: snow pack?
17:22amalloyit's not, say, freezing cold outside, Rich_Morin? that sounds like attempted murder too
17:22Rich_MorinWhere do you think SF gets its water?
17:23callenRich_Morin: I assumed the yuppies were stealing it from poor people in South America.
17:23Rich_Morinhttp://en.wikipedia.org/wiki/Hetch_Hetchy_Reservoir
17:24Rich_Morinhttp://en.wikipedia.org/wiki/Hetch_Hetchy_Aqueduct
17:28Rich_Morincallen: Between storms, Sonoma County is really gorgeous this time of year. Everything turns GREEN for a few months.
17:29abpWow I'm approaching common sense in slaying 4clojure problems short with core fns.
17:29callenRich_Morin: I'll have to ride the motorcycle up there next week.
17:30Rich_MorinIt's more pleasant during the week (aside from rush hour) - less tourists :-)
17:36Rich_Morincallen: 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:36Rich_MorinHave lunch at one of the coastal restaurants and enjoy the view...
17:36abpJust 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:37abphey gfredericks, I'm solving 4clojure and your 4core.logic interleaved. Great fun. :)
17:37gfredericksabp: oh nice :)
17:38amalloyabp: surely we were saving solutions a year ago
17:38abpamalloy, yeah more like one and a half. Embarassing how long I took to grok fp. :P
17:39abpAnd get around to know core fns
17:42abpgfredericks, how shall I call em? Stop making fun of me. :P
17:43gfredericksabp: oh that's fine verbage. I was making fun of myself, not you.
17:44abpgfredericks, ok, thought because you know a thing or two, you know.
17:44gfredericksyeah sometimes ain't do communicate to good
17:44mehworkC-M-q in emacs says "undefined". How can i make it so it auto formats my clojure code?
17:45abpme too, but I'm no native english speaker.. writer.. err ;)
17:45bawrabp: communicator? ;)
17:45abpwell
17:45abpyes
17:45gfredericksabp: you have all my sympathy
17:46abpgfredericks, those are the worst.
17:46mehworkI was born in America. So I guess I'm not really a native english speaker either
17:46gfredericksabp: sympathies?
17:47bawrI adopted myself as a citizen of the English-speaking world. So I'm, uh, retroactively native? ;)
17:47technomancyalex_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:47abpgfredericks, no, I was relating to phrases.
17:47amalloyfwiw abp, you made me curious so i did a little digging: we added that feature in may 2011
17:48Raynesamalloy: What feature?
17:48abpamalloy, ok, I think I did some in march and april
17:48amalloyRaynes: saving users' solutions on 4clojure
17:48bawrany recommended way of learning Clojure well? or do I just read the standard docs and the code behind Clojure itself?
17:49gfredericksbawr: hay libros
17:49alex_baranoskytechnomancy: 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:49amalloybawr: don't try to mimic clojure.core. read code, write code
17:49bawrgfredericks: wha?
17:49technomancyalex_baranosky: heh; yeah if you contort your code to fit its requirements =)
17:49alex_baranoskytechnomancy: I seem to be seeing failures also occur when there are multiple possible namespaces that have the same ending
17:50technomancyalex_baranosky: yeah, the current logic is easily confused
17:51technomancyit needs to accumulate more data about past failures to be able to make the correct decisions down the line, particularly about aliased vars
17:51alex_baranoskytechnomancy: we'll see what we can do, but at minimum, the require/refer change appears to work
17:51technomancycool. that should be pretty straightforward.
17:51gfredericksbawr: there are books
17:52alex_baranoskyif 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:52alex_baranoskytechnomancy: yep, tests pass creating require/refer instead of use/only
17:53technomancynothing 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:53technomancymaybe just focus on getting it working first before you get fancy =)
17:54alex_baranoskytechnomancy: sounds good, I'll keep you posted
17:54technomancygreat
17:54technomancywould be really happy to see this working again =)
18:00abpbawr, 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:00abpAnd I'm out.
18:07amalloyokay, google impresses me. accidentally searched for "jpirs": they realized my right hand was misplaced, and showed me the results for "hours" instead
18:08technomancydoesn't work =(
18:08gfredericksbut now I know about Toul
18:11muhootrying to figure out how to paste into refheap from an android browser on a tablet. neither ffx nor chrome seem to like it
18:12muhoomaybe refheap is eating the long-presses that usually pop up a "paste" menu
18:16muhoothough, lein works on debian chroot on an android asus transformer tablet
18:16technomancymuhoo: sweet =)
18:16technomancyhow long does `lein version` take?
18:20IceD^wondering here how lein makes suggestions to commands. e.g. try `lein server`
18:21technomancyIceD^: you can see the suggestion algorithm in leiningen.core.main
18:21IceD^yeah, I'm there already :)
18:22muhootechnomancy: like 20 seconds with 2 cores at 75% cpu :-)
18:23muhooactually 7 seconds according to time
18:23muhoousing the oracle embedded jvm for armel
18:23technomancythat's not so bad
18:28muhoonot at all, considering it's basically a phone
18:28muhoowith a big screen
18:30muhoowow, this is like an El Nino rain.
18:33hyPiRionIt's just levenshtein with an edit distance of 3-4 or less, isn't it?
18:39mehworkis there a linux cli tool that can auto reformat clojure to be in a decent lisp indentation style?
18:39muhoomehwork: emacs :-)
18:39mehworkaside from emacs
18:40mehworkit'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:41muhoooh, then you might want to try lighttable
18:41muhoonot a cli tool though.
18:41dottedmagmehwork: el-get helps a lot
18:41dottedmagThat is, M-x el-get-install foo, M-x foo-mode
18:42callenmehwork: they're not going to stop telling you to use Emacs.
18:43bawr>Simple Made Easy
18:43bawr>Emacs
18:43callentakes 2 seconds to run lein version on a Macbook Air
18:43bawrI still have no idea how the former connects with the latter.
18:44callenbawr: 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:44dottedmagWell, it doesn't.
18:44mehworkcallen: lein version?
18:44callenbawr: it's only things like LightTable that really bring anything new to the table.
18:44callenmehwork: da
18:44gfredericks\forall_{x,y} emacs complects(x,y)
18:44bawrgfredericks: xD
18:44callenGET IT? NEW! TO THE TABLE! HAAAAAAAAAAAAAAAAAAAAAAAAAAA
18:45bawrI just refuse to believe that Emacs is the best we can do for Lisp-editors.
18:45bawrBecause that would be pretty sad.
18:46mehworki don't think anyoe else has put in one millionth as much time into another lisp editor though
18:46mehworkso i'm sure it is the best there is right now
18:46gfredericksthings 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:47callenbawr: Zmacs was pretty great. LightTable has promise.
18:47callenyou could evaluate code in Emacs to change the state of the enclosing operating system. Sigh Symbolics Genera.
18:47xeqiwaiting for my direct neural interface
18:48callenxeqi: you'll keep waiting then :)
18:48ziltiI 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:48bawrcallen: Ahh, Lisp Machines.
18:49callenRaynes: 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:49mehworklighttable looks cool
18:49callenzilti: pretty sure he makes it using node-webkit.
18:49clojurebotIt's greek to me.
18:49callenclojurebot: you weren't asked.
18:49clojurebotI don't understand.
18:49callenI know, that's why I didn't ask you.
18:50ziltilol
18:51pipelinethere is always movitz
18:51pipelinecommon lisp on raw x86
18:52callenpipeline: only CL'ers are that crazy.
18:52gfredericksoh man ex-data on the repl is nice
18:52gfredericks(ex-data *e)
18:54bawrWell, LIghtTable seems interesting.
18:57bawrI wish it was better documented, though.
19:02callenbawr: it's pretty nascent. If you have a feature request, bug ibdknox.
19:03gfredericksI wonder how much content could be gathered for a clojure Wat talk
19:04amalloygfredericks: headlining: contains?
19:05gfredericksis that #_%2 bug still out?
19:06gfredericksand there is clojure.core//
19:06amalloyi doubt #_%2 will change anytime soon
19:06bbloomgfredericks: i'm pretty sure 1.5 fixes /
19:06gfredericksright; cljs needed it
19:08gfredericks&(-> 42)
19:08lazybot⇒ 42
19:08gfredericks&(->> 42)
19:08lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$--GT
19:08gfrederickswouldn't be a very dramatic talk :/
19:09Bronsawtf
19:09bbloommost of the "wat?"s in clojure would require a pretty deep understanding of the implementation of lisps to really say "wat" about
19:09bbloom:-P
19:09gfredericks,(+ [] {})
19:09clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
19:09gfrederickshaha WAT
19:10bbloomgfredericks: try that here: http://himera.herokuapp.com/index.html
19:10bbloomWAT
19:10gfrederickshaha why do we have assoc/assoc-in/update-in but no update amirite WAT
19:11bbloom"[object Object][object Object]"
19:11gfredericksbbloom: ermagherd WAT
19:11gfredericksthat's CUHRAZY
19:11muhoogawd, cljs is still js
19:12muhooso i'd expect the best WAT-hunding would be in cljs
19:12bbloomif somebody can figure out how to make polymorphic + fast on all platforms without absurd amounts of type hints, please do :-)
19:12muhoohunting
19:12amalloythat's the nice thing about clojure being hosted. you can choose between a weak type system, or an aggressive, hostile, weak type system
19:13gfredericks~rimshot
19:13clojurebotBadum, *tish*
19:13bbloomi prefer my type systems as hostile as possible. and armed to kill
19:13muhoobbloom: haskell user?
19:13bbloomno :-P
19:13bbloomi just like the mental image of a type system armed to kill with a mean look on it's, um, face
19:13Bronsa6oh i see
19:14muhoowhat's the type system of the CLR like? never used it
19:14amalloyhaskell's type system is like a puppy bringing you your slippers
19:14bbloommuhoo: the CLR's type system is marginally more sophisticated than Java's
19:14ChongLiyeah how about javascript?
19:14muhooclojurebot: javasccript
19:14clojurebotPardon?
19:14ChongLikiller in a different way
19:14muhooclojurebot: javascript
19:14clojurebotjavascript is beautiful, you're just too conformist to appreciate its quirks: http://tinyurl.com/7j3k86p
19:14bawrSo. What's the current recommended way to get Clojure to start up faster for scripting/etc?
19:14muhoohahaa
19:14bbloommuhoo: most interestingly, the CLR supports value types and true generics
19:15bbloommuhoo: as well as much better native call interop
19:15Foxboronbawr, Linux or Windows?
19:15brainproxybawr: drip maybe?
19:15Bronsathat weirt ->> error is caused by https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L437
19:15Bronsaweird*
19:16bawrI 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:16bawrLinux.
19:16Foxboronbawr, drip it is
19:16FoxboronThats the A) you mention.
19:16Foxboronhttps://github.com/flatland/drip
19:16bawrOh, thanks.
19:16BronsaI got a bigger wtf though
19:16Bronsa>ArityException Wrong number of args (-1) passed to: core$map clojure.lang.Compiler.macroexpand1 (Compiler.java:6478)
19:16ChongLiclojurescript can be used for command line utilities
19:17muhooBronsa: how is -1 args even possible?
19:17Bronsaeheh
19:17muhooyou thought i was going to give you an arg, but NO, i took one away instead! muaaahahah!
19:17ziltiChongLi: Who would ever do that?
19:17Bronsai know what's bugged but i have no idea on how to fix it
19:17bbloomi 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:17bbloomyou can fix an error message
19:17bbloomyou can't fix [] + {}
19:17gfredericks-1 args is usually calling a macro like a function, isn't it?
19:17ChongLizilti: who knows, it's sort of an esoteric thing
19:17Bronsanope gfredericks
19:18bawrFoxboron: Oh, seems it's not really a standalone JVM, which is interesting.
19:18gfredericksBronsa: fooey
19:18Bronsait's when you get an arityexception from a function evaluated in macroexpansion-time
19:18Bronsalike
19:18Bronsa>(defmacro [] (map +))
19:18Bronsaand the bug is https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6472 here
19:18gfredericksthe macroexpander just subtracts 2 from all arity exceptions regardless?
19:18ChongLigenerally I think most people are served by shell, perl or python
19:18Bronsayep
19:18gfrederickswell...great.
19:19zilti"clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap" That's strange, too.
19:19amalloyah! i knew there was a way to get -1 args but i couldn't remember/find it
19:19brainproxyChongLi: there seems to be a bit of renewed interest in tcl of late too
19:19bbloomBronsa: that seems like a really easy fix: can't you just move the arguments to v.applyTo out of the try/catch?
19:19amalloyzilti: #({})
19:19brainproxyi keep seeing mention of it on HN and other places
19:19bawrCLojure scripting can be really powerful when done right.
19:20zilti,#({})
19:20clojurebot#<sandbox$eval27$fn__28 sandbox$eval27$fn__28@28f056a7>
19:20amalloy&({}) ;; is what i meant
19:20lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap
19:20hyPiRion,({} [] ())
19:20muhoo2that's 0, not -1
19:20clojurebot()
19:20amalloyyou probably wrote something like (#({:a %}) 1)
19:20brainproxyzilti: when you use the #(...) notation for lambdas
19:20ChongLibrainproxy:hmm, strange
19:20gfredericks,~foo
19:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0)>
19:20brainproxyyou should't use the reader literal notation for hash-map, vector as the first block inside the labmda
19:21brainproxyerr expression
19:21gfredericks,~42
19:21clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
19:21brainproxyzilti: try this instead, #(hash-map ...)
19:21hyPiRion,`~42
19:21clojurebot42
19:21ziltibrainproxy: No, my problem was (@db-struct) instead of writing @db-struct...
19:22brainproxyokay
19:22brainproxy,#({:a 1})
19:22clojurebot#<sandbox$eval156$fn__157 sandbox$eval156$fn__157@76b047f0>
19:22Bronsabbloom: that way you get an arityexception on n+2 parameteres if you invoke the macro v with the wrong number of args
19:23brainproxy,(#({:a 1}))
19:23clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
19:23brainproxy,(#(hash-map :a 1))
19:23clojurebot{:a 1}
19:25brainproxyChongLi: 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:26ChongLibrainproxy: oh yeah? perhaps I'll check it out
19:26Bronsabbloom: the thing is, you have no way to know if the ArityException is of the macro, or of the body of the macro
19:26ChongLiI thought it was mainly used for writing GUIs or something
19:26brainproxyI 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:27brainproxybut 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:27ziltibrainproxy: seesaw is pretty awesome, too.
19:28ChongLihmm
19:28ChongLiwhat about tcl/java
19:28ChongLi?
19:28brainproxyzilti: neat, hadn't seen that, will play with it
19:29ChongLiJacl is a self-contained implementation of a Tcl interpreter, written entirely in Java
19:29ziltibrainproxy: 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:29ChongLithis seems kinda cool
19:30ChongLiTcl Blend as well
19:30ChongLihmmm
19:31ChongLiyou could write a program in clojure that calls out to Tcl/Tk to do its GUI
19:31ChongLithat would be weird
19:32brainproxyChongLi: probably not worth it
19:32ChongLiyeah
19:32ChongLijust interesting to think about
19:32brainproxyi mean might as well use swing or this seesaw thing zilti mentioned
19:32brainproxyoh sure
19:33ChongLiso I've been reading Paul Graham's On Lisp
19:33ChongLiit's been my first exposure to CL code
19:33ChongLiwhat I don't get is how people can put up with all that sharp-quoting and funcalling
19:35ChongLican anyone explain to me what the advantages of that are? that is, having a separate namespace for functions?
19:35hyPiRionKnowing what is vars and what is defuns
19:35hyPiRionvars may change, defuns (usually) don't
19:36ziltiChongLi: I never understood that, too, but I've been told that this question can start wars
19:36ChongLizilti: I don't want to start a war here :)
19:37brainproxyChongLi: http://www.nhplace.com/kent/Papers/Technical-Issues.html
19:37brainproxythat turned up when I googled lisp-1 vs lisp-2
19:37ChongLibrainproxy: thanks
19:39abpI'm still not sure if I should use namespaces or maps for my functions.
19:40ChongLimaps?
19:40clojurebotmaps are functions
19:40abpYou see. :P
19:40abpNo, in a control flow library.
19:42abpBasically putting fns into maps would require documentation tools that look on fn-meta for docs etc, because no vars there.
19:42ChongLiyou want to use the maps to dispatch or something?
19:42hyPiRionPutting fns or vars into maps?
19:43hyPiRionI mean
19:43hyPiRion,(ns-publics 'clojure.core)
19:43clojurebot{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:44abpChongLi, actually to build computation graphs.
19:45abphttps://gist.github.com/4142595
19:45abphyPiRion, thanks now I have even more to think about. ;P
19:46hyPiRionabp: You're welcome :p
19:47hyPiRionabp: Do you have the cgf-library on github yet? Sounds interesting
19:48hyPiRionOr is it too early?
19:49abphyPiRion, 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:51abphyPiRion, since the presentation of prismatics graph at strangeloop there are a few of those libs out there.
19:51hyPiRionIn clj?
19:51abpyes
19:52hyPiRionI have apparently missed that, thanks for telling
19:53abphttps://github.com/stuartsierra/flow https://github.com/doo/process
19:53abpProbably more I don't remember now.
19:55abpI 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:56abpDespite planing to provide that as well.
19:57hyPiRioncool
19:59ziltiDid 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:00abpI think it can be a lot. Transport between nodes could be arbitrary.
20:03hyPiRionIt's like dataflow variables from what I can see
20:03hyPiRionExcept it doesn't sound lazy
20:06abpI 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:33abphyPiRion, ok, I know some things about dataflow variables. But didn't know that name.
20:41hyPiRionIt's not often used
20:42hyPiRionDataflow variables, I mean, not the name
20:42abpBy now I don't undestand why.
20:43hyPiRionYeah, it's a bit sad I think. It's one of the features I miss in Clojure
20:43abpI've written such a system in Java. It worked like a charm despite being Java.
20:43hyPiRionheh
20:44abpIt 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:47abphyPiRion, have you worked with such systems? Because you've said you miss it in Clojure.
20:47callencan you do an "update ... returning" in Korma?
20:47ziltireturning?
20:48callenzilti: yes, returning.
20:48ziltias in, wait until finished?
20:49callenzilti: http://www.postgresql.org/docs/9.0/static/sql-update.html
20:49callenzilti: real SQL databases have something called RETURNING for their UPDATE queries.
20:50callenzilti: just ctrl-f "RETURNING" and yo'll see.
20:50callenOracleDB, MSSQL, and PostgreSQL all have it.
20:50hyPiRionabp: I've used the programming language Oz
20:50callenas is typical, MySQL does not because it's a sad pale imitation of a SQL database.
20:51p_l*SNRK*
20:51p_lyou meant ISAM dataset with SQL emulation layer ;)
20:54ziltiSo a "UPDATE table whatnot-values RETURNING *" returns all rows that have been updated?
20:54harobHi 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:55callenp_l: yeah, old wounds there for me. I've had to write entire libraries to work around MyISAM limitations.
20:56callenzilti: the reason it's important is that it enables one to perform a write followed by a read atomically and safely.
20:56zilticallen: Isn't that just syntactical sugar for wrapping this in a transaction?
20:58p_lcallen: I finally dropped it after being burned one time too many by MySQL weirdness with encodings
20:58callenzilti: MyISAM doesn't have transactions, either.
20:58callenp_l: oh right, it's not UTF-8 by defaulr rightt right?
20:59callenpardon mistypes, terminals are being eirweird.
20:59p_land query planner in MySQL is... shit
20:59zilticallen: I'm not talking about MySQL. I'm right now working with H2
20:59p_lcallen: and has iirc three different points at which encoding conversion can happen in a connection, and implements unicode incorrectly
21:00lucianp_l: it's awesome compared to mongodb's
21:00p_llucian: ... you knolw how to pick your insults
21:00p_l*know
21:00lucian:)
21:01lucian(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:06p_lMy 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:08lucianyeah, if you value your sanity you don't want to know what tricks i do to keep mongodb from doing table scans
21:27harobIs 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:31amalloy(.getBasis (class b))
21:31amalloy(but, why are you looking at basises anyway? surely that's an implementation detail
21:32amalloyno, what i just suggested won't work at all
21:33amalloyyou'd have to do reflection, i guess
21:33harobamalloy: 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:34harobI'm guessing this is not a great way to it. Is there a better way to achieve that?
21:35amalloyi can't say, because you've only said what your implementation plan is, not what your goal was
21:35amalloywhy 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:36harobFair 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:37callenharob: http://meta.stackoverflow.com/questions/66377/what-is-the-xy-problem
21:37callen,xy
21:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: xy in this context, compiling:(NO_SOURCE_PATH:0)>
21:37callen$xy
21:37amalloywell, as usual i'll caution you against using records prematurely - maps are more flexible and easier to work with
21:37callen~xy
21:37clojurebotxy is http://mywiki.wooledge.org/XyProblem
21:37callengood bot.
21:37callen$botsnack
21:37lazybotcallen: Thanks! Om nom nom!!
21:37callenwrong bot. sigh.
21:37amalloybut you could, for example, define a multimethod get-relations, and create methods of it with each of your record classes
21:38harobe.g. (defrecord Baz [a b c d]), and [:b :d] are "relation" keys. There are several such record types.
21:38harobamalloy: 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:39amalloymeh. 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:39harobThe reason I though metadata might be a better solution is that this data is effectively "static"
21:39harobok
21:39callenI'd say this is another example of why Clojure should be a like video game where you unlock new powers.
21:40callenprotocols and records would be inaccessible initially ;P
21:40bbloomcallen: you're welcome to steal that idea if you promise to do it justice
21:40callenHaskell by its design has this built in by making everything difficult.
21:40callenbbloom: 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:41harobthanks for the help amalloy!
22:00muhoo2the secret i've found is, if i can't figure out wtf something does, then don't use it :-)
22:01amalloythat's the trouble with records. they look easy to use
22:04muhoo2well 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:05dnolenbreaking 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:06dnolenhttp://github.com/clojure/core.logic/commit/bbc4e820128d5a0745ce3d79cd3bbd9401a1bf55
22:09loliveiraclojure_csv or clojure/data.csv?
22:09bbloomdnolen: 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:11dnolenbbloom: 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:11dnolenit was becoming a hassle I mean.
22:11bbloomdnolen: one other thing that sets off my spider sense: negations in identifiers. like NON in non-storable. what about a word like "ephemeral"?
22:13bbloomdnolen: who is "we"? just you? you and other core.logic contributors? the logic programming community?
22:13dnolenbbloom: "ephemeral" has a different connotation to me.
22:14dnolenbbloom: myself and Will & Nada really.
22:14Guest24989How do I use a variable with repeat?
22:14bbloomdnolen: cool. like i said, i'm a totally ignorant, but curious observer: could you elaborate on how unification collapses into a normal constraint?
22:15Guest24989(map mod (repeat 9) [3 5])
22:15Guest24989How can I turn that into (repeat x)?
22:15dnolenbbloom: part of the realization is arising from how context sensitive unification really is.
22:15bbloomi figure if i learn logic programming a step behind you, i can get 30% of the knowledge transfer for 3% of the effort :-)
22:16dnolenbbloom: unification as is done in Prolog is pretty straightforward. Recursive decent add the logic var bindings to the substitution map.
22:16bbloomdnolen: lexical context?
22:16dnolenbbloom: (== [1 x] [y 2])
22:17brainproxygah... tried again setting up lein-ritz / ritz-swank so I can move past deprecated lein-swank ... last try was a few months ago
22:17brainproxystill no joy, just doesn't work
22:17bbloomyeah, 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:17dnolenbbloom: y has to be 1, x has to be 2. This is easily done via recursion.
22:17brainproxyfollowed instructions in the repo to the letter
22:17bbloomthat's what i find interesting, so your realizations are interesting
22:18dnolenbbloom: 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:18dnolenbbloom: but that's just like constraint solving over finite domains.
22:19bbloomi 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:19dnolen"forms of unification that aren't Prolog like" is what I meant
22:19bbloombasically, finite domain solving involves iteratively reducing the domain of vars
22:19bbloomrather than backtracking
22:19Guest24989How do I use repeat with a value?
22:20bbloomie process of elimination vs trial and error
22:20dnolenbbloom: yes, but you can think of the domain as kind of side condition. (infd x (domain 1 2 3))
22:20dnolenwe don't know what x is really
22:20bbloomwhat's an example of a side condition?
22:20dnolenbbloom: that it's something as long it's 1 2 or 3 :)
22:21bbloomah, heh
22:21bbloombut what about in the (== [1 y] [x 2]) situtation?
22:21dnolenbbloom: 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:21bbloomor rather something with multiple solutions
22:21dnolen(# x y)
22:22dnolenso x can never appear free in y, where y is some lambda calculus term
22:22dnolenbut imagine we unify y with (lam y z), where z itself is a logic var
22:22dnolenwell we need to make sure (# x z) then
22:23bbloomdnolen: 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:23dnolenso you can unification here needs to push these side conditions (constraints) along
22:23dnolenbbloom: more than happy to explain more later
22:23bbloomdnolen: thanks. cheers
22:38seangroveIs there a cross clj/cljs way to parse an int from a string?
22:38seangrovecljs has (js/parseInt %) obviously
22:39muhoo2is :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:46dnolenseangrove: there isn't a way that works in both places.
22:46seangroveI'm starting to become more and more partial to feature expressions...
22:47seangroveAlthough I don't quite like them, even so
22:54muhoo2seangrove: i saw this thing lynaghk created called cljx
22:54muhoo2it supposedly unifies some stuff like that, so you get the same code for both platforms.
23:09pipelinecallen: well, you could always port clojure to jnode