#clojure logs

2011-12-31

00:01adiabaticthanks!@
00:07TimMcadiabatic: When you see "((" you should think, "Whoop, here comes a function call that returns a function!"
00:07TimMc(or a thing that can be used as a function)
00:07amalloyi prefer to think "aw yeah, code's about to get awesome"
00:08adiabaticyeah, that was an artifact of my, ahem, transitional indentation style
00:08amalloyhaha
00:08amalloyif you're ashamed about it, you're on the Path
00:17TimMcamalloy: (((((((((((((foo))))))))))
00:17TimMcum
00:17TimMc)))
00:17amalloy)))
00:18TimMcOff-by-one error (I was counting in 3s.)
00:19amalloycounting is too hard. it just looked off so i checked in paredit
00:19TimMc(((((...))))) probably means you should be using trampoline. :-P
00:23amalloy&(class ((((((fn [] (fn [] (fn [] (fn [] (fn [] (fn []))))))))))))
00:23lazybot⇒ sandbox6906$eval9224$fn__9225$fn__9226$fn__9227$fn__9228$fn__9229$fn__9230
00:23amalloyis lazybot lagging like mad today, or is it me?
00:26adiabaticOK, I think I need another hint. I need to implement count, and I can't use def (otherwise I'd recursively peel off the head of the list until I ran out of list). Subtle hints, anyone? Nothing in http://clojuredocs.org/quickref/Clojure%20Core looks particularly promising for this one
00:26tomojyou mean you need an anonymous count?
00:26tomojwell..
00:26amalloyzoiks. subtle hint: def is *terrible* for locals; you want to use let, loop, or a recursive function
00:27adiabatic"try let instead". got it.
00:27tomojyou mean (defn my-count [coll] ...) is allowed?
00:28amalloyreally recursion is the answer; let and loop are just sugar. you can create any kind of "looping" structure you want with just recursive functions
00:29adiabatic(defn my-count [x] (x)) ; You tripped the alarm! def is bad!
00:29amalloy(fn my-count [x] x)
00:30adiabaticAnd I'll be able to call my-count from within that anonymous…ish…function?
00:31amalloy&((fn my-plus [x y] (if (zero? x) y (my-plus (dec x) (inc y)))) 10 20)
00:31lazybot⇒ 30
00:34emezeskel
00:34emezeskewrong terminal!
00:41JorgeBIs it possible to safely eval some code as if in a sandbox?
00:52amalloy$google clojail flatland
00:52lazybot[flatland/clojail - GitHub] https://github.com/flatland/clojail
00:53tomoj&{# "hi!"}
00:53lazybotjava.lang.ClassNotFoundException: hi!
00:53tomojwhat is that?
00:53amalloy&#java.util.Date[]
00:53lazybot⇒ #<Date Fri Dec 30 21:54:39 PST 2011>
00:53amalloy&'#java.util.Date[]
00:53lazybotjava.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: Fri Dec 30 21:54:58 PST 2011
00:54tomojnew eval syntax in 1.3?
00:54amalloyit's the record-literal syntax in 1.3
00:54tomojer.. ah
00:55tomojoh, here it's actually {(Long. 1) "hi!"}, the test output just had a #
00:55tomoj&{# "java.util.Date"}
00:55lazybotjava.lang.RuntimeException: Unreadable constructor form starting with "#java.util.Date}"
00:56JorgeBamalloy, thanks
00:56tomojhmm
00:57amalloywriting clojure.test code with arrows and doto looks hilarious, kinda yoda-ish. (doto (f x) (-> nil? not is))
00:58tomojis the record literal syntax documented anywhere?
01:04amalloy,(case 1 (1 2) "one or two")
01:04clojurebot"one or two"
01:04amalloy,(case 1 [1 2] "one or two")
01:04clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: 1>
01:22adiabaticdo I need to install clojure-contrib-devel via macports to get (use 'clojure.contrib.trace) to work, or is clojure-contrib enough?
01:23amalloydon't install clojure-anything from macports
01:23amalloy$google clojure github leiningen readme
01:23lazybot[README.md at master from technomancy/leiningen - GitHub] https://github.com/technomancy/leiningen/blob/master/README.md
01:24amalloyinstall that baby and let it handle your dependencies (including clojure and, if you must, contrib) for you
01:43adiabaticOK, now I can't get my `clj scratchpad.clj` workflow back yet…
01:45amalloywhat does that do? compile-and-run that file, then exit? just lein repl, and if you want you can call load-file from there
01:45adiabaticI put `:main helloworld.core` in project.clj and now when I do `lein run` I get a ClassNotFoundException: helloworld.core
01:45adiabaticYeah.
01:45amalloysadly clojure currently requires you to AOT-compile a namespace if you want to run it as main
01:46amalloy(ns helloworld.core (:gen-class)) (defn -main [& args] ...) probably works, if you aren't ready to embrace a repl-driven workflow yet
01:49adiabaticNever really did in Python. Don't expect it'll grow on me too quickly.
01:51adiabaticAFAICT it's great for quick syntax checks, but for repeated errors, I tend to prefer the "up, enter" dance
01:58adiabaticthere we go
02:15replacaRaynes: ayt?
02:15replacalate at night?
03:49jackdempseyhey folks, can anyone point out the obvious mistake here? doing what i thought would be simple learning exercises and i'm already failing
03:49jackdempseyhttps://gist.github.com/1543423
03:49jackdempseythe usage of odd? works as i'd expect, but not the divisible-by…anything basic i'm missing!?
03:53jackdempseyoh lord. nm. ha.
04:25gf3is there something like take-if, or should I use for?
04:26gf3or drop-if
04:31gf3ahh I want filter
08:12foodooI'm working on the 4clojure problem 128 (https://www.4clojure.com/problem/128) with my solution http://pastebin.com/n3GPbkhX and it looks like the sandbox doesn't like my code. 4clojure returns: "java.security.PrivilegedActionException: java.lang.ClassCastException [...]" How can I make the sandbox accept my solution?
08:50Raynesfoodoo: Need to actually know what the error is.
08:50RaynesYou'll need to paste the exception.
08:50foodoojava.security.PrivilegedActionException: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry (NO_SOURCE_FILE:0)
08:52RaynesThat doesn't look like a sandbox thing.
08:52RaynesDoes it work in your repl?
08:53foodooRaynes: the individual functions do. And also the (-> ...) expressio
08:53RaynesWhat is 'card'? It doesn't seem to be defined.
08:54foodooah, you are right
08:56foodooI wrapped the entire thing in a (fn [card] %existing-code%) expression now. But I still get the same error.
08:58Raynesfoodoo: Wrapping it in (fn [card] ..) and then calling it works in my repl.
08:59foodooRaynes: Yes. I also tested it and it works fine in the repl
09:00RaynesOh, I see.
09:00RaynesThat is strange.
09:00RaynesThat could possibly be a bug in the sandbox.
09:00Raynesfoodoo: Could you create an issue on http://github.com/4clojure/4clojure/issues about it?
09:00foodoosure
09:10foodooRaynes: done https://github.com/4clojure/4clojure/issues/200
09:11RaynesThanks
10:11TimMcamalloy_: Wait, what? There's a record literal syntax?
10:11Bronsasince clojure 1.3
10:12TimMcIs it part of the public API?
10:12TimMcIt's totally not listed on http://clojure.org/reader
10:13Bronsahttp://dev.clojure.org/display/design/defrecord+improvements
10:22TimMcOK, I think I've seen that.
10:28VinzentHello and happy new year! Where -?> is located now? Is it in new contrib or in clojure itself?
10:33TimMcVinzent: incubator, I think?
10:35VinzentTimMc, yeah, thanks
10:39TimMcFuck it, creating an issue for *read-eval* not being documented in read and read-string.
11:10RaynesTimMc: It isn't particularly documented, but it is absolutely on purpose and public.
11:10TimMcRaynes: Which, the record syntax?
11:11RaynesOh wait, nevermind.
11:11RaynesLiterals.
11:11RaynesI thought you were talking about the factory functions.
11:11RaynesI'm just as surprised as you are about this fancy record syntax.
12:06lnostdalthere's isa? and similar, but is there a type-checking function suitable in e.g. :pre and :post contexts which will show an error message telling which type (and perhaps printed representation of value) it actually did get instead of what it expected?
12:07lnostdalthe thing i seem to do over and over is add and remove print statements -- just to figure out what actually was passed
12:13Vinzentlnostdal, you can write hook that will prn all input data and add it to the functions you are currently working on
12:14Vinzentand for type checks you can use (class x)
12:18Vinzentalso, 'spy' from the tools.logging may be halpful
12:18lnostdalyeah, i already have something like spy
12:18lnostdalbut adding it, then removing it over and over again ....hm
12:19lnostdalclojure needs something like check-type (common lisp)
12:20TimMclnostdal: Add it to a project, require that project everywhere.
12:20lnostdalor whatever .. not sure if that did what i mean here actually
12:22Vinzentlnostdal, with hooks you don't have to modify code itself, you can just add/remove them from the repl
12:23lnostdalwhat do you mean by hooks?
12:23Vinzenthttps://github.com/technomancy/robert-hooke
12:24lnostdalok, yeah
12:25lnostdalbetter of writing my own type-checker / assert function that does what's needed _when_ something goes wrong .. instead of, here too, having to add hooks .. then figure out a way to make the same scenario play out again
12:25lnostdalfeels silly .. should be in core already ...meh
12:27Vinzentso you want tracing of input data for all functions? or you want static-typed clojure? :)
12:27TimMcProbably just better reporting from pre/post.
12:29lnostdal,((fn [x] {:pre [(isa? (type x) clojure.lang.Ref)]} (+ @x 2)) 40)
12:29clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (isa? (type x) clojure.lang.Ref)>
12:30lnostdalyes, TimMc .. something like isa? there .. but it should of course say what it actually _did_ get .. simple really .. :>
12:32Vinzentah, yeah, then I agree
12:32lnostdalsomething like "I got a <long: 40>, but expected a ref." .. then i instantly go "oh right!" .. no need to reeval code, do tests again, or even figure out what the heck some random user did to trigger this -- now long passed, scenario
12:36Vinzentyeah, that's true. I don't use pre and post conditions much, so I haven't actually face these problems
12:36Vinzentalso, it'd be nice to have simpler, in-line syntax for conditions
12:37Vinzentsomething like this http://onclojure.com/2010/03/05/pre-and-post-conditions-a-quest-for-a-nicer-syntax/
12:39Vinzentand a mechanism to describe structure of nested collections, something similar to midje's 'just'. E.g. if I want a vector of 2 numbers, I could write (match [number? number?] x)
12:43y3diis sam aaron's overtone talk from the 2011 conj on the web?
13:11Raynesy3di: Not yet.
13:31technomancyamalloy_: "sadly clojure currently requires you to AOT-compile a namespace if you want to run it as main" <- only true of uberjars actually; both "lein run" and "clojure.main -m" will work without gen-class/aot.
13:36wingieis there a good book on how to do functional programming in clojure?
13:38Vinzentwingie, any clojure book :)
13:39wingieVinzent: is this a good source for learning it? http://clojure.org/
13:39wingieor should i pick a book instead
13:42wingiehow do i install latest java on mac?
13:43Vinzentwingie, I think book would be much better. Also check out http://learn-clojure.com/ - there is a lot of useful links there
13:44pandeirowingie: i am really liking clojure in action, published by manning
13:45wingieokay i know ruby and javascript
13:45wingiehave no experience with java .. is it crucial to know java when using clojure?
13:46wingiewould i ever need to touch a java lib?
13:46wingieor i know a little java (learned the basics some years ago)
13:47technomancywingie: over time you'll need to learn how to read Java (not right away), but writing Java is unnecessary unless you're working with a legacy codebase.
13:47wingietechnomancy: why would i need to learn how to read java?
13:48wingieand when
13:48technomancywingie: learning how poorly-documented libraries work or debugging issues with them
13:50pandeiroi get a connection refused error now when i try to clojure-jack-in... it seems to fail on open-network-stream... anyone know what that's about?
13:55pandeiroweird, if i run lein swank and then use slime-connect, it works on port 4005
13:56pandeiroand clojure-jack-in was working fine just yesterday after i replaced 1.3.2 w/ 1.3.3
13:56Raynestechnomancy: I don't think I've ever needed to read Java code.
13:57technomancyit depends on the libraries you use
13:57technomancyit used to be a lot more necessary to know the JDK for I/O
13:57TimMctechnomancy: Why can't an uberjar just include a launcher class that calls clojure.core with the real main class?
13:57TimMcIs this just a "patches welcome" situation?
13:57technomancyyou'd need non-transitive AOT
13:58technomancyunless you did runtime resolution, which would work fine
13:58technomancyare you saying it should be a lein feature or what?
13:58technomancyI guess at least documenting as a technique in the tutorial would be good
13:58technomancybut /me is heading off
14:01TimMcOK. I'll try to build a JAR that does what I imagine.
14:12TimMcI'm imagining a fake main that calls clojure.main -m
14:20TimMcWell, that was easy.
14:27pandeiroalright so my issue was ip6-related
14:27pandeiro(just in case my future self is looking this up in Raynes' #clojure logs)
14:29TimMcIs there a way I can check whether something was AOT-compiled? e.g. some var.
14:32Raynespandeiro: I don't thing that there is more than one of them.
14:32Rayness/them/me/
14:33RaynesOh, wait. Never mind. Grammar nazi fail.
14:35TimMcrayneseses
14:36pandeiroRaynes: i proofread for a living :)
14:36RaynesTimMc: I've been reading up on English conventions since Stuart Sierra threatened to asphyxiate guppies if I ever accidentally say "it's" when I mean "its".
14:37pandeiroits and it's is painful to read, but there/their makes me cry
14:38pandeirothen i try to tell myself that most people on the internet are not native english speakers
14:38TimMcYeah, just keep telling yourself that.
14:38Raynespandeiro: Yeah, I was under the impression that you needed to use s's when a name is both possessive and ends in a s, but theoatmeal tells me that either way is acceptable.
14:38TimMcpandeiro: Do you find that spending time on the internet impairs your grammar-sense?
14:38pandeiroTimMc: no it makes it more acute
14:39pandeiroRaynes: i am under the impression that s's is NEVER, EVER acceptable
14:39TimMcI *never* had problems with their/there/they're in elementary school, but I find myself typo'ing those these days.
14:39Raynespandeiro: I bet that you'd vibrate like a washing machine if you trolled through a VB.NET forum for a while.
14:40pandeirohaha let me go do that
14:40pandeiroi need a boost
14:50romanandreghey guys, I'm trying to extend some of the clojure libraries (algo.monads in this case), but I don't have any leiningen tools, do you have any wiki or tutorial where they show you how to compile and run test on this projects where the only thing you have is a pom.xml file?
14:51romanandregalso, how do I load the library to the repl the same way "lein repl" would do?
15:05romanandregI tried maven, but when I call mvn in the root of the project I get this error:
15:05romanandreg[WARNING] Some problems were encountered while building the effective model for org.clojure:algo.monads:jar:0.1.1-SNAPSHOT
15:05romanandreg[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.clojure:pom.contrib:0.0.25, /Users/roman/.m2/repository/org/clojure/pom.contrib/0.0.25/pom.contrib-0.0.25.pom, line 119, column 15
15:06romanandregsadly my maven foo is not that great :-(
15:08TimMctechnomancy: OK, I have a working example of a JIT uberjar using an AOT loader class: https://github.com/timmc/uberjit/blob/master/src/sj/loader.clj
15:12TimMctechnomancy: So, I'm imagining Leiningen dropping that loader.clj in with a hardcoded namespace.
15:55flazzis it possible to overload count for a custom type?
16:03TimMcflazz: Check the source.
16:03TimMcSee if there's a multimethod or interface or what have you.
16:03flazzTimMc: for count? will do
16:03flazzthanks
16:04TimMcflazz: I think there's a Counted interface for constant-time counts.
16:04bobhopeDoes anyone know how progress on clojure's integration with Fork/Join is going?
16:04bobhopeOr when it might be released?
16:06bobhopeAlso, can anyone explain how agents are scheduled? Like, if you have a system with 10 agents, and one agent has 100 actions pending and the others each have 5 actions pending, and the agent with 100 actions pending runs one action, will the thread that agent was run on continue running actions from that queue until it's exhausted? What if one of those actions causes additional actions to be sent to that agent?
16:11chouserbobhope: It's not documented, so don't rely on this always being the case...
16:12hiredmanbobhope: I think they run roughly fifo, they use an executor under the hood which most likely keeps tasks in a queue
16:12chouserbut my reading of the code indicates that once an agent is running an action, it won't give up its thread until at the end of an action there are no more actions to run.
16:13hiredman*sigh*
16:13chouserheh
16:13chouserYou don't trust my reading of Java code?
16:14chousersrc/jvm/clojure/lang/Agent.java line 155
16:15hiredmanwell, a lot has a changed since the last time I looked Agent.java
16:15chouserhm, no, you're right to doubt me
16:16hiredmanI don't think this ActionQueue thing existed last time I looked at this
16:16chouserthe execute just re-queues the action
16:16chouserrather, queues the next action. subsequent actions on the same agent can probably end up on different threads.
16:16chouserthis should be easy to demonstrate.
16:16RaynesI have a system with 10 chousers. He basically just schedules things however he likes.
16:16RaynesIt works out though.
16:17chouserYour chousers work out? I should get one of those.
16:18hiredman(send-off (agent :agent) (fn f [_] (send-off *agent* f) (println (.getId (Thread/currentThread)))))
16:18hiredmanor something
16:19hiredmanchouser: it seems like the possible starvation behaviour would be undesirable, so I would be surprised if that is what agents did
16:20bobhopechouser, sorry, i didn't see your response--i'm going to look at the code now
16:20chouseryep, you're right.
16:20chouser(dotimes [_ 20] (send a #(do (Thread/sleep 100) (prn (.getId (Thread/currentThread))) (inc %))))
16:21chouserwhen I run that here I get a bunch of actions on one thread, then a bunch on another.
16:21chouserIf my original interpretation of the code were correct, that would be impossible, so I was definitely wrong.
16:21chouserbobhope: so hiredman was right -- all the actions are fed into executors which manage the scheduling
16:22bobhopedo you know which executor might be backing it?
16:22chouserbut regardless, these specifics aren't documented which means future versions of Clojure could do something different.
16:22clojurebotCool story bro.
16:23hiredmanbobhope: it's a vanilla executor
16:23bobhopeI'm interested because I have a program with 100k agents or so, and they each have small actions, but I think it makes sense to attempt to run the actions in batches to improve locality
16:23chouserbobhope: yup! ##clojure.lang.Agent/pooledExecutor for send and ##clojure.lang.Agent/soloExecutor for send-off
16:24chouserhuh
16:24chouser,clojure.lang.Agent/pooledExecutor
16:24clojurebot#<ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor@da95c1>
16:24chouser,clojure.lang.Agent/soloExecutor
16:24clojurebot#<ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor@2e3cb1>
16:25hiredmanseems like a lot of agents to me, but I've never really used agents seriously
16:25bobhopemy problem has a lot of parallelism
16:26bobhopeunfortunately, it's pretty fine-grained
16:26chouserI wouldn't be surprised if batching improves throughput
16:26hiredmanwell, agents aren't for parallelism
16:27bobhopethey aren't?
16:27bobhopewhat are they for?
16:27hiredmanthey are for wrapping a series of async generated states with an identity
16:28bobhopeI don't understand what that means
16:28hiredman~google rhickey state and identity
16:28clojurebotFirst, out of 1680 results is:
16:28clojurebotUI Press | Donald R. Hickey | The War of 1812: A Forgotten Conflict
16:28clojurebothttp://www.press.uillinois.edu/books/catalog/84xtw3mk9780252060595.html
16:28hiredmanUh
16:29wingiehow can i have REPL up/down key support?
16:29hiredmanbobhope: if you just want to run tasks in parallel then you don't want agents, you want futures or use executors directly
16:30hiredmanagents are a clojure reference type
16:30bobhopemy problem involves having hundreds of thousands of state elements with data flowing between them
16:30hiredmanhttp://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey this one
16:31bobhopeit seems like agents are a good abstraction for modeling this problem
16:31hiredmanah, so you do need the state to have a consistent identity
16:32bobhopethe problem I'm solving is really a dataflow problem
16:32wingieanyone?
16:32bobhopebut it has some extra out-of-band state beyond the dataflow itself
16:32clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
16:32wingiei need up/down key to work :(
16:32bobhopewingie, get leiningen
16:33bobhopehiredman, I don't know what you mean by "identity"
16:33hiredmanwingie: rlwrap
16:33hiredmanbobhope: so clojure generally deals with immutable data
16:33hiredmanlike {:name "bob"}
16:33bobhopeyep
16:34hiredman(let [bob {:name "bob"}] bob)
16:34bobhopeOh, you mean identity in the sense that I have a name for something whose data is changing, which is why I need a reference type?
16:34wingiewii there is a brew package for leiningen
16:34hiredmanwingie: use the shell script
16:34bobhopewingie, google for leiningen, then click the first link, then read
16:34hiredmanthe data isn't changing, you have a series of unchanging data over time
16:36hiredmanbut you wrap that unchanging data over time in a single reference (an identity)
16:36wingiehiredman: why not brew?
16:36bobhopewhen you say "change", you're referring to mutation?
16:36hiredmanyes
16:37hiredmanthe reference types use managed mutation to provide identities
16:37bobhopeahh, that's what I wasn't understanding
16:37wingiebrew installs 1.6.2 which is the latest according to https://raw.github.com/technomancy/leiningen/stable/bin/lein
16:38wingieso i guess its the same
16:38bobhopeI was trying to interpret what you were saying under the assumption that I fully understood that clojure's mutation is constrained to reference types
16:38bobhopevocabulary is hard ;)
16:38hiredmanwingie: it's not, the lein shell script will install it for your user
16:38wingiehiredman: ah .. it doesn't matter for me if it installs system wide
16:38chouser"identity" means approx the same as "instance of a reference type"
16:39hiredmanwingie: better not to though
16:39wingiehiredman: why?
16:39amalloyRaynes, pandeiro: Raynes was right about s's, and the oatmeal was apparently wrong. if a name ends with an s but is not plural, then its possessive ends with s's. for example, the dog owned by someone named Evans is Evans's dog
16:39bobhopechouser, now I understand
16:39Raynesamalloy: You're about to go to war with a proofreader. Better don your English hat.
16:40hiredmanwingie: I dunno, just nothing else in the java/clojure ecosystem installs system wide
16:40amalloyRaynes: i will bitchslap any "proofreader" who thinks s's is never acceptable
16:40hiredmanamalloy: different style guides say different things, s's is the more modern choice
16:40amalloyhiredman: emacs! :P
16:41wingiewhy is the repl that bad it doesn't have auto completion and forces me to use rlwrap
16:41wingiehaskell's REPL is way better :)
16:41hiredmanwingie: becuase no one cares
16:41amalloywingie: because rlwrap exists. why waste effort on reimplementing rlwrap?
16:41wingiei care!
16:41bobhopeI usually use vimclojure or slime
16:41wingieperhaps im a noone
16:41hiredmanthere is more interesting code to write
16:41bobhopeIt's like a repl, but it's way better
16:42wingieok
16:42bobhopesince you get the full power of a text editor behind you
16:42hiredmanyou can write code just fine with the existing repl
16:42hiredmangood enough
16:42technomancythere is reply
16:42wingieis it an idea to use leiningen to run clojure files instead of using REPL to learn?
16:43technomancyhttps://github.com/trptcolin/reply
16:43Raynestechnomancy: Why isn't that in Leiningen yet?
16:43technomancyRaynes: it's not really done yet
16:43technomancyit was only started at the conj iirc
16:43bobhopewingie, leiningen is a build system that also can configure a repl with readline and set up your classpath for you
16:44bobhopewingie, if you really want to use a pleasant environment, you should choose vim or emacs
16:44Raynestechnomancy: Neither is Leiningen, but I still use it. :p
16:44RaynesLeiningen is a development environment for the command line.
16:44bobhopewingie, and then, you can have incredible power by having your editor be a repl
16:44technomancyRaynes: reply is totally on the table for 2.0
16:45bobhopeso that you can execute the code under the cursor, or see what its macro expansion is
16:45bobhopeor look up its documentation or soure
16:45bobhope*source
16:45wingiebobhope: im using cloud9ide for my web projects
16:45RaynesIt's probably best if we avoid terms like "build system".
16:45wingiethey have clojure support ... thank god
16:45pandeiroamalloy: Raynes: touche, seems i am getting old (http://www.chicagomanualofstyle.org/CMS_FAQ/PossessivesandAttributives/PossessivesandAttributives01.html)
16:45wingieor let me say clojure highlighting
16:46wingiei decided to try out clojure instead of haskell because they had clojure highlithing haha =)
16:46technomancyRaynes: I like the term "project automation" but I'm not 100% settled on it
16:46bobhopewingie, if you want blissful development, you should really consider vim or emacs with the associated clojure integration
16:46bobhopeFor instance, I just type ,me to macroexpand the block under my cursor
16:46Raynestechnomancy: I don't really like including "project" in it.
16:46RaynesThat implies that it is useless for non-project things.
16:46yoklovemacs makes writing lisp code amazing
16:47bobhopeor ,et to execute the expression under my cursor in the repl
16:47amalloyyoklov: writing lisp code is already amazing
16:47Raynespandeiro, amalloy: Nobody was incorrect then, right? Not even theoatmeal.
16:47wingiebobhope: yeah vim is powerful
16:47technomancyRaynes: well if core would get off their bums and actually provide a launcher, it then lein could get back to just being about projects
16:47yoklovThat's true, not having paredit-mode is a pain though.
16:47wingieits the best console editor ever
16:48bobhopewingie, have you used vim?
16:48pandeiroRaynes: depends on whose authority the question rests... AP (hence most American mags and newspapers) doesn't allow s's
16:48wingieyepp
16:48bobhopeare you comfortable with it?
16:48amalloyi totally agree emacs is great for writing lisp. you're just implying that it's not awesome to write lisp unless you use emacs
16:48wingiejust during a period .. now im using c9 more
16:48wingieno .. just a beginner
16:48yoklovOh, I didn't mean to imply that at all
16:48wingieusing it for simple stuff on the console
16:48Raynespandeiro: Have you ever just considered learning lojban and pretending that you were never a native English speaker?
16:49wingieonce upon a time i even wanted to learn vimscript because of it=)
16:49bobhopewingie, http://naleid.com/blog/2011/12/19/getting-a-clojure-repl-in-vim-with-vimclojure-nailgun-and-leiningen/ was really useful for me
16:49pandeiroRaynes: i will consider that, after lisp
16:49bobhopeit gave me an excellent dev environment for clojure
16:50wingienice thanks
16:58wingieis Leiningen the defacto build system for Clojure?
17:05wingielein is like npm for node/gem for ruby
17:07yoklovi think its somwhere between the two things you said (but i'm just learning clojure also)
17:07yoklovsomewhere*
17:08wingieyoklov: cool
17:08wingiewe should chat :)
17:08wingiewhy are you learning clojure?
17:08wingieand from what langs are you from
17:09yoklovother lisps
17:09wingieah
17:09yoklovand i guess i also know java but thats... less important haha
17:09wingieit would definitely be simpler for you to learn it then
17:09wingiefor what you learning clojure?
17:09yoklovmaybe, i keep getting stuck and just going back to them though haha.
17:10yoklovbetter libraries, mostly. Also it feels much more modern.
17:11yoklovI.E. car/cdr/cons was designed in the 60s and feels a bit... dated (tragically, I'm so used to it).
17:12wingieisn't clojure from 2009?
17:13yoklovDunno, around then I think. Sequences certainly feel like a better way of doing things though.
17:13wingieah im still very new .. kinda 1 hour... need to start reading a book about it
17:13yoklovthis is like my 4th or 5th time trying to learn.
17:13wingiewow :)
17:14yoklovwell none of them were very serious and I just get stuck at a point and end up being like "oh i know how to do this in racket (or whatever) i'll just go back to that"
17:15wingie:)
17:15wingiei hope i will like all the ()
17:15yoklovoh, you will.
17:15wingieit sure will look cool if they were of different colors
17:16wingieits cool that heroku has support for it
17:16wingieanother reason im learning clojure before haskell
17:16wingiejust in case i have a backend app i can just deploy it
17:16yokloveh, haskell's type system is way more of a hassle than its worth
17:18wingiewhat do you think of lisp?
17:18wingiesomeone in that channel told me to not bother learning clojure
17:18wingiethat it wasn't ready yet
17:18yoklovthey're jealous that lisp is more powerful.
17:18amrois there a way to get cleaner backtraces from noir? I'm not interested in seeing clojure.lang.Compiler.analyzeSeq(Compiler.java:6409) etc
17:19danlarkinyou may not be interested in seeing it... but it's on the stack, sooo
17:20amroso what exactly?
17:20danlarkinso it's gonna show up in stack traces
17:20amroI'm wondering if there's something that cleans it up already, else I'll use a wrapper around lein run that filters it out
17:21danlarkinsaying you want to clean it up implies you think it's dirty
17:21danlarkinbut it's just being accurate
17:21amroit's noise, my mistake is on the top of the stack
17:21yoklovwingie: check your pm's
17:21danlarkinthose frames *are* actually on the stack
17:21amroI know they are
17:24danlarkinyou may only be interested in the top of the stack right now, but who knows when the whole thing will provide you with insight
17:25amroI'm not saying want to nuke it from orbit and ensure it never shows up again anywhere, I'm just asking if there's a way to filter it when I want to filter it
18:11wingieno one said i could use leiningen's repl :)
18:11wingieno need to install anything else
18:12wingielein is so slow .. is it because it has to boot up the whole jvm?
18:29emezeskewingie: I believe that is why it's slow. I've heard that getting a "client" JVM installed can help a lot
18:39seancorfieldwingie: I tend to leave a REPL open in a window for a long time (so I don't deal with startup time)
18:39seancorfieldMy REPL in Emacs (via lein swank-clojure) has been open for weeks :)
18:51wingieseancorfield: :)
20:22adiabaticStill getting the hang of lispy formatting style. How's this? https://gist.github.com/1545877
20:26amalloyyour indents are weird. i guess you're not using emacs?
20:30adiabaticNo.
20:31amalloyadiabatic: https://gist.github.com/1545887 is some feedback
20:32adiabaticI've tried it, but that was back in the days when vim was my go-to editor of choice, and it wasn't So Frigging Awesome that I wanted to switch. I've since moved on to TextMate and now BBEdit.
20:32adiabaticthanks!
20:32amalloynote also that your current version fails if the input collection is nil: it reports count is 1
20:33adiabaticSo two-space indents is the strong convention in lispland?
20:33amalloyfor forms that have a "header" and a "body", yes
20:34amalloyeg, fn has a header where you give it a name and args, then a body. the body is indented by two
20:41amalloyanyway, more important than how many spaces you indent by is that if A is a subform of B, then A is indented more deeply than B. your original version violated that assumption by putting (let [r (rest coll)] ...) farther left than (fn my-count-plus ...), which was its parent
20:44adiabaticgotcha
20:50amalloyit seems a little weird to me that lisp, this whole family of languages, have all (mostly) settled on one consistent formatting style, while all the young upstarts like C are still arguing among themselves and need company/project style-guides to keep things consistent from developer to developer
20:54adiabaticProbably has more to do with the number of different syntaxes and syntax rules in the curly-braces camp.
20:58adiabaticwould "(cond" get its own line if the first test were really long?
21:05amalloyi dunno. clojure's cond is a beast to indent
21:07amalloybecause it drops the "unnecessary" parens around each pred-expr pair, there's no easy way for editors to indent it right, and it can be hard for the reader to tell what's a pred and what's an expr
21:07amalloyi wrote a cond+ that lets you write (cond+ test1 expr1 [test2 expr2]), ie put in brackets whenever you think it aids readability
21:13adiabaticwhy is (seq …) better than (= '() …)? Brevity, but anything else?
21:14adiabaticAlso, in clojure, do I need to worry about my functions being tail-call optimizable?
21:14hiredmanclojure doesn't do tco
21:14hiredmanthe empty list doesn't need to be quoted
21:15hiredman,(= () nil)
21:15clojurebotfalse
21:15hiredman,(= (seq ()) nil)
21:15clojurebottrue
21:15hiredman,(map empty? [() nil])
21:15clojurebot(true true)
21:17hiredman,(filter string? (repeat 10 1))
21:17clojurebot()
21:17hiredman,(seq (filter string? (repeat 10 1)))
21:17clojurebotnil
21:27adiabatic,(first ())
21:27clojurebotnil
21:30amalloybecause things which are empty are not always ()
21:32adiabatic,(= () "")
21:32clojurebotfalse
21:32hiredman,(= () (seq ""))
21:32clojurebotfalse
21:32hiredman,(= nil (seq ""))
21:32amalloyand if you test against () everyone who reads your code will be like "...what is he testing here?" as compared to when you do (if (seq x)) the reader says "okay, he's seeing if the thing is empty or not"
21:32clojurebottrue
21:32hiredman,(empty? "")
21:32clojurebottrue
21:35adiabatic,(if-let [[h & r] ""] 1 0)
21:35clojurebot1
21:35hiredman,(macroexpand '(if-let [[h & r] ""] 1 0))
21:35clojurebot(let* [temp__3695__auto__ ""] (if temp__3695__auto__ (clojure.core/let [[h & r] temp__3695__auto__] 1) 0))
21:36hiredman,(if-let [[h & r] (seq "")] 1 0)
21:36clojurebot0
21:51adiabatic,(if-let [[h & r] [1 2 3 4 5]] 7 8)
21:51clojurebot7
21:51adiabatic,(if-let [[h & r] [5]] 7 8)
21:51clojurebot7
21:51adiabatic,(if-let [[h & r] []] 7 8)
21:51clojurebot7
21:51adiabatic…hunh.
22:19amalloy[] is truthy, as is (). what's the problem, adiabatic?
22:20adiabaticNew problem now. Can I use destructuring assignment on (sorted-set 1 2 3 1)?
22:21adiabaticcode: https://gist.github.com/1546129 passes 1, fails on 2: http://www.4clojure.com/problem/23
22:21adiabaticComplains that nth isn't supported on this type, but *I*'m not using nth…
22:30wingiecould you say that vector is like an array in other langs?
23:14technomancywingie: sorta
23:15technomancyarrays are usually mutable and fixed-length and often homogeneous, but apart from that they are similar