#clojure logs

2011-01-07

00:00riddochcIsn't there a promise? fn?
00:00ckyriddochc: If you look at the definition of promise, there is no way to tell a promise from any other function.
00:02amalloycky: ##(-> (promise) class .getName (.indexOf "promise") neg? not) :P
00:02sexpbot⟹ true
00:03ckyamalloy: That's so ghetto.
00:03amalloynot exactly a sophisticated algorithm
00:10qbgUsing Clojure to permute a part of this guy's self portrait (http://i.imgur.com/vqTq2.jpg), I was able to make this: http://i.imgur.com/TMZJE.png
00:14amalloyqbg: what do you mean, permute a part of his portrait? like, you picked a chunk of his image and rearranged only the pixels in that chunk?
00:14qbgCorrect
00:14amalloythat's pretty cool
00:14qbgI've wanted to do this for years, and I finally did
00:16amalloyqbg: how old is his project?
00:17qbgSee this thread on reddit: http://www.reddit.com/r/programming/comments/exkxp/hey_proggit_me_and_my_friend_wanted_to_see_how/
00:57Licensermorning
00:57amalloy&(let [{x :k :or {x 1]} {:k nil}] x)
00:57sexpbotjava.lang.Exception: Unmatched delimiter: ]
00:57amalloy&(let [{x :k :or {x 1}} {:k nil}] x)
00:57sexpbot⟹ nil
01:05amalloyoh jeez. i just looked at the implementation of destructuring in core.clj. that is some wild stuff going on
01:28chouserindeed
01:31devnchouser: this book is great.
01:33devnamalloy: i put up some ugly destructuring examples earlier...
01:35devnhttps://gist.github.com/438897
01:37devn&(let [{:keys [foo bar] :or {foo 5}} (list :bar 2)] [foo bar])
01:37sexpbot⟹ [5 2]
01:38devn:D
01:38chouserdevn: I know, right? I'm glad you're enjoying it.
01:39RaynesWhat book?
01:39devnRaynes: Less than Words Can Say
01:39devngoogle for it -- it's on a website called sourcetext IIRC, free to read
01:40amalloydevn: meh. i mean the code that parses the binding forms
01:40devnfantastic book about language
01:40devnamalloy: sure sure i was just posting for anyone else's enjoyment
01:40devnsome of those make me think for a few moments :)
03:04LauJensenMorning all
03:10Berengal_workLauJensen: I'm looking at clojureql, and I'm missing documentation on how to write a backend. Could you tell me where I should start looking?
03:11LauJensenBerengal_work: Start by understanding this https://github.com/LauJensen/clojureql/blob/master/src/clojureql/sql92compiler.clj - There are a few conventions in the AST which might trip you up, so catch up with me here or in #clojureql and I'll be happy to help out
03:13bobo_LauJensen: are the functions intentionaly that long, or was it hard to get them shorter? (havent read the code to carefully)
03:14LauJensenbobo_: Basically the compile function takes a table object and converts it into a string representation (vector actually, but thats a detail). It makes for an easier read to have all components in a single function. The caveat is, that the table object, might container joins (which is why we have build-joins) and it might be part of union, in which case it has both its own properties and those of the entire union.
03:15bobo_I dissagree with the easier read part. But maybe its a matter of taste
03:16LauJensenTry reading some of Rings source. Every two lines is split into its own function (roughly), which means you're constantly scrolling up and down and looking in other files to understand the most basic functionality.
03:17bobo_ctrl+click and alt+rightarrow
03:17bobo_*leftarrow
03:17tomojLauJensen: scrolling? :P
03:17LauJensentomoj: You get the idea. You cant just read a function and be done with it
03:17bobo_When reading a function, i want to know what it does first
03:18bobo_then if it matters to me, i want to know how it does it
03:18bobo_if i first have to understand how, and then get to know what. It is alot harder
03:18LauJensenI dont feel the same way
03:18bobo_as i said, matter of taste
03:18LauJensenbobo_: But when you write the H2 backend, you get to call the shots :)
03:18bobo_:-p
03:19bobo_If i had time, i would write a backend. I like the library alot. But time is not something i have =(
03:19tomojbobo_: what are those shortcuts from?
03:20bobo_tomoj: netbeans, im not acculy sure if it works in enclojure.
03:20LauJensentomoj: Where is that screencast you promised me?
03:20bobo_tomoj: but anyway, my main point was lack of tooling is not a reason to make "ugglier" code.
03:21tomojhopefully less than a lightyear away
03:21tomojbut perhaps nowhere at all :1
03:22LauJensentomoj: perfect. I like the fact that I tell an advocate of trainingwheels that if they can make a convincing screencast I myself will start using trainingwheels, and almost 6 months later, still no such video can be produced :)
03:23tomojaww, don't blame paredit for my failures
03:23tomojand, 6 months, really? shit
03:24bobo_LauJensen: can you make a video showing why you dont need paredit? Ive started liking paredit lately
03:25LauJensenSure I could
03:25LauJensenActually, it makes more sense the other way around, since paredit is an extra tool which complicates editing
03:25bobo_paredit is realy realy annoying sometimes. But mostly it makes it easier to edit
03:25tomojyeah, I think we have the burden of proof
03:26tomojI feel like I should just record my coding sessions so I can go back and actually see how I use paredit, pick out interesting stuff and rerecord
03:26bobo_This might sound weird. but i like everything except the enforcing of matching parens
03:26tomojwould be nice to record the actual text changes and not a video initially
03:27LauJensentomoj: sounds like a noble idea - I'll check back in 6 months and see if you've made the case for trainingwheels by then
03:27tomojwhen you don't have matching parens, don't most paredit commands break?
03:33Berengal_workIs there a nice way to load an entire project into swank at once?
03:34tomojwhy?
03:34clojurebotwhy not?
03:34Berengal_workPreferably without ruining namespaces
03:35Berengal_workSo the nice describe-foo and jump-to-foo functions work in slime
03:36tomojthe describe functions don't seem to work at all for me
03:36tomojmaybe I'm not using them right
03:37tomojdoes your project have many entry points?
03:38tomojand I guess you want to M-. and type in a function to jump to manually?
03:39AWizzArdAny compojure users here?
03:39AWizzArdOr Jetty users that is.
03:39Berengal_workHmm, yes, but slime probably doesn't understand the namespaces enough
03:40AWizzArdIn Compojure my handlers can return a string or vector or number or map, and those return values are then translated into a http response.
03:40AWizzArdI however would like to stream a response. Possibly tens of thousands of rows from a sql request.
03:40tomojif the function isn't loaded, I guess C-x C-f and C-s is more work than M-. with manual entry after the hypothetical "load entire project"
03:41tomojpersonally never find myself using M-. with manual entry
03:41AWizzArdSo, I would like to force it to send out the headers, but not yet the body. Instead I would like to grab the (body) output stream S and have my handler function write directly into S.
03:41Berengal_workM-. and C-s are about the same in terms of efficiency
03:42Berengal_workI think the problem with M-. is that it doesn't namespace-qualify the symbol, so if you haven't loaded it unqualified, it won't work anyway
03:42Berengal_workAnd loading the entire project unqualified might not work properly
03:44Berengal_workBy the way, (->> (all-ns) (remove #(re-matches #"user" %)) (map (comp require symbol str)))
03:44Berengal_work*(str %)
03:46tomojwon't (all-ns) only return ns's you don't need to require anyway?
03:52tomojBerengal_work: what do you mean about namespace-qualification? you're in ns foo, you want to jump to bar/bar, and you type `M-. bar`?
03:53tomojbad example since that jumps to the namespace
03:54tomoj`M-. bar/bar` seems to work fine
04:03Berengal_worktomoj: It seems I'm confused
04:04tomojprobably me
04:05Berengal_workNo, things didn't work as I expected, so obviously I've got the wrong idea about something
05:27Gigarobyguys is there a function to add a element in a point of a sequence ? like (add-to [1 2 3] 1 "a") -> [1
05:27Gigaroby-> [1 "a" 2 3]
05:28raeknot for doing it in constant time
05:29GigarobyI work on small seq's does not matter
05:29Gigarobyso I assume it does not exist ...
05:30raekit is still possible to do
05:30raek(concat (take n s) x (drop n s))
05:30Gigarobyyep
05:30raek...where x is a collection of one
05:30Gigarobythanks
05:31raekwith vectors you can reuse everything up to the new element
05:32Gigarobyah
05:32Gigarobynothing
05:32Gigarobyall this
05:32Gigarobywas about
05:32Gigarobyinserting
05:32Gigarobyan element
05:32Gigarobyat the end of a seq
05:32Gigarobybut if I use a vector
05:33Gigarobyelements are add
05:33Gigarobyonly at the end
05:33raek(into (subvec v 0 n) (list* elem (subvec v n)))
05:33raekyes
05:33raek,(conj [1 2 3] :a)
05:33clojurebot[1 2 3 :a]
05:34Gigarobyyes in this program I just need to put and remove elements from the top
05:34Gigarobylike a stack
05:34raek(let [v [1 2 3], n 1, elem "a"] (into (subvec v 0 n) (list* elem (subvec v n))))
05:34raek,(let [v [1 2 3], n 1, elem "a"] (into (subvec v 0 n) (list* elem (subvec v n))))
05:34clojurebot[1 "a" 2 3]
05:35raekthen you can use 'conj' and 'pop' for pushing and popping
05:35Gigarobyyep
05:35Gigarobyinfact
05:35Gigarobythanks a lot
05:35raekthey work both for lists and vectors
05:35raek(although the work on opposite "ends")
05:35Gigarobyyep
06:10ordnungswidrigis there a common alias for partial? For complicated point free expressions the symbol "partial" is rather noisy. I, tend to use "§" but I'd like to see what others think
06:14hoeckordnungswidrig: thats the reason that I'm barely using partial
06:14AWizzArdordnungswidrig: I already suggested to use exactly that same symbol in 2008.
06:14AWizzArdUS keyboards can't produce it :)
06:16ordnungswidrig*g*
06:16ordnungswidrigbbl
06:30ordnungswidrigone could use a "ascii graphic" symbol like ->, say ! or <>
06:34mids
06:35ordnungswidrigmids: this would depend on the seasons (and on the geographic) location ;-) on australia at the same time you'd have to use ☼
06:35mids:D
06:47kjeldahlwDoes anybody know if interacting with SQL-Server through clojureclr is supported yet, and if there are any examples?
06:57AWizzArdHi rhickey.
07:02LauJensenkjeldahlw: You cant just use ClojureQL?
07:03zoldarhello, I'm trying to play around with a lightwieght networking framework (SpiderMonkey) written in Java. The problem is, that the serialization mechanism requires defining message classes with members. From what I see, gen-class allows only defining single state member object. Is there any way to explicitly define other class members?
07:06a_strange_guyzoldar: do the classes have to extend a specific superclass?
07:06zoldaryes, but superclass does not contain these members
07:07a_strange_guybleh
07:07a_strange_guyif you wouldn't have hadt to extend a class but an interface instead
07:07a_strange_guythen you could use deftype
07:08zoldarhmm
07:08a_strange_guy(deftype Foo [a b c])
07:08zoldaractually, there's alternative interface for extension
07:08a_strange_guythen use it
07:09a_strange_guywith deftype you can create a class with named field and implement interfaces
07:09zoldarthanks, I'll try that
07:11zoldarwhy gen-class prevents creating class members? only because of concurrency concerns?
07:13a_strange_guygenclass only creates a a wrapper class
07:14a_strange_guyeverything is delegated to the fns in the namespace
07:18zoldarthanks for clarification - one more question - per default, does deftype declare members as final ?
07:20a_strange_guymaybe
07:20a_strange_guybut you can make them utable by annotating the fieldnames with ^:unsynchronized-mutable
07:20a_strange_guy^mutable
07:28zoldarok, I'm screwed anyway, because there's no interface for message, message listener has one. Oh well...
07:29fbru02hey guys , lost my memory, what is a best way to zip values in two lists or vectors?
07:29fbru02i don't want a map so zipmap is not great
07:29raek(map vector coll-a coll-b)
07:30fbru02raek: thanks !
07:52jowagclojure.contrib.http.agent uses await internally, so (result (http-agent "some-url" ...)) may block indefinetly if underlying agent failed. Is there some workaround around this or I shouldn't use contrib.http at all?
08:40zoldarI'm trying to implement a java interface using deftype - here's my code: http://clojure.pastebin.com/JYV4hTzs , the interface definition itself: http://clojure.pastebin.com/cvrzGnqY . When I try to compile the clojure code, an exception is thrown: error: java.lang.IllegalArgumentException: Can't define method not in interfaces: messageReceived. I've tried adding type hinding for methods and arguments but it still doesn't work. What am I miss
08:40zoldaring?
08:40clojurebotoptimizing is http://clojure.org/java_interop#optimization
08:40zoldar*hinting
08:45chouserSince there's only one method for each name, you shouldn't hint the args to deftype.
08:48chouserzoldar: try removing your messageReceived doc string
08:49zoldarah
08:50zoldarthanks, that was it
08:51fogus`LauJensen: Cake should work.
08:55LauJensenfogus`: okay thanks
08:56LauJensenFor a moment, I was afraid that the cake was a lie
08:57fogus`Does it now work for you?
08:57kjeldahlwLauJensen: Regarding ClojureQL, does SQL-Server have a JDBC interface available (usually)? I'm not in control of the server...
08:57LauJensenfogus`: marginalia itself worked, I havent tried with cake - I asked because otherwise I might have contributed the task
08:58LauJensenkjeldahlw: looks like it http://lmgtfy.com/?q=sql-server+jdbc+driver&amp;l=1
08:58fogus`LauJensen: I haven't messed with Cake too much, but Justin added the task, so think it's good to go.
08:59LauJensenfogus`: should be as simple as adding a tasks.clj with (deftask mag #{} (run-marginalia ...))
09:00kjeldahlwLauJensen: If it's a separate download, it will not help in my case, but thanks anyway. I'll prod the server and see what it has available. I know ODBC is enabled, so maybe, just maybe... :-)
09:00fogus`LauJensen: Well then we're set
09:13shortlordI am trying to install vimclojure, but am stuck after installing the nailgun server using leiningen. How can I start it so that vimclojure connects successfully? all the documentation about vimclojure seems to be outdated, including both of the screencasts + website of the author
09:19jjidoAnyone knows of Clojure-related jobs in the UK?
09:21midsjjido: http://jobsearch.monster.co.uk/Search.aspx?q=clojure&amp;cy=uk&amp;lid=193
09:23jjidomids: right, thanks. Is there a more specialised site?
09:25tonyli just saw this yesterday http://functionaljobs.com/jobs/ but it has not open yet
09:26tonylmaybe looking at companies that use clojure and see if they have jobs available
09:27chouserI use Clojure at work, and we're hiring, but there's no guarantee you'd actually be using Clojure if you were hired. We have lots of Ruby and PHP as well. But it's a great place to work, regardless.
09:28chouserhttp://sentryds.com/
09:31jjidoThanks Chris, Tony
09:35chouserjjido: oh sorry, didn't notice you said UK. That might not work. :-/
09:55cemerickjjido: you might want to ask ejackson when he's around; he's in Cambridge IIRC
09:55jjidocemerick: thanks for the tip!
09:56cemerick:-)
10:13raekphilosophical question: are zippers and monads related on some level?
10:13ordnungswidrigraek: I'd say yes. however the exact details must be worked out :)
10:15raekthe idea of composing pure functions that represent mutations rings a bell... :)
10:17chouserzippers don't usually capture or manipulate functions
10:19chouseror use user-provided functions in any way other than when defining zippers on new types
10:19chouserbiab
10:52hugodfogus`: I added some initial maven support for marginalia https://github.com/talios/clojure-maven-plugin/issues#issue/28
10:52hugodrunning marginalia on pallet produced a >500K file
10:54fogus`hugod: Whoa! Thanks. :-)
10:54fogus`hugod: It produces big files by default at the moment because the gen'd file contains all of the js deps
10:55hugodok
10:55fogus`That stands to change
10:56fogus`hugod: BTW, Marginalia v0.3.0 is a bit better
10:58hugodfogus`: it would simplify maven integration a little if parse-project-file were called at the top level rather than within uberdoc!
11:05fogus`hugod: I'm happy to help Maven integration. What do you mean by "top level" main- ?
11:08hugodfogus`: run-marginalia would be sufficient - the current directory is different when invoked under maven, and the maven mojo contains code to specify the output path
11:08fogus`hugod: OK. Can do
11:10fogus`I'll push that out later today.
11:12hugodthanks
11:13fogus`hugod: No, thank you. :-)
11:22mduerksenis it just me or does noone need a data type for a symmetric relation?
11:46lpetitninjudd: ping
11:46lpetitoh, and hello, btw
12:09fbru02lpetit: hello !
12:10lpetithello, fbru02
12:14lpetitanyone using classlojure ?
12:19AWizzArdrhickey: I have a case where I would like to express (extend MyProtocolA MyProtocolB {:foo .. :bar ...}). But currently at the place of MyProtocolA I need a class or interface.
12:19AWizzArdAre there good reasons for not allowing protocols in that position?
12:20AWizzArdI can code around this. I just stumbled over this issue, but it is no show-stopper for me.
12:22lpetitAWizzArd: it's more being able to extend protocols to interfaces which seems weird :)
12:24AWizzArdMy macro generates Records that all implement ProtoB. I want all records that implement ProtoB be able to call methods of ProtoA too. In my case I can simply have my macro just let the records it generates also implement ProtoA. I just thought that a generic extension of A with B would be nicer.
12:27hiredmanI don't think that is likely, one of the design points of protocols was to keep a flat space
12:28lpetitAWizzArd: "Records implement ProtoB" is java-like "parlance". The right way to speak about it (if I'm not wrong) is "ProtoB is extended to Record Foo"
12:28AWizzArdlpetit: ok
12:29Islondoes anyone knows a easy way to add 2 maps? (add-map {:a 1 :b 3} {:a 3 :b 6}) -> {:a 4 :b 9}
12:29AWizzArdI wonder if there was a reason for (currently) not allowing to extend protos with other protos.
12:29lpetitAWizzArd: what does "I want all records .. be able to call methods of ProtoA too" ? I don't understand.
12:29lpetits/?/mean ?/
12:30lpetits/\?/mean \?/
12:30sexpbot<lpetit> s/mean ?/mean mean ?/
12:30lpetit:)
12:30mrBliss,(merge-with + {:a 1 :b 3} {:a 3 :b 6}) ;; Islon
12:30clojurebot{:a 4, :b 9}
12:30IslonmrBliss: thanks!
12:31AWizzArdlpetit: I have an instance of my record (ProtoB). I can call (foob my-rec).
12:31AWizzArdI want to be able to also (fooa my-rec)
12:32lpetitAWizzArd: my current understanding. Protocols define contract for abstract data types. So you can only extend them to real datatypes. That's why that's being able to extend protocols to host's (java) interfaces which seems weird to me then :)
12:33AWizzArdI want all records that extend B to also extend A. But not all records/classes that extend A require to extend B too.
12:33AWizzArdI now solve this by having my macro generate records that extend both, A and B.
12:33lpetitAWizzArd: I'd do the same
12:34AWizzArdBut if I could just (extend ProtoA ProtoB {...}) then my macro would only need to extend ProtoB as it did for days, until I just discovered that it requires to extend ProtoA too.
12:34AWizzArdI thought that when one can extend interfaces, then it should in principle be okay for other Protos too.
12:35KirinDaveArgh
12:35KirinDaveThe worst part about working with Scala is that Scala programmers seem to hate convenience.
12:35lpetitAWizzArd: well, we'll have to wait for Rich's answer to get the final word :)
12:35KirinDaveClojure; has a shell-out library standard. Because it comes up, and the java way is repetitive and tedious.
12:35KirinDaveScala; "Just call Runtime"
12:36lpetitKirinDave: so you have generalized this example into a definitive opinion 'bout "Scala programmers" and "Scala" in the large ?
12:37KirinDavelpetit: This is a great example of why I love clojure contrib.
12:37KirinDavelpetit: But yes. I have. isthereaproblem.com?
12:38lpetitnotforme.net
12:38KirinDavelpetit: I like Scala a lot. It's fun and interesting. Until you do something you've done a thousand times before with not a whit of help from the language and ask, "Wait... why isn't this part of the stdlib?"
12:38KirinDaveIt comes up a lot more than it does for Clojure or Groovy or JRuby.
12:40lpetitKirinDave: Interesting. So it's not just about this one example you gave. Thx.
12:42KirinDavelpetit: it's a recurring theme. Wanna see what I am talking about? Lift is another good example. Premiere scala web framework, right? Go to getting_started
12:42KirinDaveTry not to tear your face off after the first paragraph. It's difficult, but resist
12:43KirinDaveEven better, know that there actually _is_ a link to a much slower, more measured tutorial to lift ON THAT PAGE. Also know that almost no one finds it because it's difficult to find. :\
12:46lpetitKirinDave: simply lift, at the end, is that it ? :-)
12:47KirinDavelpetit: Yeah, but their link styles make it hard to find.
12:47KirinDaveAnd it's not simply Lift
12:47lpetitKirinDave: indeed, we're far from an hello world example.
12:47KirinDaveThat's the same damn tutorial in a pdf
12:47KirinDaveIt's Exploring Lift, the second link.
12:47lpetit!
12:48apgwozi was playing code golf this morning with recursive quick sort. if you don't worry about StackOverflow errors and use the naive solution, how small can you get it?
12:50apgwozhttps://gist.github.com/769825
12:50apgwoz
12:50apgwoz
12:50apgwoz
12:50apgwoz
12:50apgwoz
12:51KirinDavefogus`: Face. Off. Faceoff. http://fayr.am/3unw
12:54BerengalWhy does clojure-mode color (rename) differently from (forget)?
12:54apgwozKirinDave: I once tried to write hello world using lift, and i came to the conclusion that it's a humongous pile of overengineering.
12:55fogus`https://gist.github.com/769828
12:55amalloyBerengal: it has a list somewhere of library functions
12:55apgwozKirinDave: but, you should check out nathan hamblen's unfiltered: https://github.com/n8han/unfiltered
12:55Berengalamalloy: But rename isn't in the standard library...
12:55BerengalWell, at least not in clojure.core
12:56fogus`apgwoz: Slight modification :-)
12:56amalloyBerengal: clojure.set
12:56apgwozfogus`: yeah, for some reason i didn't even think of using filter/remove d'oh
12:57fogus`apgwoz: It's definitely not efficient, BUT I love that code because it draws a picture of what qsort does
12:57Berengalamalloy: Okay, but why color it differently than other functions, like (comp)
12:57amalloyhttps://github.com/technomancy/clojure-mode/blob/master/clojure-mode.el#L481
12:57amalloyBerengal: that, i don't know. i think it's silly personally
12:58apgwozfogus`: yeah, the purpose wasn't efficiency. someone sent me qsort in erlang, and asked what it looked like in clojure.
12:58Berengalamalloy: I'd much rather it colored functions that were in scope...
12:59amalloyBerengal: that's kinda hard,even if you let clojure-mode depend on swank/slime
12:59amalloybut feel free to do it yourself
13:00lpetitfogus: answer sent via github msg
13:00Berengalamalloy: When my annoyance threshold is reached :)
13:01amalloyBerengal: technomancy took over clojure-mode from jochu, and i've sorta read it over myself, but i don't think either of us really knows how it works
13:04Berengalamalloy: I barely know how to concatenate strings in elisp, so it might take me a while
13:04amalloyyeah, same here
13:04lpetitargh
13:04lpetitfogus`: ^^^
13:04amalloyBerengal: if you figure out how indentation works, let me know. there's a change i'd like to make, and one joshua__ wants too
13:06Berengalamalloy: The one where sometimes it indents one tab, other times it aligns the tail of the form?
13:06amalloyBerengal: eh? i'm not familiar with that behavior
13:07amalloyi have a bone to pick with the indentation of ((juxt + -) 10<RET>5)
13:08hiredmanamalloy: the fuxt just produces takes a single arg
13:08hiredmanjuxt
13:08hiredmangeez
13:08hiredmanthe fn juxt produces …
13:08amalloyhiredman: ##((juxt + -) 10 5)
13:08sexpbot⟹ [15 5]
13:09lpetit,(doc juxt)
13:09clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
13:09hiredmanah well
13:09amalloybut even if you were right, clojure-mode doesn't know that; it just doesn't want to indent (( as a function
13:09hiredmanamalloy: you forget I find sexpbot annoying and have it on ignore
13:09amalloyhiredman: heh, so i did
13:09Berengalamalloy: (for [x y]<RET>(println x<RET>y<RET>z))
13:10amalloy,((juxt + -) 10 5)
13:10clojurebot[15 5]
13:10hiredmando you have back tracking indenting turned on?
13:10hiredman(cause you really should)
13:10amalloyBerengal: that indents fine for me
13:11amalloyhiredman: i'm not sure. i remember discussing it once but i don't know how to check if it's on
13:11lpetithiredman: can you tell me more about back tracking indenting ?
13:11Berengalamalloy: It's fine, but it's inconsistent as far as I can see.
13:11hiredmanlpetit: it indents things better
13:11hiredman*shrug*
13:11amalloyBerengal: ?? looks perfectly consistent
13:11lpetithiredman: so helpful ;)
13:12hiredmanI've had it on forever now, I don't remember what it's like without it
13:12amalloyyou mean that for indents by one indent instead of lining up with [x y]?
13:12hiredmanI seem to recall protocols and letfns not indenting correctly
13:12lpetithiredman: oh, it's backtracking for getting more context before choosing an indenting strategy ?
13:12lpetits/indenting/indentation/
13:12sexpbot<lpetit> hiredman: oh, it's backtracking for getting more context before choosing an indentation strategy ?
13:12Berengalamalloy: yes, while println aligns the arguments
13:13amalloyBerengal: there's a list of special-case indents, used mostly for "control-flow" type functions
13:13hiredmanfor has a binding form, and most (if not all) indent like that
13:13hiredmanlet,with-open,binding,for,etc
13:14BerengalIt annoys me a bit that I can't get my own macros to indent like that
13:16BerengalPerhaps I could get it to cycle indents...
13:17hiredmanBerengal: clojure-mode does special case indenting macros that start with with-
13:17amalloyBerengal: untested, but (put 'mymacro 'clojure-indent-function 1) should work
13:17amalloyor at least be a step in the right direction
13:17Berengalhiredman: I think I've noticed that
13:17Berengalamalloy: Not portable between different environments, unfortunately
13:18amalloyno, and you're unlikely to find a strategy that is, sadly
13:18BerengalWould having tab cycle between indent-one (binding style) and allign (funcall style) befine?
13:18raekordnungswidrig: thanks for the link! reading it now.
13:18Berengalalign*
13:19lpetitBerengal: would ease the pain for sure
13:19amalloyBerengal: i doubt it. there are a lot of other things that perform indent logic
13:19amalloy<RET> does a reindent, M-q reindents the whole defn...
13:19Berengalamalloy: This is only for regular list forms
13:20Berengalamalloy: You could keep the current logic for finding the first indent in the cycle
13:21amalloyBerengal: my point is, if you do some magic with tab's indenting, a RET will screw you up
13:21lpetitamalloy, Berengal: in emacs with clojure-mode, if you call reindent on a line, does it also reindent correctly the following lines as necessary ?
13:21amalloyit's probably possible to do in the long run, maybe even correctly, but i'd rather spare myself the grey hairs
13:21amalloylpetit: yes
13:22amalloylpetit: though if the following lines were indented in a "non-standard" way, it reindents them to standard
13:22amalloywhich i don't love, but i can live with
13:22lpetitamalloy: oh so that's far from perfect. IMHO it should just shift the following lines to make them follow the new column of the current line
13:23tomswEvening all. Is there a better way to do this: (take-while identity (iterate #(.getParentElement %) n))?
13:23tomswall I want to do is get a finite list of ancestor elements
13:23amalloytomsw: that's a function a lot of people have written a lot of times. it's not in clojure.core, but it might be in contrib somewhere
13:24amalloylpetit: i agree. feel free to make it one of the places where CCW is better than emacs :)
13:24ordnungswidrigi'm looking for a simple persistent work queue in clojure. any ideas?
13:24lpetitamalloy: totally on my todo list, already :-)
13:24tomswamalloy: reassuring to know I'm in company
13:24ordnungswidrigor shall I go with rabbitmq or like that
13:25mduerksentomsw: in case you have to do it yourself: take (keep ... instead of (take-while identity
13:25amalloymduerksen: that's a very different behavior, isn't it?
13:25mduerksenamalloy: i just realized :(
13:26mduerksentomsw: forget what i said :)
13:27tomswmduerksen: no worries, I made exactly the same mistake about 10 mins ago
13:28fogus`lpetit: Thanks for the link. I will look at the code this weekend.
13:29lpetityou know you've done too much clojure .... when you type (cake repl) in your bash terminal :)
13:29amalloylpetit: (join #hadoop) :)
13:30lpetitfogus: impl. details are a moving target (eg regexeps), but grammar shape currently pretty stable (heh, paredit.clj is based on it, so it must be ;) )
13:30ordnungswidriglpetit: there is a lisp shell IIRC
13:30ordnungswidriglpetit: http://clisp.sourceforge.net/clash.html
13:31lpetitordnungswidrig: no thanks :)
13:32tomswmduerksen: but identity isn't really the opposite of nil?
13:32raekordnungswidrig: there's always clojure.lang.PersistentQueue
13:32ordnungswidriglpetit: or, hmm, build sime macros and use the repl as your shell!
13:32raekor, what did you mean by "persistent" in this case
13:32raek?
13:33ordnungswidrigpersisting over jvm restart :-)
13:33mduerksentomsw: no, as predicate it isn't when value's can also have the value false
13:33ordnungswidrigI need a simple work queue that persists even when the jvm restart.
13:34raekah, then ignore that suggestion... :-)
13:35ordnungswidrigraek: I did :-)
13:53hiredmanclojurebot: pidgin | was | developed by mayans
13:53clojurebotIk begrijp
14:05Hoornetclojurebot: help
14:05clojurebothttp://www.khanacademy.org/
14:09bendlashey folks
14:10bendlasquick question: would be
14:10bendlas,(contains? (transient {:a 0}) :a)
14:10clojurebotfalse
14:10bendlasconsidered a bug?
14:11lpetitbendlas: no
14:12bendlasso there is no way to distinguish non - containment from a nil value?
14:12bendlason a transient?
14:13Guest79031how can get from a hash with a lot of hashes inside it the value of a given key?
14:13Guest79031in an arbitrary level
14:13Guest79031is there any way to do that?
14:13bendlasGuest79031: get-in
14:13ordnungswidrig,(keys (transient {:a 0}))
14:13clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentArrayMap$TransientArrayMap
14:13raekGuest79031: sounds like 'get-in'
14:13bendlas,(doc get-in)
14:13ordnungswidrigaha
14:13clojurebot"([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of ke(ys. Returns nil if the key is not present, or the not-found value if supplied."
14:14lpetitbendlas: nope
14:14lpetitonly a few commands can operate on transients
14:14raek,(get-in {:a {:b {:c 1}}} [:a :b :c])
14:14clojurebot1
14:14lpetits/commands/functions/
14:14sexpbot<lpetit> only a few functions can operate on transients
14:15ordnungswidrigGuest79031: -> is your friend as well
14:15ordnungswidrig,(-> {:a {:b {:c 1}}} :a :b :c )
14:15clojurebot1
14:15bendlaslpetit: so what about dropping in those \! and wrapping it in #(persistent! ... (transient %))
14:15Guest79031get-in it's not working for me with this hash -> {10 {:users #{"adm" "gerente"}, :name "req-1"}}
14:16Guest79031i'm trying to get the :name value
14:16bendlasisn't that how transients should work?
14:16markskilbeckordnungswidrig: so elegant.
14:17raek,(get-in {10 {:users #{"adm" "gerente"}, :name "req-1"}} [10 :name])
14:17clojurebot"req-1"
14:17Guest79031hmm...i see...but i don't know a priori how's that structure
14:17raek-> is a good replecement for get-in when all the keys are keywords (as they are functions)
14:18ordnungswidrigGuest79031: sorry, this works only for keyword keys
14:19raekGuest79031: what do you have, and what do you want to obtain?
14:20bendlasordnungswidrig: about (-> {} transient keys), I get that you can't have seqs on transients
14:20cemerick,(get-in {10 {:users #{"adm" "gerente"} :name "req-1"}} [10 :name])
14:20clojurebot"req-1"
14:20bendlaswouldn't go well with lazyness
14:20cemerickGuest79031: ^^
14:21ordnungswidrigbendlas: -> was thought as an alternative for get-in
14:22bendlasordnungswidrig: I use it mostly to reduce nesting
14:22bendlasand destructuring let for get-in stuff
14:23ordnungswidrigbendlas: desctrucuring is nice
14:24bendlasyes, I like that it's a distinct concern from cond - stuff in clojure
14:24RaynesAre there plans to move the getting started pages from assembla to confluence?
14:26cemerickRaynes: there's an open invite for people to move stuff over. Presumably, those responsible for each environment would take the lead on that.
14:26cemericks/an/was
14:26sexpbot<cemerick> Raynes: there's was open invite for people to move stuff over. Presumably, those responsible for each environment would take the lead on that.
14:26RaynesHell, I'll do it.
14:26RaynesI really hate linking to things that are outdated.
14:26RaynesWell, not outdated, but you get the point.
14:29cemerickRaynes: FYI: http://groups.google.com/group/clojure-dev/browse_thread/thread/53ea0d2aa36b19fb
14:29cemerickso, make sure there's redirects in place @ assembla
14:32fogus`hugod: Better? https://github.com/fogus/marginalia/commit/19b665e42ddfa29b8d8ca79e4b3e67313f278ef1
14:33Raynescemerick: Indeed. /me pings stuart for an injection of clojure-dev into his confluence account.
14:33hugodfogus`: yes - should be able to use uberdoc! now :)
14:34fogus`hugod: Thank you for pulling that Maven support together. Can't wait to try it out.
14:34clojurebotclojure-maven-plugin is http://github.com/talios/clojure-maven-plugin
14:34Raynesclojurebot: Thank you. I'm sure he desperately needed to know that.
14:34clojurebotCool story bro.
14:37fogus`hugod: BTW, I bumped the version number to 0.3.2
14:38eyerisIs clojure-clr's clojure.compile.exe supposed to create a .exe file? All I get is a .dll file, but I've read posts on the mailing lists that imply that it should create a launcher .exe
14:38Raynescemerick: I suddenly have mvn. Magically, even. I remember conceding to the gigantic download and deciding to wait until I really, really needed it to download it over this lowly connection.
14:39RaynesBut the Maven gods hath smiled upon me and I have it now.
14:40RaynesMaven really does have a mind of it's own, huh? Should I be frightened? Do I need to sacrifice animals to keep it happy?
14:40cemerickRaynes: whoa. Surely this is a sign of the end times upon us?
14:40cemerick;-)
14:40Raynes(:
14:40hugodfogus`: I'll update the mojo
14:41cemerickRaynes: re: mind of its own: generally, the aim is to avoid thinking about things you really don't care about anyway.
14:43ordnungswidrigcemerick: if the project is large enough maven forces me to think about thins i really don't care about
14:44cemerickI disagree.
14:44cemerickUnsurprisingly.
14:45RaynesWhoa. Can you even disagree with that? I'm not sure that statement was even eligible for disagreement. :o
14:46RaynesThe only thing keeping me going is the assumption that, with my simple needs, I shouldn't have to do much XML tweaking if clojail ends up in contrib.
14:47RaynesXML is like a phobia for me. Like with arachnophobia.
14:47RaynesI'm sure it'll pass.
14:58chousercemerick: oh, you're around. I should be talking to you.
15:00cemerickchouser: hi :-) about?
15:00chouserreleasing finger tree
15:01stuartsierrachouser: tell people to listen to me
15:01chouserEveryone should listen to stuartsierra. He knows what he's talking about, even if I don't.
15:01cemerickstuartsierra: is/will there be a an opportunity for a quorum on various issues?
15:02stuartsierraJust build issues, or general issues?
15:02cemerickif so, I should be able to bribe chouser appropriately ;-)
15:02cemerickI'll take what I can get.
15:04chouserso, what *are* we talking about?
15:05mattmitchellcould someone recommend an activerecord-like lib?
15:05gtrakyes
15:05bendlasmattmitchell: clojureql
15:05mattmitchellbendlas: great thanks
15:26shortlordhow can I thread integers through nested maps using "->"? I have defined a map placements with integers as keys, (placements 8) works, (-> placements 8) fails:
15:26shortlordjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)
15:27hiredmando you know what -> does?
15:27RaynesI don't think so.
15:27amalloyshortlord: ((comp m1 m2 m3 m4) 8)?
15:27amalloyor (-> 8 m1 m2 m3 m4) if you're in love with ->
15:29hiredmanmy suggestion is a meditation on the macroexpansion of ->
15:32shortlordwell, I looked at this example here http://clojuredocs.org/clojure_core/clojure.core/-%3E where it was used to pull something out of deeply nested maps, but I guess I have misunderstood it then
15:34raekshortlord: -> happens to work similarly to get-in when the keys are keywords
15:34raekas keywords work as functions
15:34raekbut integers do not
15:34amalloyshortlord: yeah my example is not what you want; i mis-guessed your goal when your example had only one integer and one map
15:34raek(:a m) is the same as (get m :a)
15:35raek(-> m :a :b :c) becomes (:c (:b (:a m)))
15:35Raynesshortlord: (-> 1 (+ 2) (* 3)) = (* (+ 1 2) 3)
15:36raekfor keys 1, 2 and 3, you'd want (get-in m [1 2 3]) which could be written as (-> m (get 1) (get 2) (get 3))
15:36Raynesraek: A major part of the macro chapter in my book is implementing -> with and without syntax quote. I figured I could kill two birds with one stone, since I'm not only teaching macros but I'm also teaching -> :>
15:37afekzcould anyone suggest a direction for me to explore doing the following idiomatically: selecting records from two different data sources and attempting to match each entry one against the other, where there is no unique ID field and a consolidated field may match twice (but I want to pick up duplicates)...
15:37amalloyRaynes: without syntax-quote is tricksy
15:37Raynesamalloy: I dids it.
15:37afekz(it's the matching part I'm asking about, really... the queries/etc are fine)
15:37RaynesIt wasn't that bad.
15:38shortlordok, thx for all the help, I guess I have understand what -> does now :)
15:43alpheus-> makes me feel like I'm reading Lisp backward
15:43raek-> makes me feel like I'm reading Forth forward
15:43Raynesraek: o.
15:43Rayneso/
15:44RaynesYou'd think after several months of using a blank keyboard, I'd make typos much less often.
15:44amalloyRaynes: i've been using a keyboard i can't see for like five months and i still can't type for shit
15:44gtrakdoes that help productivity?
15:45cemerickRaynes: I think they make keyboards that have the letters printed on the keys. I've got one, they're cool.
15:45Raynesgtrak: No, but it helps to annoy people who aren't touch typists.
15:45RaynesAnd that's plenty reason for me to use it.
15:45RaynesAnd wooby gave it to me, so it's extra extra special. <3
15:45Crowb4rIt also makes using an alt. layout easier because you have a blank slate.
15:46Crowb4rsuch as Dvorak, or something else.
15:46amalloyCrowb4r: that's only relevant if you're a sissy who looks at the keys
15:46Crowb4rfor instance I use US layout, Coder-Dvorak and Russian.
15:46amalloymy keyboard is under my desk, invisible
15:47Raynesamalloy: Under the desk? Do you type with your feet?
15:47gtrakhow is using dvorak on a blank keyboard any easier?
15:47Raynesgtrak: Because looking at the keys don't confuse you, I suppose. And it isn't just plain weird to switch the keys around.
15:47amalloyRaynes: hanging from the bottom surface of the desk
15:48gtrakyea, i guess there's an efficiency gain there in the context-switching of your mind :-)
15:48RaynesI'm in love with das keyboards now, but I've gotta say, these things aren't meant to be cleaned. I took the keys off to clean it before realizing that not all of the keys are the same. ._.
15:48amalloyhahaha
15:48RaynesI'm still not entirely certain I've got them back on right, but I'm pretty sure.
15:48RaynesThree hours worth of work, anyway.
15:49RaynesI don't know what Alan did with this keyboard over the years, but there was enough hair under these keys to make a wig. I couldn't get it all out with a vacuum cleaner.
15:54linusericssonis there a clojure wrapper for Central Authentication Service (the Yale single sign-on protocol)?
15:56amalloydoes anyone think it makes sense for (-> blah ()) to expand to (blah) instead of (nil blah)?
15:57hiredmanit's really (cons (first ()) (cons blah (rest ())))
15:58amalloyhiredman: i know that's what the implementation looks like, but it could special-case () since (nil blah) is guaranteed to be wrong
15:58raekRaynes: I had to try to implement -> without ` too: https://gist.github.com/770086
15:58amalloywhereas (blah) is occasionally useful if the previous form results in a thunk
15:59hiredman(-> blah (apply nil))
15:59amalloyhiredman: i suppose that's an option, yeah
16:01Raynesraek: I stuck very, very close to the original implementation of ->.
16:04raekhrm, better to check for seq? rather than symbol? ...
16:05raekis -> found in many lisps?
16:13shortlordgiven a ref and a function in the same namespace, that needs to alter that ref. is it better style to pass the ref as an argument or simply alter it, because it's in scope anyway?
16:14shortlordthe function is not pure anyway, so I guess it does not make it a bad style not to pass the ref as an argument, right?
16:15amalloyshortlord: you'll have less pain refactoring/improving later if you pass it in
16:15amalloycause eventually you'll discover some solution that's better than having a global ref
16:16lpetit"I’ve noticed that it seems that people are doing a lot of data intensive work like Clojure because it just focuses on that problem of manipulating data, which I think is great. You can certainly write services of any kind in Clojure if you like"
16:16amalloyor you'll want to reuse this library for more than one thing at a time, or...
16:17lpetit^^ How would you qualify this apparently genuine attempt to narrow the usability of clojure to some niche ?
16:17lpetitWhat would be the exact term ? It's not FUD, even more subtle than that.
16:18shortlordamalloy: ok, I'll pass it as an argument then, thx :)
16:19cemericklpetit: I don't think saying X is good for Y necessarily implies that X isn't good for Z.
16:20lpetit"it just focuses"
16:20lpetitfor more context : http://www.infoq.com/interviews/wampler-scala
16:21cemerickI haven't watched the vid, but I think you're reading more than you should into "just".
16:21cemerick"just" isn't, e.g. "merely"
16:21lpetitwould be like answering a question on scala: "yeah, scala is really good at writing concurrent programs, for which task it seems tailored to".
16:22cemerickSee, that doesn't sound negative to me in any way. :-)
16:23hiredmancemerick: just is often used as a sort of passive aggressive pejorative
16:23lpetitmaybe. I try to see this from the eyes of somebody who has almost never learned 'bout clojure. And I might get the impression that Clojure is not general purpose, but has a bias towards data manipulation, as if it were some kind of dsl for an ETL.
16:23cemerickhiredman: yeah, but given the latter part of the statement that lpetit quoted ("you can certainly…")…?
16:25hiredmanit's somewhat amusing given how many people mused about "a dynamic language like clojure on the frontend and a static lanague like scala on the backend"
16:25hiredmanwhen most people are really doing ruby on the frontend and clojure on the backend
16:27cemerick…due more to staffing concerns than anything else, I presume.
16:27lpetitanyway
16:27hiredmanI like to think it's because writing scala is horrible
16:28cemerickI was meaning the ruby:clojure pair, vs. full-stack clojure.
16:56BerengalWhat should I name a function that takes a map, a function, a vector of keys in the map and a vector of new keys and produces a map with the keys in the first vector replaced by the keys in the second, their values being mapped to the return values of the function called with the values of the first keys?
16:58Berengal(foo {:a 1 :b 2 :c 3} [:b :c] [:sum :diff] (fn [b c] [(+ c b) (- c b)])) => {:a 1 :sum 5 :diff 1}
16:59tonylreplace-keys ?
16:59qbgThe fn returns a vector? That seems strange
17:02BerengalEh, I'm not sure if this is the best function either...
17:02BerengalWould it feel more natural to add the extra keys, then remove the now-superfluous keys?
17:03fbru02_hey guys i have more an architecture question anyone up to it?
17:03Berengalqbg: The vector is for multiple return values
17:04qbgBerengal: My point it that it would seem better to me to map the function over the values, not apply it to the values
17:04qbgI suspect you are trying to do something really strange
17:04Berengalqbg: It takes them all as input at once. A simple map won't do
17:05BerengalAnd well, sort of strange
17:05qbgThis function feels a bit *too* specific
17:06Berengalqbg: Actually, it's pretty general. It can be used to both add and remove keys
17:07BerengalI'm experimenting with relations
17:08fbru02_ok here it goes anyway, i have a java system , that we want to break up , make it less monlothic, and we have new development we are doing in clojure. How should all these parts speak ?
17:09qbgInterfaces?
17:09BerengalInterfaces are good
17:10tonylfbru02_: there are a lot of variables that go into making that decision
17:10tonylspecially what you mean by system and parts
17:11fbru02_tonyl: let's suppose we have total control over the source code of these parts
17:13BerengalAre you using clojure as a glue language?
17:13tonylfbru02_: then I would go by what qbg and Berengal say, interfaces and datastructures. datastructures to be shared among the parts and interfaces/protocols to manage what to do with those datastructures and how to share them
17:14fbru02_tonyl: Berengal I wasn't following your conversation guys, i will go back and read it , but yes that was my hunch, using clojure as glue
17:16Berengalfbru02_: What I'd do is not let the java parts interact directly. Instead, let them provide a decent interface to clojure, and let clojure worry about the interoperability between the different parts
17:16BerengalBut obviously I don't know the details
17:16fbru02_Berengal: makes sense
17:17qbgfbru02_: Is Clojure conceptually running the system or is Java?
17:17fbru02_what transport/data protocol should i use ? clojure sexps ?
17:17fbru02_qbg: right now Java
17:18qbgfbru02_: Even after you do new development in Clojure?
17:19fbru02_qbg: at first yes, code base is still huge...
17:21qbgHow do you see Clojure being used as glue then? Is there some configuration component you will be (re)writing in Clojure?
17:23fbru02_qbg: this new component that we will write in clojure , will need some parts of the Java legacy code , I see us coding some sort of wrapper api for this part of the legacy code
17:23fbru02_do i mae sense at all?
17:25TakeVIs it possible to do Android programming with Clojure? I know Android doesn't use the JVM, but it does use Java.
17:26qbgWhat I'd try to do then is in Java create the interface(s) that the Clojure code will fulfill and then use the tools in Clojure to create class(es) that implement the interface(s)
17:27emn3mjoin #starcraft2
17:27emn3moops
17:27RaynesTakeV: http://dev.clojure.org/display/design/Android+Support
17:27emn3msorry
17:28technomancyemn3m: construct additional pylons
17:28wdouglaslol
17:28fbru02_qbg: how about out of process components, how should i expose an api from one clojure system to another ?
17:28TakeVRaynes: Awesome, thank you.
17:28emn3mtechnomancy: it's lack of overlords that usually is my problem
17:28Raynestechnomancy: o/
17:29technomancy\o?
17:30RaynesReturning a high five whilst scratching one's head?
17:30Berengal,(binding [+ -] [(+ 3 2) (let [f +] (f 3 2))]) ; Someone explain this?
17:30clojurebot[5 1]
17:32raekBerengal: the arithmetic functions are treated specially by the compiler and cannot be rebound
17:32Berengal:(
17:32qbgraek: Actually they are just inlined
17:33tomoj,(binding [+ -] [(+ 3 2) (+ 3 2 1)])
17:33clojurebot[5 0]
17:33raekah
17:33tomojheh
17:33qbgFor special cases as tomoj points out
17:34BerengalSeems that could blow someone's toe off...
17:34qbg,(binding [+ -] (#'+ 3 2))
17:34clojurebot1
17:35hiredmanwith 1.3 unless a var is explicitly dynamic you won't be able to rebind it, and I doubt + will be dynamic
17:35qbgBerengal: I'd think (binding [+ -] ...) would have a much greater chance of blowing someone's toe off
17:36Berengalhiredman: True, I forgot about that
17:36RaynesBerengal: If you accidentally use binding and rebind something as common as +, you've got more problems than Clojure allowing you to blow toes off.
17:36qbgYou may want to checkout with-redefs
17:36qbgIn 1.3
17:37Berengalqbg: Well, I'm trying to build an AST, and I was hoping I could just do it with functions instead of having to either introduce new ones or write a huge macro stack for the entire DSL
17:39BerengalAlso, I'm way to tired to be thinking about implementation details now it seems...
17:39qbgBerengal: So you want (+ 1 2) => (ast-+ 1 2) or something like that?
17:39qbg(by => I mean evaluate)
17:39BerengalYepp
17:40qbgHere is an idea:
17:40qbgCreate a new namespace excluding clojure.core
17:40qbgThen write a small macro to intern a new fn in the namespace for everyone in clojure.core that does what you want
17:41lpetitto simulate referential transparency, withing increasing the used heap forever, so to speak
17:41qbgThen if you evaluate your code in that namespace, it should do what you want
17:42Berengalqbg: So, write a macro that sneakily evaluates the body in that different namespace, is that what you're saying?
17:43qbgOr a fn to do (binding [*ns* (find-ns '<your ns>)] (eval <code>))
17:43qbgIf the loss of lexical scope is okay
17:44lpetitBerengal: yep, exclude clojure.core, require it as e.g. "c" or "core" or "clojure" instead. "require" or "use" your namespace fulll of DSL helper functions. And let your favorite IDE do its magic only offering you, and your users, the minimalist DSL-oriented completion assistance :)
17:44lpetitthat is, if you can isolate DSL code in its own dedicated namespaces
17:44linusericssonIs there a way to take in a lot of arguments in a compojure POST-route whichout explicitly name every variable? Like an & argv?
17:45Berengalqbg: I'm not sure if it is
17:47Berengalhttp://clojure.pastebin.com/n9g8XyCQ <- here's a small example of what I'm trying to do
17:48BerengalI still need to figure out if I can do it without wrapping the whole thing in a macro...
17:49qbgSo join, restrict, etc. are not functions/macros?
17:49BerengalI hope they'll be functions
17:51BerengalFrom relations to relations that is
17:51qbgYou want to perform this transformation so your math in join, transform-attributes, etc. works correctly?
17:51BerengalYep
17:52BerengalMaybe it could work if I made some specific ones macros...
17:52qbgAre you against having join, restrict, etc. be macros that will expand to a use of a functional version of themselves?
17:53BerengalNot as such, but it would be nice to be able to parameterize e.g. the restriction
17:54BerengalSo you could do (fn [& restrictions] (apply restrict some-relation restrictions))
17:55BerengalThat would require either a new restriction-builder macro, or more likely, a more bothersome explicit-ast approach
17:55qbgYou could have (restrict some-relation restrictions ...) -> (restrict-fn some-relation (transform restrictions) ...)
17:57qbgOr you shadow math and provide versions of the operators that work lists in the way you want in addition to how they normally work
17:57qbgClojureQL does stuff like that I think
17:59BerengalHmmm... is it possible to extend + to work for new types?
18:00qbgYou'll have to shadow + to do that
18:00amalloyBerengal: clojure.contrib.generic-arithmetic, i think?
18:00qbg#'clojure.core/+ doesn't let you do that for perf reasons
18:01Berengalamalloy: Would users of my code have to know about that?
18:01amalloy*shrug*
18:02qbgBerengal: They would probably have to use/require both libs
18:04fbru02_qbg: and all , can you help on how would you do an api (for a clojure program talking to another one)
18:05fbru02_I still got that pending from our conversation
18:06lpetitBerengal: after having considered everything, why not just have the functions of your dsl be aliased to a very short alias (one char) ?
18:07lpetitBerengal: not that bad - http://clojure.pastebin.com/V0akxiE3
18:09Berengallpetit: Could work
18:10BerengalI still haven't completely let go of the idea of wrapping the entire thing in one macro...
18:10lpetitthink edition : could even have an IDE feeling = "d/" and wooops code suggestions for dsl specific operators
18:11amalloyfbru02_: do you mean api for direct function calls, or a protocol for data transfer across processes/networks?
18:11fbru02_amalloy: i would love to have the second
18:12amalloyfbru02_: https://github.com/ztellman/gloss maybe?
18:12fbru02_amalloy: let me take a look :) thanks !
18:12BerengalThe trouble with a wrapping macro is that you couldn't translate something like (?-> (table :foo) (restrict (< (:id :foo) 10))) to (restrict (< (:id :foo) 10) (table :foo)) without some issues
18:12cemerickanyone here a Java 2D font wizard?
18:23lpetitcemerick: question answered ;)
18:23cemericklpetit: yeah, I knew that was a longshot :-)
18:24lpetitcemerick: yay, now (ns ^{:doc "The core Clojure language."
18:24lpetit :author "Rich Hickey"}
18:24lpetit clojure.core) is not a problem to findDeclaringNamespace anymore.
18:25cemerickyou lifted c-m-p's approach, I assume?
18:25lpetitc-m-p ?
18:25cemerickThe contextual side of the house is tougher, of course.
18:25cemerickclojure-maven-plugin
18:25lpetit(defn find-namespace
18:25lpetit [tree] (spy (sym-name (form (first (call-args (some #(call-of % "ns") (code-children tree))))))))
18:26lpetitcemerick: ^^
18:26lpetitoops , need to remove the spy
18:27cemericklpetit: I've got a big backlog of ccw tweaks to push through. I don't think I'm going to get to it before the end of the month, tho. What are your release plans like for 0.2.0?
18:27lpetitc-m-v approach is for findMaybeLibNamespace (yes I'm good at finding horribly long java method names)
18:28lpetitcemerick: aligned with pure open source philosophy = when I feel it's ready :-p
18:28cemerickheh, OK
18:28cemerickwell, hopefully I can get them in under the wire
18:29lpetityes. public branch repl-ui is kept up to date
18:29lpetitcemerick: backlog wrt to repl view ?
18:30cemericklpetit: REPLView and some nREPL bugs
18:33lpetitcemerick: great, so our works will be complementary. Still need to work on porting actions to handlers (so much code reduction!), and at least 2 big remaining stuff from editor to repl : code completion, visual matching brackets, and same default/strict switching command/status-bar-reporting
18:33lpetityeah, it's 3 big stuff, not 2
18:34cemerickThere's that pile of feedback from Lee et al. that came through in November, too, which I've not touched.
18:34lpetitOnce I've got those 3 big stuff checked in, I'll release a new RC. Hopefully before the end of January ! !
18:34cemerickThings have been very busy since early December.
18:34lpetitsure
18:35lpetitbut now things are fitting into place again for me, I'm rather confident that I'll find a pace
18:58devnlpetit: your grammar for clojure has been nice for me to look over while working with ANTLR -- thanks for that.
19:00lpetitdevn: you're welcome. But currently I'm only maintaining it, and my attention is on the grammar for clojure written for parsley, FWIW
19:43clajI cannot get somnium.congomongo to work as expected on OS X, java seems to bound for my local IP, 192.168...
19:43clajand if i explicitly tells (mongo! :host "127.0.0.1") that wont work correctly either :(
20:59tufflaxIn Vimclojure, which key indents a block of code properly if selected in viual mode?
21:00tufflaxvisual*
21:07chouser=
21:07amalloy:wqemacs :)
21:09tufflax:) thanks
21:43Leonidascan I have a macro match on both an atom and a list and unpack the latter in head & tail?
21:44Leonidashttp://paste.pocoo.org/show/316937/ doesn't quite work, because of the same arity. but when I remove the first rule, it tries to unpack an atom which isn't the most useful thing to do
21:45amalloyLeonidas: why a macro at all?
21:45Leonidasamalloy: this is an exercise, the expansions are just placeholders for now.
21:45Leonidaslater there will be Real Code(TM) :)
21:47amalloy(let [x (atom 1) [head & tail] (if (instance? IDeref x) [x] x)] (use head and tail))
21:47amalloyor go the other route and test for (coll? x)
21:48Leonidasamalloy: hmm, ok, so I cannot "pattern match" it.
21:49amalloyLeonidas: no, not with destructuring. i think there are some pattern-matching-related libraries for clojure...maybe qbg knows?
21:50Leonidasamalloy: the funny thing is, I am actually trying to port a scheme macro using syntax-rules to Clojure. qbg's syntax-rules should be able to do that :)
22:51ikeji(assoc {} :a 1)
22:53ikeji,(assoc {} :a 1)
22:53clojurebot{:a 1}
22:53ikeji(conj {} [:a 1])
22:54ikeji,(conj {} [:a 1])
22:54clojurebot{:a 1}
22:54ikeji,(conj {} :a 1)
22:54clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
22:55amalloyikeji: you can /msg the bots
23:31qbgI need to work on an alpha2 release of syntax-rules