#clojure logs

2012-05-19

02:42tomojthis benchmark is silly, right? https://gist.github.com/139af93a585057d4121a
02:43ChousukeI guess so
02:45Chousukeit's also completely expected, fwiw
02:46Chousukethe overhead from take looks large because realising the actual elements in the range seq takes next to no time
02:54wkmanirejoin #refheap
02:56amalloytomoj: especially because range produces a chunked sequence and take doesn't do anything to preserve its chunkiness
02:58amalloyfwiw, with the new reducers from 1.5 the overhead from take is probably smaller than the cost to create a range
03:23tomojamalloy: cool
03:23tomojI am trying to think whether I should use reducers for this
03:38y3diwhy did clojure gain traction and not jfli, Foil, Lisplets, or DotLisp
03:40RaynesBecause I'm here and not there.
03:41rothbardy3di: maybe because it came out at a time that jvm languages were becoming hot and industrially used (particularly jruby and scala)
03:41rothbardjvm languages other than java that is
03:42RaynesWell, some of it is simpler than that.
03:42RaynesDotLisp was a Rich Hickey project. It didn't gain traction because he moved on to Clojure.
03:42RaynesOne is the result of the other.
03:42fliebelall of them seem to be form rich
03:43RaynesRight.
03:43RaynesIt's kind of a matter of what he decided on.
03:43y3difliebel: yep
03:43y3diahh
03:43rothbardRaynes: well if DotLisp came out in 2003 that gave it several years chance to become popular before Clojure was released.
03:44RaynesBut how long was he working on Clojure during that time?
03:44RaynesHow much did he work on dotLisp during that time
03:44fliebelThere where a lot of lisps on the JVM before Clojure too. Did Dotlisp offer any sgnificant advantage over a CL on the JVM?
03:44rothbardI don't see how that's relevant. first Clojure release probably in 2007 probably wasn't all that much more featureful than DotLisp release in 2003.
03:45rothbard(not sure on date of first clojure release)
03:45Raynesfliebel: dotLisp is .net
03:45rothbardfliebel: I think using .net types instead of some wrapper types and not botherin gwith backwards compatibility
03:45Raynesrothbard: It's relevant because if he wasn't as active in the community of dotlisp as he was in the early Clojure days, it would have made every bit of difference.
03:46rognvIs clojureCLR any good?
03:46fliebelrognv: No idea, it doesn't run on Mono.
03:46rognvthat means no then :(
03:47RaynesI don't understand the correlation between goodness and mono.
03:47RaynesWhy does it matter if it runs on Mono? Isn't the point of .NET Windows?
03:48rognvI guess the word "better" would be more appropriate.
03:48fliebelDid the early Rich lisps show any of the treats that make Clojure so nice to use, or where they just his toy languages and experiments?
03:49fliebelrognv: IIRC, it's just some dependency issue. It depends on some native lib that doesn;t run on Mono
03:50rothbardRaynes, well it matters if rognv runs Linux/Mac. many .net users want to deploy to Linux or iOS.
03:51fliebelOh, yea... phonegap, or the other one, they use mono, right?
03:51rothbardmonotouch
03:51fliebelyea, clojure-clj depends on vjslib
03:53y3diwhat are the arguments for clojure not being a real lisp? are there even any remotely valid ones?
03:53rothbardfliebel: I haven't looked closely but they didn't appear to have clojure's niceties other than basic java interop
03:54Raynesrothbard: Right, but I'm not sure why they would.
03:54rothbardy3di: for some arbitrary definitions of "real lisp" there are good arguments.
03:54fliebely3di: That it doesn't use enough parens? I don't know.
03:54rothbardRaynes, clojure-clr specifically or .net in general?
03:54Raynes.net in general
03:55rothbardRaynes, why they would want to deploy to Linux/iOS?
03:55fliebelrothbard: Which defs?
03:55RaynesYes.
03:55rothbardRaynes: 1) they already have linux servers 2) linux servers are cheaper 3) the devices run iOS
03:56RaynesBut why would they write .NET with the intention of running it on Linux?
03:56Borkdudey3di: Rich wanted to use Lisp while clients decide they want Java/.NET. The solution is Clojure. (story short)
03:56rothbardRaynes, they like C#/F#/etc
03:56RaynesMeh, it doesn't matter. People do things. Life goes on.
03:57BorkdudeRaynes: there are people who don't want to learn Objective-C to create apps for the iPad, but want to use C#
03:57BorkdudeRaynes: just like some people want to use Clojure instead of Javascript
03:57BorkdudeRaynes: or Java...
03:59rothbardRaynes: there's actually a lot of good linux software written in C#, e.g. Tomboy
04:01BorkdudeI know a student who did an internship at Microsoft-stack based company, his assignment was to check out if MonoTouch would be suited for them to build iPad/iPhone apps (http://xamarin.com/monotouch)
04:03fliebelHm, does anyone actually have mono installed?
04:05tomojI do
04:05tomojI don't remember why
04:06daniel___what would be the quickest way of finding the index of the least significant or most significant bit in a binary number?
04:08Borkdudefliebel: I have
04:08tomojdaniel___: look it up by type? guess I don't understand
04:08fliebelI was trying to see if clojure-clr works, but I don't seem to have it, neither does my package manager.
04:08tomojthe index of the least significant bit of any number on the jvm is 0, no?
04:09amalloy$javadoc Long
04:09lazybothttp://docs.oracle.com/javase/6/docs/api/java/lang/Long.html
04:10amalloyhas highestOneBit and lowestOneBit
04:11daniel___oh, thanks amalloy
04:11daniel___thats what i meant
04:13daniel___looks like that gets me a Long with that bit, but doesn't get me the index
04:13Borkdudefliebel: I installed it manually
04:13daniel___i think in combination with numberOfLeadingZeros i can work it out
04:14Borkdude"Why isn't Clojure a real Lisp?" - "Why isn't the Java Virtual Machine a real Machine?"
04:14fliebelBorkdude: to much work. and then I can't uninstall.
04:16Borkdudefliebel: what OS are you on?
04:19Borkdudebtw, I installed mono to see if I could show .NET examples without a VM, but I mostly use the VM now anyway and don't really use mono(develop)
04:19rothbardfliebel: looks like dotlisp did have vector literal syntax and maybe multiarit functions but not hashmap syntax ({} was used for records)
04:20Borkdudealthough some students even got creating webservices with WCF working under OSX
04:26Borkdudesomething else, what is the current status of developing mobile apps with clojure?
04:27Borkdudeis it possible?
04:27rothbardBorkdude: possible on android but startup time is slow. possible with clojurescript+phonegap, haven't seen any examples though
04:28muhoo4 hours in, and i *almost* understand how defpage works
04:45Borkdudehas anyone tried the android emulator on osx lately? last time I checked it was unusably slow
04:52alexyakushevBorkdude: I'm working on simplifying the Clojure/Android development process right now. You can look at this group for some info: https://groups.google.com/forum/?fromgroups#!forum/clojure-android
04:58Borkdudealexyakushev: tnx
05:04muhooandroid simulators are in general quite slow. easier to test on an actual device.
05:50mudphoneanyone have examples of good write-ups for use cases of Clojure vs. Haskell?
05:54scottjmudphone: pretty simple. if you want static typing, haskell. if you want jvm, clojure. otherwise pick preference.
05:54mudphonescottj: interesting, thanks
05:55mudphoneI don't know much about the Haskell concurrency story
05:55mudphonei'm assuming people use monads for state (in Haskell)
05:57fliebelscottj: Clojure also does static typing, right?
05:57scottjfliebel: nope, there are people working on it though
05:57fliebelscottj: yea: http://cloud.github.com/downloads/frenchy64/papers/type-inference-review.pdf
05:58scottjmudphone: I don't know Haskell but I believe it has STM builtin, perhaps even partially the inspiration for Clojure's, though I suspect like clojure's stm it is rarely used
06:02mudphonewith monads, i guess
06:49daniel___are there any problems using '-' or '+' in a function name?
06:49daniel___defn bitscan+ defn bitscan-
06:50babilendaniel___: No, why? Do you have a problem with that?
06:51daniel___babilen: i have a problem, just wanted to rule that out
06:51daniel___havent worked it out yet
06:51Borkdudeif you want to call it from java it might be problematic ;)
06:52daniel___yeah, not planning on doing that
06:52daniel___somethings wrong with my logic atm, think that function is fine
06:52daniel___its how im using it
06:52y3dicommonlisp has static typing right?
06:52Borkdudey3di: no
06:52raekcalling such functions from java is not a problem
06:53babilendaniel___: Would it make sense to paste the code to, say, http://refheap.com so we can take a look?
06:53daniel___yeah, maybe
06:54raekRT.var("some.ns", "bitscan+").invoke(...);
06:57daniel___might be hard to work out whats going on: https://gist.github.com/2730452
06:57daniel___works for positive (bitscan+) attacks but not negative (bitscan-) attacks
06:58y3diis the clojure compiler progressively being rewritten in clojure
06:59Borkdude,(-> (clojure.lang.RT/var "clojure.core" "+") (.invoke 1 2 3))
06:59clojurebot6
07:00scottjy3di: no, but some steps have been taken to make that easier when it eventually happens (clojurescript and protocols)
07:00daniel___it's not a real situation at the moment, i have all 32 pieces plus an extra bishop
07:00daniel___still should work though
07:17ro_stanyone using monger?
07:17ro_stgot your book yet, matessim?
07:18Borkdudehmm, ##(-> (clojure.lang.RT/var "clojure.core" "defn") (.invoke nil nil 'foo '[a b] '(+ a b)))
07:18lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!
07:18Borkdude,(-> (clojure.lang.RT/var "clojure.core" "defn") (.invoke nil nil 'foo '[a b] '(+ a b)))
07:18clojurebot(def foo (clojure.core/fn ([a b] (+ a b))))
07:21Borkdudeso when you invoke defn this way, you get the macroexpansion back?
07:21Borkdudeor how does this work, defn isn't even a macro
07:22Borkdudeit is a function which returns a clojure expression…
07:25mfexBorkdude, defn *is* a macro
07:26gfredericksand macros can be seen as functions which return clojure expressions :D
07:26gfredericksI think maybe in the source it looks like a function because defmacro doesn't exist yet
07:26ForNeVeRMacros *are* such functions.
07:26Borkdudemfex: gfredericks ah that's it: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L263
07:27Borkdude(. (var defn) (setMacro)) …
07:27matessimro_st, its in the mailbox office
07:28matessimit didn't fit my mail box, so i need to pick it up, its open tomorrow only :)
07:28matessimclosed on weekends :/, but can't wait to start reading it.
07:28ro_stit's a great book. i finished it recently, although there are plenty of places i need to revis
07:28ro_stit
07:30gfredericksForNeVeR: not quite just that, but mostly just that
07:30gfredericksI could write a function that returns code and it would not be a macro
07:31raek"macro functions" also take two extra arguments
07:32raekso when you write (defmacro foo [a b] ...) a function like (fn [a b &env &form] ...) will be created
07:32raek(not sure about the ordering of the extra args, though)
07:34Borkdudehmm, so the metadata (:macro true) decides wether the expansion will be evaluated: https://www.refheap.com/paste/2795
07:35Borkduderaek: the extra args are the first two
07:36raekBorkdude: it decides whether the compiler should call the macro at all
07:36raekmacro functions are never applied at runtime
07:36Borkduderaek: right
07:37raekso when the compiler sees (foo a b c) it will check the macro flag. if it set the form will be replaced by the macro expansion. if it's not, then code for an ordinary function application is generated
07:37Borkduderaek: yeah, cool.
08:16VinzentHi. Any idea why this function https://www.refheap.com/paste/2796 throws StackOverflowError when called?
09:50glitch99Quick question: in lisp afaik, data and code are the same thing. so if I were to (def foo '(println "hello")) then I can funcall that foo - (funcall foo) but clojure doesn't have this ability?
09:52glitch99nevermind - (eval foo)
10:29jweissis there a way to package an uberjar with lein, so that when it's run, it runs a swank server instead of the "main" class?
10:30jweissi'm guessing i just make swank the main class, and a real dep instead of a dev dep?
10:52jweisshm.. trying to make swank.swank the main class of an uberjar doesn't seem to work. even if i precompile swank.swank, when i run lein uberjar, it seems to remove the "classes" dir.
10:58fliebelWhat would it take to automatically answer emails? You know, NLP and all that...
11:20ifesdjeenhi guys!
11:21ifesdjeendoes anyone know why (contains? [ :id :another-field ] :id) evaluates to false?
11:21ifesdjeenwhereas (contains? [1 2] 1) evaluates to true
11:22ifesdjeenand (= :id (first [:id :another_field])) evaluates to true, too...
11:22metellusit's based on the index, not the contents
11:22ifesdjeennot sure why contains on a vector of keywords returns false
11:22ifesdjeenah
11:22metellus,(contains? [:a :b] 1)
11:22clojurebottrue
11:23ifesdjeeni see now
11:23ifesdjeen(contains? [1 3] 3) is false
11:23ifesdjeenmakes sense, actually
11:24ifesdjeeni guess i'll use some
11:24ifesdjeenthank you metellus
11:35lemoqhi folks!
11:38lemoqGot some trouble with declare... my code keeps throwing an exception that i am trying to call an unbound function. Did I get that right that I can use declare to make some like "early" declarations, i.e. before actually implementing the code?!
11:42lemoqhere's the code that's causing trouble http://pastebin.com/hPd6846r
11:44tmciverlemoq: I don't see a definition for blank . . .
11:46tmciverlemoq: also, it looks like you could just put the defn for col-parser after the defs for blank and expr?
11:46tmciverlemoq: in which case you don't need declare. I don't think I've ever had the need for declare myself.
11:48lemoqtmciver: I omitted the def of blank, because I could narrow down the problems to expr. If I put the definition of col-parser to the bottom I will have to make other declares beforehand.
11:48lemoqBut I'm trying that now
11:52daniel___i want to restrict a functions argument to within a certain range and if it isn't in the range, return 0
11:52daniel___i remember reading about ways to restrict the arguments but i suppose this will return an error
11:53tmciverdaniel___: you can use pre (and post) condition but these throw Assertion errors if their tests don't pass.
11:53daniel___i guess i need an if statement
11:54tmciverdaniel___: yes, otherwise I think you need to manual check for that in your function to return 0.
11:54daniel___yeah, i think i need to wrap the whole function in an if else
11:54daniel___how can i check if a number is within a range
11:55tmciverdaniel___: (if (not (< a arg b)) 0 ...)
11:55tmciver,(< 1 2 3)
11:55daniel___yep, that'd do nicely
11:55clojurebottrue
11:55tmciver,(< 1 3 2)
11:55clojurebotfalse
11:55daniel___i thought there might be a function like (if (within [1 2 3] 1) ..
11:56tmciverdaniel___: well, you can check if a number is a part of a collection with 'some'
11:57hyPiRionEither (some = [1 2 3] 1) or (contains? #{1 2 3} 1)
11:58tmciveror (some #{1} [1 2 3])
12:01daniel___don't worry, i used an if and it's working perfectly
12:01daniel___using some wouldnt be any more concise
12:02adeelkhtmciver: clever
12:03tmciveradeelkh: nah, it's right out of the doc: ##(doc some)
12:03lazybot⇒ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
12:05adeelkhtmciver: yeah but that only works because a set can actually be treated as a function that tells you whether something is in it
12:05adeelkh,[(#{1} 1) (#{1} 2)]
12:05clojurebot[1 nil]
12:21gfrederickswell it doesn't quite
12:21gfredericks'(#{false} false)
12:21gfredericks,(#{false} false)
12:21clojurebotfalse
12:26adeelkhgfredericks: well, to be exact, it (s x) for some set s returns x if x is in s or nil otherwise
12:26adeelkh-"it"
12:46lemoqI am still having problems with declare, and I think I can narrow it down to some weird behavior: I declare a symbol which I bind to a function, and this function is called several times with a pretty deep nesting... it seems that the more times I evaluate all my code the deeper the nestings can be done without getting an error?!
12:48lemoqhere's some code... http://pastebin.com/cpGMWp0u
12:49adeelkhi'm trying to set up a clojurescript repl. where exactly do i put (repl/connect "http://localhost:9000/repl&quot;)?
12:49lemoqhappens in the REPL as well as in clooj, the editor i am using... you can safely ignore everything until the symbol other is defined
12:50xeqiohh, a parser combinator
12:51gfredericksthis is-valid function is strange
12:51lemoqgfredericks: y?
12:52lemoqxeqi: yes, it's a parser combinator... fun fun fun :)
12:52gfrederickslemoq: because I forgot you had your own and/or :)
12:52gfredericks(def expr (or llist other)) was pretty weird otherwise
12:53lemoqgfredericks: yeah :)
12:53gfrederickslemoq: what's the error?
12:54lemoqcopy the code into your REPL, and you will see that the tests fail with an "attempting to call unbound function: expr" error... do that 4 times, and everything works fine
12:54lemoqwhich seems pretty odd to me
12:55lemoqit seems like the stuff declared in the (declare ...) part is not redefined later on, as I would expect
12:56tmciverlemoq: hmm, I don't seem to be getting any error, though the calls at the end all return nil.
12:57xeqiI get the nil returns too in swank
12:57tmciverlemoq: wait, (is-valid "(a)") gives that error
12:57xeqibut if I call (expr "(a)") I get the unbound error
12:59lemoqerrors will vanish if you copy the stuff 4 times into the REPL... you can then reproduce it by adding parenthesis to the calls, which gives an error, and then copying again, and the error is gone
13:01hiredmanlemoq: do you understand what def and declare do?
13:01hiredmanlemoq: they create vars, which are implicitly deref'ed when you name them
13:02hiredmandef gives the var a value, declare doesn't
13:02lemoqyeah, that's my understanding: declare kind of "reserves" a name, and def binds it
13:02gfredericksdo they create new vars each time?
13:02mfexadeelkh, put it in your .cljs file?
13:03adeelkhmfex: i'm using node.js, so then i would just compile and run it with node?
13:03hiredmangfredericks: no
13:03lemoqso my understanding is that I can resever a name via declare and use it when passing functions around, but the functiona that is finally called has to be def'ed to the symbol
13:04hiredmanbut you refer to the var expr before the def that gives it a value is reached
13:04hiredmanso the var expr is deref'ed, but it has no value
13:04hiredmanline 39
13:04mfexadeelkh, repl/connect is for the browserrepl
13:05adeelkhmfex: i thought so. so how would i get it working with node?
13:05lemoqhiredman: yes, because that what i understood - i can use the name and making the binding later
13:05lemoqexpr is bound in any way before the first real call
13:06mfexadeelkh, node.js is the server side right? repl/connect is for the browser on the client side
13:06gfrederickslemoq: you could use the name inside a function if you didn't call that function till later
13:06adeelkhmfex: that's right. i'm trying to make a command line script you can run with node.
13:07gfredericksbut if you use the name at the top-level and it hasn't been bound to anything yet then it'll just be nil
13:07gfredericksor unbound
13:07adeelkhmfex: and i'm wondering how i would get `lein trampoline cljsbuild repl-listen` working
13:07gfrederickseither way not what you want
13:07xeqilemoq: (def inlist expr) immediately derefs expr and binds it to inlist
13:07xeqiyou can use (def inlist #'expr) instead
13:08hiredmanxeqi: only if the value of expr is going to be a function
13:10lemoqxeqi: what does #' stand for? kind of a delays deref?
13:10gfredericks#'foo === (var foo)
13:11gfredericksit gives you the var itself instead of the var's value
13:11gfredericksnot normally useful except that when the var's value is a function, you can call the var as if it were a function, which gives you an extra level of indirection
13:12mfexadeelkh, I don't know of a client side version of the repl to be used inside nodejs scripts
13:12xeqigfredericks: ah, yeah, thanks for catching that it has to be a function
13:12gfredericksxeqi: hiredman caught it. I wouldn't've
13:12xeqiheh, thanks hiredman
13:13lemoqworks perfect, I am only passing functions around here
13:13lemoqthank's a lot guys!
13:40kumarshantanuHey guys, anybody familiar with Lein2 profiles looking at this?
13:41Borkdudekumarshantanu: whatever you're going to ask, try #leiningen
13:42kumarshantanuBorkdude: Thanks!
13:47tomojshort variadic accumulator generator: (comp #(partial swap! % +) atom)
14:07tankpilothi all. I'm about to pick noir for beginning web development with clojure
14:08tankpilotit seems like the clojure way of web dev... am I right? is there any more common/popular framework around the community now?
14:08gfrederickstankpilot: I think that's it. I've never used it though.
14:10xeqitankpilot: noir seems to the popular starting point
14:13xeqiat a lower level there is compojure, which noir uses underneath
14:15tankpilotxeqi: thanks for the answer
15:23LauJensenEvening gents
15:23hyPiRionEvening.
15:34Bronsa
16:05patchworkHmm… any reason running lein deps on a freshly cloned repo would give "Operation timed out" errors?
16:05patchworkI can't run any lein commands
16:06xeqiis there a repo defined that is unaccessible?
16:06patchworkNo extra repos are defined
16:07patchworkAll the dependencies are on clojars
16:07patchworkIt is quil, I was hoping to try it out
16:09patchworkHmm… lein commands are not working on any repos
16:09patchworkThey all have httpclient timeouts
16:09patchworkBut I am connected to the internet?
16:09RaynesAre you sure? (har har har)
16:10patchworkIs there some repo lein depends on that could be down?
16:10xeqido you have any maven proxy settings?
16:10xeqinot sure if that could cause it
16:10patchworkRaynes: I seem to be, since you can read my bewildered messages
16:11patchworkxeqi: Hmm… not that I know of. How could I check that?
16:12xeqi~/.m2/settings.xml I think, never used them
16:12clojurebotCool story bro.
16:13Raynesclojurebot: Thanks for your clever interjection.
16:13clojurebotthanks for your suggestion, but as usual it is irrelevant
16:13RaynesSick burn.
16:13xeqihaha
16:14xeqipatchwork: it should just be central and clojars for repos
16:14patchworkxeqi: That file doesn't exist, so I assume I don't have proxy settings
16:14patchworkshould I create them?
16:14xeqino
16:14patchworkI am using the latest leiningen binary from master
16:15xeqilein version?
16:16patchwork`lein version` times out!
16:16patchworkwhat… is going on
16:16xeqi`cd .. && lein version`
16:16Borkdudepatchwork: are you sure you are not making up our reactions yourself and you are indeed connected to the internet?
16:16patchworkYeah, I'm in no project dir
16:17patchworkBorkdude: entirely possible, I will explore this further
16:17patchworkYeah lein version won't complete!
16:17neotykhello everyone
16:18Borkdudepatchwork: did you just "install" leiningen, or change it's version?
16:18Borkdudeneotyk: hi
16:18patchworkBorkdude: Yeah, I have the latest lein binary from the master branch on github
16:19neotykpatchwork: you compiled it?
16:19Borkdudewhat does it say when you just do "lein"?
16:19patchworkIt hangs
16:20Borkdudepatchwork: OS?
16:20patchworkneotyk: I would compile it, but `lein compile` hangs!
16:20patchworkMACOSX 10.6.8
16:21patchworkIs there another way to compile the lein binary without lein?
16:21neotykpatchwork: have you removed your ~/.m2/repository already?
16:21patchworkneotyk: Not lately
16:21patchworkyou think that will help?
16:21neotykpatchwork: lein is there
16:21patchworkDoes maven get into some inconsistent state somehow?
16:22xeqior in ~/.lein/self-installs/
16:23patchworkremoved ~/.lein/self-installs, it redownloaded, and is hanging again!
16:23Borkdudepatchwork: fwiw, I'm on 10.7.4., just downloaded the lein script (which uses 2.0.0-snapshot) and when I run it it starts downloading the leiningen jar
16:23neotykxeqi: right, I don't see it in m2 repo, but I see them in .lein
16:23patchworkblowing away .m2
16:24patchworkThanks for the help guys, this is really weird
16:24Borkdudelein self-installs are stored in ~/.lein/self-installs
16:24neotykpatchwork: you can C-\ hanging lein, and gist output
16:25Borkdudepatchwork: to be sure, throw away ~/.m2 and ~/.lein
16:25Borkdudepatchwork: also if you have previous version of the lein script, be sure not to confuse them
16:26neotykBorkdude: maybe we should do install party next ams-clj?
16:26Borkdudeneotyk: why not
16:27Borkdudeneotyk: if there are actually people who need this
16:27neotykBorkdude: but then, it just works for us
16:28patchworkAlright, blew away ~/.m2 and ~/.lein, redownloaded, many deps started downloading right away but then it started hanging again!
16:28patchworkI wonder if this is because one of my plugins
16:28Borkdudepatchwork: what plugins?
16:28patchworkWell, I have a ~/.lein/profiles.clj with some plugins defined
16:28neotykthere you go
16:28Borkdudeneotyk: what do you mean?
16:28Borkdudepatchwork: throw it able
16:28Borkdudeaway
16:28patchworkAlright
16:28Borkdudepatchwork: or just rename .lein to .lein-backup or smth
16:29patchworkOh brutal
16:29patchworkyeah one of the plugins was causing it
16:29patchworkIs there something that maps plugins to their respective repos?
16:30patchworkone of these must be coming from somewhere else
16:30Borkdudepatchwork: maybe lein-newnew or smth?
16:30Borkdudepatchwork: I can only guess, but nice that it's solved...
16:31Borkdudepatchwork: I had also problems with profiles.clj causing the leiningen plugin in Eclipse to not work correctly, it's tricky
16:32patchworkYeah that is rough, having lein's working properly depending on whether all plugin repos are functioning or not
16:33patchworkI don't even have that many, time to do some process of elimination
16:33patchworkThanks for the help
16:33Borkdudepatchwork: maybe you can let us know what caused the bug, it's helpful to share the knowledge
16:33Borkdudeneotyk: I didn't understand what you meant by "it only works for us"
16:35Borkdudeneotyk: how were the previous install fests, people actually came for that specifically?
16:37neotykBorkdude: it only works for us ~ if there are actually people who need this
16:38neotykas in, we don't need it
16:38neotykBorkdude: after first Amsterdam October, we organized one install session, and once before
16:39neotykBorkdude: but nobody asks for it, or we didn't ask
16:41neotykBorkdude: it was basically getting lab repl setup in eclipse and intellij
16:41gfrederickswhat's the emacs thing that does the remote filesystems?
16:41gfredericksnm
16:41Borkdudeneotyk: I see
16:43espeedWhat's the clojure naming convention for funcs that would have the same name as a built-in?
16:43espeedDo you add a hyphen? e.g. (defn long- [] ())
16:43RaynesNo, you can just name them the same.
16:43Borkdudeespeed: the same name is the same name ;)
16:44RaynesThey will either shadow built in functions or clients can (require ...) them so as to not shadow the built ins.
16:44RaynesThis is a common thing.
16:44gfredericksmildly annoying though
16:44amalloywell, it's not *common*. but it happens
16:44neotykespeed: (:refer-clojure :exclude [await])
16:44amalloysometimes people give them different names to avoid the confusion/difficulty, sometimes they use the same name. the latter is probably better
16:44Raynesamalloy: It's pretty common.
16:44stuarthallowayplease use good names and namespace qualify
16:45gfredericksRaynes: amalloy: okay both of you specify an exact percentage of clojure libs that do this and then we will not bother to determine who was closest.
16:45RaynesSee, stuarthalloway agrees with me. It was originally my idea though.
16:45stuarthallowaychronological order of IRC appearance != orginality :-)
16:45neotykgfredericks: http.async.client uses it
16:46Borkdudegood names like "contains?" so each day people come in asking why (contains? [4 5] 4) is false :P
16:46Borkdude(sorry)
16:46hyPiRionI like the difference between next and rest better.
16:47hyPiRion,(list (next [1]) (rest [1]))
16:47clojurebot(nil ())
16:47stuarthallowayre: contains? -- people who refuse to read even the first five words of docstrings should expect to be confused often :-)
16:48gfredericks,(->> contains? var meta :doc (re-seq #"\S") (take 5) (clojure.string/join " "))
16:48clojurebot"R e t u r"
16:49gfredericksah, that explains it
16:49gfredericks,(->> contains? var meta :doc (re-seq #"\S+") (take 5) (clojure.string/join " "))
16:49clojurebot"Returns true if key is"
16:51amalloy&((juxt next rest) [1]) ;; hyPiRion
16:51lazybot⇒ [nil ()]
16:51RaynesNuts.
17:00gfredericksso you can extend a sub and super type with the same protocol, and it picks the most specific implementation?
17:12amalloyyes
17:13gfredericksthat is cool.
17:13gfredericksjava methods work the same way?
17:14gfrederickswait
17:14gfredericksof course
17:14gfredericksO_O
17:15gfrederickswhere's -?> defined these days?
17:15Bronsacore.incubator
17:15gfredericksah right, thx
17:15Borkdude,(doc -?>)
17:15clojurebotIt's greek to me.
17:16Borkdudenice documentation ;)
17:16gfredericksBorkdude: is like -> but short-circuits as soon as nil
17:16Bronsait's not part of clojure.core
17:16Bronsait's in a library
17:17LeNsTR,(clojure-version)
17:17clojurebot"1.4.0-master-SNAPSHOT"
17:17gfredericksman incubator is on version 0.0.25
17:17gfredericks0.1.0 is a milestone now?
17:22zakwilsonring.adapter.jetty seems to lack any way to shut a server down. Is that inherent, or just missing?
17:23weavejesterzakwilson: If you set :join? to false in the options, the adapter doesn't block and returns a Jetty Server object you can use to stop the server.
17:23weavejesterzakwilson: Under normal use, the adapter blocks until the application ends.
17:29zakwilsonweavejester: is destroy the correct method to call to shut it down?
17:29weavejesterzakwilson: I believe there's a method called "stop" on the Server class.
17:30zakwilsonOh, there it is, from org.mortbay.component.AbstractLifeCycle. Ugh. Java APIs.
17:33tmciverweavejester: Just noticed in ring.mock that the header function lower-cases the header name. Is there a reason for that? Headers typically begin with a caplital letter.
17:35weavejestertmciver: Headers are case insensitive, while Clojure maps are case sensitive, so there needs to be some normalization.
17:35gfrederickslower-case letters are pretty
17:36weavejestertmciver: For instance, if there was a header "Content-type: text/html" you wouldn't want it to be parsed into a map {"Content-type" "text/html"} because that lowercase "t" would mean your code wouldn't work.
17:36weavejestertmciver: The easiest way to normalize a case insensitive string is to lower or uppercase it.
17:36weavejestertmciver: So Ring request maps use lower-case header names.
17:37tmciverweavejester: so Ring also lower cases the headers in the request?
17:37weavejestertmciver: Yep
17:38tmciverweavejester: which 't' are you referring to that would break the code?
17:38weavejestertmciver: "Content-type" with a lower "t" in the type, as compared to "Content-Type" which is the usual way of writing it.
17:38weavejestertmciver: In HTTP both are equivalent. In a Clojure map, they're different.
17:39weavejester,(let [headers {"Content-type" "text/html"}] (headers "Content-Type"))
17:39clojurebotnil
17:39gfredericks,(dotimes [n 5] (println "(inc weavejester)"))
17:39clojurebot(inc weavejester)
17:39lazybot⇒ 1
17:39clojurebot(inc weavejester)
17:39lazybot⇒ 2
17:39clojurebot(inc weavejester)
17:39lazybot⇒ 3
17:39clojurebot(inc weavejester)
17:39lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
17:39clojurebot(inc weavejester)
17:40lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
17:40TimMchaha!
17:40tmciverweavejester: OK, good enough. As long as Ring is self-consistent. :) Thanks.
17:41TimMcweavejester: Any new thoughts on the file-change event thing?
17:42weavejesterTimMc: Yep, I did this: https://gist.github.com/2732467
17:43weavejesterIt could probably be made more general
17:44weavejesterBut basically I add a watch on the atom, which means I don't have to make or use a separate event-registering service
17:44weavejesterAnd then I use a promise to wait for the value.
17:44weavejesterUsing a promise to deliver a boolean that's always true is a little… bad I guess.
17:45weavejesterBut a more general function that returned a more specific result would, I think, be idiomatic.
17:45weavejesterSince we want to watch a ref, and then deliver a value when something happens, which is a promise.
17:46weavejesterThe full code is here: https://github.com/weavejester/ring-refresh/blob/master/src/ring/middleware/refresh.clj
17:47gfredericksin dnolen's new extending-core.logic wiki page, why is there no need to unify Datum with LVar?
17:50gfredericksand why does this fail? (macrolet [(foo [] (list 'deftype 'FOO ['x]))] (foo))
17:53TimMcweavejester: Did you see this suggestion? http://clojure-log.n01se.net/date/2012-05-18.html#16:12
17:54weavejesterTimMc: Oh, no, but I kinda did that by using a timestamp
17:54weavejesterTimMc: Each time a file is updated, an atom is reset with the most recent modification date.
17:55weavejesterTimMc: Then each page creates a watcher on the atom that looks for when the timestamp in the atom is more recent than when the page was loaded.
17:57TimMcweavejester: It looks like your current code will wait up to 60 seconds, but has no minimum.
17:57weavejesterTimMc: Right
17:58weavejesterTimMc: I guess it would make sense to limit it
17:58weavejesterTimMc: In case some automatic process is rapidly updating a file in a watched directory
17:59weavejesterTimMc: Though that would be more "rate" than a minimum wait time.
18:17TimMcweavejester: Maybe what you want is this: Wait for up to 1 minute for *any* event, but return no sooner than 100 ms after the *first* event.
18:17TimMcA double-timer system.
18:18weavejesterTimMc: Maybe… I'm not too worried, though, as people can always kill the tab or the server if it starts refreshing too much.
18:19TimMcCertainly, build for what you *know* is needed.
18:21weavejesterIt's basically for development only
18:25TimMcOh!
18:25TimMcThat makes it easier.
18:27weavejesterTimMc: It's so I can make changes to a web page without needing to switch to the web browser and hit the refresh button
18:36madsyAnyone know if seesaw's xyz-panel or when-mouse-dragged behavior is buggy? It jumps all over the place here.
18:47muhooi find clojure code a lot easier to reason about than other OOP, except now that i'm getting into ring and noir. wrappers around wrappers around handlers, i'm getting lost.
18:48muhooit's starting to remind me less of FP and more of OOP, in particular, diving down rabbit holes to figure out what is actually happening.
19:07agriffishow can I get a sorted-map from zip-map? (I'm new to clojure.)
19:08agriffiszipmap I mean.
19:08amalloy(into (sorted-map) ...)
19:10agriffisheh, I was about to paste that.
19:10agriffis(into (sorted-map) (zipmap old-ids new-ids))
19:10agriffisneeding to call sorted-map threw me there.
19:10agriffisamalloy: thanks
19:13agriffisout of curiosity, if you wanted to do it with apply, how would that go? (apply sorted-map ...)
19:14amalloyugh don't :P
19:14agriffisok :-)
19:14amalloybut: (apply sorted-map (interleave olds news))
19:14agriffisoh, gotcha
19:14amalloyi mean, that's actually a more performant solution in this case, i guess
19:14amalloymaybe
19:14agriffisit avoids the conversion, which is kinda nice.
19:16amalloyi'd probably write (into (sorted-map) (map vector olds news)), just because i don't like using interleave to construct argument lists, but i'm probably wrong
19:17agriffisthanks, I appreciate seeing the possibilities.
19:25madsyAny people with seesaw here who could confirm a bug for me?
19:39agriffisThis is almost what I want: (.quote #"" mystring)
19:39agriffisIllegalArgumentException No matching method found: quote for class java.util.regex.Pattern clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)
19:39agriffisThe reason it's *almost* is because I want the class method...
19:41agriffisThe java interop page doesn't really give clues about importing Java classes.
19:41amalloy&(java.util.regex.Pattern/quote ...)?
19:41lazybotjava.lang.RuntimeException: Unable to resolve symbol: ... in this context
19:42agriffisoh! dots instead of slashes
19:42agriffisperfect! thanks again amalloy
19:45ethanishey all
19:45ethanisI'm writing my first clojure-backed web application
19:45ethanisand I've just started fiddling with using clojurescript for the client-side code
19:46ethanisI'm managing the project with leiningen
19:46ethanisand since changing the source-path to "src-clj", I'm getting a ClassNotFoundException when I try doing lein run
19:46ethanishere's a gist with relevant documents: https://gist.github.com/2732826
19:46ethanisany idea what the cause might be?
19:47ethanislein version is 2.0.0-preview4 if that's at all helpful
19:50muhoohow would i flatten a list, not completely, but just the FIRST level
19:51amalloy~flatten
19:51clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
19:53muhooconcat, thanks
19:59zakwilsonThinking about the various lisp-to-sql compilers I've seen... might it be better to directly manipulate maps that represent the query rather than try to express things in terms of functions? Korma does something like that internally, but why not make *that* the interface you use directly?
20:02muhoowhy couldn't you? doesn't korma expose those?
20:06zakwilsonmuhoo: you could. It's not idiomatic though, and the representation might be subject to change.
20:10hiredmanhttps://github.com/hiredman/polycosm is kind of neat
20:14zakwilsonhiredman: that looks very useful. I have some code that uses clojure data structures serialized to byte strings for performance, and this would provide a cleaner way to keep on top of different versions.
20:16hiredmanit still needs a nice clean way to communicate between runtimes, what I have now is via a local messagebus, but that seems kind of silly for things in the same jvm
20:16hiredmanand a clean unloading of modules, but that will be very tricky
21:02muhoois this even a legal defn form: (defn foo {:something "bah" :somethingelse "baz"} [{:id somesym}] (do soemthing)) ?
21:03muhooif so, what does that first map do?
21:05gfredericks(defn foo {} [] nil) compiles
21:06ibdknoxlooks like a failed attempt at metadata to me
21:06gfredericksit sounds vaguely familiar but I can't remember anything about it
21:07muhooibdknox: it's in noir.core/defpage :-)
21:07muhooi'm trying to figure out what it does and why
21:07ibdknoxhm?
21:08muhoohttps://www.refheap.com/paste/2799
21:08ibdknoxah
21:08ibdknoxyeah
21:08ibdknoxthat adds meta
21:08ibdknox,(doc defn)
21:08clojurebot"([name doc-string? attr-map? [params*] prepost-map? ...] [name doc-string? attr-map? ([params*] prepost-map? body) + ...]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata. prepost-map defines a map with optional keys :pre and :post that contain collections of pre or post conditions."
21:09gfredericksany advantage to that form?
21:09ibdknoxno
21:09muhoook thanks
21:09ibdknoxat least not that I know of
21:10ibdknoxI think at the time I thought it would add the meta to function
21:10ibdknoxbut it doesn't :(
21:11muhooah! that'd explain why (meta GET--foo) returns nil
21:12ibdknoxmuhoo: yeah you need to do it on the var
21:12muhoo(meta #'GET--foo), gotcha, but none of that other stuff is in there. ok.
21:13muhoomight just patch that and pull request. i know you're busy these days.
21:21netrinodo we have for clojure something like slim or haml?
21:27hiredmannetrino: yes, it is called "reading data structure literals from a file"
21:27muhoonetrino: stencil/moustache , or hiccup?
21:28netrinoI don't want sexpr-ed html
21:29muhoomaybe https://github.com/davidsantiago/stencil then
21:31netrinomuhoo: thanks, I'll take a look at it
21:31derridanetrino: what's wrong with sexp mappings?
21:32netrinoderrida: it looks ugly for me when writing html
21:32muhoo:-o
21:34netrinoarrr, mustache even uglier :(
21:34netrinomoustache*
21:35muhooyou keep using that word. i do not think it means what you think it means :-)
21:37netrinomuhoo: ok. i mean that's it doesn't looks nice for my eyes, it that correct meaning? :)
21:38derridalook nice compared to what
21:39muhooi guess there's no accounting for taste, as the saying goes.
21:41derrida;)
21:42netrinoderrida: slim looks ok for me. much less noise comprarely to html or sexpr. maybe i'll get used to sexpr-ed html in the future
21:43derridanetrino: are you new to lisp(s)?
21:44muhoofor example, i'm trying to understand how macros work by taking apart noir.core, and trying to understand hof's and fp by taking apart ring/compojure. i'm suspect that might be considered insane, but that's what i'm doing.
21:44ethanisif you're requiring a protocol from another package
21:44ethaniscan you use the standard (:require bla :only (MyProtocol)) syntax?
21:45ethanisI mean: (:require [bla :only (MyProtocol)])
21:45ethanis:require/:use
21:47netrinoderrida: not exactly. i'm ok with lisp syntax. i just don't like how html looks in terms of lisp. i also don't like how html looks by itself. that's why i tried to find something instead of hiccup, which would be similar to slim (which is the most easy to read as for me)
21:49muhooethanis: while procrastinating, i tried that, and it works
21:49muhooalso, wow, speaking of metadata, protocols have a buttload of metadata on them, looks like
21:49ethanisha, thanks muhoo
21:50muhooah, it's not metadata, protocols seem to be maps. a rabbit hole for another time.
22:10XPheriorHow does Clojure handle persistence abstraction? Whenever I look up how to do persistence in Clojure, I see lots of MySQL or MongoDB calls scattered throughout code. Not good!
22:16jasonjcknXPherior: datomic.com
22:16XPheriorjasonjckn: I thought Datomic is a specific type of database. It's a service layer, too?
22:16jasonjcknXPherior: spit/slurp api's do file I/O, which is a form of persistence
22:17XPheriorDatalog is so intimidating, at least for me.. Hah
22:17jasonjcknWhat exactly are you looking for, persistence is a pretty general thing
22:17XPheriorjasonjckn: That's true. I just wish that persistence services extended to the database realm.
22:17XPheriorjasonjckn: Well, I come from the Rails world. So something akin to Active Record?
22:18jasonjckni'm not familiar with active record, but there's definitely some options available to you, ibdknox would know better
22:18jasonjckni'll google one sec
22:18XPheriorjasonjckn: It's just an ORM. You never have any database specific code on your model layers.
22:19jasonjcknRight, yah, if you're looking for the clojure interpretation of ORM it's datomic :)
22:19ibdknoxhm?
22:19jasonjcknbut i'm sure there's already some library in clojure for ORM style
22:19ibdknoxdatomic is a datastore
22:19XPheriorI'm finding Datomic a little hard to understand. Maybe I just need to keep at it.
22:19jasonjcknibdknox: he wants something akin to active record
22:20ibdknoxthere isn't one
22:20XPheriorI figured.
22:20ibdknoxdoesn't make much sense in Clojure
22:20ibdknoxthe closest thing is clj-record
22:20ibdknoxbut don't use that
22:20ibdknoxyou'll be sad
22:20XPheriorIt just feels so wrong to see raw SQL in the model files
22:20XPheriorLike, say I want to swap out my DB's. That'll be a massive pain
22:20ibdknoxwhy would you want to swap dbs?
22:20XPheriorAlso, ibdknox, it already made me sad. Haha.
22:21XPheriorBecause requirements and needs change. You never know, dude
22:21gfredericks(swap! db mysql->postgres)
22:21XPheriorHar har
22:21ibdknoxI've never seen that really work in practice
22:21ibdknoxlol
22:21ibdknoxbut I guess if you don't care about optimizing
22:21ibdknoxthen it would work
22:21XPheriorClojure is big on abstractions, right? Why not with the database details?
22:22gfredericksclojure.java.jdbc is a bit of an abstraction, isn't it?
22:22ibdknoxclojure.java.jdbc does that
22:22ibdknoxkorma is built on top of that
22:22ibdknoxhttp://sqlkorma.com
22:22XPheriorEverytime I see JDBC I run in the other direction screaming. I'll look into it then
22:22gfredericksthat's funny every time I see activerecord I have the same reaction
22:22XPheriorAh, yeah I've seen this. But I feel like I'm just sticking in SQL still
22:23XPheriorHaha, gfredericks
22:23XPheriorEh, you know what. I'll just suck it up and try to write something with Korma and see how I feel about it when I'm done.
22:25XPheriorWish I could get a Clojure job out of college. That would make me very happy.
22:26ibdknoxXPherior: ReadyForZero is hiring
22:26gfredericksat clojure west folks had so many jobs in their pockets their pants were falling down
22:26XPheriorgfredericks: Hahaha
22:26XPherioribdknox: Where are they located?
22:26ibdknoxSF
22:26ibdknoxdowntown
22:26ibdknoxgreat guys
22:26XPheriorAh, darn. I'm moving to Philly.
22:27XPheriorSounds like it
22:27ibdknoxgood problem
22:27XPheriorPhilly/NYC is probably best for start up on East coast
22:27ibdknoxwhy stay east?
22:27XPheriorFamily.
22:27gfredericksweather!
22:28amalloyjust tell 'em they're holding you back. family loves that
22:28ibdknoxweather?
22:28amalloyibdknox: intended counterargument, i think
22:28gfredericksweather.
22:28ibdknoxwest coast weather is *much* nicer than the east coast
22:28ibdknox:p
22:28XPherioramalloy: You tryin' to get me killed?
22:28gfredericksfor incorrect definitions of "nicer", perhaps
22:29ibdknoxlol
22:30gfredericksthis extending core.logic thing is not straightforward
22:31jasonjcknXPherior: i'm leaving my family in canada for technological jobs in san fran
22:31jasonjcknXPherior: listen to your inner geek
22:31XPheriorHah, jasonjckn. I wouldn't enjoy my job as much, honestly.
22:31XPheriorWouldn't be worth it for me.
22:31XPheriorMore power to you, though
22:32XPheriorThe only thing more boring than sitting through a software requirements class is studying for the exam. Dear God.
22:33gfredericksXPherior: what's a use case?
22:33yoklovhm, puting mutable things in a set, bad idea, right?
22:33gfredericksyoklov: bad idea
22:33XPheriorgfredericks: Just shoot me in the head. We had like 4 lectures on UC's
22:33jasonjcknmutable things… bad idea
22:33gfredericksgotta mutate _something_
22:33yoklovgfredericks: how about atoms?
22:34ibdknoxI don't go for use cases, I try to make completely useless things as much as possible. Ends up much simpler that way :D
22:34gfredericksyoklov: why the hookie are they in a set?
22:34ibdknoxthat will technically work
22:34ibdknoxbecause of the way hash is implemented
22:34gfredericksXPherior: draw the use cases out in a sequence diagram
22:35yoklovgfredericks: yeah, was just curious about that, these aren't atoms
22:35XPheriorMy answers for that class are usually "Uh.. Let's just write acceptance tests."
22:35XPheriorHookie... Haha
22:36gfredericks,#{(atom 4) (atom 4)}
22:36clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: (atom 4)>
22:36jasonjcknyah that's really annoying
22:36ibdknoxlol
22:36gfredericks,(let [a (atom 3) b (atom 4) s #{a b}] (swap! a inc) (count s))
22:36clojurebot2
22:36jasonjcknYou can't do this in your DSL: (my-macro {_ 3 _ 4} )
22:37jasonjcknbecause the symbol _ is duplicate key
22:37yoklovand yeah, mutation is a bad idea, but i've been making games in clojure, and i'm trying to find the balance between 'a total pain in the ass to manage due to having state' and 'a total pain in the ass to manage due to having no state'
22:37ibdknoxit will work in CLJS because hash uses some magical goog id thing
22:37yoklovhuh, good to know
22:38jasonjcknyoklov: I made a very simple game, a single atom, and it was so refreshing compared to my C++ days
22:38gfredericks(->> 50 (range) (map atom) (def united-states))
22:38jasonjcknyoklov: i developed the whole game interactively, never restarted the process
22:38gfredericksoh forgot to put them in a set
22:38ibdknoxlol
22:39yoklovjasonjckn: it doesn't really scale up that well though
22:39ibdknoxyoklov: have you looked at my sub-atom implementation?
22:39yoklovibdknox: i have not
22:39jasonjcknyoklov: I know :(
22:39ibdknoxit's in crate
22:39ibdknoxunder binding
22:39jasonjcknyoklov: if you're doing serious game dev, you care about every cpu cycle
22:39yoklovjasonjckn: well, you do during the render loop at least
22:39gfrederickswell not _every_ one. just most of them.
22:40jasonjckn*nods*
22:40yoklovthe issue is more that you can't have any cyclic data
22:41yoklovi think thats my problem at least, some game type things just end up being absurdly hard to do without state, but I feel like there might be a balance somewhere.
22:41ibdknoxsubatoms let you fake it a bit
22:42ibdknoxthat won't address the speed issue though
22:44yoklovibdknox: yeah, i'm looking at it right now, so what exactly is it? just what it sounds like?
22:45ibdknoxmore or less
22:45ibdknoxit lets you keep a reference to some part of an atom
22:45ibdknoxand swap it and deref and such
22:45yoklovoh, that's really interesting
22:46ibdknoxit reconciles the one atom to rule them all thing
22:46gfredericksso if you had an (atom {:apple 2 :pear 4}) you could get a reference to your atom's apple?
22:46ibdknox~rimshot
22:46clojurebotBadum, *tish*
22:49yoklovyeah, i haven't been that big of a fan of the 'state of the world in an atom' thing, seems like a nice fix (though, it seems somewhat out of place in crate)
22:50ibdknoxI needed it for databinding to work
22:50jasonjcknyoklov: why can't you have cyclic data?
22:50gfrederickscyclic data and immutable data structures hate each other
22:50yoklovjasonjckn: how would you make cyclic data without any reference types?
22:50jasonjckni was assuming ref types, nvm
22:51yoklovibdknox: yeah, by the way, is that stuff in clojars/usable from lein yet?
22:51ibdknoxI thought I pushed it
22:51ibdknoxmaybe I didn't
22:51yoklovyou may have, but hadn't last i checked (a while ago)
22:52yoklovseems to be
22:52ibdknoxjust pushed an alpha3 with the absolute latest I have
22:52ibdknoxwell
22:52ibdknoxclojars is being slow
22:52ibdknoxbut it'll be there in a sec
22:54gfredericks,(let [a (atom nil) b (atom a)] (reset! a b) a)
22:54clojurebot#<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #>>>>>>>>>>
22:54gfrederickswho knew after five cycles it finishes.
22:56yoklovi remember in racket there was a way to make immutable cyclic data structures, which would be nice in clojure, but i think it required even more primitives and i can't imagine it would be worth it in clojure.
22:57yoklovit's nice to use a language which cares about the size of it's core
23:06muhoowhat in the world would @foo# mean? and no, it's not an atom or ref
23:07gfredericksit means (deref foo#)
23:08muhoohmm, i guess you can deref things that aren't atoms? interesting
23:08gfredericksif it's inside a backtick the foo# will get gensymed
23:08muhooit is indeed
23:08gfredericks,(-> 1 (+ 2) delay deref)
23:08clojurebot3
23:08gfredericksyou can deref all sorts of things
23:08gfredericksatoms, refs, vars, agents, futures, promises, wedding cakes
23:09tmciverthe cake is a lie!
23:09muhoojava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IDeref
23:09gfrederickshell I once saw a feller deref an old sheep dog what couldn't walk on all fours anymore
23:11muhoofunctions can't be derefed, apparently, either
23:11gfredericksin clojureql you would build query objects and then deref them
23:12muhooah, but the var that holds the function can. got it *light bulb*
23:12muhoo(deref #'argh) --> does not blow up
23:13muhooheh @#'argh
23:13gfredericksmuhoo: that's a good way to get at private vars
23:13muhooi wonder what's the longest string of looks-like-cursing characters that can be put together without the compiler puking
23:13tomojit's unfortunate that IDerefWithTimeout doesn't fit well with cljs
23:14gfredericks,(read-string "@#'!?")
23:14clojurebot(clojure.core/deref (var !?))
23:14muhooheh
23:15gfredericks,(read-string "@#'!?$%*")
23:15clojurebot(clojure.core/deref (var !?$))
23:15gfrederickshm
23:15gfredericks,(read-string "(@#'!?$%*)")
23:15clojurebot((clojure.core/deref (var !?$)) %*)
23:16gfrederickssymbols can't have %'s after the first character apparently
23:16metellus,(read-string ";@$%&*%^#%^^**(^#%$%%*(&($^&#")
23:16clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:17metellus,(read-string "(@#'!?$%*);@$%&*%^#%^^**(^#%$%%*(&($^&#")
23:17clojurebot((clojure.core/deref (var !?$)) %*)
23:17metellussuccess!
23:27amalloytomoj: why not? ajax calls happen on another thread; you could try-to-deref them
23:35tomojand it blocks for timeout-val if the call doesn't finish? what does 'block' mean?
23:37tomojmaybe there's some sensible semantics, I dunno
23:37tomojbut I want protocols in cljs that don't exist in clojure yet, whatever cljque is an attempt at finding
23:38tomojactually I can't think of any sensible semantics unless you have continuations baked in to cljs or something
23:39tomojs/timeout-val/msec/
23:40tomojor something like lamina's async macro?
23:41tomojthen you could translate a deref with a timeout into the async analogue of lamina's IDerefWithTimeout impl
23:47gfredericksI am putting ~' all over the place. It is time for misquote.
23:50tomojfor writing macros?
23:50tomojI don't understand the use case for misquote I mean
23:50gfrederickssexp templating
23:51gfredericksbut yeah writing macros
23:51tomojlike hiccup style?
23:51gfredericksin the rare cases where you don't want the backquote symbol expansion
23:52tomojwouldn't dropping ` just make them hairier?
23:52gfredericksnot in this case
23:52gfredericksthis is more like code generation
23:52gfredericksgenerating giant deftypes and related things
23:53tomojare you actually saving out the code to files? I ask because I have wondered about that
23:53gfredericksno
23:53gfrederickscompile-time
23:54gfredericksso rather than (deftype Foo [x1 x2 x3 ... x100]) I have a macro that does that