#clojure logs

2012-01-29

00:01jweissjeremyheiler: just out of curiosity, how would that work? if you don't know the names you want to bind in advance, what names would you use inside your function?
00:02muhoowhat is a "promise" in clojure?
00:03muhooi mean, i did ##(doc promise) but i don't understand it
00:03lazybot⇒ ------------------------- clojure.core/promise ([]) Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is... https://refheap.com/paste/468
00:03jweissmuhoo: it's a way of connecting two unrelated pieces of code, possibly in different threads, so that one can deliver a value to the other
00:03muhoojweiss: cool, thanks
00:04muhookind of like a slot/signal in gui toolkits?
00:05jweissmuhoo: i use in in my test-running harness - when the test starts, it creates a promise object in a result map. the reporting derefs the promise, which waits forthe test to complete before it reads the result
00:05jweissthe reporting mechanism doesn't need to know anything about how orwhen the test is run
00:05jweissit just gets the result when it's available
00:06muhooasync communications? nice.
00:06jweisspassing a promise to a piece of code is saying "here, eventually this will contain what you need, call deref when you're ready for it"
00:07muhoowhen you're ready for it, or when it is ready for you?
00:07muhoowhat if the data isn't ready yet?
00:07muhooand you call deref on the promise?
00:07nappingblocks
00:08nappingas mentioned in the pasted docs
00:08muhoooh, yes it does, thanks.
00:08napping(and the deref-with-timeout)
00:09muhoooh cool, realized? is how you check to see if there's data
00:09muhooit's like select/read/filedescriptor stuff
00:10muhoobut instead of file descriptors, it's vars. nifty.
00:37jeremyheileroh yeah https://refheap.com/paste/469
00:40muhoojeremyheiler: it is ALIIIIVE!
00:43jeremyheilerhaha
00:45jeremyheilerNow I have to think about important things, like consistancy. For example, should the command functions include the terminating \r\n, or should that be automatically appended by issue-command. The issue-message command does append the terminating sequence, but it's more complicated.
00:47muhooyep also api consistency
00:48jeremyheilerdefinitely
00:48muhoonot that there's anything wrong without wrapping smtp thinly and lettting the user do what they want with it
00:49muhoobut it' be nice to have stuff like (send-mail from to subject message) , etc
00:49jeremyheileri know ;-) the interesting part will be actually creating the high level functions.
00:50jeremyheilerand controlling the flow of the conversation between the client and server
00:50muhoosounds like a good project
00:50jeremyheilerand also being considerate of any possible smtp extension
00:50jeremyheiler(which is what the low level api is mostly for i suppose)
00:51jeremyheileryeah, im already having fun
01:06yoklovhow do you get around immutability of, maps for instance, in clojure if you want to make cyclic data
01:06dnolenyou can emit pretty darn efficient JavaScript w/ ClojureScript ...
01:08dnolenyoklov: you could use a reference type, but it's generally frowned upon from what I can tell.
01:08Tweyyoklov: You can use laziness.
01:08yoklovhow can i use laziness?
01:09TweyOh, beg your pardon, apparently not.
01:09yoklovhaha, thats okay
01:09TweyIn Haskell you can do something like: let m = Map.fromList [(0, m)] in m
01:10TweyEr, not that that would typecheck, but in general you can do that sort of thing
01:10yoklovright
01:10TweyStackOverflow seems to indicate that the equivalent is not valid in Clojure
01:11TweyAnd that there is no nice way to do it
01:11yoklovdamn, that sucks.
01:11Tweyhttp://stackoverflow.com/questions/4580865/how-can-one-create-cyclic-and-immutable-data-structures-in-clojure-without-ext
01:51muhoomeaning, a ring buffer?
01:51muhoohow about a vector then?
02:24nodenameHi, problem in ClojureScript One project: "lein repl" gives NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V ... clues anyone?
02:25muhooi have not yet been able to get clojurescript one working
02:26muhooregular clojurescript, yes, but not the one variety
02:26nodenamemuhoo: same kind of problem?
02:27muhoo/me checks
02:27muhooactually, i got FileNotFoundException Could not locate cljs/closure__init.class or cljs/closure.clj on classpath: clojure.lang.RT.load (RT.java:430)
02:30nodenameI think this is the answer to my question: http://clojure-play-framework.blogspot.com/2012/01/re-new-version-of-clojurescript-one.html
02:31nodenamemuhoo: seems to me you just need to set your classpath correctly (or is lein supposed to take care of that?)
02:33muhooi dunno
02:33muhooi shoudl note that lein boostrap fails too
02:35muhoohttps://refheap.com/paste/470
02:38muhoogit fuckup?
02:38muhooerror: The requested URL returned error: 403
02:39muhooah, https: does NOT work for me with git. i need to use git://
03:00muhoonodename: i got it, it works!
03:08muhoothis was required: https://refheap.com/paste/471
03:15muhooi should ask when more people aare here, but, would it be of any value to have a bot that posts a notice here when a new message comes in on the mailing list, or a bug gets posted, or some such thing?
03:19_ulisesmorning folk
03:28muhooit strikes me now that the rich-client user interfface problem that cljs is trying to solve, was originally intended to be solved by... java applets!
03:28muhooback in like 1998 or so
03:28muhoothen when that didn't work out, by xul, some years later.
04:18vimjais there a good cryptography library (looking for SHA-256) for Clojure or should I just use one of the Java libraries?
04:22amalloyi hope nobody writes a crypto library in clojure for a long time. it's a dangerous wheel to reinvent
04:22vimjawell, true
04:23vimjai would expect it to be a lispy wrapper around the java libs
04:24amalloymeh. just use apache commons or one o' them things. a wrapper would surely be so thin as to be pretty uninteresting
04:25gunsWrappers are friendly to recent converts anyway (who never thought they would be looking at Java class documentation)
04:25vimjai have for a long time avoided java
04:26vimjain fact, clojure being based on the jvm was reason enough to not use clojure
04:26vimjafor a while at least
04:29gunsI'm with you vimja; could be worse though. Rich could have stayed with .NET and tempted us all back to Windows.
04:30vimjaguns: I would still be in CL then ^_^
04:51raekvimja: the most common algorithms are implemented in classes that come with the JVM
04:53raek(def data (.getBytes "hello world, åäö" "UTF-8"))
04:53raek(import 'java.security.MessageDigest)
04:53raek(def md (MessageDigest/getInstance "SHA-256"))
04:54raek(.update md data)
04:54raek(def data-hash (.digest md))
04:58vimjaraek: thanks, I'll have to read up on java interop
05:03gunsHas anyone attempted to port clojure to the GHC?
05:04gunsJust watched a presentation by Simon Peyton Jones, and it has me all pumped on Haskell
05:05notostracaguns, not that I am aware of -- seems like you wouldn't get much library-wise
05:05gunsnotostraca: lack of libraries can be exciting for a programmer looking to make a name for himself
05:06gunsbut, that's too bad
05:06notostracathe F# people were talking about porting to LLVM if M$ fails to keep maintaining the language
05:06gunsThat's interesting!
05:06notostracahaskell might be better
05:06gunsThat kind of project is beyond my ken ATM unfortunately
05:07notostracaguns, Falcon VM could probably handle Clojure features (or the language) without much difficulty once the new engine is finalized in the next few months
05:07notostraca#falcon here on freenode
05:08notostracaFalcon is, like Clojure, a multiparadigm dynamically-typed language
05:08AimHereLets port Clojure to the Infocom Zmachine
05:08gunsnotostraca: never heard of it, but I will definitely check it out.
05:09notostracabut Falcon doesn't support concurrency internally, instead meaning to be embedded in multi-threaded C++ apps, which no other full-featured scripting languages are very good at
05:09notostracaLua is C, Python doesn't like multithreading, Ruby doesn't like embedding...
05:10notostracaFalcon 1.0 would be a great target for clojure... better interop with C++ is important for lots of apps
05:10notostracaalso, about as fast as Lua
05:10gunsinterop with C++!
05:10gunsCalling C++ methods sounds like a headache wrt GC
05:11notostracayeah, clojure concurrency primitives would be hard to port, but clojure macros would work
05:11notostracaunlike ClojureScript
05:11notostraca(as far as I remember)
05:12gunsnotostraca: Are you an author of Falcon?
05:12notostracaguns, yeah Falcon is still in early stages I would say, despite being around for years
05:12notostracaand no
05:12notostracathe author is Giancarlo Niccolai, jonnymind here
05:13vimjanotostraca: python was around for years before taking off too
05:14notostracaFalcon VM has a really neat structure, it evaluates a syntax tree directly rather than doing the standard way of execution, and gains lots of metaprogramming features as a result
05:14notostraca(at least, it WILL have this structure once released, now it is nearing the end of development)
05:14gunsdo you mean its also homoiconic? or just easy to reconstruct the AST
05:14notostracayes, homoiconic
05:14notostracastatements and keywords are manipulatable values
05:15notostracait is a pretty maximalist language, the opposite of Lua
05:15notostracawww.falconpl.org IIRC
05:15gunsLooks like there is alot of attention paid to embedded work
05:16notostracathe site is awful though
05:16gunsthat's pretty cool
05:16AimHereThe maker of Falcon obviously named his language with an eye to getting a thick O Reilly book out of it.
05:16notostracathey don't have a web designer related to the author, like clojure does haha
05:16gunslol
05:16notostracaAimHere, it is named after a judge in Italy killed by the mob
05:16notostracain honor of his sacrifice
05:17notostracasomething Falcone
05:17AimHerePython is named after Monty Python, but they still put snakes on the cover
05:17notostracayes
05:17notostracait will probably be a bird of prey :-)
05:18notostracait will be a little while before it will be really ready for major use, but when it is, porting other languages could be awesome
05:18notostracaalthough honestly you wouldn't get many features in clojure that falcon doesn't have
05:19amcnamaraanyone familiar with aleph/lamina (specifically wrt TCP)?
05:19notostracaboth have similar FP and metaprogramming
05:19notostracaamcnamara, whoosh over my head
05:19gunsThe site really does need a nice demo page. Coffeescript is the high mark on PL websites IMO
05:19notostracaguns, yeah
05:19notostracayou can use www.ideone.com
05:20notostracathey should embed it'
05:20gunsvery cool
05:20notostracayeah, if you need C++ rather than JVM, CLR, or JS, it will be a good option
05:21notostracaI have been watching the progress for about a year on the new engine
05:21notostracait has gotten so many features added...
05:22notostracai think it has portable serialized data, like clojure for the most part, but functions can be serialized too (I guess you can do that with macros?)
05:22notostracatables of functions are neat
05:22vimjanotostraca: the internationalisation stuff looks cool
05:23notostracamessage passing, again like clojure
05:23notostracavimja, yes
05:23notostracathe web page has an annoying refresh to see a new sample thing
05:23notostracabut one of the samples is a nice for-loop thing
05:23notostracayou can create blocks that only execute on specific iterations of a loop
05:23notostracalike
05:24notostracaifI have an array that is words in a sentence
05:24notostracaforstart: capitalize, formiddle: add a ", ", forlast: add "."
05:25notostracaor add " and " + text + "."
05:26notostracaalso classes can have states as part of a state machine syntax
05:26notostracaerr, classes AND objects
05:26gunsnotostraca: classes can have states? I admit I don't know what that means
05:26notostracaguns, like
05:26notostracaa bird in a game
05:27vimjaants in an ant colony
05:27notostracacould have a state called "hungry" where the "act" function is more likely to have it feed and less likely to run
05:27notostracaand a state called "scared" where the opposite is true
05:27notostracawhen it runs, it changes state
05:28gunsAnd this dynamically affects all instances of that class?
05:28notostracascared reverts to hungry after an amount of time without feeding, etc.
05:28notostracait can, or it can be per object
05:28notostracaI think
05:28notostracaI know it works for objects
05:28notostracanot sure if it can be static for a class
05:29notostracaalso they make a big deal about first-class functions as well as first-class methods
05:29gunsyou aren't kidding about multi-paradigm then
05:29notostracawhich I think is because you can assign a first-class method to a different class than you had before and it can act correctly
05:29notostracaguns, indeed
05:30notostracait is good when you can only embed one language
05:30notostracabut you need lots of features from multiple paradigms
05:30notostracaor when you don't KNOW what the requirements will be
05:30notostracait is definitely a more advanced scripting language than something like Python, harder to learn but more powerful
05:31notostraca(at a language level, not a library level)
05:31gunsI guess that's a possible scenario. Seems like Unix + open source PLs is the modern multi-paradigm solution
05:31gunsThough admittedly that's a rickety scaffold
05:32notostracaI do like clojure's data structure support better than Falcon's though
05:32notostracahard to top how easy it is to manipulate data in clojure
05:33notostracathough they each have strengths and weaknesses i suppose
05:34gunsIt's a freaking miracle, Clojure. Seems like anyhow; I haven't written anything very large in it yet.
05:35notostracaguns, same here, nothing too large. small stuff is wonderful so far
05:35gunsBut it's a breath of fresh air coming from the madness of a large Ruby project
05:35notostracaJoreji, Joreji_, Joreji__, Joreji___: hello?
05:36notostracaguns, haha oh yes
11:00TimMcI felt like such a badass for having my code work basically the first time I ran it, then I realized one of my tests didn't fail when I messed with it. :-(
11:00the-kennyTimMc: You need unit tests for yout unit tests.
11:00AimHereWrite a test suite for your test suite
11:00the-kenny*your
11:01AimHereActually testing is a binary relationship. The way to test your tests is to write the thing you were going to test
11:02TimMcthe-kenny: I use the saboteur approach to check my tests.
11:02TimMcfrob some conditionals or constants in the code under test and ensure the tests fail.
11:03TimMcThat can be automated, of course.
11:17Raynesjeremyheiler: Looking good.
11:17jeremyheilerRaynes: gracias
11:23VinzentHi. What's the best way to preserve type information when inserting in mongodb?
11:24Vinzent(with congomongo)
11:32clgvTimMc: someone wanted to port the unit test test engine that automatically removes stuff from test and checks if they still pass. did they finish that already?
11:33clgvsorry to be that unspecific. it was just something I heard here.
11:36TimMcclgv: I don't even know what it was called.
11:37clgvTimMc: I dont remember the language. must have been python or ruby
11:37TimMcThere's some ruby lib that I saw...
11:37clgvoh ok. two votes for ruby then ;)
11:38TimMcheckle
11:39TimMchttp://ruby.sadi.st/Heckle.html
11:39clgvright that wa sit
11:41jeremyheilerThat site is kind of creepy, but i seems like a neat idea as an alternative to line/branch coverage you see wtih java.
11:41jeremyheilerprobably more efficient at ensuring things are tested, too
11:42clgvoh I found the old log. technomancy was talking about it
11:42jeremyheileri wonder how that would work in clojure? if at all.
11:43clgvaccording to the log the author converted ruby into s-expressions to be able to implement heckle
11:43jeremyheilernice
11:45jeremyheilerI was thinking that it would be difficult to know what to "change" in a clojure program that wouldn't break things in a way that show you weak points. I mean, heckle changes literal values, control statemets, and operators.
11:46jeremyheileri suppose you could do similar trhings liek change (if ...) to (not (if ...))
11:46jeremyheiler*shrugs*
11:47jeremyheilersorry... (if (not ...))
11:49TimMcclgv: s-expressions? Or an AST?
11:49clgvTimMc: http://clojure-log.n01se.net/date/2011-11-10.html
11:51TimMcHearsay and speculation!
11:51TimMcI'm convinced. :-)
11:51clgvlol. technomancy sounded convinced ;)
11:53clgvah btw. did the clojure conj 2011 talks make it to public available videos already?
11:56jeremyheilerSpeaking of testing... does anybody worry about testing for ArityException to ensure fixed argument lists a preserved?
11:56TimMcWhat do you mean? If it's thrown, you know there's an error.
11:56Raynesclgv: No. I expect they will at some point in the next 30 years though.
11:57clgvRaynes: hmm whats the problem. before the conj it sounded like that was planned
11:57Raynesclgv: It is planned, but I think they managed to pick the slowest people in the world to actually produce the videos.
11:58RaynesThey seem to be focused on ever Ruby conference in the past infinity.
11:58clgvRaynes: so post-production is stalling the whole thing?
11:58Raynesevery*
11:58RaynesI don't know exactly what is stalling things on their end.
11:58jeremyheilerTimMc: For the cases when you test for a single arg function, and then you add optional varargs to it and forget to test, i was thinking it would be nice to see the test fail.
12:08TimMchrm
12:08TimMcThat's a code coverage question, really.
12:09jeremyheilerAre there any code coverage tools for clojure?
12:09bprin cljs, (map? nil) => false, but (assoc nil :foo :bar) => {:foo :bar}
12:09bpris this a bug or by design?
12:10jeremyheiler(that would certainly help me convince the boss to let me use clojure at work :-P)
12:10dnolenhmm type hints in ClojureScript might not be such a bad idea
12:10dnolenbpr: same behavior as Clojure
12:10bprdnolen: ok, thanks
12:10TimMcbpr: You can't examine a value and tell what abstraction it is participating in.
12:11TimMcnil participates in many
12:13bpri think i'm confused then. b/c {:foo :bar} is a value, yet (map? {:foo :bar}) => true
12:14TimMcmap? only checks the type -- it can't tell you what other functions will *accept*
12:14bprok
12:14TimMcIt's confusing.
12:15bprsounds like it has to do with protocols
12:15TimMcWith regards to collections, nil represents an empty sequence.
12:15TimMcThis was probably chosen so that (if (seq ...) ... ...) would work. :-/
12:16TimMcassoc is converting it into an empty map, {}
12:16TimMcSpecial-casing, in other words.
12:16bprok
12:19bprthanks, TimMc
12:21TimMc&(class (conj nil 7))
12:21lazybot⇒ clojure.lang.PersistentList
12:22dnolenTimMc: bpr: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L261
12:23TimMcoh, nice
12:23bprty, dnolen
12:23TimMcdnolen: I take CLJS is serving as a place to explore reimplementations of core functionality?
12:30clgvpretty crowded here for a sunday. I hate to have to work today....
12:46philwhat was the name of the mac tool that showed a password with big letters on your screen so some other person could type them in?
12:47philcant seem to find anything on google
12:56TimMcHells yes, I have a working transitive closure.
12:56the-kennyphil: a password?
12:58philthe-kenny: yea i mean for example when you wanna show a wifi password to somebody
12:58the-kennyphil: So just to display some password in big letters as an overlay? I think quicksilver can do this
12:59philthe-kenny: yea thats what i mean... thanks a lot!
12:59the-kennyphil: However, Quicksilver is most likely too big to use it just for this purpose :) If you find a simpler tool, let me know
13:00philthe-kenny: yea i was desperately googling for over 10 minutes, only think i found are password "recovery" tools and such
13:00philthing*
13:00clgvphil: how about copying that wlan password via usb stick? secure wifi passwords are too long to type ;)
13:01TimMcI doubt that.
13:02philclgv: yea also a possibility :) in the end i just copy and pasted it in some editor with a 72pt font :)
13:02clgvI would hate to type around 60 characters^^
13:02philmine is around 25 or so
13:02philsecure enough id say
13:02TimMcclgv: it gets hashed
13:02clgvmine has full length and is from a prng ;)
13:03philmine is also from a password generator ofc but 60 chars is overkill :)
13:04clgvTimMc: getting hashed does not prevent bruteforce attacks ;)
13:04TimMcclgv: No, what I mean is, there's a limit to how uesful a long password can be.
13:04TimMcsince it is hashed *before* comparison
13:05TimMcwhat I'm having trouble finding out is the size of WPA2 passwords
13:06clgvare you sure? that sounds odd. usually cryptographic procedure expand passwords of say N bits to a state of M>N bits to complicate algebraic attacks
13:07TimMcI would never credit the designers of WiFi with having considered something like that.
13:08clgvwell they have definitely put some effort in WPA2 since WEP was an epic fail
13:08TimMcHmm.
13:08TimMcI think it basically uses the same key design, though.
13:09clgvI am pretty sure it uses the full size of the given PSK
13:34dnolenibdknox: ping
13:59entelwhy can't i do this?: (let (vec (list 'foo 123)))
13:59dnolenentel: what is that supposed to do?
13:59entelmake a vector that looks like [foo 123] and pass it to let
14:00gfredericksah! :D
14:00TimMcentel: let needs a bindings clause.
14:00gfrederickslet is a macro
14:01gfredericksor a special form
14:01gfredericksbut in any case not a function
14:01TimMcentel: What do you imagine that would do?
14:01gfredericksthe bindings cannot be something that evaluates to a vector, it has to actually be a vector literal
14:01dnolen,(let [v '[foo 123]] v)
14:01clojurebot[foo 123]
14:01entelhrm
14:01TimMcOh, hah! I see.
14:01gfredericksentel: it has to do with the difference between compile time and runtime
14:01dnolenentel: ^ is probably what you want, right?
14:02gfredericksdnolen: I think he was treating the bindings form like it was an argument to the function let
14:02TimMcNo, I think entel wants a macro.
14:02gfredericksentel: yeah, you can do this sort of thing at compile time by writing a macro
14:02TimMcentel: What's the larger picture here?
14:02TimMcI have the feeling you're way off in the weeds.
14:03amalloyheh
14:03enteltrying to do something like this..
14:03entel(let (vec (interleave '[str trailing] (split str #" :" 2))) ;; prefix, str
14:04amalloyyou just want (let [[str trailing] (split ...)] ...)
14:04enteloh that works?
14:04entelhmm
14:04gfredericksamalloy: nice; woulda taken me minutes to figure out what he was trying to do
14:05gfredericksI need to stop mentioning macros no matter how relevant they are to the question as stated.
14:05mrb_bkany overtone users here?
14:09danieljamesI've been googling this all evening, but earlier I was able to do (show x) at the repl, and now after restarts etc (use 'clojure.contrib.repl-utils) gives me an IllegalStateException "source already refers to"
14:10danieljamesany ideas
14:10danieljames?
14:10dnolendanieljames: contrib is dead. you should use clojure.repl instead
14:11amalloyclojure.reflect
14:11entelalso does anyone know of a builtin that does this?: (defmacro append [x seq] (reverse (cons x (reverse seq))))
14:11amalloyrepl has no substitute for show, but reflect/reflect is one
14:11danieljamesThe mystery is, how did I get it to work earlier!!
14:12dnolendanieljames: a contrib must have been on your classpath. perhaps using lein blew it away?
14:13danieljamesI'm an absolute noob, I'm using eclipse and counterclockwise and it was literally one of the first things I did, defrecord a couple of pr's and (show MyRecord)
14:17the-kenny-wentel: Try conj
14:19gfredericksentel: A) conj will work if you're using a vector; B) in any case that could be a function, not a macro
14:21danieljamesah. no clojure.reflect either
14:25entelgfredericks: why should that be a function and not a macro?
14:26jeremyheilerdanieljames: you need to (require 'clojure.reflect) in order to use clojure.reflect/reflect
14:26danieljamescould not locate clojure/reflect__init
14:27jeremyheilerYou you using 1.2 or 1.3?
14:27danieljames1.2
14:27jeremyheilerAh, then you need to upgrade to 1.3 in order to use the libs that replaced contrib.
14:27solussdwhat is going on here? : `(~'~v)
14:27solussd,`(~'~v)
14:28clojurebot((clojure.core/unquote v))
14:28danieljamesI will go away and investigate how to get the latest version into eclipse. The annoying thing is that I definitely had (show MyRecordType) working earlier
14:30amalloy&(let [v 'test] `(~'~v))
14:30lazybot⇒ ((clojure.core/unquote v))
14:30danieljamesit was even coming up as a suggestion with Ctrl+Space
14:31solussdwhy isn't it ('test) ?
14:31amalloy&(let [v 'test] `('~v))
14:31lazybot⇒ ((quote test))
14:31jeremyheilerdanieljames: Did you reload something? It's possible contrib got lost somehwere.
14:32danieljamesI've restarted the REPL a couple of times. I'm pretty sure I either executed something like (require or (use but I'm not sure what
14:33solussd&(let [v 'test] ``(~'~v))
14:33lazybot⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote test))))
14:33danieljamesI didn't do require :as or anything like that
14:33solussdso confused.
14:35TimMcentel: If you have to ask why not to use a macro for that... don't use a macro for that.
14:35danieljameseugh. I did (use ... :only [show])
14:48gfredericksentel: any kind of data-processing (e.g., adding something to a collection in some particular way) can be implemented with a regular function. Just about anything you can imagine doing easily in a non-lisp can be done with functions and existing macros.
14:50entelmy theory was it would avoid an extra function call overhead.. i dont really have a good understanding of when to use macros and when not to
14:50entelwhats a good rule of thumb there?
14:50TimMcentel: Don't worry about performance yet, you don't have enough experience. And profiling is a prerequisite anyway.
14:50gfredericksit's hard to resist just saying "don't use macros", but I know that's a frustrating answer
14:51TimMcentel: Also, macros *can't* do things like conjing values together, since they operate on syntax, not data.
14:51gfredericksat least 95% of the macros I've written are for syntactic sugar, not any kind of performance.
14:52gfredericksthe only kind of performance-oriented macros I can imagine are maybe for hiccup and match
14:52TimMcRight, compiler macros.
14:52TimMcreally quite rare
14:52dnolenusing macros for inlining is ridiculous in Clojure >= 1.3.
14:53entelhmm
14:53entelok that helps
14:53dnolenentel: functions are very fast in Clojure.
14:53gfredericksentel: one thing that took me a while to understand is that, because macros run at compile time, they don't have access to the values that you're passing in. Over and over again I tried to figure out how to take the list that I was "passing to my macro" and inspect it somehow; but that's impossible because the list doesn't exist until runtime.
14:54entelwell im sure it will become more obvious with more experience
14:55entelhopefully
14:55gfredericksit's all related to the code-is-data thing
15:12ckirkendallarkh: pong
15:23raekgfredericks: but you can access preciously def'ed vars from macros. (def foo "abc") (defmacro [] (... foo ...))
15:23raekit's just the parameters that gets passed as uninterpreted code
15:31gfredericksraek: and also you can run macros at runtime too :)
15:36@chouserbut only with eval
15:40gfrederickschouser: really? Can't you get the underlying fn and pass it stuff?
15:43TimMcgfredericks: Sure, you can expand stuff.
15:44TimMc&(macroexpand-1 `(let [x 5] x))
15:44lazybot⇒ (let* [clojure.core/x 5] clojure.core/x)
15:44TimMcHeh, that wasn't very exciting.
16:11gfredericks&(@#'and nil nil 'foo 'bar)
16:11lazybot⇒ (clojure.core/let [and__3546__auto__ foo] (if and__3546__auto__ (clojure.core/and bar) and__3546__auto__))
16:11danieljamesdoes anyone have a link for how to change counterclockwise to point at 1.3?
17:04ddollari'm trying to build my first clojure app.. after running lein install, lein help shows me this: https://gist.github.com/ef014ebe2ddb6fb5e02a
17:05technomancyddollar: hmm; what does project.clj look like?
17:05ddollarhttps://gist.github.com/1a04db3d51167cfab2b3
17:06technomancyddollar: nothing odd there... did you get leiningen from homebrew or by hand?
17:06ddollarhomebrew
17:06technomancyanything in ~/.lein apart from self-installs?
17:06ddollarno
17:07technomancyit looks like there's a plugin somehow getting picked up that was written for a really old version of Clojure
17:08technomancycan you see if you can repro using the manual install?
17:08ddollarhttps://gist.github.com/5bd6d49ccb3f2b6a2843
17:08ddollarsure
17:10ddollarso i downloaded the lein script and put it in my path, ran lein self-install again
17:10ddollarsame error
17:10ddollarbut only if i run inside the app dir.. lein help works fine from my homedir
17:11technomancyand the app was generated using "lein new hello-world"?
17:12ddollari didn't use lein new, just made a directory myself
17:12technomancyoh, so what's the project tree look like?
17:14ddollarhttps://gist.github.com/5a197b97a626d51c236c
17:15technomancycan you go ahead and gist web.clj?
17:16ddollarhttps://gist.github.com/cc03dea04c1dba56de17
17:17TimMcwhoaaaa
17:17TimMcI just discovered that my transitive closure test was written backwards, but it still worked.
17:18TimMcSo, the algorithm is supposed to take a DAG of relationships like 0->1 and 1->2 and compute the missing transitive relationships, like 0->2
17:19TimMcIt turns out that if you run the inverse data through, the results are inverted too. I had no idea.
17:19technomancythere must be something else going on here
17:20ddollarwhere would a plugin live if it existed?
17:20ddollari think i tried clojure a long time ago, maybe something is left around
17:20technomancyit would either be in lib/dev or ~/.lein/plugins
17:21technomancyactually if you do "DEBUG=y lein version" will list all the locations it's checking
17:21ddollar aha
17:21ddollarsome stuff in ~/.m2/repository
17:22TimMcHeh. When in doubt, rm -rf ~/.m2/repository
17:22technomancynothing in ~/.m2 should affect the leiningen process itself
17:23ddollarso i nuked ~/.m2 and redid lein self install, still same error
17:23ddollarhttps://gist.github.com/d26da5284f37d8722222
17:23technomancyddollar: can you place this in src/leiningen/check.clj inside your project: (ns leiningen.check (:use [leiningen.util.ns :only [namespaces-matching]])) (defn check [project] (prn (namespaces-matching "leiningen")))
17:23technomancyand then run "lein check"
17:24technomancydon't worry about formatting or newlines; should work fine
17:24TimMcddollar: Whoa, that lein is old as hell.
17:24TimMc1.1.0
17:24technomancyoh yeah, that would do it
17:24amalloythree cheers for homebrew
17:24technomancywow
17:24ddollarhow do i update?
17:25TimMcddollar: I think most people just use lein's self-installer.
17:26technomancyyeah, I don't know homebrew, but if you just curl https://raw.github.com/technomancy/leiningen/stable/bin/lein to somewhere on your $PATH and chmod it you should be good to go
17:27Raynesjeremyheiler: Thanks for pasting this: https://refheap.com/paste/469
17:27Raynesjeremyheiler: It showed me how terrible pygments was highlighting Clojure, so I finally got motivation to fix it.
17:27jeremyheilerhaha, glad I can help!
17:28Rayneshttps://refheap.com/paste/4f25c8ade4b06242c99e712e
17:28RaynesYay for highlighting that doesn't suck.
17:28Raynes(notice the use line isn't completely screwed anymore)
17:28jeremyheilerYeah, that's definitely nicer. Good work.
17:29RaynesI had… I had to look at regexen. :(
17:29RaynesAnd Python.
17:29Raynes~python
17:29clojurebotpython is defmulti doc
17:29technomancyshould have tipped me off that it was warning about the meta syntax; that warning has been gone for ~ a year and a half
17:29RaynesNot the one I was looking for.
17:29Raynes~python
17:29clojurebotpython is ugly
17:29RaynesThere we go.
17:29ddollartechnomancy: hmm, that's what i did (and uninstalled the homebrew version)
17:29jeremyheilerGrows characters
17:29jeremyheilercharacter*
17:29jeremyheilerugh
17:30TimMctechnomancy: I thought homebrew was entirely out of date, so I was surprised when you said that was OK.
17:30ddollarah, i got an old one from github i think
17:30Raynesjeremyheiler: So, how is the refheap experience? Do you like it?
17:30RaynesWill you be a return customer. :p
17:31Raynescustomer?*
17:32jeremyheilerI am a big fan so far. I wish the input box for pasting was bigger (like maybe autosize it so it fills the rest of the screen?) but otherwise it's simple and to the point, so you win my vote.
17:33Raynesjeremyheiler: You have a large monitor?
17:34jeremyheileryes
17:34RaynesYeah, I've been concerned about that.
17:34RaynesI'll make an issue and talk to Alex about what we can do about not having maximum sizes.
17:35jeremyheilerHonestly, I think it would be ideal to have the site appear to be a "full screen" and resizes with the window (of course with a minmum size) and then the viewing area will just be as big as your screen, with its own scroll bar.
17:36ddollarim running now, thanks for the help
17:38Raynesjeremyheiler: Yeah, I don't see why we can't do that. I think Alex said it'd look like ass on high resolutions. *shrug*
17:40Raynesjeremyheiler: What is your github username?
17:40jeremyheilerYou know it
17:41Raynesjeremyheiler?
17:41jeremyheilerlol yeah
17:41RaynesSurpising.
17:41jeremyheilereffectively so
17:47alexbaranoskyis there a simple way to run lein repl in 1.3 ?
17:47Raynesalexbaranosky: `lein repl`
17:47Raynesalexbaranosky: Can you be more specific? :p
17:49alexbaranoskyRaynes, I thought it was always 1.2.1... maybe it doesn't play well with a project.clj that has multiple versions of clojure stpecified alla: org.clojure/clojure "[1.2.0],[1.2.1],[1.3.0]"
17:50Raynesalexbaranosky: If you use clojure 1.3.0 in your project, it'll use that with lein repl. I don't even know what that does. Really, people should just give up on version ranges and stuff.
17:50alexbaranoskyRaynes, yeah, changing to juse one version works
17:50alexbaranoskyI'll look into getting rid of it.
18:04xcthulhuThis is a noob question, but according to Halloway (2009), (class (* 1000 1000 1000 1000 1000 1000 1000 1000)) => java.math.BigInteger
18:05Raynesalexbaranosky: You should write a dependency management solution with me. We could call it. Clojure boxes or something.
18:05Raynes&(class (* 1000 1000 1000 1000 1000 1000 1000 1000))
18:05lazybotjava.lang.ArithmeticException: integer overflow
18:06RaynesHeh.
18:06RaynesAnyways, it'd be a clojure.lang.BigInt these days. I believe this changed in Clojure 1.3.
18:06lucianbah. why switch to non-arbitrarily large numbers?
18:08edwWith hiccup, why does this explode: (html5 [:p (str "hi")]) ?
18:09technomancyddollar: so it turned out a manual install from a while ago was shadowing the homebrew version on your $PATH?
18:09ddollaryeah
18:09technomancytricky
18:09xcthulhuRaynes: Okay, I have 1.3.0
18:09ddollarwill lein self-install be enough to keep me up to date going forward?
18:10xcthulhuRaynes: But I get (class (* 1000 1000 1000 1000 1000 1000 1000 1000)) => ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1374)
18:10technomancyddollar: self-install is for getting the jar file that corresponds to the given shell script, but "lein upgrade" would have done the trick
18:11RaynesYeah, the Clojure math situation in 1.3 is vague for me.
18:11edwOh wait, that works but (html5 [:body [:p (str "foo")]]) sowa.
18:11technomancyprovided "lein upgrade" existed back then; it may have been added in 1.2
18:11edws/sowa/does/g
18:12dnolen,(* 1000 1000 1000 1000 1000 1000 1000 1000)
18:12clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
18:12dnolen,(*' 1000 1000 1000 1000 1000 1000 1000 1000)a
18:12clojurebot1000000000000000000000000N
18:13ihavequestions_So I'm trying to get the lwjgl to work, and I am getting a class not found exception. So far as I can tell, lein has gotten all the deps though... anyone have a thought on what I might be doing wrong?
18:14the-kennyihavequestions_: Which class is in question?
18:14ihavequestions_org.lwjgl.opengl.Display
18:47clj_newbI don't like conds / nested ifs; is there something like a (return) in clojure? which basically says "okay, this function execution is now done." ?
18:47jeremyheiler(throw (RuntimeException.)) *hides*
18:48clj_newbgreat; all I need is to wratp defMyFn around with a try/catch
18:48clj_newbawesome, thanks :-)
18:48alexbaranoskylol
18:48clj_newbfor any arguments I want to return, I just need to derive it from the Exception class right?
18:49lucianclj_newb: i think jeremyheiler was joking :)
18:49lucianbut yeah, derive from RuntimeException
18:49ihavequestions_I think clj_newb was too
18:49jeremyheilerIf you want. It's not really performant to throw an exception for control flow, and probably not the best idea in clojure.
18:50clj_newbgivne clojure doesn't ahve tail call; I bet it doesnt' ahve continuations either? :-)
18:51lucianit has trampolines
19:01clj_newbin clojure; am I allowed to define functions starginw with _, or is that generally bad practice and should be reserfed only for core/system functions? [I'm guessing not, since everything is stuck inside of namespaces], but want to double check
19:03jeremyheilerThere's nothing wrong with that. It seems more common to add a * at the end of a function name. Though, it depends on what your reasoning for putting a _ is.
19:03clj_newbit's a set of weird, "unsafe functions" that temporarily violates invariatnts on a data structure
19:03clj_newbso I have a set of "safe" functions that always keep the datastructure satisfying certain invariants; they are built with a set of unsafe intermediate helper functions
19:04jeremyheilerunsafe functions (in terms of stm) usually have a bang (!) at the end of them.
19:05clj_newbboth the "safe" and "unsafe" functions change local _bindings_, i.e. the dynamic thread local vars; however, the "safe" ones does so in a way where certain invariants are observed; the unsafe ones violates the invariants; so it seems like ! is not an appropriate distingction here
19:05jeremyheilerok
19:07jeremyheilerIf you really want to be sure the distinction is understood, you could just name all your functions *-unsafe
19:07jeremyheilerall your unsafe functions*
19:22benares_98what's the reason for choosing the letter M for explicit typing of big decimal numbers?
19:25RaynesIt looks better than W.
19:25amalloyright. you want mario in your data structures, not wario
19:25ihavequestions_that depends on your point of view
19:25RaynesYeah, if you don't want Mario, your point of view is backwards.
19:25benares_98Shouldn't Long be L then for Luigi?
19:26ihavequestions_no, I mean by your logic, if you're upside down, wouldn't W look better than M?
19:26RaynesI like the cut of your jib.
19:26ihavequestions_thanks!
19:36ihavequestions_I'll just ask again before I leave, anybody have any idea why I'd get an error like: Unknown location: error: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.lwjgl.opengl.Display or how I might go about fixing it?
19:37jeremyheilerThat class needs to be on the classpath. How you put there depends on what you doing to build your program.
19:38jeremyheileryou're*
19:39ihavequestions_ah, ok - so even though I have the dependencies, I don't know where they are, so to speak
19:40ihavequestions_I'll see what I can do with that - thank you
19:40jeremyheilernp. are you using lein?
19:40ihavequestions_yes
19:40jeremyheilerdid you do: lein deps ?
19:41jeremyheiler(assuming you put the dep in your project.clj)
19:41ihavequestions_yeah, I have the dep in my project.clj, and got it via lein deps
19:42ihavequestions_for what it's worth, the lwjgl has native dependencies, but it seems like those all got pulled down too
19:42jeremyheileris it possible that the Display class isn't in that version?
19:43ihavequestions_well, I was looking at the jar, and it seems like that path exists
19:43jeremyheilerhmm
19:47ihavequestions_well, I gotta go for now . thank you for trying to help me out
19:49edwAnyone here deploying to Heroku? Is there a way to speed up deploys? 'lein deps' is making incremental development deeply painful.
21:55drewr,(re-matches #"(?m)f(.*)r" "foo\n\n\nbar")
21:55clojurebotnil
21:56drewranybody know how to get MULTILINE working there?
21:56drewr,(re-matches #"(?m)f(.*?)r" "foo\n\n\nbar")
21:56clojurebotnil
21:58amalloyi think you have to compile it with the right mode
21:58amalloy$javadoc java.util.regex.Pattern compile
21:58lazybothttp://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#compile(java.lang.String)
21:58drewrthat's what the (?m) is supposed to do
21:59drewr(I've also tried it with a manually compiled Pattern)
21:59amalloyyou want the (String, int) compile
21:59drewrright, tried that
22:00drewreven tried (bit-or MULTILINE UNIX_LINES)
22:00amalloyyou want DOTALL
22:00drewrorly
22:01cemerick,(re-matches #"(?s)f(.*)r" "foo\n\n\nbar")
22:01clojurebot["foo\n\n\nbar" "oo\n\n\nba"]
22:01drewrcurses!
22:01cemerickamalloy: quick draw ;-)
22:01drewrwhat's MULTILINE for then
22:01amalloychanges where $ and ^ match
22:01cemerickhaving ^ and $ match \A and \Z, IIRC
22:01drewrgah, ok
22:02amalloy\A, \Z?
22:02cemerickbeginning and end of input
22:21aphyrHas anyone used Parsley for parsing recursive infix syntaces? e.g. "foo and bar and baz or xyzzy"?
22:21aphyrIt's been somewhat difficult to google, and I'm having some trouble unwinding its internals
23:57aphyrAha! Parsley implements alternation using sets, but order matters for LR parsers!
23:57aphyrSo I need an APersistentSet that *preserves* fixed order somehow
23:58aphyrAny idea how to make one?
23:58jeremyheiler,(doc sorted-set)
23:58clojurebot"([& keys]); Returns a new sorted set with supplied keys."
23:59aphyrjeremyheiler: no, that doesn't preserve order.
23:59aphyr(sorted-set 3 1 2)
23:59aphyr#{1 2 3}
23:59jeremyheileroh, insertion order. figured you meant your own ordering scheme