#clojure logs

2013-09-02

00:00johnmn3yea, cljsbuild is hanging while compiling a fresh project from cljs-kickoff... could lein or cljsbuild be corrupted?
00:03johnmn3guess I could try moving to cljsbuild "0.3.3-SNAPSHOT"
00:03cgagtry just deleted cljsbuild
00:03cgagfrom your .m2 folder
00:06johnmn3oh, whatayaknow... successfully compiled in 91 seconds... that was after it pulled down 0.3.3-SNAPSHOT
00:06johnmn3will try back on the main project now
00:07cgagawesome
00:07cgaghow big is your project if you don't mind me asking? 91 seconds seems like a long time
00:07cgagoh, well, and / or what are you running this on?
00:09johnmn3one sec... pulling the deps might have slowed it down.. running again
00:11futileOh my.
00:11futileMaybe I'm wrong, but ns-tracker seems to take 100% CPU while watching for changes.
00:13johnmn3hmm... 47 seconds... running on an Samsung ARM A15 Chromebook with cruton in chroot
00:16johnmn3cgag: and the project isn't that big 3 cljs files, largest of which is ~1k lines
00:42futileI love the guard-rails analogy for testing.
00:42futileTests make great guard-rails, but you don't drive by constantly banging into the guard rails back and forth.
00:50noidifutile, yeah, it's a good one
00:59futileI was brought up in a TDD environment, and I've seen a *lot* of damage done by having a naive purist approach to it.
01:01bbloomfutile: i don't understand "X driven Y" or "A oriented B"
01:01bbloomfutile: why would i ever choose ONE approach to anything?
01:02futilebbloom: it's helpful as convenient language to quickly express a concept
01:02futilealthough I'm not sure it's *actually* helpful, since it's usually so sweepingly broad as to be often misunderstood
01:02futileLike C++ is Object Oriented in a totally different way than Go and Smalltalk are.
01:03bbloomfutile: so i used to think the worse thing you could do to any idea was assign a name to it
01:03bbloomonce you make it a methodology, it becomes a religion
01:03futileAnd sure, I test-drive my app, but sometimes those tests are manual tests that I do once in the repl, and stick the results into a function and never touch it again.
01:03bbloomwhat i learned from the clojure community & rich in particular was that defining words you thought you knew is a way to accomplish all the good things from naming stuff, but with far less of the bad things
01:04bbloomdefining simple & easy turned out to be 100X more useful than "decomplection oriented programming"
01:04bbloom:-P
01:04futileha
01:04futilebbloom: that only works when everyone in the conversation agree on what simple and easy mean. And when they don't, that's not immediately obvious, sometimes for a while.
01:06bbloomfutile: is it immediately obvious what "test driven development" means?
01:06bbloomit's certainly less agreeable than simple & easy...
01:06futileheh
01:06futilethats what im saying.
01:07futileive come to a conclusion that doesnt fully make sense yet
01:10futilesomething like, if you're good at programming, the designs of your program are much more important than the details that change by the language.
01:10brehautbbloom: TDD means Ron Jeffries fails to write a Sudoku solver
01:10futileexcept thats not fully true, because i would rarely use Java or half its features to solve any problem.
01:10futilei may be too tired to make sense.
01:11bbloombrehaut: lol oh man that was hilarious
01:13noidiI prefer Nat Pryce and Steve Freeman's "development guided by tests"
01:14futiletime to write a recursive descent parser for Clojure code until i pass out
01:14bbloomfutile: it's LL(1), pretty easy :-)
01:14futileoh i wonder, is Clojure's own parser usable exteranlly?
01:14bbloomfutile: see tools.reader
01:15noidiI think tests can and do have a place in the design process, but they don't drive the design, they inform the designer
01:15futilebbloom: erm i cant say i know the difference between parsers, but ill take your word for it
01:15futilenoidi: nice way of putting it!
01:15futileI can't actually go public with these opinions since I work for a guy who is big in the TDD/agile world.
01:15bbloomfutile: an LL(1) grammar/parser means you can parse it from top to bottom, left to right, with only 1 character/token of look ahead
01:15callen"big"
01:16futilecallen: you've probably heard of him
01:16futilebbloom: ah! sweet, just what i was planning :)
01:16bbloomfutile: unless you're looking for a learning experience, just use/contribute-to https://github.com/clojure/tools.reader
01:17futilebbloom: does that 1-char look-ahead take into account the various forms starting with # (not counting tagged literals)?
01:18bbloomfutile: yeah, when you encounter #, which clojure calls the "dispatch reader", it only needs to look at the next character to decide how to continue parsing. if it's a letter, it's a tagged literal or a record. if it's _ it discards, if it's ( it's a function, etc
01:18callenfutile: maybe.
01:18futilecallen: probably
01:18callenfutile: I know a lot of TDD people, I just can't think of any where you live.
01:18futilebbloom: hmm interesting
01:19futilebbloom: thanks for this link, i think i will use it
01:19bbloomclojure was designed to be LL(1) on purpose
01:19callenfutile: understanding chomsky hierarchies is critical if you want to do anything with parsing.
01:19callenfutile: what bbloom just said about being designed as an LL(1) language on purpose is extremely useful.
01:19futilebbloom: oh?
01:19futilecallen: oh?
01:19callencontrast with trying to do some kind of machine processing of, say, C++
01:19bbloommost practical languages design for a particular subset of CFG to ensure fast/simple/easy parsers
01:20callenbbloom: I should write a clojure reader with instaparse :P
01:20futilecallen: then write up a performance comparison with tools.reader
01:21callenfutile: http://www.cs.dartmouth.edu/~sergey/langsec/occupy/
01:21bbloomcallen: if you do, i'd be curious how it performs. i suspect it would be mega slow at first, but could be reasonably tweaked to be just a small bit slower than a real LL(1) parser
01:21callenbbloom: that's precisely what I was wondering. It'd be useful since Selmer is performance focused but we'd like a cleaner parser.
01:21callen(with better errors)
01:21callenfutile: although that page has "jokes" in them, it's directly relevant to what we're discussing.
01:22futilebbloom: tools.reader/read actually executes code?
01:22bbloomfutile: um, it shouldn't.....
01:23callenit's read, not eval.
01:23callennor print, nor loop ;)
01:23futileoh
01:24bbloomcallen: i'm a big fan of generalized CFG parsing b/c i like the tracer rounds approach to eliminating ambiguity & i think that if you've got a code file over 5000 lines or so, it's too damn long. with that in mind, who cares if your parser is O(n^3)
01:24futileI think I got confused because of *read-eval*
01:24bbloomfutile: clojure has a #=(this gets evaled) form which is mega evil / a bad idea
01:24futileOh wow.
01:25callenbbloom: I'm a fan of clean, reliable parsers period because I've seen too many shitty shotgun parsers.
01:25futileI think I'll use that in every file from now on.
01:25bbloomfutile: that's why there is clojure.edn/read
01:25bbloomcallen: terrible plan.
01:25callenbbloom: it's just idle thoughts of evil, don't worry.
01:26bbloomanyway, i'm off to bed. futile: go forth and learn to parse
01:26futilebbloom: learn forth? ok
01:26bbloomfutile: that too. forth is awesome
01:26futileno wait, parse forth?
01:26futileoh no
01:26futilelearn go.
01:26futilebut i already did
01:27futileand i most certainly will not parse go, thank you very much!
01:27bbloomfutile: i gave a talk about concatenative languages at clj/west. factorcode.org == super cool. learn that too
01:27futilefactjor
01:27callensigh ANTLR. https://raw.github.com/laurentpetit/ccw/c672824293148e202322c537a52a1edd71c61a16/clojure-antlr-grammar/src/Clojure.g
01:27bbloomyeah i wrote that :-P
01:27futile:D
01:28bbloomcallen: i'm annoyed that all these damn readers do syntax quoting
01:28bbloomcallen: just b/c rich hacked it that way doesn't mean everybody else should
01:28bbloombut i'm out, cya
01:29callencheers.
01:29futileAw, tools.reader doesn't preserve input locations.
01:30futileOr maybe it doesn't but just not obviously.
01:30futileAha! IndexingReader
01:44futileDang, input-location information is only provided for some types. Not numbers, for example.
01:45futilebbloom: I think that kills it for my purposes. But thanks.
01:50noidiah, futile left already
01:50noidihe could have looked at Christophe Grand's Clojure parsers
01:50noidiParsley and the newer one
01:51noidiSjacket
01:51noidiah, apparently Sjacket is built on top of Parsley
01:55ddellacostahow do I do "delete from things where id in (1, 2, 3)" in clojure.java.jdbc?
01:56RaynesWell you just wrote the sql for it, so I expect the next step would be to execute it.
01:57ddellacostaRaynes: one would think.
01:57callenddellacosta: raw parameterized or pseudo DSL?
01:57juliangindiI'm trying to figure out how to write a function that returns two values that I can capture in two variables. Any suggestions?
01:57ddellacostalet me be more clear--how do I use the built-in DSL capabilities of clojure.java.jdbc to make a parameterized delete?
01:57ddellacosta…such as they are.
01:58callenddellacosta: (j/delete! sqlite-db :test_table (s/where {:id 9001}))
01:58ddellacostaI guess I can just do execute! with my string above, but, blah
01:58callenddellacosta: no, use what I just showed you.
01:58ddellacostacallen: that works wonderfully for one id.
01:58ddellacostathat much I can figure out from the docs.
01:58RaynesI hate sql dsls. So much.
01:59callengive me 2 seconds to dive into their ghetto ass API
01:59callenand then you'll have an answer.
01:59callenRaynes: Korma is fine.
01:59RaynesSo is SQL.
01:59RaynesSo why not just write SQL? :(
02:00ddellacostacallen: so, sounds like we know about the same amount about it…d'oh.
02:00RaynesThe thing about these crazy ass DSLs is that they're designed to provide flexibility that nobody actually uses.
02:00callenddellacosta: I just got done writing blackwater, it's PTSD to re-remember what I learned about c.j.j
02:00ddellacostaRaynes: the answer is that it is handy to have a DSL to generate SQL for you when you are repetitively doing something specific for your domain model
02:00callenI need to down a few shots of scotch and then I'll be okay, just give me a minute.
02:01ddellacostacallen: hehe
02:01RaynesYou don't need a DSL for that, you need mustache.
02:01Raynescallen: Tell me about it.
02:01callenI've probably touched c.j.j more than anybody in the last 2 months, including Corfield.
02:01ddellacostaRaynes: whatza mustache
02:01ddellacostacallen: I suspect so.
02:01callenddellacosta: he means the template lang, which is a terrible idea.
02:01Raynesddellacosta: It's a bit of facial hair under the nose.
02:01callenRaynes: that's a moustache.
02:01ddellacostaooh, yeah, I don't want to do that
02:01Raynesddellacosta: It's a template language and callen can go screw himself.
02:01ddellacostanow now you two
02:01aaelonyfwiw, I typically leave SQL as a string but have different functions for potential where clauses
02:01RaynesIt's a perfectly suitable solution to this problem.
02:02ddellacostaRaynes: it leaves out a lot of the stuff in between, like, validation
02:02callenRaynes: mustache is not an acceptable way to structure or manage SQL queries.
02:02RaynesI certainly don't think writing it in a Clojure DSL is a suitable way either.
02:02aaelonyor separate generating functions for sub queries, etc...
02:03RaynesIt's certainly no more suitable than using a templating language.
02:03callenddellacosta: yeah you're going to have to use execute!, the .sql API only supports dumb AND'd where clauses.
02:03callenddellacosta: you realize Korma is more flexible and better designed right?
02:04RaynesWho'da thunk it.
02:04ddellacostacallen: okay, that's about what I thought, but figured I'd ask to see if someone had a more clever idea.
02:04callenddellacosta: I tried. c.j.j is dumber than I'm capable of outsmarting.
02:04ddellacostacallen: we were using korma and migrated away from it for various reasons--it is too magical for us, and even with the kind of pain of dealing with c.j.j dumbness it is better than wrestling with magic
02:05callenddellacosta: for the love of god, submit issues to the Github so these things can be fied.
02:05callenfixed.
02:05callenKorma isn't irreparable, it just needs improved. It's a much more solid base to work with than c.j.j
02:05ddellacostahttps://github.com/korma/Korma/issues/70
02:05callenbut if nobody submits the tickets...
02:05callengrr. k, I'm fixing this.
02:06ddellacostathis was the back-breaker for us I believe. I should add, it wasn't me, it was someone else on my team that was doing the heavy wrestling. But I can't complain too much about c.j.j, honestly.
02:06ddellacostahttps://github.com/korma/Korma/issues/64
02:07ddellacostaI mean, it may have gotten better already, but we started the porting-over process a while back, so it would be seriously counter-productive to go back again now.
02:07callensigh, I know.
02:07callenI just want Korma to get that last 10% sorted so people don't have to use c.j.j
02:08callenbecause seriously, incrementally assembling queries in Korma is WAY nicer than c.j.j
02:08ddellacostacallen: yah, I know. I mean, honestly I am not sold on either one
02:08callenand that's all I ever really needed or wanted from an ORM, and Korma does it in terms of SQL itself, but as part of the language.
02:08ddellacostacallen: but korma is definitely easier to do this kind of stuff.
02:10callenddellacosta: I do so much CRUD that I really need a nice querying layer so I can abstract the bullshit away.
02:11callenotherwise I spend all time doing manual breakouts of various reporting scenarios and it's a huge waste of human life.
02:11ddellacostacallen: I hear ya. I just have a few customized macros that do a lot of the heavy-lifting, and otherwise, I write lower-level stuff. Generally, it's not a problem.
02:21callenddellacosta: just to clarify, is the problem returning results at all or loading the results?
02:21noidicallen, is korma under active development?
02:21zeroemis there a list of common reasons compiling cljs (targeting node) leaves out certain parts of libraries?
02:22callennoidi: yes, very.
02:22ddellacostacallen: the problem is constructing a prepared statement for deletion
02:22zeroemI'm trying to get a program using core.async and some of the impl objects aren't showing up in the compiled version
02:22callenddellacosta: I'm talking about the Korma issue.
02:22ddellacostacallen: I want to do something like (delete-things! ids)
02:22callenddellacosta: I'm working on it.
02:22ddellacostacallen: oh, sorry
02:22callenddellacosta: I am not improving c.j.j
02:22callenthat is never ever going to happen.
02:22ddellacostacallen: haha, okay
02:22callennot unless they clean house and hang a few guilty parties.
02:23callenddellacosta: the insert returning results issue, which part is problematic?
02:23callenreturning results at all, or ever having gotten them to begin with?
02:23noidiI'm starting a new project that needs to use a SQL database, so I should choose between Korma nd c.j.j right about now
02:23callenie, is it okay if I just nil the bastard about?
02:23ddellacostacallen: um, at this point it is momentum more than anything. The issue at the time had to do with the fact that some of our records have a LOT of data in them
02:23ddellacostacallen: and returning them would mess us up pretty bad.
02:23callenddellacosta: so, getting the records at all. got it. thank you.
02:23ddellacostacallen: yep, sorry for the overly long answer...
02:23noidiin general I'm not a fan of frameworks and magic, so I've been thinking about going with c.j.j
02:23callenthat also means I'm prolly fucked.
02:24callenbinding macro gets defenestrated, now we try again...
02:28callenddellacosta: uh, korma can already do what you wanted.
02:28callenddellacosta: I just need to figure out the user-side entry point and document it.
02:28ddellacostacallen: yah, I mean, again it's a year old issue...
02:28callenwell it needed responded to, documentation, etc
02:28calleneven if it was a non-issue.
02:28ddellacostacallen: not surprised to hear that at all. Yeah, definitely.
02:28callenddellacosta: again, I don't know for sure if there's a user-side entry point
02:28callenI just see the necessary code in exec-sql.
02:28callenand it seems like a possible branch.
02:29ddellacostagotcha
02:30ddellacostaon the other side of the SQL DSL divide, I'm about to scream at how hard it is to simply execute a delete with an " IN " condition in c.j.j
02:31callenlol.
02:32callenddellacosta: on that subject, go here: http://sqlkorma.com/docs and cmd-f for "[in "
02:32callenI'll chill out on smug mountain while I figure out how to pass :with-results nil to the macros.
02:32ddellacostacallen: I know, I know, Korma can do it…not helpful now unfortunately.
02:32callenddellacosta: need to bug my ass earlier rather than later.
02:33ddellacostacallen: dude, earlier is, like, before I started working for these guys
02:33callenoh sure, I know we weren't talking at the time
02:33callenjust as a for-future type thing
02:33callenI like sparing people pain.
02:33ddellacostacallen: oh, yeah, most definitely I'll be bugging you about Korma if I start using it again. ;-)
02:33callenalex baranosky is going to hate me if that happens.
02:33ddellacostaalright, I think now is a good time to eat, before I throw my computer across the room.
02:33kornyany thoughts on korma upgrading it's c.j.j dependency? We had real pain when we tried adding some code that used jdbc 0.3 stuff and it collided with the korma dependency
02:33callen2013 and we can't do a SQL " IN "
02:34callenkorny: exclude and replace.
02:34callenkorny: did exclude and replace break?
02:34kornydidn't try that - seemed a bit risky
02:34callenkorny: just...write tests.
02:35korny:) lots of tests, just not sure our tests would cover making korma use a newer jdbc version
02:35korny(and to be fair, when I say "lots of pain", mostly it was just rewriting the merged code back to jdbc 0.2 stuff)
02:36noididdellacosta, looking at c.j.j, it looks like writing your own `s/in` wouldn't be too hard https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc/sql.clj#L292
02:36ddellacostanoidi: that's basically what I'm doing, because I have no choice.
02:36kornyworking at financial institutes makes us tend to be pretty conservative sometimes, I'll admit
02:36callennoidi: it's still silly as hell.
02:38ddellacostawhat I can't grasp is why I keep getting "Parameter index out of range (1 > number of parameters,
02:38ddellacostawhich is 0)," which is forcing me to actually read through clojure.java.jdbc…not what I had planned on doing today. *sigh*
02:41callenddellacosta: how would you feel about Korma only returning insert/delete counts and not results as a default?
02:42ddellacostacallen: I think that would be wise, with some option to return the results if need be
02:43callenddellacosta: working on it.
02:44callenI know how to do what I want, but it's stuff at a layer below the epidermis.
02:44callenincidentally, the layer where the macros end and the functions begins.
03:00rhg135Another ? Abot zip, what is the make-node func for?
03:10ddellacostarhg135: it is for what happens when you add a node while traversing a zipper
03:11ddellacosta…among other things
03:11rhg135What if you want a read-only one?
03:12ddellacostarhg135: …don't modify your tree as you traverse it? zip is not going to all of a sudden mutate anything
03:13rhg135I mean just supply nil?
03:13ddellacostarhg135: try it and see. ;-)
03:13rhg135K
03:15callenddellacosta: insert-returning, insert-returning*, delete-returning, delete-returning*. insert/delete/insert*/delete* no longer return by default.
03:15callenddellacosta: https://github.com/korma/Korma/pull/178
03:15callenddellacosta: I am harassing the motherfuck out of Alex until it gets merged.
03:15ddellacostacallen: cool. Thanks for all your effort. I can't promise this means we'll start using Korma all of a sudden, but it's good to know it's being actually worked on.
03:16ddellacostacallen: probably in general though, that's a good change.
03:16callenddellacosta: I expect nothing. this is purely about improving Korma.
03:16callenddellacosta: I meant it when I said I just want people to submit issues so things can be fixed.
03:16ddellacostacallen: yah, figured.
03:25rhg135It works fine
03:29ddellacostarhg135: yeah, not surprised to hear that. The only time make-node is used is when something is changed on the tree. Probably you'd get an exception if you mutated something, but otherwise seems like it should be fine.
03:30rhg135So (constantly nil)
03:32kralnamaste
03:41hhenkelGood morning. Quick question regarding the use of "edn" for config files. Is there a way to reference allready described data?
03:42hhenkelLike init a list of data and later on pointing to it?
03:43nightflyThat sounds outside of the scope of EDN
03:44hhenkelnightfly: hmm, okay. Just thought it might be possible, as it seems doable with property files.
03:48nightflyafaik EDN is just safe read'd clojure structures, which means no evaluation that would be resolve references.
03:49nightfly*needed to resolve
03:52hhenkelokay, then it seems unpractical for my purposes. Any other suggestions for a configuration format and parser?
03:52augustlI use clojure files for config, and evaulate the values as clojure, so I can have "do" blocks and logic and what not in there if I want to
03:57hhenkelaugustl: okay, that would also be a possibility. Are you aware of a parser who works with simple substitution?
03:59schmirbeing able to execute code in your config files may be sign that you're too lazy to think about the configuration file format. make sure you really want to do that if you're going to let customers use it
03:59augustlhhenkel: I just use the clojure reader
04:00augustlschmir: I regret having executable config files :) It's just for web happs I host myself, but it's still bad design to have logic in config files
04:02nightflymeh
04:03nightflyI thought it was becoming a trend to use stuff like Lua for app configuration because of the value of being able to have execution in configuration files.
04:05ivanit's no longer plain data if it executes code, you are in a much more complicated world tied to implementation
04:07hhenkelI don't want to execute code, I'm just search for a way to reference allready described data.
04:07augustlthe specific problem I'm having is that by having my config file return (in my case) a datomic database connection, I have to have really clever stuff in my config file when I need to now use multiple databases.. :)
04:08augustlhhenkel: one way is to use (read-string) and (eval) the values
04:09augustlreferencing already described data sounds a lot like just executing code to me, I might be wrong though
04:11hhenkelaugustl: Referencing would be nice, but a simple substitution of values would also work for me.
04:12hhenkelSomething like "key1 = valueA" and key2 = ${key1}
04:13hhenkelI don't care if it key2 points to the same refernce or if it would just be substituted on a string level.
04:13augustlnot sure if anything exists, but should be a pretty small task to implement your own "let", so to speak
04:14hhenkelIt seems like it should work with property files: http://stackoverflow.com/questions/872272/how-to-reference-another-property-in-java-util-properties
04:32noncom|2kral: namaste
04:33clgvnoncom|2: if I am not mistaken you were the guy interested in more primitive support for functions, e.g. float, int, right?
04:39sheldonhi am looking for some functional katas to use to get into clojure. anything leap to mind?
04:39opqdonutare you aware of http://www.4clojure.com/ ?
04:40sheldonhopqdonut: yay! i am now. thank you :)
04:42sheldonhverrrrry nice
04:46mheldhey y'all
05:15sheldonhhow can i prevent the repl from displaying the result of an expression? sometimes, it's enough for me that the statement completes without error
05:16sheldonhmaybe just (nil? expr)
05:16clgv sheldonh: use (def result (my-expr ...))
05:17sheldonhclgv: hmmm. i thought that just made result an alias for my expression, without evaluating it
05:17clgvsheldonh: then the result isnt shown unless you look at the var `result`
05:18clgv sheldonh: no that is wrong. it evaluates your expression. only in the case of lazy sequence functions the sequence wont be realized
05:18sheldonhclgv: aha! thanks for clarifying
05:18clgvsheldonh: but for such an op you can use `doall` to force evaluatuion (def result (doall (map something some-coll)))
05:31mheldpedestal is the cool new hotness with respect to web frameworks in clojure-land?
05:36mpenetmheld: depends, it's one option if you need to do server push among other things. http-kit is also worth a look (ring compliant, easy to learn compared to pedestal)
05:48Apage43man
05:48Apage43synthread just made my day
06:15turbopape /msg Chanserv recover #emo.tn
06:16RaynesStrrrrrrike one!
06:20noidiambrosebs, I forgot to reply on the mailing list, but anything that shaves time off core.typed startup is a plus. who cares about 10MB these days :)
08:35noidiIn this blog post Stuart Sierra uses a var to hold the instance of the development system. Do you know if there's a reason why he's not using an atom instead? http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
08:36noidiusing vars like that feels dirty to me
08:37manutterHe only uses it to start and stop the system right?
08:37noidiyes
08:38noidiI think an atom would better communicate that the value is going to change
08:38manutterI think it's just a convenience. The "dirtiness" of global vars comes from bugs that arise when different parts of the system change the global in different ways
08:38manutterbut the system in this case doesn't even know about the var
08:38manutterIt's only ever referenced from the repl, by the developer.
08:39noidiyeah, maybe it's ok to think of it as a constant
08:39manutterI think of it as a developer tool rather than as code
08:39noidiI'll still use an atom in my adapation of his workflow, though :)
08:40manutterSure, that would work just as well
08:45sheldonhhow can i use something from clojure.contrib in a repl started with lein repl? i tried (require 'clojure.contrib) and got FileNotFoundException from the repl and a big history lesson from google. i'm trying to use (profile ...)
08:46noncomsheldonh: clojure contrib is no more since afaik clojure 1.3
08:46noncomnow it is spread among differnt libraries
08:46noncomsheldonh: this page may be of use to you: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
08:47sheldonhnoncom: sadly not. it doesn't document where clojure.contrib.profile went
08:48sheldonhnoncom: or maybe it does. if it has no "Migrated to" and "Status:", maybe that means it was just thrown away?
08:48noncomsheldonh: is it a profiling lib?
08:49sheldonhnoncom: yeah. http://richhickey.github.io/clojure-contrib/profile-api.html
08:49noncomsheldonh: i guess that the libraries which are not shown where to find, have gone. my best guess is that currently threre are better altrnatives
08:49noncomtry https://github.com/ptaoussanis/timbre
08:50noncomthis is a profiling lib that many ppl would advice to you today...
08:50noncomi did not use it yet, though
08:51sheldonhnoncom: i was hoping for something "built in" because i haven't yet learned how to use third party libraries. but i guess now's the time. thanks!
08:51noncomsheldonh: do you use leiningen?
08:52sheldonhnoncom: yup
08:52sheldonhnoncom: does it automagically download project.clj deps? :) :) :)
08:52noncomsheldonh: so you simply add [com.taoensso/timbre "2.6.1"] to your dependencies
08:52noncomand run "lein deps"
08:52sheldonhyay! npm for clojure :)
08:53noncomyes, all will be downloaded automatically.
09:08noncomis there a way i can get to know arity (arities) of an existing function?
09:10llasramnoncom: AFAIK, the closest you can get is by looking at the :arglists metadata on a function-holding Var.
09:10noncomnice, i will try!
09:13noncomalso, do you maybe know, if i create a proxy, and in one of the implemented methods i need some function. so i have 2 options: 1) define the function right inside the proxy or 2) refer to a function defined elsewhere. My question is: does the function defined in way 1 go into every proxy instance, taking up memory?
09:22TimMcnoncom: Something just occurred to me about your research project: If you want a different ns form, fork Clojure.
09:37AWizzArdCompojure/Ring question: I am using core.typed and want to write a type annotation. defroutes returns a function. My question: what type is the input parameter, and what type is the output parameter?
09:38AWizzArdLet’s say I have this: (defroutes foo (GET "/" [] "<h1>Hello World</h1>")) — what is the argument to foo, so that it will return me a map with that html in the :body?
09:40ordnungswidrig(foo {:request-method :get :uri "http://example.com/&quot;})
09:42AWizzArdordnungswidrig: kthx
09:51noncomTimMc: yeah, I thought about that. I could get that functionality, although that would mean that the original Clojrue still lacks it.. but I could make the tests on that forked version.. I also thought that maybe it is not the ns form that has to be tweaked, but maybe I have to write a custom replacement for (require)
09:52noncomthat would allow staying with the mainstream clojure also
10:54coventryIn emacs, using ritz-nepl, C-c C-b (nrepl-interrupt) interrupts any running process, but does not return me to the REPL prompt. Anyone know a workaround for this?
11:12noncomis someone familiar with ñäî-håtp here?
11:12noncom*clj-http
11:12callennoncom: just ask your question man
11:13callenI need a Taser-over-TCP/IP protocol so I can zap people that ask to ask.
11:13noncomhow do i get the list of available content types? (the prefabs which have keyword alias)? and can i use pain strings if i don't find the one i need, like "'application/x-www-form-urlencoded"?
11:13noncomi looked into sources, but can't find
11:14noncom(client/post) refers to some (request) func, i cant find the source of..
11:14noncomsilly but..
11:14noncomoh damn
11:14noncomlooks like i got it
11:15noncomthere is no explicit :use or :require of the namespace that it comes from. instead, it is referred to somewhere in the middle of the code, by its fulyl qualified name
11:16noncomhow strange
11:26invisplease help me to write function that do this: https://www.refheap.com/18231
11:27inviswaste about 3 hours and still cant create a good decision for that
11:29opqdonutuse recursion
11:29opqdonuton the second parameter
11:29opqdonut(defn combs [xs n] (if (zero? n) [[]] (for [x xs y (combs xs (dec n))] (vec (cons x y)))))
11:30bbloomalso, consider lazy-seq
11:31invisto: <opqdonut> Thanks a lot
11:31Anderkentor use clojure.math.combinatorics/cartesian-prudct
11:32opqdonutyeah, that would be neater
11:32Anderkent(apply clojure.math.combinatorics/cartesian-product (repeat 2 [1 2 3]))
11:32Anderkent((1 1) (1 2) (1 3) (2 1) (2 2) (2 3) (3 1) (3 2) (3 3))
11:33coventryI came across a let binding of "_", which isn't used in the body. There's magic to binding "_" in a let-form, right?
11:33TimMcNo magic.
11:33coventryThanks.
11:33TimMc_ is simply convention for "not used"
11:33Anderkentcoventry: that's just a way of evaluating stuff for side effects in middle of let
11:34Anderkent_ is a name as any, but people pick it because it's the convention for unused
11:34TimMcIn some languages (and in some Clojure macros or DSLs) it *is* special, but the meaning is still "don't care" or "unused".
11:35coventryAnderkent: But it is the final binding in the form, so it could go more simply in the body. Maybe there were other bindings after it at one stage. https://github.com/clojure/jvm.tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer.clj#L840
11:35callenI use _ for things I'm doing for side effects or where I don't care about the returned value in general.
11:35Anderkentcoventry: I think it's more of a 'this *has* to happen before expr-ast is used'
11:35callenespecially in let bodies.
11:35Anderkentand thus makes sense to put it in the let where expr-ast is defined
11:36coventryOK, thanks.
11:49cjfriszIs there an easy way to run the core.typed type checker as part of my cljs build, i.e. by modifying my project.clj?
11:51bbloomcjfrisz: i'm trying to convince ambrosebs that more people will use core.typed if `lein check` worked.
11:51callenbbloom: or if it was faster.
11:51cjfriszbbloom: That's pretty much exactly what I want
11:52callena continuous type checker ala lein prism would be cool.
11:52Anderkent(deftest passes-checks (typed.core/check-ns)) ? :P
11:52bbloomcjfrisz: it's part of my master plan to convince more people that types are like unit tests. you can measure type coverage the same way you measure test coverage: in both cases you don't necessarily need 100% coverage
11:53callenI'm a little dubious of anything that places burdens on callers though.
11:54cjfriszbbloom: Ambrose mentioned to me that core.typed for cljs integration isn't quite up to par, so is it a fool's errand to try using it right now?
11:54ambrosebscjfrisz: There's nothing at the moment. Also CLJS support is pretty dodgy atm.
11:54bbloomAnderkent: that's what ambrosebs told me too :-P but `lein test` should be renamed to `lein unit` and then test should be an alias for `check` and `unit` :-)
11:54bbloomcjfrisz: there's your answer ^^
11:54ambrosebscjfrisz: If you're playing around right now I'll give myself a quick refresher of what I've actually implemented.
11:55cjfriszOh sweet…it probably would have been a good idea to check if ambrosebs was actually here
11:56ambrosebscjfrisz: Well, tell me what happens if you open up a clojure REPL and run (cljs.core.typed/check-ns 'your.ns)
11:56AnderkentFileNotFountException! (.. I'll show myself out)
11:57ambrosebsAnderkent: are you talking about core.typed?
11:57ambrosebsoh right :)
11:57cjfriszambrosebs: I just started adding types a few minutes ago, so let's see if I'm far enough for that to work :-)
11:57bbloomambrosebs: the joke was that your/ns.cljs was not found :-P
11:57ambrosebsLOL
11:58mheldwhat's the de-facto way to get views set up with clojure
11:58mheldI've got a bunch of models and I want to map them to the RESTey views I've got
11:58callenmheld: Ring/Compojure.
11:58callenmheld: need to get a little more specific about what you mean by "views" though.
11:58callenAre these API endpoints or hooman-facing HTML pages?
11:59mheldcallen: I come from the rails world
11:59AnderkentActually, it wouldn't be a FNFE, but I was too lazy to check what it actually is. (IllegalArgumentException :P)
11:59mheldI'm looking for human-facing pages
11:59callenmheld: http://www.luminusweb.net/
11:59ambrosebscjfrisz: make sure you're using macros from cljs.core.typed. I haven't documented anything yet :)
11:59mheldcallen: gracias
12:00mheldit looks like the philosophy of clojure is to be sinatra-ey -- are there any monolithic rails-ish frameworks out there?
12:00Anderkentmheld: as in web templates? envlive is cool.
12:00mheldI looked at pendulum?
12:00mheldpedestel
12:00mheldbut it didn't conform to ring, and that made me sad
12:01mheldAnderkent: the whole your-models-can-be-resources-and-talk-to-controllers-that-have-7-methods thing
12:01cjfriszambrosebs: it may take me a few minutes to get myself un-noobed enough to give you useful info
12:01bbloommheld: not to discourage you from using clojure, b/c clojure is freaking awesome, but the best monolithic framework out there… is rails :-P seriously, no sense reinventing it
12:02mheldbbloom: heh, I don't see why there couldn't be a monolithic framework in clojure!
12:02bbloommheld: it's just not in this community's DNA
12:02mheld(I'm actually rewriting this rails project in clojure because I'm giving up on trying to get rails+activerecord to work with this propriatary database)
12:03bbloommheld: your best bet is to write your API/backend in clojure and then wrap a rails frontend around it
12:03Anderkentmheld: pedestal is probably your best bet if you really need it to be monolithic. But in general ring+compojure+enlive has worked for me
12:03mheldbbloom: that's silly!
12:03Anderkentbut I've never liked the rails magic, so might be skewed
12:04ambrosebscjfrisz: the only documentation for CLJS atm is in the tests. eg. https://github.com/clojure/core.typed/blob/master/src/test/cljs/cljs/core/typed/test/dnolen/utils/dom.cljs
12:04ambrosebsIIRC that type checks.
12:05bbloommheld: if you're porting a substantial piece of code, the best thing to do is to change as few things at a time as possible
12:06mheldbbloom: it's not substantial
12:06mheldbbloom: and it'll probably be scrapped by the end of the week
12:06mheldI'm just POCing something
12:06bbloommheld: in that case, the sinatra-ish frameworks in clojure land are the way to do
12:06bbloomthey are super simple
12:07mheldwell, it would be un-substantial if I could just (defresource MODEL [:index :show :new :create]) or something
12:07mheldand nest resources
12:07mheldthat'd be super choice
12:07Anderkentwith compojure you can define routes per resource and nest those pretty easily
12:09mheldAnderkent: true
12:10cjfriszambrosebs: It says it can't find the cljs file's namespace in the classpath
12:10cjfriszambrosebs: https://gist.github.com/cjfrisz/14f2d06882fd53a0dd5f
12:10cjfriszambrosebs: feel free to assume I've missed something obvious wrt cljs; still getting the hang of it vs. Clojure
12:11ambrosebscjfrisz: I've got this in my project.clj
12:11ambrosebs :source-paths ["src/main/clojure"
12:11ambrosebs "src/main/cljs"
12:11ambrosebs]
12:11cjfriszambrosebs: good call
12:12ambrosebs(I'm just as clueless as you right now)
12:12ambrosebsI just keep dnolen on chat :)
12:12bbloomambrosebs: should start bugging cemerick too, since he's taken over lein-cljsbuild
12:13bbloomi trust in chas to just make my life easier at every turn
12:13ambrosebsbbloom: didn't know that. nice.
12:13bbloomambrosebs: https://github.com/emezeske/lein-cljsbuild/commits/master
12:14ambrosebsbbloom: dnolen has the added bonus of "sure, I'll add that to cljs.compile"
12:14bbloomambrosebs: true, but it's a lot more work to convince dnolen of anything :-)
12:14ambrosebs:D
12:14ambrosebsnice, cljsbuild is in good hands.
12:17cjfriszambrosebs: I'm starting out trying to type a function that takes 2 numbers and returns them in a vector
12:17cjfriszambrosebs: It seems that something's unhappy with me trying to use Number in my annotation: https://gist.github.com/cjfrisz/6bf9e1a088e030c7173a
12:17johnmn3I'm getting NullPointerException on lein cljsbuild once. Then I run it again and it compiles in around 120 seconds. But when I refresh the page, nothing loads. the console says: Uncaught TypeError: Object #<Object> has no method 'run'
12:17ambrosebscjfrisz: try number.
12:18johnmn3and my run method is the method that kicks off from the html into my cljs, obviously
12:18johnmn3but the stacktrace is weird: java.lang.NullPointerException: at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
12:19johnmn3which continues into clj_stacktrace
12:19johnmn3I'll just post up the stack trace
12:20mheldI'd also kill for luminus to have a 'lein luminus generate model THING foo:string bar:text'
12:20mheldthat'd be nice
12:21johnmn3isn't this a strange stack trace: https://www.refheap.com/18232
12:22johnmn3might be a bug in the compiler?
12:22cjfriszambrosebs: Let's take a step back and acknowledge that this is my first time trying to use core.typed…how would I write the annotation for an arity 2 function that takes two number and returns them in a vector?
12:22ambrosebscjfrisz: [number number -> '[number number]]
12:22cjfriszambrosebs: Ah, probably misusing Vector*
12:23johnmn3cause I've been removing, slowly, some of the recent changes to my cljs and it's not fixing it. there's no indication of error in my file.
12:23Anderkentjohnmn3: might be. Seems like it's trying to clean up some cause exception and fails
12:23Anderkentsee lines 19-22 in that stacktrace
12:23ambrosebscjfrisz: IIRC (Vector* number number) is the same as '[number number]
12:23ambrosebsis that how you're using it?
12:23cjfriszYes, and it gave me the same error
12:23cjfriszAssertionError Assert failed: No check-fn bound for rest type
12:23cjfriszcheck-fn-method1-rest-type clojure.core.typed.check/check-fn-method1 (check.clj:2953)
12:24R_MacyHow do you introspect a namespace and see all of the available functions?
12:24ambrosebscjfrisz: which core.typed version?
12:24cjfriszambrosebs: 0.2.1
12:24R_Macybumbling around on the internet and in the manual, I don't see anything obvious
12:24johnmn3so frustrating! I've run lein cljsbuild clean. Run lein cljsbuild once ... it fails... run it again, it succeeds in 120 seconds. and again, the js doesn't load in the browser.
12:24R_Macy(in a repo, to be more specific)
12:25R_Macyrepl*
12:25AnderkentR_Macy: (keys (ns-map 'ns))
12:25Anderkentit will give you more than just the functions, but oh well
12:26johnmn3i'm also on java 8 on an ARM processor. Starting think it's not worth the edge cases for development.
12:26AnderkentR_Macy: actually, use ns-publics not ns-map
12:26Anderkentunless you want the private symbols too
12:26R_MacyAh cool thanks Anderkent
12:26ambrosebscjfrisz: thanks.
12:26R_MacyI don't just public symbols, trying to see avail functions for a library I'm planning to use :)
12:27ambrosebscjfrisz: I've actually had my CLJS tests commented out while I was waiting for a new version of CLJS.
12:27bbloomR_Macy: (find-doc "ns-")
12:27ambrosebscjfrisz: I shall resurrect them.
12:27bbloomcjfrisz: talk about service. you should have ambrosebs just write all your type annotations too!
12:28Anderkentbbloom: ha, assuming they have docstrings :D
12:28bbloomAnderkent: seems like they do....
12:29benkayi've got time for one video this morning: should it be RailsConf 2012 Simplicity Matters or Strange Loop 2011 Simple Made Easy?
12:29silasdavisis there a core function to get the values from a map?
12:29Anderkentsilasdavis: vals
12:29cjfriszbbloom ambrosebs: I know! it's like having the best automatic type recovery pass over my code!
12:29bbloomsilasdavis: http://clojure.org/cheatsheet
12:29bbloomAnderkent: trying to teach people to fish too :-)
12:29juliangindican anyone give me some guidance regarding returning multiple values from a function and than saving them to local variables within another function
12:30silasdavisthanks, did try some fishing, assumed 'values'
12:32Anderkentjuliangindi: you will have to return a collection then destructure it on the receiving side. For example (defn foo [] {:a 1 :b 2}) and then (let [{:keys [a b]} (foo)] ...)
12:33juliangindiAnderkent: Awesome, thanks!
12:35cjfriszjuliangindi: here's another example: https://gist.github.com/cjfrisz/6414524
12:36juliangindicjfrisz: how do you get away with passing in too few arguments without using something like 'partial'
12:37cjfriszjuliangindi: Because I free-handed that and made a mistake :-)
12:37cjfriszI didn't make that mistake when I double-checked it in the repl
12:37juliangindicjfrisz: ohh haha! still a good example, thanks!
12:38cjfriszjuliangindi: I updated it with the fix
12:41cjfriszAlthough I suspect that multiple return values via destructuring is less efficient than using values/call-with-values/let-values in Scheme, I appreciate how much simpler it is in Clojure
12:41cjfriszThat is, assuming a good implementation of multiple return values in Scheme
12:42cjfriszambrosebs: So is that a core.typed bug that I'll need to wait on before continuing?
12:42cjfriszEr…I should say cljs.core.typed bug?
12:43ambrosebscjfrisz: probably. I think type checking any function body is broken.
12:44cjfriszambrosebs: alright, I'll probably leave my typed code in a branch then
12:45cjfriszI had been thinking about testing out core.typed with this little game even before I had two 10+ minutes bug track-down sessions yesterday that wouldn't have happened if I had types :-)
12:45ambrosebscjfrisz: FWIW the types could stay there and have no effect.
12:46cjfriszambrosebs: true, I should have thought of that
12:46clgvin datomic how do I add an entity to a "many", "ref" attribute and not replace the previous entity, i.e. I want to build up a list incrementally
12:46silasdaviscan I do better than: (apply concat (vals {:a [3] :b [6 4 6]}))
12:47benkayclgv will you pastebin your schema?
12:47Anderkent]awaysilasdavis: that looks good to me
12:47silasdavisis (mapcat last {:a [3] :b [6 4 6]}) better?
12:48Anderkent]awaymake that (mapcat val ...)
12:48ambrosebscjfrisz|away: :)
12:48coventryambrosebs: Since jvm.tools.analyze/macroexpand is piecing the macroexpanded form together from the results of eval'ing the input, there is no way to get back individuating metadata on the inputted symbols, is there? E.g. (def n #(fn [& args] 1)) (-> '(do (n) (^{1 2} n)) macroexpand last first meta) returns {1 2}, but replacing macroexpand with jvm.tools.analyze/macroexpand results in nil instead.
12:48silasdavisAnderkent]away, ah nice, thanks once again
12:49benkayclgv: [:add ?e :listy-ref ?ref-entid] maybe?
12:50ambrosebscoventry: that might be a bug.
12:50ambrosebscoventry: I imagine the metadata should show up in the AST, so it should be easy to put it back into the form.
12:50coventryambrosebs: Oh, it would be so great if there were a simple fix for that.
12:51ambrosebscoventry: I'll have a quick look.
12:51coventryThanks, ambrosebs.
12:51ambrosebscoventry: it's actually reconstructing an analyzed form, not an evaluated form.
12:52clgvbenkay: I used {:db/id experiment-id, :experiment/instance-runs instance-run-id} so I see only the last value
12:53benkayclgv: if you pastebin your schema and the query that's not working i'd love to take a look at it
12:53benkayclgv: (or, you know, subset of schema...)
12:54clgvbenkay: the schema gets generated by another lib. what is the easiest way to query it?
12:55benkayclgv: generate it at the repl?
12:57benkayclgv: i'm imagining a situation where because your schema isn't available for inspection you're having trouble reasoning about application logic
12:57clgvbenkay: I tried (d/q '[:find ?i ?t ?c :where [?e :db/ident ?i] [?e :db/valueType ?t] [?e :db/cardinality ?c]] (d/db conn)) but I'll need to resolve the ids
12:58clgvbenkay: well my problem is that I do not know how to build a list incrementally. I just assumed normal add would work that way for :db.cardinality/many
12:59benkayhas in my experience
12:59benkaygotta run, apologies for being useless
13:10benkayclgv: running that same query in my local instance returns stuff, but not I think the useful stuff :(
13:11clgvbenkay: consider :experiment/instance-run as many ref attribute do I add components to it by adding {:experiment/_instance-run expid, ...}?
13:11ambrosebscoventry: I don't know where the metadata goes..
13:12benkayclgv: that's what i would do. does that not work for you?
13:12coventryambrosebs: No worries. I think it might be a fairly tricky problem. Thanks for taking a look.
13:13benkayclgv: i think you'd have to first acquire the entid for the experiment and then add a ref attribute to the experiment entity pointing to the instance-run entid
13:13clgvbenkay: seems not. just tried that manually
13:13ambrosebscoventry: cool, yea maybe there is some subtle interaction between reading and analysis.
13:14clgvbenkay: the schema already exists
13:14benkayclgv: not talking about the schema.
13:14ambrosebscoventry: I just can't find an AST field in clojure.lang.Compiler for local Var metadata.
13:15clgvbenkay: is there no description available online how to handle :db.cardinality/many attributes?
13:16ieureI'm having issues with serving static resources in a war file (generated with `lein ring uberwar') from tomcat.
13:16coventryambrosebs: I think I was only adding metadata to the symbol in the list, in which case the problem might be that the analysis is dropping the symbol in favor of the var it represents.
13:16ieureIt works fine with `lein ring server' or an embedded Jetty, but throws "java.lang.NullPointerException: Handler returned nil" under Tomcat.
13:17ambrosebscoventry: that makes sense.
13:17ieureAny idea what might be wrong here? I see the files on the path in the .war
13:17ambrosebscoventry: this kind of thing works nicely in CLJS.
13:17ambrosebsanalyzer is much nicer.
13:18coventryambrosebs: Oh, that's interesting. I was thinking to primarily target cljs in the end anyway, but I thought things would be simpler to experiment with in clojure.
13:19ambrosebscoventry: No, definitely use CLJS to experiment with analysis.
13:20benkayclgv: here's a thing that does cardinality/many refs
13:20benkayclgv: http://paste.lisp.org/display/138732
13:20coventryambrosebs: OK, thanks. But before I go that route, is hacking the compiler to put the symbol metadata in the AST likely to be as much of a bear as it sounds?
13:20clgvbenkay: thx. I was googling myself the last 15mins ^^
13:20clgvbut found nothing suitable yet
13:20benkayclgv: I strongly recommend working through Day of Datomic.
13:21silasdavisI have function with a base return value of true or false if a data structure is in a valid format
13:21silasdavisI'd like to pass the invalid entries out as well
13:21benkayclgv: that repo managed to bang some insight through this rock i call a skull
13:21ambrosebscoventry: I wouldn't recommend it :)
13:21silasdavisI'm considering throwing an exception, returning a hash, or implementing an error monad
13:21clgvbenkay: humm is there some guide how to work through? manually I tried to find the things I need in there but not with much success yet
13:21coventryambrosebs: OK, thanks. :-)
13:21silasdavisdoes anyone have any recommendations?
13:21ambrosebscoventry: could be fun/educational though.
13:22ambrosebscoventry: probably only a few lines.
13:22ambrosebsyou'd need your own version of tools.analyzer too.
13:22benkayclgv: open up example in one window, transcribe it by hand into your editor. if you get stuck, go to a different example.
13:22ambrosebsor... no actually emit-form is a multimethod, so you'd just need to make 1 new multimethod for :var.
13:22ambrosebssick :)
13:23clgvbenkay: humm right
13:23benkayclgv: i've not had much success just looking for specific snippets to solve my problems. far more productive for me (in learning both clojure and datomic) has been to work at developing holistic understanding
13:24clgvbenkay: well my import managed to import 500 entities but didnt update the many ref attribute and then died with a TimeoutException ... :(
13:25coventryambrosebs: Yeah, I figured I'd have to make a small change to tools.analyzer, too. Do you have any suggestions about which parts of Compiler.java to read, if I want to have a go at this?
13:25benkaypretty sure we just went screaming through my personal knowledge horizon :(
13:25ambrosebsFind VarExpr, I assume there's a "parse" method on that.
13:25coventryThanks.
13:25ambrosebsAdd an extra field to VarExpr for local metadata.
13:26coventryGreat, I'll be in touch if I succeed. :-)
13:27ambrosebscoventry: great
13:27clgvbenkay: oh, did not know `touch` yet...
13:28clgvbenkay: do I need to specify both parts of a relation in a transaction to establish it?
13:28benkayclgv: that is indeed a thing.
13:28benkayclgv: what do you mean by both parts of a relation?
13:29clgvbenkay: like in the component_attributes.clj example
13:29benkayclgv: db.type/ref is inherently bidirectional
13:29ambrosebscoventry: looks like clojure.lang.Compiler.AssignableExpr.Parser is what you want to tinker with.
13:29makkalothi, i'm trying core.typed when i (:require [clojure.core.typed :as t]) and then t/All or t/U it says can not find them but i'm able to t/cf , any ideas ?
13:29clgvbenkay: oh I meant that the target entity is in the transaction as well
13:30coventryThanks, ambrosebs. I'll take a look.
13:30ambrosebsmakkalot: All and U are special, they are never qualified.
13:31makkalotambrosebs, so how can i use them ?
13:31ambrosebsif you have a type called All, use a qualified symbol.
13:31ambrosebsif you want to use *the* All, just use (All [x]...)
13:32clgvclgv: no seems to work without.
13:32clgvweird...
13:34benkayclgv: it seems so?
13:34clgvit does in the day-of-datomic case. it did not in my example.
13:35benkayclgv: well hang on, can you shoot me a line number or three in component_attributes.clj that demonstrate what you mean by both parts of a relation?
13:35clgvbenkay: I phrased that badly ;)
13:36benkayclgv: gotta step away again for a few
13:38makkalotambrosebs, thanks
13:38ambrosebsmakkalot: np
13:48cjfriszambrosebs: how do I define a type shorthand/alias, i.e. (type-alias my-type (Vector* Type Type))?
13:48ambrosebs(def-alias MyType "mydoc" Type)
13:49ambrosebshttp://clojure.github.io/core.typed/#clojure.core.typed/def-alias
13:49mheldanybody here use haml with their clojure webapps?
13:49coventryambrosebs: Do you know what the distinction between VarExpr vs TheVarExpr is about? TheVarExpr has a Parser class which pulls a Var out of the form, whereas VarExpr doesn't seem to have any kind of parser in its inheritance/composition hierarchy.
13:50ambrosebscoventry: semantically it's the difference between a and #'a.
13:50coventryThanks.
13:51ckirkendallHas anyone ran into this exception when doing clojurescript? clojure.lang.Namespace cannot be cast to clojure.lang.Named
13:51ambrosebscoventry: isn't the parser for VarExpr in AssignableExpr?
13:53timvisherhello all
13:53juliangindihello there
13:53cjfriszambrosebs: didn't notice your reply until just now; thanks!
13:53otherapricotwhen using Enlive, is it possible to select the *parent* of a node matching some criteria?
13:53ambrosebscjfrisz: :)
13:53dnolencjfrisz: btw, so are you working on a fun project that involves CLJS? :)
13:53timvisherhappy labor day to the 'mericans
13:54cjfriszdnolen: Yes
13:54sandbagsafternoon
13:54dnolencjfrisz: nice!
13:54cjfriszHad an idea for a game kicking around in my head, and I needed some application development in my life in addition to the platforms stuff I do at work
13:54coventryambrosebs: AssignableExpr appears to be an interface, and it's not clear to me which of its implementations might contain the parser used for VarExpr. I'm relatively inexperienced, though, might have missed something. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L744
13:55timvisheranyone able to tell me what triggers changing a namespace in the browser repl?
13:55ambrosebscoventry: whoops I was looking at AssignExpr :)
13:55coventrytimvisher: in emacs, C-c M-n will eval the namespace form of the current buffer.
13:56timvisheri'm used to `C-c C-l`ing a file and having all the functions loaded into the image in the namespace declared at the top
13:56timvisherbut in the browser repl, this doesn't seem to happen
13:56timvishercoventry: thanks
13:56ambrosebscoventry: I guess search for "new VarExpr" and see what's creating it?
13:57timvishercoventry: is there any way to tell what namespace I'm in?
13:57timvisheri.e. evaling *ns* in jvm clojure
13:57coventryambrosebs: Thanks, I was about to go through all instances of VarExpr in the file. "new VarExpr" is more specific. :-)
13:57ambrosebscoventry: hehe
13:58timvisheralso, is there a writeup anywhere of the differences between clojurescript namespaces and clojure namespaces?
13:58timvisheri keep hearing people mention that clojurecript doesn't support true namespaces but never an articulation as to why
13:59ambrosebstimvisher: I'll tentatively point out that the current namespace is kept in cljs.analyzer/*cljs-ns*
13:59ambrosebsif you can get to it from a browser repl (I have no idea)
13:59coventrytimvisher: Sorry, missed that you're talking about clojurescript. I asked about *ns* etc. in clojurescript (actually pedestal) a couple of weeks ago. There doesn't seem to be a good way of doing it at the moment. (See dnolen's answer a couple of responses down.) http://clojure-log.n01se.net/date/2013-08-11.html#19:26
14:00timvisherambrosebs: yeah, it doesn't look like it's defined in the browser repl :()
14:00coventryambrosebs: (Regarding the compiler) Aha, I think I want analyzeSymbol.
14:00timvishers/:()/:(
14:01ambrosebstimvisher: :)(
14:01ambrosebscoventry: sounds about right.
14:01bbloomtimvisher: quite simply, clojurescript does not have a data type which represents namespaces
14:01bbloomtimvisher: …. at runtime
14:01timvisherlol. that's actually a great emoticon
14:02bbloomtimvisher: there is a divide between the compiler on the JVM and the running code in the JS engine. namespaces only exist at compile time. at runtime, they are just plain old javascript objects
14:02timvisherbbloom: ok. so what am i doing when i eval `(in-ns 'some-ns)` in a brepl?
14:02bbloomtimvisher: you're sending an instruction to the repl implementation
14:03timvisherbbloom: so why would that be any different than loading a file with the `(ns …)` declaration at the top?
14:03bbloomtimvisher: realize that clojure, and indeed most lisps, are two-stage systems. one stage is compilation & the other is evaluation. on the JVM, both of those stages live on the same host & can share objects. in CLJS, the stages are stratefied across a host boundary.
14:04bbloomtimvisher: the ns directive is not special in clojure: it gets evaluated to code which creates namespace objects dynamically. in clojurescript, it's a special form that is analyzed at compile time
14:04timvisherok
14:04bbloomtimvisher: the in-ns function isn't actually defined in cljs. the REPL is analyzing your input and giving a directive to the compiler
14:05bbloomthat's a repl feature, not a runtime feature
14:05bbloomunlike clojure, where in-ns is an ordinary function
14:05bbloommake sense?
14:05timvishergot it, so in cljs i should be in the habit of using in-ns to change between namespaces as i move around in my buffers or at the repl. there's really no analog at the moment to simply being in the ns at the top of the file?
14:05timvisherbbloom: i think so. :)
14:06timvisherlol, as much as i ever get anything.
14:06bbloomtimvisher: just pretend that clojure.core was divided in to two namespaces: clojure.compiler and clojure.runtime
14:06bbloomtimvisher: clojurescript only has clojure.runtime
14:07bbloomtimvisher: namespaces are part of clojure.compiler
14:07bbloomtimvisher: however, since that divide doesn't really exist, it's a little less clear what works how on which side of the boundary
14:07cjfriszambrosebs: seems like def-alias causes a runtime JS exception
14:07cjfriszTypeError: 'undefined' is not an object (evaluating 'cljs.core.typed.def_alias_STAR_')
14:07timvisherbbloom: and in this case clojure.compiler is in java and clojure.runtime is in javascript and the 2 can't communicate.
14:07ambrosebscjfrisz: oh, forgot you were using CLJS :)
14:07cjfriszambrosebs: haha
14:08ambrosebscjfrisz: tell me these things xD
14:08bbloomtimvisher: right
14:08cjfriszSo that's a known problem?
14:08bbloomtimvisher: so there is cljs.repl that approximates a subset of clojure.compiler via talking to the compiler remotely
14:08ambrosebscjfrisz: might just be not yet implemented.
14:08timvisherbbloom: got it. that's much clearer. thanks very much.
14:08cjfriszambrosebs: Should I be filing tickets on these things?
14:09ambrosebscjfrisz: that would be awesome.
14:09cjfriszambrosebs: Will do :-)
14:09ambrosebscjfrisz: thanks!
14:09timvisherso my take away at this point is that the only reliable way to switch `ns`es is to use `(in-ns …)`.
14:09futileWho was that person who did a talk and put their slides online that mentioned CounterClockWise and the other plugins, and explained that tools.reader rips out source-location info but you can put it back?
14:10coventryfutile: Christophe Grand, sjacket.
14:10futileBecause tools.reader doesn't keep the source-position for each form in every atom type.
14:10futileAh! Thanks coventry.
14:12coventryBut actually, tools.reader is pretty good about decorating the tree it returns with source location data, so you might be talking about someone else.
14:15bbloomcoventry: tools.reader only stores that info in metadata afaik, which means it can't work for numbers, keywords, etc
14:16cjfriszdnolen: JIRA says you fixed the infinite loop for circular dependencies in the CLJS compiler, but I set myself up to test it yesterday and got a stack overflow
14:16coventrybbloom: Right, thanks.
14:17futilebbloom: yeah, that's why I can't use it.
14:17futilebbloom: fortunately it shouldn't be that difficult to write an efficient/fast recursive-descent parser for Clojure in Clojure, right?
14:17bbloomfutile: have you seen https://github.com/cgrand/sjacket
14:18cjfriszAnd by "set myself up," I mean that I had an object hierarchy that I needed to fix, and decided to see what happened when I introduced a circular dependency
14:18futilebbloom: I got scared away by "Sjacket is still in its infancy"
14:18timvisherso i just did this. i evaled `(in-ns 'x)`, and then evaled another form with a function defined in x and got a `Cannot call method 'call' of undefined` error because what tried to get executed was `other-ns.f`
14:19timvisheri guess there is a slight delay in the switching of the namespaces?
14:19bbloomfutile: *shrug* like i said, it's LL(1) so pretty easy to parse. see LispReader.java in the clj source
14:19timvisherbecause i executed it again a second or 2 later and got the right results
14:19bbloom~1kloc
14:19clojurebotExcuse me?
14:19futileclojurebot: you're excused
14:19bbloomfutile: and that does lots of extra stuff too, like syntax quote, which you won't need
14:19clojurebotTitim gan éirí ort.
14:20coventryfutile: tools.reader is pretty close already. I was planning to work around this issue by hacking on it. (I already have a version of it which turns off syntax-quote.)
14:20futilebbloom: oh good that confirms what I was thinking, as I don't want to pull in something that's overkill
14:21futileThe only thing that makes writing a parser a little scary for me is that I don't know *all* the syntax things you can do. Like, doesn't Clojure have literal syntax for longs (20L) and imaginary numbers?
14:21bbloomfutile: it's all in LispReader.java
14:21futilebbloom: then I'll check it out, thanks :)
14:22futileWait, https://github.com/clojure/clojure is the official repo?
14:23coventryfutile: Yes. http://clojure.org/downloads
14:24futileOkay thought so. I guess it threw me off because I thought that was just a mirror, but I saw it was mentioned in that downloads page.
14:30cjfriszambrosebs: Here's the ticket for def-alias http://dev.clojure.org/jira/browse/CTYP-39
14:30ambrosebscjfrisz: thanks!
14:30cjfriszambrosebs: I forgot the other issue I was having, and my scrollback in IRC isn't going far back enough for me to see it
14:31ambrosebsdon't worry about it.
14:31futilelol, today's log for http://logs.lazybot.org/irc.freenode.net/%23clojure downloads instead of opens in-browser
14:32coventryIn the clojure source code, running "ant" twice seems to result in a complete rebuild. (2 minutes on my machine) Is there any way to make it more selective about what needs to be recompiled and what tests need to be run?
14:32mheldhey guys, can I have one of y'all look over a macro that I'm writing up? here's what I have so far http://pastie.org/private/ntsqnw9g4jtnvdnaqymgfq (macroexpand-1 (defcrud device [:id :first_name])) gives me a not-so-useful error message -> CompilerException java.lang.RuntimeException: Unable to resolve symbol: devices in this context, compiling:(/private/var/folders/c_/2j9hpl0n0fn3v59cy4nvkms80000gn/T/form-init6654342976921486472.clj:1:16)
14:32mheldam I not unquoting something right?
14:33coventrymheld: Can you show the call to the macro which is generating the error?
14:33mheldcoventry: (macroexpand-1 (defcrud device [:id :first_name]))
14:34mheld(plural is coming from an inflection library
14:34mheld)
14:34coredhello
14:34coredthis does return true in the repl, (= (list :a :b :c) '(:a :b :c))
14:35coredbut I get an error in 4clojure, am I doing something wrong?
14:35mheldcoventry: could it be because of the way I'm defn-ing?
14:36coventrymheld: I don't know why you'd be getting a symbol "devices" out of that input.
14:36timvishercored: link?
14:37timvisheris there any way i can avoid a full recompile in cljs when adding a previously unreferenced goog component?
14:37mheldcoventry: the plural of device is devices
14:37coventrymheld: I would be looking at defentity.
14:38ambrosebscjfrisz: seems i've broken cljs.typed fairly well in the last few weeks :)
14:38cjfriszambrosebs: Oh, I remember now: function annotations don't seem to work
14:38mheldcoventry: ha, you're right!
14:38cjfriszambrosebs: :-)
14:38coredtimvisher: (= (list __) '(:a :b :c))
14:38coredthat's the question
14:38clojurebotCool story bro.
14:38ambrosebscjfrisz: yea I'm observing that too.
14:38coredI added (= (list :a :b :c) '(:a :b :c)) as I did in the repl
14:38ambrosebsI swear they worked.
14:39cjfriszambrosebs: Like my boss always says, "Bug reports should always make you happy; they're an opportunity to make your software better."
14:39ambrosebslove it :)
14:39Chousukecjfrisz: that depends on the bug report :P
14:39Chousuke"it crashes" is not going to make people happy
14:39timvishercored: can you give me a link to the problem?
14:40coredtimvisher: I think I found the issue, the site is just asking what I have to put in the missing spacce not the entire expression
14:40coredtimvisher: http://4clojure.com first problem
14:40cjfriszChousuke: (Un)luckily I work with people whose bug reports are pretty well explained and indicate that I implemented something wrong
14:40timvishercored: that's what i was assuming you were doing
14:40poutsiChousuke: you could react to that by making the software lethal... which could be interpreted as a subjective improvement on your own part
14:40poutsi;P
14:40timvisher4clojure's random in the order it present problems so i couldn't just visit the site
14:41coredtimvisher: oh, sorry
14:41coredtimvisher: did not know that
14:42coventrycored: Just give the URL in your browser address bar.
14:42timvishercored: no problem. glad you're sorted :)
14:42cjfriszambrosebs: And here's the other ticket: http://dev.clojure.org/jira/browse/CTYP-40
14:42ambrosebsgreat
14:43Chousukecjfrisz: today at my work we got an order for a new server that "should be like the other one"
14:43cjfriszChousuke: haha!
14:43Chousukecjfrisz: nowhere did it specify what other one
14:43mheldcoventry: oh, apparently it's not working because it's not a literal string
14:48coventrymheld: sounds like progress.
14:51mheldI miss define-syntax
14:51callenmheld: really?
14:52mheldyes
14:52cjfriszmheld: agreed
14:54mheldcallen: I also like having a singe namespace for functions and variables
14:54callenmheld: Clojure is a Lisp-1...
14:55mheldI could've sworn it was a lisp-2
14:55callenmheld: ...no.
14:55cjfriszoh thank glob it's not a lisp-2
14:55mheldweird that defn and def are two different things
14:55callenmheld: defn is just sugar for def and fn.
14:55cjfriszmheld: defn is syntactic sugar
14:56mheldoh! I did not know that
14:56callenyou really don't want to mistake the sugar for a representation of the semantics.
14:56mheldthat makes me like clojure even more
14:56callenmheld: it would seem you haven't noticed much, you need to get a book.
14:56mheldcallen: I should get a book
14:56callenmheld: I recommend the one by Chas Emerick et al.
14:56callenmheld: http://www.clojurebook.com/ this one.
14:56callencovers things nicely.
14:57cjfriszmheld: I miss pattern-matching macro transformers and the greater amount of parenthetical delimiters
14:57cjfriszAnd yes I just said I wish Clojure had *more* parens
14:57mheldme too
14:59johnmn3_is there a known combination of cljs release and cljsbuild that work best together?
14:59johnmn3_having a fun time trying to troubleshoot this build problem
15:00callenjohnmn3_: you mean an example project? If so, tonnes.
15:01bbloomcjfrisz: i seriously can't read infix
15:02cjfriszbbloom: ?
15:02bbloomcjfrisz: associativity & precedence is convenient when writing on paper, but fuck me it's so much harder to read w/o extra parens
15:03cjfriszbbloom: Oh, I see what you mean
15:03cjfriszwrt Clojure, forms like 'cond' have fewer parens than in Scheme
15:03johnmn3_I mean I've tried the latest clojurescript release, I've tried "0.0-1843", cljsbuild 0.3.2 and 0.3.3-SNAPSHOT. I've tried using a fresh project directory. I see no obvious syntax errors anywhere. With CLJS 1843 and cljsbuild 0.3.2, the compile just hangs forever. Using whitespace.
15:03bbloomcjfrisz: so there are two factors at play
15:03cjfriszWhich makes it harder to read to me
15:04bbloomcjfrisz: 1) is the elimination of the overloading of parens and 2) is implicit grouping for even numbers of forms
15:04bbloomcjfrisz: the former i quite like, the later i'm still on the fence about
15:04bbloomcjfrisz: but lean towards the side that clojure is on now
15:04gfredericksI'm just digging into core.typed for the first time; I always thought hypothetically that the most promising aspect was type-checking clojure-style "use maps for everything" business code
15:04cjfriszbbloom: I always get cranky when a cond clause gets long
15:04gfredericksin particular using HMap to track what keys are present when
15:05bbloomcjfrisz: yeah, so cond is the WORST CASE for #2
15:05cjfriszbbloom: and core.match has the same problem
15:05bbloomcjfrisz: and so nobody can agree on how to properly indend a cond in clojure
15:05gfredericksbut now I'm thinking it's prohibitively tedious when type-annotating all vars is required
15:05noncom|2how can i create a runnable jar with leiningen, that, upon being launched, gives a clojure repl in one of the namepsaces?\
15:05bbloomcjfrisz: yeah, it's not so bad for let b/c the odd forms are always symbols
15:05R_Macywhat's an idiomatic compjure project structure? any good examples out there?
15:06gfredericksnoncom|2: check out nrepl and reply
15:06noncom|2ok!
15:06cjfriszbbloom: I have code that let-binds cond rhs expressions just so they'll fit on one line and I'm bitter about it to this day
15:06gfredericksnoncom|2: might be able to just use reply, I forget how it works exactly
15:06bbloomcjfrisz: i've just taken to indenting the even forms in a cond
15:07bbloomcjfrisz: my editor & half the community hates it, but it looks much nicer to me
15:07noncom|2i just thought there was some like checkbox in leiningen for that, but if no, then i go for what you say, thanks!
15:07cjfriszbbloom: I think I've done that, too. Feels weird, though
15:07cjfriszbbloom: But better than leaving them at the same indent level
15:07bbloomcjfrisz: in practice, i've found that any time my conds get big and ugly, i just refactor
15:07timvisheris there a shortcut way in closure to get the currently selected radio button in a radio button group?
15:08bbloomcjfrisz: the only time it's really a problem is when there is a lot of context from the lexical closure. otherwise it's easy to extract out helper functions. make a protocol or multimethod
15:08bbloomcjfrisz: in practice, i kinda like it when some constructs become unwieldy quickly, b/c it forces you to refactor
15:08timvishersomething like jquery's `:checked` pseudoselector?
15:08cjfriszbbloom: I definitely see the benefit of that, but somewhere along the line I picked up a policy of only factoring things out if they're used more than once
15:09timvisherlol
15:09bbloomcjfrisz: terrible policy :-)
15:09timvishershould've tried that one first
15:09shaungilchristbbloom: that is seriously a great aesthetic feature
15:09timvisher:)
15:09bbloomcjfrisz: i assign names to basically everything. makes my code a little bit longer vertically (more lines) but far less dense
15:09cjfriszbbloom: I think it's an inherent mistrust for a compiler whose source code is unknown to me
15:10cjfriszbbloom: I don't know how good the inliner is ;-)
15:10bbloomcjfrisz: the inliner is terrible. the jit is pretty good :-)
15:10bbloomcjfrisz: but clearly you should code for humans first & computers second :-)
15:10gfredericksmost of the time
15:10bbloomcjfrisz: not the least of which is yourself. i can never tell what brandon of 1 week ago was up to, unless he refactored :-)
15:11cjfriszbbloom: I think this is one of those "I agree with your position completely but will be unable to extract myself from mine"
15:12cjfriszbbloom: I think I picked it up at work, and if I change my habits, my boss will make fun of me
15:12bbloomcjfrisz: your boss will make fun of you for writing clearer code?
15:12bbloomsounds healthy.
15:13cjfriszbbloom: Actually he probably won't make fun of me, but he'll end up inlining that himself when he takes a pass over the code
15:13bbloomcjfrisz: that just seems insane to me....
15:13bbloomcjfrisz: the JVM *looooves* small methods
15:13cjfriszbbloom: "Oh, this let-bound var is only used once, I'll just put the definition inline"
15:14bbloomcjfrisz: that let bound name is valuable documentation! i spent valuable time coming up with a name for that exrpession
15:14jowaganyb knows the status of multi-reducible reducers? I was thinking about using core.async to implement them, but it may be slow that way
15:14gfredericksbbloom: does the indirection of vars not get in the way of jvm optimization?
15:14gfredericksor are we just talking about locals?
15:14cjfriszbbloom: Again, agree with your position, just have bad habits :-)
15:15bbloomgfredericks: so that's an interesting point
15:15bbloomgfredericks: for locals, it clearly doesn't matter
15:15bbloomgfredericks: for vars, they have dynamic scope & so every var reference is technically an indirection (ie deref) on lookup
15:16bbloomgfredericks: my understanding is that the deref method is tiny & a itty bitty guard expression is put in there & the result is pretty much immeasurable, but i could be very wrong. i dunno
15:16cjfriszWhat's the type for a variable length, homogeneous vector in core.typed?
15:16cjfriszJust realized that I asked "What's the type for…" in a Lisp IRC channel
15:17gfrederickscjfrisz: go to your room
15:17gfredericksactually I'm playing with core.typed right now myself
15:17gfredericksI don't know the answer though
15:20kab3wmI can't seem to figure this out - I have a function that calls 3 other functions (each with side-effects). I do not care about the response. I have wrapped the 3 fn's in a do, but only the last fn is creating a side-effect. I thought that was the purpose of do, is there something else I should be using?
15:20gfrederickskab3wm: nope that sounds super weird
15:20callencjfrisz: Vector* is a heterogenous vector.
15:21callenit's a vector of "Value"s.
15:21gfrederickskab3wm: the first two return lazy seqs that you're not realizing?
15:21gfredericksdo*
15:21TimMcmheld: I could lend you my Clojure book -- it's whichever one Chas Emerick wrote.
15:21gfredericksTimMc: Clojgramming Projucre
15:21gfredericksis the title
15:21shaungilchristI just have to say, though there is some small amount of potential slowdown w/ cljs - the approach of ditching jquery etc. more than makes up for it.
15:21kab3wmgfredericks: nope, if I switch the orders of the fn's each one works as long as it's the last fn in the (do)
15:21mheldTimMc: ha thanks :-)
15:21callenGet this book -> clojurebook.com
15:22mheldTimMc: I'm on the west coast now :-(
15:22callenmheld: TimMc is recommending the same book I recommended. Just geti t.
15:22cjfriszcallen: I thought I could specify a fixed-length, homogeneous vector, e.g. (Vector* number number)
15:22gfrederickskab3wm: that's what made me speculate about lazy seqs
15:22mheldcallen: I know TimMc IRL :-P
15:22juliangindiIm attempting to loop a body and than update the input values at the "recur" section. I am having difficulties and any help would be super appreciated: https://gist.github.com/Julian25/6416129
15:23callencjfrisz: it's fixed length and homogenous because you passed it two numbers.
15:23callencjfrisz: use value.
15:23callenI specifically said, of "value"s.
15:23gfredericksjuliangindi: your recur needs to have two args
15:23kab3wmgfredericks: simplified example on pastebin on pastebin- http://pastebin.com/Uu6XjnDf
15:23gfredericksthe first is the new value of loopCurrent, the second is the new value of loopNext
15:23callencjfrisz: you can also do '[(Value x)]
15:24callenkab3wm: ick, what's with the parens at the end man :\
15:24noncom|2reply seems a good option, but there are no instructions on how to install and use it to be the frontend of the application...
15:24juliangindigfredericks: parse-raw-input return two values that i am attempting to capture in loopCurrent and loopNext
15:24gfrederickskab3wm: that didn't tell me anything new; some example code from one of the functions would be nice
15:24noncom|2it is present in lein, ok, but i want it to be the user interface for the app
15:24juliangindigfredericks: such as in this line of code "(let [[currentList nextList] (parse-raw-input (line-seq rdr))]"
15:24kab3wmcallen: I'm still learning. this helps my eyeballs for now.
15:25gfredericksjuliangindi: so (let [[a b] (parse-raw...)] (recur a b))
15:25TimMcmheld: Ah, right! Oh well.
15:25juliangindigfredericks: ah..I see. I'll give it a shot. Thanks!
15:25cjfriszcallen: thanks!
15:26callencjfrisz: just read the docs: https://github.com/clojure/core.typed/wiki/Types
15:27ckirkendalldnolen: got time for an odd async and clojurescript exception
15:27callenckirkendall: just ask your question, don't target people like that.
15:27kab3wmgfredericks: ok, here's a better paste - http://pastebin.com/ZFJiGgvD
15:28ckirkendallI am getting the following exception: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.Named
15:28ckirkendall
15:28gfrederickskab3wm: yeah that looks reasonable; you don't need a do at the top level of a defn, but that shouldn't be your problem
15:28gfredericksI have no further ideas
15:29ckirkendallI traced it to the fixup-aliases method here -> https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async/impl/ioc_macros.clj#L613
15:29juliangindigfredericks: Getting a strange error: "Can't take value of a macro". Here is the updated gist. https://gist.github.com/Julian25/6416129
15:29kab3wmgfredericks: originally I had it all at the end of let and that wasn't working, so I've just been trying whatever I can think of. Thank you for taking the time to look. I'll keep playing with it.
15:29ckirkendallAre we able to call (name ns) on a namespace? I didn't think we could do this. Is this an issue with my version of clojure.
15:30gfredericksjuliangindi: you'd want to remove the square brackets in your recur; I don't think that would give you that error though
15:30amalloyckirkendall: ns-name
15:30juliangindigfredericks: Yeah, I removed the square brackets, to no avail
15:31gfredericksjuliangindi: oh you lost your parens aroudn let; line 7
15:31ckirkendallamalloy: I thought so but this is in the core.async code.
15:32juliangindigfredericks: Yup, that was it! Thanks :)
15:32amalloyckirkendall: in that code, ns isn't a namespace, it's just a symbol
15:32amalloywell, maybe. i guess i don't know
15:32ckirkendallits somehow getting a namespace
15:35ckirkendallif sym is a namespace this code will looks like it will fail
15:35ckirkendallIt has (if-not (namespace sym) sym (... (name sym)))
15:46arkhin c2, I'm able to successfully set e.g. the "width" of an SVG dom object with (attr (select "#svg-thing") :width 80)) and I can read the value back to verify the change took place but, visually, nothing ever changes with the SVG object
15:46arkhwhoops - make that (attr (select "#svg-thing") :width 80)
15:47arkha browser element inspector still shows the svg as having the old width
15:59rurumate_Where is clojure.contribs.combinatorics now?
16:00cjfriszcallen: I couldn't get any type using Vector* to type-check for variable-length vectors. I'd checked over the docs both before and after your advice, and finally tested (clojure.lang.IPersistentVector MyType) to specify a variable-length vector that contains only entries of type MyType.
16:00coventryrurumate_: People talk here a lot about clojure.math.combinatorics. I haven't used it, though.
16:01rurumate_oh yeah, just found it, thanks
16:13callenucb: howdy.
16:13ucbhey callen
16:13ucbhow's it going?
16:13callenucb: pretty good, tossed a PR at Korma last night, signed on a place in SF this morning. Working on a public holiday. You? :)
16:14ucbcallen: writing tests for riemann streams and stuff. Finally doing some clojure for a change, so pretty good (despite a haunting migraine)
16:15callenucb: I know the horror of trying to get work done with a migraine beating down the walls. Hope you feel better soon. Glad you're doing Clojure :)
16:15ucbyeah, the migraine is easing off as the day progresses (? - it's nearly 9pm here) so I've struggled to get anything done today
16:16callenucb: 1251 and waiting on Chinese food on my end :)
16:16ucbnice
16:19callenucb: there's a dude writing a CMS in Clojure and Couch, might want to look into that if you weren't already aware.
16:19callenhe's been "thought-streaming" the work.
16:19ucboh?
16:20ucbI'm deciding, slowly but steadily, that webdev is not my thing
16:20ucbfor one, I suck at it
16:20callenhttps://github.com/SnootyMonkey/falkland-cms https://thoughtstreams.io/snootymonkey/falkland-cms/ https://readthedocs.org/projects/falkland-cms-api/
16:20callenucb: I've been full stack for a long time, everything from persistence to JS. Why do you believe you're bad at it?
16:21ucbcallen: lack of practise most likely. Been a backend dev most of my life. So-called devops (according to younguns these days)
16:21gfredericksdoes anybody know the best way to type-annotate #(assoc % :foo 12) in terms of HMap?
16:21ucbcallen: been struggling to make any tangible progress on my clojunauts thing I told you about some time ago
16:22bbloomis there a good way to track down the source of a rouge stack overflow in a sizable chunk of code?
16:22callenucb: well, there's always the option of tapping into the dark powers of Lord Sauron if you want help.
16:23callenucb: I have notions and suggestions when it comes to coder's block or working through unfamiliar territory as well.
16:23ucbcallen: I would mind the help/advice really
16:23ucbergh
16:23ucbWOULDNT
16:23callenbbloom: stack overflows that are red?
16:23ucbNT
16:23ucbok?
16:23gfredericksbbloom: clojure is a DSL for creating obscure stack errors
16:24callenbbloom: is visualvm or yourkit an option?
16:24callenbbloom: you could watch the stack bloom.
16:25amalloybbloom: i'd probably just read the stacktrace. it's usually got a pretty good indication
16:25bbloomcallen: maybe...
16:25callenamalloy: I figured that wasn't an option since he didn't just do that.
16:25callenI would've suggested that to most punters but I figured he knew better.
16:25bbloomamalloy: unfortunately, the stack trace is very short.
16:25callen^^ that's what I suspected.
16:25amalloyuhhhh
16:26bbloomit's failing in clojure.lang.AFunction$1.doInvoke
16:26amalloymind if i look at it? you've got me curious now
16:26bbloomwhich i assume means i wrote a bad function :-P
16:26bbloomhttps://gist.github.com/brandonbloom/6416765
16:26callenbbloom: code?
16:27bbloomcallen: i'm not quite ready to share yet :-P but it's probably too much code to quickly analyze for such a bug anyway.
16:27amalloybbloom: this is coming from nrepl? it does some unpleasant things to stacktraces
16:27callenbbloom: I'm suspicious of the apply.
16:27amalloyalso you misspelled propagate
16:28callenbbloom: are you doing a map of reductions?
16:28callenbbloom: in a loop/recur?
16:28bbloomamalloy: lol thanks
16:28amalloyanyway, it looks like handle-base calls itself recursively forevery
16:28bbloomcallen: no
16:29amalloyvia propagate's lambda, and some other function at 329
16:29callenthen it's probably just a straight up recursive function that isn't using loop recur.
16:29callenI don't really know what to tell you without code in front of me.
16:29callenamalloy's nose seems good.
16:30bbloomthanks guys, was just looking for some general advice. is there a way to recover a more complete stack trace?
16:30amalloybbloom: run your app outside of nrepl :P
16:30callenbbloom: dump them periodically via st.
16:30callenprobably to a log file
16:30callenput it right before the tail position.
16:30amalloybut it won't be an interesting stacktrace. it's just going to be those five lines repeated a few hundred more times
16:30callennot using nrepl is good too.
16:31amalloyplus like whatever your path from -main is, i guess
16:31callenamalloy: more of a just-in-case measure.
16:31bbloomcallen: there's only one recur that is basically a trampoline through this propagation mechanism
16:32bbloomi'll probably just stare at it for a while longer & the solution will come to me
16:32bbloomthanks again
16:34mheldhow would I override the statement that korma generates for INSERT?
16:34callenmheld: slow your roll son.
16:34coventryAm I just wrong to want to add attributes to every class in Compiler.java which implements Expr and modify every instance post-instantiation? I can't add members to the Expr interface, because then they're static final. Is this actually an appropriate place to use inheritance?
16:34callenmheld: what exactly is meant by "override"? What do you want to accomplish?
16:35mheldkorma generates INSERT INTO TABLE(key key) values (value, value) and I need INSERT INTO TABLE values(value, value,,,) -- filling in the holes that are in the column names
16:35callenmheld: why do you need the latter?
16:36mheldcallen: proprietary database
16:36callenmheld: if it's not an officially supported database, vendor specific things require using raw queries.
16:36mheldI'm ok with that
16:36callendecorating the insert macro behavior is possible, but I just got done making some tweaks to that last night and would rather not re-open that front.
16:36mheldhah
16:36mheldok
16:37mheldyeah, I'm diggin' clojure a lot
16:37mheldI totally forgot how much I love lisp
16:37coventryActually, I know I'm wrong, because it's complicating these objects. But I don't know the right way to achieve my goal of passing form-level metadata through the compiler's analyzer.
16:37callenit's easier to do semi-custom queries if you use the insert* fn and write an alternative or use a different make-query-then-exec fn.
16:37callenmheld: yeah I have ridiculous amounts of fun. 3/4s of the reason I do Clojure OSS stuff.
16:38callencoventry: dare I ask what you're doing? :P
16:40coventrycallen: I want to be able to map as many components of fully macroexpanded forms as possible back to their locations in the source code, for an edebug-like tracing tool.
16:40callenfirst noncom, now you?
16:41coventryI think you're thinking of futile, and as far as I know I was working on this before him. :-)
16:41coventryIs he also trying to make a tracing tool?
16:41callenfutile works on everything, none of it counts.
16:41callennoncom is doing something magical with ns decls, I don't know exactly what.
16:43coventryMy initial strategy was to use the location metadata you get from an indexing reader, and rely on the fact that macroexpand preserves this metadata. But it turns out that the only reliable tool for full macroexpansion is the compiler itself. It drops the form-level metadata during analysis. I am currently thinking of ways to make it not do that.
16:47bbloomamalloy: ah, turns out it was me, not nrepl eating the stack trace :-P
16:48bbloomi had another bit of code that was converting host exceptions in to target language exceptions
16:51callenmost creative way to fuck onesself I've heard in awhile.
16:52bbloomthis little project has been a total mind fuck in general
16:53bbloomevery time i code something up & it works, i'm pretty damn proud of myself & then immediate in disbelieve and try to falsify my results
16:54bbloomi'm working on abstract interpretation of a language w/ multi-shot continuations, which is hard to implement on the JVM :-/
16:55coventryOh, if I'm going to hack the compiler, I might as well hack macroexpand-1 to keep track of what it's expanded to what. That is a simple change which will maintain my form-level metadata, and I can easily reconstruct the fully expanded form from it.
17:08callencoventry: https://github.com/ztellman/riddley
17:10coventrycallen: Thanks, I hadn't come across that yet. If I can use it to track source code location, it sounds perfect.
17:10callencoventry: if you're trying to do something that involves ?!SCIENCE!? then ztellman and aphyr are good github accounts to check first
17:11ckirkendallI was able to fix the issue with 'name' being called on a namespace by patching core.async.
17:11coventrycallen: I'll keep that in mind. :-)
17:11ztellmanhaha, lag between tweeting the repo and its use being suggested: 3 minutes
17:12callenztellman: not my fault your work was relevant.
17:13callenor that I habitually check my twitter :\
17:14ztellmanwell, on the subject of open source by Kyle and myself, there will be some interesting stuff appearing on the Factual repo in the next week or so
17:14ztellmankeep watching the skies
17:25coventryztellman: that library is so useful to me. Thanks.
17:26callencoventry: he's gone, but I'll pass the love on :P
17:26coventryThank you, too. :-)
17:32noncom|2can i make "lein repl" to start in a particular namespace?
17:34callennoncom: you type in (ns name.space.here) I think.
17:37chronnononcom|2: you can use the :repl-options and :init-ns in your project.clj (https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L293)
17:37noncom|2chronno: cool! thank you!
17:38chronnononcom|2: np, although if you run it with nrepl.el it doesn't work as expected :-( (https://github.com/clojure-emacs/nrepl.el/issues/316)
17:39noncom|2eheh :) luckily i have to run it from the OS
17:42AWizzArdAbout Protocols: I have (defprotocol P (f1 [x]) (f2 [y])) and (extend-protocol P String (f1 [x] :string-f1) Object (f2 [x] :object-f2))
17:43AWizzArdCalling (f1 "hi") works fine of course, but (f2 "hi") doesn’t. Is there a way how I can convince Clojure to find the most specific f2 for Strings that is implemented?
17:43AWizzArdIn our case here it would be the Object f2. Currently it seems that because I specified *something* for class String, Clojure now expects me to implement *all* protocol FNs for this class, and does not allow fallbacks to the next most specific impl.
17:45dnolenAWizzArd: partial implementation of a protocol is a broken implementaiton, it's just not how protocols are meant to work.
17:46AWizzArdSeems I have to live with this then.
17:47AWizzArdIt’s a bit cumbersome for my JavaFX usecase, but thanks for letting me know that this behaviour is indeed a desired feature.
17:48coventryWhat's desirable about this limitation?
17:49callenif it's that loosey-goosey, don't use protocols.
17:50AWizzArdcoventry: well, an advantage is that this way one can detect possible bugs.
17:50AWizzArdIf you just forgot to implement a protocol fn you will get an exception.
17:51AWizzArdAlthough I would prefer to be able to specify ^:partial to let Clojure know that this is what I want.
17:53juliangindiI'm working on my first full Clojure project and I was wondering if anyone had tips/tricks/tools for debugging
17:53callenAWizzArd: you could contrive a fakey auto-generator exception-throwing shim for the rest.
17:53callenjuliangindi: REPL, ritz, println, pray.
17:53callenjuliangindi: visualvm, yourkit, tools.trace
17:53callenlimit-break/debug-repl
17:54callenunit tests
17:54callenfunctional tests
17:54callengenerative tests
17:54callenmocking
17:54callennot writing bugs.
17:54juliangindiif I could write bug-free code for the rest of my life, I'd get bored =)
17:54AWizzArdcallen: yes, I could offer a conveniece macro to my users, to allow them adding new JFX components for which I couldn’t implement Container behaviour myself.
17:55AWizzArdProbably a good idea.
18:00AWizzArdAnother protocol + core.typed question: (defprotocol P (foo [a b] [a b c])). Clojure eats this expression, but is this the correct way to do it? (ann-protocol P foo [[Any Any -> Any] [Any Any Any -> Any]])
18:02callenambrose has you people seriously hooked on types.
18:04AWizzArdI wanted them since 2004 in Lisps.
18:04AWizzArdAnd 2008 I started basic work on it. It’s fantastic that finally someone took the required time and did it.
18:04AWizzArdEspecially gradual typing is what I wanted.
18:05AWizzArdnice read about it: https://groups.google.com/forum/#!topic/clojure/ekj0jksZehU
18:06AWizzArdMeikel mentioned gradual typing back then.
18:12callenI'm a fan of optional typing, don't get me wrong, I'm just pleased and amused by how people are going nuts for them since Ambrose started talking about it more.
18:13AWizzArdI can’t speak for others, but I wanted this since so many years and had so many discussions about it, since 2004. So for my case it is indeed something very deep.
18:15AWizzArdThe interesting thing is that just a few daysweeks ago this project became usable.
18:15AWizzArdAnd I am already looking forward to all those people who argumented *against* static typing, and now they have it.
18:15AWizzArd“I always said it was a good thing” <-- there will be plenty of those, from all the haters too :D
18:17brehautcallen: i think there is a reasonably large subset of clojurists who would _almost_ use haskell or an ML but prefer clojure's – for lack of better word – flavour of functional programming, but do miss the static type checking
18:18brehautAWizzArd: Just because you can see the merits a dynamic language doesnt mean you dont *also* see the merits of static typing.
18:19irrelephantjust playing around abit with threading, i want to get some monitoring from the threads but can't get the logger function to update more then 1 item in the agent http://pastebin.com/ymBGxFd5
18:20irrelephantas pasted only the last value gets updated, which makes sense to me, but wrapping it in a do will stop the threads working all together
18:20amalloyirrelephant: assoc-in doesn't mutate anything
18:20AWizzArdCT allows us to even statically type code from authors who totally not want it.
18:20amalloythe definition of write-output is clearly wrong, without even reading past it
18:21irrelephantamalloy, oh, well it kinda works =)
18:21technomancyAWizzArd: I have my doubts as to whether that would be effective
18:21AWizzArdtechnomancy: what you mean?
18:22technomancyjust that it's easy to write code that a typechecker can't do anything useful with if you don't care
18:22amalloyyou really just want (update-in output [:thread-summary tid] assoc :current-item msg, :foo (rand-int 1000))
18:22brehauttechnomancy, AWizzArd: the TypeScript 'DependantlyTyped' repository is a good example of the pros and cons of that approach
18:23technomancyAWizzArd: I mean I think you can make it work, it would just be lots of work if you're going against the grain
18:23AWizzArdtechnomancy: my point is the thing we both talked about a few months ago, where you said you would like it if type-hints can go into an extra file, to avoid code clutter.
18:23brehautsorry sorry, DefinatelyTyped https://github.com/borisyankov/DefinitelyTyped
18:23AWizzArdbrehaut: you have a lin.. ah okay
18:23technomancyAWizzArd: oh yeah, that's definitely the way to go in either case
18:24brehautAWizzArd: specifically multiple type definitions for various libraries, with different language version and library version support and assumptions about how to best type said libraries
18:24AWizzArdtechnomancy: this we can do. I could write all type hints for, say, Compojure and Ring today and push this as a tiny lib to Clojars. You can then just depend (via Leiningen) on my lib and get all the benefits, as if the original authors added those type annotations.
18:25brehautAWizzArd: https://github.com/brehaut/ring.typed/ ;)
18:25brehautring is _bloody hard_ to type
18:26AWizzArdbrehaut: yup, I just learned this today :-)
18:26AWizzArdAah, there *is* ring.typed? Cool, let me have a look…
18:26brehautAWizzArd: thats my own experimental hack at it
18:26brehautAWizzArd: its not useful
18:26brehautAWizzArd: unlike https://github.com/brehaut/re.typed/ ;)
18:27AWizzArdTo me it is useful, thanks for this source for examples.
18:27brehautAWizzArd: note that its against quite an old version of core.typed atm
18:28AWizzArdOne thing we definitly need is an emacs plugin that will hide/show all type annotations when pressing Ctrl+F9
18:29AWizzArdThis way even technomancy might accept 1-3 type annotations in his code ;)
18:29irrelephantamalloy, ah that does the trick, thanks. any pointers why a do wrap would lock the threads?
18:29AWizzArdOr, if the annotations go indeed into their own file, such an emacs plugin could store them there, and only show them in-place on demand.
18:30amalloyirrelephant: what you describe makes no sense
18:32brehautAWizzArd: I quite like the annotations in another file approach
18:33brehautAWizzArd: although for practical reasons its useful to have them inline
18:33AWizzArdbrehaut: I want them directly there where the def/defn is. But: with a nice IDE plugin a separate file can be totally fine.
18:33irrelephantamalloy, sorry, when you look at the paste there are 2 assoc-in that want to change the agent, but as pasted only the last update will actually materialize, from what i understood so far that makes sense and wrapping the 2 statements in a do function should remedy that
18:34irrelephantbut when i do that the threads seem to lock up
18:34amalloywrapping those in a do would make no difference whatsoever
18:34AWizzArdThis plugin would have to automatically take care and move the annotations into the correct file, even when I edit them in-place. And I must be able to hide/show them, and when I show they need to appear as if they were in my current source file.
18:49irrelephantamalloy, well actually it stops the program from working :p, but back to more reading for me i guess. so if i also want to run let's say inc via update-in i should just make another send call from the worker thread or is there a way to put it all into one function?
18:51callenirrelephant: I can't handle your nick.
18:51amalloythat hardly seems relephant, callen
18:53callenamalloy: I don't have the koalafications to handle this ridiculousness.
18:53irrelephantone could even say it's totally irrelephant
18:54rplevyAny idea why this would produce nil in Linux JVMs and only produce result on Mac JVMs? https://www.refheap.com/18238
18:55genEricjust for you callen
18:55calleneven more maddening.
18:55bbloomaw, that makes me beary sad
18:56amalloyrplevy: just a coincidence: you're making the reflector guess which overload to call, and apparently it guesses differently in your two environments
18:56amalloysubmit takes either a Runnable or a Callable, and Runnables don't have a value
18:57amalloyIFn is both of those things, so if you don't specify which you want it to act like, you get a guess
18:57rplevyoh! that makes sense
18:58callenamalloy: I'm now convinced you aren't mortal.
18:58amalloycallen: it's pretty easy to diagnose the fifth time i see it
18:59rplevyI'm gonna go with the not mortal explanation anyway
19:00callenamalloy: you've lived the lives of 500 wizards in the last 5 years anyway, so I'm going to say it's isomorphic with being immortal anyway.
19:00amalloyhaha
19:00callenin the next episode of, "Stump amalloy!", the audience loses. Again.
19:04callenamalloy: okay, how do you force Runnable vs. Callable with Executors?
19:04callenthe question nerd-sniped me.
19:05amalloycallen: let-bind it with a typehint
19:06amalloy(let [^Callable f (fn ...)] ...)
19:07callenamalloy: returns nil, actually.
19:08callenhrm, wait
19:08amalloyi don't think i believe that. gist a reproducing repl session?
19:09callenyeah that doesn't work.
19:09bbloomanybody ever see some weird shit with defrecord and instance? not behaving?
19:09amalloybbloom: you probably reloaded the file with defrecord but not the file with instance
19:10amalloyand then tested some old instances
19:10callenhttps://www.refheap.com/18241
19:10callenamalloy: ^^
19:10bbloomamalloy: yeah, i tried that...
19:10bbloomamalloy: er suspected that, but i can't see how… there's only one file & i restarted the repl
19:10bbloomamalloy: then i thought i may have copy pasted the defrecord line & didn't cut the origina… but no, only one
19:10callenamalloy: I guessed the solution you suggested, that's why I asked to make certain I wasn't crazy.
19:11dissipate_why do i keep hearing that macros are bad because they don't compose well with functions?
19:12callendissipate_: totally false, it's a conspiracy. They're just trying to keep real ultimate power out of the hands of the oppressed proletariat.
19:12amalloycallen: you haven't typehinted tp, so it's still using reflection
19:12callendissipate_: rise up and destroy your masters! Macro all the things!
19:13dissipate_callen, Chas Emerick mentions it in his talk: http://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway
19:13amalloy(and you can't typehint the var, because that doesn't mean what you want. you have to hint it at call-time, or in a let-binding)
19:13dissipate_the guy who wrote the book 'Clojure Programming'.
19:13callendissipate_: yes, he's one of the Illumi-lispy! the new world order of lisp overlords trying to keep macro power from people like you.
19:13dissipate_hehehe
19:13dissipate_i bet...
19:14amalloycallen is the secret leader of the Resistance
19:14bbloomamalloy: http://dev.clojure.org/jira/browse/CLJ-1132
19:14bbloomamalloy: i'm not using tomcat or anything. i'm just using a normal repl, but apparently i'm not totally crazy...
19:15bbloomamalloy: but this explains my bug from earlier! i have (defrecord Raise …) and then (defn raise? [x] (instance? Raise x))
19:15amalloyyeah, i can imagine classloaders/AOT causing a problem there
19:15amalloyalthough of course it shouldn't
19:15bbloomamalloy: my recursion termination condition involved raise?
19:15amalloyhah
19:16bbloomamalloy: i refactored the shit out of my code in a quest to narrow down the bug. i apparently didn't need to do that, but i'm happy with the result :-)
19:16bbloomnow i need to figure out why the fuck this predicate is broken
19:16bbloomi'm not using AOT or anything, i don't think
19:16amalloyno AOT, no classloader funkiness, no reloading? hard to see how this could go wrong then
19:17bbloomamalloy: vim-fireplace doing something funky maybe?
19:17amalloybeats me
19:17bbloombut (instance? Raise …) genuinely does not work lol
19:17amalloyi don't even use nrepl in emacs, so how vim+fireplace over nrepl behaves is entirely foreign to me
19:19callenaahhhhh executor service. very good.
19:28bbloomamalloy: and now i can't reproduce it
19:28bbloomamalloy: that plus the growling in my stomach means a dinner break is the clear solution to debugging this
19:29amalloybet you a dollar you reloaded but forgot about it
19:29bbloomamalloy: i killed the repl & started over several times
19:29bbloomthen i moved some code around & it went away
19:29bbloomthen i tried to undo back to a point where it was failing, but i couldn't
19:30bbloombrain is clearly failing
19:31eph3meralanyone know of such a thing as a collection of problems to solve that can or would help illustrate useful examples of macros?
19:32eph3merali.e. where can I learn more about macros - such that I can spot places that might be appropriate to use them
19:32AimHereWell if you can translate from Common Lisp, there's Paul Graham's 'On Lisp' which is very macro-centric
19:32AimHereAvailable as a free pdf or a really expensive out of print rare dead-tree book
19:34rplevyeph3meral: the clojure koans project has some macro meditations, though that might not be as many as you might like.
19:34amalloyOn Lisp isn't really macro-centric; macros are one of several topics that it covers more or less equally
19:35eph3meralcool thanks
19:35AimHereBeg to differ
19:35AimHereBasically about the entire middle half of the book, from chapters 7-18 out of 25 deal with macros
19:36AimHereAnd of course subsequent chapters use them to illustrate the advanced stuff later on
19:37eph3meralI'm on Ubuntu 13.04 so I'm pretty sure I can find a clisp interpreter somewhere :)
19:38rplevyOn Lisp is definitely "The Lisp Macro Bible" if there ever was one
19:38AimHereLet Over Lambda is the Lisp Macro Book of Mormon
19:38rplevyhaha
19:39brehautlol
19:40rplevynot to offend any actual Mormans here but LoL does raise the insanity levels a bit over its self-ordained prequel, so the analogy is fitting
19:40rplevyLoL meaning let over lambda
19:40rplevynot laughing out loud
19:40rplevynor Land of Lisp
19:42microampwould you recomment 'land of lisp' for a lisp beginner?
19:43shaungilchristI would - or realm of racket :-)
19:44shaungilchristI think as soon as we come up with a sufficiently clever name for a clojure variant it will appear
19:45shaungilchristall I've got is "clowder of clojure"
19:45brehautor just clojurebook.com ;)
19:45brehautwe dont need fancy titles or cartoons to have great books about clojure
19:45microampshaungilchrist: thanks, i might get it
19:46shaungilchristconverting the exercises/games to clojure is an awesome way to learn once you are familiar with the concepts
19:47microamphow about 'learn you a/some x for great good' for clojure?
19:50rplevymicroamp: I think that was the idea of 'Meet Clojure' which is on hold right?
19:57benkaywhat would the idiomatic way to compute the result of mapping 2 functions on to a set separately?
19:57benkaywould be(
19:57benkay*
19:58benkayI want to (map (partial + 1) (partial + 11) #{3 4 5}), but that's not a thing :(
19:59AimHereYou could just nest the maps, or nest the function call
20:01AimHere,(map (partial + 1) (map (partial + 1) #{3 4 5}))
20:01clojurebot(5 6 7)
20:02benkay,(map (partial +1) (map (partial +11) #{3 4 5}))
20:02clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
20:02s4muel,(->> #{3 4 5} (map (partial + 1)) (map (partial + 11)))
20:02clojurebot(15 16 17)
20:02benkay,(map (partial + 1) (map (partial + 11) #{3 4 5}))
20:02clojurebot(15 16 17)
20:02benkayI want (4 5 6 14 15 16)
20:02technomancy"learn you a clojurebook.com for great good"
20:02AimHerebenkay, map uses the second and subsequent arguments as additional collections to be mapped over
20:02technomancyoops; didn't read the backlog
20:03AimHere,(map + [1 2 3] [100 200 300] [1000 2000 3000])
20:03clojurebot(1101 2202 3303)
20:03technomancybenkay: mapcat juxt maybe
20:03benkaytechnomancy: i think i'll go play with mapcat and juxt for a bit now
20:03benkaythanks all
20:10futileHello.
20:13seancorfieldHi futile
20:13futileHow goes it seancorfield?
20:14seancorfieldJust back from a week's vacation and catching up on tickets at work... and writing some Clojure of course :)
20:14futileHoorah.
20:14futileYou don't have Labor Day off?
20:14futileI thought this was a national holiday and you were in US.
20:15ddellacostaseancorfield: what logistical stuff do I have to go through to contribute to clojure.java.jdbc?
20:15futileWow, that was a rude thing of me to say, sorry.
20:15futileddellacosta: is that packaged with Clojure?
20:16ddellacostaseancorfield: would like to help out with some DSL stuff, if possible.
20:16ddellacostafutile: nope, but it's managed by the core team I think
20:16futileOh.
20:27brainproxygeneric term for things being compared?
20:28brainproxycomparands doesn't seem to be a word ore really fit the bill
20:28brainproxy*or
20:28futilei know that a comparator is something used to compare
20:28brainproxy"compared objects" is going the right direction, but would prefer a simple term
20:28futilecomparatee?
20:28futilelet me see what NSArray calls it
20:29futileheh it just calls them "objects"
20:31brainproxy:)
20:31futile"comparable"
20:32futile"comparative" might be a stretch
20:33futilebrainproxy: "contrastitee"
20:36futileWell, I just finished moving all my projects to Dropbox. Switching betwixt two computers is too painful otherwise.
20:36hyPiRionI really like git repos for that purpose
20:41yogthosxeqi: re: unit tests in the book, I just introduce core.test mostly and mention a couple of ring specific test libs
20:42futilehyPiRion: my git repos are inside Dropbox now :)
20:42futilehyPiRion: needing to git push and then switch computers and git pull is so tedious otherwise
20:44futileWow, the latest version of magit is kind of weird.
20:44seancorfieldsorry, got busy with a repl connected to production, doing some data detective work futile and ddellacosta
20:44ddellacostaseancorfield: no worries, of course.
20:45futileseancorfield: heh I've done that several times already in this short year
20:45seancorfieldfutile: re: Labor Day - my employer has a very flexible PTO schema so i can choose not to take public holidays off and work instead - and then take vacation when i actually _want_ to!
20:45futileseancorfield: what an awesome employer. Who are they?
20:45seancorfieldddellacosta: to contribute to java.jdbc - sign & submit your Contributor's Agreement, get on clojure-dev, get a JIRA account, get a github account
20:46seancorfieldbasically read http://dev.clojure.org/display/community/Contributing
20:46ddellacostaseancorfield: contributor's agreement is: http://clojure.org/file/view/ca.pdf ?
20:46seancorfieldfutile: World Singles... internet dating :)
20:46futileseancorfield: is that process meant to raise the bar on contributions or something?
20:46ddellacostaseancorfield: ah, okay
20:46ddellacostaseancorfield: thanks for the links! Will do.
20:47seancorfieldddellacosta: background reading http://clojure.org/contributing
20:47ddellacostaseancorfield: excellent. Will read up and follow-up. Thanks for all the info.
20:47benkayso, blackjack. this function takes in a sequence of cards ([[1 :hearts] [3 :clubs] [:king :diamonds]], for instance) and returns a list of numbers representing the possible scores. except that for some reason it's blowing up on ace cards, and i'm out of ideas as to why.
20:47benkayhttp://paste.lisp.org/display/138742
20:48futileoh man, ive never written a card came before
20:48benkayany suggestions (including those of the idiomatic type) are very welcome
20:48futilethat sounds like a fun project for FP
20:48benkayfutile: i'm definitely enjoying it. learning piles while working through the implementation. stuck on this thing though.
20:49futilebenkay: well with the little details you've given, I can't figure it out. Maybe use refheap.com?
20:49benkayfutile: http://paste.lisp.org/display/138742
20:50benkayand since you ask: https://www.refheap.com/18244
20:51xeqiyogthos: ring specific like ring-mock?
20:52yogthoshttps://github.com/xeqi/peridot and https://github.com/xeqi/kerodon
20:52futilebenkay: I would probably split that up into several small obvious functions for starters
20:52yogthosxeqi: weavejester mentioned those
20:52futileBut like I've said, I never did a card game before; maybe this kind of complex function can't be broken down any further. But I doubt it.
20:53xeqiyogthos: hehe, awesome
20:53futilebenkay: one simple thing that would definitely make it more readable is to use destructuring
20:54benkayfutile: that's a thing i'm not good at yet :)
20:54dissipate_seancorfield, does your employer let you use clojure at work?
20:54futilebenkay: which one?
20:54benkayfutile: destructuring
20:55futilebenkay: ah let me take a stab at it
20:55futilebenkay: Also try to prefer working with lazy sequences instead of using (loop)
20:55seancorfielddissipate_: we've had clojure in production for two years
20:56futileAye, us too.
20:56s4muelbenkay: you've an error in mapcat -- should be (mapcat (juxt (partial + 1) (partial + 11)) scores))
20:57seancorfieldwe have about 14.5kloc of production clojure and just over 3.5kloc of test code
20:57futilebenkay: can you give me some sample inputs and outputs for this function? That'll help me easier.
20:57benkaythanks s4muel!
20:58benkayfutile: [[3 :aces] [4 :diamonds] [:queen :clubs] [:ace :hearts]]
20:58dissipate_seancorfield, i see. you are lucky to work at an FP shop. :D
20:59futilebenkay: those are inputs?
21:00benkayfutile: that'd be a single input
21:00futilebenkay: and what would the output for this input be?
21:01futilebenkay: (score-hand [[3 :aces] [4 :diamonds] [:queen :clubs] [:ace :hearts]]) => ???
21:01lazybotfutile: Oh, absolutely.
21:01futilelazybot: smartass
21:01benkay(18 28)
21:01futileOkay.
21:01benkayfutile: (18 28)
21:02benkays4muel already found my bug, but I have a different question for you on the topic of destructuring, futile
21:02benkaygiven that sequence of vectors, how would you go about constructing a new local containing all of the first items in each entry?
21:02futilebenkay: logically speaking, how do you get [18 28] from this input?
21:03benkay3 + 4 + 10
21:03benkay= 17
21:03benkaythen + 1 and + 11
21:03benkayin blackjack, aces can count as either 1 or 11
21:03TEttinger3Raynes or amalloy, if you're around, do you know how on earth lazybot's rss plugin works? I can only seem to find unreadable feeds
21:03benkayand face cards count as ten
21:04futilebenkay: how is [3 :aces] a valid card?
21:04futileI've never heard of "3 of aces" before
21:04benkayfutile: mistake on my part.
21:05futilebenkay: what should :aces be, :hearts?
21:05benkayanything. irrelevant for scoring.
21:05futileok
21:05seancorfielddissipate_: our front end is CFML, our back end a mix of CFML and Clojure... just FYI (re: "lucky")
21:05TEttinger3cfml is coldfusion?
21:06futilebenkay: so [[3 :spades] [4 :diamonds] [:queen :clubs] [2 :hearts]] would produce only [19] ?
21:06seancorfieldcfml is the language, coldfusion is adobe's commercial implementation, but we use railo a free open source engine
21:06benkayfutile: yup!
21:07futilebenkay: Ah, tricky, so for every ace you have, you double the numbers of results you could have, kind of like a factorial (I think)
21:07benkayfutile: precisely.
21:07futilebenkay: are the suits really completely ignored?
21:07benkayi believe so
21:08futilebenkay: then that's the first thing to do, build a new structure that eliminates them, since they're just noise.
21:08benkayi think they're relevant during a push to determine the winner of a tie
21:08benkaynope, incorrect.
21:12dissipate_seancorfield, i thought cold fusion was old stuff from the '90s?
21:13seancorfielddissipate_: adobe release version 10 a while back; railo's project is on 4.x; the language has evolved a lot... it's a js-like OO scripting language that compiles on demand to JVM bytecode now
21:13benkayfutile: incorrect referred to my statement, not your suggestion about a new structure.
21:13futilebenkay: right
21:13seancorfielddissipate_: it even has closures... unlike java :)
21:15dissipate_seancorfield, and what is the app?
21:16seancorfieldan internet dating platform... 50+ sites, a dozen languages (including RTL such as arabic), about 4M users
21:16RaynesTEttinger: Apparently it doesn't work. :P
21:17TEttingerRaynes, could it be some change in xml or zip libs?
21:17RaynesTEttinger: Well, it was never exactly the best feed reader ever to begin with, but sure, that's also plausible.
21:18amalloybenkay: that problem is trickier than it looks. i don't love my solution, but https://gist.github.com/amalloy/e3368747b399e83b91d6 will work
21:18Raynesamalloy: '((((((((())))))))
21:18dissipate_seancorfield, i see, cool. can't say i'm interested in that kind of app. but if it makes money, right on.
21:19seancorfieldinternet dating is an interesting business dissipate_ and we are happily profitable :)
21:19futilebenkay: well, what I came up with actually didn't use any destructuring
21:19futileso that's weird
21:19seancorfield(and have been around for well over a decade now)
21:21benkayfutile: care to share?
21:21dissipate_seancorfield, and look at you, you probably have direct access to the databases with all those female profiles. :P
21:21futilebenkay: https://www.refheap.com/18246
21:23futilebenkay: that combinations function probably just needs https://github.com/clojure/math.combinatorics
21:23seancorfielddissipate_: and happily married for 14 years to someone i met online (on usenet, not a dating site!)
21:23futileI'm no math wiz.
21:24benkaythanks futile! someday i'll write code like that.
21:24Raynesseancorfield: Usenet isn't a dating site?
21:24RaynesYou just rocked my existence, Corfield.
21:24futilebenkay: you can start today, just a matter of memorizing patterns
21:25futilebenkay: I'm a cheater, all I do is copy other people's code.
21:25dissipate_futile, cargo cult programming?
21:26futileprobably
21:26futile"hey ->> works for him, i should use it too"
21:27benkayamalloy: that's a groovy approach as well
21:27seancorfieldRaynes: well, I guess some Usenet groups acted as dating "sites" :) Jay & I met in rec.art.bodyart ... go figure ...
21:28benkayamalloy: futile: thanks for the examples!
21:29TEttingerRaynes, I don't personally use RSS feeds, but one channel my lazybot is running in could use announcements when new things come in from an RSS feed. could the notifo plugin help?
21:30TEttingeroh nope. notifo is dead and gone
21:31amalloynotifo sounds like it's related to core.logic negation support
21:32TEttingerheh, it's a startup that lasted one whole year
21:36bjaa year is a long time
21:37futilebenkay: sure thing
21:46dissipate_TEttinger, why did notifo go under?
21:46Raynesamalloy: I figured out how to easily do the pebble-notifies-me-of-irc-pings thing.
21:46TEttinger3not sure
21:47Raynesamalloy: There is an email address you can send an email to that triggers a text message on your phone. I can add a lazybot plugin to send out emails when certain things are mentioned on IRC.
21:47Raynes?????
21:47Raynesprofit!
21:47RaynesObviously this only works in channels where lazybot is, but most of the channels that I care about are lazybot-enabled.
21:49futileso, is it rude to use "brotastic" as an exclamation?
21:49mtpbros are rude in general
21:49mtpso yes
21:49futileaww
21:50futilethat's not very brotastic :(
21:50holohi
21:50Raynesfutile: As a bro I can confirm that mtp is not a bro. Bro.
21:51holohei, where are seq-utils?
21:52holofrom contrib
21:54juliangindiI have a list of numeric strings like such '("2" "5" "6") and want to convert it into a vector of true integers, ie. [2 5 6]. Any ideas on how I could do this?
21:55aaelony(map #(Integer. %) '("2" "5" "6") )
21:55juliangindiaaelony: DUH. That would surely do it. Thanks :)
21:56aaelonysure, np… also(into [] (map #(Integer. %) '("2" "5" "6") ))
22:02cjfriszdnolen bbloom: Can one of you CLJS compiler hackers explain this one to me? https://gist.github.com/cjfrisz/94ba0f606d11a702a18f
22:03juliangindijust figured out the original list did not have three separate numeric strings, but one string containing three numbers, such as "2 5 6"…any ideas on how to take those apart and form a list with three elements as opposed to one
22:03dnolencjfrisz: that's blowing up at the top level? or are you nesting your #()
22:04bbloomdnolen: heh, i was literally about to ask that
22:04cjfriszdnolen: top level
22:04aaelony,(doc clojure.string/split)
22:04clojurebot"([s re] [s re limit]); Splits string on a regular expression. Optional argument limit is the maximum number of splits. Not lazy. Returns vector of the splits."
22:04dnolencjfrisz: is this browser REPL or compiled file?
22:04cjfriszdnolen bbloom: do you think this is a game?? of course it was top level!
22:04cjfrisz;-)
22:04cjfriszdnolen: Compiled file
22:05dnolencjfrisz: hrm, I do stuff like that all the time and haven't encountered it, would be helpful to see a minimal project that repros
22:06bbloomi'm gonna leave this one to dnolen, b/c i'm trying to end my marathon debugging session
22:07cjfriszdnolen: weird...
22:08cjfriszdnolen: if it helps, proto/render! is a call to a function declared in a protocol
22:08cjfriszI guess I could put together a trivial project that does that
22:08dnolencjfrisz: can't see how that would matter we don't do anything to special with protocol fns at CLJS source level
22:09cjfriszdnolen: Well then that's weird, because I don't know how that could expand into a #() within that expression
22:10dnolencjfrisz: yes, I can't reproduce this situation at REPL at all. You only get that error if you have multiple nested #()
22:11TEttinger3Raynes, I solved it. the API for shorten-url changed in lazybot, just removed the second param, "isgd" which isn't needed, and it workjs
22:13bbloomcjfrisz: #() is resolved at read time…. i think
22:14brehaut,(read-string "#(%1)")
22:14clojurebot(fn* [p1__31#] (p1__31#))
22:14dnolencjfrisz: what version of CLJS are you pulling in?
22:15bbloomcjfrisz: yeah, what brehaut said ^^
22:15bbloomcjfrisz: do you have another # anywhere else in the file? :-P
22:15bbloomcjfrisz: maybe your scheme is showing....
22:15cjfriszdnolen: I'm using [org.clojure/clojurescript "0.0-1859"] in my project.clj
22:15cjfriszbbloom: I actually don't use #() that much because it hurts my scheme :-)
22:16cjfriszbbloom: I only had one other #() expression in my whole repo, changed it to a fn and the same thing happens
22:16dnolencjfrisz: k, pretty recent
22:16bbloomcjfrisz: i didn't say #() i said #, just hash. like any tagged literals or #t typos or anything?
22:17cjfriszbbloom: haha, that is often the case, but not this time
22:17cjfriszI have had several compiler errors on #t in my code
22:17bbloomcjfrisz: it's hard to switch languages :-P
22:20maacldnolen: Are there any plans to implement everyg in core.logic for ClojureScript?
22:20cjfriszbbloom dnolen: Seem to have stamped it out, but I'm super weirded out
22:20cjfriszHang on…need to pull up the file I changed to fix it
22:21dnolenmaacl: I'd take a patch, but I'm fairly lukewarm about moving core.logic ClojureScript along until there's better support for sharing more code.
22:21dnolencjfrisz: you might have hit a tools.reader bug (which is what bbloom was alluding to above)
22:22dnolencjfrisz: if you can repro that would be super helpful and we can ping Bronsa about it.
22:24cjfriszdnolen bbloom: it cleared up when I changed this to a fn https://github.com/cjfrisz/chaser-cljs/blob/gradual-typing/src/cljs/chaser_cljs/game_env.cljs#L81
22:24cjfriszThat's in a different file altogether
22:24bbloomlol strange
22:25cjfriszIndeed
22:25cjfriszThe js/setInterval from the gist doesn't even call that code
22:26dnolencjfrisz: sounds like a reader bug to me
22:26cjfriszThe code that I changed to fix it gets called at startup and occasionally as a result of keydown event
22:29cjfriszdnolen bbloom hold up…maybe I didn't build correctly
22:29cjfriszLooks like even if I take out every #() in my code except the one for the js/setInterval call, I still get the nested #() error
22:30kab3wmgfredericks: not sure if you are still around, earlier you looked at this paste (http://pastebin.com/ZFJiGgvD) for me and asked if it was returning a lazy seq. I said no. It is, but I didn't understand the issue earlier. Do I need to not make it return a lazy seq somehow, or how do I handle this?
22:30cjfriszOh…wait I'm an idiot
22:30cjfriszdnolen bbloom disregard, it was user error
22:31bbloom*sigh* what happened?
22:31cjfriszI found where I snuck another #() in there, and it was totally nested
22:31cjfriszIt is a game and I have shamed my family and everyone I've ever known
22:31bbloomcjfrisz: i'm genuinely curious how you pulled that off
22:32dnolencjfrisz: good to know not a reader bug
22:32cjfriszI wrapped an init expression in a # and didn't notice it
22:32cjfriszIt slipped my notice until the 3rd or 4th time I checked grep
22:32bbloomcjfrisz: sooo grep failure. got it lol
22:32dnolenbbiab
22:35gfrederickskab3wm: easy answer: wrap it in doall; my preferred answer: don't use e.g. map for side effects; use doseq instead
22:35gfredericksin general don't mix laziness and side effects
22:36kab3wmgfredericks: got it. thank you!
22:40cjfriszbbloom: current status http://www.hark.com/clips/xmcydyzdrb-survey-says
22:40bbloomcjfrisz: eh, we've all done dumber :-)
23:01maacldnolen: Ok, I will look into it, but as you say looks rather involved.
23:02Ph_DDoes anyone have knowledge on the Friend authentication library? I'm having serious trouble getting the "interactive-form" to function.
23:05Ph_DScratch that— I'm going to investigate further with login-failure functions.
23:08ddellacostaPh_D: I know a bit, if you ask a question I may be able to help.
23:16xeqiPh_D: I've used it
23:17Ph_Dddellacosta & xeqi: Well, there are three things so far I've found that are required to make this work: 1) A way to encrypt and compare passwords, 2) Middleware for adding form fields as keywords into the :params part of the request, 3) a properly structured map of users. I seem to meet all of these requirements, but I can't seem to log in whatsoever. It fails consistently.
23:22Ph_DTrying to be succinct: I've tested the Bcrypt functions in the REPL (with database calls), my middleware is adding form fields to the :params correctly (so says my (println response) in the form-failure-handler), and I've tried two users maps: '{:username "admin" :password "pass"}' and '{"admin" {:username "admin" :password "pass"}}'.
23:25xeqiPh_D: and your :credentials-fn is something like (partial bcrypt-credential-fn (fn [name] (@users name))) ?
23:30callenPh_D: it's usually not worth the trouble
23:30Ph_DYes, it's: (partial bcrypt-credential-fn (get-user "admin"))
23:30Ph_D(get-user "admin") returns from Redis:
23:30Ph_D{"admin" {:password "<long bcrypt hash>", :username "admin"}}
23:30Ph_DI've also tried it without the nested hash:
23:30Ph_D{:password "<long bcrypt hash>", :username "admin"}
23:30Ph_Dxeql: ^
23:30callenPh_D: please don't paste code to the channel unless it's a one-liner. Use refheap.
23:30Ph_Dcallen: will do
23:30callenPh_D: unless you've got a complicated security/auth situation, Friend isn't typically going to win you more than it costs you.
23:31Ph_Dcallen: that's why I'm learning it. It's an experience.
23:34xeqiPh_D: you'll want it to return the {:username .. :password ..} version
23:35xeqidoes `((partial bcrypt-credential-fn (get-user "admin")) {:username "admin" :password "..."})` work on a repl?
23:35xeqithough I doubt the "admin" should be hardcoded in the get-user call
23:37Ph_Dxeql: It does, yeah. I'm only hardcoding it so far for testing purposes before I switch it out for a proper function.
23:42xeqiPh_D: then it looks like 1+3 are working correctly. For 2, are you using wrap-params and wrap-keyword-params, a form that adds "username" and "password" parameters, and friend's `authenticate` with `:workflows [(interactive-form)]`?
23:43Ph_Dxeql: I'm using compojure's (handler/site), which adds those and then some. I've seen working examples that do the same.
23:43xeqiyep, thats sufficent for the middleware stack
23:43xeqiprovided its like (-> routes (friend/authenticate ...) ... (hiccup/site) ..)
23:44hfaafb are loops a code smell
23:47Ph_DIt's all laid out like that (I'm assuming you meant (handler/site)), yeah.
23:49Ph_DOh, wow. Okay, does my use of http-kit as my server make a difference? This could be what's holding me back.
23:49SegFaultAXhfaafb: No.
23:51coventry"lein pprint" lists [org.clojure/tools.trace "0.7.6"] in the :dependencies, "lein classpath" lists the jar path, but (require 'tools.trace) fails in "lein repl" with "Could not locate on classpath." Any ideas why that would happen?
23:52xeqicoventry: (require 'clojure.tools.trace) ?
23:59benkayhow would I defer the evaluation of <?
23:59benkayI want to (every? (< n) [x y z]), but no ams success.