#clojure logs

2015-05-02

00:24Farehow do I tell clojure how to print my objects?
00:26bitcycleHey all. Is there a Leiningen template for clojure console applications?
00:27crocketTEttinger, Do you think scala is a good language?
00:27crocketIn my mind, scala is complex and difficult to get right.
00:28FareScala looks good on paper. I know people who love it and others who hate it in practice. Doesn't tell much.
00:29Faremost complain about the tooling.
00:29crocketScala syntax is very complex
00:29crocketIt takes a 1000 page book to explain its syntax.
00:29Fare:-(
00:29FareI'm struggling with the finer points of the python syntax right now.
00:30FareThe treatment of variables is horribly subtle.
00:30crocketFare, It's not difficult.
00:30crocketPython tutorial is not complex.
00:30Farecould certainly be worse
00:30Farethe fact that a global declaration can come after the use...
00:30crocketWhat is so subtle about python variables?
00:32Farenonlocal vs global
00:32crocketFare, I don't use global variables.
00:32Fareso there
00:33Farewhen you implement it, you have to support the weird corner cases.
00:33crocketYou just need to memorize some default global variables
00:33crocketI haven't met such corner cases.
00:35FareI'm back to implementing a python subset
00:35Fareeven sanitizing things for the chosen "subset", it's a bitch.
00:37crocketFare, You mostly don't meet corner cases.
00:37Fareyou need to implement them anyway
00:37Fareor at least detect them and throw an error saying you aren't implementing them.
00:39crocketFare, What are you doing?
00:39crocketAre you writing a python interpreter?
00:39FareI admit I'm making my life slightly harder in a way (and easier in other ways) by implementing macros for python.
00:39crocketI never heard of macros for python.
00:39FareI've resurrected my project of a pure python to clojure compiler in clojure.
00:40Farethere exist some package that implements them already. It's ugly, but it works.
00:41FareI'm also using macros and other things to desuga the language into a simpler one
00:41crocketFare, Why are you torturing yourself?
00:42FareI'm rewriting the desugaring pass right now to allow for macros. Dealing with retroactive global declaration after you already expanded an inherited macro binding... yuck. I punt.
00:42Faremany reasons
00:43Fareone of them: $work has a naive interpreter for an even smaller subset of python
00:43crocketMany reasons to torture.
00:43FareI'd like to replace it with this compiler
00:44crocket$work
00:44crocketIf it wasn't your job, would you do it?
00:44TEttingercrocket: i am not a fan of scala. i used it for an app, and its performance is good, but it is too complex for my taste
00:44FareI'd also like to write my first non-trivial compiler for a non-trivial language
00:44Farecrocket, I would do something somewhat different — it wouldn't have python syntax.
00:44crocketTEttinger, So, is clojure viable on android?
00:44Farebut I'd also be writing a compiler
00:44FareI probably would be using racket instead of clojure
00:45crocketIs racket better than clojure?
00:45Farefor writing compilers, yes
00:45Farefor interfacing with the jvm, no
00:45crocketIs racket better than clojure as a general purpose language?
00:46Faremaybe
00:46FareI'd say yes, though clojure does have goodies.
00:46crocketWhy is clojure getting so much hype, then?
00:46crocketJust because it's a good interface to JVM?
00:46Farecrocket: because it leverages the java environment
00:47crocketHow typical
00:47Farebecause it provides a relatively simple yet elegant data model and concurrency model.
00:47tomjack"This project is written in a literate programming format and requires Emacs & Org-mode to generate usable source code in CLJX form."
00:47tomjackhttps://github.com/thi-ng/geom/blob/master/src/index.org
00:48tomjackI am simultaneously intrigued and horrified
00:48Farebecause it's written by someone who cares about making practical things simple and elegant — though he obviously cares less about theory or power.
00:48crocketIs clojure viable on android right now?
00:48Farecrocket, last I heard it wasn't, or barely so, but that was many months ago.
00:50Farelooks like something's working now:
00:50Farehttp://clojure-android.info/
00:50crocketFare, Of course, working...
00:50crocket" Please, expect not every feature to be present, and those that are to have bugs. It is hard to keep up with Android platform evolution and to track down all problems that may arise, but we are doing our best."
00:50crocketWhat feature
00:50crocketIt's just a language.
00:52FareI expect the language to be there, but the interface to the system to be somewhat rough.
00:52Fareslow startup
00:52crocketYou mean the API binding?
00:54Fareprobably. I don't know anything
01:22tomjackhuh.. (defn transduce ([xform f coll] (transduce xform f (f) coll)) ...)
01:23tomjackI wonder why not (transduce xform f ((xform f)) coll) ?
01:26tomjackI see, cus that's wrong..
02:40zol_If I have a map like: {:a 1 :b 2 :c ({:d 3, :e 4}, {:d 5 :e 6})}, and I would like to assoc for example each value in [{:f 4 :g "foo"}, {:f 6 :g "bar"}] inside each map in :c respectively, how would I do that? I am actualling fetching values from an SQLite database and building my own map. So imagine that :e is a primary key and that :f is used to lookup the correct map in :c, and :g is the actual data.
02:40zol_So I want it to look like {:a 1 :b 2 :c ({:d 3, :e 4 :g "foo"}, {:d 5 :e 6 :g "bar"})} in the end.
02:55ben8hello
02:56tomjack,(clojure.set/join #{{:d 3 :e 4} {:d 5 :e 6}} #{{:f 4 :g "foo"} {:f 6 :g "bar"}} {:e :f})
02:56clojurebot#error{:cause "clojure.set", :via [{:type java.lang.ClassNotFoundException, :message "clojure.set", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366] [java.net.URLClassLoader$1 run "URLClassLoader.java" 355] [java.security.AccessController doPrivileged "AccessController.java" -2] [java.net.URLClassLoader findClass "UR...
02:56tomjack:(
02:56tomjackthe answer is #{{:d 3, :e 4, :f 4, :g "foo"} {:d 5, :e 6, :f 6, :g "bar"}}
02:56ben8I have a small problem with vectors and functions
02:56ben8http://stackoverflow.com/questions/29999316/append-to-a-vector-in-a-function
02:57tomjackzol_: that's one way.. note you need sets of maps on both sides
02:58tomjackI guess your case may be easier than the generality of join
02:58ben8anyone an idea?
02:59ben8basically I try to manipulate two vectors
02:59ben8with different length. should I first filter them to make them the same length?
03:02tomjackben8: helpful to give small example inputs and outputs you want
03:05ben8yes. e.g.
03:05ben8(rowMaker ["A1"] ["B1" "B2"])
03:05ben8; => [["A1" "B1“] [“" "B2"]]
03:14tomjackI see
03:15tomjackso, umm
03:15tomjackyou don't do things that way in clojure :)
03:16tomjackI can give you the answer to your problem, but not sure how helpful it will be towards understanding this point
03:16tomjack,(map vector ["A1"] ["B1" "B2"]) ; not quite
03:16clojurebot(["A1" "B1"])
03:17tomjacknot sure what the easiest way to fix the problem is, but what you suggested can work:
03:18ben8yes. I understand map, apply, filter etc
03:18ben8where functions work on each element
03:18ben8but here I need a more complex expression
03:19tomjackI see. what you suggested can work, though: https://www.refheap.com/0ee3934217782dbac0036fe3a
03:19tomjacker, except there's a bug
03:19tomjackof course the second (- c ca) should be (- c cb)
03:20tomjackas for fixing your attempt: doseq is not appropriate
03:20tomjackall of the functions you use are pure, so there are no side-effects and your function is equivalent to (defn rowob [colA colB] [])
03:21ben8cool. thx a bunch
03:22ben8trying to understand "(map vector colA colB)"
03:25tomjack,(map (fn [x y z] (cons 'got x y z)) [1 2 3] [4 5 6] [7 8 9 10])
03:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core/cons--4081>
03:25tomjackhrmph
03:25tomjack,(map (fn [x y z] (list 'got x y z)) [1 2 3] [4 5 6] [7 8 9 10])
03:25clojurebot((got 1 4 7) (got 2 5 8) (got 3 6 9))
03:26ben8great. so what would be a case where doseq would be appropriate?
03:27tomjackfor it to make sense the body should contain side effects
03:27ben8after writing procedural code for so long, it does take time to switch one's thinking
03:27tomjackswap!, reset!, println or other io... lots of stuff
03:29tomjackall of the data structures clojure gives you are immutable, so you never use side effects to change them, with at least one minor exception which is not important to you right now :)
04:33crocketIs clojure slow to start on android?
04:33otwieraczs/ to start on android//
04:33otwieraczyes
04:34crocketotwieracz, Whut
04:34crocketWut
04:35crocketI heard skummet compiles clojure into a fast binary
04:48crocketI think clojure is generally fast enough...
04:48crockethttp://benchmarksgame.alioth.debian.org/u64q/clojure.html is the benchmark
04:51otwieraczI'm sad there's no Common Lisp
05:01crocketIs skummet going well?
05:02crocketClojure, clojure, clojure
05:02crocketIt is becoming platform independent.
05:03crocketIs it a good choice to use ClojureCLR on mono?
05:03crocketOr, is it just better to run clojure on JVM?
05:03crocketTo be honest, windows feel awkward.
06:19crocketWhy does clojure's dynamic typing get in the way?
06:19crocketWhen does clojure's dynamic typing get in the way?
06:26TEttingercrocket, when you're faced with unusual errors, mainly. that's the best thing typed clojure does -- it has better error messages and can detect certain things at compile time
06:26crocketTEttinger, static error detection.
06:27TEttingeryeah, it reduces the amount of JVM stacktraces, while still being optional as a typesystem
06:27crocketTEttinger, Where does scala or any other statically typed functional JVM language win over clojure?
06:29TEttingerscala wins on performance at runtime on certain types of code (oddly I think idiomatic scala tends to suffer from not having any kind of traditional for loop, only iterator for loop and the nasty while with counter), scala has somewhat faster startup and can benefit from proguard...
06:30TEttingerboth clojure and scala can be optimized into performing well if you know what you're doing
06:31TEttingerclojure is very concise and tends to be clear IMO
06:31crocketTEttinger, Isn't scala more reliable than both java and clojure due to functional programming and strong static typing?
06:31TEttingerthat's a hell of a loaded phrasing
06:31crocketWhen you build things that shouldn't crash, reliability matters.
06:31crocketthings like a general library
06:31TEttingerscala isn't necessarily more reliable, it still ends up calling java code at its heart
06:32crocketWhat about kotlin?
06:32TEttingerif you're building things that shouldn't crash, Ada
06:32TEttingernot even kidding
06:32crocketScala catches errors with static typing.
06:32TEttingerAda is meant for keeping planes in the air.
06:32crockethmm....
06:32TEttingerif you don't care about that, anything else is fine
06:32crocketWhy don't people use Ada?
06:32TEttingerbecause if you thought java was verbose...
06:33TEttingerada is typically much more
06:33TEttingerit's a painful language to write, partly by intent. it's meant to be read not written
06:33crocketIf you want to build a stable library on JVM, a statically typed language might come in handy.
06:33TEttingerit has pretty much mandatory documentation so you can see who was responsible for that plane crash instead of firing the whole division
06:34crocketWhut
06:34TEttingeryeah Ada has really heavy requirements for documenting code
06:34crocketTEttinger, In most cases, planes crash because of humans.
06:34TEttingeryep
06:34TEttingerbecause the machines are pretty damn reliable
06:35crocketHumans haven't evolved to fly things.
06:35crocketI read "In Bini's inverted pyramid, he suggests using more-static languages at the bottommost layers, where reliability is the highest priority."
06:35TEttinger(like when that plane over hawaii had part of the roof tear off mid-flight, but the thing still was able to land with no fatalities)
06:35crockethttp://www.ibm.com/developerworks/library/j-jn16/index.html
06:35sobelif $deity meant for us to fly, she'd have given us loads of aluminum ore, strong winds, and millenia to figure out the physics
06:36TEttingersobel, heh I just implemented sobol sequences, your nick reminded me
06:36crocket"Next, he suggests using more-dynamic languages for the application layers, using simpler syntax for building things like user interfaces."
06:36sobel:)
06:37sobelTEttinger: i'm more used to being an edge detection alg
06:37crocketOk
06:37crocketI think resiliency comes from functional programming more than static typing.
06:37TEttingeryeah
06:37TEttingerimmutable data is a big aid
06:38crocketSo, I'm going to learn clojure and build android apps in clojure.
06:38crocketYay
06:38crocketBut, what about iOS?
06:38TEttingerlein-fruit
06:38crocketHow do I use clojure to build an iOS app?
06:38TEttingerthere's something called RoboVM
06:38crocketTEttinger, Is clojure mature on iOS?
06:39TEttingernothing on the JVM is on iOS
06:39sobelthanks for that article, crocket. i think i have to publish that to my team @ work. they really need to see Bini's inverted pyramid.
06:39TEttingerbut it has been used in app store apps
06:39sobelclojure or clojurescript?
06:40TEttingerRoboVM is, IIRC, a set of APIs that let you run android-style code on iOS
06:40TEttingerany JVM lang, it could in theory do clojurescript but it would be silly to use Rhino for it :)
06:40sobeli've read about several apps that used clojurescript to do hybrid apps (part native, part browser)
06:40sobelunder ios
06:40crocketsobel, I think Bini's inverted pyramid is obsolete.
06:40TEttingeryeah you could do that
06:41sobelcrocket: i do too, but this team needs to see it before they can overcome it
06:41crocketI want to use the same clojure codebase to compile an app for iOS and android.
06:41crocketWhat do I do?
06:41sobelcrocket: i have to convince them the design patterns they have are basically functional programming decayed over way too many java classes
06:42crocketsobel : What the hell is that?
06:42sobelcrocket: a mess
06:42crocketsobel : functional programming over java classes sounds weird.
06:43crocketsobel, Why don't you just move to a better company?
06:43sobelcrocket: ever work with Spring based projects heavy on the IoC?
06:43crocketSpring, yuck.
06:43crocketabomination
06:44sobelcrocket: they didn't hire me to tell them how busted their tools are. ;)
06:44crocketsobel, They are probably under nonsensical deadlines.
06:44crocketQuit
06:44sobelthat's adorable
06:45crocketAt least, go to a company where deadlines are absent or sane.
06:45sobel10 years ago i would have
06:45crocketWhut
06:45crocketsobel, Have you become a wage slave?
06:45sobeli like to think i'm compensated a bit better than that
06:45crocketok
06:46crocketsobel, As long as the workhours are short and you're financially well compensated...
06:46sobelhow do you suppose anything gets better, anywhere?
06:46crocketsobel, Your own startup
06:46crocketsobel, Or, my startup
06:46sobelstartup code quality! legendary!
06:46crocketsobel, My startup won't impose deadlines at all...
06:47sobelwhat about your startup's clients?
06:47crocketThere would be rare deadlines that come up once a year or two, but I'll put bounties on them to make people step up voluntarily.
06:47crocketsobel, just people who say little money.
06:47sobelthat's brilliant. you wouldn't even need employees.
06:47crocketsobel, just people who pay little money from now and then.
06:47sobelyou could just bounty all the work
06:47crocketsobel, The problem is that I want to implement open allocation.
06:48noncomhow do i add a classpath in runtime on android? (either clojure or java)
06:48noncomi use clojure in a java android app through java->clojure interop and (require) evals fail to find the namespaces on the classpath
06:48crocketIf people could depend on my bounties for their living, why not?
06:48sobelanywho. they did all these patterns where FP would have made it a lot simpler, even Spring would have made it a lot simpler, but instead they shoved square pegs into round holes using reflection
06:48noncomyeah. why do they do that?
06:48crocketsobel, Why do you use spring in the first place?
06:49crocketIt's a giant framework.
06:49sobel<blink>
06:49crocketah
06:49crocketyou didn't
06:49crocketThey did
06:50crocket"Don't get a job where spring is used"
06:50crocketDon't forget that.
06:50sobelthat's ok, i don't think you understand my job or career
06:50crocketsobel, I don't think I do
06:51crocketHowever, I'd avoid bad practices...
06:51sobeli'm not a developer by trade anymore. i'm a contributor but i'm not part of the core team, there.
06:52sobeli might make around double what the developers are making, as a consultant. and i use a much more diverse tool set, including clojure, spring, or any of the tools i've learned over the years of my (now lengthy!) career
06:53sobeland i have the ear of management because i was hired by the software dev management group to work as the sole dev in professional services
06:54sobelso think of my role as that of a beloved uncle who flies in once in a while to give advice based on meeting with the extended family
06:54crocketsobel, Do you mean a bad family?
06:54crocketA sour family
06:55sobela realistic one. you don't quit, do you?
06:55crocketsobel, I quit my job.
06:55sobeldid you know all software has bugs, and none of the programming languages are perfect?
06:55crocketsobel, I knew
06:55sobelyou might bring that reality a bit closer to your conversantional context
06:55crocketIf you mean a company by extended family, my insight is correct.
06:56crocketMost companies are families gone bad.
06:56sobelthis one hasn't gone bad (yet) and business is solid
06:56crocketsobel, ok
06:57sobeli can also walk to work, it's so close. and my kids' school is close. i have every reason to reinvest in this job.
06:58crocketIs https://github.com/oakes/lein-fruit mature enough for production?
06:58crocketI want to use the same clojure codebase on iOS and android!
06:59sobelthat looks like a trust-but-verify to me
06:59crocketMeh..
06:59crocketI guess I'll have to use PhoneGap for cross-device development.
06:59crocketMaybe not?
07:00crocketGod...
07:00crocketRobovm has fee
07:01crocketsobel, Have fun with your job....
07:02Bronsacrocket: this is getting OT
07:02crocketBronsa, What is OT?
07:02Bronsaoff topic
07:03crocketBronsa, Are you a moderator of some sort?
07:03sobelhe is, and i am, too
07:04crocketProbably, I should quit asking questions and just learn clojure and scala myself.
07:04sobelcrocket: there is an official OT channel and i might be willing to engage the career topic further there but it's played out in here
07:04Bronsacrocket: i'm not but a scrollback full of you talking about sobel's job is not what this channel is for. there is #clojure-offtopic or irc queries for that
07:04crocketok
07:05sobelcrocket: scala keeps crossing my radar but someone in here pointed me to a video from one of the core scala contributors in which he explained why he left the language/project
07:05sobeli think it was enough to keep me from investing in scala for anything new
07:05crocketsobel, There could have been political reasons for quitting rather than technical reasons.
07:05sobellet me see if i can dig it out of history
07:06sobeloh no, they were entirely technical and he went into technical detail
07:06crocketbetter than political problems
07:06BronsaI think you're talking about one of paul philips' talks
07:07Bronsahttps://www.youtube.com/watch?v=TS1lpKBMkgg this one maybe?
07:07sobelhttps://www.youtube.com/watch?v=uiJycy6dFSQ
07:07sobeler, now i'm not sure which one
07:08sobelgotta watch to figure out which one was the big FU
07:08sobelpretty sure it's the one i posted; 3:30 in he's on the "never gonna be the language i want" topic
07:08crocketthe language I want.
07:09crocketSome programmers want C.
07:09sobelwe don't want to hear what they think
07:09sobelplease don't confuse or conflate programming with democracy
07:10crocketProgramming is about freedom
07:10sobelhahahahaha
07:10crocketDemocracy != freedom
07:10sobelyou are adorable. are you interested in learning to program?
07:10crocketsobel, I have been learning to program for a while.
07:11crocketI have extensive experiences with nodejs and web browsers.
07:11crocketjavascript is not worth my career.
07:11sobeldo you have preferences for front-end (browser) or back-end (everything else) work?
07:11sobele.g. are you hoping to get into server-side development?
07:12crocketclojurescript, purescript, haskell, clojure, etc...
07:12crocketsobel, I'm going to become a mobile app dev for funding bills and a startup founder.
07:12crocketI'm already a good web dev.
07:12crocketThat said, I already know how to make server programs with 'java'.
07:12crocketjava yuck
07:13sobelwhat do you dislike about java?
07:13crocketsobel, It's excessively verbose, and its exceptions are annoying
07:13crocketIts type system is not good
07:13sobelcan you be more specific?
07:14crocketjava inheritance is like modern GOTO.
07:14sobeltell me a fact that convinces me they are annoying, don't make the judgement for me
07:14crocketIf you inherit many times, your code becomes difficult to understand.
07:14crocketJava interface is not really helpful, either.
07:14sobelso far you've convinced me you don't understand interfaces or the hazards of multiple inheritance
07:14PupenoHow can I see all the options a lein template has?
07:14crocketsobel : I understand interfaces grammatically.
07:15sobelcrocket: this should go to to the OT channel; we're off in the weeds
07:15crocketok
07:16PupenoParticularly, I want to see all the options for building a luminus app.
07:26sobelPupeno: i usually google for examples at github. usually there's an app or sample that has used and documented them all.
07:36profilis (first (filter ...)) cheap? I thought so because filter returns a lazy seq, anyone who can confirm?
07:49hyPiRionprofil: yes
07:50profilhyPiRion: great, thanks
08:01geekyvinhey guys, hope you are well. I am stuck with a recursive program that is suppose to traverse a graph until it finds a path back to the start node. the code is here, https://gist.github.com/geekyvin/7ac37e68a739d354e80d there is something wrong with the way I accumulate the result I couldnt find what exactly.
08:12jack0Hi, how many got in gsoc this year?
08:12jack0Any clue who they are??
08:12lazybotjack0: Definitely not.
08:12jack0lazybot: What do you mean definitely not?
08:21hyPiRionjack0: lazybot just responds to 2 or 3 ? at the end of a line. Right, lazybot???
08:21lazybothyPiRion: Yes, 100% for sure.
08:24jack0I did not get you, hyPiRion
08:25hyPiRionjack0: lazybot is a bot. It just does (.endsWith "your message" "??|???") and replies based on that
08:26jack0Is that so, lazybot ???
08:26lazybotjack0: Yes, 100% for sure.
08:26jack0Haha! Thanks for pointing that out hyPiRion :)
08:29hyPiRionjack0: no problem, people may assume lazybot is sarcastic or arrogant sometimes because of those replies, heh. As for GSoC this year, I believe 5 got accepted: https://www.google-melange.com/gsoc/projects/list/google/gsoc2015
08:29hyPiRionsearch for Clojure in organization there
08:31jack02 from typed , hyPiRion
08:31jack0Cool :)
08:31jack0Do you know any of these people? hyPiRion ?
08:32hyPiRionjack0: not any of the students, no. I've talked briefly with some of the mentors though.
08:33jack0Oh ok :)
08:33jack0Do these students become mentors next year?
08:33jack0and does clojure have a policy of choosing a person only once?
08:35hyPiRionjack0: https://groups.google.com/d/msg/clojure/phVQcZMXkLI/64lldl0d1-QJ – so afaik you can become a mentor if you'd like to, and I think you can be chosen multiple times
08:35jack0:)
08:37puredangerCorrect on both counts
09:18crocketIs http://www.braveclojure.com/ a comprehensive material for clojure?
09:21bcn-florI used it in conjunction with The joy of clojure, some things are clearer in brave clojure, but the Joy of clojure goes deeper into the language. It's also funny at times, especially the examples with zombies :)
10:30sobelTEttinger2: heh, so, i was just looking at sequences similar to Sobol the other day via an HN article about randomly covering a sphere with discs
10:30sobelrather, randomly distributing discs on a sphere
10:31sobele.g. why you don't warp a plane with evenly-distributed discs around the sphere and call it good
10:54tsunny(println "helloroom")
10:55hellotherePrintln ("helloroom")
10:55hellothereNot work
10:57whodidthis((PrinterSingletonFactory.getInstance()).println("helloroom");
10:58oddcully,(prn "makeemstop")
10:58clojurebot"makeemstop"\n
11:00hellotherewhodidthis: how that string works?
11:50ConfusionistCan someone explain the following observation: in a 'lein repl', when loading a file that contains (defmacro reverse-m [s] (list reverse s)) (println (macroexpand '(reverse-m "Hello"))), the result is the expected expansion. When I paste the same in a lein repl, I just see #'app.core/reverse-m (reverse-m Hello).
11:51Confusionist(expected expansion is a reference to the reverse function, a la (#<core$reverse clojure.core$reverse@676dbc3a> Hello))
12:45justin_smiththat isn't a macro expansion though, that's avar resolution
12:50ConfusionistIn the first case, the the result is, effectively, (reverse "Hello")) (with a resolved 'reverse') . In the second case, the result is (reverse-m "Hello")
12:51justin_smithreverse isn't the resolution, it's the expansion
12:52justin_smithmacroexpand doesn't do any resolution, only expansion
12:52justin_smithwell, it does just enough resolution under the hood to look for macros, sure
12:53justin_smithbut it doesn't want to show you the vars (or the functions they resolve to), just the symbols generated by the macros, recursively
12:59ConfusionistI don't understand. Let's go through this step by step. I have a file with the previous macro definition and a line (println (macro-expand '(reverse-m "Hello"))). My expectation was that it would print (reverse "Hello"). When I (load "file") in the lein repl, it indeed prints what I expected. If I subsequently say enter (println (macroexpand '(reverse-m "Hello")) into the repl, I expect to see the same. That is not the case: it prints (rev
12:59Confusionisterse-m Hello). Is my second expectation wrong?
13:00justin_smithis reverse-m in scope?
13:00justin_smith,(println (macroexpand '(reverse-m "Hello")))
13:00clojurebot(reverse-m Hello)\n
13:00justin_smithif it can't find the definition, it can't expand it
13:01ConfusionistAh
13:14ConfusionistOK, thanks, that explains. Unfortunately I'm now puzzled about the scoping issue that causes this. If I simply copy paste (defmacro my-first-macro [] (list reverse "Hello World")) (my-first-macro) from a tutorial into this repl, I get an "Attempting to call unbound fn: #'app.core/my-first-macro".
13:14justin_smiththat shouldn't happen
13:15justin_smith,(do (defmacro my-first-macro [] (list reverse "Hello World")) (my-first-macro))
13:15clojurebot#error{:cause "EvalReader not allowed when *read-eval* is false.", :via [{:type java.lang.ExceptionInInitializerError, :message nil, :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]} {:type java.lang.RuntimeException, :message "EvalReader not allowed when *read-eval* is false.", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [...
13:16justin_smithevalreader?
13:16justin_smithhmm
13:16ConfusionistHmm.. ok, I'll have to throw out dependencies, plugins and user.clj code to find out what's causing it
13:16ConfusionistI'll be back :)
14:12profilHow do I use leiningen without a project.clj? I dont want to create an entire project, just need some dependencies. How do I add them to the classpath when running a standalone lein repl?
14:12justin_smithprofil: perhaps the lein-try plugin?
14:13justin_smithor you could use a vanilla repl with clojure.core and pallet/alembic as the classpath, and use alembic to load deps. Maybe that would work.
14:13seancorfieldI'll +1 lein-try
14:30darthdeusguys, how can I use extend on this protocol? https://github.com/clojure/data.json/blob/master/src/main/clojure/clojure/data/json.clj#L286-L288 I'm trying (extend org.httpkit.server.AsyncChannel json/JSONWriter (-write [ch out] (json/-write (str ch) out))) but I get "unable to resolve symbol -write"
15:22ReefersleepHey everyone. Haven't been on IRC in ages, but I figured it'd be neat to talk to someone about the obstacles I come upon when trying to delve into Clojure in my spare time, and I don't know anyone who does Clojure in my area. So hi!
15:25ReefersleepAnyone here who uses Clojure in their day job? :)
15:37ReefersleepEveryone always mentions the brackets whenever I show them Clojure code. I can see it in their eyes before they even say anything. "My god, it's full of parens"
15:38Faredid I mention that clojure has fewer parens than java? Because Java involves 4 times as many function calls...
15:47oddcullyFare: but 50% if your code i autogenerated from your ide, so at least those don't count ;P
15:48oddcullys/if/of/
15:52oddcullyReefersleep: yes, in this channel are regulars, that (claim to) have jobs doing clojure or doing it anyway (programming anarchy)
15:56whodidthisclojure replaces parens, brackets, semicolons and colons with beautiful rainbows
16:15sidharth1how can i get ring to not add a charset to the content-type in the html headers ?
16:19hiredmanring doesn't do that
16:20hiredmanjetty does, and different servers may do it differently
16:21hiredmanapparently it is part of the servlet spec, so any server you use via a ring-servlet adapter is going to have that
16:22hiredmanif you add your own charset then that will be used
16:37michaelr`hi
16:43michaelr`Anyone interested in a remote Clojure/ClojureScript job?
16:55justin_smithmichaelr`: I'd ask again during work week hours, I bet someone is
16:56michaelr`ah, it's weekend ;)
16:56michaelr`justin_smith: thanks
16:58oddcullycan we deduce some work-life-ballance from this? ;P
16:58justin_smith:)
16:58michaelr`justin_smith: sent you my email
16:58michaelr`oddcully: i bet justin is now doing the life part of the balance
16:59dfletcherhi I wrote this neat little chunk to launch my javafx based app http://pastebin.com/b27RHWJX . it requires doing a gen-class because javafx's launch() function takes a class arg and does the construction. anyone know a nice way to pass a configuration argument to myapp-desktop-start ?
17:01dfletcherI could rebind a def of course but every tut says it's bad form :)
17:04dfletcherspeaking of not knowing what alternatives there are to rebinding defs, a second question I have is how would one go about doing user modifiable preferences in a UI app? don't want to pass around prefs everywhere and have references to possbily outdated ones in a closure or callback or so. help me OB1 Kenobe I'm so confused :>
17:07oddcullymichaelr`: you accept more work-part offloading?
17:08justin_smithdfletcher: for a lib, use explicit args, for a frontend, use a global mutable state, preferably in edn so it is easy to read, manipulate, store, restore etc. from clojure
17:12dfletcherthanks for giving me some keywords to search for justin_smith
17:13justin_smithputting all user-controlled app config in a single map in an atom is a pretty natural choice
17:13dfletcherI was thinking along similar lines but was contemplating just a Java map. this seems much better.
17:14justin_smithadvantage over java map is you get very good concurrency control, and clojure can output it to a human readable /a editable form very similar to json
17:14justin_smithhell, we even have good two-way json conversion :)
17:14dfletchernice that's what I was thinking of using to store it heh
17:17dfletcherplus i'm sure the syntax will be nicer in clojure this way with keyword lookups and destructuring instead of .get
17:17dfletcherok so this leaves this little jerk :) http://pastebin.com/b27RHWJX
17:17dfletcherjavafx wants to construct my class, don't see a way around it
17:18dfletcherguess I could put the window state into the prefs and query it from inside there but that seems weird. UI saved state is separate from prefs.
17:19justin_smithyeah, it should be
17:25dfletcherah wait I have an idea. what I actually really need inside there is mostly just the location of the user's data dir. if I made that a preference I could read *that* off global prefs and then just do all read/write ops inside my application class. that seems decent.
17:26justin_smithyeah, much cleaner
17:26justin_smithand data dir could come in via arg, or env, or a default, or a global config dir, or whatever
17:26justin_smithsystem property...
17:26dfletcheryeah when I first init the prefs
17:26dfletcheror user could override it in the UI even :)
17:27justin_smithand persist that to a config - but how do you find it next time!
17:27justin_smithPARADOX
17:29dfletcherheh right good point. command line config then, or user.home
17:50bobpoekertcore.match has “wildcard” (match one occurrence of anything) but not kleene star (match any number of things), right?
17:50bobpoekerthas anyone tried to add kleene star?
17:50bobpoekertI’m thinking of using core.match as an xpath replacement and being able to do the equivalent of // is important
17:55tomjack(no, but curious:) suppose you write a ([x y] :*) pattern and match against [[1 2] [3 4]]. what would x and y be bound to, [1 3] and [2 4]?
17:57bobpoekertI wasn’t thinking of having the star be capturing, so it would just be [1 2]
17:58bobpoekertif it were capturing maybe it would return a seq of the body evaluated for each capture?
18:00bobpoekertI was thinking more: {:children [:* {:tag “div” :class #”price” :value price}]}
18:00bobpoekertwhich would be equivalent to //div[@class~=price]/value() in xpath
20:35crocketCan anybody recommend a good clojure learning material for a layman?
20:35crocketI actually am a programmer, and I want to learn clojure.
20:44blkcatcrocket: perhaps clojure for the brave and true?
20:45crocketblkcat, Where is it?
20:45blkcathttp://www.braveclojure.com/
20:49crocketblkcat, Isn't it a work in progress?
20:53blkcatcrocket: my understanding is that it's largely completed, though it may receive some updates once he's done working on the print version
20:57crocketblkcat, like fixing typos?
21:01blkcatpresumably
21:01blkcatyou'd have to ask him :) but i think you'd be perfectly safe using it as a learning tool.
22:52dpathakjojure