#clojure logs

2013-12-24

01:50sm0keOK this is weird, are comments not allowed inside body of a function?
01:51ddellacostasm0ke: that is most definitely not the case.
01:53sm0keddellacosta: right i found a bug in my ide
01:53ddellacostasm0ke: :-)
01:53pcnddellacosta: I fixed my performance problem from last night by replacing my socket code with aleph.
01:54ddellacostaoh, I think you were talking to someone else about that--I only remember the file linking weirdness
01:54ddellacostapcn: nonetheless, happy to hear it. :-)
01:59pcnddellacosta: I finished asking how to do performance troubleshooting. I figured I did something wrong, so I figured I'd try a competant library instead.
01:59ddellacostapcn: gotcha...what were you using for socket stuff anyways? Default Java libs?
02:04pcnI was using a slightly changed version of technomancy/server-socket.
02:04pcnI wanted it to pass back client info, so I did some copypasta, and probably broke it.
02:05ddellacostagotcha.
02:11jonasenI'm thinking of finally switching to cider. It says in the readme that I should remove the old nrepl.el package. Is it enough to simply remove ~/.emacs.d/elpa/nrepl-0.1.8/ and remove all references to nrepl in init.el?
02:32pcnIs there an atoi function for clojure? I have crud coming from the network, so I'd like to avoid read-string
02:33TEttingeryes, there are a few
02:33TEttingeratoi converts a string like "11" to 11, right?
02:33TEttinger,(Integer/parseInt "11")
02:33clojurebot11
02:34TEttinger,(read-string "11")
02:34clojurebot11
02:34TEttingeroh you said read-string
02:34TEttingerthe java parseInt or parseLong is your best bet then
02:35TEttinger,(Integer/parseInt "whee 11")
02:35clojurebot#<NumberFormatException java.lang.NumberFormatException: For input string: "whee 11">
02:35pcnThanks
02:36logic_progwhat is the most idiomatic way in pure clojure (no java involved) for implementing matrix operations
02:37nones,(Integer. (re-find #"\d+" "whee 11"))
02:37clojurebot11
02:39sm0kewhen i do a `lein test` my :dependencies are not in the classpath
02:39sm0kehow do i fix this?
02:39noneslogic_prog: you can use https://github.com/clojure-numerics/core.matrix
02:44dsrx,(read-string "\"foo\"")
02:44clojurebot"foo"
02:44dsrx,(doc read-string)
02:44clojurebot"([s]); Reads one object from the string s. Note that read-string can execute code (controlled by *read-eval*), and as such should be used only with trusted sources. For data structure interop use clojure.edn/read-string"
02:51TEttingerhere the read-string is probably sandboxed with read-eval, I'd be surprised if clojurebot didn't, and I know lazybot does
02:52nones,*read-eval*
02:52clojurebotfalse
02:53TEttingeryep
03:07akurilinHas anybody here found a solid end-to-end logging solution yet by any chance?
03:08akurilinSomething that can aggregate error logs throughout the entire stack
03:08akurilinTotally a new startup idea somewhere in there :P
03:14bitemyappakurilin: could you provide an example of what parts of your stack would have their logs get aggregated?
03:14bitemyappakurilin: generally speaking, by the time a company needs something like that - they have the resources to slap together log centralization themselves.
03:16sm0keakurilin: why isnt log4j good enought?
03:17sm0keif you want fancy logging solutions, there is splunk
03:17bitemyappsm0ke: he might mean pulling everything, including db logs and the like. I'm not sure how much that sort of thing matters for most people.
03:17sm0kebut its paid
03:17bitemyappsm0ke: there are better, free-r options than Splunk. Come now.
03:17bitemyapphttp://logstash.net/ and Kibana come to mind.
03:17sm0kebitemyapp: like?
03:17sm0keKibana is just a UI
03:18sm0keit can sit on top of splunk
03:18bitemyappick.
03:18bitemyappSplunk is terrible.
03:18bitemyappJust use elasticsearch if you're going to bother.
03:18sm0kebitemyapp: exactly my point
03:18bitemyappsm0ke: ...that's what logstash is.
03:18sm0keyou can have a log4j appender to elasticsearch and you are done
03:18bitemyappbut most people don't know how to query ES, therefore...Kibana.
03:19bitemyapptimbre appender, more like.
03:19bitemyappfuck log4j.
03:19sm0kenah
03:19bitemyappXML configuration garbage.
03:19sm0ketimbre sucks too
03:19bitemyapptimbre sucks less than log4j.
03:19sm0kewell i prefer simple properties file
03:19sm0kelogging is not rocket science afterall
03:21sm0kemy setup is tools.logging + log4j appenders.
03:26akurilinI was thinking something that'd allow me to get what's essentially an error trace for a user across the stack
03:26akurilinso a user made a call to the backend
03:26akurilinthere was error there
03:26akurilinthe error is logged
03:26akurilinthe client errors out
03:26akurilinthe client's error is logged
03:27akurilineventually I'd have non-error-only logs too so I can see what the activity was that led to the error
03:27akurilinbitemyapp: the second statement sounds reasonable
03:27akurilinI'm suspecting that you can get away without it for a very long time.
03:28akurilinAt the very least you want something that will tell you that somewhere in the stack there are people experiencing errors, so perhaps aggregating them into one place is one way of addressing both clients and servers at once.
03:28akuriliniOS has Crashlytics
03:28akurilinBackends have PaperTrail
03:28akurilinJS has JSLogger/Errorception
03:31sm0keakurilin: there is two ways to think about this with same end results
03:32sm0keakurilin: either you aggregate logs from many machines to one place
03:32sm0keakurilin: or you log locally to a place which is already aggregated
03:33akurilinsm0ke: I don't see how the latter would be applicable to a javascript situation, but I'm also pretty uncreative at times :)
03:34akurilinsm0ke: js in a browser, to be precise.
03:34akurilinNot node.
03:35sm0keakurilin: doesnt matters where it is, just have 10 es clusters running with browsers sending write request to any of them
03:35sm0kei mean 10 node cluster
03:36akurilinNot sure I'm following.
03:37sm0kealthough it not common to have logging for browsers
03:37sm0keakurilin: what are you logging in the browser?
03:38akurilinWell, I have a pretty large MVC app and I need to know when it craps out for some reason.
03:38akurilinIt's a clone of our iOS app, which for a year has been using Crashlytics pretty successfully to track client errors.
03:39akurilinCrashlytics is pretty nice. It gives you the stack trace, when / how often it occurred, some stats etc, gives you warning. Easy to spot when there's a sudden surge in errors.
03:39sm0keakurilin: i see, ok well i dont know how craslytics works, but ultimatley it would be sending cash reports to servers right?
03:39sm0kecrash*
03:39akurilinYes it does.
03:41sm0kewell, why cant you? ulness you do not want to take pain of provisioning servers for handling crash reports too
03:41sm0kewhat is you application?
03:41sm0keis it pure client side, with no server interaction?
03:41akurilinsm0ke: nothing preventing me from writing this myself, but I was looking for something off the shelf / SaaSsy
03:42sm0keakurilin: ah i see
03:42sm0keakurilin: well on crashlytics homepage i see it supports android too
03:42akurilinCarving out time for infrasturcture work is always rough.
03:43sm0keah ok
03:43sm0keyou have a generic brwoser app
03:45akurilinI beg to differ, it's very special to me! ;)
03:46sm0keheh i meant cross platform webapp
03:46sm0kewell i think splunk would be one
03:47bitemyappSplunk is terrible.
03:48akurilinOh yeah, I always wondered what splunk was, heard the company was very successful very fast.
03:48sm0keno its not terrible if its the leading player in log analysis
03:49sm0keit may be terrible like oracle is terrible in db space
03:49bitemyappI've used Splunk. It's terrible.
03:49sm0kebut you get the work done right?
03:49bitemyappIt's popular because it's accessible, not because it's good.
03:49bitemyappEngineers should know better and just use something like ES + logstash.
03:49bitemyappand then use a nice dashboard like Kibana, if they need such.
03:49akurilin"accessible" as in easy to install?
03:49sm0kebitemyapp: well his point is also valid there is some operational cost to it
03:49hyPiRionakurilin: as in "easy", not "simple".
03:50akurilinhyPiRion: got it.
03:50bitemyappsm0ke: derrr herrr derrr
03:50akurilinbitemyapp: lol.
03:50bitemyappsky is blue, news at 11
03:51akurilinIt seems like ES is the household name for a lot of problem solving these days, really need to spend some time on that.
03:51sm0kewell if you have a webapp , obsviously you are interacting with a server, how much does it take you to add one more rest endpoint for error reporting?
03:52bitemyappНет терпения для дураков. ((((((
03:52bitemyappкак будто я глупый.
03:52sm0keрптглудтет упыйра
03:52akurilinbitemyapp: ;)
03:52bitemyappмусора
03:53akurilinIt's sad that you're probably better at typing cyrillic than I am
03:53bitemyappakurilin: certain things make me grumpy. I'm cheating - phonetic keyboard.
03:53bitemyappI don't use the native RU keyboard.
03:54bitemyappI am not pro rusnetnik.
03:54akurilinbitemyapp: were you hiding your fluency in Russian from me this entire time?
03:54bitemyappakurilin: I'm envious of the russians in the bay area. They have quite the community here. I know very little Russian.
03:55akurilinThat's true, I've run into quite a few so far.
03:55bitemyappI watch old Russian movies and read children's books from time to time. I can barely understand it, let alone say anything.
03:55akurilinNot a single Italian though :(
03:55bitemyappakurilin: I work with a young woman who has Italian parents. One is Milanese.
03:56bitemyappI guessed she had a milanese parent correctly :)
03:56bitemyappI could tell by her appearance, haha.
03:56akurilinbitemyapp: that's still pretty impressive.
03:56bitemyappakurilin: she speaks Italian just fine, so far as I know - but I'm not one to judge.
03:56akurilinbitemyapp: oh yeah, how so?
03:57bitemyappakurilin: very fair skinned, angular facial features. If both her parents were italian as she said, definitely milanese or somewhere nearby.
03:57akurilinbitemyapp: still, you'd think there'd be more of them. I wonder if they don't end up in tech as often.
03:57bitemyappI've been made to understand that the Italian culture, such as it exists in Italy, is very risk averse.
03:58bitemyappthey respect tenure and pensions more than entrepeneurial success.
03:58hyPiRionbitemyapp: I guess that's due to their economy these times
03:58akurilinTo some extent yes. These days those options are shrinking though due to lack of jobs, and they and Spaniards move to the UK/Germany a lot
03:58akurilinapparently not the US though.
03:58bitemyapphyPiRion: I doubt it would change much even if their economy improved.
03:59bitemyapphyPiRion: a poor economy should encourage a wider ranging search for options, not a narrow internal focusedness.
03:59bitemyapphyPiRion: the Irish are reacting in a more healthy way - seeking their careers abroad.
03:59akurilinEither you move or you live with mom until your 40s.
03:59akurilinNot that it matters since Italians seem to all live past 100 these days :P
04:00sm0kehmm is living with your mom till 40 so dreadful?
04:00bitemyappI'm not sure how you manage sexual or romantic relationships when you live with your parents.
04:00sm0keungrateful bastards are some of us!
04:00akurilinStuck is a small apartment somewhere not being able to start your own family?
04:00bitemyappIt's a disgrace to live with one's parents past college-age where I'm from. I was out of the house at 17 - proudly.
04:01akurilinI don't judge, I'm just saying it makes it hard for some to reach some goals in life.
04:01sm0kebitemyapp: derrr herrr derrr
04:01akurilinbitemyapp: and yeah this is hugely cultural
04:01bitemyappI don't either, just describing the norms of my culture.
04:01hyPiRionbitemyapp: hm, it's opposite here. After the war, people was very risk averse due to the economy. Consequently, the new working generation is more entrepreneurial while the old ones claims we should be happy with a steady income and secure job
04:01bitemyapphyPiRion: I'm less risk averse than my parents and I am dealing with a rougher economy in my young adulthood.
04:02bitemyappI expect to retire because of my side business efforts, not at the age of 65 after a long time spent being salaried.
04:02akurilinI think people with skillsets like yours simply don't have to worry much about holding onto that one job for the rest of their lives.
04:02bitemyappthat's a part of it, but I don't assume programmers are impervious.
04:03hyPiRionThere's always money in the banana stand.
04:03bitemyappBut a lot of the reason I made it is because of my appetite for risk. I could've easily gotten into a rut.
04:03akurilin*shhh*
04:03bitemyappif I hadn't moved to NYC I might've been stuck for a long time.
04:04akurilinI'm curious how aversion to boredom compares to appetite for risk.
04:04bitemyappakurilin: I have both. I'm simply an unsettled creature.
04:04bitemyappakurilin: a study recently released showed that the best employees in a company were also the least satisfied.
04:04bitemyappstrivers are by definition, not content.
04:04akurilinand consequently the most likely to peace out, right?
04:05bitemyappakurilin: hum. it made no comments there. I think the practical take-away is, "keep your best people empowered and stimulated"
04:05akurilinWell those two aren't exclusive. The strivers are always ready to bail, so you have to work extra hard to keep them stimulated.
04:06bitemyappI don't know if I'd use the qualifier "always"
04:06akurilinFair enough.
04:06bitemyappI'd put it more in terms that the best people have the most options.
04:06bitemyappyou really don't want to create a company where only people who have no options stick around.
04:06bitemyappbut that's the default mode, so it's something you have to work actively against.
04:07akurilinThat'd be a pretty bad situation to be in .
04:08bitemyappakurilin: that's how it goes for most companies. They get 1-4 years apiece of the good people, the mediocre or bad people become lifers.
04:09bitemyappGoogle's incredibly poor management is in essence subsidized by the quality labor they've locked up.
04:09bitemyappbut even at Google, that's a minority of the workforce.
04:09akurilinIt's got to be hard to hire for these teams if you want to try to lift the average.
04:09bitemyappwell part of the problem might be that they hire directly for teams.
04:09bitemyappLack of internal mobility and self-direction of labor is a good way to make talent leave.
04:10bitemyappakurilin: that's the problem my company solved, remember?
04:10akurilinbitemyapp: yes indeed.
04:11akurilinIs it actually solved? Is there data to support that this is sustainable over the long run?
04:11bitemyapp100 people so far, working fine.
04:11bitemyappValve seems to be rather successful as well.
04:11akurilinValve is what, 400?
04:12bitemyappValve is even more aggressive version of what we do and they're even bigger.
04:12bitemyappso I'd tend to believe you can get away with it at any scale a startup would care about.
04:12bitemyappThe problems of success can be dealt with when they arise.
04:12clojurebotI don't understand.
04:12bitemyapp~success is a problem you can deal with when you have it.
04:12clojurebotc'est bon!
04:12bitemyappGood bot.
04:13akurilinHeh that's fair, I'm all about deferring issues until much later.
04:13akurilinAs in, the ones that are completely irrelevant.
04:15bitemyappstartups are often bad at determining what really matters at a given point in time.
04:15akurilinVery much so.
04:16akurilinSeems like laziness is the way to go for the type of work startups do, as opposed to long-term planning.
04:16akurilinEven though, again, you never know if you're hitting local maxima all the time.
04:17bitemyappnot "laziness", just be strategic about where effort is allocated.
04:17bitemyappEvery single imaginable resource is limited when you're a startup. You have to prioritize aggressively and intelligently.
04:17bitemyappand constantly rebalance.
04:18akurilinFor sure.
04:27akurilinbitemyapp: thanks for the link to logstash, I'll have to check it out, seems interesting
04:27akurilinMore tools need mascots, seriously.
04:28bitemyappakurilin: I agree!
04:28bitemyappakurilin: logstash + kibana is a nice shake-n-bake setup.
05:21degI'm trying the leiningen 2.3.4 and ":pedantic? :abort", but not sure what it's trying to tell me: "Possibly confusing dependencies found: [lein-marginalia "0.7.1"] overrides [lein-marginalia "0.7.1"]", followed by a NPE.
05:55peterdon,(list "hello bot")
05:55clojurebot("hello bot")
06:03dsrx,'("hello bot")
06:03clojurebot("hello bot")
06:05hyPiRiondeg: could you post that as an issue to the leiningen issue list?
06:05hyPiRionsounds like a bug
06:07deghyPiRion. Ok. But, first I'm still trying to pin down exactly what's wrong. I've got a bunch of interlinked projects and everything seems to have broken. And, it's been a few weeks since I last touched this. So, in short, not really clear what's going wrong and which parts are my fault.
06:08degWhen I touch almost anything I get an obscure error compiling my ns forms: "Exception in thread "main" java.lang.ExceptionInInitializerError" with an irrelevant stack trace.
06:09hyPiRiondeg: first off, perform a `lein clean` and delete your ~/.m2 directory
06:09hyPiRionthat could resolve issues
06:09degI've already tried the lein clean. Have not tried flushing ~/.m2; will do so now. What typically goes wrong there?
06:10hyPiRiondeg: Invalid cache entries. If you have some jar which is broken, that could break stuff hard.
06:11hyPiRionI guess that's not the issue here, but better to be safe than sorry
06:11degok. Deleted .m2 and watching everything reload now.
06:14degNope, same problem.
06:15hyPiRionahh, dangit
06:16hyPiRionif you could try to make a minimal reproduction case and post it to the issue list, that would be aweseom
06:16degns seems to lose if it includes any dependency outside the project itself.
06:17degI need to untangle some of my spaghetti, before I'm comfortable posting a bug. Right now, the odds are still that it is some typo on my part. I can't yet blame any of the tools for anything worse than poor error messages.
06:17degI'll report back when/if I have anything useful. Meanwhile, my wife is calling me for lunch. :-)
06:24allenj12hey i was going throught the joy of clojure book doing the excersices and was wondering what the "f" in this code was doing. i commented the line i was confused https://www.refheap.com/22186
06:27nonesallenj12: there are stay apostrophe, it mean, that forms in vector not evaluated. So, f is symbol
06:28nones,(into '[f] [])
06:28clojurebot[f]
06:28nones(type (first (into '[f] [])))
06:28nones,(type (first (into '[f] [])))
06:28clojurebotclojure.lang.Symbol
06:31allenj12hmm ok i get that, i guess im just confused why you would want a symbol f
06:50nonesIs there ways to expand vector to function args (apply not suitable, it doesnt work in macros)
07:00sm0kewhat is default size for 1 in clojure
07:00sm0kei mean like ##(sizeof 1) ; in bytes
07:00lazybotjava.lang.RuntimeException: Unable to resolve symbol: sizeof in this context
07:01nones,(type 1)
07:01clojurebotjava.lang.Long
07:01sm0kethanks
07:01sm0kehmm well
07:01sm0kewhat if dont know the size of Long
07:02sm0keif i*
07:02noneshttp://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
07:02noneslong is 64-bit
07:04sm0kenones: isnt that what unqote splice is for
07:04sm0kenones: ~@
07:06logic_progdoes clojure run on dalvik (the android jvm) ?
07:06logic_progif so, is dalvik much lightweight compared to oracle jvm?
07:07sm0kelogic_prog: yes clojure runs on android jvm
07:11dotemacsi think theres even a chat room just for clojure on android here on freenode
07:11silasdavisI've got a handler module set up with a lein ring init and handler function
07:12silasdavisbut also with gen-class and -main for a http-kit server
07:12silasdaviswhen I 'lein uberjar' I get a jar that runs the -main class and therefore http-kit
07:12silasdaviswhen I 'lein ring server' I run the ring version
07:13silasdavisI was hoping 'lein ring uberjar' would give me a jetty adapter with ring
07:13silasdavisbut it seems to run the same code path as 'lein uberjar'
07:13silasdavisis that to be expected?
07:18sm0kesilasdavis: does it makes sense to have seperate profile with :main definition for httpkit?
07:20silasdavissm0ke, yeah perhaps so
07:20silasdavisperhaps the uberjar profile (where I have my main and aot options defined) gets applied after lein-ring sets up it's own main....
07:21silasdavisI probably shouldn't have http-kit stuff in same module really, since it's not a handler
07:24corecodehi
07:24corecodewhere can i read about how to implement IFn/AFn for an object?
07:26logic_progis there any project on faking erlang with core.async ?
07:27sm0kelogic_prog: lol
07:27logic_progsm0ke?
07:27logic_progcore.async threads should be as cheap as erlang threads right?
07:27sm0kethey are
07:28logic_progso why hasn't someone smarter than me done it? :-)
07:28sm0kewht do you want to imitate from erlang/
07:28logic_proglots of little threads
07:28logic_progand error handling
07:29logic_proglike when a thread goes into an error, instead of fixing it, it just dies and tells another thread what happened
07:30sm0kehmm ok
07:30sm0keyuck
07:31corecodeis there a way to collect & rest function arguments as map?
07:49deghyPiRion: I've isolated the :pedantic error in a working project of mine, and reported it as a leiningen issue. It was actually a duplicate of https://github.com/technomancy/leiningen/issues/1376, so I just added a comment there. (Now, on to the issues breaking the compile of my other projects).
07:54hyPiRiondeg: ah, awesome. Thanks
08:12cYmenWhy is it that when I "use" a namespace I don't get the dependencies?
08:12cYmenSo basically if I use a module and then try to run a function therein line by line it doesn't work.
08:21deadghostcYmen, what?
08:22deadghostjust in case there's confusion "use" doesn't download the dependency for you
08:23deadghostis there a main clojure book to learn from?
08:24deadghostI've been piggybacking off what I know from CL
08:24hyPiRioncYmen: Consider (use 'clojure.core.logic), which version of clojure.core.logic should it download, and from where?
08:24hyPiRiondeadghost: http://www.clojurebook.com/
08:25deadghostfirst line is a hoot
08:25deadghost"We've worked with Clojure for many years now"
08:25deadghostthat's like saying we've been here since the beginning
08:26cYmenI don't want it do download deps, I want it to recursively use stuff.
08:27cYmenWhen I load a module in the repl I want the code as written in that module to work in the repl.
08:28deadghostoh I see
08:28cYmenManual debugging, run it line by line...
08:28deadghostyou want the dependencies of that namespace
08:29deadghostif that's what you're asking idk and I would like to know
08:37cYmenlooks like switching to the namespace using (ns ..) does what I wanted
08:42deadghostoh geez
08:42deadghostlooking at clojurebook's table of contents
08:42deadghostit looks very thorough and get shit done oriented
08:45cYmenclojurebook?
08:45clojurebotclojurebook is http://clojurebook.com
08:46cYmenAh, don't have that yet.
08:46deadghostif it was my intro to lisp
08:46deadghostI think I'd cry
08:46cYmenClojure the language is pretty pleasant, the tools I still don't really like.
08:47deadghostI've enjoyed tooling so far
08:47deadghosttook me a while to figure out CL's asdf and quicklisp
08:47cYmenAnd quicklisp already made everything so
08:47cYmenmuch easier.
08:48deadghostexperience with lein has been superior
08:48cYmenNow I am getting a nullpointer exception in some third party library, I can't call it from the repl because something in that function requires ring state or whatever...it drives me crazy
08:49deadghostI need to brush up on my lisp though
08:49deadghostsince I never understood macros enough to practically use them
08:49deadghostand right now I have something that only a macro can do
08:50cYmenMacros are hard to read and write but simple conceptually...it's just code generation
08:52deadghostbut otherwise, getting into clojure has been surprisingly easy
08:52cYmenI thought the same but then I wanted to do something specific and since then I feel like I am drowning in frameworks and dsls.
08:53deadghostthe first thing I wrote was a scraper
08:53deadghostnow I'm writing a site for it using compojure + enlive
08:54deadghostkorma was kind of ehhh but I don't think I like ORMs in general
08:55deadghostcYmen, what are you working on
08:55cYmenI'm just trying to make a simple webapp.
08:55deadghostwhat are you using?
08:55cYmenRight now trying to figure out how to get something from a database.
08:56cYmenCurrently I'm not even working on it I just bought web development with clojure and I'm trying to work through the examples.
08:56cYmenAnd apparently sql/with-query-results is not in the current jdbc anymore...
08:56deadghostcYmen, what does it suggest using for db stuff?
08:57deadghostnot sure if I want to use jdbc or korma
08:57deadghostright now I'm kind of just throwing my arms in the air and using raw queries in korma
08:58cYmenTotally valid....
08:58cYmenI think that is something I miss about clojure. An easy but wrong way to do things until you want to do them right.
08:59Uatec__cYmen, the thing is, people do it the easy but wrong way, and then leave it
08:59Uatec__5 years down the line, the code is being reviewed and it's just totally uterlly awfully wrong
08:59deadghostI'm finding it very hard to shove out working spaghetti code in clojure
08:59cYmenUatec__: With clojure it's more like "people try to do it the easy way then leave clojure"? :)
08:59deadghostI still end up having to write very small functions
08:59Uatec__good
08:59deadghostand mapping over/composing
08:59cYmenhehe
09:00Uatec__let me get this... you WANT to write spaghetti code?
09:01Uatec__cYmen, that's a valid concern, but if you give people a half way house, people will inhabit that and never do things properly
09:01Uatec__you should give people all or nothing options... but make the All option useful enough to them
09:02cYmenYou're never going to change people. If you give them all or nothing they will just go find somebody who gives them whatever they want. :)
09:03cYmenBut that's philosophy, let's stick to programming. Nobody forces me to use clojure after all and if I didn't like it I wouldn.
09:03deadghosthmm well if I'm the only one working on something
09:03deadghostand it's a personal project
09:03deadghostsometimes I just want to shove out something working
09:03deadghostand fix it later
09:03deadghostand that does not seem to fly in clojure
09:04cYmendeadghost: I'm glad I already knew functional programming.
09:04deadghostI'm amazed how little I miss iteration
09:05deadghost400 lines of code and I didn't even consider it
09:07cYmenWell, it's not like there is no iteration, it's just slightly different. :)
09:37grandy_hello just typed one of the examples from clojuredocs into my repl and the output is not what the doc appears to say it will be... (def foo (map println [1 2 3]))
09:37grandy_(foo) raises an exception
09:37grandy_would anyone mind explaining this to me
09:39grandy_is this b/c i'm using the repl? still not sure why it would raise "lazyseq can't be cast to clojure.lang.IFn")
09:40cYmengrandy_: (map println [1 2 3]) is immediately evaluated
09:41cYmenso what you want is not (foo) which would call a function but instead foo which will display the value of that thingy
09:41grandy_cYmen: ahhhh
09:41grandy_cYmen: ok, makes sense
09:41cYmengrandy_: Maybe you wanted defn instead of def?
09:42cYmenIn that case you will also need an empty parameter list
09:42grandy_cYmen: i was just following the example in this: http://clojuredocs.org/clojure_core/clojure.core/doall
09:42cYmen(defn foo [] (map println [1 2 3]))
09:42cYmennow (foo) should work
09:43grandy_cYmen: i appear to have misunderstood the point of the example... thanks for making it click
09:43cYmengrandy_: Well, they never call (foo) in that example. ;)
09:43grandy_cYmen: yeah... doh
09:43cYmenThe point of the example is that when you map println over a list nothing actually happens
09:43cYmenonly when you try to access the result or in this case use "doall" will it actually run and print something
09:43deadghostmap's lazy eval caught me a while back
09:44grandy_i'm doing some very basic stuff w/ csv files and taking the opportunity to use clojure but obviously haven't done much w/ clojure yet so i'm still a bit clueless
09:45cYmengrandy_: Well, lazy evaluation with side effects is a bit tricky. They don't play well together.
09:46deadghostin my case I ended up wrapping maps with side effects in dorun
09:46grandy_cYmen: ahh
09:46cYmenIf you (def foo (map println [1 2 3])) nothing will be printed. If you try to print foo now using "foo" it will actually call the println AND show the result. In my case that gives a garbage output mixing both.
09:46hyPiRiondeadghost: another option may be to use `doseq`.
09:47cYmengrandy_: https://www.refheap.com/ea456899f5afced5b10a7ae7e
09:48grandy_cYmen: same output here
09:48cYmenThe first ( is from the contents of foo (which is a list of three nils) then 1 2 3 is the result of the println calls and then comes the rest of that list of nils which should actually be (nil nil nil)
09:49cYmengrandy_: Do you know the principle of lazy evaluation?
09:49grandy_cYmen: i think so
09:49cYmenkk
09:51grandy_cYmen: i think my understanding isn't all that real yet, bc i don't fully understand why foo returns that
09:51cYmenfoo doesn't return anything foo is just a variable :)
09:51cYmen(def foo 3) <- variable!
09:52cYmen(def foo (....)) <- still a variable! :)
09:52cYmen(defn foo [] (...)) <- now it's a function
09:52grandy_cYmen: ahh right...
09:52grandy_cYmen: why does foo print [1,2,3] at all?
09:52hyPiRionfoo is a variable regardless
09:53cYmenhyPiRion: Well, it is a variable storing a function but let's keep it simple. :)
09:54cYmengrandy_: Well, lazy evaluation in the most simple words means "When you call a function, I don't actually run it (because I'm lazy) I only run it when you try to access the return value of that function.
09:55deadghostgrandy_, try this
09:55deadghostdo def foo
09:55deadghostand foo
09:55deadghostthen foo again
09:56cYmengrandy_: So when you (def foo (map println [1 2 3])) you get a magic thingy back (usually called a thunk) which is sort of a promise that you can actually get it if you want to
09:56grandy_ahhh
09:56cYmenNow if you type "foo" in the repl and the result needs to be printed you're cashing in that promise and the code has to execute now...
09:57deadghostcYmen, where did you learn lazy eval from?
09:57grandy_cYmen: ahh ok makes sense
09:58cYmendeadghost: haskell in my first cs course at the university...
09:58deadghostI was thinking of picking up some haskell when I encountered laziness
09:58deadghostbut now it seems unnecessary
09:58grandy_thanks guys for the help
09:58deadghostuhhh
09:58cYmenyou're welcome :)
09:59deadghostis haskell actually a good choice for a first cs course?
09:59wei__is there a more succinct way of saying (map #(vector %1 %2) [:a :b :c] [1 2 3]) ?
10:00wei__,(map #(vector %1 %2) [:a :b :c] [1 2 3])
10:00clojurebot([:a 1] [:b 2] [:c 3])
10:00hyPiRion(map vector ...)
10:00cYmendeadghost: It wasn't particularly hard and it didn't give any advantages because almost nobody knows haskell. It also introduces all kinds of things that are useful to know and shape your thinking so I'm going to go with: yes. :)
10:00deadghost,(map vector [:a :b :c] [1 2 3])
10:00clojurebot([:a 1] [:b 2] [:c 3])
10:01wei__cool. i was thinking of something like zip, or interleave? but with a result as a vector instead of a map
10:01deadghostcYmen, well that's surprisingly
10:02deadghostthen again SICP looks overly difficult for a first book to me
10:02cYmenI don't know it may be a personal thing. :)
10:03cYmenI think functional programming is a lot simpler conceptually and easier to explain than normal computing. It's just the knowledge about other programming languages that confuses some people.
10:04cYmenWhen I first tried to explain python to my girlfriend she stared at a=3 a=5 and asked me "how can a be two different things?" she only knew variables from maths classes where things don't usually change value
10:04cYmentada functional programming :)
10:05lllambdahi, i have a map of maps over which i would like to pass a function (returning a new map of maps), e.g. {:foo {:bar 1 :baz 4 :qux 2}}. in this case i actually want to do two things: sum the ints and then divide the ints by that total, assigning the result as the new value of those submaps
10:05bracketscYmen: haha
10:05lllambdai have a nested reduce solution that's pretty nasty, but seems to work. is there a more idiomatic way?
10:06noneslllambda: can you give input and output example?
10:07deadghostnot sure where I'd be if my intro to programming was functional
10:07deadghostI pretty much just fumbled around until things made sense
10:07deadghostphp -> c -> lisp basically
10:07deadghostI think the k&r really helped
10:08bracketsThe Elements of Computing thrown in for good measure helps.
10:08deadghostI have never heard of that book before
10:08lllambdanones: say we use that map of maps, the output would be something like: {:foo {:bar 1/7 :baz 4/7 :qux 2/7}}
10:08deadghostis that babby's first prog book?
10:09deadghostbecause there's a babby on the cover
10:09lllambdaassume there's more top-level keys besides :foo too
10:09deadghost>building a modern computer
10:09bracketswell if by baby you mean go from chip to cpu to asm compiler to stack math to language design :)
10:09deadghost"the best way to understand how computers work is to build one from scratch"
10:10deadghostoh geez what is this
10:10bracketsits a survey of how it all works close to the metal
10:10hyPiRionlllambda: https://www.refheap.com/22189
10:10deadghostI'll put it on my reading lisp but low level stuff has never appealed to me
10:11deadghost*list
10:11lllambdahyPiRion: that doesn't seem to be loading for me
10:11bracketsits quite short. 200 pages maybe? and you won't be disappointed.
10:12deadghostsee
10:12deadghostk&r was also "quite short"
10:12cYmenbrackets: oh thats nand2tetris...
10:12hyPiRionlllambda: arg, sec
10:12deadghostnow I don't associate number of pages with shortness
10:13lllambdahyPiRion: oop, it just loaded up. guess i wasn't patient enough :)
10:13lllambdahyPiRion: this looks cleaner, thank you!
10:13bracketsdeadghost: its well written, readable, and interesting.. nothing like K & R :)
10:13lllambdai didn't know about map-vals
10:13lllambda(or had forgotten)
10:14corecodewhat is well written?
10:14bracketscorecode: http://www.nand2tetris.org/
10:14lllambdaer i see, you defined it. need some coffee to wake up
10:14hyPiRionlllambda: Yeah, it's not in Clojure core, although it's frequently used
10:14hyPiRionhttps://github.com/flatland/useful/blob/master/src/flatland/useful/map.clj has loads of others
10:17degAre there known issues of project compilations failing because of conflicts between different recursive dependencies on recent version of clojurescript?
10:17lllambdahyPiRion: here's what i was doing previously --> https://gist.github.com/maxcountryman/8ee60dbd251730cd1076
10:18lllambdagreat link, starred. thank you
10:19hyPiRionlllambda: yeah, that works as well. It really boils down to which one you consider more readable
10:19cYmendeg: I think so: https://groups.google.com/d/msg/light-table-discussion/Jy03Ka73-Qk/lSS5uSjJeB0J
10:19lllambdai don't think what i wrote is easily readable, even by me :)
10:22degcYmen: Thanks. I didn't I hit exactly the same issue, but close enough. I can fix it by rolling my project back to a slightly earlier CLJS. Testing now to see if I can, instead, exclude the earlier one from the library deps.
10:23degI WISH clojure could do a better job of error reporting. There was nothing in the error or stack trace to suggest that this was the problem; I had to do many minutes of annoying debugging.
10:23silasdavisI am trying to run lein ring uberjar
10:23silasdaviswhen it creates the jar
10:24silasdavisand I try and run it with java -jar *-standalone.jar, it complains that it cannot find myproject.handler.main
10:24silasdavismy ring profile is: :ring {:init redditch.handler/ring-init
10:24silasdavis :handler redditch.handler/app}
10:24silasdavis(redditch is project name)
10:25silasdavisI used to have a main in redditch.handler, but I've since remove this
10:25silasdavisdeleted target and lein clean'd
10:25silasdavis*ring settings I should say not profile
10:29jcromartiesilasdavis: it says "myproject.handler.main"?
10:30jcromartiewhere is "myproject" coming frmo?
10:30silasdavissorry, I should have used redditch from the start
10:32jcromartiedo you have a :main key in your project?
10:33jarodzzhello, guys
10:35silasdavisjcromartie, only in a profile 'httpkit'
10:35silasdavisand that points at redditch.server
10:38jcromartiehm, that's strange
10:39gdevhey jarodzz
10:39jcromartieand it's complaining about a missing redditch.handler.main, not redditch.handler/main
10:39jarodzzhi, gdev
10:39jarodzzi want to generate a java object from a java hashmap
10:39jarodzzwith clojure
10:40jarodzzlike i have a map {"name":"john", “age":18}
10:40jarodzzi want to generate an object with name and age fields, with value john and 18
10:41jarodzzany one got a clue?
10:41silasdavisjcromartie, Error: Could not find or load main class redditch.handler.main
10:42gdevjarodzz, yeah you'd just need to destructure your map when you're calling the constructor of the java object
10:43jarodzzgdev, thanks, man
10:43jarodzzi'll give a try
10:43jarodzznow. catch u later
10:44gdev(let [my-map {:name "john" :age 18}] (Person. (:name my-map) (:age my-map)))
10:45gdevjarodzz, ^ that's not pretty but should get you pointed in the right direction
10:46silasdavisjcromartie, on a different box I get Exception in thread "main" java.lang.NoClassDefFoundError: redditch/handler/main
10:46jarodzzgdev, many thanks man .
10:46jarodzzas long as it works
10:46jarodzz:)
10:46silasdavisI have no main specified anywhere in project.clj
10:48silasdavisthis is really odd
10:49silasdavisremoving all my aot stuff yields
10:49silasdavisWarning: specified :main without including it in :aot.
10:49silasdavisImplicit AOT of :main will be removed in Leiningen 3.0.0.
10:49silasdavisIf you only need AOT for your uberjar, consider adding :aot :all into your
10:49silasdavis:uberjar profile instead.
10:49silasdavisbut I don't think I'm specifying main anywhere
10:49silasdavisis there any file where this could be happening?
10:49silasdavisother than project.clj
10:49ior3kpossibly stupid question: how do you guys endure through papers that, superficially at least, seem extremely boring, like "out of the tar pit"? I feel this tendency of mine for tl;dr is seriously hampering my ability to grow as a programmer
10:50jcromartiesilasdavis: honestly I've avoided lein-ring and just used my own hand-rolled :main for a while now
10:51gdevior3k, everyone learns differently, maybe reading dry papers isn't your learning style
10:52gdevior3k, lucky for you there are some good talks on YouTube that kind of summarize what "out of the tar pit" was getting at
10:53jcromartiesummary: only store inputs, keep everything in sets
10:53jcromartiedone!
10:53ior3kgdev: I find many youtube talks help. But I wonder how far I can go with that
10:55gdevior3k, the only constraints is that you're limited to the papers that have been summarized in a talk that has been posted online
10:56ior3kgdev: I feel that will keep me away from a lot of juicy stuff though
10:58gdevior3k, as far as your specific problem I tend to skim long papers a few times for something that catches my eye and eventually I'll be familiar with it enough to labor over the parts I know contain the meat
10:59ior3kgdev: I'll try that, thanks
11:02gdevior3k, sorry that I'm the only one commenting on this, I'm sure there are better ways, but that's how I defeat my ADHD long enough to grok the classics
11:02ior3kgdev: I appreciate your help :)
11:02ddimagdev: I think thats a good approach
11:03ddimaskimming a couple of times certainly helps getting acquainted with the subject
11:04ddimaior3k: but in the end you'll have to find out what works best for you. for example, sleeping things over can not be underestimated ;)
11:05jcromartiehow can I run a Clojure app forever that doesn't block the main thread?
11:05ior3kddima: true that, I still wish papers were written in the head first style, though :)
11:05gdevior3k, yes hammock driven development also works here as well
11:06jcromartiei.e. how to run Jetty with {:join? false} from my -main
11:10gdevjcromartie, are you looking to do something like (defn -main [port] (run-jetty app {:port port :join? false}))
11:13jcromartiegdev: sure I know how to do that, but I guess what I'm asking is how to join it after creating the server
11:14jcromartieI've got a main namespace that has an atom containing the state of the "moving parts" of the system: the server, DB, etc
11:14jcromartiebut I want to be able to start it in either an interactive REPL or as a -main
11:14jcromartiemaybe I'm wrong?
11:14jcromartieI'm just assuming… hah
11:17jcromartieI guess Jetty marks its thread as a daemon thread
11:17jcromartiewell look at that
11:17jcromartieno need to join
11:18jcromartieJava doesn't exit
11:28gdevjcromartie, when you figure it out, post a link to it if its open source because I'm interested to see what you are trying to do
11:30dotemacsHi, I needed to do some PDF related work, form filling and document concatenation, so I put this together: https://github.com/dotemacs/pdfboxing
11:36jcromartiegdev: I did figure it out :) I was just wrong in my assumption
11:37jcromartieI thought I *had* to join the thread to keep the JVM from exiting. But if you start Jetty from -main with {:join? false} it will not exit, even though the -main function exits
11:37jcromartieI don't know why I was mixed up
11:38justin_smithjcromartie: what I do is start an nrepl from inside the function that generates my ring handler
11:38justin_smithjcromartie: then I get the server running, plus the ability to connect to the repl and fuck around
11:39gdevdotemacs, that looks interesting, always good to see a java library wrapped in parens
11:39dotemacsgdev: thanks :) not sure if those are words of praise or jest :)
11:40gdevdotemacs, words of praise =D
11:40dotemacs;)
11:45jcromartiejustin_smith: I like that idea. I'm using Cider.
11:45jcromartieSo I don't really need to start another NREPL
11:45jcromartienREPL whatever
11:46justin_smithjcromartie: cidre can connect to an external repl
11:46justin_smithand a repl is more useful if it is inside your servewr
11:46justin_smith*server
11:46jcromartieyes it is
11:47jcromartieI'm interested in the prospect, however I feel like the client/sysadmins would hate it
11:47jcromartiethey take security seriously
11:47jcromartieeven if it's exposed over SSH
11:47justin_smithI use the environment to decide whether it launches
11:47justin_smithvery simple
11:47jcromartieyeah
11:47justin_smith(if (not= environment "production) (nrepl/server-start port))
11:48dotemacsstory no.1 on HN right now is 'Why use Clojure?' https://news.ycombinator.com/item?id=6959405
11:49RaynesHo ho ho.
11:50Raynesdotemacs: Only good response to that question is "Because other lisps have too many parens :("
11:50RaynesClearly.
11:50dotemacshaha
11:52jcromartiecongrats dotemacs
11:53jcromartiewe've actually gone pretty whole-hog on Clojure for every new project at work now
11:53jcromartielike, 8 people using it?
11:53jcromartieyeah
11:53dotemacsjcromartie: on what ? :) the pdf library or ...?
11:54jcromartiepdf library?
11:54dotemacsjcromartie: I posted this earlier: https://github.com/dotemacs/pdfboxing
11:54justin_smithjcromartie: did you think that article on hn was by dotemacs ?
11:54gdevwow, there's already a video from the 2013 conj posted on clojure's youtube channel.
11:54technomancybbloom: my five-year-old runs in, "Daddy, I'm so excited today" / "Oh, because of Christmas?" / "No, because I almost finished code.org!"
11:54dotemacsjustin_smith: it looks like he did
11:55dotemacsjcromartie: i just shared the HN link here, thats all :)
11:55deadghostmakes me think of those HN articles
11:55jcromartiedotemacs: shouldn't you compare a plain Java fib method to a Clojure fib fn, rather than a whole Java program to a Clojure fn/
11:55deadghost"How I taught my 5 year old to code."
11:55deadghostand right below it
11:55jcromartieoh yeah what
11:55gdevtechnomancy, that's awesome
11:55jcromartiesorry dotemacs
11:55jcromartieI see
11:55deadghost"Why 5 year olds should be playing and having a life instead of coding"
11:58justin_smithwhoever wrote that fucking "why use clojure" article is a false flag clojure hater trying to scare people away from the language
11:59jcromartieI doubt it. He might just suck at thinking/writing.
11:59justin_smiththe examples aren't even valid code, the project.clj is needlessly complex
11:59justin_smith jcromartie: an idiot that agrees with you is worse than a smart enemy
12:00deadghostyou'd be amazed how crazy/dumb people can be
12:00justin_smithfair enough
12:00justin_smithstill a bad article, regardless
12:01deadghostI saw an article on "jquery doesn't have a for loop... but js does!"
12:01deadghostand people thanking the author in the comments
12:01deadghostfor teaching them jquery is written in js
12:01deadghostand why jquery doesn't have a jquery specific for loop
12:02jcromartieI've heard it way too many times… "I know jQuery, but not JavaScript"
12:03dotemacsjustin_smith: nice quote re: 'idiot...'
12:03justin_smithhey, I know clojure but not java, same diff right?
12:03justin_smithdotemacs: bad paraphrase of the best teacher I ever had
12:04justin_smithat least you can learn something from a smart enemy.
12:05jcromartiejustin_smith: I wouldn't say so… Clojure : Java :: jQuery : JavaScript is not true
12:05justin_smithit was a tenuous reach, clojure is a java library after all
12:05jcromartieok
12:05jcromartieyeah
12:05jcromartiebut jQuery doesn't add new syntax to JavaScript :)
12:05justin_smithI was being glib though
12:05justin_smithyeah
12:06justin_smithand I actually know enough java to know how to use the jvm, I just haven't directly written java is all
12:07jcromartiejQuery is a domain specific language for making an intractable mess
12:08jcromartiethe other day a Puppet Labs guy told me "the Puppet language is a DSL on top of Ruby" at which point I had to say "hold on a sec..."
12:08jcromartieit's not
12:08jcromartieat all
12:11justin_smithEvery program is a DSL. Some of them are even useful for using programattically.
12:13dotemacsjcromartie: sorry, what point are you making regarding puppet ?
12:14justin_smithhe is saying it is not a DSL
12:15dotemacsjustin_smith: i get that part, but i don't understand what he backs it up with, hence the question
12:15dotemacsjustin_smith: i fully agree with you about every program being a DSL
12:16gdevlink in HN post was blocked as a security risk by websense. comments section was TL;DR, doubt I missed anything more than flaming troll bait or trolling flame bait
12:17justin_smiththe latter, or geniune stupidity, one of those
12:18justin_smith"here is some code that isn't even valid, see how good the language is?" "here is a rediculously overcomplex build configuration file, isn't that cool?"
12:18jcromartiedotemacs: no, I'm saying that .pp files are not "a DSL on top of Ruby" which is what the Puppet Labs guy said… it was in-person, we had a bit of back and forth over what that phrase means
12:19jcromartiedotemacs: if Ruby expressions are not valid, it is not "a DSL on top of Ruby"
12:19jcromartiedotemacs: in new versions they *do* allow you to use .rb for modules
12:20jcromartie"DSL on top of X" means a superset of X, i.e. just new functions or syntax added
12:20gdevjustin_smith, oh yeah that does sound like an enlightening PLT discussion
12:20jcromartiewithin the constraints and capabilities of X
12:23dotemacsjcromartie: well, we're nitpicking here but a DSL is a language designed for a specific domain, rather than a 'superset' as you call it
12:24dotemacsjcromartie: im going by wikipedia definition here
12:26justin_smithdotemacs: the operative thing here is the word "on"
12:26justin_smith"on" implies superset
12:26jcromartieyes
12:26jcromartieexamples: Rake
12:26justin_smith"in" impliest subset
12:27dotemacsjustin_smith: right, when you put it like that, then I have to agree
12:48deadghosthmmm ehhhh
12:48deadghostI basically have the same question as this guy: http://stackoverflow.com/questions/11911010/binding-a-local-var-in-deftemplate-for-enlive
12:48bbloomtechnomancy: awesome!
12:48deadghostI'm querying from a db and want it in a local var
12:49deadghostso I can slowly suck out it's delicious data
12:49deadghostmucking with the lib seems kind of crappy
12:50zerokarmaleftbbloom: I've contributed 3 girls to code.org's demographic data, I plan to add a 4th this weekend
12:52bbloomzerokarmaleft: killer. glad you're liking
12:53justin_smithdeadghost: classic problem to compose a macro with new functionality, you must also make a macro
12:53justin_smiththe macro rule of contagion
12:53bbloomzerokarmaleft: add the word "it" to that sentence :-P
12:54zerokarmaleftbbloom: it's certainly more effective when I sit with them, but they're having a blast
12:56deadghostwell, I guess I can't put off learning macros then
12:56bbloomzerokarmaleft: yeah, it's not quite *zero* teacher yet, but the videos are quite useful and the the game-like nature of it doubles as a baby sitter. in my experience, you can watch/help quite a few kids at once, which isn't remotely the case with scratch
12:57zerokarmaleftand it's fascinating to watch each of them build up different solutions, their thinking patterns are wildly different even at the same age
12:57justin_smithdeadghost: also enlive can return edn, and it is viable to instead alter the edn it returns before rendering
12:57deadghostedn?
12:58justin_smithvanilla clojure datastructures
12:58arrdemdeadghost: Extensible Data Notation.
12:58justin_smithmaps, vectors, lists
12:58justin_smithstrings, numbers, characters
12:58arrdemdeadghost: a JSON equivalent subset of Clojure syntax.
12:58deadghostI see
12:58gdevdeadghost, it could be worse, you could try to use a monad
12:58arrdemgdev: sssh the haskellers will hear you
13:00technomancybbloom: have you looked at etoys at all?
13:00technomancylooks like a somewhat more sophisticated Scratch
13:00gdevarrdem, i doubt they can hear me over the sound of their own smugness, lol just kidding, I love them all, especially bitemyapp
13:15varniehello. I have found a typo on the official Clojure website.
13:16varniehere: http://clojure.org/getting_started ("Himera provides a browser-baed ClojureScript REPL"). "baed" <-- this one
13:16arrdemis it me or did everyone miss the point of the article over here.. https://news.ycombinator.com/item?id=6958983
13:16arrdemvarnie: awesome. lemme figure out where the issue needs to go.
13:19arrdemhum...
13:20arrdemtechnomancy: is it appropriate to ping dev.clj.org with the above? I'm not seeing a seperate channel for website typos.
13:48popinman322I'm getting "Unable to resolve var" when I attempt to resolve a let variable
13:48popinman322How would I get around that?
13:50jcromartiepopinman322: code?
13:50jcromartiethat should not happen
13:50jcromartieI assume you are trying to use it outside of the let scope
13:50gdevpopinman322, yeah it sounds like you're out of the let block then
13:52popinman322(let [beginning (fn [x] ...)] ((#'beginning) (fn [reader buffer] ...)))
13:53popinman322The second function in the list also references beginning
13:55gdevpopinman322, paste the whole thing at https://www.refheap.com/ and include the stacktrace
13:58gdevplease?
13:59popinman322gdev: On it
13:59gdevpopinman322, thanks
14:01popinman322gdev: https://www.refheap.com/e8bc2884ef718c0fe41b06f5d
14:02justin_smithpopinman322: why are you asking for the var behind a let bound value?
14:02justin_smithpopinman322: #' means "give me the raw var, not the thing it points to"
14:03justin_smithin that context, beginning is not a var, it is a let binding
14:03popinman322justin_smith: Just started using Clojure, please inform me @_@
14:03justin_smithbeginning is not a var
14:03justin_smithin that context it is a value bound by let
14:03justin_smithso there is no var to dereference
14:04popinman322And it can't escape the let binding?
14:04justin_smithescape it to what?
14:04justin_smithit is a name for a value
14:04justin_smith'beginning gives you the raw symbol
14:04justin_smithbeginning gives you the value
14:04justin_smithwhat else could you access?
14:04popinman322I want the function that is beginning to be in the list returned by let
14:05justin_smithfunctions are values
14:05justin_smithyou don't need a special quotation syntax for them
14:05justin_smith,=
14:05clojurebot#<core$_EQ_ clojure.core$_EQ_@1715346>
14:05popinman322'(beginning)
14:05popinman322?
14:05justin_smithoh, you want beginning inside a list?
14:06popinman322Indeed
14:06justin_smiththen yeah, '(beginning) or [beginning]
14:06justin_smithif a vector is acceptable that is more readable
14:06popinman322Would the value persist outside of the let binding, though?
14:06justin_smithsimilar issue with every other usage of #' in your paste
14:06justin_smithwhen you don't quote the symbol, you are accessing the value not the symbol
14:06popinman322Alright
14:06justin_smiththe value persists outside the let binding, if you pass it out
14:07justin_smiththis is what closures are, btw
14:07justin_smithkinda the thing clojure is named after :)
14:08justin_smithso, do you understand that error message now?
14:08justin_smith,(doc var)
14:08clojurebotGabh mo leithscéal?
14:09justin_smith,(use clojure.repl)
14:09clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.repl, compiling:(NO_SOURCE_PATH:0:0)>
14:09justin_smithweird
14:10justin_smithanyway, it may help to look into what vars are, and how they are different from let bindings
14:10gdev ,(use 'clojure.repl)
14:10clojurebotnil
14:10justin_smithwait, how is that different from what I did?
14:10justin_smith,(doc var)
14:10clojurebotExcuse me?
14:11justin_smithoh, ok, I forgot to quote the ns
14:15gdevlazybot, ,(doc var)
14:15gdevI forgot how to switch bots =/
14:16justin_smith#(doc var)
14:16justin_smith&(doc var)
14:16lazybot⇒ "Special: var; The symbol must resolve to a var, and the Var object\nitself (not its value) is returned. The reader macro #'x expands to (var x)."
14:16justin_smithFINALLY
14:16justin_smitha var is one of the mutible container types, like ref or atom, it is used to store values in namespaces
14:17justin_smitha let binding is just a symbol to value translation
14:18popinman322justin_smith: I see
14:18popinman322Thanks
14:22jcromartiegrrr, trying to figure out how to get output from log4j to show up in nrepl
14:22jcromartieworks fine with "lein run"
14:24jcromartiebut on an nREPL connection (via cider) nothing is output
14:25jcromartiewith the same log4j config
14:25jcromartieconsole appender...
14:26gdevjcromartie, so you are in emacs? if so, what does your *nrepl-server* buffer show
14:26jcromartiehm, there it is
14:27jcromartieI didn't know that was there
14:27cemerickI keep meaning to go figure out how to get that output to stream to the REPL interaction window.
14:27jcromartiein the past, I used bound-fn on my handlers
14:27justin_smithit is because *out* is a dynamic var, I am sure
14:27jcromartiebut for some reason that doesn't work with clojure.tools.logging
14:29jcromartiei.e. the handler fn I passed to run-jetty was (bound-fn [req] (my-handler req))
14:29jcromartiethat only works for println
14:29cemerickjcromartie: none of the logging stuffs touch *out* at all
14:29jcromartieI didn't think so
14:30jcromartieso, the *nrepl-server* buffer captures System/out System/err?
14:30jcromartieor what
14:30cemerickyeah, that's just a window to the tty of the process AFAIK
14:30jcromartieok that's easy enough
14:32jcromartieI could rewire System/out ?
14:33jcromartiewell anyway I have my log output, that's good enough
14:35BAMbandawhy am I getting errors when I try to call my (pig-latin) function?
14:35BAMbandahttp://paste.lisp.org/display/140661
14:35justin_smithwhat is the reasoning for not putting the output of the process in the nrepl buffer anyway?
14:36BAMbandajava.lang.IllegalStateException: Attempting to call unbound fn: #'brainfood.core/pig-latin
14:36BAMbanda Var.java:43 clojure.lang.Var$Unbound.throwArity
14:36BAMbanda AFn.java:39 clojure.lang.AFn.invoke
14:36BAMbanda/home/shai/clojure/brainfood/src/brainfood/core.clj:20 brainfood.core/eval4737
14:38justin_smithBAMbanda: I don't think this is the source of your problem, but in general it is better not to put side-effecting code (like the printlns) at the top level. Instead, move -main to the bottom of the file, and put the printlns in there
14:39justin_smiththen lein run will run -main, or from a repl you can call it manually
14:41BAMbandajustin_smith, hmm ok
14:41BAMbandathanks
14:42justin_smithBAMbanda: all that code works if I paste it into a repl
14:42BAMbandajustin_smith, yeah i see
14:42justin_smithso maybe the problem is just that the printlns are at the top level, and maybe putting them inside -main would be enough to fix your issue
14:43justin_smiththough I thought definitions would be guaranteed to be carried out in top to bottom order in an ns
14:45andyfIf anyone feels the urge over the holiday season to experiment with copying Scala's hash function implementations to Clojure for some comparative experiments versus Clojure's current hash functions, let me know.
14:45andyfSuch work could end up in Clojure's implementation, if it compares favorably versus some other alternatives.
14:45andyfBut no guarantees on that.
14:52arrdemandyf: did you see the hashing thread on the main clojure mail list?
14:53arrdemandyf: I think that the scala hashfn got some treatment there already.
14:54andyfarrdem: I was a participant in that thread, if it is the one I am thinking of. The reason I am asking is that I have heard second-hand that Rich would like to see a comparison of a proposed change to the hash function (from Mark Engelberg) against Scala's implementation, before deciding.
14:54andyfTo my knowledge, no one has yet experimented with the Scala hash in Clojure yet.
14:54arrdemandyf: ok. I just remember seeing the thread and thought I'd bring it up.
14:55arrdemandyf: I may elect myself the victim for this just so that I learn how to build the core...
14:55andyfarrdem: And thanks. It was relevant :-)
14:55andyfarrdem: If you want help, I can give you tips. It is not hard.
14:57sprocketdoes anyone have any recommendations as to the best clojure book out there?
14:58gfredericks~book
14:58clojurebotbook is books
14:58andyfarrdem: There is no need to follow the parts of the following wiki page that describe how to create patches until you are ready to do that, but the pulling a Clojure tree and building it steps are here, too: http://dev.clojure.org/display/community/Developing+Patches
14:58arrdemsprocket: how much clojure have you written? what are you looking for?
14:59sprocketarrdem: just starting out with clojure, though i've been doing dev in other languages for 15+ years so i can handle more advanced topics
14:59andyfsprocket: I'd recommend Clojure Programming published by O'Reilly
15:00sprocketandyf: thank you - i'll check it out
15:00arrdemsprocket: so if you're looking to learn good clojure design and thinking, The Joy of Clojure is awesome.
15:00sprocketarrdem: great, thanks!
15:00arrdemsprocket: Clojure Programming is more basic stuff, but still a good tour of the language
15:01justin_smithI would say joy of clojure if you already have lisp fu
15:01elfenlaid_The Joy of Clojure is kind of advanced book, but a bit boring
15:02justin_smithso it depends what kind of languages those 15 years represent
15:03sprocketjustin_smith: i've done a reasonable amount of common lisp over than time, so it should be alright
15:03arrdemsprocket: er no. that means yoi'
15:03arrdem*you'll have to unlearn mutable state lisp
15:03arrdemthat had me on my head for a solid month :/
15:03sprockethah, alright :)
15:04arrdemsprocket: that said, I think you'll be pleased with the relative sanity of our data literals and macros.
15:04arrdemsprocket: total step up from clisp and relatives.
15:06justin_smithwell idiomatic common lisp uses conses as if they were immutible - mostly
15:07justin_smithor mine did at least
15:07arrdemin that case I have a bone to pick with some people....
15:07justin_smitharrdem: maybe I am overly generous
15:08justin_smithrplaca, rplacd etc. of course are there - but I rarely found myself needing them, personally
15:08arrdemjustin_smith: the only largeish clisp codebase I've worked with made extensive use of in-place list mutation.
15:08justin_smithOK
15:08arrdemjustin_smith: it was C in s expressions.
15:09justin_smithsorry to hear that, it must have sucked
15:09arrdemno it didn't, I threw it out and wrote clojure :D
15:12gfrederickscombining the low-level performance of lisp with the ease-of-reasoning of C
15:12arrdemgfredericks: idk man... clisp can be pretty fast if you never hit the garbage collector...
15:13edw_http://doc.poseur.com/xmas-eve-macros
15:13Bronsaarrdem: wasn't SBCL the fast one out there?
15:14arrdemBronsa: yes. SBCL is the most active and fastest clisp compiler.
15:14Bronsaoh, you were talking about clisp the language, not the implementation
15:15arrdemBronsa: yeah I have the bad habit of using clisp to refer to all ANSI CL implementations.
15:16justin_smithI think the common lisp concept of cons-free-programming can be done in clojure
15:16justin_smithif you opt into mutible data structures but use them in a sane feed-forward way
15:16justin_smithI mean feed forward as in "don't touch it after you pass it to the next function in the DSP pipeline"
15:17andyfjustin_smith: I think that kind of sanity can be achieved in just about any programming language. The trick is, whether you actually do so or not :-)
15:17arrdemjustin_smith: sure, but then you've just reinvented transients for efficiency, it's still essentially functional code.
15:18justin_smithandyf: difference being immutibility is a sane default, and you opt into consless mutible things in tight loops
15:18justin_smitharrdem: correct
15:18justin_smitharrdem: not quite transients, I am thinking of DSP where your buffer size is fixed, so you don't even need resizable vectors, numeric arrays of primitives will be ideal
15:21arrdemedw_: cool.. but you don't need that atom...
15:23arrdemjust feed forwards a [val, trace] pair...
15:24gfredericksedw_: oh man not the fn/fn* special case...
15:25gfrederickssometimes I wish ->/->> didn't even normalize non-lists
15:25gfredericksbasically every time I try to explain what the threading macros do
15:26arrdemgfredericks: (-> big-map :foo :bar :baz) is a nice alternative to get-in thanks to that.
15:26gfredericksyeah those are the times when I don't mind
15:31gfredericksI feel like this -=> can be a two-liner and I'm thinking too hard about how to make it one
15:32arrdemgfredericks: mine is basically a wrapper around -> with a let to destructure a log out...
15:32arrdemgfredericks: but I'm stuck on the initial case :P
15:33arrdemI'd use meta, but then it wouldn't be legal to (-=> 3 inc inc)
15:33gfredericksoh it'd be nice if we could avoid packing and unpacking at each step
15:34gfredericksI didn't check if edw_'s code does that or not
15:34arrdemit does, by using a globaly scoped atom :/
15:34gfredericksoh right
15:34arrdemhence why we're rewriting it :P
15:41gfredericksokay let's call it a 10-liner
15:41arrdemhaha I have 16 with two macros.. I think you're winning
15:43gfredericks12 lines
15:44gfredericksnow let's see if it works
15:44arrdemI
15:44arrdem'm off by one layer of [] per form..
15:46arrdemhttps://refheap.com/22199
15:48arrdemcrap I fail the test case.
15:48gfredericksoh forgot to quote the code is all
15:49gfredericksw00h I think I got it
15:49gfredericksI opted not to wrap fn/fn* of course
15:50gfrederickshttps://www.refheap.com/22200
15:50gfredericksarrdem: I think the order of your cases in --=> makes the second one unreachable
15:51gfredericks,((fn ([a b c & more] :first) ([a b c] :second)) :a :b :c)
15:51clojurebot:second
15:51gfredericksjust kidding
15:51gfredericks,((fn ([a b c & more] :first) ([a b c] :second)) :a :b :c :d)
15:51clojurebot:first
15:51arrdemthe anon inline fn kills mine... trying to figure out why.
15:52gfredericksarrdem: well it doesn't work for normal -> so either you special-case it like edw_ or you decide not to support that like me
15:52arrdemgfredericks: I think I can cheat with an extra let gensym.
15:53gfredericksO_O
15:54arrdemnope just kidding. that makes no sense in the general case.
15:54arrdemunsupport that crud..
15:54gfredericksarrdem: I think you're not really doing what edw_ is doing; especially in the first clause of -=>
15:55gfrederickse.g. (-=> 12 inc) should return [13 [[12 12] [inc 13]]] I think
15:55gfrederickswhereas you would return [[12] 13]
15:55arrdemgfredericks: yeah you're right. I'm just logging intermediate values not the expressions too.
15:55gfrederickson top of evaling the first arg twice
15:56arrdemwell that I can fix easily.
15:57gfredericksfo sho
15:58gfredericksmacros are fun
15:58gfredericksstay safe kids, use a function
15:58arrdempfft
15:58arrdemcompile time hackery ftw
16:00arrdemgfredericks: you do produce the terminal expression/value pair in the log?
16:01gfredericksarrdem: yep
16:05arrdemgfredericks: herm... the tail expression is proving sticky.
16:06gfredericksthe tail expression?
16:06arrdemI have (-=> (inc 61) (#(- % 1))) eval to [[[(inc 61) 62]] 61]
16:07edw_arrdem: It's a dynamically-scoped atom, so it'll work when nested.
16:08edw_arrdem: Unless Rich introduces CALL/CC, in which case I'm fucked, possibly.
16:09arrdemedw_: that's not something I'd worry about.
16:09edw_arrdem: Dare to dream. (I'm a Scheme refugee.)
16:10arrdemedw: is call/cc suddenly a good thing? the last several thunks of literature I read were not exaclty flattering...
16:11edwarrdem: Suddenly?
16:12edwI don't think anyone advocates deploying CALL/CC casually.
16:13arrdemgfredericks: paste updated, now does logging but will totally break if nested.
16:15gfredericksarrdem: nesting is problematic anyways since you have to pull out the ... oh I dunno
16:16arrdembah I break on the empty tail case...
17:23AimHereHmmm, is read-string safe to do on a string where you know the first-character is ':'?
17:24AimHereIs there any danger of that being not-a-keyword?
17:28justin_smithif you are using at least clojure 1.5 and you use clojure.edn/read-string that should be fine
17:28justin_smithbut you could also call keyword on a string
17:29justin_smith,(keyword (subs ":hello" 1))
17:29clojurebot:hello
17:29AimHereYeah, I did think of that, just wanted the code slightly neater
17:33technomancyuse c.c/name instead of subs
18:08alewit's not possible to kill one cider/nrepl session at a time is it? you have to kill all of them?
18:26gdevalew, how are you trying to kill the sessions?
18:27alewthe only command I know of is cider-quit
18:27alewor cider-restart
18:35bitemyappedw: call/cc is not a good idea.
18:37bitemyapparrdem: call/cc is still a bad idea.
18:39arrdemholy shit bitemyapp just agreed with me. christmass came early :P
18:40arrdembitemyapp: so I realized that all my data modeling in Clojure is typeclass based. :P
18:40andyfBronsa: ping
18:41Bronsaandyf: pong
18:43andyfBronsa: Perhaps new type of exception from tools.analyzer(.jvm): If you have a few mins, try out latest Eastwood + libs on Raynes/fs: https://github.com/Raynes/fs He has a perhaps unusual macro that causes exception that I haven't gotten to the bottom of yet.
18:43andyfI can file a ticket to track it if you like.
18:43Rayneslol
18:44RaynesInteresting.
18:44andyfRaynes: This is very likely nothing bad about your code, but about tools.analyzer(.jvm)'s newness.
18:44Bronsaandyf: taking a look now
18:44RaynesI didn't write any of those macros anyways :p
18:45RaynesI'm interested in what the issue is when someone finds out, though.
18:45andyfI've been throwing lots of open source projects at pre-release Eastwood lint tool, in hopes of shaking out the kinds of problems that people would file after the release announcement :-)
18:46bitemyappandyf: a script that automatically downloads a list of projects and runs eastwood against them sounds useful.
18:46andyfbitemyapp: Got one :-)
18:46Bronsammh
18:46Bronsahttps://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj#L156 might be the issue
18:47andyfbitemyapp: I have been gradually adding projects to the list as things get more stable.
18:47bitemyappandyf: very cool. Automation is sanity :)
18:47BronsaRaynes: andyf: yep, that's it
18:48anagriusYou think it would it be worth it to make a port of swank-cdt for cider? Or is swank-cdt working fine for everyone?
18:48BronsaRaynes: s/./../
18:48andyfBronsa: I don't understand the issue yet. It needs type hint on this?
18:48andyfOh, syntax error?
18:48Bronsaandyf: no, it needs to be (.. this (toFile) (toUrl))
18:49andyfAny guesses why Clojure doesn't mind that expression?
18:50BronsaI'd guess because clojure simply ignores (toUrl)
18:50andyfBronsa: I'll experiment
18:51Bronsaandyf: lints fine now but.. it seems like it hangs when linting the tests
18:51andyfI think that is a different namespace. I can look into that more. Most common cause I've seen so far is tests open a connection to a host that cannot be reached.
18:52Bronsabtw yeah https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L950
18:52Bronsaif the third argument to a . form is a list, Compiler.java will ignore everything else
18:52andyfCool. Thanks for tracking it down so quickly.
18:53andyfSounds like a good thing to check for in a linter some time
18:54andyfWell, I guess since tools.analyzer throws an exception on it, perhaps better said is: another opportunity for Eastwood to print a message a developer can understand when this happens.
18:55Bronsaandyf: I'll make tools.analyzer throw a nicer error for that
18:56andyfBronsa: Great. If it can have ex-data with the ast of the whole . expression containing the problem, that would be useful.
19:01cYmenAfter adding a dependency to my projec.clj what do I have to do to make my repl aware of it?
19:02rovardid something change in clojuremode recently to convert lambda and fn to the lambda character and pretty f?
19:02Bronsaandyf: https://github.com/clojure/tools.analyzer/commit/5c31e2058369c230b493e671caa48be741919b71#diff-ca9fdc7850490879310292f81bfbb68fR608
19:02rovarI've seen discussion on the mailing list about it, but it was never enabled, it seems, until today..
19:03cYmenrovar: hm..my emacs has been doing that for a while
19:03Bronsaandyf: I cannot give you the AST in the ex-data because there's not one yet at that point :)
19:04rovarcYmen: it only seems to do it when I load files.. I'd prefer it didn't
19:08BronsaRaynes: https://github.com/Raynes/fs/pull/66 \cc andyf
19:09RaynesUgh.
19:09RaynesBronsa: I swear, either someone isn't adding tests, someone isn't running tests, or I don't understand tests.
19:09BronsaRaynes: it's ok, I suck at tests too.
19:21arrdemthat makes three of us...
19:22edwarrdem: https://github.com/edw/tinsel/blob/master/src/tinsel/core.clj
19:23edwNo atom.
19:23edwMucho beautiful.
19:23arrdemvery immutable
19:23arrdem so linted
19:23arrdemwow
19:23Bronsalol
19:24arrdemedw: nice! do like!
19:24arrdem(inc edw) ;; have some internet points
19:24lazybot⇒ 1
19:25arrdemwe need a library with bits like this that's actively maintained...
19:29arrdemedw: note, you have a typo in the readme.md
19:29arrdemedw: the require specifier is missing a ]
19:31sherbondyhiya folks, could someone explain to me why the syntax for field access of data-types is inconsistent across clj and cljs?
19:31edwD'oh. Fixed.
19:31edwThanks.
19:31sherbondyin clj, both (.field type-inst) and (.-field type-inst) are supported, but in cljs, only (.-field type-inst) is
19:32edwarrdem: I didn't see your second message; I figured you were torturing me, knowing what a stickler for typos I am.
19:32arrdemedw: haha. no problem. cool project idea btw! much less evil than my old pr-let macro :P
19:33edwpr-let?! Sadly, I have dont things like that: pr-identity,specifically.
19:34edwarrdem: I got to thinking about this in the context of Lighttable, and wanting to use Clojure to manage my checking account.
19:34arrdempr-identity should be clojure.core/...
19:34arrdempr-let was just a bad idea hack.
19:35edwI had like a forty-line long set of let bindings and I was *NOT* going to break that fucker up just to print one of those intermediate values!
19:36edwWhat _was_ the horrible, horrible piece of code I wrote for? No matter...
19:39edwarrdem: What you _really_ need is NAMED-PR-LET, because--obviously!--you're going to sprinkle it all over your code, and how will you tell what's what?
19:42arrdemedw: that can be done too...
19:44edwTo go to BK or not to go to BK... I mean, I took a shower and everything!
19:44arrdemedw: https://refheap.com/22205
19:45arrdemedw: one more for the macroheap
19:45arrdemsadly we don't have a *fn* variable...
19:48edwHigh on my list of lein plugins I'd like to write is something to implement paste-dependencies e.g. refheap, gists. Many of my projects are just dinky little < 100 line collections of code I use all the time.
19:50arrdemeeh... for all that it'd be nice to have paste dependencies, or to have a fast evolving macro dumping ground it kinda makes using such things difficult.
19:51arrdembut I agree, for a lot of things the full blown maven versioning is kina overkill.
19:51edwThere is the guy who did the GitHub deps plugin. I forget what the big project he is/was involved with. It's been a while.
19:52arrdemif you find it, please link it here. I'm intrigued.
19:52arrdembut I doubt that it's the right "light weight" solution.
19:53edwOh, he was Mr Clojurescript One.
19:54edwhttps://github.com/tobyhede/lein-git-deps
19:54edwhttps://github.com/brentonashworth/one
19:56arrdemidk...
19:56arrdemtechnomancy: I assume we'll never see a "git dependency" structure in main :deps
19:58arrdemedw: cool. I may have to use that. not sure that it's a general replacement for Maven/clojars but for some really small things it may be appropriate.
20:00edwYeah. I was looking into it when I was trying to solve our internal Clojure code reuse (and deployment to Heroku) problem. Deploying from private repos (of any kind) to Heroku is kinda a PITA.
20:00dsrxarrdem: there is a lein plugin for that
20:01edwOK, I'm off to go to Otto's Shrunken Head to get some Xmas Eve fun in.
20:01dsrxlein-git-deps I think?
20:01edwdsrx: Yes, we we're actually just discussing it.
20:01arrdemI mean my thing with targeting git as a dependency is that religious use of lein ancient would be better
20:01dsrxoh...
20:01edwTootles!
20:01arrdemedw: merry christmass!
20:03edwThank you. I'll have a tiki punch for you.
20:22bitemyappedw: you know there was already a Clojure library with the name tinsel right?
20:23bitemyappedw: also: I like your library.
20:28arrdembitemyapp: do you have a solution to the "rappidly evolving snippets bucket" problem?
20:28bitemyapparrdem: code snippets?
20:30bitemyapplogic_prog: it's Christmas :P
20:30arrdembitemyapp: basically if edw were to throw a bunch of other stuff in tinsle depending on or using it direclty becomes a source of overhead
20:30arrdembitemyapp: but at the same time, packaging a bunch of snippets into one place is a good thing
20:30arrdembecause otherwise you'll just end up `cp`ing a bunch of snippet files around between projects
20:31arrdemwhich is not managable or repeatable at all.
20:31bitemyapparrdem: flatland/useful set a precedent.
20:31bitemyappI'd advise breaking off pieces more often than they did though.
20:56shep-homeHmm, I'm getting a stacktrace from clojure.test: https://gist.github.com/shepmaster/8119538
20:56shep-homeAnd seemingly, it only touches my file in the ns declaration
20:57shep-homeat Java.lang.ArrayIndexOutOfBoundsException: null
20:57shep-homeI am running my tests from within emacs / cider
21:00shep-homeHmm, it seems like it might occur the second time i run my tests...
21:00shep-homeclosing the repl and starting a new one works once
21:00ivancan you paste the code?
21:10Bronsaandyf: I looked into using the ::source info to rewrite e.g defonce-or-defmulti-macro-expansion?
21:11Bronsaandyf: problem is, suppose you have (defmacro x [] (defonce foo 1)), the macroexpanded form of (x) will have '(x) as ::source, so it will not know about the defonce
21:12andyfBronsa: Thanks for looking into it.
21:13Bronsaandyf: looks like trying to match the expanded code is the only way to cover all the cases sadly
21:13andyfBronsa: I would be more disappointed with that news if I hadn't already implemented it :-)
21:14andyfAs it is, you are giving me more reasons to leave it as it is.
21:15shep-homeivan: I'll have to try to reduce it first, which might help anyway. I guess it isn't a known/obvious issue then
21:23sherbondyI have a question about deftype and extend type
21:24sherbondysay I make a datatype with deftype, like, (deftype point [x y z])
21:24sherbondyand then I call (extend-type point ...)
21:24sherbondywill I have access to x y and z?
21:36bitemyappRaynes: Vault is fucking terrifying.
21:36Raynes?
21:37bitemyappRaynes: http://hackage.haskell.org/package/vault-0.1.0.0/docs/Data-Vault.html#t:Vault from http://hackage.haskell.org/package/wai-1.2.0.1/docs/Network-Wai.html#t:Request - The authors of WAI were apparently concerned about performance *_*
21:38Raynesbitemyapp: What.
21:39Rayneshow what is this does even
21:39bitemyappRaynes: you know how in Ring we just kick request maps around?
21:39gdevalew, okay I figured it out, if you do C-k and select the buffer you want to kill, it should let you do what I think it is you were trying to do
21:39bitemyappand if you want to chain state, you just assoc?
21:40bitemyappRaynes: they made request a record, then stashed "extra" key value pairs in a vault field.
21:40bitemyappfor speeeeeeed
21:40Rayneslolol
21:40justin_smithgdev: I think it is cleaner to just run (System/exit 0) in the repl you want to shut down
21:41gdevalew, scratch that, I've just been informed that you can do (System/exit 0) in the repl you want to shut down
21:42bitemyappRaynes: Vault is basically ST for keys of * -> *. fucking nuts.
21:53alewah ok
22:15andyfBronsa: 'hanging' while linting other namespaces of 'fs' project was due to a future call, and Eastwood not doing (shutdown-agents). It does now.
22:15Bronsaandyf: oh, ok
22:16andyfBronsa: I am just glad I already knew about the 1-minute hang at the end and its cause, or it would have driven me nuts.
22:16Bronsaandyf: btw I'm toying a bit with using datomic to query the ast, here's what I got for checking if an ast represents a defonce: http://sprunge.us/FfUb?clj
22:18andyfBronsa: I do not grok datomic queries yet, which I guess are just datalog, but is line 6 unnecessary?
22:18Bronsaandyf: no, just a junk leftover
22:20andyfBronsa: Is the main motivation for having the ast in datomic so that one can write queries in this form? Or is there another reason?
22:23Bronsaandyf: it seemed something nice to experiment after seeing jonase's work so I did https://github.com/Bronsa/tools.analyzer.jvm.index
22:23Bronsaandyf: yeah, querying the AST is my main & only motivation ATM
22:24andyfBronsa: I can see why that would be an attraction, and cool that you guys are implementing it. I may not get into it for a bit longer myself, just from trying to get a few more things tidied up elsewhere in Eastwood first.
22:25andyfYesterday was my "flurry of filing patches motivated by things Eastwood found" day. Sounds like we already have a fan or two.
22:26Bronsaandyf: it's definitely not a priority for me either, but it looks fun enough to give it a try sometime in the future
22:26Bronsaandyf: yeah -- https://twitter.com/michaelklishin/status/415407087393730560
22:34TEttingerso my quick search turned up nothing, but is there a library out there for seeded random number generation in clojure? I use rand-nth a fair bit now, but I would like to be able to make that have reproducible results given a certain seed
22:35TEttinger... going to check ztellman's github...
22:38andyfTEttinger: Don't the underlying Java methods have ways of initializing the seed?
22:39TEttingerandyf, maybe, but I don't know what java.util.Random object they are using
22:39TEttingerI found https://github.com/kephale/clj-random/blob/master/src/clj_random/core.clj
22:40kephaleyeah!
22:43TEttingerheh hi kephale
22:43kephaleif there is a lot of complaint about the naming i'd be happy to add some aliases to the standard randX function names
22:43kephalehowdy
22:43TEttingerno, that makes total sense
22:43TEttingerthink I found an error
22:43kephaleaiee
22:44TEttingerhttps://github.com/kephale/clj-random/blob/master/src/clj_random/core.clj#L105
22:44TEttingernot a logic error
22:44kephaleah in the comment, gotcha, thanks
22:44TEttingerjust... the rand-nth function would only behave correctly if the range is [0,n)
22:44TEttingerif n is inclusive, lrand-nth wouldn't work
22:45TEttingerI'd also check lrand , see if it's correct
22:47egosummerry almost christmas :) i was wondering if there were a std lib fn equiv to #(%1 %2)?
22:47andyfegosum: apply?
22:47kephalelrand seems to be ok…
22:48andyfegosum: That is not quite what you are asking for, though, since apply treats its last arg as a sequence of args, not a single arg.
22:48TEttingerkephale, just wasn't sure if it was supposed to have 1 inclusive
22:48egosumandyf: exactly
22:48kephaleahhh yes gotcha
22:48kephaleTEttinger: i'll double check the inclusivity
22:49TEttingerkephale, this looks very useful, surprised this didn't exist before you made it
22:49egosumi just prefer to avoid the whole #(%1 %2) for totally aesthetic reasons…i don't like reading J/APL hah
22:49kephalei know! i was shocked too
22:50egosumi just made it instead… (defn call [f & args] (apply f args))
22:53TEttingeregosum, there's the literal translation of (fn [f x] (f x))
22:54egosumTEttinger: right, that's essentially what I'm doing with `call`, just making sure i hadn't missed a std lib fn/lazy-webbing. Thanks :)
22:55TEttingerwondering if there's a way to do it with partial
22:56egosumpartial generally doesn't play nice with multiple arity
22:59logic_progIs there a way to use crossovers where a given piece of code (1) uses clojure.core.async in clj land and (2) cljs.core.async in cljs land?
23:04ddellacostalogic_prog: probably cljx is going to be your friend here--as far as I know that's the one thing crossovers *doesn't* do well. Although, I suppose you could do it with a macro, somehow...
23:04ddellacostalogic_prog: or more accurately, that is exactly cljx's use-case
23:04logic_progdamn
23:04logic_progI just got comfortable with crossovers
23:05ddellacostalogic_prog: well, I'm sure that's not wasted time. :-)
23:05edwSpeakers or automobiless?
23:05edws/automobiless/automobiles/
23:06andyfBronsa: Here is another one that might be new to you, and perhaps not reasonable to try to make tools.analyzer(.jvm) handle. simple-check has a namespace simple-check.clojure-test defining a macro defspec, and inside that macro's expansion it does a (require 'simple-check.core), with a comment about shame in introducing a cyclical dependency.
23:06logic_proghaha
23:06logic_progthis is rsorta badass
23:07logic_progit's basically jsut #+clj and #+cljs
23:07logic_progreminds me of C macros, _if_def_ hell
23:07ddellacostalogic_prog: yeah, I mean, *maybe* there is a way to do it w/crossovers, but I gotta say, cljx makes it really easy.
23:07ddellacostalogic_prog: so you're probably best off just using that.
23:08edwlogic_prog: I thought you were making your own speakers or something.
23:08Bronsaandyf: I'll look into that maybe tomorrow, it's 5am here now and I'm going to sleep :)
23:08logic_progwell, they say an expert if someone who has made all the newb mistakes
23:08andyfno rush
23:08ddellacostaedw: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/CROSSOVERS.md
23:08logic_progI'm soon to be a cljs/clj code sharing expert
23:08ddellacostalogic_prog: :-)
23:08logic_progedw: lol, I was wondering if you were posting in the wrong channel
23:08sherbondyspeaking of cljx, has anyone tried writing custom rules?
23:09sherbondythe readme is a little cryptic on that, but I'm guessing it's just kibit rules?
23:09logic_progcljx should just use clojure macros
23:09logic_progfor specifying clj / cljs code
23:09Bronsaandyf: mind to open a JIRA ticket so I don't forget?
23:09logic_progbasically, if you should be able to define e macro, and depending on :clj or :cljs, it does different things
23:09ddellacostasherbondy: I haven't, but definitely curious about it.
23:09sherbondyoh, nit's no longer based on kibit, never mind
23:10sherbondyhttps://github.com/lynaghk/cljx/blob/master/src/cljx/rules.clj
23:10sherbondyso the bottom of that file sheds some light on the expected format of the transformations
23:11ddellacostalogic_prog: not sure what you're arguing for--doesn't cljx already basically work that way? I think I'm not understanding your point.
23:11logic_progddellacosta: in you opinion, is htere ever a reason to use crossover + cljx together? as I go through the cljx setup, it seems to be a strict superset of what crossover does. in particular, cljx without #+cljs #+cljx = what crossover does
23:11sherbondyyep, you shouldn't need both
23:11ddellacostalogic_prog: yeah, I would imagine so. The one project I used cljx in I didn't use crossovers.
23:12logic_proghmm, learning about cljx makes my christmas eve sorta happy :-)
23:12edwddellacosta: Ah!
23:12sherbondyhey, you folks want to see a neato project that uses cljx?
23:12sherbondyIt's still very much a wip, but it finally runs in the browser and the jvm!
23:13sherbondyhttps://github.com/sherbondy/rt
23:13sherbondya ray tracer!
23:13sherbondylein cljsbuild once, then open index.html and wait a few seconds, and a tiny raytraced scene will appear
23:13sherbondylikewise, lein run, and a .ppm file of the same scene will appear in the directory!
23:14edwI'd forgotten about that. Clojure-in-Scheme got me thinking about writing an EDN reader for a Scheme so I could then create a Scheme dialect using sets, hashes, and vectors as part of the syntax.
23:14sherbondythe algorithm is very naive, and I'm using clojure seqs all over the place instead of native arrays, but it's a raytracer, dammit!
23:14logic_progsherbondy: does it run on asm.js yet :-)
23:14sherbondyoh, and it uses core typed!
23:14sherbondyha, no
23:15logic_progfuck ... with cljx, why do I have separate clj and cljs src directories ?
23:15edwbitemyapp: Thank you. Thank arrdem for shaming me into making a beautiful version.
23:15logic_progwhy not one gigantic code base?
23:15sherbondyfor platform-specific libraries
23:16andyfBronsa: will do
23:16sherbondyno point wrapping a ton of functions in #+clj, might as well be a separate library
23:16sherbondy*namespace
23:19ddellacostasherbondy: that's really cool. :-)
23:19ddellacostalogic_prog: yeah, I think it depends on what the volume of your platform specific code ends up being
23:20ddellacostalogic_prog: if it's minimal, you can get away with including it all in the same cljx files. Otherwise separate dirs/libs makes sense I think.
23:22ddellacostasherbondy: I look forward to reading through your ray tracer when I've got some time...nice little project. I haven't done much core.typed either. Neato.
23:30TEttingersherbondy, haha neat. ppm is one of those internally-it's-text image formats, right?
23:31sherbondyyep, that's right
23:32sherbondyjust a string of 0-255 r g b values
23:32sherbondydelimited by spaces
23:32TEttingeroh I was thinking of xpm I think
23:33TEttingerhttps://dl.dropboxusercontent.com/u/11914692/dungeontiles.xpm I think this is valid C source?
23:57logic_progI am having a dumbass cljx problem:
23:58logic_prog"lein cljsbuild auto" does not seem to pick up on "touch shared/data.cljx"
23:58logic_progbasically, when I edit my *.cljx files, lein cljsbuild auto does not fire off
23:58logic_progyet, shared/data.cljx is being used
23:58logic_progI know this becuase "lein cljsbuid auto" compiles it the first time around (giving a warning)