#clojure log - May 19 2012

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

2:42 tomoj: this benchmark is silly, right? https://gist.github.com/139af93a585057d4121a

2:43 Chousuke: I guess so

2:45 it's also completely expected, fwiw

2:46 the overhead from take looks large because realising the actual elements in the range seq takes next to no time

2:54 wkmanire: join #refheap

2:56 amalloy: tomoj: especially because range produces a chunked sequence and take doesn't do anything to preserve its chunkiness

2:58 fwiw, with the new reducers from 1.5 the overhead from take is probably smaller than the cost to create a range

3:23 tomoj: amalloy: cool

3:23 I am trying to think whether I should use reducers for this

3:38 y3di: why did clojure gain traction and not jfli, Foil, Lisplets, or DotLisp

3:40 Raynes: Because I'm here and not there.

3:41 * Raynes dances

3:41 rothbard: y3di: maybe because it came out at a time that jvm languages were becoming hot and industrially used (particularly jruby and scala)

3:41 jvm languages other than java that is

3:42 Raynes: Well, some of it is simpler than that.

3:42 DotLisp was a Rich Hickey project. It didn't gain traction because he moved on to Clojure.

3:42 One is the result of the other.

3:42 fliebel: all of them seem to be form rich

3:43 Raynes: Right.

3:43 It's kind of a matter of what he decided on.

3:43 y3di: fliebel: yep

3:43 ahh

3:43 rothbard: Raynes: well if DotLisp came out in 2003 that gave it several years chance to become popular before Clojure was released.

3:44 Raynes: But how long was he working on Clojure during that time?

3:44 How much did he work on dotLisp during that time

3:44 fliebel: There where a lot of lisps on the JVM before Clojure too. Did Dotlisp offer any sgnificant advantage over a CL on the JVM?

3:44 rothbard: I 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.

3:45 (not sure on date of first clojure release)

3:45 Raynes: fliebel: dotLisp is .net

3:45 rothbard: fliebel: I think using .net types instead of some wrapper types and not botherin gwith backwards compatibility

3:45 Raynes: rothbard: 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.

3:46 rognv: Is clojureCLR any good?

3:46 fliebel: rognv: No idea, it doesn't run on Mono.

3:46 rognv: that means no then :(

3:47 Raynes: I don't understand the correlation between goodness and mono.

3:47 Why does it matter if it runs on Mono? Isn't the point of .NET Windows?

3:48 rognv: I guess the word "better" would be more appropriate.

3:48 fliebel: Did 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?

3:49 rognv: IIRC, it's just some dependency issue. It depends on some native lib that doesn;t run on Mono

3:50 rothbard: Raynes, well it matters if rognv runs Linux/Mac. many .net users want to deploy to Linux or iOS.

3:51 fliebel: Oh, yea... phonegap, or the other one, they use mono, right?

3:51 rothbard: monotouch

3:51 fliebel: yea, clojure-clj depends on vjslib

3:53 y3di: what are the arguments for clojure not being a real lisp? are there even any remotely valid ones?

3:53 rothbard: fliebel: I haven't looked closely but they didn't appear to have clojure's niceties other than basic java interop

3:54 Raynes: rothbard: Right, but I'm not sure why they would.

3:54 rothbard: y3di: for some arbitrary definitions of "real lisp" there are good arguments.

3:54 fliebel: y3di: That it doesn't use enough parens? I don't know.

3:54 rothbard: Raynes, clojure-clr specifically or .net in general?

3:54 Raynes: .net in general

3:55 rothbard: Raynes, why they would want to deploy to Linux/iOS?

3:55 fliebel: rothbard: Which defs?

3:55 Raynes: Yes.

3:55 rothbard: Raynes: 1) they already have linux servers 2) linux servers are cheaper 3) the devices run iOS

3:56 Raynes: But why would they write .NET with the intention of running it on Linux?

3:56 Borkdude: y3di: Rich wanted to use Lisp while clients decide they want Java/.NET. The solution is Clojure. (story short)

3:56 rothbard: Raynes, they like C#/F#/etc

3:56 Raynes: Meh, it doesn't matter. People do things. Life goes on.

3:57 Borkdude: Raynes: there are people who don't want to learn Objective-C to create apps for the iPad, but want to use C#

3:57 Raynes: just like some people want to use Clojure instead of Javascript

3:57 Raynes: or Java...

3:59 rothbard: Raynes: there's actually a lot of good linux software written in C#, e.g. Tomboy

4:01 Borkdude: I 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)

4:03 fliebel: Hm, does anyone actually have mono installed?

4:05 tomoj: I do

4:05 I don't remember why

4:06 daniel___: what would be the quickest way of finding the index of the least significant or most significant bit in a binary number?

4:08 Borkdude: fliebel: I have

4:08 tomoj: daniel___: look it up by type? guess I don't understand

4:08 fliebel: I was trying to see if clojure-clr works, but I don't seem to have it, neither does my package manager.

4:08 tomoj: the index of the least significant bit of any number on the jvm is 0, no?

4:09 amalloy: $javadoc Long

4:09 lazybot: http://docs.oracle.com/javase/6/docs/api/java/lang/Long.html

4:10 amalloy: has highestOneBit and lowestOneBit

4:11 daniel___: oh, thanks amalloy

4:11 thats what i meant

4:13 looks like that gets me a Long with that bit, but doesn't get me the index

4:13 Borkdude: fliebel: I installed it manually

4:13 daniel___: i think in combination with numberOfLeadingZeros i can work it out

4:14 Borkdude: "Why isn't Clojure a real Lisp?" - "Why isn't the Java Virtual Machine a real Machine?"

4:14 fliebel: Borkdude: to much work. and then I can't uninstall.

4:16 Borkdude: fliebel: what OS are you on?

4:19 btw, 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)

4:19 rothbard: fliebel: looks like dotlisp did have vector literal syntax and maybe multiarit functions but not hashmap syntax ({} was used for records)

4:20 Borkdude: although some students even got creating webservices with WCF working under OSX

4:26 something else, what is the current status of developing mobile apps with clojure?

4:27 is it possible?

4:27 rothbard: Borkdude: possible on android but startup time is slow. possible with clojurescript+phonegap, haven't seen any examples though

4:28 muhoo: 4 hours in, and i *almost* understand how defpage works

4:45 Borkdude: has anyone tried the android emulator on osx lately? last time I checked it was unusably slow

4:52 alexyakushev: Borkdude: 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

4:58 Borkdude: alexyakushev: tnx

5:04 muhoo: android simulators are in general quite slow. easier to test on an actual device.

5:50 mudphone: anyone have examples of good write-ups for use cases of Clojure vs. Haskell?

5:54 scottj: mudphone: pretty simple. if you want static typing, haskell. if you want jvm, clojure. otherwise pick preference.

5:54 mudphone: scottj: interesting, thanks

5:55 I don't know much about the Haskell concurrency story

5:55 i'm assuming people use monads for state (in Haskell)

5:57 fliebel: scottj: Clojure also does static typing, right?

5:57 scottj: fliebel: nope, there are people working on it though

5:57 fliebel: scottj: yea: http://cloud.github.com/downloads/frenchy64/papers/type-inference-review.pdf

5:58 scottj: mudphone: 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

6:02 mudphone: with monads, i guess

6:49 daniel___: are there any problems using '-' or '+' in a function name?

6:49 defn bitscan+ defn bitscan-

6:50 babilen: daniel___: No, why? Do you have a problem with that?

6:51 daniel___: babilen: i have a problem, just wanted to rule that out

6:51 havent worked it out yet

6:51 Borkdude: if you want to call it from java it might be problematic ;)

6:52 daniel___: yeah, not planning on doing that

6:52 somethings wrong with my logic atm, think that function is fine

6:52 its how im using it

6:52 y3di: commonlisp has static typing right?

6:52 Borkdude: y3di: no

6:52 raek: calling such functions from java is not a problem

6:53 babilen: daniel___: Would it make sense to paste the code to, say, http://refheap.com so we can take a look?

6:53 daniel___: yeah, maybe

6:54 raek: RT.var("some.ns", "bitscan+").invoke(...);

6:57 daniel___: might be hard to work out whats going on: https://gist.github.com/2730452

6:57 works for positive (bitscan+) attacks but not negative (bitscan-) attacks

6:58 y3di: is the clojure compiler progressively being rewritten in clojure

6:59 Borkdude: ,(-> (clojure.lang.RT/var "clojure.core" "+") (.invoke 1 2 3))

6:59 clojurebot: 6

7:00 scottj: y3di: no, but some steps have been taken to make that easier when it eventually happens (clojurescript and protocols)

7:00 daniel___: it's not a real situation at the moment, i have all 32 pieces plus an extra bishop

7:00 still should work though

7:17 ro_st: anyone using monger?

7:17 got your book yet, matessim?

7:18 Borkdude: hmm, ##(-> (clojure.lang.RT/var "clojure.core" "defn") (.invoke nil nil 'foo '[a b] '(+ a b)))

7:18 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!

7:18 Borkdude: ,(-> (clojure.lang.RT/var "clojure.core" "defn") (.invoke nil nil 'foo '[a b] '(+ a b)))

7:18 clojurebot: (def foo (clojure.core/fn ([a b] (+ a b))))

7:21 Borkdude: so when you invoke defn this way, you get the macroexpansion back?

7:21 or how does this work, defn isn't even a macro

7:22 it is a function which returns a clojure expression…

7:25 mfex: Borkdude, defn *is* a macro

7:26 gfredericks: and macros can be seen as functions which return clojure expressions :D

7:26 I think maybe in the source it looks like a function because defmacro doesn't exist yet

7:26 ForNeVeR: Macros *are* such functions.

7:26 Borkdude: mfex: gfredericks ah that's it: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L263

7:27 (. (var defn) (setMacro)) …

7:27 matessim: ro_st, its in the mailbox office

7:28 it didn't fit my mail box, so i need to pick it up, its open tomorrow only :)

7:28 closed on weekends :/, but can't wait to start reading it.

7:28 ro_st: it's a great book. i finished it recently, although there are plenty of places i need to revis

7:28 it

7:30 gfredericks: ForNeVeR: not quite just that, but mostly just that

7:30 I could write a function that returns code and it would not be a macro

7:31 raek: "macro functions" also take two extra arguments

7:32 so when you write (defmacro foo [a b] ...) a function like (fn [a b &env &form] ...) will be created

7:32 (not sure about the ordering of the extra args, though)

7:34 Borkdude: hmm, so the metadata (:macro true) decides wether the expansion will be evaluated: https://www.refheap.com/paste/2795

7:35 raek: the extra args are the first two

7:36 raek: Borkdude: it decides whether the compiler should call the macro at all

7:36 macro functions are never applied at runtime

7:36 Borkdude: raek: right

7:37 raek: so 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

7:37 Borkdude: raek: yeah, cool.

8:16 Vinzent: Hi. Any idea why this function https://www.refheap.com/paste/2796 throws StackOverflowError when called?

9:50 glitch99: Quick 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?

9:52 nevermind - (eval foo)

10:29 jweiss: is 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:30 i'm guessing i just make swank the main class, and a real dep instead of a dev dep?

10:52 hm.. 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:58 fliebel: What would it take to automatically answer emails? You know, NLP and all that...

11:20 ifesdjeen: hi guys!

11:21 does anyone know why (contains? [ :id :another-field ] :id) evaluates to false?

11:21 whereas (contains? [1 2] 1) evaluates to true

11:22 and (= :id (first [:id :another_field])) evaluates to true, too...

11:22 metellus: it's based on the index, not the contents

11:22 ifesdjeen: not sure why contains on a vector of keywords returns false

11:22 ah

11:22 metellus: ,(contains? [:a :b] 1)

11:22 clojurebot: true

11:23 ifesdjeen: i see now

11:23 (contains? [1 3] 3) is false

11:23 makes sense, actually

11:24 i guess i'll use some

11:24 thank you metellus

11:35 lemoq: hi folks!

11:38 Got 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:42 here's the code that's causing trouble http://pastebin.com/hPd6846r

11:44 tmciver: lemoq: I don't see a definition for blank . . .

11:46 lemoq: also, it looks like you could just put the defn for col-parser after the defs for blank and expr?

11:46 lemoq: in which case you don't need declare. I don't think I've ever had the need for declare myself.

11:48 lemoq: tmciver: 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:48 But I'm trying that now

11:52 daniel___: i want to restrict a functions argument to within a certain range and if it isn't in the range, return 0

11:52 i remember reading about ways to restrict the arguments but i suppose this will return an error

11:53 tmciver: daniel___: you can use pre (and post) condition but these throw Assertion errors if their tests don't pass.

11:53 daniel___: i guess i need an if statement

11:54 tmciver: daniel___: yes, otherwise I think you need to manual check for that in your function to return 0.

11:54 daniel___: yeah, i think i need to wrap the whole function in an if else

11:54 how can i check if a number is within a range

11:55 tmciver: daniel___: (if (not (< a arg b)) 0 ...)

11:55 ,(< 1 2 3)

11:55 daniel___: yep, that'd do nicely

11:55 clojurebot: true

11:55 tmciver: ,(< 1 3 2)

11:55 clojurebot: false

11:55 daniel___: i thought there might be a function like (if (within [1 2 3] 1) ..

11:56 tmciver: daniel___: well, you can check if a number is a part of a collection with 'some'

11:57 hyPiRion: Either (some = [1 2 3] 1) or (contains? #{1 2 3} 1)

11:58 tmciver: or (some #{1} [1 2 3])

12:01 daniel___: don't worry, i used an if and it's working perfectly

12:01 using some wouldnt be any more concise

12:02 adeelkh: tmciver: clever

12:03 tmciver: adeelkh: nah, it's right out of the doc: ##(doc some)

12:03 lazybot: ⇒ "([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:05 adeelkh: tmciver: yeah but that only works because a set can actually be treated as a function that tells you whether something is in it

12:05 ,[(#{1} 1) (#{1} 2)]

12:05 clojurebot: [1 nil]

12:21 gfredericks: well it doesn't quite

12:21 '(#{false} false)

12:21 ,(#{false} false)

12:21 clojurebot: false

12:26 adeelkh: gfredericks: well, to be exact, it (s x) for some set s returns x if x is in s or nil otherwise

12:26 -"it"

12:46 lemoq: I 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:48 here's some code... http://pastebin.com/cpGMWp0u

12:48 * gfredericks looks

12:49 adeelkh: i'm trying to set up a clojurescript repl. where exactly do i put (repl/connect "http://localhost:9000/repl")?

12:49 lemoq: happens 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:50 xeqi: ohh, a parser combinator

12:51 gfredericks: this is-valid function is strange

12:51 lemoq: gfredericks: y?

12:52 xeqi: yes, it's a parser combinator... fun fun fun :)

12:52 gfredericks: lemoq: because I forgot you had your own and/or :)

12:52 (def expr (or llist other)) was pretty weird otherwise

12:53 lemoq: gfredericks: yeah :)

12:53 gfredericks: lemoq: what's the error?

12:54 lemoq: copy 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:54 which seems pretty odd to me

12:55 it seems like the stuff declared in the (declare ...) part is not redefined later on, as I would expect

12:56 tmciver: lemoq: hmm, I don't seem to be getting any error, though the calls at the end all return nil.

12:57 xeqi: I get the nil returns too in swank

12:57 tmciver: lemoq: wait, (is-valid "(a)") gives that error

12:57 xeqi: but if I call (expr "(a)") I get the unbound error

12:59 lemoq: errors 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:01 hiredman: lemoq: do you understand what def and declare do?

13:01 lemoq: they create vars, which are implicitly deref'ed when you name them

13:02 def gives the var a value, declare doesn't

13:02 lemoq: yeah, that's my understanding: declare kind of "reserves" a name, and def binds it

13:02 gfredericks: do they create new vars each time?

13:02 mfex: adeelkh, put it in your .cljs file?

13:03 adeelkh: mfex: i'm using node.js, so then i would just compile and run it with node?

13:03 hiredman: gfredericks: no

13:03 lemoq: so 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:04 hiredman: but you refer to the var expr before the def that gives it a value is reached

13:04 so the var expr is deref'ed, but it has no value

13:04 line 39

13:04 mfex: adeelkh, repl/connect is for the browserrepl

13:05 adeelkh: mfex: i thought so. so how would i get it working with node?

13:05 lemoq: hiredman: yes, because that what i understood - i can use the name and making the binding later

13:05 expr is bound in any way before the first real call

13:06 mfex: adeelkh, node.js is the server side right? repl/connect is for the browser on the client side

13:06 gfredericks: lemoq: you could use the name inside a function if you didn't call that function till later

13:06 adeelkh: mfex: that's right. i'm trying to make a command line script you can run with node.

13:07 gfredericks: but 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:07 or unbound

13:07 * gfredericks forgets

13:07 adeelkh: mfex: and i'm wondering how i would get `lein trampoline cljsbuild repl-listen` working

13:07 gfredericks: either way not what you want

13:07 xeqi: lemoq: (def inlist expr) immediately derefs expr and binds it to inlist

13:07 you can use (def inlist #'expr) instead

13:08 hiredman: xeqi: only if the value of expr is going to be a function

13:10 lemoq: xeqi: what does #' stand for? kind of a delays deref?

13:10 gfredericks: #'foo === (var foo)

13:11 it gives you the var itself instead of the var's value

13:11 not 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:12 mfex: adeelkh, I don't know of a client side version of the repl to be used inside nodejs scripts

13:12 xeqi: gfredericks: ah, yeah, thanks for catching that it has to be a function

13:12 gfredericks: xeqi: hiredman caught it. I wouldn't've

13:12 xeqi: heh, thanks hiredman

13:13 lemoq: works perfect, I am only passing functions around here

13:13 thank's a lot guys!

13:40 kumarshantanu: Hey guys, anybody familiar with Lein2 profiles looking at this?

13:41 Borkdude: kumarshantanu: whatever you're going to ask, try #leiningen

13:42 kumarshantanu: Borkdude: Thanks!

13:47 tomoj: short variadic accumulator generator: (comp #(partial swap! % +) atom)

14:07 tankpilot: hi all. I'm about to pick noir for beginning web development with clojure

14:08 it seems like the clojure way of web dev... am I right? is there any more common/popular framework around the community now?

14:08 gfredericks: tankpilot: I think that's it. I've never used it though.

14:10 xeqi: tankpilot: noir seems to the popular starting point

14:13 at a lower level there is compojure, which noir uses underneath

14:15 tankpilot: xeqi: thanks for the answer

15:23 LauJensen: Evening gents

15:23 hyPiRion: Evening.

15:34 Bronsa:

16:05 patchwork: Hmm… any reason running lein deps on a freshly cloned repo would give "Operation timed out" errors?

16:05 I can't run any lein commands

16:06 xeqi: is there a repo defined that is unaccessible?

16:06 patchwork: No extra repos are defined

16:07 All the dependencies are on clojars

16:07 It is quil, I was hoping to try it out

16:09 Hmm… lein commands are not working on any repos

16:09 They all have httpclient timeouts

16:09 But I am connected to the internet?

16:09 Raynes: Are you sure? (har har har)

16:10 patchwork: Is there some repo lein depends on that could be down?

16:10 xeqi: do you have any maven proxy settings?

16:10 not sure if that could cause it

16:10 patchwork: Raynes: I seem to be, since you can read my bewildered messages

16:11 xeqi: Hmm… not that I know of. How could I check that?

16:12 xeqi: ~/.m2/settings.xml I think, never used them

16:12 clojurebot: Cool story bro.

16:13 Raynes: clojurebot: Thanks for your clever interjection.

16:13 clojurebot: thanks for your suggestion, but as usual it is irrelevant

16:13 Raynes: Sick burn.

16:13 xeqi: haha

16:14 patchwork: it should just be central and clojars for repos

16:14 patchwork: xeqi: That file doesn't exist, so I assume I don't have proxy settings

16:14 should I create them?

16:14 xeqi: no

16:14 patchwork: I am using the latest leiningen binary from master

16:15 xeqi: lein version?

16:16 patchwork: `lein version` times out!

16:16 what… is going on

16:16 xeqi: `cd .. && lein version`

16:16 Borkdude: patchwork: are you sure you are not making up our reactions yourself and you are indeed connected to the internet?

16:16 patchwork: Yeah, I'm in no project dir

16:17 Borkdude: entirely possible, I will explore this further

16:17 Yeah lein version won't complete!

16:17 neotyk: hello everyone

16:18 Borkdude: patchwork: did you just "install" leiningen, or change it's version?

16:18 neotyk: hi

16:18 patchwork: Borkdude: Yeah, I have the latest lein binary from the master branch on github

16:19 neotyk: patchwork: you compiled it?

16:19 Borkdude: what does it say when you just do "lein"?

16:19 patchwork: It hangs

16:20 Borkdude: patchwork: OS?

16:20 patchwork: neotyk: I would compile it, but `lein compile` hangs!

16:20 MACOSX 10.6.8

16:21 Is there another way to compile the lein binary without lein?

16:21 neotyk: patchwork: have you removed your ~/.m2/repository already?

16:21 patchwork: neotyk: Not lately

16:21 you think that will help?

16:21 neotyk: patchwork: lein is there

16:21 patchwork: Does maven get into some inconsistent state somehow?

16:22 xeqi: or in ~/.lein/self-installs/

16:23 patchwork: removed ~/.lein/self-installs, it redownloaded, and is hanging again!

16:23 Borkdude: patchwork: 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:23 neotyk: xeqi: right, I don't see it in m2 repo, but I see them in .lein

16:23 patchwork: blowing away .m2

16:24 Thanks for the help guys, this is really weird

16:24 Borkdude: lein self-installs are stored in ~/.lein/self-installs

16:24 neotyk: patchwork: you can C-\ hanging lein, and gist output

16:25 Borkdude: patchwork: to be sure, throw away ~/.m2 and ~/.lein

16:25 patchwork: also if you have previous version of the lein script, be sure not to confuse them

16:26 neotyk: Borkdude: maybe we should do install party next ams-clj?

16:26 Borkdude: neotyk: why not

16:27 neotyk: if there are actually people who need this

16:27 neotyk: Borkdude: but then, it just works for us

16:28 patchwork: Alright, blew away ~/.m2 and ~/.lein, redownloaded, many deps started downloading right away but then it started hanging again!

16:28 I wonder if this is because one of my plugins

16:28 Borkdude: patchwork: what plugins?

16:28 patchwork: Well, I have a ~/.lein/profiles.clj with some plugins defined

16:28 neotyk: there you go

16:28 Borkdude: neotyk: what do you mean?

16:28 patchwork: throw it able

16:28 away

16:28 patchwork: Alright

16:28 Borkdude: patchwork: or just rename .lein to .lein-backup or smth

16:29 patchwork: Oh brutal

16:29 yeah one of the plugins was causing it

16:29 Is there something that maps plugins to their respective repos?

16:30 one of these must be coming from somewhere else

16:30 Borkdude: patchwork: maybe lein-newnew or smth?

16:30 patchwork: I can only guess, but nice that it's solved...

16:31 patchwork: I had also problems with profiles.clj causing the leiningen plugin in Eclipse to not work correctly, it's tricky

16:32 patchwork: Yeah that is rough, having lein's working properly depending on whether all plugin repos are functioning or not

16:33 I don't even have that many, time to do some process of elimination

16:33 Thanks for the help

16:33 Borkdude: patchwork: maybe you can let us know what caused the bug, it's helpful to share the knowledge

16:33 neotyk: I didn't understand what you meant by "it only works for us"

16:35 neotyk: how were the previous install fests, people actually came for that specifically?

16:37 neotyk: Borkdude: it only works for us ~ if there are actually people who need this

16:38 as in, we don't need it

16:38 Borkdude: after first Amsterdam October, we organized one install session, and once before

16:39 Borkdude: but nobody asks for it, or we didn't ask

16:41 Borkdude: it was basically getting lab repl setup in eclipse and intellij

16:41 gfredericks: what's the emacs thing that does the remote filesystems?

16:41 nm

16:41 Borkdude: neotyk: I see

16:41 * gfredericks doesn't know why he didn't just google that first

16:43 espeed: What's the clojure naming convention for funcs that would have the same name as a built-in?

16:43 Do you add a hyphen? e.g. (defn long- [] ())

16:43 Raynes: No, you can just name them the same.

16:43 Borkdude: espeed: the same name is the same name ;)

16:44 Raynes: They will either shadow built in functions or clients can (require ...) them so as to not shadow the built ins.

16:44 This is a common thing.

16:44 gfredericks: mildly annoying though

16:44 amalloy: well, it's not *common*. but it happens

16:44 neotyk: espeed: (:refer-clojure :exclude [await])

16:44 amalloy: sometimes people give them different names to avoid the confusion/difficulty, sometimes they use the same name. the latter is probably better

16:44 Raynes: amalloy: It's pretty common.

16:44 stuarthalloway: please use good names and namespace qualify

16:45 gfredericks: Raynes: 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:45 Raynes: See, stuarthalloway agrees with me. It was originally my idea though.

16:45 stuarthalloway: chronological order of IRC appearance != orginality :-)

16:45 neotyk: gfredericks: http.async.client uses it

16:46 Borkdude: good names like "contains?" so each day people come in asking why (contains? [4 5] 4) is false :P

16:46 (sorry)

16:46 hyPiRion: I like the difference between next and rest better.

16:47 ,(list (next [1]) (rest [1]))

16:47 clojurebot: (nil ())

16:47 stuarthalloway: re: contains? -- people who refuse to read even the first five words of docstrings should expect to be confused often :-)

16:48 gfredericks: ,(->> contains? var meta :doc (re-seq #"\S") (take 5) (clojure.string/join " "))

16:48 clojurebot: "R e t u r"

16:49 gfredericks: ah, that explains it

16:49 ,(->> contains? var meta :doc (re-seq #"\S+") (take 5) (clojure.string/join " "))

16:49 clojurebot: "Returns true if key is"

16:51 amalloy: &((juxt next rest) [1]) ;; hyPiRion

16:51 lazybot: ⇒ [nil ()]

16:51 Raynes: Nuts.

17:00 gfredericks: so you can extend a sub and super type with the same protocol, and it picks the most specific implementation?

17:12 amalloy: yes

17:13 gfredericks: that is cool.

17:13 java methods work the same way?

17:14 wait

17:14 of course

17:14 O_O

17:15 where's -?> defined these days?

17:15 Bronsa: core.incubator

17:15 gfredericks: ah right, thx

17:15 Borkdude: ,(doc -?>)

17:15 clojurebot: It's greek to me.

17:16 Borkdude: nice documentation ;)

17:16 gfredericks: Borkdude: is like -> but short-circuits as soon as nil

17:16 Bronsa: it's not part of clojure.core

17:16 it's in a library

17:17 LeNsTR: ,(clojure-version)

17:17 clojurebot: "1.4.0-master-SNAPSHOT"

17:17 gfredericks: man incubator is on version 0.0.25

17:17 0.1.0 is a milestone now?

17:22 zakwilson: ring.adapter.jetty seems to lack any way to shut a server down. Is that inherent, or just missing?

17:23 weavejester: zakwilson: 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:23 zakwilson: Under normal use, the adapter blocks until the application ends.

17:29 zakwilson: weavejester: is destroy the correct method to call to shut it down?

17:29 weavejester: zakwilson: I believe there's a method called "stop" on the Server class.

17:30 zakwilson: Oh, there it is, from org.mortbay.component.AbstractLifeCycle. Ugh. Java APIs.

17:33 tmciver: weavejester: 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:35 weavejester: tmciver: Headers are case insensitive, while Clojure maps are case sensitive, so there needs to be some normalization.

17:35 gfredericks: lower-case letters are pretty

17:36 weavejester: tmciver: 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:36 tmciver: The easiest way to normalize a case insensitive string is to lower or uppercase it.

17:36 tmciver: So Ring request maps use lower-case header names.

17:37 tmciver: weavejester: so Ring also lower cases the headers in the request?

17:37 weavejester: tmciver: Yep

17:38 tmciver: weavejester: which 't' are you referring to that would break the code?

17:38 weavejester: tmciver: "Content-type" with a lower "t" in the type, as compared to "Content-Type" which is the usual way of writing it.

17:38 tmciver: In HTTP both are equivalent. In a Clojure map, they're different.

17:39 ,(let [headers {"Content-type" "text/html"}] (headers "Content-Type"))

17:39 clojurebot: nil

17:39 gfredericks: ,(dotimes [n 5] (println "(inc weavejester)"))

17:39 clojurebot: (inc weavejester)

17:39 lazybot: ⇒ 1

17:39 clojurebot: (inc weavejester)

17:39 lazybot: ⇒ 2

17:39 clojurebot: (inc weavejester)

17:39 lazybot: ⇒ 3

17:39 clojurebot: (inc weavejester)

17:39 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

17:39 clojurebot: (inc weavejester)

17:40 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

17:40 TimMc: haha!

17:40 tmciver: weavejester: OK, good enough. As long as Ring is self-consistent. :) Thanks.

17:41 TimMc: weavejester: Any new thoughts on the file-change event thing?

17:42 weavejester: TimMc: Yep, I did this: https://gist.github.com/2732467

17:43 It could probably be made more general

17:44 But basically I add a watch on the atom, which means I don't have to make or use a separate event-registering service

17:44 And then I use a promise to wait for the value.

17:44 Using a promise to deliver a boolean that's always true is a little… bad I guess.

17:45 But a more general function that returned a more specific result would, I think, be idiomatic.

17:45 Since we want to watch a ref, and then deliver a value when something happens, which is a promise.

17:46 The full code is here: https://github.com/weavejester/ring-refresh/blob/master/src/ring/middleware/refresh.clj

17:47 gfredericks: in dnolen's new extending-core.logic wiki page, why is there no need to unify Datum with LVar?

17:50 and why does this fail? (macrolet [(foo [] (list 'deftype 'FOO ['x]))] (foo))

17:53 TimMc: weavejester: Did you see this suggestion? http://clojure-log.n01se.net/date/2012-05-18.html#16:12

17:54 weavejester: TimMc: Oh, no, but I kinda did that by using a timestamp

17:54 TimMc: Each time a file is updated, an atom is reset with the most recent modification date.

17:55 TimMc: 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:57 TimMc: weavejester: It looks like your current code will wait up to 60 seconds, but has no minimum.

17:57 weavejester: TimMc: Right

17:58 TimMc: I guess it would make sense to limit it

17:58 TimMc: In case some automatic process is rapidly updating a file in a watched directory

17:59 TimMc: Though that would be more "rate" than a minimum wait time.

18:17 TimMc: weavejester: 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:17 A double-timer system.

18:18 weavejester: TimMc: Maybe… I'm not too worried, though, as people can always kill the tab or the server if it starts refreshing too much.

18:19 TimMc: Certainly, build for what you *know* is needed.

18:21 weavejester: It's basically for development only

18:25 TimMc: Oh!

18:25 That makes it easier.

18:27 weavejester: TimMc: 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:36 madsy: Anyone know if seesaw's xyz-panel or when-mouse-dragged behavior is buggy? It jumps all over the place here.

18:47 muhoo: i 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:48 it'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:07 agriffis: how can I get a sorted-map from zip-map? (I'm new to clojure.)

19:08 zipmap I mean.

19:08 amalloy: (into (sorted-map) ...)

19:10 agriffis: heh, I was about to paste that.

19:10 (into (sorted-map) (zipmap old-ids new-ids))

19:10 needing to call sorted-map threw me there.

19:10 amalloy: thanks

19:13 out of curiosity, if you wanted to do it with apply, how would that go? (apply sorted-map ...)

19:14 amalloy: ugh don't :P

19:14 agriffis: ok :-)

19:14 amalloy: but: (apply sorted-map (interleave olds news))

19:14 agriffis: oh, gotcha

19:14 amalloy: i mean, that's actually a more performant solution in this case, i guess

19:14 maybe

19:14 agriffis: it avoids the conversion, which is kinda nice.

19:16 amalloy: i'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:17 agriffis: thanks, I appreciate seeing the possibilities.

19:24 * the-kenny always forgets you can map over multiple seqs.

19:25 madsy: Any people with seesaw here who could confirm a bug for me?

19:39 agriffis: This is almost what I want: (.quote #"" mystring)

19:39 IllegalArgumentException No matching method found: quote for class java.util.regex.Pattern clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)

19:39 The reason it's *almost* is because I want the class method...

19:41 The java interop page doesn't really give clues about importing Java classes.

19:41 amalloy: &(java.util.regex.Pattern/quote ...)?

19:41 lazybot: java.lang.RuntimeException: Unable to resolve symbol: ... in this context

19:42 agriffis: oh! dots instead of slashes

19:42 perfect! thanks again amalloy

19:45 ethanis: hey all

19:45 I'm writing my first clojure-backed web application

19:45 and I've just started fiddling with using clojurescript for the client-side code

19:46 I'm managing the project with leiningen

19:46 and since changing the source-path to "src-clj", I'm getting a ClassNotFoundException when I try doing lein run

19:46 here's a gist with relevant documents: https://gist.github.com/2732826

19:46 any idea what the cause might be?

19:47 lein version is 2.0.0-preview4 if that's at all helpful

19:50 muhoo: how would i flatten a list, not completely, but just the FIRST level

19:51 amalloy: ~flatten

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

19:53 muhoo: concat, thanks

19:59 zakwilson: Thinking 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:02 muhoo: why couldn't you? doesn't korma expose those?

20:06 zakwilson: muhoo: you could. It's not idiomatic though, and the representation might be subject to change.

20:10 hiredman: https://github.com/hiredman/polycosm is kind of neat

20:14 zakwilson: hiredman: 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:16 hiredman: it 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:16 and a clean unloading of modules, but that will be very tricky

21:02 muhoo: is this even a legal defn form: (defn foo {:something "bah" :somethingelse "baz"} [{:id somesym}] (do soemthing)) ?

21:03 if so, what does that first map do?

21:05 gfredericks: (defn foo {} [] nil) compiles

21:06 ibdknox: looks like a failed attempt at metadata to me

21:06 gfredericks: it sounds vaguely familiar but I can't remember anything about it

21:07 muhoo: ibdknox: it's in noir.core/defpage :-)

21:07 i'm trying to figure out what it does and why

21:07 ibdknox: hm?

21:08 muhoo: https://www.refheap.com/paste/2799

21:08 ibdknox: ah

21:08 yeah

21:08 that adds meta

21:08 ,(doc defn)

21:08 clojurebot: "([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:09 gfredericks: any advantage to that form?

21:09 ibdknox: no

21:09 muhoo: ok thanks

21:09 ibdknox: at least not that I know of

21:10 I think at the time I thought it would add the meta to function

21:10 but it doesn't :(

21:11 muhoo: ah! that'd explain why (meta GET--foo) returns nil

21:12 ibdknox: muhoo: yeah you need to do it on the var

21:12 muhoo: (meta #'GET--foo), gotcha, but none of that other stuff is in there. ok.

21:13 might just patch that and pull request. i know you're busy these days.

21:21 netrino: do we have for clojure something like slim or haml?

21:27 hiredman: netrino: yes, it is called "reading data structure literals from a file"

21:27 muhoo: netrino: stencil/moustache , or hiccup?

21:28 netrino: I don't want sexpr-ed html

21:29 muhoo: maybe https://github.com/davidsantiago/stencil then

21:31 netrino: muhoo: thanks, I'll take a look at it

21:31 derrida: netrino: what's wrong with sexp mappings?

21:32 netrino: derrida: it looks ugly for me when writing html

21:32 * derrida jawdrops

21:32 muhoo: :-o

21:34 netrino: arrr, mustache even uglier :(

21:34 moustache*

21:35 muhoo: you keep using that word. i do not think it means what you think it means :-)

21:36 * derrida wonders what netrino finds pretty

21:37 netrino: muhoo: ok. i mean that's it doesn't looks nice for my eyes, it that correct meaning? :)

21:38 derrida: look nice compared to what

21:39 muhoo: i guess there's no accounting for taste, as the saying goes.

21:41 derrida: ;)

21:42 netrino: derrida: 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:43 derrida: netrino: are you new to lisp(s)?

21:44 muhoo: for 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:44 ethanis: if you're requiring a protocol from another package

21:44 can you use the standard (:require bla :only (MyProtocol)) syntax?

21:45 I mean: (:require [bla :only (MyProtocol)])

21:45 :require/:use

21:47 netrino: derrida: 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:49 muhoo: ethanis: while procrastinating, i tried that, and it works

21:49 also, wow, speaking of metadata, protocols have a buttload of metadata on them, looks like

21:49 ethanis: ha, thanks muhoo

21:50 muhoo: ah, it's not metadata, protocols seem to be maps. a rabbit hole for another time.

22:10 XPherior: How 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:16 jasonjckn: XPherior: datomic.com

22:16 XPherior: jasonjckn: I thought Datomic is a specific type of database. It's a service layer, too?

22:16 jasonjckn: XPherior: spit/slurp api's do file I/O, which is a form of persistence

22:17 XPherior: Datalog is so intimidating, at least for me.. Hah

22:17 jasonjckn: What exactly are you looking for, persistence is a pretty general thing

22:17 XPherior: jasonjckn: That's true. I just wish that persistence services extended to the database realm.

22:17 jasonjckn: Well, I come from the Rails world. So something akin to Active Record?

22:18 jasonjckn: i'm not familiar with active record, but there's definitely some options available to you, ibdknox would know better

22:18 i'll google one sec

22:18 XPherior: jasonjckn: It's just an ORM. You never have any database specific code on your model layers.

22:19 jasonjckn: Right, yah, if you're looking for the clojure interpretation of ORM it's datomic :)

22:19 ibdknox: hm?

22:19 jasonjckn: but i'm sure there's already some library in clojure for ORM style

22:19 ibdknox: datomic is a datastore

22:19 XPherior: I'm finding Datomic a little hard to understand. Maybe I just need to keep at it.

22:19 jasonjckn: ibdknox: he wants something akin to active record

22:20 ibdknox: there isn't one

22:20 XPherior: I figured.

22:20 ibdknox: doesn't make much sense in Clojure

22:20 the closest thing is clj-record

22:20 but don't use that

22:20 you'll be sad

22:20 XPherior: It just feels so wrong to see raw SQL in the model files

22:20 Like, say I want to swap out my DB's. That'll be a massive pain

22:20 ibdknox: why would you want to swap dbs?

22:20 XPherior: Also, ibdknox, it already made me sad. Haha.

22:21 Because requirements and needs change. You never know, dude

22:21 gfredericks: (swap! db mysql->postgres)

22:21 XPherior: Har har

22:21 ibdknox: I've never seen that really work in practice

22:21 lol

22:21 but I guess if you don't care about optimizing

22:21 then it would work

22:21 XPherior: Clojure is big on abstractions, right? Why not with the database details?

22:22 gfredericks: clojure.java.jdbc is a bit of an abstraction, isn't it?

22:22 ibdknox: clojure.java.jdbc does that

22:22 korma is built on top of that

22:22 http://sqlkorma.com

22:22 XPherior: Everytime I see JDBC I run in the other direction screaming. I'll look into it then

22:22 gfredericks: that's funny every time I see activerecord I have the same reaction

22:22 XPherior: Ah, yeah I've seen this. But I feel like I'm just sticking in SQL still

22:23 Haha, gfredericks

22:23 Eh, 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:25 Wish I could get a Clojure job out of college. That would make me very happy.

22:26 ibdknox: XPherior: ReadyForZero is hiring

22:26 gfredericks: at clojure west folks had so many jobs in their pockets their pants were falling down

22:26 XPherior: gfredericks: Hahaha

22:26 ibdknox: Where are they located?

22:26 ibdknox: SF

22:26 downtown

22:26 great guys

22:26 XPherior: Ah, darn. I'm moving to Philly.

22:27 Sounds like it

22:27 ibdknox: good problem

22:27 XPherior: Philly/NYC is probably best for start up on East coast

22:27 ibdknox: why stay east?

22:27 XPherior: Family.

22:27 gfredericks: weather!

22:28 amalloy: just tell 'em they're holding you back. family loves that

22:28 ibdknox: weather?

22:28 amalloy: ibdknox: intended counterargument, i think

22:28 gfredericks: weather.

22:28 ibdknox: west coast weather is *much* nicer than the east coast

22:28 :p

22:28 XPherior: amalloy: You tryin' to get me killed?

22:28 gfredericks: for incorrect definitions of "nicer", perhaps

22:29 ibdknox: lol

22:30 gfredericks: this extending core.logic thing is not straightforward

22:31 jasonjckn: XPherior: i'm leaving my family in canada for technological jobs in san fran

22:31 XPherior: listen to your inner geek

22:31 XPherior: Hah, jasonjckn. I wouldn't enjoy my job as much, honestly.

22:31 Wouldn't be worth it for me.

22:31 More power to you, though

22:32 The only thing more boring than sitting through a software requirements class is studying for the exam. Dear God.

22:33 gfredericks: XPherior: what's a use case?

22:33 yoklov: hm, puting mutable things in a set, bad idea, right?

22:33 gfredericks: yoklov: bad idea

22:33 XPherior: gfredericks: Just shoot me in the head. We had like 4 lectures on UC's

22:33 jasonjckn: mutable things… bad idea

22:33 gfredericks: gotta mutate _something_

22:33 yoklov: gfredericks: how about atoms?

22:34 ibdknox: I 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:34 gfredericks: yoklov: why the hookie are they in a set?

22:34 ibdknox: that will technically work

22:34 because of the way hash is implemented

22:34 gfredericks: XPherior: draw the use cases out in a sequence diagram

22:35 yoklov: gfredericks: yeah, was just curious about that, these aren't atoms

22:35 XPherior: My answers for that class are usually "Uh.. Let's just write acceptance tests."

22:35 Hookie... Haha

22:36 gfredericks: ,#{(atom 4) (atom 4)}

22:36 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: (atom 4)>

22:36 * gfredericks learned something new today

22:36 jasonjckn: yah that's really annoying

22:36 ibdknox: lol

22:36 gfredericks: ,(let [a (atom 3) b (atom 4) s #{a b}] (swap! a inc) (count s))

22:36 clojurebot: 2

22:36 jasonjckn: You can't do this in your DSL: (my-macro {_ 3 _ 4} )

22:37 because the symbol _ is duplicate key

22:37 yoklov: and 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:37 ibdknox: it will work in CLJS because hash uses some magical goog id thing

22:37 yoklov: huh, good to know

22:38 jasonjckn: yoklov: I made a very simple game, a single atom, and it was so refreshing compared to my C++ days

22:38 gfredericks: (->> 50 (range) (map atom) (def united-states))

22:38 jasonjckn: yoklov: i developed the whole game interactively, never restarted the process

22:38 gfredericks: oh forgot to put them in a set

22:38 ibdknox: lol

22:39 yoklov: jasonjckn: it doesn't really scale up that well though

22:39 ibdknox: yoklov: have you looked at my sub-atom implementation?

22:39 yoklov: ibdknox: i have not

22:39 jasonjckn: yoklov: I know :(

22:39 ibdknox: it's in crate

22:39 under binding

22:39 jasonjckn: yoklov: if you're doing serious game dev, you care about every cpu cycle

22:39 yoklov: jasonjckn: well, you do during the render loop at least

22:39 gfredericks: well not _every_ one. just most of them.

22:40 jasonjckn: *nods*

22:40 yoklov: the issue is more that you can't have any cyclic data

22:41 i 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:41 ibdknox: subatoms let you fake it a bit

22:42 that won't address the speed issue though

22:44 yoklov: ibdknox: yeah, i'm looking at it right now, so what exactly is it? just what it sounds like?

22:45 ibdknox: more or less

22:45 it lets you keep a reference to some part of an atom

22:45 and swap it and deref and such

22:45 yoklov: oh, that's really interesting

22:46 ibdknox: it reconciles the one atom to rule them all thing

22:46 gfredericks: so if you had an (atom {:apple 2 :pear 4}) you could get a reference to your atom's apple?

22:46 ibdknox: ~rimshot

22:46 clojurebot: Badum, *tish*

22:49 yoklov: yeah, 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:50 ibdknox: I needed it for databinding to work

22:50 jasonjckn: yoklov: why can't you have cyclic data?

22:50 gfredericks: cyclic data and immutable data structures hate each other

22:50 yoklov: jasonjckn: how would you make cyclic data without any reference types?

22:50 jasonjckn: i was assuming ref types, nvm

22:51 yoklov: ibdknox: yeah, by the way, is that stuff in clojars/usable from lein yet?

22:51 ibdknox: I thought I pushed it

22:51 maybe I didn't

22:51 yoklov: you may have, but hadn't last i checked (a while ago)

22:52 seems to be

22:52 ibdknox: just pushed an alpha3 with the absolute latest I have

22:52 well

22:52 clojars is being slow

22:52 but it'll be there in a sec

22:54 gfredericks: ,(let [a (atom nil) b (atom a)] (reset! a b) a)

22:54 clojurebot: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #<Atom@146d732: #<Atom@1da2ce4: #>>>>>>>>>>

22:54 gfredericks: who knew after five cycles it finishes.

22:56 yoklov: i 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:57 it's nice to use a language which cares about the size of it's core

23:06 muhoo: what in the world would @foo# mean? and no, it's not an atom or ref

23:07 gfredericks: it means (deref foo#)

23:08 muhoo: hmm, i guess you can deref things that aren't atoms? interesting

23:08 gfredericks: if it's inside a backtick the foo# will get gensymed

23:08 muhoo: it is indeed

23:08 gfredericks: ,(-> 1 (+ 2) delay deref)

23:08 clojurebot: 3

23:08 gfredericks: you can deref all sorts of things

23:08 atoms, refs, vars, agents, futures, promises, wedding cakes

23:09 tmciver: the cake is a lie!

23:09 muhoo: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IDeref

23:09 gfredericks: hell I once saw a feller deref an old sheep dog what couldn't walk on all fours anymore

23:11 muhoo: functions can't be derefed, apparently, either

23:11 gfredericks: in clojureql you would build query objects and then deref them

23:12 muhoo: ah, but the var that holds the function can. got it *light bulb*

23:12 (deref #'argh) --> does not blow up

23:13 heh @#'argh

23:13 gfredericks: muhoo: that's a good way to get at private vars

23:13 muhoo: i wonder what's the longest string of looks-like-cursing characters that can be put together without the compiler puking

23:13 tomoj: it's unfortunate that IDerefWithTimeout doesn't fit well with cljs

23:14 gfredericks: ,(read-string "@#'!?")

23:14 clojurebot: (clojure.core/deref (var !?))

23:14 muhoo: heh

23:15 gfredericks: ,(read-string "@#'!?$%*")

23:15 clojurebot: (clojure.core/deref (var !?$))

23:15 gfredericks: hm

23:15 ,(read-string "(@#'!?$%*)")

23:15 clojurebot: ((clojure.core/deref (var !?$)) %*)

23:16 gfredericks: symbols can't have %'s after the first character apparently

23:16 metellus: ,(read-string ";@$%&*%^#%^^**(^#%$%%*(&($^&#")

23:16 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:17 metellus: ,(read-string "(@#'!?$%*);@$%&*%^#%^^**(^#%$%%*(&($^&#")

23:17 clojurebot: ((clojure.core/deref (var !?$)) %*)

23:17 metellus: success!

23:27 amalloy: tomoj: why not? ajax calls happen on another thread; you could try-to-deref them

23:35 tomoj: and it blocks for timeout-val if the call doesn't finish? what does 'block' mean?

23:37 maybe there's some sensible semantics, I dunno

23:37 but I want protocols in cljs that don't exist in clojure yet, whatever cljque is an attempt at finding

23:38 actually I can't think of any sensible semantics unless you have continuations baked in to cljs or something

23:39 s/timeout-val/msec/

23:40 or something like lamina's async macro?

23:41 then you could translate a deref with a timeout into the async analogue of lamina's IDerefWithTimeout impl

23:47 gfredericks: I am putting ~' all over the place. It is time for misquote.

23:50 tomoj: for writing macros?

23:50 I don't understand the use case for misquote I mean

23:50 gfredericks: sexp templating

23:51 but yeah writing macros

23:51 tomoj: like hiccup style?

23:51 gfredericks: in the rare cases where you don't want the backquote symbol expansion

23:51 * gfredericks is writing a bunch of hairy macros

23:52 tomoj: wouldn't dropping ` just make them hairier?

23:52 gfredericks: not in this case

23:52 this is more like code generation

23:52 generating giant deftypes and related things

23:53 tomoj: are you actually saving out the code to files? I ask because I have wondered about that

23:53 gfredericks: no

23:53 compile-time

23:54 so rather than (deftype Foo [x1 x2 x3 ... x100]) I have a macro that does that

23:56 * gfredericks out

Logging service provided by n01se.net