#clojure logs

2012-03-15

01:41archaicI'm trying to implement the interface javax.swing.tree.TreeNode, the method children() expects the children returned as an Enumeration, how do I create the enum? (given I have the children as a seq)
01:49amalloy&(doc seq-enumeration)
01:49lazybotjava.lang.RuntimeException: Unable to resolve var: seq-enumeration in this context
01:49amalloyugh. it's around there somewhere, i think
01:49amalloy(clojure.lang.SeqEnumeration. the-seq)
01:51amalloyarchaic: ^
01:51archaicAhh thanks, (enumeration-seq) goes the other way - thats the one I needed
02:41konrIs there a more elegant way to create an instance using a list of args than (eval `(java.awt.Color. ~@[1 2 3]))?
02:49pyrkonr: (defn constructor [vec-or-list] (clojure.lang.Reflector/invokeConstructor java.awt.Color (to-array vec-or-list))
02:50pyrkonr: then (construtor [1 2 3])
02:50pyrkonr: but that's not pretty either
02:50aperiodicheh, eval or interop
02:50aperiodicchoose your poison
02:51konrthanks!
03:14fliebelSome of you have tweeted about smalltalk in the past, usually in relation to things it did right, but is it actually a nice language to program in?
03:21scottjfliebel: I liked it but wouldn't every choose it over clojure. I do think it's a very beautiful language but sometimes ugly features are nice too. The dev environment is also very impressive.
03:22fliebelscottj: I found a job in Smalltalk, which seems like a little crazy idea, which is why it interests me.
03:22scottjfliebel: JPM?
03:22fliebelscottj: JPM?
03:23scottjfliebel: guess not (jp morgan (chase))
03:23scottjthey have a big deriviatives app written in smalltalk
03:24fliebelscottj: guess not. I had no idea about active Smalltalk use.
03:27scottjfliebel: programming in smalltalk now is kind of like the movie back to the future (and there's a famous smalltalk article with this name). it's definitely not a modern language and a ton of things you'd expect are missing, but you also realize the past wasn't that backwards and actually worked pretty well and had a lot of really good stuff that's lost from the modern world.
03:29fliebelscottj: Hm, I do think that we should learn from the past, but I'm not sure if a full time job is the right way to do that.
03:31fliebel"Alan Kay has commented that despite the attention given to objects, messaging is the most important concept in Smalltalk"
03:32echo-area``Ensure'' doesn't force the newest value, right?
03:37raekecho-area: if you mean that thread A reads X from ref R in the following scenario? then no. ref R contains Y, thread B enter transaction, thread A enter transaction, B sets R to X, A calls ensure
03:38raekthis article explains the STM really well: http://java.ociweb.com/mark/stm/article.html
03:38echo-arearaek: You sent me that link some time ago ;-) I have read that. And I'm reading LockingTransaction.java.
03:39echo-areaI seem to doubt that ensure fixes write screw; I don't make it clear until now, and will discuss later here
03:40echo-arearaek: Thank you by the way :-D
03:50fliebelscottj: What kind of stuff doe Smalltalk not have? Except for regex literals and that nonsense.
04:12Lajlafliebel, a full hindly-milner static type inference
04:13fliebelLajla: Like public static final int[]<a, b>?
04:14Lajlano
04:14LajlaAs in Haskell or OCaml
04:14LajlaC++ most certainly does not have a hindly milner type system
04:14LajlaEhhh
04:14LajlaSay you got some Haskell code
04:14Lajlaas in: square x = x * x
04:14Lajladefinition of the square function
04:14fliebelLajla: That is what I mean, you have to type out al the types
04:14Lajlathat is statically typed
04:14LajlaYeah, well, you don't in a hindly milner system because it can infer the types for you
04:16fliebelFrom what I read, Smalltalk is dynamically typed.
04:29gtuckerkelloggthere's something i'm not getting about alter
04:30gtuckerkelloggI have a function, and if I run it (update-cache cc fresh-chr @cc-cache dirty-locs)) it works fine
04:32gtuckerkelloggbut if I try to use it in an alter, with (dosync (alter cc-cache update-cache cc fresh-chr @cc-cache dirty-locs))
04:32tsdhLajla: As a note on C++. In the brand-new C++11 spec, you can in many circumstances declare types as "auto", and the compiler will infer the correct type for you.
04:32Lajlatsdh, in what cases?
04:33LajlaLike, how clear is it when you can do that
04:33Lajla?
04:33tsdhLajla: http://en.wikipedia.org/wiki/C%2B%2B11#Type_inference
04:33gtuckerkelloggit throws an error Wrong number of args (5) passed to: core$update-cache
04:33gtuckerkelloggdriving me nuts
04:34tsdhLajla: If it doesn't compile, that's a case where it didn't work. :-)
04:34Lajlatsdh, don't hate me for not feeling save from that
04:34LajlaBut I'd admit that I got a passionate hatred for C++ which rivals the hatred republicans have for people who know how to turn a computer on.
04:36tsdhLajla: I didn't use C++ seriously enough to have a strong positive or negative feeling about it. But at least I have to confess that they're making quite some progress. Who would have betted that C++ has lambdas before Java has some years ago?
04:36mindbender1gtuckerkellogg: i think you should read up a bit on alter works within a dosync.
04:37mindbender1alter will pass an extra argument to your fn
04:37Lajlatsdh, that is exactly my problem with C++
04:37Lajlawell, one of them
04:37mindbender1so your fn should be redefined to accept 5 args
04:37Lajlait keeps adding dfeature and feature and feature and feature to the point that its syntax isn even decidable at this point
04:37gtuckerkelloggahhhh
04:38LajlaI mean, C++ syntax is just cluttered and unreadable at this point to account for that, not to mention that the language takes 3829382 hours to compile something simple and its errors messages are just ehrr..
04:38LajlaSomeone once managed to give me something which on his compiler generated 3 pages of error message from a simple typo
04:38mindbender1gtuckerkellogg: if you're within a repl .. (doc ?) helps
04:39gtuckerkelloggsorry about that
04:39gtuckerkelloggi read the (doc alter), but it's as if I didn't see that at all
04:42tsdhLajla: Yes, the syntax is a bit "grown" over times. Ok, one could argue it was rather insane from the beginning.
04:43tsdhLajla: WRT error messages, the clang compiler does a pretty good job there.
04:47emezeskeC++ errors can be problematic, but it's not like it's alone there
04:47emezeskeI have dealt with some ridiculous Clojure errors
04:48emezeskeYou know the ones, deep in some library, happening in a lazy func somewhere
04:48emezeskeAt least with C++, the crazy errors actually do contain the info you need to fix them (if you're willing to spend a bunch of time picking them apart to figure that out)
04:52ivan___emezeske: i doubt clojure has anything on jruby for crazy errors ;)
05:01RaynesEverybody digging the new editor on https://refheap.com?
05:01RaynesI think it's pretty awesome, but I'm biased.
05:04LajlaDoes clojure have a contracy system?
05:06tsdhRaynes: Wow, that even indents when writing directly in it.
05:08tsdhRaynes: It has a problem with binding vectors (let, for, with-open) if you place each binding pair on a separate line. Then the second binding pair is indented to the value of the upper value.
05:10Raynestsdh: Indeed. I'll file an issue on codemirror and see if I can tackle it myself. Thanks for pointing that out.
05:12tsdhRaynes: You're welcome.
06:10lnostdalhttp://dev.clojure.org/display/design/Improve+Binding "Yet that is often the expectation/desire" no it is not! :(
06:11lnostdalit causes weird leaks and assumptions .. agents execute "outside" of binding scope
06:13Fossino emacs keybindings, no editor :>
07:28lnostdalhttp://dev.clojure.org/display/design/Improve+Binding?focusedCommentId=4653329#comment-4653329
07:28lnostdalhow do you guys deal with this stuff?
07:32clgvlnostdal: that should work in clojure 1.3
07:33clgvlnostdal: oh. maybe not for an agent since it's threadpool might be running already. but if you spawn a new thread it should have the current binding
07:33lnostdalok, i'm not sure when this change was made actually .. i'm on 1.4.x here now, so perhaps it's a 1.4.x thing; not a 1.3.x thing
07:34lnostdalhmm
07:34lnostdalhuh, i'm saying new threads should _not_ have the "current" binding since they have no way of knowing what is "current" .. perhaps i misunderstood
07:34clgvI can imagine that there remains work to be done for agents
07:35lnostdal(the same goes for agents and futures too)
07:35clgvafair the thread has the current binding from the time where it was created (or even started?)
07:35lnostdalagents have bindings from the point of send or send-off
07:36clgvoh I misread the linked comment
07:36lnostdalok
07:37clgvI think the 1.3 behavior is good. I assumed it doesnt know the binding
07:38clgvthe question is when the binding should be inherited. once on the 'agent call or on every 'send call
07:39clgvthe problem with resources in 'with-open that could occur with 'binding is the same as with lazy-se4qs
07:39lnostdalyes, it is
07:40clgvwell this consistency is good as long the general problem is not solved ;)
07:40lnostdaland this stuff should even try to solve it automatically .. it leads to, hm, what's the term; false positives .. things that "seem to work" perhaps most of the time, but then doesn't sometimes
07:40lnostdalshouldn't even try*
07:41clgvprobably things like with-open should be replaced in a pipes-and-filter style
07:45lnostdalperhaps, and perhaps that would work for stuff like with-db-connection and similar too
07:46lnostdal..but i still think the "classic" with-* dynamic extent type resource handling should be "sane"
07:49clgvthe problem in 'with-open is that you don't know when too close it if the sequence is lazy
07:49clgv*to
07:50clgv*the sequence that uses the file
07:53lnostdalthat seems like an unrelated thing
07:54lnostdalwhen/if you're gonna use lazy stuff you won't be using with-* anyway
07:54lnostdalthat seems like a totally different realm or way of doing things to me
07:55clgvhm ok. in clojrue 1.2 I had the problem with 'binding that it stop to work as soon as a thread was spawned that was pretty annoying
07:56tomojbut I always thought binding was for thread-locals
07:57clgvtomoj: it is
07:57lnostdalno, it's totally reasonable .. you have no way of knowing how long that binding will really last (point to a real / still open (i/o)) resource
07:57lnostdal..when in a background thread
07:58clgvmaybe it should treat resources special then. but for immutable values thats totally reasonable
07:58lnostdalhowever, there are some things which are reasonable to always forward/convey by-default though
07:58lnostdalyes, like *print-length* and stuff
08:00lnostdali think i recall SBCL having a global variable with a list of default (and user added) bindings to forward/convey by default .. but the default/normal behavior was to not convey anything as it makes code in threads "magically work" in some cases where it'd been better to fail all the time so it got the users attention early
08:00lnostdalnot convey anything new*
08:02clgvlnostdal: hmm, a configuration what to convey would be doable I guess
08:03clgvlnostdal: could be metadata
08:03lnostdalindeed
08:16lnostdaljust patched my local clojure to not do this anymore and found 2-3 potential places where agents race with the extent of outer bindings .. i wouldn't have seen this otherwise; thing would just randomly have failed if e.g. the agent pool was somewhat busy .. perhaps i'm totally wrong about this or just nuts, but this seems to be the right thing to deal with this
08:17lnostdalright way*
08:17clgvclojure.lang.Var is the place to patch, right?
08:20lnostdalclgv, https://refheap.com/paste/1077
08:21clgvah. I would have thought thats implemented in the java source ^^
08:22clgvwell, easier that way ^^
09:55mdeboardI really need to add a mode hook for ignoring this join/quit spam
10:17jorendorfftewald: hey tim
10:52pandeirotomoj: did you ever figure out why (io/copy (io/input-stream url) (io/output-stream filepath)) does an incomplete copy btw? still trying to fix my binary download fn from last night
10:54simardhow do you get to evaluate functions typed by a user with clojail if eval is disabled from within the sandbox ? ie.: how does clojure-bot and tryclojure do it ?
10:56TimMc,(let [evil (resolve (str 'eval))] (evil `(+ 1 2 3)))
10:56clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
10:56TimMc,(let [evil (resolve (symbol "eval"))] (evil `(+ 1 2 3)))
10:56clojurebot6
10:56TimMcsimard: Well, in the case of clojurebot... :-P
10:57TimMcsimard: I believe the sandbox works by taking apart the submitted code and checking it against whitelists and blacklists.
10:58TimMcsimard: The dot form (. foo bar) is also replaced with something that does checks for forbidden methods, classes, and packages.
10:59simardso basically I would read a string into a form outside the sandbox, and submit that form to the sandbox.
11:03simard(let [sb (sandbox secure-tester)] (sb (read-string "(System/exit 0)")))
11:03simardgreat.
11:04TimMcsimard: Yeah, but use a secure reader.
11:05simard?
11:05TimMcI can break the snippet above in at least 2 ways.
11:05TimMcclojail has a secure reader.
11:06TimMc,(read-string "`````````````````a")
11:06clojurebotExecution Timed Out
11:08TimMc&(take 7 (map (comp count flatten read-string) (iterate (partial str \`) "a")))
11:08lazybot⇒ (0 2 8 41 221 1202 6548)
11:16pandeiroit's possible to nest with-opens right?
11:19clgvpandeiro: as far as I remember you can even open multiple resources in one with-open
11:20pandeiroclgv: yeah that i've done but i am opening a zip and then doseqing through the entries
11:20clgvpandeiro: should by no problem. with-open expands to try-finally-blocks
11:24joegalloclgv: yes, you can nest with-opens, pandeiro, yes you can have multiple resources in a single with-open -- correct on all counts
11:25joegallooh, i got confused there, that was all clgv explaining to panderio. please re-address my previous message accordingly. :)
11:25pandeirojoegallo: thanks, gotcha.
11:26clgv;)
11:26pandeiroi really needed to update nakkaya's io primer with the stuff i'm learning... stuff's changed since 2010
11:35wmealingcan anyone reccomend a good resource on setting up a clojure project with jenkins-ci ?
11:36wmealingspecifically a lein project
11:39wmealingah technomancy wrote one, thanks.
11:49uvtcpandeiro, didn't know about the takkaya site. Looked it up. Thanks.
11:50uvtcpandeiro, gah. s/takkaya/nakkaya/
11:53pandeirouvtc: yeah lotsa good stuff there
11:54pandeirohow does one get slime to recognize new libs added to the classpath since starting swank? or do i need to restart?
11:56metajackpandeiro: just jack-in again or use something like pomegranate (https://github.com/cemerick/pomegranate)
11:59pandeirometajack: jacking in will clear my session variables?
12:00pellebHi guys. I'm trying to develop a ring auth framework based on OAuth 2. It's still early days, but I'd appreciate feedback on my clojure as I'm trying to learn idiomatic clojure while writing this. https://github.com/pelle/clauth
12:03metajackpandeiro: unfortunately yes.
12:32jaleyhas anyone had issues connecting to an nREPL from counterclockwise? i'm seeing a long pause followed by an IndexOutOfBounds
12:39dabdI have a lein project using clojure 1.2.0 but when when I run Mx-clojure-jack-in and eval *clojure-version* on the REPL it shows clojure 1.3.0. How is this happening?
12:44joegallodabd: can you paste your project.clj? maybe one of your dependencies is pulling in clojure 1.3.0 or something like that.
12:44joegalloif you ls lib, which version of clojure do you see there?
12:50tmciverdabd: I believe you have to M-x cd to a project directory first.
12:51bhenrywill doseq wait to complete before moving on? or will it run in another thread?
12:52raekbhenry: it won't involve other threads
12:52raek,(macroexpand-1 '(doseq [x xs] (foo x)))
12:53clojurebot(clojure.core/loop [seq_33 (clojure.core/seq xs) chunk_34 nil count_35 ...] (if (clojure.core/< i_36 count_35) (clojure.core/let [x (.nth chunk_34 i_36)] (do (foo x)) (recur seq_33 chunk_34 count_35 (clojure.core/unchecked-inc i_36))) (clojure.core/when-let [seq_33 (clojure.core/seq seq_33)] (if (clojure.core/chunked-seq? seq_33) (clojure.core/let [c__3866__auto__ (clojure.core/chunk-first seq_33)...
12:53dabdjoegallo: here are my dependencies from project.clj http://cljbin.com/paste/4f621e2ce4b06159e94b7f25
12:53dabdtmciver: I am running clojure-jack-in from the project.clj directory
12:53raekbesides some optimizations, the doseq expands into loop and recur
12:55mstumphow do you apply lazy-cat?
12:57joegallodabd: so, yeah, one of your dependencies is pulling in clojure 1.3.0, and so you're getting that in lib
12:58joegallofigure out which one, and add an exclude to it, and cross your fingers and hope it actually works with clojure 1.2
13:36true_droidwhat's the idiomatic way of converting a string into a number? or checking that a string contains a number (like Python's isdigit()?
13:36true_droid(try (Integer/parseInt "…") …) is not applicable
13:38dnolentrue_droid: what's wrong with Integer/parseInt?
13:38true_droidwell, I'm solving this problem https://www.4clojure.com/problem/128
13:38true_droidand it spits out this: "You tripped the alarm! catch is bad!"
13:40TimMctrue_droid: "4clojure" and "idiomatic" often don't go well in the same sentence (because of the constrained environment)
13:41true_droidok, pardon my request of an "idiomatic" way
13:41pandeirotrue_droid: maybe you could use regex instead of try/catch to limit parseInt application?
13:43TimMcI'd probably solve this one with a slightly brute-force approach.
13:43pandeirois vec a costly operation?
13:43true_droidI'll better use the range check to determine if the character is a number
13:43true_droidlike (if (>= (int rank-char) (int \2)) ...)
13:44true_droidis relying on Java exceptions really idiomatic in Clojure?
13:44technomancy"(simple) Shen can be embedded straight into Clojure using the 神 and defprolog macros." o_O
13:44true_droidthat would make the code slightly less portable if we take into account the fact that Clojure is also implemented on top of the CLR
13:45true_droidplus there's also py-clojure currently in development
13:45true_droidthey would all have different exception classes
13:45technomancytrue_droid: real-life programs are going to have a lot bigger portability concerns than exceptions
13:46dnolenpandeiro: not really
13:46dnolentechnomancy: pretty cool stuff
13:47true_droidtechnomancy: what do you mean? if I write a program in Python using only standard portable modules, it will work in JPython, PyPy etc.
13:48true_droidif I write a program in JPython which uses JVM's features, it will not be portable of course
13:48technomancydnolen: it would be interesting if it weren't for the license
13:48true_droidso the question is: isn't there a way to write portable Clojure code? (as in portable between VMs)
13:48dnolentrue_droid: Clojure is probably one of the few programming languages to fully embrace heterogenous hosts. It rarely tries to solve problems which the host solves for you.
13:48dnolentrue_droid: non-hosty stuff yes, large app no
13:49Chousuke_Cross-host portability seems to be an explicit non-goal for Clojure.
13:50Chousuke_I guess you could consider the various implementations a family of languages
13:50true_droiddnolen: so, writing in Clojure is like writing in Mac-Ruby then? your program will still be in Ruby, but it'll work only with Cocoa
13:51dnolentrue_droid: for apps yes. But there *libraries* that can work everywhere w/ a little effort - core.match and core.logic come to mind ;)
13:51pandeirodnolen: if i have collections i want to access by index, (vec coll index) would be the way to go then?
13:51dnolen,(doc vec)
13:51clojurebot"([coll]); Creates a new vector containing the contents of coll."
13:51pandeirooops i meant ((vec coll) index)
13:52dnolenpandeiro: as in the coll is not already random access? then you will have a conversion linear in the size of coll.
13:52pandeiroi am parsing messy csv data and i need to map some transformations and then be able to access by index
13:53true_droiddnolen: I see, thanks
13:53pandeiroso i parse with string/split which gives a vector, but then after mapping i have a list
13:54dnolenpandeiro: if you intend to do a lot of random access yes - yes convert to a vector
13:54dnolenpandeiro: w/o knowing what you're doing hard to tell if ((vec coll) index) will actually be a bottleneck
13:55pandeirodnolen: i assume the alternative would be to use loop somehow instead of map to transform a vector into another vector?
13:57dnolenpandeiro: no need to loop, map into vec is efficient because of laziness
14:00true_droidwhich music plays well with coding in Clojure?
14:00emezesketrue_droid: Autechre?
14:01TimMcFischerspooner
14:03ieureIs there some way to get at the Compojure URI template stuff from Ring middlware?
14:03ieuree.g. I have (GET "/user/:user-id" [] "stuff")
14:03true_droidthanks!
14:03ieureAnd I want to wrap that up with middleware that can look at :user-id.
14:06duck1123ieure, are you sure you want this as a middleware? (executed for all routes) or do you only want it when the path matches?
14:06ieureduck1123, Pretty sure I want it as middleware… And I can wrap only the routes that need the behavior, yeah?
14:06duck1123if it's the latter, :user-id should be available in the params
14:07duck1123if you want to do url matching outside of compojure, look at clout
14:08ieureSo this is what I have
14:08ieurehttps://gist.github.com/2045735
14:08ieureAnd in that, there is no :user-uuid in the request.
14:09fdaoudI wouldn't think there is a user-uuid because it's part of the url, not the request params
14:09fdaoudieure
14:10ieurefdaoud, Yeah, I know.
14:10duck1123the route params don't get added till that path matches, so replace the [] with request, then print that request var, you should see it
14:10ieureHmm.
14:11ieureOkay so next question is
14:12ieureCan I do something like (GET "/user/:user-uuid" [user-uuid request] ...) in my route?
14:12ieureBecause the wrapper needs the full request.
14:12ieureBut the function I'm calling needs the params
14:13duck1123clout/compojure does some funny stuff there for convienience, but {{:keys [user-uuid]} :params :as request} might work
14:14mefestoieure: this should also work: (GET "/user/:user-uuid" [user-uuid :as req] ...)
14:15dabdjoegallo: thx. I think I will try to migrate all my code 1.3.0.
14:15fdaoudieure: try (GET "/user/:user-uuid" [user-uuid :as request] ...)
14:16duck1123converting to 1.3+ should be a lot easier now that the vast majority of dependencies are updated
14:16fdaoudthat would be the whole request. you could also just get the params map with (GET "/user/:user-uuid" [user-uuid :as {p :params}] ...)
14:18netrealmWhat's the right way to run two functions in the "then" part of an if?
14:18ieurenetrealm, (do …)
14:19ieurenetrealm, Or (if-not error-case exprs*)
14:20duck1123actually, you would want when-not, otherwise you'd still have to use the do
14:20netrealmieure, duck1123: thanks
14:24dnolennice, ClojureScript get a mention in the ThoughtWorks Tech Radar http://www.thoughtworks.com/radar
14:24gf3hola, ibdknox, I'm sure you're sick of me by now, I have another suggestion/idea
14:25gf3ibdknox: I think noir-cljs might benefit from multiple builds a la lein-cljsbuild
14:25gf3ibdknox: for instance, I have my main app, which is heavy on the cljs and includes everything, but I also have a few landing pages that I'd like just a tiny bit of functionality on
14:26gf3ibdknox: and I would need them to be lean and snappy
14:35bsteuberhi everyone
14:35Licenserhi bsteuber
14:36bsteuberI am trying to read a clojure string while keeping track which form is on which line, for all forms
14:36bsteuberthe clojure reader seems to do it for lists only
14:36bsteuberany idea on how I could achieve that?
14:37Licenserbsteuber look at this: https://github.com/Licenser/clj-highlight
14:37LicenserI think I solved it in there
14:38Licenserso it does not build datastructures from the string
14:38bsteubercool
14:39bsteubermaybe I'll steal more than just the line numbers from this project ^^
14:40Licenserheh
14:40Licenserwhat are you working on?
14:40bsteuberwhich ns contains the number stuff?
14:40bsteubera clj IDE, of course :)
14:41bsteuberwell not really, just now just some interactive testing tool
14:42yoklovman, after writing in clojure, having to writing in java again is just painful.
14:43yoklovhaving to write*
14:43Licenserbsteuber the idea was to use a mangler for lines since you can 'remember' which line you're on by counting each newline token
14:43bsteuberLicenser: sorry I don't understand any of that code right now ^^
14:44ieureFAIL in (test-allowed?) (auth.clj:18) expected: nil actual: nil
14:44ieurewat
14:44Licenserieure it is a slightly different nil, a bit more one-ish perhaps?
14:46fdaoudyoklov: +1
14:47fdaoudyoklov: I've been using functionaljava.org, it helps a little. but you still have a lot of java verbiage (that's never gonna go away.)
14:48yoklovfdaoud: the verbiage is one of the worst parts, and I'm not sure I could sell anyone on letting me use that library, haha.
14:49yoklovthough, some of those data structures would be really nice...
14:54fdaoudyoklov: yeah, data structures, map, filter, foreach, etc. with chaining helps write more readable code. you stash away logic in function objects.
15:04yoklovyeah, that would definitely be nice… But I'm using java for a school project and trying to convince my team to use that would probably just undermine my authority (i already shot down their plan to use a weird 3rd party gui library…).
15:05fdaoudyoklov: what was that library?
15:06yoklovhm, jgoodies i think? I remember it not looking particularly bad, just unnecessary for a chat application, which is what we're doing
15:06AimHereyoklov> Use Greenspan's 10th. Come back with a huge pile of code that just incidentally implements clojure, and say it's a domain specific language
15:06fdaoudoic
15:06AimHereIntended to make solving the problem easier
15:07yoklovAimHere: yeah, you're right, that's what i should be doing.
15:09tomojpandeiro: no clue
15:10tomojpandeiro: actually
15:11tomojpandeiro: (let [os (io/output-stream "/tmp/doodle.jpg")] (io/copy (io/input-stream "http://www.google.com/logos/2012/yoshizawa12-hp.jpg&quot;) os) (.flush os))
15:11tomojseems to work
15:11tomojhmm
15:11tomojalso (with-open [is (io/input-stream "http://www.google.com/logos/2012/yoshizawa12-hp.jpg&quot;) os (io/output-stream "/tmp/doodle.jpg")] (io/copy is os))
15:12simardamalloy: I was told to use clojail's "secure reader" if I need to evaluate something within the sandbox, is that (safe-read) ?
15:13amalloyyes
15:13simardso, (let [sb (sandbox secure-tester)] (sb (safe-read "(+ 1 2 3)")))
15:14simardthat and setting the java policy properly and I should be "safe", right ?
15:16amalloyyeah, that's about the safest clojail can make you
15:19TimMcsimard: safe-read protects you against things like *read-eval* true
15:19TimMcbut also more tricksy things
15:22pandeirotomoj: thanks yeah i solved it using (with-open...)
15:26amalloyTimMc: no other tricksy things
15:28TimMcamalloy: Wait, it doesn't guard against ```````?
15:28amalloyhow could it? read throws an exception there
15:28TimMctry catch? timeouts?
15:29amalloyso? it catches the stackoverflowerror, let's imagine
15:29TimMcsimard: Uh, so I guess I oversold safe-read.
15:29amalloywhat's it gonna do? all it can do is throw it
15:30TimMcMagic, I don't know.
15:30simardwhat does ``````` do anyway ?
15:30TimMcI guess I'm thinking in Java terms, where you'd at least wrap the exception.
15:30TimMcsimard: Stack overflow / timeout.
15:30TimMc&(take 7 (map (comp count flatten read-string) (iterate (partial str \`) "a")))
15:30lazybot⇒ (0 2 8 41 221 1202 6548)
15:30dnolenfliebel: just wanted to say I'll get to your post - but it probably won't be until the weekend.
15:31fliebeldnolen: No problem, it's great that you want to think about the problem with me.
15:32dnolenfliebel: definitely! it's a fun problem and less boring than Send More Money, N-Queens or Sudoku
15:33fliebeldnolen: Yea, I think it has real value. I posted something about it on an electronics forum, and apparently there are a dozen design apps, but only one abandoned generator.
15:35fliebeldnolen: I also started to read the rest of the cKanren paper.
15:40fliebeldnolen: Current thoughts: (divfd numerator denominator result remainder) lanes: ((1 2) (3 4)) wire-link = appendo? connectedo = (infd x y lane)
15:42dnolenfliebel: hmm, don't know where you're going with that yet, might be good for another post :)
15:43fdaoudTimMc: what kind of crackhead thing was that?! :-)
15:44fliebeldnolen: Me neither, they are vague conclusions based on the current limitations.
15:45fliebeldnolen: Basically, we need to split and unify lanes.
15:45fliebelWe can only split if there is something to split, i.e. a list.
15:46jamieiApologies if this is a dumb question, but is it possible to dynamically redefine a macro?
15:46fliebelSo our domain is now 2D, but domains are only numbers, hence the divfd constraint, for translating a 1D domain onto a 2D space.
15:47dnolenfliebel: I don't follow, I need some serious hammock time with the problem.
15:47fliebeldnolen: Ok, I'll talk to you after the weekend.
15:48dnolenfliebel: Iooking forward to it!
15:52amalloyjamiei: i think it's an insufficiently-specified question :P
15:52amalloylike, what do you imagine being able to do
15:55jamieiOk, I have a macro that opens a connection. In order to test the code, I want to redefine it dynamically so I can not have to open the connection
15:55jamieiDoes that make more sense?
15:57TimMcYour macro opens a connection?
15:57TimMcOh, you mean it produces code that opens a connection.
15:58jamieiyes, absolutely right
15:58jamieimy poor explanation
15:58jamieihttps://github.com/tavisrudd/redis-clojure/blob/master/src/redis/core.clj
15:59TimMcYou can certainly redefine a macro -- I do that all the time in the repl.
16:00jamieihmm
16:03jamieiredefining it in the same way it was defined gives an illegal state exception, complaining over the conflict
16:10raekjamiei: are you trying to redefine it in the same namespace where it was originally defined?
16:11raekyou get a conflict if you try to define a var whose name is already associated with a var in another namespace
16:14JulioBarrosAnyone here use noir? I've some how messed up my project and am getting blank response pages with no exceptions or messages. Any way to trace what is going on?
16:14jamieiraek: yes, ideally, I'm trying to replace the original so I don't need to open an actual connection for my tests
16:43kakellahello ... anybody up for a little configuration help? i am trying to get aquamacs working with slime+swank ... so far have a swank process running but no repl ...
16:43kakellaclojure itself seems to be working fine ...
16:45yoklovwhat did you do to connect
16:45lancepantzkakella: i would strongly suggest against aquamacs
16:45yoklov^^
16:45y3dioh wow i didn't know storm was half done in clojure
16:45Lukedoes pmap block until all the threads are done running?
16:45kakellai tried clojure-jack-in
16:46lancepantzkakella: `brew install emacs --cocoa`
16:46yoklovhm. okay. just making sure you weren't using one of the old ways to connect
16:46lancepantzmuch much better
16:46kakellaany particular reason why not aquamacs?
16:46yoklovlancepantz: does that have fullscreen support now?
16:47arohnerweavejester: I'm using clj-aws-s3, and when trying to save an object w/ get-object, I get Premature end of Content-Length delimited message body (expected: 566032010; received: 110962445). I don't think it's your fault, but have you seen that error?
16:47arohnerkakella: is your clojure process already running with the swank server, or are you expecting clojure-jack-in to start it?
16:47arohnerLuke: no
16:47lancepantzyoklov: native os x full screen, no
16:48yoklovthat stinks
16:49yoklovkakella: eh, at the very least, non-standard emacsen like that are more of a hassle than they're worth in the long run
16:49kakellaarohner: i believe the process is already running ... but if there is a way i can check it then please tell me and i will try
16:49arohnerkakella: aquamacs is slightly...weird compared to normal cocoa emacs. It used to be necessary several years ago when there was no cocoa emacs
16:49arohnerkakella: ps ax | grep java
16:49kakellayes it is running
16:50arohnerkakella: is swank? netstat -lant | grep 4005
16:50arohnerkakella: you have two options: 1) start clojure yourself, your process is responsible for starting the swank server. Then connect via M-x slime-connect. 2) use clojure-jack-in, which starts the process+swank for you
16:50kakellalooks like not for swank ...
16:52arohnerkakella: if you want to go with 1), follow the directions under Embedding, https://github.com/technomancy/swank-clojure
16:53tmciverarohner: kakella: I don't believe 4005 is the default port for swank when started with clojure-jack-in. It seems to be a random port around 6x,xxx
16:55tmciverkakella: I've had mixed results trying to connect to a running swank using slime-connect. In the past I've used the very ugly technique of attempting to quit emacs at which point it tells you that there are running processes and shows the swank port number.
16:55kakellai see in *swank* buffer a port number .. and if i netstat with that port number then i do get a result
16:56arohnerkakella: try M-x slime-connect, and use that port number
16:56arohnerkakella: that isn't supposed to be necessary w/ jack-in, but let's see if it works
16:58kakellaarohner: well i got a message saying something like "take this REPL brother ..." ... but it did not open a new buffer ?
16:58arohnerthat's progress at least
16:59arohnerdo you have a buffer named something like *slime repl clojure*
16:59kakellano ... i have *slime-events* and *swank*
17:00arohnerthat's very strange
17:00tmciverkakella: yeah, it sounds like you've connected to swank but something is weird with emacs. you probably want to abandon aquamacs at this point.
17:01tmciverkakella: a repl is supposed to open up when you get that message.
17:01kakellahmm ... ok so what's my best alternative to aquamacs?
17:02arohnerkakella: http://emacsformacosx.com/ is good, or brew, macports
17:04kakellaok ... i'll try these alternatives and see if i get lucky :) thanks for your support Licenser, arohner, tmciver, yoklov, lancepantz
17:06Licenserkakella you are more then welcome
17:07tmciverwho knew? emacs has a function 'list-processes' that can be used to find the swank port. That seems better than trying to kill emacs for the port info.
17:09technomancytmciver: you can also see it in the *swank* buffer
17:09tmcivertechnomancy: I see. Cool.
17:14rptHi everyone, what is wrong with this:
17:14rpt(fn fcap [s] (str (filter Character/isUpperCase s)))
17:14rpt(noob question)
17:14rpt,(fn fcap [s] (str (filter Character/isUpperCase s)))
17:14clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: isUpperCase in class java.lang.Character, compiling:(NO_SOURCE_PATH:0)>
17:15PhlogistiqueHi
17:15PhlogistiqueArch Linux users among here?
17:15yoklovrpt: you can't use java methods as first class functions
17:15yoklovtragically
17:15Raynes&(filter #(Character/isUpperCase \A) [\a \B \c])
17:15lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox6997$eval11487$fn
17:15PhlogistiqueI installed the pacman clojure package
17:15Raynes&(filter #(Character/isUpperCase %) [\a \B \c])
17:15lazybot⇒ (\B)
17:15PhlogistiqueIn order to try Overtone
17:15Phlogistiquebut when I type "lein"
17:16PhlogistiqueI get an Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
17:16Raynesrpt: You have to wrap it in a function, since that is a Java method and not a Clojure function.
17:16rptyoklov: ah OK, thanks
17:16Phlogistique(I sourced /etc/profile.d/jdk.sh and /etc/profile.d/clojure.sh before)
17:17Phlogistiquejust typing "clj" works fine
17:18PhlogistiqueHere is the full backtrace http://sprunge.us/BXCB
17:20yoklovPhlogistique, you're using leiningen 2.0, have you tried the stable?
17:24yoklovI don't know if that will make a difference, seems worth a shot though. I use arch and have gotten clojure working, but I don't recall how I did that (and i'm not at the right computer to check).
17:24Phlogistiqueyoklov: no I have not
17:24PhlogistiqueI'll see that
17:26Phlogistiquenow it takes more time downloading
17:28yoklovgood luck, everything i've installed involving java in that distro has been a hassle
17:29yoklovi really should just move to a saner linux
17:34Phlogistiquehere we go http://sprunge.us/TaHM
17:34PhlogistiqueException in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core__init.class or leiningen/core.clj on classpath: (NO_SOURCE_FILE:0)
17:36technomancyPhlogistique: curl: (6) Could not resolve host: cloud.github.com; Name or service not known
17:36Phlogistiqueuh
17:36Phlogistiquesorry
17:39kurtharrigeranyone know a good idiomatic way to trim or pad a vector to a desired size... take n works in the vector to large case is there anything idiomatic to pad a vector
17:41technomancykurtharriger: (reduce conj my-vec (repeat n nil))
17:41weavejesterarohner: No, I haven't seen that error before, sorry.
17:41kurtharrigercool thanks
17:41Phlogistiquegot lein working; thanks
17:42technomancykurtharriger: can just use concat if you don't need to keep it as a vector
17:42technomancybut there's no O(1) concat operation for vectors
17:43kurtharrigerk, concat should work for me thanks
17:45TimMckurtharriger: concat + cycle
17:45TimMcor repeat
17:46TimMcFor padding I guess you don't want cycle in most cases.
17:49kurtharrigeryeah just want to append 0 to the seq till it reaches desired length: (defn pad [v length padding] (concat v (repeat (- length (count v)) padding)))
17:50TimMckurtharriger: (defn pad [v length padding] (take length (concat v (repeat padding))))
17:50technomancynice
17:51kurtharrigerthat looks slightly cleaner and handles both cool
17:51technomancys/v/coll/ for the argument name though
17:51technomancysince there's no longer anything vector-specific about it
17:51kurtharrigeryeah its more general then vectors
18:10gf3ibdknox: yt?
18:20brehaut"However, I'm not sure Clojure is going to impress Python developers for the reasons the author states. Python has metaprogramming and it has an immutable type (the tuple)"
18:20brehautO_o
18:20yoklovlol
18:21yoklovclojure clearly cannot compete with the tuple
18:21metajackreal immutable:
18:21metajack>>> f = ({}, [])
18:21metajack>>> f[0]["asdf"] = 1
18:21metajack>>> f
18:21metajack({'asdf': 1}, [])
18:22yoklovwell
18:22brehautmetajack: clojure's immutable datastructures are just as susceptible if you put a java object into them
18:22yoklovto be fair you're changing the dictionary there
18:22yoklovand not the tuple
18:22yoklov(i think, i don't know python)
18:22metajackthere's hardly any point if it's not turtles all the way down.
18:22yoklovi agree with you there
18:22metajackyou can't depend on tuples as values.
18:23metajackunless the value is the length of the tuple :)
18:23yoklovor you deal exclusively in tuples of tuples.
18:23metajacklike church numbers ? :)
18:23FrozenlockIn seesaw, is there a function similar to `input', but which can offer more than a single box? I would like to be able to let the user enter 2 (or more) different info at the same time.
18:24yoklovsomething like that :((),((),()))
18:24emezeskeBah, there's still plenty of reasons to use tuples
18:25metajackstrings are immutable so you can build enough from there. but it would be pretty unpythonic and pretty tedious.
18:25emezeskeAnd they *are* immutable -- they're just allowed to contain immutable references to things that are mutable
18:25TimMcmetajack: "hardly any point"? Go use haskell, then!
18:25metajack(it's exactly how erlang works for the most part)
18:26TimMcYou can do that in any language that allows any mutable objects.
18:28Phlogistiqueyeah, Python has metaprogramming, but it's pretty much against their culture, and even disregarding that it's Ruby-level metaprogramming - no true macros, need to remember the details and names of a lot of things
18:28Phlogistiquethough "OMG, Clojure has metaprogramming thus it will knock out those pythonners" is a pretty ridiculous statement
18:29emezeskeComparing imperitive OO metaprogramming to AST metaprogramming is apples and oranges, really
18:29Phlogistique(Also, Haskell has (static) metaprogramming too!)
18:29yoklovwell, the statement was that "python has metaprogramming so they won't need clojure"
18:30Phlogistiqueyoklov: yeah; it's a misleaded answer to a misleaded statement
18:30yoklovemezeske: i agree, you do very different things when doing, say ruby metaprogramming vs lisp macros
18:30_ato...and people assume one is joking when one refers to FactoryFactoryFactories in Java. From the the standard library: (new XPathFactoryFinder(classloader)).newFactory().newXPath().compile(...) => XPathExpression
18:30mdeboardnamedtuple is not an example of homoiconicity no matter what people tell you
18:31PhlogistiqueI will implement a Forth on CPython to knock out those pythonners with metaprogramming!
18:39yoklov… on that note does anybody want to see my implementation of unlambda in clojure?
18:40yoklovhttps://github.com/thomcc/unlambda-clj
18:41yoklovor, really https://github.com/thomcc/unlambda-clj/blob/master/src/unlambda_clj/core.clj
18:43yoklovi finished it yesterday, and don't even feel bad about plugging it because writing in continuation passing style is a pain
18:55TimMcUnlambda is pretty esoteric, dude.
18:55yoklovhaha, yeah
18:56yoklovit's really cool though, sort of blew my mind when i found out about it
18:56yoklovand clojure made it a lot of fun to implement.
18:59yoklovbut i'll note that weird esoteric languages probably are crossing the "too out there" line
19:03dnolenyoklov: very cool, pretty code
19:03yoklovthank you!
19:04dnolenyoklov: having dug in to CLJS, I'm realizing Clojure is a pretty cool language for building interpreters and compilers.
19:06yoklovyeah, this made me realize that. being able to describe apply as a multimethod was… extremely awesome, to say the least
19:07yoklovthe biggest downside i noticed is no tail calls in clojure, which can make interpreters (such as this one) tougher
19:07dnolenbrehaut: I had a chat w/ ambrosebs, sounds like when he's done he'll offer up the code as a Clojure contrib.
19:07brehautdnolen: thats very exciting
19:08TimMcyoklov: Did you end up using trampoling?
19:08yoklovyeah
19:08brehautreturn type polymorphism at compile time :D
19:09yoklovwhich worked perfectly, gotta say.
19:29qbgdnolen: I see LOGIC-30 was just upgraded to major priority. Are you taking a look at it currently?
19:32dnolenqbg: it's actually already available in a core.logic branch
19:32qbgSweet!
19:32dnolenqbg: I haven't had a time to go over the patch in detail, I'm setting aside my weekend to do some intense Clojuring.
19:33dnolenqbg: if your patch check out (which it looks like it will) I'll probably request that you replace the current system wholesale.
19:33qbgI plan to once it gets in :)
19:34qbgIt was really fun to work on
19:34dnolenqbg: gotta run, but thanks very much for tackling this.
20:01FrozenlockI'm ready some compojure tutorials, and confused by the "public/file.css". Where am I supposed to create this public folder? In the project folder? In the source folder?
20:02spoon16project folder
20:07FrozenlockThanks! However it still doesn't work. I must have messed somewhere else :(
20:20weavejesterFrozenlock: If you're using route/resources, then the "public/file.css" should be included as a resource.
20:20weavejesterFrozenlock: By convention, the default Leiningen resources path is ./resources
20:20weavejesterFrozenlock: So the full path would be ./resources/public/file.css
20:24clj_newbHi, had anyone had seen this error when installing vimclojure? Error: E117: Unknown function: vimclojure#AddCompletions
20:24clj_newband loads like that
20:25alexykhow can I ask cheshire to parse unquiet keys?
20:27clj_newbit looks like it works thou
20:29pbostromhey y'all, I want to mess around with a websocket server, is aleph a good starting point? I've also seen setups using webbit or jetty
20:41archaicWhen I run lein deps on a project that has native dependencies (in native/linux/x86_64) this folder is cleared/emptied - my current solution is just to re-copy it from a backup folder, what am I missing here?
21:15brehauthttps://github.com/jduey/appraiser/blob/master/src/appraiser/forms.clj
21:16brehautit gets interesting around line 184
22:15johnmn3Hi
22:16johnmn3I'm working on a seesaw app. I'd like to embed a picture inside the resulting jar file
22:16johnmn3anyone know how to do that?
22:17johnmn3I figure I have to drop it in "resource" folder or something, but is there a tutorial on the web that speaks directly to this?
22:18johnmn3this may do it: http://stackoverflow.com/questions/8009829/resources-in-clojure-applications
22:18qbgDrop it in the resource folder and load it from the classpath
22:27johnmn3(.getFile (clojure.java.io/resource "picture.png"))
22:35johnmn3this is a little closer: (label :icon (icon (.getFile (clojure.java.io/resource "Airport-Blue.png"))))
22:35johnmn3still no worky
22:53semperostrying to use clojure.test.tap, (with-tap-output (run-tests))
22:53semperoswhen I try to evaluate that, I get an arity exception
22:53semperoserror: clojure.lang.ArityException: Wrong number of args (0) passed to: test$testing-vars-str
22:54semperosbut that function takes 0 args in the Clojure source...
22:55semperosor at least it used to...
23:46johnmn3(frame :title "title has icon" :icon (icon (clojure.java.io/resource "img.png") :content (blah))
23:46johnmn3does the trick