#clojure logs

2013-12-30

00:56deadghostso guys
00:56deadghostafter 3 weeks of using clojure
00:56deadghostI am nearly done with my first project
00:56deadghostNEARLY
00:56TEttingerdeadghost, you're fast
00:56deadghostthing that's stopping me is libre office actually
00:57TEttingerit took me a year...
00:57TEttingerwhat?
00:57clojurebotwhat is http://gist.github.com/306174
00:57deadghostwhat I'm doing is trying to start a web site making business
00:57deadghostnothing complicated
00:57deadghostjust wordpress
00:57deadghostso
00:57deadghostI scrape yellowpages for businesses with no listed site
00:57deadghostusing clojure
00:57deadghostcompile that info into a db
00:58deadghostthen wrote a web interface to enter an url if they actually do have a site
00:58TEttingerthat's handy
00:59deadghostand creating mailing labels using libre office and postgresql
00:59deadghostI think I just spent 4-5 hours just trying to get the template to work
00:59deadghostnot even getting the data into it
00:59deadghostjust the template margins and such
01:00deadghostTEttinger, you probably finished a more complex project
01:00TEttinger... maybe
01:00TEttingermy first project that I think was "real" was probably a CSV reader lib
01:00TEttingerthere already was one but it wasn't very flexible
01:01deadghostI shouldn't even need to scrape since yp gave me api access
01:01deadghostbut for some reason the data was less accurate than a scrape
01:01TEttingerhahaha
01:01TEttingerthat's awful
01:02deadghostanyways result was about 20,000 businesses nearby with no listed website
01:02deadghosthopefully I get enough bucks to not need to find work
01:03deadghostTEttinger, I'm not sure whether I'd count this project as slow or fast
01:03deadghost3 weeks since I touched or read any kind of clojure
01:04deadghostbut it's a small project that should take a day or two in a familiar language
01:05TEttingernice though
01:05TEttingerthink you understand the language better than when you started?
01:06deadghostyes
01:06TEttingergood stuff
01:06deadghostbut I'm sacrificing some learning to shove things through
01:06deadghostkind of how I wrote a pornhub clone without understanding how a function worked
01:07deadghostbut with actual learning
01:07TEttingerclojure has such a large and powerful standard lib, that's the big thing I need to learn more of. there's tricks with stuff like distinct and into, that I still don't get yet
01:07deadghostif you didn't say clojure
01:08deadghostI'd mistake that as describing sql
01:08TEttingerheh
01:08TEttinger(doc distinct)
01:08clojurebot"([coll]); Returns a lazy sequence of the elements of coll with duplicates removed"
01:08TEttingerand that can be used to check for whether something contains duplicates
01:09deadghostI still need to figure out macros
01:09deadghostenlive/compojure
01:09TEttingersame here
01:09deadghostunit tests
01:09deadghostemacs environment
01:09TEttingerI use light table
01:09deadghostlein set up
01:09TEttingerlein rules.
01:10deadghostthere's a designer that wants to do a start up with me
01:10deadghostand good shot I'll be the only programmer
01:10ddimathen maybe stick to something you already know well for the beginning? ;)
01:10deadghostso kind of need to grind through every thing
01:10deadghostnope I'm inexperienced with everything
01:10deadghostfull speed with clojure
01:11ddimaahok :)
01:16arrdemanyone have a hosted email solution they'd promote?
01:28bitemyapparrdem: http://i.imgur.com/HBzJCEg.jpg
01:28bitemyapparrdem: fastmail I've heard good things about.
01:28bitemyappif that's not what you meant, please do clarify.
01:28arrdembitemyapp: ohai. goddamn pugs totally broke my win streak. I won one of five games today.
01:29bitemyapparrdem: the problem with running your own postfix server isn't that it's hard, it's that you have no credibility in the overall email network and it's hard to guarantee deliverability without taking a few measures.
01:29arrdembitemyapp: and yeah that's what I was looking for. sorta.
01:30arrdembitemyapp: such as? I've tried to run my own postfix before and I noticed that my sendmails never got delivered but I never figured out why or how to mitigate it.
01:32bitemyapparrdem: nobody trusts an anonymous postfix server.
01:32bitemyapparrdem: setting things up so you can get your email delivered is a whole industry unto itself.
01:33bitemyappthe situation with spam is bad enough that individuals basically can't expect perfect deliverability on their own mail servers.
01:33deadghostexplains why no one gets my emails
01:33bitemyappno offense, but people that don't know about these issues or how to mitigate them - probably shouldn't be running their own mail server
01:34bitemyappand should instead point their MX records at a service like fastmail and let them handle it.
01:35deadghostmy friend wanted to set up email and I totally don't know how well he did
01:35arrdemTEttinger: Pick Up Gamers
01:35deadghostI do know that google was mad at my email for a while because of ipv6 or some such
01:36deadghostand then magically stopped being mad and took my emails
01:36bitemyapparrdem: yeah pugglies are awful.
01:36arrdemTEttinger: random people you get matched with. Typically the word PUG implies that they are totally incompetent to boot
01:36TEttingerarrdem, heh that would be me, if I played
01:36TEttingerinstead, I am a Fatlus
01:36bitemyappTEttinger: oh you like Atlus games?
01:36TEttingeryes
01:37bitemyappTEttinger: are Persona games Atlus?
01:37TEttingerI think so. normally I think it refers to fans of the atlus hard-core RPGs
01:37deadghostI thought they were
01:37bitemyappTEttinger: I played Persona 4, found it too grindy.
01:37TEttingerfor me that means the NIS-made games, disgaea, makai kingdom, etc.
01:38bitemyappI think I prefer Tactical RPGs that are balanced for no grinding.
01:38TEttingerheh, I'm the opposite
01:38bitemyappI liked Disgaea a bit too, but the same grinding problem.
01:38bitemyappI don't like wasting my time.
01:38bitemyappand I don't like skinner boxes.
01:38TEttingerit isn't a waste if numbers go up!!111
01:38deadghostI thought kotr wasn't grindy enough
01:39deadghostor was it KOTOR
01:39TEttingerknights of the old republic?
01:39deadghostyes
01:39deadghostplay through felt incredibly fast
01:39TEttingerI still need to play that and the mass effect series
01:39TEttingernot very good at real-time games
01:40TEttingerpuggle
01:40deadghostI need to get around to playing civ 5
01:40deadghostbecause of the anime mods
01:40bitemyappman, KOTOR. Such a great game.
01:40TEttingerhaha
01:40bitemyapptoo bad the sequel was so janky.
01:40TEttingeris janky getting popular now?
01:40TEttingerthe word I mean
01:42deadghosthow many hours a day do you spend on programming activities
01:43deadghosteveryone seems more knowledgeable and make more stuff than me
01:43deadghostmakes me wonder if everyone is a neckbeard consistently putting in 12 hours a day or something
01:44ryanfanyone know of a good blog post or something about the relationship between multimethods and namespaces?
01:45ryanfspecifically I'm wondering, if there are defmethods scattered in different namespaces, does the file where the method is being called need to refer to those namespaces somehow in order for the method definitions to be available
01:45ryanfor do they just need to be loaded or what?
01:50ryanfnvm, got it working
01:55bbloomhelp me out you persistent data loving crazy wonderful people you: http://stackoverflow.com/questions/20834721/what-libraries-provide-persistent-data-structures/
01:57bitemyappbbloom: what, you want me to list off a bunch of Haskell libraries?
01:57deadghostwhy did you ask a question
01:57deadghostthen immediately answer yourself
01:57deadghostthen comment to your own answer right after
01:57bbloomdeadghost: http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/
01:58bbloombitemyapp: sure, why not :-P
01:58bitemyappbbloom: poasted.
01:59bitemyappbbloom: linked tim's work on clojure-py and unordered-containers.
01:59bbloomdoes clojure py expose its data structures?
01:59bitemyappbbloom: considering I've been using them, yes.
01:59bitemyappbbloom: we use clojure-py as a library at work for production stuff.
01:59bbloombitemyapp: awesome
01:59bitemyapp'course that's also why I bitch about it incessantly because it's not mature at all.
01:59bbloomwhy didn't i think to look there? :-)
02:00bitemyappbbloom: you need hashable collections to represent edn in Python. That's why we needed clojure-py.
02:00bitemyappThat it has a lisp reader as well was just a bonus.
02:02deadghostok I'll be sure to be more schizo
02:02deadghostand talk to myself on stacko
02:12bitemyappbbloom: I found examples of libraries in C#, Java, and JavaScript - edited my post to add them
02:13bitemyappbbloom: I expect upboats o_o
02:14bbloombitemyapp: upboat delivered
02:14bbloomthanks :-)
02:14bitemyappbbloom: I tried to make certain they weren't dumb copying collections.
02:17bbloomk past my bed time. i'm maybe going to attempt to do some work tomorrow after this lazy ass week
02:26mischanixI'm new to clojure; I'm designing a clojure model of an existing card game (CCG; Hearthstone), and I have a large class of functions which each alter a tiny part of the game state. I'm trying to describe, as succinctly as possible, an action which is the composition of two smaller actions, but with a different dice roll for each of the smaller actions.
02:27TEttinger(doc comp)
02:27clojurebot"([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
02:28TEttingermischanix, the different die roll thing is... I think you might want to pass in a variable for the kind of roll?
02:29TEttingermischanix, do you have some examples?
02:30mischanixBefore I draw an example, do you know if in a situation like this the argument containing the game state should be the last or the first?
02:30TEttingerI'd say first
02:30TEttingerfor purposes of -> I guess
02:30TEttingerthough last you can just use ->>
02:31mischanixHow do you do partials with just the first argument needing to be applied?
02:31mischanixIs there anything in the library for that or should I diy it?
02:31TEttinger,(#(+ % 10) 5)
02:31clojurebot15
02:31TEttinger,(#(+ 10 %) 5)
02:31clojurebot15
02:38mischanixYeah, I found a nice way to do it now, thinking about it just as plain partials. Thanks.
02:39TEttingernp
02:42marcopolo`is there some library that does automatic currying in clojure? has anyone used it?
02:42marcopolo`I guess automatic is a bit superflous
03:58ryanfdnolen: I'm seeing a bug in clojurescript 2127 that looks related to this http://dev.clojure.org/jira/browse/CLJS-643
03:58ryanfare you aware of anything like that?
03:58ryanfor anyone else
03:59ryanfI don't really understand what's going on well enough to diagnose it, but array-map-index-of-keyword? is returning null because cljs.core.constant$keyword$6 isn't defined https://gist.github.com/rf-/882121c30ec6ffc178c7
04:00ryanfthe upshot is that (assoc a-map :keyword value) is returning null
04:01ryanf(that gist is manually deobfuscated compiler output)
04:02lgs32ayou can't assoc anymore?
04:03ryanfit's specifically the path where you call three-arg assoc and the key is a keyword that isn't already in the map -- at least, that's the case where I know it's not working
04:03ryanfit looks like other things would probably be broken for the same reason though
04:06ryanfclearing out my compilation targets and running cljsbuild once from scratch fixes it
04:06ryanfwhich makes sense based on the stuff in that jira issue
04:06ryanfbut I made a temp commit if anyone wants to see how to repro it
04:06ryanfgoing to bed now though
04:31seriously_random& more is not very clear: http://pastebin.com/MC266AiN
04:31lazybotjava.lang.RuntimeException: Unable to resolve symbol: more in this context
04:33pyrtsaseriously_random: How about (cons x (cons y more))?
04:34pyrtsaOr (apply list x y more)
04:34pyrtsacons is probably better in this case.
04:34seriously_randomcons is fine
04:39TEttinger,((fn ([] 1) ([x] x) ([x y] (* x y)) ([x y & more] (reduce * (concat [x y] more)))) 1 2 3 4)
04:39clojurebot24
04:40TEttingerseriously_random: ^
04:50bitemyapp$seen ucb
04:50lazybotucb was last seen quitting 18 hours and 28 minutes ago.
04:50bitemyappdermert.
04:53seriously_randomTEttinger, agree, that is even more clear
04:54TEttingerhooray
05:06hyPiRion(list* x y more)
05:08pyrtsaHa, didn't know about list*!
05:08TEttinger(doc list*)
05:08clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
05:08TEttingernice
05:54seriously_randomstuck with predicate and reduce: http://pastebin.com/S3iXWm6w
05:58pyrtsaseriously_random: Check some-fn and every-pred.
06:25seriously_randompyrtsa, sorry that doesn't help me much. Can you give a hint how to chain "and" recursively? Do I need to create every possible pair from the sequence of preds?
06:27abaranos`seriously_random: if you use filter you cannot get the effect you want
06:28abaranos`you could combine reductions with filter to get the filtered results at each step of the way
06:30TEttinger,(loop [data [1 0 4 -2 :a 7 "a" 2] fns [number? integer? pos? even?]] (if (empty? fns) data (recur (filter (first fns) data) (rest fns))))
06:30clojurebot(4 2)
06:31TEttingerthere you go
06:32TEttingerseriously_random, does that do the job?
06:40pyrtsaseriously_random: Like abaranos` suggested:
06:40pyrtsa,(reductions #(filter %2 %1) [1 0 4 -2 :a 7 "a" 2] [number? integer? pos? even?])
06:40clojurebot([1 0 4 -2 :a ...] (1 0 4 -2 7 ...) (1 0 4 -2 7 ...) (1 4 7 2) (4 2))
06:43abaranos`pyrtsa: yeah like that :)
06:43abaranos`I think seriously_random isn't on anymore... my nick autocompletion doesn't work for him anymore
06:44pyrtsaIt does for me.
06:44seriously_randomsorry, was afk.
06:46seriously_randomTEttinger, the function has to be use like this: (filter (pred-and even?) [a-seq])
06:47abaranos`your suggestion is impossible
06:47abaranos`filter doesn't work that way
06:47abaranos`though I could be misunderstannding you. its late
06:47seriously_randomabaranos`, http://iloveponies.github.io/120-hour-epic-sax-marathon/one-function-to-rule-them-all.html#exercise-11
06:48TEttingerpred-and might call filter repeatedly on a partial arg
06:48abaranos`i see
06:49pyrtsaseriously_random: (def pred-and every-pred)
06:50seriously_randomthe issue I have is how to build recursively (fn [x] (and (and (and (....
06:51TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/every-pred#source
06:52TEttingerseriously_random, the source seems to be pretty uh... yeah...
06:52seriously_randomTEttinger, lol
07:00pyrtsaseriously_random: Your definition of every-pred should almost fit in one line by using (reduce #(...) true preds) and reduced in the definition of #(...).
07:33seriously_randompyrtsa, is this right in any way at all? http://pastebin.com/iLgYUySd
07:46pyrtsaseriously_random: It fails for 0 predicates at least.
07:52lumafiwith 1 argument, it returns a sequence of functions. with more arguments, it returns a single function, that either returns a falsy value or recurses (returning a list of functions or a single function again)
07:52lumafidoesn't look correct
07:54pyrtsaShouldn't write straight answers to questions like this but couldn't resist: (reduce (fn [_ p] (if (apply p args) true (reduced false))) true preds)
07:57hyPiRion#(apply every-pred (constantly true) %&)
08:06seriously_randomhyPiRion, can't use apply, I am supposed to use reduce, sort of like that: http://pastebin.com/JFDxrP8V
08:36mdrogalisGuess I'll give Cider a try now. Seems more sturdy.
08:47bitemyappmdrogalis: brave.
08:48mdrogalisbitemyapp: How're you?
08:50bitemyappmdrogalis: pretty good, spending most of my time in Haskell-land. my recently built desktop didn't have java installed until I needed ElasticSearch.
08:50bitemyappmdrogalis: and you?
08:50mrhankyanybody have an idea which the fs/init method doesnt work on loading my webpage? it does work if i call it from my web repl after loading the page: https://www.refheap.com/22309
08:50mdrogalisbitemyapp: We do miss you. :P I'm alright, a little slower around the holiday.
08:50mdrogalisIt's pretty excellent to tune out for a while.
08:51bitemyappmdrogalis: I've been spending the holiday tinkering, coding, learning. That's partly how I got away with not installing Java for ages.
08:51mdrogalisbitemyapp: Conj talks are coming up for entertainment. :P
08:51mdrogalisAlways need more tinkering time.
08:52bitemyappmdrogalis: most of my time so far has been spent hammering out the web dev patterns I knew in Clojure and finding their parallels in Haskell.
08:53bitemyappsome stuff is better, some stuff ain't. The stuff that ain't is pretty rectifiable.
08:53mdrogalisWeb dev always felt so mechanical to me. :/
08:54bitemyappmdrogalis: that's partly why people are okay with using frameworks, it factors out the redundancy.
08:54bitemyappsometimes those frameworks hurt more than they help, but that's the tradeoff.
08:54daGrevishello! what's the clojure alternative for join function? i want to get list of string to a string with seperators between them. (list "a" "b" "c") -> "a b c". I tried apply fn, but don't know how can I set separator for it.
08:55daGrevis,(apply str '("a" "b"))
08:55clojurebot"ab"
08:55mdrogalis,(doc clojure.string/join)
08:55clojurebot"([coll] [separator coll]); Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator."
08:55pandeirocan nrepl/cider not jump to a function definition of whatever is at point?
08:56daGrevismdrogalis, thanks:)
08:56mdrogalisdaGrevis: :)
08:57daGrevismdrogalis, just... how can I import it? (sorry for pythonic terms)
08:58bitemyapppandeiro: nrepl can. I dunno if cider is unfucked enough yet for that, but I'm sure it will eventually.
08:58mdrogalis(require [clojure.string :as s])
08:58daGrevis,(clojure.string/join " " (list "a" "b"))
08:58clojurebot"a b"
08:58pandeirobitemyapp: huh, damn. what about basic eldoc-like functionality?
08:58bitemyappdon't ask me about cider.
08:58daGrevismdrogalis, can I do it like in above example?
08:59bitemyappI can only tell you what nrepl can do.
08:59pandeirobitemyapp: and do you know the function name in nrepl?
08:59bitemyapppandeiro: C-h m
08:59pandeirocheers
08:59mdrogalisdaGrevis: Sure, why not?
09:28daGrevisi have some vars and I do this
09:28daGrevis,'(a b)
09:28clojurebot(a b)
09:28daGrevisbut if I do the same using (list ..)
09:29daGrevis,(list a b)
09:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:29daGrevisi quite not get it, I thought (list ..) and '(..) are equal
09:31pyrtsa,(list 'a 'b)
09:31clojurebot(a b)
09:32teslanickI thought the ' notation was for quoting symbols
09:33teslanicki.e. what pyrtsa said
09:33pyrtsaQuoting affects everything within the quoted form. It just happens that e.g. quoted numbers, keywords, strings, lists etc. evaluate to the numbers themselves, and symbols remain as symbols.
09:34pyrtsa(Doh, meant to say "evaluate to the numbers, keywords, strings, lists etc." of course)
09:35hyPiRionthe ' notation is just the same as saying (quote ...), and that in turn means "do not evaluate the following expression"
09:37pyrtsaI didn't think it was that obvious before I started to understand what's said here: http://clojure.org/reader
09:41philed,(list (+ 1 2))
09:41clojurebot(3)
09:41philed,'(+ 1 2)
09:41clojurebot(+ 1 2)
09:41philedquotes are special forms. They don't use the normal evaluation rule.
09:45pyrtsaQuoting can be confusing to beginners. It can be argued that they make Lisps in fact not referentially transparent: (apply + (range 3)) isn't the same as (apply + (1 2 3)) because (1 2 3) is read as a function call.
09:46pyrtsaNot that it matters that much.
09:48pyrtsa(Doh, and of course replace (range 3) with (range 1 4) above. (blush.)
09:49philedI liked the fact the Paul Graham started out explaining evaluation rules and quotation at the very beginning of ANSI Common Lisp.
09:49pyrtsaMakes sense.
09:49hyPiRionyeah, that book is awesome
09:52gdevI'm pretty sure one of the Clojure books starts out with evaluation rules. 80% though, don't quote me on that
10:02ambrosebsdidn't some-fn and every-pred return multi-arity functions.
10:02ambrosebsI assumed they returned predicates.
10:02ambrosebs*didn't realise
10:04daGrevishow could I get first ten elements from a list?
10:04daGrevisi know about first, rest and nth
10:04pyrtsa(take 10 xs)
10:04hyPiRion(take 10 my-list)
10:04daGrevisthanks!
10:07gdev(set! *print-length* 10) (println my-list)
10:08Bronsaambrosebs: +1 for the jvm.tools.analyzer ns segment change btw
10:08ambrosebsBronsa: yep should have done it ages ago
10:10Bronsaambrosebs: i tried to lint core.typed w/ eastwood but looks like there are some weird circular dependencies that make it hard to do automatically
10:10ambrosebsBronsa: totally insane circular stuff going on yes.
10:11ambrosebsBronsa: calling clojure.core.typed/load-if-needed should load everything
10:13Bronsaambrosebs: noted, thanks
10:15gdevusing Rx to develop a pharmacy front end makes for some confusing namespaces
10:39daGrevishow can I make my fn to be lazy?
10:40daGrevisit computes a inf. list of integers and I want to do something like (take 10 (myfunc))
10:40daGreviscurrently it throws out integer overflow
10:43levinmdaGrevis are you familiar with lazy-seq ?
10:44daGrevisnot really
10:44daGrevisbut I'm reading about it now http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci
10:45daGrevislevinm, it says that 2nd example should be avoided. why's that? http://clojuredocs.org/clojure_core/clojure.core/lazy-cat#example_850
10:46levinmmy expertise probably doesn't extend as far as yours, I just knew the name. You might also want to look at accepted answer at http://stackoverflow.com/questions/4992298/clojure-lazy-sequence-usage
10:47daGrevistrust me, I have no experience ;)
10:47daGrevisthanks for the link tho ;)
10:51marcopolo`daGrevis: You don't want to keep the head because then you can't GC
10:54teslanickI'm curious: is it because you can't GC the first two elements, or does it somehow prevent GC on the entire seq that has thus far been realized?
10:55marcopolo`teslanick: If you don't keep track of the head then you only have to keep in memory the current chunk of the seq that has been realized
10:55nDuffteslanick: holding the head caches everything that's been realized.
10:55nDuffteslanick: ...which can be convenient if you have something that was expensive or side-effecting to calculate.
10:55marcopolo`If you do keep track of the head, you have to keep track of every element that has been realized because it's a linked list
10:56marcopolo`nDuff: good job team!
10:56teslanickThat's exactly what I wanted to know, thanks!
11:05daGrevisI guess it doesn't make sense to filter out lazy seq
11:05daGrevisbecause it will run forever, right?
11:05daGrevisit will be like: good, good, good, bad, bad, bad, bad and will never stop
11:07daGrevisso I have fib-seq that's lazy and I want to filter out all integers that are below 4'000'000
11:08rovardaGrevis: if your filter is lazy, it will not run at all
11:08teslanickdaGrevis: filter itself returns a lazy http://clojuredocs.org/clojure_core/clojure.core/filter
11:08rovaruntil you ask it for results..
11:09daGrevisrovar, teslanick : you are right. the problem came from me trying to get sum of all later
11:09daGrevishttp://vpaste.net/Xy8hL
11:17teslanickdaGrevis: The problem is with your lazy-seq definition, not the filter or sum.
11:25Jardawut
11:25Jardaoops
11:25Jardais it possible to transform keys recursively of a map
11:26Jarda{:foo-bar {:ding-dong 15}} -> {:foo_bar {:ding_dong 15}} is the desired outcome
11:26abakeris there a good lein template for clojurescript? cljs-kickoff? cljs-template? something else?
11:26Jarda,help
11:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: help in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:27samratabaker: there's also David Nolen's mies
11:27abakerah, nice, I'll try that one out
11:27abakerthanks samrat
11:51dnolenabaker: there are better ones if you want a webserver setup, mies is just about playing around with ClojureScript w/ minimal fuss.
11:51seangrovednolen: About to experiment with using om for production - any strong recommendations against this, or should it be alright with the correct expectations?
11:52dnolenseangrove: not sure if I would use it on a production project just yet, but it's getting there
11:53abakerdnolen: I'm looking for something simple, create a cljs impl (or maybe wrapper) for other JS libs
11:53dnolenabaker: ok, then mies might work for you.
11:55seangrovednolen: Sounds like a ringing endorsement, so long as we have the right expectations
11:55seangrovednolen: It'd either be this or writing a wrapper around React anyway
11:57dnolenseangrove: the labeled issues give an idea for what I think is problematic http://github.com/swannodette/om/issues?state=open
11:58dnolenseangrove: only show stopper is the #30 at the moment, but people may find other things
11:58rovarI am trying to create define functions in another namespace, I was hoping to use binding to do so.. this is what I have..
11:58rovarserializable functions at that..
11:58rovarhttps://www.refheap.com/22313
11:59mullrdnolen: woohoo! that's my bug!
11:59rovarit appears to be successfully creating the function, but not in the ns I'm hoping for..
11:59dnolenmullr: heh :)
12:00dnolenmullr: thanks for the minimal case
12:00rovardoes binding only work for reading from said ns?
12:00mullrdnolen: no problem
12:01rovarom looks pretty sweet. once I get to the webdev portion of my project I hope to give it a spin.
12:01rovarat this point I'm still trying to create a multi-user lisp
12:02rovarI guess I should look at the source for binding. I was hoping it was a scoped setter.. I just need to push a ns onto a stack and then pop it off..
12:02rovarmayhaps I should just write that function..
12:07seangrovednolen: Trying to use the latest (r2127) cljs, getting this error - seem familiar at all? https://www.refheap.com/2719477a1e7002a6bcc21f66d
12:07seangroveCould be a deps issue with some other google library
12:08dnolenseangrove: latest google closure compiler required JDK 7
12:08dnolenreqires
12:08dnolenerg, requires
12:09dnolenseangrove: if you want it to work with something else you need to build it yourself.
12:09dnolenseangrove: that might not be it, but this looks similar to what someone else reported and that was the conclusion
12:09seangrovednolen: looks like I have javac 1.7.0_21 here
12:10daGreviswhyes this runs forever? http://vpaste.net/0QO9B
12:10dnolenseangrove: k, then it's some other dependency issue
12:10seangrovednolen: is the ticket on cljs?
12:10seangroveerr, JIRA?
12:10dnolenseangrove: no
12:10dnolenseangrove: this is some Java dependency issue
12:10seangroveFun fun. I'll look into it
12:10seangroveThanks for the pointer
12:10dnolenseangrove: or that's what it looks like to me. if you can determine that's it not then yes open a ticket.
12:11dnolenseangrove: google closure pulls in a lot of dependencies, may be lein deps tree will make it obvious what's going wrong?
12:11daGrevisif I replace filter with take 10, it runs and gives me an integer. what's wrong with my filter? http://vpaste.net/yNftE
12:12seangrovednolen: Looks like it must be a problem with some other com.google.* deps
12:13S11001001daGrevis: how does filter know when to stop looking for more elements for which the test returns true?
12:13daGrevisS11001001, good point. any ideas how can I say it to stop after first false?
12:14S11001001daGrevis: filter isn't the right function for that. Look at the other functions available
12:14phileddaGrevis: Write a take-while function.
12:14philedIf not in the standard library.
12:16daGrevisphiled, S11001001: found it! http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/take-while and it works :)
12:18philedSweet!
12:21rovarclojuremud.core> (defmacro do-in-ns [next-ns & stuff] `(let [old-ns *ns*] (do (in-ns next-ns) (eval ~stuff) (in-ns old-ns))))
12:21rovar#'clojuremud.core/do-in-ns
12:21rovarclojuremud.core> (do-in-ns (s/fn inc2 [x] (inc (inc x))))
12:21rovarCompilerException java.lang.RuntimeException: Can't let qualified name: clojuremud.core/old-ns, compiling:(/tmp/form-init8607824030701866727.clj:1:1)
12:21seangrovednolen: Yup, depenedency issue from a random jar, thanks.
12:22rovarin this case I really do wish to capture *ns* in old-ns
12:22rovarwell.. at run time.. not compile time..
12:24rovaroic.. should have gensym'd the old-ns
12:25alandipertrovar: you could (declare ^:dynamic *old-ns*) before the macro and bind it to *ns* in the macro
12:26rovaralandipert: that was my first approach..
12:26rovaralandipert: https://www.refheap.com/22313
12:26rovarit didn't seem to want to bind the function to the new ns when I did it that way
12:27rovaralthough mayhaps I screwed something up.
12:32dnolenseangrove: cool
12:51rovareerg..
12:52rovarmy macro expansion seems to be embedding my form in an additional set of ()'s
12:52rovarthus trying to execute what I've created
12:52foofoobarHi! I'm reading "Clojure - Functional Programming for the JVM" and have a question: (def vowel? (set "aeiou")) ; When a set is used as a function, it returns the argument if it is in the set and nil otherwise.
12:52foofoobarso I tried ((set "aeiou") "a") and I get nil, why ?
12:53scottjfoofoobar: (seq "aeiou") gives a seq of characters like \a, where "a" is a string
12:53scottjfoofoobar: set runs seq on its arg before putting them in a set
12:53seangrove,(set "aeiou")
12:53clojurebot#{\a \e \i \o \u}
12:53seangrove,((set "aeiou") \a)
12:53clojurebot\a
12:54foofoobarah, so what I did wrong was passing a string instead of a \a ?
12:54scottjfoofoobar: yes
12:54seangrovefoofoobar: Yeah, exactly. Just different data types, s'all.
12:54foofoobar,((set "aeiou") (seq "a"))
12:54clojurebotnil
12:54foofoobar:/
12:55scottj,(seq "a")
12:55clojurebot(\a)
12:55foofoobar,((set "aeiou") (first (seq "a")))
12:55clojurebot\a
12:55foofoobarah, okay :) Thanks for help!
12:56gdevugh, Windows ftl, leiningen won't show my profiles or plugins from my profile.clj unless I'm in the .lein directory. how do I debug this?
13:03mocker4clojure needs a 'Follow people who aren't super awesome but have solved more than you' option. :)
13:03seangrovemocker: So you can understand their solutions?
13:03mockerMy solution to problem 19 isn't pretty: #(first (drop (count (rest %)) %))
13:03mockerseangrove: So I don't feel so bad about my solutions.
13:05seangrovemocker: Well, consider the bad feelings as dues paid to become awesome ;)
13:05mockerhehe
13:07rovarhow can I un-paren something in a macro?
13:07rovaror un-nest
13:07seangroverovar: You can splice
13:08rovar,(doc splice)
13:08clojurebotIt's greek to me.
13:08seangroverovar: http://stackoverflow.com/questions/4571042/can-someone-explain-clojures-unquote-splice-in-simple-terms
13:08rovarthat looks like what I want..
13:08rovarbut how did it get this way in the 1st place?
13:08rovaris question for another day
13:09seangroverovar: Probably best to post the macro itself if you're looking for help with that
13:10rovarseangrove: here is my latest version : https://www.refheap.com/22316
13:10rovarstill a problem with quoting of namespaces..
13:10rovaralso.. probably my approach in general. I wish to be able to create and bind functions to arbitrary namespaces..
13:10mockerseangrove: Or maybe a 'users not participating in the code golf' would be better.
13:10rovarthe (binding [*ns* myns] blah doesn't seem to work.
13:11rovaralso the straightforward (def my-ns/myfn (s/fn blah)) doesn't seem to work..
13:12seangroveWhat namespace is s/ supposed to refer to in that case?
13:12rovaroh. right.. s is serializable-fn
13:13rovarbasically I want people to be able to share the same environment and add/remove functions to their and other namespaces at runtime..
13:13rovarand of course I want to be able to serialize them so progress is remembered
13:13seangroveSounds a bit mad, but interesting
13:13rovarit's for a mud :)
13:14rovarthat you build from the inside out
13:14rovarmore of a multi user repl, really..
13:14seangroveThe error it's giving you is about a namespace being cast to a symbol, do you know which form causes that?
13:14rovarin my first approach, I just did a contextual-eval with a hash of each user's symbol
13:15rovarseangrove: I am assuming it's for the first setting of in-ns at (clojure.core/in-ns (quote room-ns))
13:15rovarbut I don't know why that would be...
13:16rovarthe 2nd use of in-ns evals against the gensym variable I set
13:19edwI naively assumed that building an uberjar twice in succession from the same source would lead to jars with identical checksums. I was wrong. Anyone have insight into what changes? An internal timestamp of some sort?
13:19nDuffedw: yes, jars contain timestamps.
13:20nDuffedw: ...the META-INF folder also contains build time data, if my memory is at all correct.
13:20edwnDuff: Ugh, seems dubious to me.
13:20nDuffedw: ...also, I'm not certain that the compression algorithms used are guaranteed to be deterministic; one could create two different jar files with the same contents but different compression tables, files in different orders, etc.
13:22rovaredw: I think it is a good thing for signatures and hashes of packages to contain the timestamp at which they were created
13:22edwnDuff: Right, though I would guess that the LZ77 or whatever algo is stable/consistent, even if there are multiple possible correct representations of a given series of bits.
13:22edwrovar: I would agree, if I could get lein to build IFF the uberjar is out of date.
13:23nDuffedw: LZ77 may be consistent, but (f'rinstance) iterating over an unordered set to get contents to put into that archive may not be.
13:24edwnDuff: I hear you. Per my comment to rovar, my fundamental issue is that I can't get lein to perform a NOP if the jar is up-to-date with respect to the sources.
13:24nDuff*nod*.
13:25rovarso it should use timestamps of artifacts vs source instead of hashes..
13:27edwI'm building a Makefile to handle deploying a jar, and at this point I have to depend on human judgement/intervention to build the jar, unless I want to re-implement half of lein in Make.
13:29edwHello, it's Unix version six calling, it would like its features back, since we're clearly not using them.
13:32rovarwtf? https://www.refheap.com/22317
13:33TimMcedw: I believe there is specifically a timestamp in the pom.xml files.
13:34TimMcedw: This script may be useful in investigating differences in JARs: diff <(unzip -c -- $1) <(unzip -c -- $2)
13:35nDuff"$1" / "$2", with quotes, if there are spaces or glob characters anywhere in the names (or if you don't know the value of IFS)
13:35TimMcTrue!
13:36TimMcFunny that I remembered to use -- but forgot to quote.
13:36edwTimMc: That was my next step. I think I'm going to need to have to assemble a list of all the on-disk files included into the jar and list them as prerequisites in the Makefile.
13:37TimMcBut yeah, we *really* should be using cross-platform deterministic builders. It's great for auditing.
13:37nDuffunzip -c only works if you assume equivalent ordering.
13:38nDuff...unless unzip offers guarantees itself on that count.
13:38TimMcI see no guarantee of that in unzip's manpage.
13:39edwTimMc: I didn't think it would be such a hassle to get lein to do nothing if nothing needed to be done.
13:41gregorstocksMD5=`md5 x.jar`; lein uberjar; if [ $MD5 -ne `md5 x.jar` ] ; then lein uberjar ; fi
13:42TimMcgregorstocks: See above conversation on timestamps in JARs.
13:42clojurebotPardon?
13:43gregorstocksTimMc: that's probably not the biggest problem with my proposal
13:43bitemyappgregorstocks: http://www.youtube.com/watch?v=rLw-9dpHtcU
13:44gregorstocksbitemyapp: good point
13:45bitemyappgregorstocks: you should visit more often.
13:46edwI'm going to kludge this so I look for the newest file in src/, test/, and resources/ (as well as project.clj) and then compare the newest timestamp to the timestamp of the uberjar. Jeebus.
13:46TimMcgregorstocks: Oh. Yes, indeed. :-P
13:46gregorstocksbitemyapp: yeah, beats working
13:46bitemyappgregorstocks: I can't trick Dave into coming here.
13:46TimMcI'm like the Clojure compiler, I just freak out at the first error and stop reading.
13:47gregorstocksbitemyapp: set up a Jabber bot that messages him with every message from this channel
13:47bitemyappTimMc: and spew something senseless yet vaguely proximate?
13:47gregorstocksand forwards his replies here
13:47koalallamaTimMc: sldkjfslfjsdsferrorors are you sure about that?
13:47bitemyappGregor Stocks, King of Duct Tape.
13:52WWWestHi
13:52WWWestI've got an async question
13:53bitemyappWWWest: I've got an async answer, many even, no guarantees about when you'll get them though.
13:53rovardo you expect to block on your request?
13:53WWWestso I've got fun1, which processes values inside a go block, and returns a value at the end
13:53TimMcbitemyapp: Some days, some days.
13:53WWWestso that value is inside an implicit chan
13:54rovarWWWest: you might be able to more succinctly describe this with code
13:54rovarjussayin
13:54WWWestnow, somewhere else, also inside a go block, I'm trying to map fun1 and get a seq
13:54bitemyapprovar: no no, let him keep rolling with this.
13:54bitemyapprovar: it's like talking to an academic, this is fun.
13:54WWWest:)
13:54rovaris your channel of uniform density?
13:55WWWestso I
13:55bitemyappWWWest: why do you need a seq?
13:55edwHey, "all" I have to do is compare my uberjar's timestemp to the following file:
13:55WWWestdo this : (map #(<! (fun1 %)) values)
13:55edwfind . \( -type f \) -and \( -path './resources/*' -or -path './project.clj' -or -path './src/*' -or -path './test/*' \) -and -not -path '*~' | xargs ls -lt | head -n 1 | cut -c 45-
13:55edwYay.
13:55WWWestwhy is this wrong?
13:56WWWestbitemyapp: I need a seq because it seems natural and clojury
13:56bitemyappWWWest: there are HOFs in core.async if you want something like map.
13:56rovarmap<
13:56bitemyappWWWest: http://clojure.github.io/core.async/#clojure.core.async/map&gt; and map<
13:56WWWestaha
13:56bitemyappWWWest: you're being clingy.
13:56rovarhttp://clojure.github.io/core.async/#clojure.core.async/map&lt;
13:57rovarthat's actually not exactly what you're after..
13:57bitemyappWWWest: you're that boyfriend that won't let his girlfriend spend time with her friends asynchronous. You keep wanted to hold her entire schedule in your hands all at once.
13:57bitemyappWWWest: stop that.
13:57rovarbecause it creates a new channel with all the stuffs
13:57bitemyappWWWest: just let her do what she wants.
13:57bitemyappWWWest: use the damn core.async functions. Don't try to realize/comprehend stuff in channels into sequences.
13:57bitemyappIt's a mispattern.
13:58rovarWWWest: but to answer your question, you need to run anything with a channel operation inside of a go block, you were attempting to run it inside of a lambda inside of a map
13:58WWWestbitemyapp: ok, I'll go over map< and see what I can do with that
13:59rovarso to do what you wanted would end up rather kludgy, as bitemyapp said, better to use the core.async tools.
13:59bitemyapprovar: well, unless you want to do a one-off blocking operation against the channel.
13:59rovarright.. could do that..
13:59bitemyappI mean, I've written "channel drainers" but that's because I had a clumpy value distribution and I knew how to abuse a while loop.
13:59bitemyappbut uh, you know. Hypocrisy is okay sometimes if you actually know what you're doing.
13:59bitemyappCf. C++
14:00dnolenadd ICloneable protocol to CLJS, prep for specify, but it means you can do specify like things today.
14:00dnolenhttps://github.com/clojure/clojurescript/commit/00008eeca5979f90e5f2e147478202e15949ea8d
14:00dnolens/add/added
14:48rovaramalloy_: are you about?
15:05shock_oneHi. Is it the right place to ask about Korma?
15:05nDuffshock_one: it's not a bad place to ask about it.
15:07shock_oneHow would I write the GROUP_CONCAT part? https://gist.github.com/shockone/841609292144d260a8fb
15:09shock_oneWhat do you recommend instead?
15:11nDuffshock_one: I wrote my own thin layer on top of clojure.java.jdbc, but there's a lot to choose from.
15:11nDuffshock_one: my big beef with Korma is that it's so macro-centric as to make it hard to compose.
15:11nDuffshock_one: ...that's a problem that HoneySQL (for instance) doesn't have.
15:14shock_oneYeah, I also noticed that. But you have to agree: it looks cool. In my case it's not a problem, we'll execute only one query, but it will be quite complicated.
15:19rovardoes anyone here use either Titanium or Jiraph?
15:19rovarI can't get either to work for different reasons..
15:20shock_onenDuff: by the way they surely know about this issue, and try to provide non-macro versions where it's possible. https://dl.dropboxusercontent.com/u/608214/scrn/1388434649.png
15:20nDuffshock_one: Whether it's known hardly matters.
15:32edwOK, so that took a while. Makefile and lein now play nice. $(shell find ...) is my new best friend.
15:35nDuff...
15:41nDufferr, pathname.
15:41nDuff(since filenames can't contain '/' either).
15:43TimMcnDuff: Fuck tha po-leece.
15:47TimMcnDuff: Do you know what happens if a '/' ends up on disk in a filename?
15:49gdevoh wow, my lein_home environment variable was set to .lein\bin instead of just .\lein -_- so it was probably looking for my profiles.clj in the bin folder
16:15rovarwhat is the recommended approach for making a mutable map of mutable maps?
16:15rovare.g. (def foo (ref {})
16:16seangroverovar: You ask the darndes' questions.
16:16rovarwhere foo would be altered with things that go into foo, which would also be refs to maps
16:16seangroveI'd say, the recommended approach is to approach the problem without mutable maps
16:17rovarneat idea.. how would you recommend keeping a list of users that could be altered frequently, each with their own set of properties which could be altered frequently.
16:17seangroverovar: Why not use immutable maps and get/assoc/update-in?
16:17rovarthought about it..
16:18rovarbut when user moves from room a to room b, their map gets updated
16:18seangroveSure, assoc-in
16:18rovarso I don't want to recreate the entire set of all users because one user changed...
16:18seangroverovar: Persistent data structures...
16:18rovari'm well aware of the concept.. but we're talking potentially thousands of updates per second..
16:18seangroveCross that bridge when you come to it?
16:19seangroveYou're not recreating the entire set of all users, changing the data is generally very efficient
16:20rovarso make the users map an atom?
16:20rovarand just swap in a new one?
16:20seangroveIf you need to. Depending on your loop, you probably don't need an atom
16:21rovarI'm not serializing these requests within the loop, so I'd need something to do that for me.
16:22seangroverovar: I don't know enough about what you're trying to do to give you any solid recommendations other than you probably don't need mutable data structures at all here
16:23rovarso a multi-user environment where a number of transactions could occur, consider, for instance, a user moving from one room to another.. In one transaction, the rooms's contents will be emptied of said user and that user will be added to the list of users in another room. Simultaneously, the user's reference to its container will need to be updated into its new room.
16:24rovarits effectively two indices, because I will need random access of users in a room, and also constant time access of a room for that user..
16:25dnolenrovar: thousands of updates a second is not that many for Clojure data structures
16:25dnolenrovar: I would abandon your mutable map of mutable maps
16:25dnolenand just do something functional as suggested
16:26rovarthat's fine, but I'd still need to update both indices atomically. I could make them part of the same map, and swap out the entire map..
16:26rovarbut logically, it seems sane to have one map be "rooms" and the other "users"
16:28dnolenrovar: ok, then two refs and transactions would probably work for you. I've never really used the STM so perhaps some one has a better suggestion.
16:30rovarif I use the single map approach, I'd still have to use an atom for the map, because I'd want to guarantee consistency if every thread in the threadpool tries to update it simultaneously. one could end up with lost writes or A B A problems..
16:30whomphow do you unquote?
16:31whomplike if i'm given 'a, how do i get a?
16:32dnolenwhomp: like you want to look up the value the var a is bound to?
16:32seangroverovar: Then you could probably do (atom {:rooms ... :users ...})
16:32whompdnolen, yeah
16:32whompit appears eval does the trick
16:32llasram`whomp: There's a few answers to that question, but usually needing to ask it means you're approaching the problem from a non-idiomatic direction
16:32seangroverovar: But you'll probably want to spend some time considering your data structures, since it's going to severaly hamper or help you once things get going.
16:32llasram`whomp: Unless you're developing tools
16:32dnolenwhomp: or you could resolve the var, but you'd need to provide a namespace.
16:33dnolen,(doc resolve)
16:33clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
16:33whompi was making a swap function, (swap a b) switches values of a and b
16:33llasramwhomp: Like, swap the values of two vars?
16:33whompyeah
16:34llasramIf you really wanted to do that, the right way would be to pass the vars -- #'a syntax
16:34llasramBut I'm skeptical that's something you'd actually want to do :-)
16:34seangrovewhomp: Generally, swap would be implemented as (fn swap [a b] [b a]) ;)
16:35whompthx :)
16:36llasramwhomp: Why do you need such a `swap`?
16:37whompjust realized i don't need it haha
16:37llasramkk
16:37whomptrying to do the euclidean algo
16:37mi6x3mhey clojure, how come the REPL prints sequences with list literals?
16:38Cr8how else would it print them
16:38mi6x3mCr8: with a generic type indication, no need to indicate the contents?
16:39Cr8that's how java objects that don't have any print method defined are printed
16:39llasrammi6x3m: I believe just convenience
16:39Cr8any data type that can be printed in a way that the data inside can be read back though, will be
16:39llasrammi6x3m: A lazy seq printed as a list, then re-`read` as a list will have all of the same properties as the original sequence (once fully realized)
16:40Cr8,(read-string (pr-str (range 10)))
16:40clojurebot(0 1 2 3 4 ...)
16:40dnolenwhomp: yeah swapping two vars is strange, if you're trying to write GCD you just need recursion
16:40whompyeah i see the solution now
16:40llasrammi6x3m: Actual lists support a few extra operations, but you rarely use/need them in practice
16:40whompty
16:41mi6x3mllasram: yes, but 'sequence' is just a property right? so this will give me a list although I didn't print a list
16:41mi6x3manyhow, it doesn't matter
16:41mi6x3mI just wanted to ask :)
16:41mi6x3mthe book I read doesn't get that straight
16:42llasrammi6x3m: Yes and no. The abstraction lets you treat anything on which you can call `seq` as a "sequence", but printing is via the type hierarchy, and will never call `seq` on its own
16:43mi6x3mllasram: yes, I am aware :)
16:43llasramOk, cool
16:43mi6x3mthanks for clarifying, this helps me a lot
16:44mi6x3mbut this list output
16:44mi6x3mis purely a REPL thing right?
16:44llasramWell, REPL + using `pr` etc for serialization
16:47alandipertmi6x3m: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L145
16:48mi6x3malandipert: ah, this makes it crystal clear :)
16:48mi6x3mthanks !!
16:51alandipertmi6x3m: np!
17:03TimMc&(map (juxt counted? class) ((juxt identity (comp read-string pr-str)) (range 5)))
17:03lazybot⇒ ([false clojure.lang.LazySeq] [true clojure.lang.PersistentList])
17:05whompcan i apply a function n times to a value? like (func 5 f a) would give f(f(f(f(f(a)))))
17:08TimMcThere's iterate...
17:08mikerod,((apply comp (repeat 5 inc)) 1)
17:08clojurebot6
17:08mikerodsort of weird :)
17:09_zipHello
17:09zerokarmaleft,(take 5 (iterate inc 0))
17:09clojurebot(0 1 2 3 4)
17:09amalloy(nth (iterate f a) 5)
17:09alandipert,(reduce #(%2 %1) 1 (repeat 5 inc))
17:09clojurebot6
17:09TimMcUsing iterate here is also weird, because it generates a seq you don't use
17:09amalloyTimMc: why weird? that seems perfectly normal
17:09_zip,(iterate inc 5)
17:09clojurebot(5 6 7 8 9 ...)
17:10amalloyif discarding bits of a sequence were considered bad, nth wouldn't exist
17:10mikeroditerate seems like the most to-the-point
17:10mikerodapproach*
17:10S11001001TimMc: all data is transient
17:10TimMcamalloy: Oh, it's a perfectly normal functional programming way of doing things. I guess I'm just more aware recently of perf-y things, even though it usually doesn't matter.
17:11TimMcS11001001: :-)
17:11TimMcYes, I should practice non-attachment.
17:12TimMc"In 10000 years, your data will long since have crumbled to dust. No one alive will even know the name of the storage media it resided upon."
17:13mikerod,((apply comp (repeat inc 100)) 0)
17:13clojurebot#<ClassCastException java.lang.ClassCastException: clojure.core$inc cannot be cast to java.lang.Number>
17:13mikerod,((apply comp (repeat 100 inc)) 0)
17:13clojurebot100
17:20seangrovednolen: Should https://github.com/swannodette/om/blob/master/examples/mouse/core.cljs#L27 be inside an om.core/transact! ?
17:21seangroveI'm getting an error as-is: "Cannot manipulate cursor outside of render phase, only om.core/transact! and om.core/read operations allowed"
17:21seangrove(could also be a typo, but trying to understand the om lifecycle)
17:21dnolenseangrove: om.core/transact! and om.core/update! do the same thing - just different signature.
17:23seangrovednolen: Got it, thanks
17:41shriphanihi everyone. I am trying to work around this problem: (read-string "{:url http://grails.1312388.n4.nabble.com/}&quot;)
17:41bbloomshiney: \"
17:41bbloomsorry i mean shriphani
17:41shriphaniand the reader complains that the value there is an invalid token
17:41bbloomyour url is not quoted
17:42shriphanibbloom, that is read from a file
17:42bbloomthen your file is invalid
17:42shriphaniI did (spit f s)
17:42shriphaniand it put that there
17:42bbloom,(read-string "{:url \"http://grails.1312388.n4.nabble.com/\&quot;}&quot;)
17:42clojurebot{:url "http://grails.1312388.n4.nabble.com/&quot;}
17:42shriphaniah, so how do I coerce spit to put the quotes for me ?
17:42bbloomwhat was the class of the object that outputted that URL?
17:43shriphanierm.. i sent the map to spit...
17:43shriphaniand the map contained a key :url and a value i.e. the url itself
17:43bbloom(-> the-map :url class)
17:43bbloomwhat is it?
17:44shriphanijava.lang.String
17:44bbloomah ok, i see
17:44bbloomuse (spit f (prn-str s))
17:44bbloomi'm not sure why you're getting such a bogus string representation
17:45bbloomi suspect that spit is calling str instead of prn
17:45bbloom,(str {:url "http://grails.1312388.n4.nabble.com/&quot;})
17:45clojurebot"{:url \"http://grails.1312388.n4.nabble.com/\&quot;}&quot;
17:45bbloomhm no...
17:45shriphani(spit filename (with-out-str (prn content)) :append true)
17:45bbloom,(.toString {:url "http://grails.1312388.n4.nabble.com/&quot;})
17:45clojurebot"{:url \"http://grails.1312388.n4.nabble.com/\&quot;}&quot;
17:45shriphanithat is what I have in my spit
17:45shriphaniso I should not call it prn ?
17:45bbloomno, that should be precisely what you want
17:46shriphaniok it puts in the quotes now.
17:46shriphanithx bbloom
17:47bbloombtw, with-out-str & prn together like that is just prn-str
17:47shriphaniah.
17:47shriphaniI just copy-pasted that off an s/o answer
17:48bbloomshriphani: submit a correction :-)
18:06zerokarmaleftwhat's the quickest way to mock out friend's authentication for testing?
18:12zerokarmaleftseems like (with-redefs [friend/current-authentication ...] ...) would do the trick but I'm not sure what needs to be in the map
18:22whompwhat's the diff between --> and ->?
18:23splunk_whomp: perhaps you mean -> vs. ->>?
18:25whompsplunk_, yeah
18:26splunk_it's "thread second" vs. "thread last"
18:26splunk_compare (-> "x" (str 1 2)) vs. (->> "x" (str 1 2))
18:26splunk_or I usually think of it as "thread first" vs. "thread last"
18:27splunk_the former inserts the "x" as the first arg to the `str` (the second element of the list)
18:27splunk_the latter inserts the "x" as the last arg to the `str`
18:27splunk_make sense?
18:28algalzerokarmaleft: I just used ring.mock.request and helper function wrap-in-credentials to create properly authenticated requests.
18:30algalzerokarmaleft: Perhaps manually building a mock request map is only sensible if you're using a straightforward authentication method like HTTP Basic Auth
18:30zerokarmaleftalgal: I'm trying to avoid going through OAuth
18:31whompsplunk_, thx :)
18:31whompalso, where can i see other people's solutions to 4clojure challenges?
18:32RaynesIf you have an account and you solve a problem, it'll give you a link to the soluitons.
18:33splunk_anybody know idiomatic way to get the equiv of a line-seq for edn? like an edn-seq?
18:34dsrxwhomp │ [23:23:04] what's the diff between --> and ->?
18:34dsrxah the good old C down-to operator :)
18:34rovarsplunk_: what if your edn is already in a seq?
18:36splunk_rovar: I'm not sure I understand--if it's already in a seq, how did it get in there? I'm trying to loop over a file reading EDN out of it until it's EOF, but that's very...not Clojure-y.
18:38splunk_Hoping to avoid just `line-seq`ing it, because don't want to be dependent upon one EDN value per line
18:38shock_onewhomp: you have to follow users if you want to see their results. I would recommend you to follow all the guys who solved every single problem, it's pretty enlightening to look at their solutions.
18:39rovarsplunk_: slurp the file and then call read-string on it?
18:39whompshock_one, when i follow someone, nothing happens
18:39dsrxshock_one: you say enlightening, i say ego-destroying :P
18:40rovaryea I think the site is kind of broken
18:40splunk_rovar: yeah, that'll work, though I presume it's not lazy, so I'll have a 1+ gig string in mem
18:40shock_onewhomp: https://www.4clojure.com/problem/solutions/1
18:40whompohh i c thx
18:42rovarsplunk_: I don't think it's lazy. If you want to pull one sexp of edn out at a time, you'll need to write a parser. If you have each edn separated by a newline only, then readline it and pass that to read-string one at a time..
18:44splunk_rovar: yeah that'll do for now. thx.
18:45splunk_This appears to have the full slightly awkward solution:
18:45splunk_https://github.com/clojure-cookbook/clojure-cookbook/blob/master/local-io/read-write-clojure-data-structures/read-write-clojure-data-structures.asciidoc
18:45splunk_at the bottom
18:46rovarthat looks cool
19:19dnolensignificantly cleaned up Om TodoMVC using the latest stuff, http://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/app.cljs, enjoy!
19:26nooniansweet, thanks!
19:36devnis there a way to convert "10101" to an int using bitwise ops?
19:37TEttingerdevn: as a string first?
19:38TEttinger,(Integer/parseInt "10101" 2)
19:38clojurebot21
19:44seangrovednolen: Why do you (check (...)) for ILookup on MapCursor? Surely we're just reading at that point, not manipulating the cursor?
19:46bitemyappdevn: what you're thinking of is basically impossible.
19:46bitemyappdevn: at least, not in an efficient sane way. You can't just mask something that is an array of multiple bytes like that.
19:46bitemyappdevn: you *could* write an algo to do it, but I doubt it's any faster than the default impl.
19:48devnbitemyapp: that was what i wanted to confirm. my own sanity.
20:06dnolenseangrove: no operations allowed on the cursor outside of the render phase
20:07dnolenseangrove: you will likely not see something consistent with the app state
20:38johnwalkerghany news on 1.6.0 release ?
20:46tpopetechnomancy: hey, I'm finally circling around to take a look at nrepl-discover
20:58whompany ideas what's wrong with this code? it tells me, "invalid token: match" but i have no idea why
20:58whomphttps://gist.github.com/anonymous/ee3cfb4934510563253a
21:00justin_smithfor starters you likely want a ' before the vector in pairs
21:00seangrovewhomp: Also, it's not json
21:00seangrove{match: ..} => {:match ... }
21:01whompseangrove, brilliant thx :)
21:01justin_smithyeah, it wasn't saying "invalid token: match" it was saying "invalid token: match:"
21:02justin_smithsome quoting around the thing being called invalid would help there
21:02whompyeah
21:02seangrovejustin_smith: Good point
21:02whompit's also just hard to code in the repl
21:04seangrovewhomp: I don't think you'll find many people who agree with that ;)
21:04justin_smithwhomp: just a style thing, leave currMap for jvm method names, a clojure binding is better named curr-map
21:04seangrovewhomp: But it looks like you're developing out of it and then copying back in - that's not a good way to learn for now. Try sticking in the repl a bit more.
21:04whompohh ok cool. and it isn't even supposed to be a map lol
21:04bbloomseangrove: i can't code worth a damn AT the repl
21:04whompno, i develop in the repl
21:04bbloomseangrove: i also can't code worth a damn without the repl being a keystroke away :-)
21:05whompwhat's the shortcut to compile and run in the main screen?
21:05justin_smithwhomp: emacs has C-M-x for that
21:05justin_smithdunno what editor you are using though
21:05whompemacs + evil
21:06justin_smithsometimes instead of C-M-x I do M-h M-w to capture the current form, and then control-y to paste it in the repl, so my repl becomes more of a log of what I have tried
21:07justin_smithI am sure evil has some equivalent commands (grab entire form surrounding point / copy it / paste it)
21:07seangrovebbloom: Heh, yes, sorry. Should have been more specific that you pretty want to keep your code syntactically valid where you can for quick evaluation
21:07seangroveRather than building up a big block of pseudo-code and then trying to figure out where the syntax errors are
21:07seangrovebbloom: I know you specifically have a different approach though ;)
21:07seancorfieldjustin_smith: I use a function that Stuart Sierra posted to copy and paste the surrounding top level form into the repl - and have it bound to C-c e
21:08bbloomseangrove: but i'm a weirdo indeed
21:09seangrovebbloom: Perhaps one we should all be emulating though.
21:09justin_smithsometimes I write my code on paper or a whiteboard if I am in full on hammock-driven mode
21:09bbloomseangrove: nah, find your own process. you can't have mine :-P
21:23dnolenmullr: that bug was good excuse to move on ICloneable, specify is going to be fun, I may just take a crack at it myself.
21:23mullrdnolen: specify?
21:23dnolenmullr: extending individual instances to a protocol
21:24dnolenit's going to be awesome
21:24mullrdnolen: ... I think I want that
21:24seangroveSounds pretty interesting
21:24seangrovednolen: Just finished converting a basic widget over to om/sablono, seems pretty interesting so far
21:25mullrseangrove: I've been using sablono as well and am very happy with it
21:25dnolenseangrove: nice! I'm pretty happy with Om now, it was really putting a barrier between the render phase and event handlers that cleaned things
21:25dnolenseangrove: it's actually a bit of a problem in React, people accidentally holding onto stale stuff
21:26seangrovemullr: I've noticed a few oddities with it, but it's good enough for now
21:27mullrdnolen: Have you thought about a way to get the path from a cursor? It'
21:27dnolenmullr: I have a bit, what's your use case?
21:27mullrs attractive to do a top level event loop to handle the succession of an app state atom, and the path of a cursor is very useful in that case
21:28mullrdnolen: crude example: https://gist.github.com/mullr/8191555
21:29dnolenmullr: open a Github issue
21:30seangrovemullr: I've been thinking about this + pattern matches to case ui succession
21:30seangroveHaven't gotten anything concrete yet at all though
21:32mullrdnolen: https://github.com/swannodette/om/issues/33
21:33dnolenmullr: thx
21:33majykI'm using Clojurescript 0.0-2134 (although that version doesn't matter) and lein-cljsbuild 1.0.1 and everytime I build my Clojurescript code the modified date on the output JS file is Dec 31, 1969. This is happening on Windows 8.1. My timezone is set correcly in the OS. Anyone know what is going on?
21:33bbloomseangrove: what's that about pattern matching / ui succession?
21:34dnolenmajyk: maybe a platform bug in CLJS? but that seems weird to me
21:34majykthis has been happening to me for a while but I just caught on
21:34bbloomthat sounds like a timestamp of -1
21:36seangrovebbloom: Trying to think about making widgets as widget-y as possible. Have them come with default behavior that modifies a path of a big ui data structure and (separately) dom representation they're part of, then have a top-level event loop that compares data changes from the last loop and this loop and dispatches behavior accordingly.
21:36seangroveSo custom behavior is implemented based on changes to the ui data structure, separate from the widget behavior itself
21:36bbloomhm, not sure i follow
21:36bbloomi'll wait until you have an example or something, even if it doesn't run :-P
21:37seangrovebbloom: no worries, I should have something more concrete before I talk about it with a lot of people
21:37john2xsablono should be called "nom". om nom
21:38seangroveOr just h => om with hiccup in it => ohm
21:38bbloom(inc john2x)
21:38lazybot⇒ 2
21:39lsdafjklsdk
21:40bitemyappjohn2x: that was a meme in the Haskell mailing list
21:40bitemyappjohn2x: making new monad transformers om and nom.
21:40bitemyapprunMonad $ do om . nom . nom >>= etc etc etc
21:44lsdafjklsdanyone working with Om right now?
21:45seangrovelsdafjklsd:
21:45dnolenlsdafjklsd: people are starting to play around w/ it yes
21:45bitemyapplsdafjklsd: did you roll your face on your keyboard to get that nick or your cat's face?
21:46bitemyappI need a cranial diameter here.
21:46lsdafjklsdit's epic.. it's a 'kinetic' name
21:46justin_smithbitemyapp: I read it as a portmanteu of a favirite drug and a trollish junk key sequence
21:46lsdafjklsdmuscle memory
21:46lsdafjklsdit's home keys, a few trips around the block and you got it down :D
21:46bitemyappI'm going to assume you'
21:46bitemyappare quite mad.
21:46lsdafjklsddnolen: I asked because I had a question :D
21:47dnolenlsdafjklsd: ask away
21:47lsdafjklsdI have an input that, when a user hits the return key, it's state get's reset
21:48bitemyapplsdafjklsd: it is state get is reset
21:48lsdafjklsdso on the js hash, I have {value: (:input-val cursor)}
21:48lsdafjklsdbut when I do that I can not type in the input
21:48lsdafjklsdI think it has to do with react
21:49dnolenlsdafjklsd: yes inputs are handled a bit in a special way, have you looked at Om TodoMVC, it demonstrates how to do things the React/Om way
21:49dnolenlsdafjklsd: if you are using sablono or some other sugar you may run into issues, Om provides fixed version of React input elements
21:50dnolenlsdafjklsd: https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/item.cljs
21:51lsdafjklsddnolen: ah, Ok was not looking in that file
21:51dnolenlsdafjklsd: I would use component local state for the value in the text field
21:51lsdafjklsddnolen: yes this is the simple code I was trying https://gist.github.com/lsdafjklsd/8191733
21:52lsdafjklsddnolen: I'm suuuuuper slow at learning clojure / om at the same time.
21:52lsdafjklsddnolen: but have two days off so going to try and build something
21:52dnolenlsdafjklsd: you need to "commit" the changes to the text field, this is done by setting the value of the text field
21:53dnolenlsdafjklsd: if you don't do this, React/Om won't let the text field value change
21:53lsdafjklsddnolen: ok, because that was creating odd behavior
21:53lsdafjklsddnolen: boom, nailed it. exactly
21:53lsdafjklsddnolen: thanks so much man
21:53dnolenlsdafjklsd: this basically lets you intercept changes and do fancy stuff etc.
21:54dnolenlsdafjklsd: no problem
21:54lsdafjklsddnolen: do you have any meetup talks in the works on this stuff anytime soon?
21:54dnolenlsdafjklsd: yeah likely to talk about it more than a few times this year
21:55lsdafjklsddnolen: cool, im new to NYC and have yet to get out too a meet up
21:55lsdafjklsddnolen: I missed your core.async talk, but caught it on youtube. amazing
21:55dnolenlsdafjklsd: cool, yeah will probably do something in NYC in the next couple of months
21:56bbloomlsdafjklsd: om is a bit experimental, so it might not be a great place to start learning clojure
21:56dnolenlsdafjklsd: heh thanks, but the actual awesomeness of core.async is mostly due to other people, same for Om :)
21:58lsdafjklsdbbloom: yea, I'm not just starting with clojure.. but coming from rails / ember the whole functional thing is a lot to take in
21:58bbloomlsdafjklsd: my usual recommendation is to do the puzzles at 4clojure.com & follow some of the top users. great way to learn the stdlib and get comfortable with the syntax
21:59lsdafjklsdbbloom: yea 4clojure.com is great. I worked through stuart halloway's book
21:59lsdafjklsdbbloom: and have been working through functional programming for the object orientated programmer by marick ( WHICH IS AMAZING )
22:36dnolenBOOM https://github.com/clojure/clojurescript/commit/571e156d2daa223dcef273106827e932283e2f93
22:36dnolenClojureScript gets specify
22:36Bronsaneat
22:37rovarcool! what is specify?
22:39bitemyapplsdafjklsd: beware - Marick isn't an authority on FP
22:39dnolenrovar: you can extend a value to a protocol
22:39rovarah
22:39bitemyapplsdafjklsd: if you want to learn higher level patterns, FP, specifically in the Clojure community Stuart Sierra is a better exemplar.
22:40dnolenrovar: like giving a particular map or vector some functionality without polluting all instances w/ that functionality
22:40lsdafjklsdbitemyapp: I found that book to be a really fresh approach
22:40bitemyapplsdafjklsd: you can do better still than that if FP is what you're into, but I'll leave it at that. I don't want hackles to get raised :)
22:40rovarthat was pretty clear from the tests: (assert (= (specify noz IWoz (-woz [_] :boz)) noz))
22:40rovar:P
22:40lsdafjklsdbitemyapp: I appreciate it any help to stay on track
22:41lsdafjklsdbitemyapp: looking forward to the joy of clojure 2
22:41rovardnolen: does clojure proper have docs on this? It seems like a fairly common javascript idiom..
22:41bitemyapplsdafjklsd: JoC is better.
22:42rovarbeen reading JoC2 good stuff.. the bits on macros could have been better..
22:42rovarthere are a lot of interesting examples, but the text doesn't really explain them or bring them together..
22:42lsdafjklsdit's worth the meap?
22:42bitemyapplsdafjklsd: I'm being a little unfair, but I think a very simple and approachable way to indicate my overall point would be that he defs everything at the top-level of the namespace.
22:42dnolenrovar: well the bad version of it is common in JS, usually involved slow cloning and adding some methods and name clashes
22:42dnolenrovar: and a bunch of other horrible things
22:42rovaryea
22:42dnolenrovar: this avoid all that non sense
22:43lsdafjklsdbitemyapp: marick?
22:43bitemyapplsdafjklsd: yes.
22:43rovardnolen: I've tended to avoid such things for much the same reason that I've managed to avoid prototyping languages. Except for javascript.
22:44rovardidn't have a choice there.
22:44lsdafjklsdbitemyapp: He said something like "file modularity has worked for c, it's good enough for us in clojure"
22:44bitemyapplsdafjklsd: let me expand my original statement to be more complete: he's not an authority on FP, programming in general, or Clojure.
22:45bitemyapplsdafjklsd: you can't quote marick at me. That's like quoting the Bible to an Atheist.
22:45rovarbitemyapp: Marick said you'd say that.
22:46dnolenlsdafjklsd: btw, I recommend ignoring most of the things that bitemyapp says. He means well.
22:46lsdafjklsdbitemyapp: haha, we'll I'll read with a grain of salt then. but the first half of the book you build an OO language with clojure and I found that very helpful in bridging the gap between the two worlds
22:46bitemyappit's a terrible idea and a terrible way of teaching FP.
22:47bitemyappyou have to unmoor yourself.
22:47rovarthat's like giving methadone to a heroin addict
22:47lsdafjklsdhahaha
22:47rovaror maybe just less heroin
22:47rovarwhichever is worse..
22:47lsdafjklsdto be fair, I have like no OO experience
22:47bitemyapplsdafjklsd: it doesn't matter, it's familiar to imperative programmers.
22:47lsdafjklsdother than rails
22:47lsdafjklsdwhich isn't really oo programming
22:47bitemyappOO and imperative have similar operational semantics.
22:48lsdafjklsdya
22:48bitemyappthat's my point.
22:48bitemyappyou have to unmoor yourself.
22:48rovarI spent the first 10 years of my career mucking about with imperative pseudo OO nonsense..
22:48bitemyapprovar: CL was the only language to really make a go of it anyway and AOP carried water for it in the end.
22:48rovarIMO there is a way to code in clojure which captures the best of OO features, but I wouldn't call it OO, but I would call it idiomatic
22:48bitemyappit's not OO
22:49bitemyappit's just taking unoriginal features common to some OO languages that happen to also make sense in virtually any programming language.
22:50bitemyappthey're more "deconstructed" than how they usually appear.
22:50rovarit depends on who you ask.. it's not java/c++ style pseudo OO, but you get encapsulation, interfaces, message passing when needed
22:50bitemyappdnolen: I see two possibilities, either you didn't see his mailing list antics - in which case you don't know any better and were somehow not on the ML during that time period (unlikely)
22:50rovarinheritance is already pretty much considered a mis-pattern
22:50bitemyappdnolen: or you were on the mailing list and you're being a hypocrite.
22:50bitemyappand choosing to pretend his understanding of Clojure is somehow not problematic.
22:51bitemyapprovar: really? you should tell the FP-lite peeps over in #scala that.
22:51dnolenbitemyapp: eh, it's a big world. People can use Clojure how they like.
22:51bitemyapptheir libraries and ecosystem appeared to not have gotten the copy-pasta memo.]
22:51dnolenas long as they don't put defn's in defn's :D
22:51bitemyappdnolen: so you won't say a thing if I propagate mis-patterns like him?
22:51bitemyappdnolen: can I hold you to that?
22:52bitemyappbecause if so, I have some counter-revolutionary ideas for driving people to Haskell.
22:52rovarbitemyapp: people attracted to the implicits and other DSL tools of Scala deserve what they get.
22:52bitemyapp(inc rovar)
22:52lazybot⇒ 1
22:52rovarit's like trying to fix c++ template metaprogrammers
22:52rovarthey're broken in a strange way
22:52bitemyapp"so we're going to put a def in out defn to make things extra deffy and fast!"
22:52dnolenbitemyapp: I wouldn't care beyond saying I don't like this or that pattern, this or that approach.
22:53dnolenbitemyapp: my experience is people eventually come around and there's little point in trying to push them too hard along
22:53dnolenbitemyapp: I started Clojure by writing an Object system, yessir.
22:53rovarrovar: back to work.
22:53bitemyappdnolen: now the world is upside down and Mori is a thing.
22:53bitemyappdnolen: have you seen that I have to use clojure-py in production? the edn parsing situation in Python is a disaster but the hashable collections are nice.
22:54dnolenbitemyapp: I have not followed clojure-py at all
22:54bitemyappdnolen: well, given the limitations of Python's collections you basically need something like Mori for Python in order to implement an edn parser.
22:54bitemyappdnolen: you can't have #{ {:a 1} } in python.
22:54bitemyappit's inexpressible.
22:55bitemyappand not because of the keyword, either.
22:55bitemyappso between the lispreader and the collections, we had to use clojure-py to talk to Datomic.
22:55bitemyappPretty bad :(
22:57rovarI think clojure-rust would be fun to write
22:57bitemyappvery glad clojure-py exists though.
22:57bitemyapplife-saver so far.
22:57bitemyapprovar: still no facking TCO.
22:58bitemyappgrumble grumble grumble
22:58rovaryea.. TCO is at ods with reference mgmt, who knew..
22:59rovarbut that's ok, because we can use the recur trick to build iterative loops..
22:59rovareven GNU C gets CTO, though.. :/
22:59rovarTCO
22:59bitemyapprovar: I eagerly anticipate Zed Shaw's "Rust is a Ghetto" blog post.
23:00justin_smithgnu c does self call, or generalized tail call?
23:00bitemyappjustin_smith: almost certainly self-call.
23:01justin_smithhttp://www.prodogtivity.com/ you like doges right?
23:01Wild_Catbitemyapp: what are you using clojure-py for, out of curiosity?
23:02bitemyappWild_Cat: Python <---> REST API <---> Datomic
23:02bitemyapppretty messy situation though.
23:02alewwhat is the difference between self call and generalized tail call?
23:03Wild_Catbitemyapp: wait, you're only using it to parse EDN?
23:03bitemyappwe're basically tip-toeing around clojure-py's rough patches.
23:03Wild_Cat...I'll grant you it's a valid use case, though.
23:03bitemyappWild_Cat: did you read everything I said?
23:03bitemyappit's not just the parsing.
23:03justin_smithalew: generalized tail call can turn two functions that each tail call the other into a loop
23:03Wild_Catbitemyapp: sorry, no, I jumped in in the middle of the conversation. I will now.
23:03justin_smithalew: eliminating all the function call / return in the mutual recursion
23:04justin_smithvery useful for state machine / parser type stuff
23:04bitemyappalew: self-call: a ( a ( a ( a ( a ( a ( a ( a
23:05alewis that related to trampoline?
23:05bitemyappalew: mutual: a ( b ( c ( a ( b ( c ( a ( b ( c
23:05justin_smithalew: it eliminates the need for trampolining often
23:05justin_smithunder the hood you get a loop / switch basically
23:05justin_smithbut you get to express it as functions calling other functions
23:06justin_smithwith trampoline you still have function calls, they just only go one deep, and you need to translate to return a function instead of calling it
23:06justin_smithwith generalized tail recursion it is just normal code that calls other functions
23:07alewI'm guessing clojure doesn't have that?
23:07bitemyappthese differences can lead to much much nicer code than it would otherwise indicate.
23:07justin_smithit doesn't have either kind of tail call optimization
23:07alewright
23:07alewlimitations of the jvM/
23:07alewjvm?*
23:07bitemyappuh, hold up
23:07Wild_Catthat's because the JVM doesn't support TCO, right?
23:07bitemyappit's not a fundamental limitation
23:07bitemyappit's a tradeoff.
23:08Wild_CatClojure has loop/recur for that stuff, though
23:08bitemyappyou can do TCO on the JVM and there are languages that do
23:08Wild_Catit's not as great, but it works.
23:08bitemyappClojure chose to favor interoperability and performance.
23:08bitemyappit was not a "given" though.
23:08alewis TCO not performant?
23:08justin_smithwell you can't do cross method goto, which makes tail recursion between functions hard, unless you put all your code in one method
23:08bitemyappalew: it is in the right language implementation, the JVM doesn't make that easy to do in a generic way.
23:09bitemyappalew: in languages like Haskell and OCaml recursion compiles down to the same assembler you'd see from C for all intents and purposes.
23:09Wild_Catthe lack of TCO isn't that big an issue when you have proper looping constructs anyway
23:09justin_smithalew: it is very performant, compared to regular function calls, and very readable / maintainable compared to huge loops with switch statements
23:09bitemyappWild_Cat: no. No. No.
23:09bitemyappWild_Cat: no. no. Stop. no. No. Don't ever say that again. No. No.
23:10justin_smithhttp://www.prodogtivity.com/?dog=43
23:10bitemyappWild_Cat: https://github.com/noprompt/frak/blob/fraskell/hs/src/Frak.hs
23:10alewThere is a lot of code I would rather express recursively
23:11bitemyappWild_Cat: recursion >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> imperative looping bullshit
23:11bitemyappespecially once things like mutual recursion can be used safely
23:13rovaris there something like a get-in but with wildcards?
23:13bitemyapprovar: madness.
23:14rovarlet's say I have some heavily nested maps..
23:14justin_smithwow, that sounds like a complexity nightmare
23:14bitemyapprovar: madness.
23:14justin_smithI mean you could do it...
23:14justin_smithbut I am sure it is not built in
23:14rovarI have a good reason for it..
23:14alewis that haskell do the same thing as all the cljx code in the same repo?
23:14bitemyapprovar: you need a different data structure
23:14rovarerr..
23:14bitemyappalew: the haskell code is the beginning of an experiment, it's not complete.
23:15rovarthat will be almost impossible..
23:15rovarhttps://www.refheap.com/22327
23:15rovarthese data structures need to exist mostly as-is for other purposes..
23:15bitemyapprovar: this is easy. You can do it in roughly linear time
23:15bitemyapprovar: my friend, I'm going to introduce you to...
23:15bitemyapprovar: Zippers! http://clojuredocs.org/clojure_core/clojure.zip/zipper
23:16bitemyapprovar: enjoy!
23:16bitemyappseancorfield: zippers are awesome.
23:17rovarbasically my need is to select, say all verbs named "c1" under the hierarchy of users -> items -> verbs
23:17bitemyapprovar: then my suggestion is...
23:17bitemyapprovar: drumroll
23:17bitemyapp...
23:18bitemyapprovar: in light of this critically unique and troubling information I must recommend
23:18bitemyapprovar: ...
23:18bitemyapprovar: zippers.
23:18seancorfieldbitemyapp: er, hi, yes, i'm sure zippers are great :)
23:18bitemyapp(inc seancorfield)
23:18lazybot⇒ 9
23:18bitemyappI am corrupt but gracious.
23:18hiredmanrovar: I would check out clojure.set, what you want is to create various indices for lookups
23:19hiredmanrovar: you may also look at core.logic and pldb
23:19bitemyapprovar: hiredman's first suggestion is great.
23:19rovarwhat exists on that page is the worst set of examples for any api in any programming language ever.
23:20rovarI mean.. wow... they pull in the zippers ns as z. then proceed to def z
23:20rovarthis is the type of documentation created to confuse would-be invaders and keep them from sacking cities.
23:20justin_smithclearly they like the last letter of the alphabet
23:20bitemyapprovar: http://www.haskell.org/haskellwiki/Zipper http://learnyouahaskell.com/zippers http://en.wikipedia.org/wiki/Zipper_(data_structure) http://en.wikibooks.org/wiki/Haskell/Zippers
23:21bitemyapprovar: index-y stuff related to clojure.set is a good place to look though.
23:21alewthat makes sense
23:21rovaroh, I'm well aware of how zippers work
23:21alewthe naming conventions came over from haskell
23:21rovarI am a haskeller
23:21justin_smithrovar: there was a standard protocol in the Netherlands during WWII - words they would have someone say, which they were sure no German could pronounce correctly
23:21bitemyapprovar: too bad the docs don't have types :(
23:22bitemyappjustin_smith: it's called a shibboleth. Genocidal semites are the first known group to utilize the concept.
23:22justin_smith"pronounce this properly, or die"
23:22bitemyappjustin_smith: in the original case, the word was shibboleth. The dirty foreigners would mispronounce it as "shibbolet" IIRC
23:22TEttingerit was a war not a genocide. besides god told them to do it
23:23bitemyappTEttinger: it was genocide. Their god told them to kill all the women and children on pain of death.
23:23justin_smithhttp://www.prodogtivity.com/?dog=66 the cabbage barked in the wrong accent
23:23bitemyappjustin_smith: lollapalooza for the Japanese, Scheveningen was the word the Dutch used.
23:23bitemyappjustin_smith: you're on a roll today.
23:24bitemyapp(inc justin_smith)
23:24lazybot⇒ 23
23:24justin_smithdoges are always relevant
23:32bitemyappshit_hn_says: Why the hell should I worry about text encoding before sending a string into a TCP socket...
23:32bitemyappgg wp
23:32bitemyappbest troll #2013
23:40alewwhat's the idea behind b64 encoding?
23:41justin_smithalew: it doesn't use the 8th bit, so it can go over protocols like email unmolested
23:41justin_smithand has a trivial transformation to become arbitrary binary data again
23:42justin_smithprobably it is mostly used for email attachments of binary data like images
23:43justin_smithor, back in the day, binary newsgroups on usenet (maybe that still exists?) would post pirated movies and music as base64 encoded usenet posts
23:45justin_smithalso it gets (ab?)used to embed small images directly in the html of some web pages
23:45alewInteresting
23:46seangrovejustin_smith: Also used by the old version of Selenium for taking screenshots
23:46seangroveMight be used for the new one too, not sure
23:46justin_smithseangrove: so it can like put a screen shot in a log file or something?
23:46rovarif I define (def getvals (partial mapcat vals)) I can use it inside of a -> block.. but if I put (partial mapcat vals) inside the -> block, my result for the block is a partial function, which isn't what I was hoping for.
23:47justin_smith((partial mapcat vals))
23:47rovarrovar then uses macroexpand, and he is enlightened
23:47rovarthanks.
23:47justin_smithnp
23:48TimMcbitemyapp: I'll bite, what's wrong with that quote?
23:49justin_smithTimMc: well if you don't care about text encoding, you may as well ignore endianness too. And if you don't care about that, you could just request that the client generate some random numbers filling up the requisite amount of space and save bandwidth.
23:50TimMcOh, character encodings, OK.
23:50TimMcFor some reason I was thinking about escaping/quoting.
23:51justin_smithon an abstract level these are similar things :)
23:51TimMcLike... certain characters that you couldn't transmit raw, or something (which didn't make sense to me.)
23:52TimMcYes, they are all concepts of embeddings.
23:52justin_smithand utf8 could be seen as using a reader macro on the byte stream level
23:53justin_smitheverything is just regular 7 bit ascii until you hit the magic stuff then the rules change momentarily
23:54rovar(apply (partial merge-with list) (-> (get-in bar [:users "root" :items]) vals ((partial mapcat vals))))
23:54rovarbam
23:54rovarzippers.. pssh
23:54justin_smithnice
23:54rovarI guess I could partial the apply and put it into the ->
23:55rovarsometimes I miss auto-currying
23:56rovar(-> (get-in bar [:users "root" :items]) vals ((partial mapcat vals)) ((partial apply (partial merge-with list))) )
23:56rovarheh..
23:58tpopeat that point just use ->>, no?
23:59alewyou could just use as->