#clojure logs

2013-12-08

00:00xpe,(class #{})
00:00clojurebotclojure.lang.PersistentHashSet
00:00xpeigorw that's why I was looking at hash values
00:00justin_smith,(= (str 4) (str 4.0))
00:00clojurebotfalse
00:01gdevlol
00:01igorwnote that this is double vs float, not double vs int
00:01justin_smithright, but just showing that my above even works with int vs. float
00:01justin_smithwhile str conversion does not
00:01xpe,(= 0 0.0)
00:01clojurebotfalse
00:01justin_smithxpe ==
00:02igorwso single-element sets behave differently than multi-element?
00:02justin_smith,(== 0 0.0)
00:02clojurebottrue
00:02justin_smithigorw: in the sense that a single element set has only one ordering, yest :)
00:02xpeigorw: the semantics of = are different than ==
00:02justin_smith,(every? #(apply == %) (map list (sort #{3 4}) (sort #{3.0 4.0}))) ; my final answer
00:02clojurebottrue
00:03xpeif you use = to compare sets, it compares its elements with =
00:03xpeif you want to compare set elements with ==, I think you'll need to write your own thing
00:03xpebut you probably don't want to mix numeric types
00:03justin_smithxpe: or the one I just pasted
00:03gdevlol at the docstring for =
00:04gdevcompares numbers and collections in a type-independent manner
00:04xpe"compares numbers and collections in a type-independent manner" I don't even know what that means
00:04justin_smiththat needs a big † with a footnote
00:05xpeigorw: so THAT was fun, right?
00:05justin_smith,(= [1 2 3] '(1 2 3)) ; xpe
00:05clojurebottrue
00:06gdevyes, numbers and collections are treated type-independent, but collections that care about type with numbers...all bets are off
00:07igorwapart from using doubles everywhere, it's probably easiest just to sort the sets before comparing
00:07igorwthanks justin_smith! :)
00:07xpeigorw can't you just use doubles? is this an application or a library?
00:08igorwyeah, in this case I can do that
00:08deadghosthttp://pastebin.com/s4nhfKMH
00:08deadghostI'm trying to get rid of (remove nil?
00:08xpe~dotsmack =
00:08clojurebotexcusez-moi
00:08xpeoops
00:08xpe~docsmack =
00:08clojurebotHuh?
00:09justin_smithdeadghost: why?
00:09xpeigorw: good. mixing floats and doubles sounds like heartache.
00:09deadghostjustin_smith, because the code just juts out
00:10xpedeadghost: you want to remove it because it looks bad?
00:10deadghostand there might be a map function that omits nil that already exists
00:10deadghostthat I am not aware of
00:10deadghostxpe yes
00:10bellkevI have a really newbie question... If I have a number n, is there an easier way to get its negative than (- 0 n) or (unchecked-negate-int n)?
00:11xpedeadghost you could use the threading macros if that looks better to you
00:11justin_smith(->> url get-listings (map #(when (has-no-website? %) (collect-listing-data %))) (remove nil?))
00:11justin_smithit indents nicer
00:11xpe,(let [n 2] (- n))
00:11clojurebot-2
00:11justin_smithand is arguably a bit simpler
00:11justin_smith(to read that is)
00:12xpebellkev ^
00:12justin_smith,(- -1)
00:12clojurebot1
00:13bellkevah, that'll do
00:13bellkevthanks
00:19xpe,(#(nth (iterate - %) (dec (Math/pow 2 10))) 3) ; negate 3
00:19clojurebot-3
00:19xpebellkev: in case you want a computationally inefficient version
00:20bellkevyes, definitely, thank you
00:20xpeit has the advantage of writing values all over the heap too
00:20xpeactually... not sure about that
00:20bellkevOr, of course I could always just multiply by exp(pi * i)...
00:21xpebellkev: i imagine so, yes
00:22arrdemgdev: got 10 to read something?
00:22gdevarrdem, sure
00:23amalloy,(doc keep) deadghost
00:23clojurebot"([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."
00:26deadghostamalloy, perfect
00:53gabe_hollombeHey folks, is the Clojure Google group an appropriate place to ask for feedback on my answers to some Clojure exercises? E.g. is my code idiomatic, how can it be improved, etc.
00:58hyPiRionyeah. If it's small code snippets, people tend to help out here too
01:01arrdemdrop a refheap/gist link in channel and odds are someone'll read it and comment
01:07gdevgabe_hollombe, don't forget to run it through kibit first https://github.com/jonase/kibit
01:07gabe_hollombethanks hyPiRion arrdem gdev
01:08Raynesarrdem: Clearly you ordered those in order of how much you're deeply in love with the authors.
01:09arrdemRaynes: what'd I do?
01:10andyfarrdem: Nothing, except talk when Raynes was feeling punchy.
01:11RaynesI wasn't... what
01:11Raynesarrdem: I was asserting that you love me more than the gist developer.s
01:12Raynesdevelopers.*
01:12arrdemRaynes: ah. that is entirely false... I can't M-x gist-paste-buffer that I know of..
01:12Raynes$google defunkt gist
01:12lazybot[defunkt/gist · GitHub] https://github.com/defunkt/gist
01:13Raynesarrdem: ^ :'(
01:13arrdemRaynes: it's OK. I'll still spam you with stacktraces :D
01:13Raynes<3
01:13RaynesBut now I'm worried I've said terrible things to andyf though.
01:14RaynesHis discontent seemed pretty sincere.
01:14andyfRaynes: I'm not offended at all. Just (poorly) trying to inject some levity.
01:14RaynesOh, good.
01:15RaynesWell, apologies for messing up the levity with insincerity then :)
01:15RaynesEr, insecurity*
01:15andyfI can mess up levity all by myself, thank you :-)
01:15arrdem(inc Raynes) ;; here take some karma, it helps
01:15lazybot⇒ 38
01:15arrdemmother of god
01:16arrdemRaynes: dear sir, with a channel karma that high how dare you feel insecure
01:16arrdem$karma technomancy
01:16lazybottechnomancy has karma 87.
01:16Raynesdat technomancy
01:16arrdemokay. all is still right with the world.
01:16RaynesMy karma is proportionate to what I've contributed to Leiningen.
01:17Rayneslein new, lein repl (well, the first lein 2 draft of it)...
01:18Rayneslein test :only foo.bar/baz is by far the greatest feat of over-engineering that I have accomplished at the behest of technomancy in the history of time :P
01:18RaynesI forget if anyone ever actually used that feature for anything other than :only.
01:18RaynesI don't think so though.
01:19mysamdogI can't seem to find any information about events in dommy. How would I go about detecting if an element was clicked?
01:20mysamdognvm
01:21mysamdogI found it
01:21arrdemRaynes: is there some awesomeness lurking there unused?
01:21arrdemRaynes: or just code of adamantium
01:22Raynesarrdem: They are test selectors. You can select tests based on arbitrary function calls.
01:22hyPiRion$karma hyPiRion
01:22lazybothyPiRion has karma 25.
01:22RaynesIn this case :only refers to a built-in one of those functions for selecting only one test.
01:22RaynesAt least, that's how I remember it.
01:23alsois there a way to exclude a direct dependency using a leiningen profile?
01:23RaynesThis really was ages ago.
01:24arrdemalso: what do you mean by that? a dependency elsewhere in the filesystem for instance?
01:24seancorfieldRaynes: I wonder if the lein test stuff could be abstracted so it could drive Expectations and Midje through higher-order tasks? Then :only and its ilk could be more widely applicable...
01:25RaynesHahaha, you want to abstract test selectors even more!?!?! Goodness, Sean, there be dragons.
01:25alsoarrdem: i have a dependency on instaparse that i want to exclude for cljs builds
01:26alsoso that i can use a clojurescript port of instaparse, but only for the cljs build
01:26arrdemalso: I know vanishingly little about the tooling around cljs. I'm not your man, sorry.
01:26seancorfieldRaynes: it's selfish - I primarily use Expectations and it seems a waste to see work duplicated across multiple lein test-ish plugins :)
01:26alsoi was thinking this wouldn't be cljs specific
01:26seancorfieldand I know the Midje diehards would appreciate it too
01:27RaynesYeah, there is certainly still room for improvement in lein test.
01:27justin_smiththere are midje diehards?
01:27Raynesalexbaranosky
01:27RaynesAnd presumably Brian Marick.
01:27arrdemI use clojure.test....
01:27RaynesAt least. Those are two concrete examples I can think of.
01:27seancorfieldWe do use clojure.test, but only in conjunction with clj-webdriver for more procedural tests... for general tests we prefer the more declarative approach of Expectations
01:27Raynesseancorfield: I think people avoid touching lein test like the plague because of clojure.test being so difficult to work with and extend.
01:27arrdemalso: there isn't a cljs port of instaparse yet.
01:28arrdemalso: you're gonna have a bad time
01:28seancorfieldpretty sure [Neurotic] uses Midje too?
01:28RaynesLots of people use it, justin_smith was being silly :p
01:28justin_smithRaynes: for caribou-core we use clojure.test with keyword selectors
01:28justin_smithvia lein test
01:28alsoarrdem: https://github.com/Engelberg/instaparse/pull/50
01:29seancorfieldfor me, Midje has too much magic and is a whole new language to learn... but it's certainly an impressive project
01:30arrdemalso: yeah that's a port in progress. Trying to build atop that would take a very brave individual.
01:30alsoarrdem: and fixed slightly here: https://github.com/also/instaparse/commits/cljs
01:30Raynesseancorfield: I use it in a few projects. Laser, notably.
01:30clojurebotNo entiendo
01:30RaynesPending a rewrite of the tests with clojure.test.
01:31RaynesJust because I don't really have one single good reason to use midje other than to be loldifferent.
01:31alsoarrdem: brave isn't the word i'd have chosen :)
01:31RaynesI'm sure there are people using midje for things it is actually useful for, I'm just not one of them. :)
01:31arrdemalso: insane and foolhardy spring to mind, but you seem to have taken on the challenge so good on ya
01:32alsoarrdem: it works for my simple parser, although generating the parser is too slow to do in clojurescript
02:56gabe_hollombeI'm very new to Clojure, and just finished the simple exercises from Kyle Kingsbury's _Clojure from the Ground Up_ chapter on sequences. I'm wondering if I wrote things in an idiomatic / sane fashion. If anyone would like to take a look at ~30 lines and provide feedback, I'd be totally grateful. https://gist.github.com/gabehollombe/7854417
02:59n_bgabe_hollombe: for line 16 I might do ,(-> "abracadabra" frequencies \c)
03:00gabe_hollomben_b: I'm not familiar with the (-> …) syntax yet. Can you re-write that as an expression?
03:01n_b((frequencies "abracadabra") \c)
03:02gabe_hollombeahh. I was trying (\c (frequencies "abracadabra"))
03:02gabe_hollombe=-)
03:02n_bIt's slightly more expensive, I imagine, but it makes it clealer what you're trying to accomplish IMO
03:03gabe_hollombeyeah. I like it. ty for the tip on frequencies =-)
03:05n_bIf you haven't found it yet, http://clojure.org/cheatsheet is kept open on a monitor always
03:05gabe_hollomben_b: Yes. I should look at it more often as I learn
03:16hydromethello
03:17hydrometA friend and I are planning on learning Clojure together!
03:17hydrometMy friend is an undergrad student in math / finance and has only learned Fortran (but also has been working with MySQL databases)
03:18hydrometI've learned more languages in the past (C, Objective-C, Ruby)
03:18hydrometGiven how much of a newbie my friend is to programming in general, I'm wondering what book we should start with for learning Clojure?
03:27hyPiRionI'd guess "Clojure Programming". That seems to be a solid book overall, although I don't know whether it fits for people new to programming
03:28hyPiRionFinding a good book for people new to programming AND Clojure seems to be hard
03:28hyPiRion(read: Noone has written a book aimed for that group of people)
03:29arrdemhydromet: I'd say go pick up "Structure and Interpretation of Computer Programs" if you're looking for the go-to lisp intro book
03:30arrdemhydromet: if you're looking for a somewhat technical clojure intro "Clojure Programming" is good
03:30arrdemhydromet: "The Joy of Clojure" really goes in depth on good design in Clojure
03:31hydrometarrdem: thank you for the suggestions
03:32hydrometarrdem: I had looked at the preface / intro on "Clojure Programming" and my only concern, for my friend who only knows Fortran, the that this book apparently uses comparisons to object oriented languages such as Java, Python and Ruby
03:33arrdemhydromet: yeah that's gonna be a stumbling block.
03:33arrdemwell... actually...
03:34hydrometarrdem: in some respects my friend might have an advantage learning Clojure (since he doesn't have years of OOP which might require him to "detach" from when it comes to Clojure)
03:34arrdemhyPiRion: is that really gonna be an issue? Clojure hides a lot of the OOP stuff pretty well...
03:34hydrometarrdem: whereas for me, I might have more to "unlearn" :)
03:34hyPiRionarrdem: I'm not sure, I've not read a Clojure book as a beginner
03:35arrdemhydromet: the real mind-bender of learning clojure isn't so much unlearning OOP, it's unlearning state. That threw me for a solid loop for about two months :/
03:35hyPiRionBut yeah, learning Clojure isn't hard, unlearning mutation is.
03:35gabe_hollombehyPiRion++
03:35arrdemgabe_hollombe: that's (inc hyPiRion)
03:36gabe_hollombeaaroncm: =-D
03:36gabe_hollombeold habits
03:36arrdemgabe_hollombe: heh
03:36gabe_hollombeI was trying to make hyPiRion's point
03:36hyPiRionhehe
03:37hydrometarrdem: and hyPiRion: good points, thank you for sharing your views ... not so much about unlearning OOP but more so about state and mutation
03:38gabe_hollombehydromet: there's also sicpinclojure.com
03:38hydrometand for my friend, his brief experience with Fortran probably means he might get thrown for a loop at first
03:38gabe_hollombeit's a work in progress
03:39hydrometbut I've read enough about Clojure at a high level and understand some of the abstracts with regard to state / mutation (and thus he idea of snapshots in time) so I think I will be able to help mentor my friend to a certain extent
03:39arrdemhydromet: in all seriousness, don't undervalue or underuse this channel
03:40arrdemhydromet: these guys saved my arse a bunch of times as I was getting started. you'd be surprised what'll get a well considered answer here.
03:40hydrometgabe_hollombe: thank you for noting sicpinclojure.com - I just had a quick scan of it, looks really nice!
03:41hydrometarrdem: that's great, thank you for the suggestion! I've heard great things about the Clojure community
03:41arrdem~clojure
03:41clojurebot"[Clojure ...] feels like a general-purpose language beamed back from the near future."
03:41hydrometI had the pleasure of attending a presentation last year in Chicago of Rich Hickey's - he was talking about data (not Clojure) but I was very inspired by his presentation!
03:43xpikacan someone tell me a function to covert a symbol to a string?
03:43hydrometAlso, I was thinking my friend and I would start out playing with Clojure by using Light Table.
03:44gabe_hollombehydromet: I'm learning clojure myself. also using LightTable. I'm a hardcore Vim-er, but I'm finding LT's insta-repl buffer mode pretty nice
03:45gabe_hollombeas I get more comfortable, I suspect I'll move back to Vim and take the time to learn paredit properly
03:47hydrometgabe_hollombe: glad to hear you're enjoying Light Table so far. Neither my friend or I have any experience with Vim or Emacs. We can perhaps climb those tools' learning curve later, I don't want my friend to feel overwhelmed (he also has a heavy load of classes next semester)
03:49arrdemhyPiRion: what was the motivation for astyx? seems like tools.reader could do the same job...
03:49arrdemnot that I don't like writing parsers too, I'm just curious
03:51john2xxpika: ,(name :foo)
03:51hyPiRionarrdem: It was mainly just because I wanted to play with instaparse, and I was a bit curious finding some sort of pattern on the legal keywords/symbols
03:51john2x(name 'foo) :P
03:51hyPiRionIt's not meant to be something you consume, I just dumped it up on github for convenience reasons really
03:52m0gI'm trying to generate a pom from a project.clj file and I can't get the plugin syntax straight. Any hint? https://gist.github.com/m09/7854791
03:52m0gSpecifically it doesn't nest manifest into archive
03:53arrdemhyPiRion: gotcha.
04:04m0ghum the syntax doesn't allow my use case atm actually.
04:04clojurebotTitim gan éirí ort.
05:26cYmenmorning
05:36d11wtqIs there any convention with regards to the prefixes "new-" and "create-" for functions that return specialized data-structures? A quick check with apropos shows both variants are used.
05:38d11wtqActually, scratch that. "create-" seems to be the convention for initializing a data structure.
06:06tufflaxhttp://stackoverflow.com/questions/20448448/can-this-clojure-code-be-optimized
08:38foobar27hi, are there any experts of cc.qbits/hayt hanging around here? (the CQL library used in alia, cassaforte and casyn)
08:48deadghostsay I have '(1 2 3)
08:48deadghostand I wanted to pass 1 2 3 into a function
08:49deadghostis there an easy way to strip the list
08:52oriigdeadghost: use apply
08:52foobar27deadghost: you probably want (apply f '(1 2 3))
08:52Okasudeadghost: (apply #'f '(1 2 3))
08:54deadghosthmm ok
08:54deadghostworks for me
08:56deadghosthmm wait no, no it doesn't
08:58foobar27deadghost: can you post a short failing example?
08:58foobar27(e.g. on refheap.com)
08:58deadghostnot so much failing as I don't think apply would be appropriate here
08:59foobar27what to you want to do?
08:59deadghosthttp://pastebin.com/5K3QMsvu
08:59deadghostso I'm passing in an arbitrary number of selectors
09:00deadghost:ul.colors :li :a for example
09:00deadghostand since it's & it gets packed into a list
09:00deadghostwhen I want it to look like [:ul.colors :li :a html/text-node] in the body
09:01foobar27I don't fully understand the situation yet
09:01foobar27but does the following work? (html/select node (concat selector [html/text-node]))
09:02justin_smithdeadghost: can you show the erroneous output? I think what you want is mapcat
09:02justin_smithinstead of map, but I can't know that until I see the output you don't like
09:18deadghostfoobar27, works with (html/select node (into [] (concat selector [html/text-node])))
09:18deadghostmore verbose than I'd like but at least it's working
09:37justin_smith(def concatv (comp #(into [] %) concat))
09:37justin_smiththat will make it less verbose
09:37justin_smithand you will likely find other places to use it
09:49deadghostjustin_smith, will do though I still suspect there are cleaner ways
09:50justin_smiththe cleaner way would be for the function you call not to require a vector - but if it needs one then why not have a strightforward way to construct it
09:56deadghostjustin_smith, that's how it is from the library I nabbed
09:56deadghostI'm thinking macro usage might be warranted here
09:58deadghostactually that's probably overkill for some verbosity
10:07pepijndevoshmmm, dorothy, rhizome and lacij seem like very similar projects. any recommendations?
10:10justin_smithpepijndevos: first glance, rhizome is likely better, because the author writes good stuff
10:11pepijndevoslol
10:11justin_smithmaybe someone has a more informed opinion, but that is my hunch
10:29pepijndevoswhats the deal with this pedestal thing?
10:37justin_smithit is an end to end webapp stack with an unusual / experimental design
10:37justin_smithfrom what I hear it is cool if you want to do a one page webapp and do every part of it in clojure
11:36logic_progis there a way to change the way atoms are displayed
11:36logic_progi.e. I'd like to have atoms show up as #atom ... rather than have clojure de-ref the atom and print it
11:38bbloom_logic_prog: you can redefine the print-method, but be aware that affects all other code that may print something, so you should only do it in your local repl & not in library code
11:38logic_progactually, what I want is:
11:38logic_prog(set *print-level* 10)
11:38logic_progsince the real problem (which I did not mention in my question) is cycles in atoms
11:38logic_progi.e. I had problem X, but asked about problem Y.
11:39logic_progsorry about that.
11:39coventrylogic_prog: Have a look at the print-method defmethods in https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L104
11:39bbloom_logic_prog: alternative advice: get rid of your cycles
11:39bbloom_use an extra indirection, such as an id number or symbol
11:39logic_progI can't
11:40logic_progI have "objects" and "listeners"
11:40logic_progobjects need a list of listeners that are listening to the object; and listeneres need a list of objects they're listening to
11:40logic_progboom, cycle!
11:40logic_progI'd love to kill this cycle
11:40bbloom_further advice: don't do that at all :-)
11:40bbloom_but i can't provide an alternative b/c this is an open research problem heh
11:40logic_progbbloom_: how should I solve this problem instead?
11:40bbloom_step waaaay back, what are you trying to accomplish?
11:41logic_progreal time shared objects in clojure+clojurescript
11:41logic_progI have websockets set up, when a user makes a change, I want all other clojurescript clients to get updates
11:41logic_progthus, I have an "object" and "listenres" (which are websocket + clojurescript)
11:42logic_progobjects need a list of listeners (so that when an object changes, it can tell all websockets "hey, dude, update shit")
11:42logic_proglisteners need a list of objects, so that when they close, I can tell it to unregister
11:43seangroveWhy do objects need a list of their listeners?
11:43seangroveWhy not use a third-party queue?
11:43bbloom_so worth pointing out: once you attach listeners to objects, you've added a ref-counting scheme
11:43logic_progso taht when I send an dojbect a "update" message, it can send it to all listeners
11:44bbloom_so if you're already doing manual memory management, you might as well store listeners in external state (such as a top level atom)
11:44seangroveYeah, I was basically going to build up to the idea bbloom_ is proposing
11:44justin_smithlogic_prog: you could add a level of indirection, a map of unique id to object, another mapping of unique id to listener, and have each store the id and manually look up the value when needed
11:44justin_smithclassic cycle-flattening technique
11:44bbloom_however, let's go further back: why do you want to do this at all?
11:44logic_progbbloom_; I'm writing a real time svg editor
11:44logic_progclient side = clojurescript, server ide = clojure
11:45bbloom_what data is being synchronized between client and server?
11:45logic_progthe "svg document" is a "shared object", so taht when a client updates it, all clients get updates
11:45logic_progthings like "add this rectagnle; move that rectangle; delete this circle"
11:45logic_prog"diffs" to the svg document
11:45bbloom_yeah, don't use mutable/synchronized objects
11:46bbloom_use a queue. read about http://en.wikipedia.org/wiki/Operational_transformation
11:46logic_progokay
11:46logic_progwhat shoudl I be using isntead?
11:46logic_progholy shit
11:46logic_progI should read about that
11:46logic_progit evenworks for google docs
11:46logic_progprobably good enough for me
11:47seangrovehah
11:47bbloom_then also read this: http://awelonblue.wordpress.com/2012/07/01/why-not-events/ -- then ignore its aguments, b/c anything beyond what he's saying is an open research problem. it's just worth understanding the shortcomings
11:47bbloom_entertainingly i just linked that on twitter too. i find myself thinking about that post pretty frequently :-P
11:47bbloom_anyway, cycles are pretty much 100% of the time a bad thing
11:47bbloom_sorry, i mean POINTER cycles
11:48bbloom_you may have cyclic relationships in your data, but if you have a pointer cycle you've got aproblem
11:48bbloom_you need an extra indirection so that you can make incremental, structural sharing changes to an object w/o having to copy the complete pointer graph
11:48bbloom_haskell allows cyclic lazy objects & they are prod of that, but it's a major anti-feature
11:48bbloom_s/prod/proud
11:49justin_smithbbloom_: that's what I was getting at with the map of id to listener / map of id to object suggestion
11:49justin_smiththere is probably a name for that transformation
11:49bbloom_it sounds like he has only one object tho: the SVG document
11:49bbloom_which might have a change log on it too
11:49justin_smithsvg has g in it
11:50seangrovebbloom_: Interesting that the author points out pi-calculus and csp as failures as well
11:50bbloom_seangrove: i don't think he said they are failures, he said we can do better
11:51bbloom_seangrove: also if you look at the comments, you'll see that i argue in favor of event systems in non-distributed contexts
11:52seangrovebbloom_: Still reading through. Interesting points, but I certainly hope he proposes something mind-blowing
11:52jtoycan I just do lein install of a project I hav and then from another repo how would I install it?
11:53bbloom_seangrove: he proposes many many different ideas over the course of many future rambling blog posts of varying value
11:59logic_progokay fuck it
11:59logic_progcycles are dead
11:59bbloom_w00t
11:59logic_progand now, my code also no longer works :-)
12:00jtoyit seems like that doest work, i need to do something else to use a locally installed jar
12:02logic_progokay, works now :-)
12:08justin_smithjtoy: you should be able to declare it like any other dependency
12:08justin_smithcheck that what you put in the dependencies in the project using it exactly matches the project / version in the one you lein installed
12:08amakcider is not in marmelade
12:09justin_smiththe latest version is broken in marmelade, there is a discussion of this on the clojure-emacs github
12:09justin_smithyou can package-install out of a git repo
12:25jtoyjustin_smith: I tried a few different ways, I did lein install for my library A then added the same dependency name as what i had in library A into app B and I see that it fails to find the library, then I also tried uplpoading jar A and pom A to an s3 repository and then just try to start B and it fails
12:25coventryamak: Just use nrepl.el for now.
12:25amakcoventry: why?
12:27justin_smithjtoy: weird, I use lein install followed by requiring the resulting lib very frequently
12:27justin_smithto double check things are good before lein push
12:28justin_smithor to make a temporary replacement for a lib to check a bug fix
12:28justin_smithare you sure the name and version strings are an exact match?
12:29jtoyjustin_smith: do you need to modify the dependencies in project to do this? yes, they are the same string, jst double checked: toy-app "0.0.1" and [toy-app "0.0.1"]
12:30justin_smithno group string
12:30justin_smithlike group/toy-app
12:31justin_smithand this is all on the same machine?
12:31jtoyjustin_smith: what do you mean by group? I need to change my app to be in a group?
12:31jtoyyes, all on the same machine
12:31justin_smithjust double checking it wasn't jtoy/toy-app on one side and just toy-app on the other
12:32amakella loads all the packages in .emacs.d/elpa/?
12:32amak*elpa*
12:32justin_smithjtoy: because if those things match you should be able to require the other lib and access its code
12:32justin_smithjust like any other dep
12:33justin_smithbecause lein install puts things in the same place it would put a remote dep, the resolution method is identical
12:34jtoyI think I found the issue, im still investigating
12:34justin_smithalso double check the pom.xml in ~/.m2/... and be sure that it reflects what you would expect to find
12:37jtoyjustin_smith: yes, I did find the error, but I just found anohter issue, in my library A, i referencea class C, that C exists in project B which I am trying to run, i cant do this?
12:38jtoyit looks like I cant creat a lib A that references C and in my project B have a dependency for A while having the soruce for B in my project
12:39jtoyI mean "having the source for C in my project"
12:41jtoyis it possible to use libraries in clojure that have functions that can call functions from your own code?
12:42AimHerejtoy: if you're having to write that, you're probably not structuring your code properly
12:44jtoyAimHere: for instance I have some generic data-creation functions, I want to add a callback so I can add some customizations, before I just had my library call src/templates/callbacks.clj and I would customize only that for each project
12:44jtoyhow can I achieve this while being able to keep all the library code seperate ?
12:55justin_smithjtoy: define a protocol or interface
12:56justin_smithhave the underlying code call the methods of the protocol/interface and get an instance passed in
12:56jtoyjustin_smith: how would the library code know what to call though?
12:56justin_smiththe calling code defines the class implementing it
12:56justin_smithbecause you passed it in so it could be bound
12:56justin_smith(lib/init-<whatever> my-instance)
12:56justin_smithfor example
12:57justin_smithbetter yet, never let the underlying code create or store the instance, only let it be passed in
12:57justin_smithbecause the caller should own the object anyway
12:57jtoydo you know of any good tutorials on this? I havve read a lot about protocol/interfaces but hav not used them
12:58jtoyI thiml the way I structured my code is completely wrong
12:58justin_smithhttp://blog.josephwilk.net/clojure/isolating-external-dependencies-in-clojure.html
12:59justin_smithjtoy: it takes a while to get the design of user / lib interaction exactly right without globals or dependency loops
13:01justin_smithhe is mostly talking about testing in that article above, but the same concerns apply for lib / user dependency isolation too
13:01jtoyjustin_smith: I agree! thanks, I am reading it all in detail, I think I see how to modify my stuff
13:04justin_smithhttp://tech.puredanger.com/2010/03/01/dependency-injection-clojure/ also see the comments on this post (and enough of the post to see the context)
13:07coventryamak: So you don't have to deal with those kinds of failures.
13:07amakcoventry: i was able to install cider
13:07amakmelba has the pakage
13:07amakmelpa
13:08jtoyjustin_smith: can I turn a whole namespace into a defprotocol and then override a couple of functions?
13:08jtoyit seems like I just need good old fashioned OOP :)
13:09justin_smithjtoy: one sec, I have a recent example
13:10justin_smithhttps://github.com/caribou/caribou-plugin/blob/master/src/caribou/plugin/protocol.clj I have the protocol, then I define make, which merges the overrides the user wants with the default / identity / null versions
13:11jtoyjustin_smith: excellent, I can implement it similiar to this
13:12jtoythx
13:12justin_smithnp
13:13arrdem(inc justin_smith)
13:13lazybot⇒ 17
14:08gfredericksdoes test.generative offer anything over simplecheck?
14:09bbloom_gfredericks: <insert standard comparison instead of competition comment>
14:10bbloom_"how do test.generative and simplecheck differ?"
14:10bbloom_not that i have an answer for you :-)
14:11gfredericksI'm curious now that simplecheck is getting contribb'd
14:12gfredericksseems weird if one lib is a superset of another
14:21bellkevhas anyone had issues with lein-cljsbuild just hanging for a long time when running a build task?
14:23bellkevoh, nvm! Looks like it wasn't compiling anything because all I did was stop the auto building, change the optimization settings, and restart, and none of the source files changed so it wasn't rebuilding....
14:23dnolenbellkev: yeah easy to get tripped up by that one
14:23seangrov`bellkev: Yeah, I always do `lein cljsbuild clean; lein cljsbuild whatever` because of that
14:23bellkevEither an "all files up-to-date" message on startup, or settings changes triggering rebuilds could be nice...
14:35gdevI'm so confused by Quil's random function. couldn't figure out why I was getting an NPE, then I look at source and realized it tries to pass in the current applet. since i was just testing from the repl i had no applet
14:35gdevexplains the NPE, but not the reason why it requires an applet just to give me a random number
14:36seangrov`gdev: Maybe some Java interop artifact?
14:41gdevseangrov`, that's what I thought too. first place I looked was the javadoc for the processing library. Even the java version doesn't require an applet
14:47seangrov`Hrm, what's the straightforward way do a depth-first travesal of a datastructure and pull out the first element? clojure.walk?
14:53jonasenseangrov`: If you want the leftmost leaf then maybe (first (tree-seq ...))
14:53coventrySomething like (->> [[[[[[[1]]]]]]] (iterate first) (take-while sequential?) last first)?
14:54seangrov`jonasen coventry: I think I may be missing a better approach. I'm actually trying to transform/expand a datastructure out https://www.refheap.com/21603
14:55seangrov`I'd like to work from the leaves inward, expanding each tag until it reaches a terminal state
14:55seangrov`Seems like I might want clojure.walk/postwalk here....
14:55jonasenseangrov`: yes, I think so too
14:58jonasen(postwalk #(if (number? %) (inc %) %) widget) will inc the two numbers
15:04seangrov`Strangely, it seems like postwalk will visit a hashmap twice - once as a vectory, and then once as a map
15:04seangrov`Ah, I guess that's not strange, it's just recursively walking the map as well
15:05seangrov`Would be nice to know if the value I'm transforming is inside a map though....
15:09ihvjfb8a74htkgbi YOU MAY BE WATCHED
15:09ihvjfb8a74htkgbiWARNING WARNING WARNING, WARNING
15:09ihvjfb8a74htkgbiWARNING WARNING WARNING, WARNING WARNING
15:09ihvjfb8a74htkgbi YOU MAY BE WATCHED
15:09ihvjfb8a74htkgbiYOU MAY BE WATCHED
15:10coventryseangrov: I think the vectors you're seeing are MapEntries.
15:11coventryIn which case you can tell by inspecting the type.
15:12seangrov`coventry: Interesting, let me check
15:13seangrov`Loosk like (type ...) just returns a clojure.lang.PersistentVector
15:13seangrov`Not too worries about it though, just prototyping something that can be dirty for now
15:16coventryOh, right, I'm mostly using clojure.walk2. That will give you MapEntries, clojure.walk just gives you PersistentVectors.
15:22logic_progin core.async, alts! claims to be _non-deterministic_ when multiple channels are ready. However, I don't want it to be non-deterministic. I want it to be a FIFO -- I want to merge the channels based on the time when they're ready. (i.e. imagine two channels, one = key_down events, two = key_up events) -- I wnat the two channels to be mixed based on the time the events happen
15:23bbloom_logic_prog: if you add a buffer, it will be FIFO until the buffer is full
15:23logic_progwait, sorry
15:24logic_progsuppose I have key_down_A key_up_A keydown_B
15:24logic_progwhat prevents the mixin from giving me: "key_downA key_down_B key_up_A" ?
15:24bbloom_logic_prog: but you actually DO want non-determinism, even when the underlying mechanism is deterministic. core.async injects added randomness to preserve the non-determinism b/c the precise mechanical evaluation order of co-occurring message sends is an implementation detail of the ordering of your code
15:24bbloom_logic_prog: i dunno what you mean by "mixin"
15:24bbloom_logic_prog: channels are like queues: they are FIFO
15:24logic_progsorry, by mixin I mean alt!
15:24seangrov`coventry: That switch worked, thanks
15:24bbloom_the nondeterminism only occurs when multiplexing
15:25logic_progso I'm using clojurescript, and I'm using listeners, so I have channel1 = listen :keydown, channel2 = listen :kenup
15:25logic_progand now, I want to merge channel1 and channel2 into one channel that has all key-events
15:25bbloom_why two different channels?
15:25logic_progbecause goog.listen
15:25bbloom_they can put on to the same channel
15:26logic_proghmm
15:26alsoif you need them in separate channels, split them out later
15:26bbloom_you're using put! with a listen?
15:26logic_progI'm a dumbass
15:26seangrov`logic_prog: I just use a little (utils/relay target-ch event-name) as my callback handler
15:27bbloom_a put! will essentially create an unbounded buffer, but internally in all realistic js engines, the events will be processed internally in the correct order, so you're ok
15:27logic_progdoes put! never block?
15:28bbloom_put! is the non-blocking primitive underlying >! -- it will use a setTimeout-like mechanism to enqueue in to the system event bus
15:28bbloom_(if it has to)
15:29logic_progsuppose I do (let [out (chan 100)]
15:29logic_progwhat happens to a put! if there is already 100 elements
15:29logic_progdoes it not block?
15:30coventryseangrov`: NP. The only drawback I've run into with walk2 is that there's no canonical jar for it.
15:40justin_smithhttps://github.com/caribou/clojure.walk2 we track the upstream, though upstream took all their jars back
15:41seangrov`justin_smith: took their jars back?
15:41justin_smithclojure.walk2 decided to unpublish all extent jars, but we have a caribou jar of it with the same code
15:42justin_smithhttps://github.com/caribou/clojure.walk2/compare/stuartsierra:master...master
15:43coventryYeah, I use the caribou one. Not much of a drawback.
15:52rovarArityException Wrong number of args (1) passed to: core$fn--666$fn clojure.lang.AFn.throwArity (AFn.java:437)
15:52rovaranyone have any ideas as to how I could discover what core$fn--666$fn is?
15:53justin_smithin core, name your anonymous functions
15:53TEttingerrovar, it's an anonymous fn. such as one created with #()
15:53justin_smith(fn what-this-does [arg]...)
15:53rovaryea..
15:53justin_smithand replace #() with the above too :)
15:53justin_smiththe optional name arg to fn makes that so much easier to track down
15:53TEttingeryep.
15:54goraci hi is there something like update in datomic )? we store facts usually, so update is the new fact it appears
15:54TEttingerit sounds like it's the kind of error I have gotten using #() with no % in it with map
15:54rovarhttps://gist.github.com/anonymous/7863679
15:55rovaroh.. i just found the answer..
15:55rovaractually.. nevermind
15:55rovarthat gist doesn't include me already fixing that bug
15:57rovarhttps://gist.github.com/rrichardson/7863716
15:57rovarthere isn't much in the way of anonymous functions there.. though I don't know how multimethod is implemented
15:58rovarthe pieces all seem to wor..
15:58rovarwork
15:59TEttingertry naming the fn on line 1
15:59TEttinger(defmulti send-multi (fn is-this-the-problem [msg] (-> msg :action keyword)))
15:59amalloyrovar: i bet if you restart your repl it will work
16:00amalloyor just (def send-multi nil) and then re-eval it
16:00amalloydefmulti has defonce semantics, so you probably have a stale dispatch function from earlier
16:00rovaroh interesting..
16:00amalloyyes, it's horrible
16:00rovari guess that makes sense
16:02cYmenWhen should I use letfn over let?
16:02rovarthe def nil fixed it
16:02rovarcYmen, when you have a list of inner functions to define
16:02rovarand are too lazy to type (let [myfn (fn [foo] ...
16:04tickingcYmen, rovar afaik, letfn has the additional property of making the functions available in all other function bodies
16:04justin_smithrovar: cYmen: it allows mutual recursion
16:04justin_smithwhich does not work with let
16:06cYmenah okay
16:06tickingAm I the only one feeling that lighttable does more harm than good to the clojure ide ecosystem? Nobody starts something similar because it is always looming on the horizon.
16:07rovarticking, I dunno, I like lighttable, but frankly I prefer vim with tim pope's clojure plugins
16:07logic_prognot emacs?
16:07logic_progI used vim for 15 years.
16:07logic_progclojure converted me to emacs.
16:07bjaticking: lighttable + plugins seems interesting
16:07rovarhaven't needed it so far
16:08logic_progemacs is like flying
16:08bjavim + vimux + vim-sexp has been good enough for me
16:08logic_progthose on land are happy with traveling on land
16:08logic_progbut those that have flown can never go back to land again
16:08bjafor cljs, clj, python, etc
16:08rovarI started on emacs, but in my work I always seem to be ssh'ing to a machine that only has vi/vim
16:08rovarso I don't fight it
16:09tickingbja, yeah but it looks like LT looses more and more clojure background, plugin maps are json instead of edn, most plugins are written in js not cljs
16:09amalloyrovar: tramp?
16:10cljris anytone here familiar with alpeh?
16:10bjaticking: why does it matter though? I can write my plugins in cljs if I want
16:10amalloy~anyone
16:10bjaand it has nrepl support
16:10clojurebotanyone is anybody
16:10amalloyclojurebot: forget anyone |is| anybody
16:10clojurebotI forgot that anyone is anybody
16:10amalloy~anyone
16:10clojurebotanyone is anybody
16:10amalloyugh
16:10cljrumm ha?
16:11cljri dont know what just happpened :)_
16:11rovaramalloy, I'm rarely ssh'ing over just to edit files..
16:11rovarI've not needed repl in vim, I have a screen full of repls in a tiling wm
16:11amalloycljr: i was trying to evoke the clojurebot factoid that tells you not to ask "does anybody know about _____", but instead just ask your real question
16:11rovarI can evaluate expressions if I need to..
16:11seangrov`ask?
16:11clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
16:11amalloynot bad
16:12tickingbja, yeah, but it seems that instead of becoming a good clojure ditor first, they choose to become a mediocre general pupose one, the BOT stuff is also hard to see in recent lugin developments
16:13rovarmaybe I'll muck about with tramp
16:14bjawriting stuff in clj/cljs only really matters for doing clj development though. like, it's a lot easier to write code to edit/modify clojure in clojure than in something else. That said, it doesn't matter a whole lot since you probably want to just be writing most of that kind of stuff as nrepl middleware and just calling it from your editor.
16:14tickingbja, the entire LT-Mailinglist is always enthusiastic and dreams of the highest goals, yet nobody takes the time to implement something, there are top 10 wishlists for plugins, but only 1 person who wrote one (in js)
16:15tickingbja, if it had een open source from the start people could have participated but now all it does is binding resouces trhough anticipation of greener grass
16:16tickingbja, yeah doing most of the stuff as middleware makes sense, yet something for the general editing chores, that is a little more modern than emacs would be nice
16:17amalloyrovar: you can tramp over, and M-x shell opens a remote shell instead of a local one
16:18justin_smithmore modern than emacs is a low bar - emacs still thinks windows are inside frames (all for historical reasons)
16:18rovaramalloy, yea, that is useful.
16:18rovaramalloy, I need to figure out how to just boot into emacs
16:19rovarto hell with the rest of the useless operating system.
16:19tickingrovar, unix haters handbook?^^
16:20bjaticking: I can't say that I really want/need more than vim+vimux and something like Hy to let me write vim plugins
16:21bjawhich is what I use now. LT is still missing too much stuff (git and diffing being huge) for me to want to use it
16:21tickingbja, yeah but the inital light table concepts looked nice, structural editing would be cool
16:21bjaticking: it has structural editing
16:22tickingbja, real structural editing or pseudo?
16:22cljris there a "reload" to compliemtn require or does require do reloadin?
16:22bjaticking: it seems real enough to me. I only play with LT, but you can bind the paredit stuff to whatever you want
16:23bjait still pales in comparison (as does paredit mode) to vim-sexp plus vim motions
16:23tickingbja, yeah paredit is pseudo mode
16:23tickingbja, there are no real nodes, everything is done on text
16:30amalloycljr: (require '[foo.bar :reload])
16:36cljramalloy: thanks you
16:38avishaihi
16:38avishailazy-seq question
16:38cljrim sorry to ask so many questions, but im just not used to the clojure workflow....i started up a repl and it seems to be in my projects namespace project.core > ..., however, i can't seem to access anything defined within that namespace, which I assumed i would be able to, for example, the -main functiopn doesn't seem to work
16:39cljri tried (-main), (project.core/main), and 0 luck
16:39avishaiif i want something like `for` that forces evaluation but returns the seq, (doall (for )) is the way to go?
16:40hyPiRionyes
16:42avishaicljr, you could try browsing the namespace to see what's loaded
16:43avishaialso you could try using (load) to force load the clj file
16:44cljravishai: how do you browse the namespace?
16:45avishaiyou could use (ns-aliases)
16:45avishai(ns-publics)
16:45avishaietc
16:45avishaior better yet, use ayler
16:45cljrwell, im clearly an idiot, file wasn't loaded due to a syntax error.....
16:46tickingcljr, if your main is named -main you have to do project.core/-main
16:47cljrticking: yeah, i figured that much, just working tghrough newbie pitfallas
16:47tickingcljr, there are plenty, but the reward is quite worth it ^^
17:03cYmenI think this is the fourth time that I have done something like this (fn [p] (let [p (rest p) f (first p)]...
17:05justin_smith,((fn [[f p]] [(+ f f) p]) [1 2 3]) ; cYmen
17:05clojurebot[2 2]
17:05justin_smith,((fn [[f & p]] [(+ f f) p]) [1 2 3]) ; actually more like this
17:05clojurebot[2 (2 3)]
17:06danielcomptonBuilding on cljr, is there a guide for how to work with Clojure at the repl, move around namespaces, that kind of thing? I have found that part quite confusing
17:08justin_smithdanielcompton: I think you can find everything else if you master - apropos, source, doc, in-ns, require
17:08cljrdanielcompton: im not positive this is accurate or even what you mean, but you can change namespaces with (ns '...)
17:08justin_smith,(clojure.repl/apropos "vec")
17:08clojurebot(vector-of vec vector vector? subvec)
17:08justin_smithcljr: if you are not creating a new one in-ns is better
17:09danielcomptonI was wondering if there is a written guide somewhere explaining the overall workflow and how the different pieces work together
17:09rovarJoy of Clojure has some good bits on experimenting in the repl
17:09cYmenjustin_smith: my point was actually not about destructuring but that my bad variable names lead to clashes and hence weird errors
17:09justin_smithI am sure there is, but all the info is available in the repl itself with the above commands
17:09justin_smithcYmen: ahh, ok
17:09danielcomptonI see
17:09cljramalloy: i notced your name on the docs, so Im gonna shoot a question at you, if you are busy no problem.....
17:10cljramalloy: im following the client part here https://github.com/ztellman/aleph/wiki/TCP
17:10justin_smith,(apropos "ns") ; another good set of leads
17:10clojurebot(ns-aliases booleans the-ns instance? gensym ...)
17:10coventrydanielcompton: The workflow is very flexible, but Stuart Sierra has put a lot of thought/writing into his approach.
17:11danielcomptoncoventry: do you mean http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
17:12coventrydanielcompton: Yes. Also, with good editor integration you don't necessarily end up doing a lot directly in the repl. You just send forms via emacs.
17:12coventrydanielcompton: So this is worth a read http://clojure-doc.org/articles/tutorials/emacs.html#using-the-repl
17:12danielcomptonSimilar for vim?
17:13danielcomptonI've been holding out on Emacs but maybe I just need to take the plunge
17:13cljramalloy: ive done everything b4 enqueue, and i can see something in the channel, however, when i enqueue, i do not see that inside the channel, too....it is my understanding that is a bidirectional channgle?
17:13coventrydanielcompton: Yes, do it. Vim has many strengths, but it is definitely the poor step child in this regard.
17:14justin_smithanother thing to remember is that there are very few things that work differently between a repl and a loaded file, so you can think less about "how the repl works" and more about "how clojure works"
17:18danielcomptonWould behaviour of loaded namespaces be one of those differences?
17:23justin_smithnope
17:23justin_smithif you require the namespace into the working namespace, it works the same in a repl as in a file
17:26coventryThe main difference between at-the-repl and other contexts is that the print stage forces evaluation of lazy structures.
17:28coventryYou could write a function which behaved differently at the repl by having it depend on its stack trace, I guess.
17:32justin_smithand there are different design considerations
17:32justin_smithI only call use in the repl
17:32justin_smithI only rebind things in namespaces I didn't write in the repl
17:32justin_smithbut that isn't different functionality, just best practices
17:33avishaiis there a function which is equivalent to #(or (seq? %) (coll? %))
17:33avishaie.g. to check i can iterate on param
17:40shriphanihi everyone. Is is possible to make enlive retain the path from root to a node when I use a selector? i.e. delete the subtrees that don't fit the selector ?
17:43justin_smithavishai: seq
17:43justin_smithit will be truthy if iterable
17:43justin_smithfalsey if not
17:43avishaijustin_smith, seq?
17:44justin_smithno, seq
17:44justin_smithwait...
17:44justin_smithsorry
17:44justin_smiththat doesn't work since seq fails on thing that are not iterable with an exception
17:44justin_smith$source seq
17:44lazybotseq is http://is.gd/detxmL
17:45justin_smithbut the source to seq shows what you would need to do to canonically make that check
17:45avishai10x
17:46justin_smithhmm - need to check the java code for that one actually
17:49coventryWhy would it be bad to be able to take the value of a macro?
17:50justin_smithmacros only do their thing at compile time
17:51justin_smithif you passed one at runtime, how would you know what to do with it?
17:51justin_smithhow would the compiler know what to expand?
17:53coventry`Was thinking it could be useful to return a convenience macro at the repl some times. There are workarounds, though.
17:54justin_smithyou can pass the var it is bound to
17:54justin_smith,#'or
17:54clojurebot#'clojure.core/or
17:54justin_smiththat is different from the macro, of course
17:54justin_smithbut it points to it
17:56coventryIs there a simple way to get the repl to recognize it as a macro at that point? E.g. (defmacro t []) (@#'t) seems to call t as a straight function.
17:58arrdemunless you use eval somewhere, the concepts of "return" and "macro" are fundimentally incompatible. you should probably look at your "workaround" options, because this is sketchy to say the least.
18:00cljrin c/python you can include \x as an escap seq to encode hex values in strings, what is directly equivalent in clojure?
18:01cljr"\xf9\xbe\xb4\xd9" for example
18:02hyPiRionIt's the same as in Java afaik
18:03hyPiRionSo you got either unicode escape or octal escaping, although I don't think hex escaping like in python possible
18:04hyPiRion,"\u0063"
18:04clojurebot"c"
18:04cljrhmm, alright
18:05mercwithamouthis anyone working through web development in clojure?
18:05justin_smithwhy does this give me an npe: (satisfies? clojure.lang.ISeq [])
18:06justin_smithis that not the right way to refer to the ISeq protocol?
18:08alsoISeq is a protocol?
18:08justin_smithhttps://github.com/clojure/clojure/blob/clojure-1.4.0/src/jvm/clojure/lang/ISeq.java looks like it to me
18:08justin_smithactually I am having trouble using satisfies at all...
18:11alsoi thought that satisfies for was protocols, not interfaces, and that ISeq was an interface.
18:11justin_smithOK
18:11justin_smithhow would I check if something implements the interface? is there a method for that?
18:11dnolenjustin_smith: instance?
18:12dnolen,(instance? clojure.lang.ISeq ())
18:12clojurebottrue
18:13mercwithamouthproblem solved =P
18:13justin_smithnice, that is what I was looking for
18:13justin_smithbut sadly, it still doesn't help me answer the "can you call seq on this without getting an exception" question
18:14justin_smithdo I really need (try (seq x) true (catch Exceptione e false))
18:14justin_smiththat seems silly
18:18AeroNotixwhat arey ou trying to do?
18:18AeroNotixI came in late
18:18justin_smithsomeone had a question
18:19justin_smithhe wanted to know how he could tell if he could iterate on something
18:19AeroNotixseq?
18:19justin_smithexception for some things that don't implement ISeq
18:19justin_smithbut not for others (like strings)
18:19AeroNotix(seq? 'not-a-seq)
18:20justin_smith,(seq? {:a 0 :b 1})
18:20clojurebotfalse
18:20justin_smithyou can iterate on that
18:20AeroNotixah
18:20justin_smith,(seq? "hello")
18:20clojurebotfalse
18:20justin_smithyou can iterate on that too
18:20justin_smithetc.
18:20justin_smiththere seems to be no reliable check, other than attempt to call seq, and catch the exception
18:20justin_smithbut that seems weird
18:20justin_smithI am hoping I am just ignorant of the right answer
18:21justin_smithpragmatically you either know whether the thing coming in should be a collection, or you know the specific collection types to check for, almost always
18:21justin_smithbut as a general question it is still interesting
18:22AeroNotixYou can never be sure about stuff like this in languages which don't have very strong type systems.
18:22AeroNotixThem's the breaks
18:22radsjustin_smith: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L83
18:22radsseqable?
18:22justin_smithoh, cool
18:23justin_smithso that is his answer, thanks
18:23justin_smithoh, that is from a future clojure version
18:23justin_smithlol
18:43xpeso I'm trying to think of a decent name for a Clojure program that is pretty much just a "event loop" that waits for time to pass
18:44xpepart of it is clearly an http service, that's easy. I just want to think of a better name than "loop" or "event-loop" but I guess that would do
18:44xpe(part is the HTTP service, part of it is totally separate)
18:44clojurebotYou don't have to tell me twice.
18:45xpehi clojurebot you work in mysterious ways
18:46xpe,(clojure.java.shell/sh "shutdown now")
18:46clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.java.shell>
18:47xpe,(use '[clojure.java.shell :only [sh]])
18:47clojurebotnil
18:47xpe,(sh "echo hello")
18:47clojurebot#<SecurityException java.lang.SecurityException: denied>
18:56justin_smithxpe: that would look for a command called "echo hello", you probably want (sh "echo" "hello")
18:57xpe,(sh "echo" "thanks") ; justin_smith
18:57clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sh in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:57xpe,(use '[clojure.java.shell :only [sh]])
18:57clojurebotnil
18:57xpe,(sh "echo" "thanks") ; justin_smith
18:57clojurebot#<SecurityException java.lang.SecurityException: denied>
18:57mudgewhat is the clojure idiomatic way to get the last 4 characters of a string as a string?
18:58amalloy&(doc subs)
18:58lazybot⇒ "([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."
18:58xpe,(apply str (take-last 4 "arstdhne"))
18:58clojurebot"dhne"
18:58justin_smith,(#(subs % (- (count %) 4)) "hello")
18:58clojurebot"ello"
18:59xpebut `subs` looks better
18:59andyfmudge: Also depends a bit on whether you care about UTF-16 Unicode encoding, and your definition of character, but that might be further down the rabbit hole than you need to go
19:00mudgehmm.... I wonder why subs doesn't take a negative index to indicate number of characters from the end of the string
19:00andyfmudge: It has been proposed, but never implemented in Clojure yet.
19:00justin_smithyeah, that bugs me, but count is constant time, because the string is immutible and the size is stored
19:01mudgeandyf: my guess is that at this point it hasn't been added to Clojure because Rich and/or others don't want to add it to the language, and I wonder why
19:01mudgejust_smith: good to know
19:01andyfmudge: I have not heard a reason given that I can recall at this moment. Such a fn is not difficult to write yourself if you want one.
19:02mudgeyea
19:02mudgethanks guys for the input
19:04mudgeI actually need to see if the last four characters of a string = "html". Is it clojure idiomatic to resort to interop like so: (.endsWith "mystringhtml" "html") ?
19:04mudgeor is it more idomatic to avoid introp?
19:04andyfmudge: I have seen .endsWith and .startsWith frequently in Clojure/JVM code.
19:05alsois there a way with ring to write directly to the OutputStream?
19:06mudgethanks andyf
19:10justin_smith,(.endsWith "foo.html" "html")
19:10clojurebottrue
19:10justin_smithinterop is usually idiomatic, unless it mutates something
19:11mudgejustin_smith: good to know, thanks
19:28john2xwhat's the quickest way to double each character in a string? e.g. "ABC" => "AABBCC"
19:31cljrhas anyone here used gloss much?
19:31justin_smith,(apply str (mapcat #(list % %) "hello")) ; mudge
19:31clojurebot"hheelllloo"
19:32justin_smithI would usually avoid the string -> seq -> string thing, but it may be the easiest way to do something like that
19:32justin_smithbut a way to do it just as a string is welcome
19:32also,(.replaceAll "ABC" "(.)" "$1$1")
19:32clojurebot"AABBCC"
19:32justin_smith(inc also)
19:32lazybot⇒ 1
19:32justin_smithmuch better
19:32john2xnice. thanks!
19:34alsoclojure.string/replace to avoid the interop form
19:40john2x,(clojure.string/replace "ABC" "(.)" "$1$1")
19:40clojurebot"ABC"
19:40alsoah, i think that needs a regex argument
19:40john2x,(clojure.string/replace "ABC" #"(.)" "$1$1")
19:40clojurebot"AABBCC"
19:40also,(clojure.string/replace "ABC" #"(.)" "$1$1")
19:40clojurebot"AABBCC"
20:01l4uis dev compilation time a design goal of clojure?
20:01dnolenl4u: dev compilation time?
20:02cljrIf anyone has any experience with gloss, any pointer on how you would handle this: https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer would be amazing help....
20:04l4udnolen: em.. compilation speed in development mode. do I have to wait for a long time like in java for compilation? or is it relatively fast (like in golang)
20:04cljrit has never been particularly slow for me
20:04dnolenl4u: interactive development is pretty much how people work in Clojure, so it's not really a pain point
20:05l4udnolen: cool
20:05dnolenl4u: the development work flow is very unlike golang - you don't edit your files and compile
20:05dnolenl4u: you write some functions and test them as you go at the REPL
20:07shriphaniHi, if someone is familiar with the clojure source, can you tell me why there is more than 1 definition of invoke here? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java
20:08algernoncljr: you probably want some trickery with (header)
20:08dnolenshriphani: perormance
20:08dnolener performance
20:09shriphaniah. TIL. Thanks.
20:10dnolenshriphani: not specific to keywords, but how functions work in Clojure
20:11gdevdnolen, no blog post about reactjs or tagged literals in cljs? just waiting for the code samples to be feature complete?
20:11algernoncljr: header takes a frame for the header (in this case, :byte), a function that takes that, and returns the codec for the body, and another function that takes a body and returns the header value
20:11l4udnolen: thanks. lemme try the REPL workflow with vim-fireplace
20:12amalloydnolen: wait, performance? IFn requires all of those arities
20:12dnolenamalloy: but the IFn encoding is for performance, you could think of a lot slower ways that involve less typing
20:12algernoncljr: so you can have a function that checks the header, if it's < 0xfd, body is nil, header is identity. if it's <= 0xffff, body is header + :byte
20:13abpHi dnolen, you said libs like jquery aren't nescessary with ClojureScript, or something like that. Is it because we have better ways to abstract with cljs or more recent browsers not requiring much smoothing over API-glitches etc.?
20:13algernonthough I'm not exactly sure how you'd combine the two, but it should be possible, I think.
20:13dnolengdev: still working on it - it's going to be serious doozy of post - perhaps even more so than the CSP ones
20:13dnolengdev: basically that immutable representation for UI is just better always - hopefully that turns some head ;)
20:14gdevdnolen, that virtual DOM =)
20:14dnolenabp: because Google Closure provides much of same functionality and it's optimizable instead of being a giant blob of JS that you have to take wholesale.
20:15petehunt
20:16abpdnolen: Ah ok. Does that even apply when using jquery with externs? I don't know much about how the closure-compiler behaves when externs are present.
20:16dnolenabp: externs doesn't magically make random JS libs optimizable by Closure, it just prevents renaming
20:17abpdnolen: Too bad ;)
20:18cljralgernon: good call, i had just started considering a solution using header, too, thanks
20:19petehuntabp: one of the big issues is polymorphism, at least when it comes to jit-ing
20:22technomancymudge: I added a patch for negative subs, but it got rejected as "goofy"
20:23mudgetechnomancy: hmm... I wonder why it is goofy, seems simpler and better than having to do it these other ways
20:23technomancywell it was a patch
20:24mudgeI could do (.endsWith "stinghtml" "html") but what if I want my code to work in ClojureScript too?
20:24technomancythe default state of a patch is rejection
20:24mudgemeaning that most patches are rejected?
20:24technomancyright
20:24mudgebut did someone say your patch was goofy? that's not a very enlightening reason
20:25technomancyI think rich said it was goofy
20:25technomancymaybe it was silly
20:25mudgeok, i really wonder what Rich would do if he need a substring that contained the last 4 characters of a string
20:25andyfmudge: The quote from Rich was "IMO its' goofy"
20:26gdevis this on Jira?
20:26technomancygdev: I think so, but search isn't working for me ATM
20:26andyfgdev: https://news.ycombinator.com/item?id=2053908
20:27andyfThat link is from JIRA
20:27mudgei don't want to do (subs "somethinghtml" (count "somethinghtml") - 4) every time
20:27gdevandyf, thanks
20:27mudgethat seems more goofy
20:28andyfmudge: So write your own version of subs that works the way you want.
20:28technomancyoh nice; I'm not the only one to submit the exact same patch http://dev.clojure.org/jira/browse/CLJ-1042
20:28andyfmudge: I am not saying it should not go into Clojure, I am saying that waiting for it to go into Clojure before you start doing it yourself is an exercise in futility.
20:29andyftechnomancy: The only JIRA hit while searching for the word "goofy" :-)
20:30mudgeandf, the thing is that some things belong in the core of the language or in the standard library -- things that could be used very frequently in many places. But you are right Andy, perhaps I should make a library with random functions that I use frequently that aren't in the core or standard library
20:30SegFaultAXThat's basically what contrib used to be.
20:30andyfmudge: There is a library useful by amalloy and others that has some thing like this (but maybe not negative indices), and someone else recently came out with another library with similar intentions.
20:30SegFaultAXAlso, flatland/useful
20:31andyfAnyone remember the name of that other one?
20:31mudgeoh that sounds good
20:31technomancyandyf: that's me; the goofy guy
20:31mudgeI just wonder how rich would get a substring at the end of a string
20:31mudgewhat would he do?
20:31andyftechnomancy: I am not saying you are goofy, and I don't think Rich is, either. He thinks the idea of negative indices is goofy.
20:32andyfHe is usually pretty specific in discussing the ideas, not the people, at least in public conversations I have read.
20:32maravillasandyf: was it prismatic's plumbing? https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj
20:33mudgewhere's riche's email address, I"m just too curious why he thinks it is goofy and what he would do.
20:33andyfHere it is: https://github.com/weavejester/medley
20:33andyfAt least, that is the one I was trying to remember.
20:33maravillasah, nifty
20:33andyfmudge: Um, you can send him private email if you want on that topic, but I wouldn't recommend it.
20:34mudgethanks andyf, why don't you recommend it?
20:34andyfmudge: If you want a function like that, check flatland/useful and medley to see if it is already there, and if not, create an issue there or submit a patch.
20:34andyfmudge: Because I think it would be a waste of both of your times.
20:35mudgeandy, sounds good, i doing that now, thank you
20:35dnolenmudge: I think he pretty much stated all the relevant reasons on the HN post
20:35mudgewhere is the HN ost?
20:35andyfhttps://github.com/weavejester/medley
20:35andyfWoops. I meant this: https://news.ycombinator.com/item?id=2053908
20:35danielcomptonAnd an email to the clojure mailing list would benefit everyone, not just you
20:35dnolenmudge: ^
20:39bbloom_technomancy: i just searched JIRA for "goofy"
20:39bbloom_was not disappointed
20:39bitemyapptechnomancy: friend of mine and I are hacking on grom, we were looking at the Async stuff in client.ml and complaining ;)
20:40bitemyapptechnomancy: OCaml needs a do-syntax.
20:45gdevhow did we end up talking about something from 1074 days ago?
20:45andyfgdev: Because mudge asked why there weren't negative indices for subs, and technomancy was remembering the good old days :-
20:46gdevandyf, oh, thanks again =)
20:50andyfmudge: If you have the patience, I'd recommend making your negative-index handling version throw errors in the same conditions that either Perl or Python do, whatever those conditions might be. And documenting what those boundary conditions are, and writing unit tests for them.
20:52pdknah
20:52pdkpeople love array indexing functions that loop around when you go out of range
20:52pdkbe bold
20:52pdkbe daring
20:55gfredericksuse mod and allow any index whatsoever
20:56gfredericksconvert doubles to ints with floor
20:56mudgethanks andyf
20:56gfredericksif you get a string try to parse it as a number
20:56andyfgfredericks: I can't tell whether to laugh or cry at your suggestions.
20:56gfredericksanything else just call .intValue on it and see what happens
20:57mudgesounds very dynamic
20:57gfredericksput it in a lib and name it "goofy"
20:57gfredericksin the technomancy vein of literary character themed libs
20:58andyfIMO that would be goofy :-)
20:59also,(#(+ %0.123e1) 1)
20:59clojurebot1
20:59alsoslightly goofy
20:59andyfalso: Yeah, I might submit some patches for things like that in the next month or three.
20:59gfredericksmost of clojure's goofy is by omission, not design :)
21:00gdevnoway I wanted to use the library name goofy for a lein plugin. it scans your code and adds any files that have goofy code to gitignore so you can push it
21:01gdeverr *can't push it
21:01andyfFirst one to Clojars wins?
21:02gfredericksit's still available
21:02technomancyandyf: oh, yeah understood.
21:03gfredericksis there a ticket for %1.2?
21:04andyfgfredericks: None that I recall, and I recall way too many (but not all)
21:04justin_smithgdev - or joker, if your commit contains a .DS_Store, silently replace a random file with the contents of that .DS_Store file - they would learn their lesson fast
21:08gdevnow thats just mean =p
21:09JoelMcCrackenI'm looking to build a website as my first "real" clojure project. I think pedestal seems a little much for me; is there something better? I have lots of experience in lisp and web development, but almost none on the jvm
21:10JoelMcCrackencompojure seems popular, but its hard to get a feel for the ecosystem from google alone
21:10tickingJoelMcCracken, yeah I would go with the lightweight web stack
21:11mudgednolen: I don't argue that negative indexes should be added to subs --- I just want to know why rich thinks it is goofy and what would he do
21:11tickingJoelMcCracken, Pedestal has the framework approach similar to ruby on rails, all in one box, but I prefer to pick and choose the libraries I like
21:11andyfI am not an authority on these matters but this book seems like a good intro from my going through it: http://pragprog.com/book/dswdcloj/web-development-with-clojure
21:12gdevJoelMcCracken, have you looked at Dmitri Sotnikov's book
21:12andyfI think it is by the same authors as the luminus web framework.
21:12amalloyi think negative indexes are a bad idea because either you have to make every collection type (importantly, including user-created types) support them, or let the language feel inconsistent
21:12andyfLuminus is: https://github.com/yogthos/luminus
21:12JoelMcCrackengdev: i haven't
21:13gdevJoelMcCracken, I think its the one andyf linked
21:13andyfgdev: JoelMcCracken: It is the same book we are mentioning
21:13JoelMcCrackenoh oh. good
21:14tickingLuminus is basically the stack I was going to propose in one package ^^
21:14gdevJoelMcCracken, there is also Caribou http://caribou.github.io/caribou/docs/outline.html
21:14tickingI would go with ring as the webserver adapter, compojure for routing, and on top of that laser for templating
21:16seangrov`justin_smith: Any idea if walk2 works with clojurescript?
21:16justin_smithseangrov`: no clue
21:18tickingJoelMcCracken, if you want to do interactive webapps I'd even take a look at clojurescript and enfocus :)
21:18JoelMcCrackeni'm mostly worried about jvm stuff =-\
21:18JoelMcCrackeni've always been confused/scared by the inpenetrable javaspeak
21:19technomancyhttp://copperthoughts.com/p/clojure-io-p1/ will get you through the most common JDK classes required for basic clojure
21:19mudgeHow to use doseq with ->> ?
21:19technomancymudge: no can do
21:20JoelMcCrackenthanks for the advice! ill probably be buying this book
21:20technomancyJoelMcCracken: none of the crazy dependency injection or factory junk actually matters from clojure unless you're stuck with a specific library that hasn't been wrapped
21:20technomancypretty rare these days
21:21tickingJoelMcCracken, tbh encounters with java are rare in clojure, leiningen shields you pretty well from the tool world, and clojure is so powerfull you almost never have to call java stuff
21:21mudgetechnomancy: I tried wrapping doseq in #( ) but doesn't work
21:21mudgeI want to thread some values through some functions and then pass the value into a doseq
21:23technomancymudge: (let [xs (->> y f1 f2 f3)] (doseq [x xs] ...))
21:23JoelMcCrackenticking: yes well, i'm worried about deployment
21:23mudgethanks technomancy
21:24alsoJoelMcCracken: where will you be deploying?
21:24JoelMcCrackenfor now, ubuntu
21:24tickingJoelMcCracken, scale?
21:24JoelMcCrackeninitially im just developing for myself
21:25tickingJoelMcCracken, do you need websockets?
21:25JoelMcCrackenno
21:25tickinglein-ring
21:26tickingyou declare your handler in your project.clj, and can also put optional init and teardown functions in there
21:26justin_smithhttp-kit does websockets and is compatible with ring
21:26JoelMcCrackenam I understanding correctly that the above book web-development-with-clojure is complete?
21:26tickingand then call lein ring serve
21:26tickingjustin_smith, yeah but not with lein-ring ^^
21:26JoelMcCrackenticking: on production?
21:27technomancyJoelMcCracken: uberjar with ring-jetty-adapter is the easist way to deploy
21:27mudgewhy can't ->> work with doseq?
21:27technomancymudge: because ->> places the element in the last position
21:28technomancymudge: the last position of doseq is where side-effects go, not inputs
21:28tickingJoelMcCracken, like technomancy said, lein ring uberjar will give you a jar you can run, lein ring uberwar will give you a war for tomcat and the like but that would be overkill
21:30mudgetechnomancy: I see, but I tried wrapping doseq in a function with #(doseq [file-path %] body)
21:31mudgemaybe I am using #( ) incorrectly?
21:31technomancymudge: easier for you just to macroexpand than for me to explain =)
21:31mudgeOkay, I will do that
21:32tickingJoelMcCracken, so you should probably go with https://github.com/weavejester/lein-ring and the default ring jetty adapter, some people like to run http-kit in production (as justin_smith mentioned) but that requires some (3 line) setup, vs 0
21:38justin_smithmudge: (#(doseq [file-path %] body))
21:38mudgejustin_smith: that's it thanks
21:39mudgewell I will try that
21:40mudgetechnomancy: I am just starting to use cider in emacs, not sure how to macroexpand the part that you expect me to
21:41technomancymudge: nothing cider-specific required
21:41technomancy,(macroexpand-1 '(->> [123] (doseq [x %] (prn x))))
21:41clojurebot(doseq [x %] (prn x) [123])
21:41JoelMcCrackenok =)
21:41JoelMcCrackeni'll try it
21:42technomancycider has fancy ways of doing that, but start with the repl when in doubt
21:43coventryIn the cider-specific department, there is C-c M-m, nrepl-macroexpand-all (I guess cider is the same, anyway.)
21:43mudgeokay
21:45mudge,(macroexpand-1 '(->> [123] #((doseq [x %] (prn x)))))
21:46clojurebot(fn* [p1__61#] ((doseq [x p1__61#] (prn x))) [123])
21:47mudgethat looks like it should work
21:47justin_smithmudge: you have the # in the wrong place
21:47justin_smithnot #(( but (#(
21:47mudgeah
21:48danielcomptonJoelMcCracken I found https://devcenter.heroku.com/articles/clojure-web-application to be a good starting point for understanding how all of the pieces fit together
21:49mudgejustin_smith, yes that works
21:53mudgei understand, thanks technomancy
21:54technomancymudge: I'm in the middle of playing learn.code.org with my kids, so I'm very much in the "ask the right questions; don't give the answer" mode now =)
21:56mudgehaha
22:08gdevtechnomancy, lol I did hello.processing.org with my kids today and by the end of the hour I was totally in a "okay, here's the bloody answer" mode
22:08technomancygdev: well iirc processing is just simplified Java, right?
22:10gdev"simplified" java
22:10technomancythat's actually one of the things that bugged me most about quil; it's still super imperative =\
22:11tickingand buggy^^
22:12gdevyeah I'm wondering if the same techniques that were used to make seesaw could be used to improve quil
22:13tickingI think generating svg with clojurescript could be rea,,y functional and nice
22:13technomancyI'm hoping to work my way up to racket
22:14technomancybut the lowest-level racket stuff I've found targets middle school
22:14justin_smithticking: this lib may not be far from clojurescript compatibilityhttp://liebke.github.io/analemma/
22:14justin_smithit does a nice nested map / svg conversion, and supports animation
22:14nkozothere is a way to disable the chunked behaviour of the sequences?
22:15justin_smithnkozo: if the precise timing of the realization matters so much you probably want something more imperative - loop is not chunked
22:16tickingjustin_smith, I was thinking among the lines of enfocus style transformatations, but convertig the entire document at once might also work ^^
22:17tickingtechnomancy, for you or your kids?^^
22:18nkozojustin_smith: the timing is not the problem, but the realizations of the elements are expensive
22:19technomancyticking: for my kids
22:19tickingtechnomancy, maybe there should me more clojure learning games, I wanted to do a mars rover game for some time now
22:19nkozojustin_smith: I already used a loop but I had the doubt if was possible to make more elegant approach using sequences... but the chunked behaviour is my main obstacle
22:20technomancyticking: clojure is pretty newbie-hostile
22:20technomancyI wouldn't put my kids on it till they had a solid start in racket
22:21newblueis this a reasonable way to handle a boolean state in a closure? https://www.refheap.com/21610
22:21technomancythere's a 15-year old at seajure who's presented on optimizing puzzle-solving algorithms, but he started around 8 in racket iirc
22:22tickingtechnomancy, could be, but I think the method is more important than the language
22:22technomancyif I dropped clojure on my kids I would just be constantly apologizing for the stack traces and stuff; it would be awful
22:23tickingtechnomancy, I would start with a core.async channel you can shove :forward :left :right :pick and :drop in, so you had to do everything by hand
22:23tickingand then gradually automate on top of that
22:25tickingtechnomancy, controlling a roomba that way could be fun ^^
22:26justin_smithnkozo: you can generate a lazy-seq from loop. The performance penalty is a side effect, if you need to control it you want something more imperative than the standard lazy functions.
22:27justin_smithactually strike using loop, if you are recurring to a lazy tail you don't need to use optimized recursion, a self call suffices
22:29emaphistechnomancy: look at Logo, a lisp for kids. has recursion and higher order functions
22:30nkozojustin_smith: thanks, will research that.
22:30gdevtechnomancy, funny that you mention quil, I was just playing with it today. this was a direct port from the java version, but still kinda awful https://gist.github.com/gdeer81/7866927
22:30emaphistechnomancy: then a look for "The Great Logo Adventure", on the net, IttTeaches recursion and higher order fucntions to kids.
22:32tickingemaphis, I love logo for the fact that it is the oldest lisp still in use today
22:32emaphistechnomancy: then graduate to Brian Harvey's "Computer Schience Logo Style" kind of a SICP for kids.
22:32emaphisticking: :-)
22:33emaphiss/Schience/Science.
22:33zerokarmalefttechnomancy: what are you teaching them in the meantime?
22:34justin_smithnewblue: you can use reset! if you don't care what the original value was
22:35justin_smithnewblue: and :active? can be redefined as deref
22:36justin_smith(fn [] @active) = #(deref active)
22:37justin_smithalso, why do activate and deactivate take an arg? the code as is won't work
22:37newbluejustin_smith: just plugged in deref and it definitely looks cleaner
22:38newblueand reset! is totally what I was looking for, too - I was most worried about the double parenthesis and whether is a code smell
22:38ZerkerWait logo is immutable?
22:39newblue*it is
22:39Zerkervariables are*
22:39justin_smithnewblue: double parens just means you are looking somthing up in order to call it
22:41technomancyemaphis: racket actually implements logo =)
22:41technomancyemaphis: but having a curriculum to work through would help; I'll take a look. thanks.
22:42zerokarmalefttechnomancy: ah, read the scrollback...learn.code.org looks cool...like a web version of scratch
22:42justin_smithif it is a code smell it is only because it indicates you were doing data hiding (with your closure), and with immutibility data hiding is less useful and more annoying
22:42technomancyzerokarmaleft: it's a lot more focused; I feel like they're much less distracted
22:42newbluejustin_smith: I don't mind 'em at all, just trying to use "proper style" where I can. Speaking of, is there an upper limit to how much you should cram into a closure?
22:42justin_smiththe limit is readability
22:43justin_smithbut consider using a function that returns an updated state, rather than a clojure that changes a hidden state
22:43justin_smith*a closure that
22:43technomancyzerokarmaleft: you can do scratch on the web (but in flash; ick) but the main draw of code.org is that it's guided tutorials instead of free-form play
22:43technomancy(there's a place for both IMO, but right now they are learning a lot more from the tutorials)
22:45zerokarmalefttechnomancy: the fact that it uses assets from familiar games will help me keep their interest too, I think
22:45technomancythere's a book for scratch that has some guided activities, but it's still too free-form for my 5 year-old
22:45tickingyeah but I wonder how long it takes to undo the imperative damage done
22:46technomancyticking: =\
22:46technomancyMatthew Flatt (of racket fame) had that same complaint and suggested http://www.bootstrapworld.org/
22:46gdevtechnomancy, i have that book too. was a total waste
22:46tickingI remember that it took me years to unlearn OO
22:47technomancybut there's no way you could start a 5-year-old on that
22:47tickingyeah they even lost me after not having something running after 5 clicks and 21 seconds ^^
22:48technomancyI think bootstrap is designed for a classroom
22:49technomancy(which is a pretty hostile environment for learning)
22:49tickingthe problem is though, functional programming in a learning environment is uber hard
22:49tickingI agree
22:49coventrynkozo: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L178
22:49technomancyticking: eh... what about 4clojure?
22:49gdevminikanren4kids.org is an available domain
22:49tickingtechnomancy, they are the worst
22:49technomancyyou just need to frame things in terms of values
22:50tickingtechnomancy "solve this problem without using the idiomatic simple solution"
22:50musicalchairneed not a computer to teach the programmer's mind. I think a lot could be taught by acting thingss out physically. Say, your kid could dictate a logo program and you act it out on the floor
22:50technomancyit's a bit less obvious than scratch/code.org, but just because no one's done it doesn't mean it's inherently difficult
22:50technomancymusicalchair: http://www.robotturtles.com/ =D
22:50emaphistechnomancy: "The Great Logo Adventure" is a curiclulum for children but it might be a little heavy for a 5 year old. :-) but there is a reference to it on this page: http://www.softronix.com/logo.html
22:50technomancyemaphis: thanks
22:50musicalchairtechnomancy: =)
22:50newbluejustin_smith: I have a semi-bloated closure already, and am just tacking on active/not active. It has a few GUI items and their bindings...I dunno, it seems the best way to quarantine the all the state
22:51technomancymy 5-year-old is reading at a 3rd-grade level, so it might work
22:52tickingtechnomancy I think having no mutable world makes it difficult, because there is nothing to interact with really
22:52coventryI've was tutoring some people in python this semester, and the biggest problem was the course instructor, but wow it was hard to lead them to the right answer without just telling them.
22:52musicalchairseparately, I'm not convinced functional programming needs to be the first thing taught to avoid "imperative damage" The CPU is imperative, after all
22:52technomancyticking: true; it forces you to be more abstract, which is objectively more difficult for early-stage childhood development
22:52technomancypart of the point of logo is to be the bridge between the abstract and concrete
22:53technomancyso at that developmental stage, reaching FP through imperative ideas might be necessary
22:53tickingmusicalchair, yeah but not because it is such a nice programming model ^^
22:54technomancycoventry: pick up some tips from reading socratic dialogues
22:54technomancyhe seemed to have a knack for it =)
22:55musicalchairticking: just a supremely practical one. most cookbooks I've seen are imperative. something about the real world...
22:55technomancyIIRC Meno deals with imparting mathematical knowledge
22:56coventryOh, I've got it down pretty well, and they were happy with the results, but it took far more iterations of question/attempt-at-answer than it usually does when teaching math (it was the first time I'd tried to teach people programming.)
22:56tickingmusicalchair, I'm not saying that there shouldn't be imperative concepts, I just don't think javascript is a good start
22:56technomancyhttps://en.wikipedia.org/wiki/Meno#Dialogue_with_Meno.27s_slave
22:57technomancycoventry: ah gotcha
22:57musicalchairticking: agreed. I was getting a little rambunctious =X
22:57tickingmusicalchair, which is what code.org does basically
22:58tickingmusicalchair, btw I think that teaching assembly is actually better than say java
22:58gdevmusicalchair, cookbooks are imperative, but restaurant menus are more declarative. select cheesecake from dessert menu
22:58tickingmusicalchair, because you can see all the state at once, (at leasf the registers)
22:59emaphisgdev: unless you think of a recipe as a fucntion. :-)
23:00emaphis*function
23:00cljri imagine this is a really stupid quesiton, but clojure.contrib is built in, correct?
23:00coventryI learned assembly about two years after I learned BASIC, and it was WAY harder. I suppose it might have been the quality of the tools, though.
23:00tickingcljr, contrib is dead
23:00mheldok. the next version of lein needs to be able to figure out what to do with git repos
23:00mheldjust... fyi
23:00seangrovecoventry: Yeah, that's a pretty huge gap
23:00tickingcljr, it was spitted up into different clojure projects and the core
23:00musicalchairticking: yes, I might agree. I think you would want a "friendly" assembly. I guess that is pretty much logo
23:01emaphismheld: source control without setting your hair on fire.
23:01justin_smithmheld: what do you mean?
23:02technomancyticking: because no one programming assembly would actually do it by choice beyond a week or two =)
23:02tickingmusicalchair, yeah, one line per instruction, single side assignment, looks like llvm for kids ^^
23:02cljrticking: well, that explains a lot actually
23:02musicalchairgdev: perhaps, but I'm not sure what you learn about the process of cooking from a menu. I should probably have not made the analogy, it's better to be direct
23:02justin_smithforth is a good choice for assembly-like while still teaching about abstraction and design
23:02technomancy"your first programming language can be anything, as long as your second makes you wonder what the hell was wrong with the first"
23:02tickingtechnomancy, yeah but by then you will have the deeps satisfaction of knowing what is really going on and can then move to higher abstractions ^^
23:03mheldjustin_smith: [clj-time "0.6.0" :git "URL_TO_REPO_TO_CLONE_FROM"]
23:03mheldor something
23:03musicalchairtechnomancy: now that's a solid way to teach; by comparison
23:03technomancymusicalchair: already been bitten by the lack of function arguments in scratch =)
23:03musicalchairyou don't know what you have until it's gone, etc
23:03coventrymheld: Do you know about checkout dependencies?
23:05gdevin the end our kids will just grow up to be project managers anyway -_-
23:05emaphistechnomancy: BYOB is a version of scratch with functions, recursion and higher order funtions.
23:05mheldcoventry: I'm unfamiliar with this
23:05tickingmusicalchair, technomancy, but wouldn't then clojure be ideal? you could start out with imperative core async (basically "actors") , then functional clojure, then core.logic ^^
23:05coventrymheld: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
23:05emaphistechnomancy: http://byob.berkeley.edu/
23:06mheldcoventry: I guess that works, too
23:06mheldstill think the way that bundlr does it is awesome
23:07mheldbundler
23:09mheldalso, boo on the name of the folder checkouts
23:10mheldnow when I checkout branches on git it'll ask me "zsh: correct 'checkout' to 'checkouts' [nyae]?"
23:10tickingI have to say, zuckerberg on code.org creeps me out
23:11emaphismore than Bill Gates?
23:11musicalchairticking: it might be promising in some ways but I think programming is far from any ideals both in pedagogy and practice. Who knows what programming will be like in 20 years, anyway?
23:12tickingmusicalchair, same as every year, some shitty language like php
23:13coventrymheld: just use magit for basic git tasks. Less typing. :-)
23:14tickingmusicalchair, it's shitty langs until the AI singularity ^^
23:14gdevyeah I'm sure 20 years ago people said the same thing and those people were probably shocked to find out we'd be optimizing around the same constraints we had 20 years ago
23:14tickinggdev, to be fail paralellism has taken of in our gpus
23:14tickingfair
23:15tickingbut we still throw c at it ^^
23:15deadghostthere's some hype with that thing wolfram is working on
23:16emaphisdeadghost: isn'
23:16emaphishe inventing Lisp?
23:17tickingthat stuff is so great
23:17tickingdid you read that article?
23:18deadghostI think I did
23:18ticking"in the past programming languages have been modular and chopped up, we solve this problem by having one monolythic language that integrates everything"
23:18cljrhmm, there used to bea nice repeat function in clohjure.contrib.,string, but that isn't in clojure.string, is there somewhere else i should be looking?
23:19tickingcljr, what does it do?
23:19cljrticking: http://clojuredocs.org/clojure_contrib/clojure.contrib.string/repeat
23:19tickingcljr, as a general guide see this http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
23:21tickingcljr, it seems to have gotten lost, but no worries
23:21ticking`(apply str (repeat 5 "hi"))
23:22cljrticking: very cool, thank you
23:22ticking,(apply str (repeat 5 "hi"))
23:22clojurebot"hihihihihi"
23:25bitemyapptoday was a good day :D
23:25gdevbitemyapp, you didn't have to use your AK?
23:26bitemyappgdev: good reference, used to own one, they're nice but not very accurate.
23:26bitemyappgdev: actually because I pair-programmed some Haskell with a buddy of mine for 4 or 5 hours, had some good food, and got a silk scarf.
23:28bitemyappyou can accurize or upgrade an AK, but realistically, there are more accurate 7.62x39mm rifles out there. The only thing "special" about them is the brand cachet and extreme reliability.
23:28gdevI haven't had a silk scarf since my deployment to Chile
23:29bitemyappgdev: deployment?
23:29gdevwith the Navy
23:29tickingas a war file?
23:29bitemyappgdev: ahhh, my company has a lab in chile.
23:29bitemyappgdev: apparently the food in Chile is *terrible*.
23:30tickingbitemyapp, but the wine is goow
23:30gdevbitemyapp, I wouldn't know, I always ate dinner on the ship so I could save my money for the bar
23:30gdevthe wine was goow, that is true
23:30tickinghrhr
23:31seangrovebitemyapp: Seems the wrong weather for a silk scarf - is it warm enough?
23:31bitemyappgdev: supposedly the default meal for the people there is a boiled hot dog wrapped in wonder bread.
23:31tickingI'm in keyboard limbo, between qwerty and workman
23:31bitemyappseangrove: that's the point, I need a cover, not to be suffocated with heat.
23:32bitemyappseangrove: also, I say silk, but it's quite fuzzy. 100% silk though.
23:32bitemyappseangrove: sale at Macy's, 25-50% off.
23:32seangrovebitemyapp: Ah, ok, fuzzy silk scarf sounds good.
23:32gdevbitemyapp, so tell us more about this...Haskell, is it?
23:32bitemyappseangrove: I didn't go in intending to get silk, it was the only non-acrylic scarf I could find.
23:32seangroveI'd rather bitemyapp talked to Crockford about it
23:32gdevI've heard some interesting things about it on the intertweets
23:32bitemyappseangrove: what's this about Crockford and Haskell lately?
23:33bitemyappoh, my RT?
23:33seangrovebitemyapp: His "monads and gonads" talk :P
23:33bitemyappCrockford has given talks on monads lately, yeah.
23:33bitemyappthat's not his only one that mentions monads.
23:33bitemyappIt's not strictly correct, but close enough anyway.
23:33bitemyapphe's trying to approximate the concept for muggles.
23:33bitemyappit's easier to just write the code.
23:34bitemyappgdev: if you have a question, ask :P
23:35gdevbitemyapp, actually, I'll take my chances in the #haskell channel =b
23:36seangrovebitemyapp: I suppose, but was pretty surprised by some of his remarks about js leading the way.
23:37bitemyappseangrove: yeah, that was a lie.
23:37bitemyappfunctional and useful implementations of monads in untyped languages doesn't make a ton of sense.
23:37bitemyappyou need type deduction for it to provide any real leverage or be nice to use.
23:38seangrovebitemyapp: In any case, he's done a lot of work with spreading some knowledge, that's good for something.
23:38bitemyappnot that you *can't* use monads outside of that context, it's just that it will be very rare for it to make much sense, which means you're back to smashing rocks together like a fuckin' neanderthal
23:39emaphisAt any rate, functional programming in javascript: http://shop.oreilly.com/product/0636920028857.do
23:40Zerkertwisted: just learn steno already
23:40Zerkerticking: *
23:40coventryI came across this recently, it's an interesting perspective. http://marijnhaverbeke.nl/monad.html
23:41Zerker\me has fallen victim to http://xkcd.com/604/
23:46cljris there a better way to get debugging output? when i run a function in console and an erroer ppops up, it only tells me some area way down in the stack where the problem occured, it doesn't tell where in my file is causing the error
23:50justin_smithcljr: is the function defined in a file or in the repl?
23:51justin_smithcljr: if you load it for a file you will get line number info, you can do (require '[my.ns :as my] :reload)
23:56cljrjustin_smith: im not totally following, it is defined in a file and im just opening up a repl and runnning one of the fcuntions within that namespace, but only line number information is related to functions that my function is calling