#clojure logs

2012-08-09

00:00KirinDaveRaynes: Isn't Noir the flavor of the quarter?
00:06technomancyNoir is very prescriptive
00:06technomancybut you lose out on a number of things that make compojure particularly charming
00:11RaynesKirinDave: Yeah. Hell, I'm a developer of it. But even I've been using Compojure lately.
00:12technomancyI love how defroutes compose <3
00:12KirinDaveRaynes: I just do way more APIs.
00:12technomancyand you can just M-. your way through them from a single route
00:12technomancy*root
00:12technomancyso rad
00:45dhklmefisto`: I use Rails professionally, but for my own projects, I have been using noir/compojure. Can't say I miss much from the Rails world. Sure, you get less hand holding and there's no scaffolding to get you up and running in seconds. But I'm sure you'll find noir/compojure much more liberating.
01:07lynaghk`ping: seancorfield
01:08A_TURBAN_ON_STERlynaghk, why don't you ping me?
01:08A_TURBAN_ON_STERAm I not important enough for you?
01:08A_TURBAN_ON_STERAm I not a man, and a brother?
01:31technomancyhttp://people.gnome.org/~michael/images/2012-08-08-german-comments.png
01:31technomancy^ libreoffice
01:32porcoI have no experience on Java, should I learn some Java before learning clojure?
01:33technomancyheavens no
01:33PeregrineI have no java experience and I am doing ok with clojure.
01:33PeregrineIn fact in my professional life I program in perl.
01:33technomancyyou'd go crazy
01:34technomancyI mean unless your goal is to appreciate clojure more =)
01:37PeregrineGrab Chas Emericks book and go to down on learning clojure.
01:37PeregrineI'm sure you can look up the java you need to
01:38porcowhat kind of book should I pick up?
01:38porcoI program in php and python at work
01:38Peregrinehttp://www.clojurebook.com/
01:39hiredmanjava (the language) is trivial to pick up if you know some other class based language
01:39PeregrineI also like Programming Clojure by Stu Halloway but the standard response seems to be clojurebook.com
01:40amalloyJoy of Clojure
01:40hiredmanthe non-trivial part is all the packages in the jre, the glut of libraries available on the internet, etc
01:50brainproxyporco: I can also recommend the Clojure Programming book pub'd by OReilly, already mentioned by others
01:51brainproxyI came from a mostly JavaScript background, with a smattering of some other things here and there, but little java knowledge
01:52brainproxythat book really helped me dive into clojure (and Java for that matter), it was a good guide for a lisp noob, though it will certainly challenge and stretch you
01:54dhklporco: Go for Clojure Programming to learn the basics. It's the most up-to-date book practical book out there. Then go for Joy of Clojure for an in depth exposure.
01:54porcook, I'm going to read it, I learned some haskell before
01:59KirinDaveSo, technomancy
02:00KirinDaveI found something _really_ funny in one of our projects
02:00KirinDavehttps://gist.github.com/85842a22bfb6203b7dd5
02:00KirinDaveI nearly lost it.
02:00technomancyoh dear
02:00technomancyoooooh my
02:00KirinDavetechnomancy: I know
02:00KirinDaveReally good
02:00KirinDaveLike gold medal lol
02:01technomancy$kill
02:01lazybotKILL IT WITH FIRE!
02:01KirinDaveBest part is git blame pins this on me because of how the repo was moved
02:01KirinDaveI _know_ I did not write that
02:01KirinDaveI'd sooner cut my fingers off.
02:05aduKirinDave: is that ruby?
02:05KirinDaveadu: Capistrano tasks, yes.
02:05KirinDavecap maven:clean
02:05KirinDavecap maven:idk:yolo
02:06aduwhat's Capistrano?
02:07antifuchsone edit distance away from crapistano, is what it is (bitter, me?) (:
02:07aduhmm, something about servers
02:07antifuchsit's a deploy tool
02:10aduis Capistrano related to Clojure?
02:10antifuchsit's written in ruby, but I guess you can use it to deploy clojure apps
02:10antifuchsit's a parallel ssh driver, essentially
02:11KirinDaveYeah
02:14sthuebnerno
02:18ro_stis there any particular benefit to using java 1.7 for clojure work? is it perhaps faster?
02:18aduyou mean (1.)7?
02:19ro_stok, that
02:19ro_st:p
02:19aduthe 1. disappeared awhile ago
02:19ro_sti have java version "1.6.0_33" installed
02:19ro_stthat's a paste from running java -version
02:20ro_stanyway, that wasn't my question :-)
02:20aduI suppose that's the difference between continuity and marketing
02:21ro_stantares_: lol @ https://github.com/michaelklishin/validateur/blob/master/src/clojure/validateur/validation.clj#L107
02:22antifuchsI was trying to use the lein-ritz plugin in leiningen 2 just now, and it complains "Exception in thread "main" java.lang.RuntimeException: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact lein-ritz:lein-ritz:jar:0.3.2 in central (http://repo1.maven.org/maven2)&quot;
02:23antifuchsI've put {:user {:plugins [[lein-ritz "0.3.2"]]}} in my ~/.lein/profiles.clj
02:23antifuchsanyone know how to resolve this? I'm completely in the dark re. maven and such things
02:23ro_stantifuchs: have you looked at nrepl.el?
02:23ro_stor is this not for use with emacs
02:24antifuchsro_st: yes, I have. ritz is something I want to try.
02:24ro_stah ok
02:24antifuchsyeah, can't find the artifact in clojars or the central maven repo
02:24antifuchsguess I have to build it myself (:
02:25technomancyantifuchs: clojars only has 0.3.1
02:25antifuchsoh, cool then.
02:25antifuchstechnomancy: how could I have checked this? (:
02:26technomancyantifuchs: https://clojars.org/search?q=ritz
02:26antifuchssweet! thanks! (:
02:27technomancyno problem
02:28tutysraI am seeing some improper output format in the repl when I run this - (defn tst []
02:28tutysra (fn [aseq]
02:28tutysra (let [mapfn (fn [v]
02:28tutysra (let [v (identity v)
02:28tutysra _ (println :x)
02:28tutysra _ (println :y)]
02:29tutysra v))]
02:29tutysra (map mapfn aseq)))) ((tst) (range 5))
02:29tutysrathe output from the println in let is getting mixed up with the resulting seq of tst
02:31tutysrais this a known issue?
02:33amalloyyes, known issue with your code
02:33amalloyalso, please use gist or refheap for pasting enormous code samples
02:34tutysraamalloy, sure...
02:36amalloyseriously though, map is lazy, printing is lazy. the repl says "oh hey, a list, i'll print a (. what's the first element? <your function now does some printing> oh gosh, it's 0? i'll print a zero", and so on
02:37antifuchsheh, looks like ritz is targeting a pretty outdated version of slime, too. *cracks knuckles* time to upgrade things, then, I guess (:
02:38technomancyyou should ping hugod
02:38antifuchswill do!
02:38antifuchs(is hugod the ritz maintainer?)
02:39technomancyyeah
02:39antifuchscool cool. will ping.
02:39antifuchsI wish there was an easy way to get a recent & relatively stable slime version that doesn't involve installing a cl (:
02:40antifuchsbecause right now, I think quicklisp is the de-facto release channel for slime
02:40antifuchsxach does testing on it, and does timeslotted releases
02:40antifuchs(and best of all, the slime maintainers don't complain much!)
02:41antifuchsslight negative: you pretty much have to have a lisp installed to get the quicklisp-slime-helper (and the attached slime package).
02:43tutysraamalloy, yes, i could see that - (def res ((tst) (range 5))), initially when I ask for the value of res, I see the print vals in res but from next time it prints only the range values
02:47tutysraI am using emacs, normally the output from (println x) shows in a different color than return value, but in this case with tst everything is shown in the same color as return value, why it is so?
02:51tutysrahere is the gist of tst function - https://gist.github.com/3301766
03:04antifuchstutysra: I'm guessing you're using slime & swank-clojure?
03:05tutysraantifuchs, you are right, i am using slime + swank-clojure
03:05antifuchstutysra: it simply shows the return value in a different face from regular output (the print mechanisms slime-side are different, too)
03:05antifuchsI think it may even try to highlight the return values as a presentation thing that you can rightclick and such
03:05antifuchs(but that may be only if you use common lisp)
03:07antifuchsI think slime's intention is that it tries to highlight things it knows are values differently from arbitrary text output
03:08tutysraok, in my case the output from the println statements are mixed up with the return value due to lazy evals, I am expecting the println output to show in a different color than return value as it does normally
03:10antifuchsah, yeah, that's yucky.
03:10antifuchsdon't think there's much that can be done to fix, other than changing lazy data structure printing, I guess
03:12tutysraas amalloy pointed out, the repl prints "(" when it starts to realize the lazy seq and after that the output from println follows... got a bit confused when I saw this for the first time
03:16tutysraantifuchs, ok, it is not a big concern if it cannot be fixed, I got the reason...would look nice to eye if some thing can be done to fix it
03:17tutysrathx antifuchs, amalloy for the explanation
04:39PeregrineWhen I try to use ring.util.serve I get an error ClassNotFoundException org.mortbay.log.Logger java.net.URLClassLoader$1.run (:-1)
04:41hiredmanis ring.util.serve on your classpath?
04:41PeregrineIt is.
04:41hiredmanare you sure?
04:41hiredmanbecause that error message says no
04:41hiredmanwhat makes you think you do?
04:42PeregrineYes because the time before when it wasn't on my classpath it gave me a different error about not being able to find ring.util.serve class...
04:42PeregrineThat's not the exact error message it gave
04:42hiredmanoh of course sorry, org.mortbay.log.Logger is the missing class
04:43hiredmando you have some dependency pulling in jetty?
04:43PeregrineC:\Users\peregrine\.m2\repository\ring-serve\ring-serve\0.1.2\ring-serve-0.1.2.jar is in the classpath I just checked to make sure.
04:43hiredmanring-serve should, but you might want to check and see
04:44hiredmanorg.mortbay is jetty
04:44PeregrineWell I expect ring.util.serve should pull in jetty but I am also using ring.adapter.jetty as a dependency
04:44hiredmanwhat version?
04:45hiredmancan you pastebin the entire exception?
04:46hiredmanthe entire stacktrace
04:46no7hingisn't the mortbay package a relict of very old jetty versions?
04:46PeregrineHmm it seems the eclipse repl is hiding it.
04:46PeregrineGive me a moment
04:47PeregrineHmm that does seem to be the entire exception.
04:47hiredmanno7hing: well, it depends what you mean by "very old"
04:48PeregrineI just did lein repl and tried using ring.util.serve and it gives the exact same exception.
04:48no7hingyeah, very old is relative
04:48no7hingver 6
04:48PeregrineI do suspect it is an issue with mismatched versions.
04:48hiredmanyeah
04:48no7hingthe bundled jetty adapter with ring is 7.6
04:48no7hingring.adapter.jetty
04:49hiredmanI expect ring moved to jetty 7, and ring-serve depends on 6
04:49Peregrinering.adapter.jetty refers to [org.eclipse.jetty/jetty-server "7.6.1.v20120215"]
04:49PeregrineOk thanks.
04:49hiredmanPeregrine: is there a reason to not just use lein-ring?
04:49hiredmanhttps://github.com/weavejester/lein-ring/
04:50PeregrineProbably not.
04:50no7hingfunny, i was about to ask something about ring&jetty too
04:51PeregrineIt seemed more convenient to be able to stop and start the server from inside my repl.
04:51hiredmanah, well, you just need the jetty adapter for that
04:52PeregrineHow do I stop the server?
04:52hiredman(.stop return-value-of-whatever)
04:52no7hing(.stop server-var)
04:53no7hingdoes the bundled jetty adapter in ring use one thread / request?
04:53PeregrineAhh I'll need to make sure to set join? to false so it doesn't block on the run-jetty command.
04:54weavejesterI've been meaning to deprecate ring-serve and add its functionality into the more general ring-server
04:58clj_newb_23982is there av erson of conjure.contrib.seq-utils/find-first that is in core?
04:58clj_newb_23982or somethign like it?
05:01Peregrine(first (filter pred coll))?
05:01clj_newb_23982doh; I actually need index of the element
05:01weavejesterYeah, that's literally what find-first is
05:08weavejesterclj_newb_23982: You probably want the keep-indexed function then.
05:08clj_newb_23982weavejester: yeah, got it working
05:12otfrommorning
05:14clj_newb_23982string has .substring in java
05:14clj_newb_23982do lists / vectors have a "subsequence" ?
05:16no7hingnobody? i seem to have a conceptual gap concerning threads and in this case servers
05:16clojure-newcomerhey guys, is it possible to output two forms from a macro, like a defmulti and a defmethod ? I'm failing on this in the REPL atm
05:17no7hinglike in: what get's executed in a thread and what get's executed in clojure's own (main) thread
05:17hiredmanno7hing: http://en.wikipedia.org/wiki/Java_Servlet
05:18hiredmanthe standard servlet stuff (which ring is built on) is 1 thread per request
05:18hiredmanno7hing: clojure as such doesn't have a "main" thread
05:19hiredmanthe jvm has a main thread
05:19hiredmanbut webapps are often deployed to containers where your app never gets anywhere near the jvm's main thread
05:20no7hingso as long as i or jetty don't use async servlets with manual setting of continuations (e.g. for a db call) the thread is bound to execute my servlet, yes?
05:20hiredman"bound to execute my servlet" ?
05:20weavejesterclojure-newcomer: Yes, just use "do", e.g. `(do (form-one) (form-two))
05:20clojure-newcomeror would I have a macro that calls two macro's to do this ?
05:20clojure-newcomerthink I read somewhere a macro can only return one form ?
05:20no7hing@hiredman: won't do other stuff
05:21clojure-newcomerweavejester: thanks
05:21clojure-newcomerwill give it a go
05:21no7hinglike accept other inbound requests
05:21weavejesterno7hing: Your handler function gets its own thread
05:22weavejesterno7hing: So a request comes in, a thread is grabbed from a pool, and then the handler is evaluated in that thread.
05:23no7hingthanks, that fills in that gap
05:24no7hingand if i have potentially long running tasks in context of a request, i'll have to use async servlets or something like netty, yes?
05:25no7hingto not hog the thread for the time it takes to finish the long running task
05:25weavejesterAleph is probably the most "clojurey" solution.
05:25weavejesterBut you should only have long running requests if you're using long-polling or websockets.
05:26no7hingaloha, from the same dev, is a slimmer wrapper around netty
05:26no7hingand more approachable ;)
05:26no7hinghttps://github.com/ztellman/aloha
05:27no7hing@weavejester: i'am thinking of using server sent events/chunked transfer encoding
05:27weavejesterDoes aloha have anything for async stuff?
05:28no7hingas it's using netty under the hood it probably has no other choice
05:28weavejesterAh, oops, gotta go or I'll be late
05:28no7hinghaven't checked yet if the interface allows for it, tho
05:28weavejesterno7hing: I meant is there any Clojure interface to the async sutuff
05:28no7hingbye
05:28weavejesterbye for now
05:29no7hingoh erlang, don't let anybody tell you again that you're hard to grasp
05:33clgvfor (defmacro defbla [symb expr] `(def ~(vary-meta symb assoc :type :bla) ~expr)) when calling (defbla x 20) I get "ClassCastException clojure.lang.Var cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:211)". why?
05:46magopianhello guys, a quick question
05:46magopiani can't understand why (reduce str [\1]) gives \1
05:46magopianand not "1"
05:47magopianok got it, with a simple RTFM ;)
05:47magopianIf coll has only 1 item, it
05:47magopianis returned and f is not called.
05:52magopianthanks everybody for being my rubber duck ;)
06:39clgvwhy does (def ^{:type :bla} mydef 1) result in a "ClassCastException clojure.lang.Var cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:211)"?
06:47hyPiRionclgv: It doesn't for me.
06:48clgvhyPiRion: clojure 1.4.0?
06:48hyPiRionyup, lein repl.
06:49hyPiRionIs that what you wrote verbatim?
06:49clgvthats weird.
06:50clgvin CCW repl it has the exception - in "lein2 repl" not. specifying :type seems to be the reason
06:50hyPiRionStrange.
06:50hyPiRionIn 1.3.0 it throws off the exception you mentioned.
06:51hyPiRionIf you try out (def ^{:type Integer} mydef 1) instead?
06:52clgvthat works. I think there is a good error missing
06:52clgv*good error message
06:52hyPiRionyeah, seems like it.
06:55cemerickWhat are people using for their ClojureScript REPL-ing? Just a bare terminal?
07:02ejacksoncemerick: I use the repl provided by lein-cljsbuild
07:02cemerickejackson: which is in a terminal, I presume?
07:02ejacksonyup
07:03naegyou could use light table playground
07:03ejacksonthere was a nice setup w/ emacs and clojurescript1
07:03naegit's like a REPL in the terminal - but in the browser :o
07:03ejacksonwhere you could get eval from buffers and run a simultaneous clj repl. But it was a bit of fuss
07:04cemerickejackson: that uses inferior-lisp, I think?
07:04ejacksonyeah, that's what I recall
07:04cemerick(i.e. still a terminal, essentially)
07:04cemerickRight.
07:04ejacksonwell, the eval stuff raises it above that :p
07:04ejacksonsweetness
07:05cemericknrepl.el is getting quite decent, from what Raynes and technomancy have been saying
07:06cemericknaeg: I'm afraid I'm pretty well locked into ccw. :-)
07:07cemerickejackson: does lein-cljsbuild allow you to specify different repl environments, or does it always just use the Rhino one from cljs.repl.rhino?
07:07naegI'm still not sure what to use, atm I'm just using light table to try out stuff while learning
07:10ejacksoncemerick: dunno.
07:10ejacksonjust a brief encounter
07:11ejacksonit was a faff and I ended up programming eye and debugging by js/log
07:12cemerickwahoo!
07:13ejacksoncemerick: settle, settle...
07:14cemerick;-)
07:15ejacksoncemerick: well that was very cheshire cat dramatic of you !
07:15cemerickragequit
07:16cemerickmostly, getting my irc client to stop freezing up
07:16cemerickit gets a bit oversensitive after a couple weeks without a restart
07:17ejacksonwell, so do I.
07:31hyPiRionPeople have said that http://java.ociweb.com/mark/clojure/article.html is the best free online resource/"book" for learning Clojure. Is that still valid?
07:33scottjhyPiRion: yeah
07:33otfromdoes nrepl.el solve the lein repl OOM error? https://github.com/technomancy/leiningen/issues/691
07:36RaynesI guess, in that those are two entirely different things.
07:37hyPiRionscottj: Humm, I wish there were some sort of http://tour.golang.org/ - but for Clojure instead.
07:37otfromRaynes: how so? I thought that nrepl used REPLy same as lein repl
07:37otfromwould be great if I was wrong as I'd like to give nrepl.el a go
07:37ohpauleezhyPiRion: labrepl?
07:38RaynesFor usage with nrepl.el, you want to use lein repl :headless, otfrom. All it does is start an nrepl server.
07:38ohpauleezhttps://github.com/relevance/labrepl
07:38Raynesohpauleez, otfrom: tryclojure would serve a similar purpose if people would contribute an actual worthwhile tutorial and/or I had time to do it myself.
07:38RaynesEr, not otfrom. Sorry.
07:38ohpauleezRaynes: agreed
07:39otfromRaynes: np ;-)
07:39hyPiRionohpauleez: If it's not hosted on some webpage, it will increase the threshold for people interested in learning.
07:39otfromRaynes: ok so lein repl :headless doesn't have the same issue that REPLy has with holding on to head and blowing up with OOM. That's cool. I'll give that a go then
07:39ohpauleezShoreleave's demo is using catnip for an interactive tutorial/walkthrough
07:40hyPiRionAnd yeah, tryclj is the step I want to see, it shouldn't be too difficult making it like redis' tutorial.
07:40hyPiRionFamous last word and all that.
07:40ohpauleezhaha for sure
07:41hyPiRionI'll have a look into labrepl, and figure out if that's good enough.
07:42hyPiRionI just wish the threshold were lower, I want to work with Clojure dangit.
07:42hyPiRionAs in, work at work with Clojure.
07:43ohpauleezhyPiRion: What's your industry? Clojure was introduced to Comcast without much trouble, and I've built a number of startups up with Clojure
07:43ohpauleezIndustry and current language/tooling
07:51hyPiRionohpauleez: Hahah - I'm doing video codecs.
07:51russfrankI wrote my first clojure program.. comments? https://gist.github.com/3303549
07:51ohpauleezin C?
07:52hyPiRionyup
07:52ohpauleezahhh
07:52russfrankis there any better way to represent those bits that are just essentially if else if chains?
07:52cemerickrussfrank: cond
07:52cemerickor condp
07:53ohpauleezrussfrank: Use if-let and cond
07:53russfrankok, will try, thanks
07:54hyPiRionrussfrank: (defn fn-name docstring arglist)
07:54russfrankwell, so one of the issues here is that I have some cases where I *know* I need to return false
07:54ohpauleezrussfrank: Also functions should look like (defn some-name "What this does" [arg1 & args] ..) etc
07:54ohpauleezwith the comment first, on a newline, and the arg list next, on a newline
07:55russfrankok, nvm, I see how cond is useful
07:55russfrankyeah I'll fix the docstrings
07:55ohpauleez&(doce some-fn)
07:55lazybotjava.lang.RuntimeException: Unable to resolve symbol: doce in this context
07:56ohpauleez&(doc some-fn)
07:56lazybot⇒ "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-... https://www.refheap.com/paste/4194
07:56ohpauleezrussfrank: http://clojuredocs.org/clojure_core/clojure.core/some-fn
07:57ohpauleezAlso: #(not (lookup % model))
07:57ohpauleezor better
07:57ohpauleez#(false? (lookup % model))
07:58ohpauleezlikewise: nil?
07:59ohpauleezrussfrank: You shouldn't use identical? like that. Use the predicate functions you're looking for or use (= thing-1 thing-2)
08:01ohpauleezrussfrank: Likewise, you should try to use restructuring to help you pull out the values you're looking for.
08:01ohpauleezHope these tips help!
08:02russfrankthey do
08:02russfrankohpauleez: https://gist.github.com/3303613 little better with cond
08:03russfrankI'm using identical? because I need to know if it's exactly false
08:03russfrankit can return nil if the variable is simply unset
08:03russfrankso each variable can be nil, true, or false in the model, and (= nil false) => true of course, so that's why I'm using identical
08:04ohpauleez&(false? nil)
08:04lazybot⇒ false
08:04ohpauleez&(false? false)
08:04lazybot⇒ true
08:04russfrankhah, ok.
08:04ohpauleez&(nil? false)
08:04lazybot⇒ false
08:04ohpauleez&(nil? nil)
08:04lazybot⇒ true
08:06ohpauleezSo the next thing you should do, is patch up the predicates. Then I can help you through putting some let blocks in that destructure these args a bit
08:06russfrankhttps://gist.github.com/3303640
08:06russfrankthat makes things considerably nicer
08:07ohpauleezrussfrank: (true? (satisfiable? clause model))) that can be simpler. How?
08:08russfrankit can be just (satisfiable? clause model) but I like the symmetry of explicit truth testing
08:08russfranksince we have to test if it's specifically false in the following test
08:08ohpauleez(we're going to refactor that later haha)
08:09ohpauleezBut right now, we're going to introduce some lets - I'll comment on the gist itself in a second
08:09russfrankoh alright I'll change it haha
08:09russfrankok
08:28ohpauleezrussfrank: anytime you see and (if … (let [] )), you should think - if-let
08:29ohpauleezanytime you find yourself using (get ...)
08:29ohpauleezyou should use destructuring
08:30ohpauleezusing (let (if-let … )) or (if-let (let …)) are fine, but usually means there might be a better way to structure and process your data
08:31ohpauleezput the some before the every?, so you can potentially avoid going through the entire collection
08:31estebannhow can I tell if a form has been quoted?
08:32hyPiRion,(= [] '[])
08:32clojurebottrue
08:33ohpauleezsimilarly -
08:33ohpauleez&(type (quote (1 2 3 4)))
08:33hyPiRionI don't believe you can, unless I interpret you wrong.
08:33lazybot⇒ clojure.lang.PersistentList
08:33ohpauleezyou cannot, unless you're the author of the macro or quoting form
08:33estebannweird
08:34ohpauleezif you're in a situation where you need to know if something is quoted, chances are you're programming to the implementation, not to an interface
08:34hyPiRionDo you need to differentiate between quoted and "unquoted" values?
08:34ohpauleezand need to refactor the approach
08:35estebanni'm just sort of exploring options at this point... but it seems strange that there are aspects to a data structure to which only eval has access
08:35naeg,(print "hello naeg")
08:35clojurebothello naeg
08:36ohpauleezestebann: You have access to the reader too
08:36dmedvinsky,(print ",(print \"hello clojurebot\")")
08:36clojurebot,(print "hello clojurebot")
08:37ohpauleezmy example above shows that the reader sees a quoted form AS the data structure
08:37ohpauleezcode is data is code
08:38estebann,(= (eval '(+ 1 1)) (eval ''(+ 1 1))
08:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
08:38estebann,(= (eval '(+ 1 1)) (eval ''(+ 1 1)))
08:38clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
08:38estebannwell, that second one would have been false
08:39ohpauleezright, and you'd expect that, you eval'd the data
08:39estebann,(= '(+ 1 1) ''(+ 1 1))
08:39clojurebotfalse
08:40ohpauleezright, you're just proving the reader works
08:40ohpauleezthe first one returns the raw list, as a list
08:40ohpauleezthe second one returns a quoted list
08:41ohpauleez(1 2 3 4) does not equal (quote (1 2 3 4))
08:41estebannbut the members of both are the same, and they both have the same type
08:41estebanni'm probably just not getting something
08:41ohpauleezthey don't have the same members
08:41ohpauleeztotally, let's try one more thing
08:42ohpauleez(1 2 3 4) has four members: 1 2 3 4
08:42estebannok
08:42ohpauleez(quote (1 2 3 4)) had two members: quote and (1 2 3 4)
08:42ohpauleezso '(1 2 3 4) and ''(1 2 3 4) can't be equal
08:43estebann,(first '(1 2 3))
08:43clojurebot1
08:43estebann,(first ''(1 2 3))
08:43clojurebotquote
08:43estebanngotcha
08:43estebannok thanks, that's helpful
08:43ohpauleezit's just the reader, reading forms. Quote just says, "Hey, this is data"
08:43ohpauleeztotally welcome
08:46hyPiRionrussfrank: Here's how I'd do it https://gist.github.com/3303586
08:46hyPiRionIt's a good program for being your first though.
08:47ohpauleezhyPiRion: That's good. Destructure in the first function, and put some before every?
08:48ohpauleezI'd consider take-while or drop-while too, to make things a little more readable
08:48hyPiRionOh, yeah, find is a special function you'd usually use to get a value
08:49hyPiRionLook at this: ##(do (println (get {:a nil} :a)) (println (get {:b :a-does-not-exist} :a)))
08:49lazybot⇒ nil nil nil
08:50hyPiRionSo if you have a nil value, you're unable to distinguish it between not being there at all.
08:50ohpauleezhyPiRion: I'm just talking about (= (get v 0) \-)
08:50hyPiRionohpauleez: Ah.
08:51ohpauleezI would throw a let up top, (let [[first-char] v] ...)
08:51russfrankhyPiRion: thanks -- will read through this
08:51ro_stohpauleez: had any issues with enfocus's set-style and :top or :height ?
08:51ohpauleezbut the get is fine, since the value isn't really needed anywhere else
08:51hyPiRionohpauleez: (defn lookup [[c :as v] model] would be a nice one
08:51ohpauleezro_st: I don't use those
08:52djcoinPutting function name then doc then args of functions seems kinda weird to me (but I guess that's a deeply rooted coding style). I would rather bundle together function name then functions args then doc
08:52ro_stok
08:52ohpauleezdjcoin: It's because you can have multiple arg lists
08:52hyPiRionrussfrank: My pleasure, thanks for giving me a break at work ;)
08:52ro_stdjcoin: args close to the impl is better
08:52ohpauleezand often do in production code
08:52djcoinOh yeah, right
08:52hyPiRionI really like 4clojure, so if you're interested in learning about many different functions, go there.
08:53ohpauleezI read it as: Name, meaning, implementation
08:53hyPiRionI believe the reason why arglist is after docstring is a technical one
08:53ohpauleezI shouldn't need to see the implementation if I just want the name or the meaning of something
08:53ohpauleezfor sure, because of multiple arg lists
08:54hyPiRionconsider (defn foo "docstring" ([a b] ...) ([a b c] ...))
09:07pandeirowhat fn would take a seq '(1 2 3) and produce an infinite seq '(1 2 3 1 2 3 1 2 3 ...) ?
09:07pandeirorepeat produces '((1 2 3) (1 2 3) (1 2 3))
09:07hyPiRioncycle
09:07hyPiRion#(cycle '(1 2 3))
09:07hyPiRion,(cycle '(1 2 3))
09:07clojurebot(1 2 3 1 2 ...)
09:09pandeirohyPiRion: thanks, can never remember the names
09:11pandeiro,(let [f '(nil nil "fizz") b '(nil nil nil nil "buzz")] (take 30 (map vector (range) (cycle f) (cycle b))))
09:11clojurebot([0 nil nil] [1 nil nil] [2 "fizz" nil] [3 nil nil] [4 nil "buzz"] ...)
09:11TimMchaha
09:11pandeirojust translating the HN post on functional fizzbuzz from Haskell to Clojure :)
09:12TimMcIt's almost right.
09:12pandeiroyeah?
09:12TimMcOff by one.
09:12hyPiRionWhich one?
09:12pandeiroah 1 indexed?
09:12TimMcSwitch fizz and buzz to be the first in their lists, maybe.
09:13pandeirohyPiRion: it was on front page this morning, read it on the train, sorry no link
09:14hyPiRionpandeiro: ah, okay
09:14hyPiRionCan't find it.
09:14pandeiroTimMc: enlighten me? i know it should technically produce '(1 2 "fizz" 4 "buzz"...) but i was ignoring the post-processing part :)
09:14pandeirohyPiRion: one sec
09:15pandeirohttp://pragprog.com/magazines/2012-08/thinking-functionally-with-haskell ?
09:16hyPiRionthanks
09:16hyPiRion(inc pandeiro)
09:16lazybot⇒ 1
09:17pandeirowoohoo!
09:17pandeirolook out, #clojure
09:17russfranklol
09:18pandeirothank you thank you, i will be doing fizzbuzz all week
09:24hyPiRion,(map #({"" %} %2 %2) (range) (map str (cycle ["Fizz" "" ""]) (cycle ["Buzz" "" "" "" ""])))
09:24clojurebot("FizzBuzz" 1 2 "Fizz" 4 ...)
09:27TimMcThe issue is that it should be replacing the multiples of 3 and 5, but it looked like you were hitting the multiples-minus-one.
09:32pandeirohyPiRion: i am still parsing that, impressive
09:34TimMc#({a b} c d) -> #(if (= a c) b d)
09:35hyPiRionpandeiro: It's not that complicated - TimMc hit the nail on the hackish part.
09:38ToxicFrogClever.
09:39pandeiroyeah it is
09:39pandeiro(clever, not complicated)
09:39pandeirothe optional second arg to the hash-map-as-fn is the trick
09:39pandeiroas TimMc illustrated
09:41jrheardhi folks - can someone please explain this to me?
09:41jrheard=> (some #{:a} {:a 1 :b 2})
09:41jrheardnil
09:41ToxicFrogYeah, I didn't know you could do that
09:42jrheard(i would expect to see :a instead of nil)
09:42duck11231and obviously, it's not very useful
09:42ToxicFrog,(some #{:a} {1 :a 2 :b})
09:42clojurebotnil
09:42ToxicFrogHmm
09:43ToxicFrogOh, I think I see what's happening
09:43jrheard!
09:43XPheriorIs there a way to declare my data at the bottom of a Midje test? I have a let form at the top of most facts. It kind of obscures what the test does.
09:43ToxicFrog,(some #{[:a 1]} {:a 1 :b 2})
09:43clojurebot[:a 1]
09:43jrheardhm!
09:43jrheardthat makes sense
09:43ToxicFrogjrheard: a map is, conceptually, an unordered collection of [key value] pairs
09:44ToxicFrogSo that's what some looks for
09:44jrheardso if i want to know if a map contains a key, the only recourse i have is to use contains?
09:44jrheardi was hoping to write a general in? function that would return True if an item is in a collection
09:44duck11231XPherior: you can set up some data in an around at the end, but I had diffuculties doing that, so I just use let
09:45jrheardfirst-pass implementation looked like (some #(= x %) coll) , but it doesn't work on dicts :)
09:45hyPiRionjrheard: use find
09:45XPheriorduck1123: Hm, alright. That's kind of a shame. It would make the test so much more readable.
09:45jrheard!
09:45ToxicFrogjrheard: contains? works on non-maps as well
09:45jrheard!
09:45jrheardboth of those are great to know!
09:45jrheardthanks folks :)
09:45XPheriorcontains? is such a misleading function. Ugh
09:45ToxicFrogjrheard: however, contains? looks for keys, not values
09:45ToxicFrogWhich can be unpleasantly surprising
09:45duck11231XPherior: it works, but I just found it to brittle when working with lazy seqs, and dynamic bindings and whatnot
09:45ToxicFrog(eg, [:a :b :c] contains? 3 but does not contains? :a)
09:46jrheardToxicFrog: buh
09:46XPheriorToxicFrog: Yeah I understand. :/
09:46djcoinWhat are the advantages of dynamic typing other static typing ? Curious about what clojurians think about this :) - if there are any except that lisp language can't be statically typed easily -
09:46XPheriorJust makes me wish Clojure had a where clause, sort of thing
09:47hyPiRionwhere clause?
09:47XPherior((+ a b) (where a => 1 b => 2))
09:47hyPiRionoh.
09:47XPheriorLike Haskell has.
09:47ToxicFrogjrheard: this is actually harder that I would have expected, now that we're looking at it.
09:47jrheardyeah, right?
09:47ToxicFrogPartly, I think, because you want to search for keys in maps but values in everything else
09:47jrheardexactly yeah
09:47XPheriorToxicFrog: How about using a protocol?
09:47jrheardi just want python's "in" operator
09:48jrheardis it idiomatic in clojure to do different things based on the type of your input? e.g. pattern-matching in haskell, do this if it's a map or that if it's anything else
09:48hyPiRiondjcoin: Well, it's less verbose, and I like that. It's also easier to prototype.
09:49jrheardthe impression i've been getting is that instead you're encouraged to code to the abstractions, not the implementations
09:49babilenjrheard: The main problem is that you don't see a map as a collection of [k v] pairs for your "in" function. Once you do that the content tests in Clojure make a lot of sense
09:49hyPiRionjrheard: Have you looked at multimethods? It's pattern-matching-ish
09:49jrheardhyPiRion: yeah and i love that they exist, but they don't seem to also let me match on types
09:49djcoinType inference on static language does not make it too verbose (besides when it comes to optimization in clojure you may need to add type hint)
09:49djcoinhyPiRion: ^
09:49djcoinAgreed for prototyping :]
09:50XPheriorjrheard: I think Rich said pattern matching was overly complex, and to rely on polymorphism - which protocols basically are
09:50jrheardbabilen: fair enough; so i'll just not write my in? function and instead use contains? on maps and some on non-maps
09:50XPheriorYou're not saying if this is a map, do this.. More, each type handles it if it ops to do so
09:50jrheardXPherior: yeah, that fits with the impression "clojure programming" has been giving me
09:50XPheriorTakes a while to get used to :)
09:50jrheard:)
09:50jrheardthanks again for the help folks
09:50hyPiRiondjcoin: Well, it's a personal opinion. Go has managed to make static typing nice, whereas I haven't yet used Haskell or anything static and functional.
09:51babilenjrheard: exactly -- And collections are also functions of their keys -- But then you would argue that you don't want keys (i.e. indices) for lists and vectors as in &(["a" "b" "c"] 1)
09:51hyPiRionI'm comparing to C/Java, in which things becomes somewhat verbose in my opinion.
09:52ToxicFrogI still haven't used go
09:52babilen,(juxt (["a" "b" "c"] 1) (1 ["a" "b" "c"]))
09:52clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
09:52ToxicFrogBut it was Scala that convinced me I actually like static typing, I just don't like statically typed languages
09:52ToxicFrog*most statically typed languages
09:53mdeboardand that's how I met your mother
09:53ToxicFrogHonestly I keep going back and forth on it. Dynamic typing means I know the type system will never get in my way, which still happens from time to time in Scala. But static typing makes debugging and constructing large programs so much more convenient.
09:54djcoinI guess people think being a lisp, macro etc. outweights static typing. Well i'm maybe telling non sense, you can't really compare such things
09:55djcoinWhat's may be kinda clear to me is that, if you ahve to pick for a dynamic typed language, make it empowering and choose a lispy
09:55XPheriorFound what I was looking for. Hah. https://github.com/myguidingstar/clojure/commit/17f43bc2d9284571a12559978b55c58f026a49ec
09:55clgvToxicFrog: when comming from a statical typed language without a repl you certain have to change the way you are working in clojure with the repl. but when you manage that writing large programs works good, as well
09:58hyPiRionI would really love optional static typing and type inference based on that.
09:58ToxicFrogclgv: I'm coming from statically typed languages with repls, actually
09:58ToxicFrogHaskell and Scala
09:58djcoinToxicFrog: how did you happend to make a move to clojure ?
09:59djcoinhappen*
10:00hyPiRionFor me, it's not so much about being static, dynamic, compiled or interpreted, but more about being interactive.
10:00ToxicFrogdjcoin: I did some fiddling around with other lisps but none of them really clicked with me. Clojure is the first lisp-1 I've seen that I actually find practical for day to day use (easy to deploy on all OSes, lots of library support, etc)
10:01ToxicFrogIt came up while I was looking for a new language to learn, and I was already in a JVM mood from working with Scala a lot, so I decided to have a go at it.
10:01ToxicFrogAnd so far it's pretty nice.
10:01djcoinCool :)
10:02augustlwhen I start a server with "lein ring server-headless", killing the process "bash /home/augustl/local/bin/lein ring server-headless" does _not_ kill the actual java process. How can I fix that?
10:06augustlcurrently having some "fun" writing a Swing app that starts a bunch of services for testing etc. Using ProcessBuilder and Process to call "lein ring server-headless", but destroying that process doesn't destroy the actual java server
10:07augustljust like killing it with "kill" in a terminal doesn't destroy the java server
10:08ToxicFrogswing :suicide:
10:09augustl"lein trampoline", yay
10:13jsabeaudryWhat determines if clojure-mode will figure out how to indent the & body of a macro correctly or not?
10:15jsabeaudryIs it only when the macro name starts with "with-"
10:19pjstadighttp://groups.google.com/group/clojure-dev/msg/6a5b044fd3b70ad7
10:19pjstadig?
10:20pandeiroanyone looked at the clojurescript/lua source/announcement on HN today? is there any overlap between the python, scheme, and lua targeting projects?
10:21ohpauleezpjstadig: Are you asking the status of that or RH's reply?
10:39llasramjsabeaudry: Take a look at `define-clojure-indent` and related
10:40llasramjsabeaudry: It automatically applies certain indentation rules to symbols starting with `with-`, but also uses properties on the (in-elisp version of) the symbol to determine how to indent that symbol's invocation form
10:41jweissIf i want a macro expansion to be able to refer to the same symbol in both generated and passed-in code, what's the best way to handle it? i can't think of any hygenic solution.
10:41llasramjweiss: Do you have an example?
10:43jweissllasram: https://www.refheap.com/paste/4205 the problem is req# - i want both the generated code and the passed in code to refer to the whole map.
10:44jsabeaudryllasram, thanks for the pointer, I'll have a look at that
10:45llasramUsually what I'll do is have the macro take a symbol argument in some `let`-ish syntax which is then bound via let around the expansion of the body form
10:49jweissllasram: ok i'll try that thanks
10:51S11001001I've just noticed a particular idiomatic tic of mine that I don't think is quite as widespread as I thought
10:51S11001001I refer to packages that use a particular library as "clients" of the library
10:51S11001001is this normal?
10:53russfrankohpauleez: I liked hyPiRion's use of map, ended up with this https://gist.github.com/3303640
10:54arkhwhen at a repl, if I do a (load-file "path/project.core") and (in-ns project.core), and it 'require's project.supplemental, is there a way to reload project.supplemental when changed?
10:55arkhsorry, typo with (in-ns ...)
10:55dgrnbrgIs there something in clojure's libraries that's like a future, but it runs on the same thread when I try to deref it?
10:55clgvdgrnbrg: delay
10:56dgrnbrgi thought i remembered that, but i couldn't remember the name
10:56dgrnbrgthanks!
10:56uvtcS11001001: I like using "client" for local/remote interactions because it's one of a pair: "client/server". Are there matching terms like that for "user-of-library/library"? (Hm. Maybe I'm having brain lock.)
10:56arkhdelay runs on the same thread but doesn't (necessarily) immediately execute
10:56S11001001uvtc: the only ones I can think of are dependent and reverse dependency; both of these are terrible
10:57S11001001uvtc: and there's no rule against using one name for different things; else assoc should be called something else :)
10:57ohpauleezrussfrank: That's looking better. Consider using take-while/drop-while instead of that sort of weird filter in line 53, remove the blank lines between arg-list and the bodies, and consider [model [c :as v]] for line 4
10:57ohpauleezrussfrank: then run the whole thing through kibit
10:58uvtcS11001001: Oh. caller/callee
10:58S11001001uvtc: (map my-function my-list)
10:58uvtcS11001001: Oh, well, that would be too general, since of course it applies to regular functions too...
11:02TimMcS11001001: I don't talk about packages as clients but instead just refer to "client code" or "relying code".
11:03TimMc"Caller" focuses on function signatures, not other contracts.
11:03jkkramer"consumer" is used sometimes, too
11:03S11001001TimMc: hmm, nice qualifier
11:03russfrankhm, the kibit installation is not working.. I added the thing to my user profile but lein is saying kibit is not a task
11:04TimMc"Dependent" really gets to the heart of it, though: It's a DAG.
11:06S11001001TimMc: it's truth, but too easily confused with dependency in prose
11:07arkhregarding my previous babble, it seems I could just do (use 'project.core :reload)
11:08S11001001TimMc: and the situation is even worse when speaking, where "dependents" vs "dependency"...
11:08uvtcHm ... availor/availee (Calling code avails upon the library code.) :)
11:11S11001001jkkramer: that might work
11:12TimMcS11001001: Yeha. :-(
11:12TimMc*yeah
11:17russfranklein doesn't seem to want to install kibit .. https://gist.github.com/29d3785de75e62f7814c
11:17russfrankohpauleez: any ideas?
11:23treehugis there anything similar to a mathematica/ipython repl for clojure?
11:25antares_treehug: reply is a "more advanced" REPL, leiningen 2 (leiningen.org) uses it
11:27nDuff...which gives you far more capabilities than IPython's -- keystrokes for moving things in and out of blocks, code-structure-sensitive copy/paste, etc.
11:28nDufftreehug: ...personally, I'm using the out-of-the-box configuration from Emacs Live (https://github.com/overtone/emacs-live#readme)
11:30nDufftreehug: ...see the videos linked there to get an idea of what the workflow feels like.
11:30treehugcools thanks
11:32TimMcrussfrank: I was getting the same last night. Lein 1.7.1, Ubuntu Phornicating Phoenix or whatever.
11:33TimMcrussfrank: I only got as far as determining that lein could successfully download from both Maven Central and Clojars and that Clojars had a valid-looking kibit 0.0.4 jar.
11:37naegWow. Clojure's collections and the functions conj, seq, into, empty, etc. just blew my mind. This really make use of dynamic typing. Python seems so inferior in this aspect now
11:37russfrankpython isn't functional ;P
11:37naeg"this aspect" -> dynamica typing :P
11:37russfrankoh, I suppose I see what you're saying
11:38russfrankthat python doesn't really take advantage of dynamic typing by not being functiona l
11:38scriptorrussfrank: it's not really related to being functional
11:38russfrankTimMc: yeah, I noticed the same thing. it seems like when it copies the jar into ~/.lein/plugins/, it screws that up and ends up just creating a 0 byte jar..
11:38scriptorit's about using dynamic typing to have a seq interface
11:38naegI'm not yet sure whether what blew my mind was part of being functional - but if it is, then yes
11:39TimMcPython goes a few steps in that direction with duck-typing, of course.
11:41naegas far as I understood duck-typing, it's just so inferior
11:41naegI just love good abstractions
11:42piranhawell python has protocols and they aren't that bad
11:42piranhalike len(x) calling x.__len__ or x.attr calling x.__getattr__ (or, if attr is a descriptor, attr.__get__)
11:43naegthat's a nice concept too, yeah. but when using them, you're still bound to the type (e.g. whether it's an array or a map) except for len
11:44piranhanaeg: in which case?
11:44piranhanot sure I understood what you mean
11:46piranhaI mean I love conj and friends, but in this case Python isn't that bad. All stuff like 'a in b' or slicing is backed by some protocol (__contains__ and __slice__ in those cases)...
11:46naegpiranha: writing an example for you...(takes some time, still a beginner to clojure :P)
11:46piranhaok sure :)
11:48naegpiranha: http://cljbin.com/paste/5023db70e4b09bebef3e5ff5
11:49naegdepending on what kind of seq (list, hash table, ...) and what you're doing with it, you could have a bad time in Python
11:49naegbecause you would have to check whether you're working with a list or a dic now
11:50piranhanaeg: yes, this case makes sense...
11:50ro_stdnolen: seen this? https://code.google.com/p/leak-finder-for-javascript/
11:51dnolenro_st: no why?
11:51piranhanaeg: well, in type it would be something like type(seq)(x for x in <your code>) :-)
11:51piranhas/in type/in python/
11:51ro_stjust saw it now. thought it might be interesting for clojurescript hackers :)
11:51naegpiranha: that's actually an example from Clojure Programming
11:53ro_stdnolen: also, i wanted to ask you, the sourcemap stuff that's working now, is that from the generated js to the compiled js?
11:53scriptornaeg: if you disregard hash tables, wouldn't the equivalent be straightforward to do with lists, generators, and tuples?
11:54piranhascriptor: it would be even with dictionaries, if code looks like the thing I wrote earlier.
11:54dnolenro_st: yes, which isn't that useful.
11:55ro_stit is to me :-) how do i switch it on?
11:55piranhaalso, it's trivial to make your own type which behaves like a some sort of sequence
11:55naegyeah, but it's even more trivial not doing it at all :P
11:55dnolenro_st: it's only available in the sourcemap branch. Add compiler option :sourcemap true I believe.
11:56pepijndevosHow do you solve the multiple o
11:56naegI'm sure there are better examples in which you would have to do further type checking in Python...
11:56dnolenro_st: and actually you're quite right, it is useful :)
11:56pepijndevos*index problem
11:57piranhanaeg: yeah, that's always the problem with abstract examples, they don't make much sense IMO. :) I think that this is nice property of Clojure but it's not much better than Python here. It's other properties of Clojure which make it better than Python
11:57ro_stdnolen: ah, ok. i've only got the cljs that lein-cljsbuild fetches. i'll figure out how to use the one from that branch in git
11:58naegpiranha: I'll think about a more concrete example (and maybe even write a blog post) later, so I can show it to you can scriptor. Have to conintue learning clj now :P
11:59piranhasure :)
11:59dnolenthere's a good chance I might tackle sourcemap soon, since I'd like to demo that at StrangeLoop
11:59dnolenro_st: we'll see
11:59naegbut made a note, might not come up with it today but it's in my head
12:00ro_stdnolen: awesome. i'm quite happy to spelunk in the :whitespace js if it means i can step through :advanced js.
12:00ro_stnot like i haven't been doing that for a year already, anyway :-)
12:01ro_stdnolen: are you using cljs for anything? or are you just wizarding on it for laughs?
12:02dnolenro_st: heh yeah, I'll try to see if I can't figure out something basic to land in master.
12:02ro_sti'm looking at lein's sample project.clj, i don't see anything in there about using git as a dep
12:03ro_stah, a plugin
12:03dnolenro_st: currently just hacking on the compiler.
12:03dnolenro_st: you can do it without checkouts feature s well.
12:04dnolens/without/with
12:04ro_stand the :sourcemap true can go into the cljsbuild options?
12:04dnolenro_st: yes that should work.
12:06nDuff...that is, translating foo > 3 AND foo < 5 into {:foo [...what goes here?]}
12:07metajack(where (and {:foo [> 3]} {:foo [< 5]}))
12:07metajackthere is a similar exmaples in the docs for korma
12:08nDuff...so at that point I no longer can pass my complete where clause around as a map, but have to pass around the query it's going to be merged into.
12:08nDuffThat's not insurmountable, but a touch annoying.
12:09metajackthe map as where clause is sugar. you can't have duplicate keys in a map, so you can never do multiple constraints on the same field that way
12:10metajackalso, the map is implicit AND, so you can't do OR that way either
12:11metajackif all you need is multi-constraint fields, just pass around the list, or add more sugar to korma
12:11ro_stdnolen: took a quick stab at the checkouts thing. don't i have to specify a path for the sourcemap, or does it infer from output path?
12:11metajackseemd reasonable to support something like {:foo [[> 3] [< 5]]}
12:12metajackor change it to a vector, [:foo [> 3] :foo [< 5]]
12:12nDuffHrm. Right now I have "middleware" for my queries -- removing some clauses and inserting others. Pondering whether I want to keep that workflow and adopt it to work without the sugar, dump it altogether, or extend korma.
12:12metajackif your value field here is integers, you can use in to get around this :)
12:13metajackalso assuming the range is smallish
12:13nDuffThey're integers, but they're several million values apart from each other.
12:13metajackfrom looking at it, i think about extending korma to support a vector syntax instead of or in addition to the map syntax. then you could keep the simpler middleware
12:16dnolenro_st: to be honest I haven't look at it recently, I think it outputs a sourcemap file based on the name of the output file.
12:18nDuffHmm. Can parameters be used with (raw) in korma?
12:19ro_stok, thanks
12:19nDuff...hrm, looks like it only takes a string
13:34dgrnbrghello clojurians
13:35dgrnbrgI have a fascinating performance problem in my clojure code
13:35dgrnbrgin my AOTed namespace, I am seeing a defn take 100s of ms
13:35dgrnbrgi'm not sure what could cause this--perhaps it's causing a cascade of classes to be loaded?
13:36dgrnbrgor maybe there's some name resolution mechanism that needs to run?
13:36dgrnbrgthere's a lot of reflected calls to classes in symbols defined in a let around the defn--perhaps somehow those reflections cause something to happen? (although warn-on-reflection remains silent)
13:39llasramdgrnbrg: If there are reflected calls, why is warn-on-reflection remaining silent...?
13:40hyPiRionhave you set warn-on-reflection to true?
13:41mrb_bkdnolen: ping
13:42mrb_bkCome see #clojure's own dnolen speak at our lovely NYC offices! http://dev.paperlesspost.com/blog/2012/08/08/paperless-post-tec-talks-david-nolen/
13:44hyPiRionduck11232: Where do you live?
13:44duck11232Detroit, MI
13:44hyPiRionAh. At least you're in US of A ;(
13:44TimMcI could take the bus down from Boston, I suppose...
13:45scriptorI could, uhm, walk there
13:45TimMcShow-off. :-P
13:45casion_are there any nifty ways to browse clojure docs, or cheatsheets or whatnot?
13:46scriptor:D
13:46TimMc~cheatsheet
13:46clojurebotCheatsheets with tooltips can be found at http://jafingerhut.github.com/ .
13:46hyPiRioncasion_: lein repl with cdoc and doc
13:46casion_I know of find-doc/doc obv, and browring clojure.org
13:46casion_those dont seem to get me far when I dont know what I"m trying to find heh
13:46scriptorclojuredocs.org is nice, if you haven't check that out yet
13:46AWizzArdIt is really unfortunate that doc now went into clojure.repl. Why was it moved? I think it is nice to have in clojure.core.
13:46casion_hyPiRion: oh there we do
13:46casion_that's great
13:47achenghyPiRion: what is cdoc?
13:47duck11232checkout clojureatlas if you know the type of data you're working with, but not the fn you need
13:47achengcasion_: there is the findfn project ...
13:47hyPiRioncdoc is a function dragging out data from clojuredoc
13:49hyPiRionmaybe even it works here, though it would be spammy.
13:50hyPiRion,(cdoc map)
13:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cdoc in this context, compiling:(NO_SOURCE_PATH:0)>
13:50dgrnbrgllasram: they are calls w/ the ffi syntax (i.e. ".")
13:50dgrnbrgi guess i meant that they are interop calls, whcih may have classloader ramifications
13:53dnolenmrb_bk: pong!
14:03casion_thanks for the suggestions guys
14:04achengi see. cdoc requires cd-client.core
14:05casion_clojureatlas looks super neat
14:08babilenThat reminds me: Do you have any idea when clojuredocs and/or the cheatsheet will be updated for clojure 1.4?
14:21emezeskednolen: Have you had a chance to look at http://dev.clojure.org/jira/browse/CLJS-340 at all ?
14:27hyPiRionbabilen: I suspect when 1.5 comes out.
14:27naegI've got a question about this line of code:
14:27naeg(repeatedly 10 (partial rand-int 50))
14:28naegis partial 'abused' to create a function which takes no arguments in order to supply it to repeatedly?
14:29raekI wouldn't consider it abuse
14:29naegI considered it abuse beacuse the documentation says "Takes a function f and fewer than the normal arguments to f [...]"
14:29S11001001any distastefulness is offset by the coolness of using partial
14:29raekmaybe I would have written (repeatedly 10 #(rand-int 50))
14:29ohpauleezI don't know that I'd use partial
14:29raektrue.
14:29ohpauleezyes, what raek said
14:30ohpauleezS11001001: haha
14:30naegseems more straightforward indeed, wondering why the authors of Programming Clojure did it that way...
14:31S11001001for the time/space tradeoff
14:31naegbut it basically does what I assume?
14:31raekthey're equivalent
14:32S11001001unless you are running very very low on permgen space :)
14:32naeglol
14:32naegthanks all
14:33dnolenemezeske: yes, I posted about it on the clojure-dev ML no responses yet
14:33emezeskednolen: Oh, I didn't see that, I'll look there. Thanks!
14:33dnolenemezeske: mostly trying to gauge opinions around transition.
14:34emezeskednolen: Yeah, it's a big change
14:36augustlwhat's a good way to create a vector of N items where all items have the same value?
14:36augustlwhat I'm actually trying to do: turn [{:id "123abc"} {:id "456def"}] into {"123abc" "on" "456def" "on"}
14:37lynaghkaugustl: try something like (zipmap (keys v) (repeat "on"))
14:37lynaghker, that should be (values v)
14:37dnolenlynaghk: in this case probably want vals.
14:38augustlhmm, repeat
14:38augustlhah, cool
14:42jcromartieis there an idiomatic way to map over a collection for side effects? like (doall (map fn coll)) or (doseq [x coll] (fn x)) but with one call?
14:42achengoff topic: in erc (emacs' irc client) is there a key chord for cycling through previous nicks (vs typing it like "hyPiRion: ")
14:43jcromartiedoall + map strikes me as the wrong way to go since it builds a resulting sequence of nils
14:43casion_acheng: I use hippie-expand
14:43casion_that works quite well for the task (and others)
14:43raekjcromartie: you can use dorun + map instead of doall + map
14:44jcromartiedorun huh
14:44raekbut there is no function that does both the dorun and map parts
14:44jcromartieI see someone saying "be careful when you find yourself doing (dorun (map …))
14:44achengcasion_: nice!
14:44raek(except for 'doseq' of course)
14:44jcromartielooks like doseq is the best
14:46antifuchsda-dorun-run-run da-dorun-run?
14:46emezeskeOne thing I feel compelled to point out is that if your function is just doing side-effects, you're not really "mapping" per se
14:47emezeskeA "map" being a transformation from one list of values to another
14:47jcromartieyeah
14:48jcromartieso doseq is definitely the right way to go
14:48jcromartieno need to just build up a seq of n nils
14:48jcromartiealso, it's worth turning off spellchecking when talking about Clojure
14:48emezeskeIf you really like the syntax of map, you can just (defn doeach [f coll] (doseq [x coll] (fn x)))
14:50casion_jcromartie: or add clojure terms to your dictionary
14:50jcromartieimport all public vars :)
14:50casion_I've done it ;)
14:51casion_along with the c standard library
14:51casion_makes life easier on irc
14:52uvtcjcromartie: if you just need to do something $n times, see `dotimes`
14:52uvtc.
14:53jcromartieuvtc: yeah
14:59mrb_bkdnolen: just wanted to share the invite with you :)
14:59mrb_bklooking forward to it
15:00dnolenmrb_bk: the same!
15:00mrb_bkthrowing down the plastic in case you get jelly everywhere
15:01dnolenmrb_bk: haha
15:02mrb_bkand strangeloop is coming so soon too! exciting
15:02dnolenmrb_bk: yep, I'm really excited about StrangeLoop.
15:11achengoskarth -> xbot -> coffee -> Guest33534 -> oskarth ?
15:12oskarthacheng: oh, sorry. Just testing out nicks and freenode for helping a friend with a irc bot
15:12oskarthso for example "googlebot" was taken, which is what she wanted it to be called in the first place
15:12oskarthcoffee was just showcasing a registered nick
15:13achengoskarth: :) reading about that guy chasing down a ddos in an irc chat room was fun
15:13oskarthacheng: link? haven't seen that one
15:13achengoskarth: was on HN recently. but pretty old...
15:14oskarthah
15:14oskarthreminds me of the guy who started chatting to a trojan creator in the trojan
15:14achengoskarth: http://www.crime-research.org/library/grcdos.pdf
15:15achengmight be the same thing?
15:15oskarthah thanks
15:15oskarthdon't think so
15:15achengoh yeah. i saw that other one too. haha
15:15oskarthhttp://blogs.avg.com/news-threats/chatted-hacker-virus/
15:15oskarththats the one I thought of
15:17achengoskarth: ah i think yours was on HN and mine was in a comment on HN
15:18oskarthah
15:18oskarthinteresting article
15:20daganujoin #java
15:20daganuups!
15:24foodoo(let [a 1 b 2 a 3] (+ a b)); would you consider assigning a value to the same symbol twice as bad style?
15:25S11001001foodoo: no
15:26uvtcfoodoo: I could see assigning multiple times to the same symbol if you're building it up to use inside the body of the `let`.
15:26S11001001foodoo: it helps to avoid a frequent source of errors; commonly, you'll do (fn [a] (let [a' (slight-transform-of-a)] (do-stuff-with-a))), and forget to use a' instead of a because of name similarity. Shadowing prevents that confusion
15:27foodooS11001001: so you argue that because you don't need the old value in the current context, you can just shadow it?
15:28S11001001foodoo: not just can, but in many cases should
15:28foodoofunny. I thought that the bindings in let were more intended for constants. But thanks for clarifying that :)
15:29hiredmanit's not assignment
15:29hiredmanand let bindings are immutable
15:30hiredman,(let [a 1 f (fn [] a) a 2 f2 (fn [] a)] [(f) (f2)])
15:30clojurebot[1 2]
15:30uvtcfoodoo: One thing I learned from listening to the elders in here is that, in a `let`, you're binding symbols directly to values. This is in contrast to what happens when you do `(def x 1)`, where you're making a symbol x refer to a var which then contains the value 1.
15:36foodooI see
15:37XPheriorIs it possible to evaluate a form before passing it to a macro?
15:38nDuffXPherior: What are you trying to accomplish?
15:38achengXPherior: you can operate on read-time stuff while building your return expression
15:39XPheriorHm.. Gimmie a second. I want to phrase this clearly.
15:40XPheriorI'm passing the result of a macro to another macro. The macro that gets a macro is complaining at compile time because it sees the macro, not the expanded form
15:42llasramXPherior: usually you just want the "outer" macro to include any inner forms in its expansion. Then normal macro expansion will recursively expand any macros in the resulting expansion
15:42XPheriorllasram: That's exactly what I want. Isn't that like, the default behavior?\
15:43llasramXPherior: Yes, it is the default behavior. So if that's not what's happening, then you have a bug in your macro :-)
15:44XPheriorHm, alright. I'll poke at it for a while longer and Gist something if I give up.
15:44amalloyno, you two are saying two different things and thinking they're the same
15:44XPheriorThanks guys.
15:44XPherioramalloy: Oh?
15:45amalloyXPherior: the default (indeed only) behavior is for the outer macro to have absolute control over the forms it's passed. some other macro inside can't magically expand first, because that breaks everything
15:47amalloyconsider: (defmacro do-reversed [& body] (cons 'do (reverse body))) (do-reversed (x [x 1] let))
15:47amalloyif x were a macro in scope, it would be incorrect to expand it inside the body of do-reversed, because in the expansion x isn't supposed to be in call position
15:48XPherioramalloy: Ah, I see.
15:48amalloyas an aside, i think my implementation of do-reversed is totally broken, but you get the idea
15:48XPheriorYeah, I do
15:48XPheriorSo what is the solution to this type of problem?
15:48amalloyusually it's to realize that it's not a problem and you're doing something else conceptually wrong
15:50XPheriorHaha. Alright, I will rethink my approach.
15:50achengthis is why nDuff asked what you're trying to accomplish instead of attempting to answer the question
15:50XPherioracheng: Yeah, that's fair.
15:50mkwhat's the right way to conceive of if? Does it perform a common-in-clojure type conversion? Does it just check = false or = nil, and don't worry about truth?
15:50acheng(whereas i just jumped in :-P)
15:50XPheriorLong day at work. Think I just need to step away from it
15:51amalloymk: it checks = false or = nil, and that's exactly what truth is defined to be, so i do'nt understand "don't worry about truth"
15:52mkamalloy: that's often been called "truthiness" rather than truth
15:52amalloyokay, so?
15:54XPheriorIt's not as complicated in our little land. :)
15:56emezeske,(map true? [true false nil])
15:56clojurebot(true false false)
15:56emezeske,(map true? [true 42 false nil])
15:56clojurebot(true false false false)
15:56mkwell, in different languages ifs behave differently. In some low level languages, if operates on numbers. In Java it operates on truth only. In javascript, type conversion is performed, and you can cast various objects into either true or false
15:56joly,(map #(if % true false) [true false nil])
15:56clojurebot(true false false)
15:56amalloy(= #(if % true false) boolean)
15:56mk,(map boolean [true false nil [] 1])
15:56clojurebot(true false false true true)
15:56nDuffHmm.
15:56uvtc,(map #(if % true false) [true 42 [] '() false nil])
15:56clojurebot(true true true true false ...)
15:57S11001001,(boolean (Boolean. false))
15:57clojurebotfalse
15:57nDuffShame korma.sql.engine/predicates isn't dynamic -- it would be awfully nice to be able to rebind it to add custom predicates
15:57jolyamalloy: cool, hadn't realized that
15:57S11001001,(if (Boolean. false) true false)
15:57clojurebottrue
15:57S11001001:]
15:57dnolenfoodoo: that said, wise to not get too crazy w/ that - I've run into trouble with it before.
16:02amalloyhah. i forgot about that, S11001001. good counterattack: "what you said is true, unless the user is a madman who constructs Booleans"
16:02S11001001curse of serialization
16:02mkI guess the code I just tried shows that if is intimately tied to boolean casting... maybe there are other things of note? (I think boolean casting is pretty terrible. Casting doesn't make sense unless it's reflexive...)
16:02amalloyS11001001: how is that relevant?
16:02foodoodnolen: Sure. Always strive for clarity
16:02Raynesamalloy: Because Java's serialization stuff reads back in boolean objects that are blown to crap in Clojure, I think.
16:02amalloytrue enough
16:02S11001001,(let [bs (java.io.ByteArrayOutputStream.) os (java.io.ObjectOutputStream. bs)] (.writeObject os [false]) (.flush os) (if (first (.readObject (java.io.ObjectInputStream. bs))) 1 2))
16:02clojurebot#<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0)>
16:02S11001001yeah, something like that
16:02S11001001=> 1
16:02S11001001,(let [bs (java.io.ByteArrayOutputStream.) os (java.io.ObjectOutputStream. bs)] (.writeObject os [false]) (.flush os) (if (first (.readObject (java.io.ObjectInputStream. (java.io.ByteArrayInputStream. (.toByteArray bs))))) 1 2))
16:02clojurebot#<CompilerException java.lang.NoClassDefFoundError: Could not initialize class java.io.ObjectOutputStream, compiling:(NO_SOURCE_PATH:0)>
16:02S11001001ugh
16:03mkwhere else besides (if) and (boolean) does this sort of casting occur?
16:03mkwhen-let?
16:03amalloymk: nowhere. it occurs only in if
16:04S11001001,(filter identity [(Boolean. false)])
16:04clojurebot(false)
16:04S11001001if has a lot of transitive implications :)
16:04amalloyS11001001: that's the joke, so to speak
16:04S11001001amalloy: ah, I see what you're doing now
16:04amalloyjust don't call functions that depend on 'if, if you're bothered by clojure's truthiness
16:05mkamalloy: is if defined in terms of boolean, or is boolean defined in terms of if?
16:05gtrak,(source or)
16:05clojurebotSource not found
16:05gtrak&(source or)
16:05lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
16:05amalloy~def or
16:05Raynes$source or
16:05lazybotor is http://is.gd/Z6BNy8
16:06gtrakboth of them are out of date :-)
16:06RaynesPatches welcome.
16:06gtrakhttps://github.com/clojure/clojure/blob/1.2.x/src/clj/clojure/core.clj#L663
16:06Raynes(for lazybot, not clojurebot)
16:06Raynes(screw clojurebot)
16:06Raynes(:P)
16:07RaynesI think...
16:07Raynes$cd clojure.core/or
16:07mklooks like both if and boolean are probably defined in terms of RT/booleanCast
16:08Raynes$cd clojure.core or
16:08lazybotclojure.core/sorted-map: http://clojuredocs.org/v/1494
16:08lazybotclojure.core/keyword?: http://clojuredocs.org/v/1497
16:08lazybotclojure.core/vector-of: http://clojuredocs.org/v/1503
16:08RaynesHey, it's only completely wrong.
16:08scriptorhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L791
16:10uvtcRaynes: could be worse.
16:14mabesI need to prepend a single element onto a lazy-seq, is there a better way than using concat?
16:14foodoomabes: cons?
16:15S11001001mabes: as foodoo says, cons is the standard way to do that
16:15mabesfoodoo: hrmm.. I thought I had tried that and it forced evaluation.. you are right though, cons is what I'm looking for
16:16S11001001conj will force
16:16amalloyS11001001: really?
16:17amalloy&(do (conj (map print (range 10)) 0) nil)
16:17lazybot⇒ 0123456789nil
16:17amalloy&(do (cons 0 (map print (range 10))) nil)
16:17lazybot⇒ nil
16:18amalloyS11001001: do you have a simple explanation for why that is?
16:20amalloyhm. apparently LazySeq.cons calls RT.cons(x, seq()) rather than RT.cons(x, this). i assume there's a reason, but it seems like a non-obvious choice
16:20scriptoramalloy: looks like it calls seq() inside LazySeq's cons
16:21scriptoryep
16:21mkI wouldn't bother with conj anyway. It's not even a real function
16:21amalloywat
16:21mk,(= (conj '(1) 2) (conj [1] 2))
16:21clojurebotfalse
16:22mk,(= (1) [1])
16:22clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
16:22amalloymk: that is the most ludicrous evidence for "not even a real function" that you could have produced
16:22mk,(= '(1) [1])
16:22clojurebottrue
16:22mknot referentially transparent
16:22amalloycompletely untrue, and basically irrelevant if it were true
16:23emezeskeIt's definitely referentially transparent. Note that '(1) is actually not the same argument as [1].
16:23gtrakmk: it depends on its arguments, how is that not referentially transparent?
16:23mkproof above. The same values (1) and [1] go in, different values come out (true, false)
16:23gtraka list and a vector are different values
16:23emezeske'(1) and [1] are emphatically not the same values.
16:24mkemphatically they are
16:24scriptorno
16:24scriptor= checks for contents in seqs
16:24hiredman= divides things in to "equality partitions"
16:24hiredmanlists and vectors are in the "sequential" partition
16:26mkscriptor: I'm not sure why that's not just an implementation detail that you're describing
16:26TimMcclojurebot: equality partition is http://www.brainonfire.net/files/seqs-and-colls/main.html#tbl-eqpart
16:26clojurebotOk.
16:26dnolenmk: you seem to like saying things which make no sense.
16:26mkTimMc: thanks
16:27TimMc(and patches welcome...)
16:27gtrakis a set #{1} and a vector [1] the same value for some definition of value?
16:29Chousukethey are the same when treated as a sequence
16:29Chousukebut that is purely because the set has only one item
16:29mkdnolen: yes, and the things that others say sound silly to me as well. That sort of thing is usually due to a misunderstanding that tends to be cleared up in channels like these...
16:29emezeske(dec mk)
16:29lazybot⇒ -1
16:29gtrakChousuke: that's running through a seq function first, no?
16:29hiredmanlook, I dunno why you all are still talking to him
16:30scriptormk: conj behaves differently according to the sequence's type, = checks the contents of the sequence, regardless of the type
16:30Chousukegtrak: yes
16:30scriptorhiredman: good point
16:30hiredmanscriptor: that is not true
16:30gtrakmk: you could be clearer at identifying what are your own assumptions
16:31hyPiRion##(doc =) explains how = works.
16:31lazybot⇒ "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus... https://www.refheap.com/paste/4211
16:31hiredmanscriptor: vectors are not sequences, so conj behaving differently for vectors is not conj behaving differently for different sequences
16:31gtrakmk: just saying X is so because it is doesn't cut it
16:31hyPiRion,(= 1.0 1)
16:31clojurebotfalse
16:32hyPiRionoh, they need to update the docs again.
16:32mkgtrak: sets and vectors are different. Vectors and lists are the same. Under Java's definition of equality, a linkedlist is equal to an arraylist that contains the same items.
16:32scriptorhiredman: right, sorry, collection maybe?
16:32Chousukemk: it's not really meaningful to compare sets and vectors for equality
16:32Chousukesince sets have no order.
16:33mkChousuke: exactly
16:33mkit does make sense though. You just return false, just like you do when comparing 1 to :hello
16:33gtrakmk: I would say any semantics bound to the type of the value are part of the value-ness of it
16:33Chousukewell yeah.
16:33mkemezeske: what was the dec for?
16:34Chousukebut then, comparing lists and vectors does make sense because their structure is essentially the same. plus, it's useful
16:34dnolen,(subvec '(1 2 3) 1)
16:34clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentVector>
16:34dnolenmk: so why doesn't this work ^
16:34gtrakclojure makes an equality partition choice to group them together because it's useful, you could easily do something else if you wish
16:35mebaran151Hey #clojure, I'm having a weird deps problem: Failed to collect dependencies for clojure.lang.LazySeq; was working this morning and haven't touched my project.clj file. Any idea how to start to debug?
16:35mkChousuke: yes, I agree. This is why (= '(1) [1])
16:35gtrakthat's a semantic on the = function
16:35technomancymebaran151: try upgrading leiningen; recent versions will give a more helpful error
16:35TimMcWorst type signature I've seen all week: List<P3<String, Integer, List<List<List<String>>>>>
16:35mebaran151technomancy: what's a good version to self-install?
16:35TimMcmebaran151: lein update
16:36konrYeah, got a job in a company that uses clojure :D
16:36mebaran151TimMc: on windows
16:36technomancymebaran151: preview7
16:36TimMclein upgrade*
16:36Chousukemk: oh and if you're saying = is not referentially transparent because (conj '(1) 2) is not the same as (conj [1] 2) then you're just not making sense :P
16:36TimMcWhat happens on Windows?
16:36mkdnolen: it's probably explicitly a function for converting between representations of the same value
16:36mebaran151TimMc: unsupported operation for us windows users :(
16:36TimMcOuch.
16:37gtrakrepresentations of values are themselves values
16:37mkChousuke: no, conj isn't
16:37TimMcmk: I think what you mean is that conj does not preserve =.
16:37emezeskemk: So, by your definition, is this function referentially transparent or not: vector?
16:37Chousukemk: sure it is
16:37emezeske,(vector? [1])
16:37clojurebottrue
16:37Chousukemk: give an example where it isn't :)
16:37emezeske,(vector? '(1))
16:37clojurebotfalse
16:37TimMcmk: Referential transparency... you keep using that phrase. I do not think it means what you think it means.
16:37mk,(= (conj '(1) 2) (conj [1] 2))
16:37clojurebotfalse
16:37dnolenmk: anyways if you continue along these lines people will just ignore you as I am feeling inclined to do.
16:38Chousukemk: so? that does not violate referential transparency
16:38RaynesI'm surprised this conversation is still happening.
16:38Chousukeyou're not giving the same arguments to conj
16:38TimMcmk: Seriously, Go look it up. You have the wrong term.
16:38aperiodicmk: 'referential transparency' is not defined in terms of 'things that look the same to ='
16:39mebaran151technomancy: the error message did get better, but it can't seem to find anything now, even org.clojure/clojure 01.3.0
16:39Chousuke,(= (conj [1] 2) (conj [1] 2)) you can call this as many times as you want and it will return true.
16:39clojurebottrue
16:39Chousukeunless your hardware is falling apart
16:39RaynesI always get confused about people who are like "They're all wrong. It's amazing how much smarter than them that I am."
16:39mkTimMc: if the same values go in, the same values come out. Suppose I evaluate (conj [1] 2) and attempt to cache the result for instances of (conj '(1) 2). This fails.
16:39scriptormk: just because = returns true for two different values does not necessarily mean either value can be substituted for the other
16:40scriptor= does not mean 'the same'
16:40scriptorin the sense that you're assuming it does
16:40Chousukemk: '(1) is not the same value as [1]
16:40mkdo vectors and lists both implement the List interface?
16:40gtrak= is a function like anything else, it could be called in-the-same-equality-partition, it's semantics don't affect what semantics conj should have, because conj does not call =
16:41amalloythat's actually an interesting point, though: ##(let [conj (memoize conj)] [(conj [1] 2) (conj '(1) 2)])
16:41lazybot⇒ [[1 2] [1 2]]
16:41Chousukemk: no.
16:41Chousukemk: vectors don't
16:41TimMcmk: Does clojure.core/class violate this thing you are calling rt?
16:41gtrakamalloy: aha!
16:42gtrakbecause memoize uses =, it binds the semantics, then it starts to matter
16:42Chousukeamalloy: that means memoize breaks referential transparency :/ huh
16:42Chousukebecause it uses mk's version of it, I guess :P
16:42scriptorwell, shit
16:43technomancymebaran151: typo?
16:43Chousukeor in short, memoize seems to have a bug :P
16:43mebaran151it says it can't find anything actually
16:43TimMckonr: Cool! Where?
16:43mebaran151I'm wondering if my .m2 got corrupted somehow
16:43Chousukea rather silly one but nonetheless a bug
16:44konrTimMc: Brazil! A business intelligence startup
16:44gtrakthe bug is the fact that the thing returned is different depending on what's called first
16:44amalloyChousuke: that can't be a bug in memoize; it has to be a "bug" in either =, or how maps work
16:44amalloyor how conj works, i suppose
16:44mkTimMc: they probably do violate rt, but that's fine, because they deal with things at a different level of value-equivalence. This is a bit like the difference between java's == and .equals
16:45TimMc&({[] 3} ())
16:45lazybot⇒ 3
16:45Chousukem
16:45ChousukeI guess that's useful behaviour
16:45amalloyTimMc was just looking for an excuse to type ({[
16:45mebaran151technomancy: let me make a paste: what's the best one for clojure?
16:45mkperhaps the bug isn't in memoize, but in conj like I've been suggesting
16:45TimMc'strue
16:45Chousukeconj does what it's supposed to do.
16:46TimMcmebaran151: refheap!
16:46Chousukeit's just that maps use = semantics
16:46nDuffibdknox: Around? I'm trying to come up with a suitable patch for https://github.com/ibdknox/Korma/issues/82, but having some trouble.
16:46Chousukenow that I think about it
16:46amalloymy opinion is there's not a bug anywhere, just some unfortunate consequences of design decisions that are useful in most cases
16:46Chousukeso memoize inherits that, and you get this weirdness. But I think the solution is worse than the problem.
16:46TimMc(with-equality-semantics identical? ({[] 3} ())) => nil
16:46mebaran151https://www.refheap.com/paste/4212 << here is my paste, I don't see any typos at first blush
16:47amalloyTimMc: identical? is totally nuts anyway
16:47emezeske,(let [vector? (memoize vector?)] [(vector? [1]) (vector? '(1))])
16:47clojurebot[true true]
16:47emezeskeI guess it's important to be careful with memoize
16:47TimMcemezeske: lulz
16:48ChousukeTimMc: but then you wouldn't even be able to do ({[1] 5} (vector 1)) with that.
16:48TimMcToo bad! identical? is the standard equality predicate.
16:49Chousukeso it'd be (with-equality-semantics sometimes-cares-about-type ...)
16:49mebaran151the local salesforce and local echosign libraries aren't problematic; commenting them out it still isn't working...
16:49mkamalloy: sure, I probably agree. But I think the right way to describe the design decision is to say that conj was made not rt
16:50Chousukebecause of course you wouldn't want (seq '(1 2 3)) and (seq [1 2 3]) to be considered different
16:50emezeskemk: If conj is not RT, then neither is vector? and that just doesn't make sense to me
16:50Chousukewhich they would be if it were type strict :P
16:50gtrak,(conj (seq [1 2 3]) 3)
16:50clojurebot(3 1 2 3)
16:51Chousukemk: conj is again not problematic at all. it returns the same values for everything you pass to it.
16:51Chousukethe problem is memoize's implementation
16:51Chousukethe function it returns is not RT
16:52Chousukein some theoretical cases :P
16:52TimMcSo hey, how about that one sports team?
16:52TimMcI hear they scored so many points!
16:52technomancyThe sports team from my area is superior to the sports team from your area.
16:52emezeskeTimMc: My local sporting team is better, because their HQ is near me
16:52technomancyIt is a demonstrable fact.
16:53emezesketechnomancy: If your sporting team fought my sporting team, would there be a tear in the fabric of space time?
16:54Chousukemaybe they are the same team
16:54gtrakwoohoo, score a goal unit
16:54Chousukethat would solve the conflict
16:54emezeskeWhoa... very zen
16:55TimMcChousuke: My equality predicate for sports teams is (constantly true).
16:55Chousukeone team to rule them all huh
16:55Chousukemust be boring, with no-one to play against
16:56mebaran151technomancy: so deleting my .m2, it redownloads all the artifacts correctly, but then says it failed to find them. Any ideas why?
16:56Chousukeor maybe you have many teams, and they all win every game
16:56Chousukeor you can't tell the difference anyway
16:56S11001001I use cons more than conj, but I use into more than either
16:57scriptorthey tore a hole in spacetime and are playing a version of themselves form one planck time in the future
16:59technomancymebaran151: it's specifically complaining about org.clojure/clojure "1.3.0"?
16:59mebaran151all of them :/
17:00technomancyif it's all of them then it's probably a connectivity issue
17:00clojurebotev4l, I think your issue is that you didn?t include the [] for the arguments to your method.
17:00technomancymaybe you need to specify a proxy or something
17:01technomancyrlb: hey, any further word on emacs in wheezy?
17:02mebaran1`technomancy: no proxies that I know of
17:03mebaran1`if you run lein deps on my project.clj, does it work for you? (excepting teamlazer.beez, a jar installed in my local repo, which I have commented out but to no avail)
17:13mkemezeske: vector? isn't referentially transparent over values proper for roughly the same reason java's == isn't rt. In java equivalent linkedlists and arraylists are the precisely same value. That doesn't mean that instanceof or == are broken.
17:14RaynesOh God, no more. No more!
17:14technomancyo_O
17:16hyPiRionOh, we've just started.
17:19pjthomasanyone here play with overtone at all?
17:19aperiodicmk: you define RT in terms of =, everyone else defines it in terms of type & =, and as long as nobody changes their definitions, you'll call some things non-RT which everyone else calls RT. if you want to change people's minds, present an argument as to why referential transparency should disregard type, instead of just saying 'x is not RT' over and over.
17:20mattmossI don't know what I just read. o_O
17:21scriptordon't worry too much about it
17:21achenga set is not ordered, but once a set exists, will it always get mapped/seq'd over in a repeatable order?
17:22achengor is that a bad thing to rely on?
17:22jkkrameracheng: bad
17:22achengok
17:22hyPiRion,(let [id (memoize identity)] (id (java.util.ArrayList.)) (id []))
17:22clojurebot#<ArrayList []>
17:22hyPiRionoh, the joy.
17:22achengmaybe i should avoid situations where the response is acheng: bad
17:23jkkramer:)
17:23hyPiRionacheng: sorted-set
17:23amalloyi don't think that's a bad thing to rely on
17:23mkaperiodic: it doesn't disregard type. It wouldn't make sense to do so because every value has only a single type. I've tried to explain the distinction with reference to java's different implementations of lists. Whether it's linked or array, equivalent lists are value-equal.
17:24achenghyPiRion: thanks
17:24achengamalloy: please say more
17:25dnolen acheng: can you be more specific, *how* were you planning on relying it?
17:25aperiodicmk: if 'every value has only a single type', then how is ##(= [1] '(1))? what is your definition of type?
17:25lazybot⇒ true
17:26hyPiRionacheng: On second though, it may not be exactly what you want: ##(sorted-set 2 6 4 -2 0)
17:26lazybot⇒ #{-2 0 2 4 6}
17:26hiredman~troll
17:26clojurebotaccording to troll lore living beings move backwards through time
17:26achengwhile using map with a fn that takes multiple arguments, it just so happens that the last two arguments could be a particular set ... i was wondering if i could put it in there as a set twice
17:27achengmight as well use sorted set and be done with it
17:27hyPiRionacheng: wait a second.
17:27mkaperiodic: yeah, [] and () are the same type. You know how you can have the same string value residing in different places in memory? Well, sometimes, the same value can be implemented in different classes (again, the various list implementations). We bother with different classes because the classes offer different performance characteristics.
17:28hyPiRionacheng: https://github.com/flatland/ordered is what you want
17:28aperiodicmk: ok, change 'type & =' in my really long respone up there to 'class & ='
17:28achenghyPiRion: ok will check it out
17:30mkaperiodic: "everyone" excludes the java language spec for lists
17:31hyPiRionWell, that was a surprise: ##(= (class '(1)) (class ()))
17:31lazybot⇒ false
17:31achenghyPiRion: oh, i don't care about maintaining a particular order that isn't sorted... i just want to map an fn over the members of a set -- i want the same member of the set to be used for arg1 and arg2 of fn
17:32mebaran151technomancy: after a lot of thwacking, I've found the two packages making problems are noir-cljs and fetch: any idea about a workaround?
17:32acheng(gotta take off)
17:32TimMcacheng: I believe the order for an instance is deterministic, yes -- just like vals and keys on a map give the same arbitrary ordering.
17:32hyPiRionacheng: Oh, then I misunderstood completely. Sorry. If it is exactly the same map, you could assume that the operations on it are deterministic.
17:32achengok
17:33achengTimMc: does this just happen to be the case, or is it part of the spec (can it be relied on)?
17:33technomancymebaran151: I thought noir-cljs was replaced by something else
17:33technomancyisn't that just a template for new apps?
17:33mkif the sets to list thing seems weird, just pretend that you're generating a list using (sort-set-by-hash the-set)
17:34mebaran151technomancy: it adds some middleware to automate clojurescript compiling
17:34technomancyok, must be thinking of something else
17:34technomancyyou could browse the clojars repo to see what versions are available
17:35mkobviously sets don't define a "first element", but you can produce a list by sorting a set
17:35achengI might as well use sorted set and then i don't have to wonder
17:35mebaran151so it looks like some strange dependency issue, I bet on conflicting versions of the apache libraries
17:35hyPiRionacheng: I don't believe it is part of the spec, but it would make sense to believe that the iteration over the same set isn't random ;)
17:35mebaran151I'm wondering why it broke today though....
17:36hyPiRioncouldn't you just use the same element twice though?
17:36hyPiRionAs in (map #(vector % %) #{1 2}) instead of (map vector #{1 2} #{1 2}).
17:37TimMcacheng: Not part of any spec I've seen, but if core changed it, they'd get lynched.
17:37TimMcI believe it is very common to rely on that behavior.
17:38S11001001it's definitely safe to rely on the order of (seq some-set) being repeatable, for a given seq call
17:38S11001001so if you assume something about the seq function...
17:39mebaran151I think it might be a conflict between commons codec 1.5 and 1.6; anyway to tell lein to just use 1.6 and be done with it?
17:39technomancymebaran151: some noir stuff uses version ranges, which can break at unpredictable times when new versions are released
17:39technomancymebaran151: add a top-level dependency on the version you want and an :exclusions entry under noir
17:39technomancysee `lein help sample`
17:39mkS11001001: will two values always appear in the same order every time seq is called on any set?
17:40S11001001probably
17:41madsyIf you couldn't depend on the order of seqs, I don't see how it would be useful
17:41mkseqs sort sets using hashcode, right?
17:41madsySince every container is seqable
17:41madsyAnd the clojure libraries depends on it so much
17:41hiredmana seq is just an iterator
17:42madsyhiredman: Right, but would it make sense that the order depended on the underlying container?
17:42mkmadsy: the problem is that sets by definition don't define order. But you can get order out of a set by sorting its elements using some property p (which in clojure might be hashcode)
17:43hiredmanmadsy: sure, and IPersistentSet is an interface, so anything can be a "set"
17:43hiredmanhttp://docs.oracle.com/javase/1.5.0/docs/api/java/util/Set.html#iterator%28%29 similar issue
17:43mebaran151technomancy: so it looks like I
17:43madsyhiredman: Yeah. I don't see how that would be useful. Since seq is used so much.
17:44madsySuddenly you have a seq you don't know if is a vector or a set
17:44mebaran151(sorry, enter fail) narrowed it down to noir-cljs, but the general error message is that it just can't load the dependency
17:44mkmadsy: it probably does, but you don't need to make it depend on the container
17:44mebaran151seems like within the package there are mutually conflicting deps
17:44hiredmanmadsy: a seq is a seq, it is not a vector or a set
17:44hiredmanmadsy: and a given seq is immutable and is always the same
17:45madsyyep
17:45hiredmanmadsy: but there why should calling seq on a set multiple times always return the same seq?
17:45technomancymebaran151: usually with the right :exclusions you can make it work
17:46mk,(= (seq [1 2 3]) [1 2 3] '(1 2 3))
17:46clojurebottrue
17:46hyPiRionmk: two values will NOT neccesarily appear in same order
17:47madsyhiredman: I wouldn't focus on sets, but that the behavior was consistent no matter what the seq refers to.
17:47mkhyPiRion: that's no good. Why is that?
17:47hyPiRion,(= (into #{} (range -10 10)) (into #{} (range 9 -11 -1)))
17:47clojurebottrue
17:47hiredmanthe equality comparison for sets done in c.l.APS doesn't depend on order, it iterates over one of the set's elements and checks if the other set contains each
17:47hyPiRionmk: bucket increase/resizing probably
17:48hyPiRion,(into #{} (range -10 10))
17:48clojurebot#{-1 0 -2 1 -3 ...}
17:48hyPiRionmeh.
17:48hyPiRion,(prn (into #{} (range -10 10)))
17:48clojurebot#{-1 0 -2 1 -3 ...}
17:48mebaran151technomancy: any way to hint it to tell me what to exclude: I'm not having much luck :/
17:48hyPiRionOkay, anyway, try printing out (into #{} (range -10 10)) and (into #{} (range 9 -11 -1)) - they contain the same result, but not in the same order
17:49mkif you want to use sets safely, just turn the set into a list using a sort
17:49hiredmanmadsy: what makes you think I am focused on sets?
17:50hiredmanseqs for vectors and lists will always be in that order because the colelction is ordered
17:50mebaran151it looks as noir-cljs itself no longer can be pulled down by lein
17:50mebaran151hmpppph
17:51mebaran151as I built this whole app on noir and cljs, I am now in a bit of a pickle...
17:51hiredmanmebaran151: I would recommend not using anything with "noir" in the name
17:51hiredmannoir tends to be broken and busted and side effecty and just bad
17:52mebaran151it looked like the best documented web framework at the time, and seemed to go well with jquery jayq
17:52hiredman:/
17:52mkwhat's the replacement?
17:53emezeskeNoir is just a thin layer on top of compojure
17:53hiredmanemezeske: nah
17:53hiredmanemezeske: noir is full of sideffecting add-middleware calls, and the versions never work, and etc
17:53emezeskehiredman: I am talking about noir proper, and that's definitely what it is
17:54hiredmanemezeske: noir is junk
17:54emezeskeIt *is* just a thin layer on top of compojure. Anyway, my point was that the "replacement" is just using compojure.
17:54hiredmancompojure+lein-ring
17:54emezeskeYes.
17:54mkthen why have noir to begin with?
17:55PeregrineBecause the author wrote it
17:55mebaran151I suppose I could knowck down to compojure, as I do most of my templating in plain ol' hiccup functions
17:55Peregrineand posted it
17:55mkhiredman: I see
17:55gtrakit does all the session cookie stuff?
17:55PeregrineWe don't have the ability to stop someone from posting stuff.
17:55mebaran151the biggest things I'd have to work around is teh clojurescript stack, which seemed to work most effectively
17:55mkPeregrine: not yet, huh?
17:55hiredmanemezeske: noir is a thin layer on compojure, and hiccup, and etc
17:56emezeskehiredman: Well that's true. I guess my emphasis was just on the "thin" part, e.g. it's easy to just not use it
17:56mebaran151since noir was a thin layer on top of compojure, I figured it couldn't mess with too many things...
17:56mebaran151but now I am in dependency hell
17:57hiredmanyeah, because noir is junk, with a nice website
17:57pandeiroi think noir is/was a good stab at removing some boilerplate but i do find most of my web programming falling into some of its cracks
17:57Peregrinemk, we could ask github to require hiredman to review clojure libs before they're posted.
17:57pandeiromebaran151: i think you can resolve it w/o too much problem
17:57PeregrineI don't think it would work so well.
17:57emezeskemebaran151: Have you tried lein-cljsbuild? I think it might take care of the cljs stuff for you
17:57technomancyPeregrine: bring popcorn
17:58mebaran151emezeske: yeah I've tried it, but it throws random NPE's
17:58mefisto`a bit of cannibalism going on here it seems
17:58emezeskemebaran151: I see. That is not typical; did you try creating an issue on github?
17:58mebaran151I was actually planning on sending some bug reports your way, but was limping along with noir cljs
17:59hiredmansomeone told me the first time they paired with my at work I just sort of walked through the code base at work going "this is bad, this is crap, ughh, why?" which I have no memory of
17:59emezeskemebaran151: A simple stack trace would be a good start
18:00mebaran151until I had time to try to track it down
18:00hiredmanlein-cljsbuild works
18:00mebaran151Clojure on windows always seems to have its "interesting" moments
18:00emezeskeOH
18:00hiredmanmebaran151: did you configure it in project.clj? you don't just add the dependency you need to configure options in there
18:00emezeskeYou didn't mention the "Windows" part
18:01emezeskeHaha, yeah, I am not going to track down any Windows bugs
18:01emezeskeIf someone else does, though, that's cool
18:01mebaran151once I get my build running again, I'd be more than happy to help, though usually I find Windows bugs need my own TLC
18:01technomancyhiredman: I can totally picture that scene
18:02technomancyeven though I don't think it was with me
18:02amalloyhiredman: really, noir is a thin layer? it seems like if it manages to do so many things that infuriate you (not wrongly, imo) it's a fairly bulky layer
18:02mebaran151to be honest, Clojure dependency hell can't be any worse than Haskell dependency hell
18:03mebaran151amalloy: noir doesn't seem very heavy weight to me; had a couple of nice utility functions and good clojurescript support when I chose it
18:03mebaran151but right now it's magically breaking my build
18:03jsabeaudryI'm trying to writeShort with a RandomAccessFile (in a with-open scope) and somehow the short does not get written and no exception is thrown ?!
18:03mebaran151which is sad, because I was close to releasing this nice piece of software (after writing my own salesforce wrapper too...)
18:03hiredmanjsabeaudry: pastebin?
18:04amalloysounds like probably missing a flush or close or something
18:04hiredmanmy guess is written in a lazy seq that isn't forced
18:04hiredmanamalloy: he did say it is in a with-open
18:05amalloyokay, i'm changing my mind to your guess
18:05mebaran151the noir deps don't seem to insane btw, except that lein is choking on them
18:06emezeskemebaran151: I used noir originally for my app, and when I went about dropping it in favor of just compojure, hiccup, etc, it took probably a few hours to get rid of it
18:06mebaran151the thing is I use his jquery wrapper pretty extensively
18:06emezeskemebaran151: It wasn't a lot of work, mostly it was learning good things about compojure that noir hid from me
18:06technomancynoir uses version ranges; they are known to be problematic
18:06emezeskemebaran151: You can use jayq without noir...
18:06mebaran151let me try
18:06mebaran151then I'll have to debug cljsbuild, which I suppose I should do anyway
18:07mebaran151(I haven't had a cljs repl for really long time...)
18:07emezeskeI've had various reports of people having it work or not work under Windows
18:07emezeskeI don't know what the state is these days
18:08emezeskeI haven't had a "doesn't work under windows" report in a while, if that means anything
18:08jsabeaudryhiredman, http://pastebin.com/cAQ4GkAe
18:08mebaran151the only thing that would be a little pesky is that I used the "fetch" library, which implicitly makes noir routes
18:08emezeskemebaran151: Heh, I used fetch too
18:08emezeskemebaran151: That was most of the work for me
18:09jsabeaudryhiredman, all the println do happen
18:09mebaran151emezeske: fetch was pretty nice
18:09technomancyemezeske: are some of those issues trampoline problems?
18:09emezesketechnomancy: Maybe, I don't remember, it's been a while :(
18:09mebaran151trampoline I think is doing weird things on Windows
18:09mebaran151I've been meaning to reinvestigate
18:09Raynestechnomancy: Whoa, what?
18:10emezeskemebaran151: Fetch has basically the same problems as noir, because it depends on noir
18:10Raynestechnomancy: Noir uses version ranges? Where?
18:10emezeskemebaran151: If you want to modify the routes it creates, it's kind of a pain
18:10mebaran151emezeske: exactly
18:10hiredmanjsabeaudry: try writing it to a regular file
18:10emezeskemebaran151: I ended up making my own "fetch" library which I like a lot better
18:10technomancyRaynes: I think it might not in git, but someone said the stable release did
18:10emezeskemebaran151: Unfortunately it's pretty tied into my app logic atm so no open-sauce :(
18:10technomancyRaynes: it triggered a bunch of issues when central dropped their clojure artifacts
18:11hiredmanjsabeaudry: my guess is randomaccessfile doesn't work on /proc/fpga/file for whatever reason, but I've never tries so I dunno
18:11jsabeaudryhiredman, alright, will try that, but I can write fine to that character device using dd bs=2 seek=30...
18:11emezeskemebaran151: Do you do auth in your app?
18:11jsabeaudryhiredman, the read works
18:11hiredman*shrug*
18:12mebaran151emezeske: not exactly
18:12Raynestechnomancy: Apparently it used a version range in 1.2.2.
18:12mebaran151all the auth is handled by my salesforce bindings
18:12Raynestechnomancy: It does not anymore and never will again.
18:12mebaran151all the perm stuff lives in salesforce and the management side is salesforce side too
18:12emezeskeAh, gotcha, I was just going to mention auth pains in noir, nevermind though
18:13mebaran151Salesforce is nifty for that sort of thing, gives me user management for free
18:13mebaran151I was porting a hacked together Rails app for this project
18:14mebaran151I'd also love a general way to disable colorize
18:14emezeskemebaran151: colorize?
18:14mebaran151makes color ascii codes in clojure, or random trash in Windows :)
18:15emezeskeOh, heh, sometimes I will "... | grep --color=never ." to get rid of color, under linux. Super ugly hack :)
18:16mebaran151I think fetch is abandonware :/
18:16emezeskePretty much all of ibdknox' stuff is gathering dust right now, I think -- he's working on Light Table
18:17amalloyemezeske: you can also | grep ... | cat, since it won't color if output isn't a tty
18:17emezeskeamalloy: Nice, that's easier to type!
18:18amalloybut why do you want to disable color sometimes? i can understand wanting it off always if you hate colors, but sometimes?
18:18emezeskeIt's a silly story, having to do with the way colors are displayed on a particular machine of mine
18:18jsabeaudryhiredman, thanks, It does work on a regular file. I guess I'll ask around linux to try to spy on the kind of calls java makes on the OS.
18:18S11001001I like it when a program unconditionally writes color codes, so when I'm in emacs shell I get funny bits all over my buffer
18:19S11001001or in a file I >ed to
18:20jsabeaudryI gotta say, I'm very far from loving java, even after a year of clojure
18:20S11001001status spinners and bars are also neat. blahblah 0%^Mblahblah 1%^Mblahblah 1.5%^M...
18:20amalloyjsabeaudry: you thought java would teach you to love java?
18:20amalloyer, clojure would
18:21arrdemamalloy: let's give Java credit for giving birth to the JVM and pretend the rest never happened
18:22amalloywell, the jvm would still suck if people hadn't liked java
18:25mebaran151I'm not such a huge anti-fan of Java
18:25jsabeaudryamalloy, Yes, I hoped working with clojure would help me be more respectful of the java world
18:25mebaran151I just got fetch back out of deps hell with a well placed, exclude [noir]
18:26technomancymebaran151: maybe you could open a bug report on noir so other people could find it if they had the same problem
18:26mebaran151I'll rip out my noir bits later; there are already a huge number of flaky abominations in this app dealing with the fact that Echosign has an insane wsdl that doesn't really work except with Apache CXF
18:27mebaran151which uses a jaxb that is incompatible with the salesforce jaxb
18:27mebaran151so I've been fighting dependency hell for a long time :)
18:28dnolenCLJS poll - opinions about names. In CLJS we overload aget/set to deal with primitive objects, I'm thinking obj-set/get is perhaps better - relevant ticket http://dev.clojure.org/jira/browse/CLJS-353
18:29jsabeaudryhiredman, looks like I should be able to probe with strace and perhaps find a workaround to the java
18:29mebaran151dnolen: I watched your video about core.logic; really nice intro
18:29dnolenmebaran151: thx
18:31hiredmandnolen: what is the point? the two are not compatible either way
18:31pandeiromebaran151: dnolen: link?
18:32hiredmandnolen: why not just make people use the (.-foo ...) syntax we already have?
18:33mebaran151I knew it, colorize is secretly destroying my build
18:33mebaran151it's this colorize dep that is apparently in fighting
18:33dnolenhiredman: it will get munged.
18:33dnolenhiredman: I mean mangled
18:34dnolenhiredman: they are conveniently equivalent for JS, but not necessarily for other hosts.
18:34dnolenhiredman: just another step at making core.cljs a bit more reusable.
18:36hiredmandnolen: the lua port is done though, isn't? this isn't
18:36hiredman"required" isn't it already reusable?
18:37dnolenhiredman: not required, but it's a minor fix and it makes the types more sensible.
18:37hiredmanbasically, what I see is the addition of special forms to make static analysis easier for less capable hosts
18:38dnolenhiredman: in this case it really is a complecting - primitive array types and primitive object types are handled in the same way. Even though the semantics really are not the same even in JS.
18:39hiredmanmaybe the right answer is when it can be determined that x in (aget a x) is an int, or not the compiler can emit something more specialized, but otherwise needs more general logic
18:41dnolenhiredman: in CLJS aget/set is used in a way that doesn't make sense in Clojure JVM currently. the aFOO fns in Clojure JVM are specifically about primitve arrays.
18:42hiredmandnolen: so maybe they shouldn't be cross platform in anyway, aget/aset are part of interop and behave diferently on different hosts
18:42mebaran151alright: quesiton of the hour, can anyone tell me why lein chokes on the "colorize" dependency
18:42dnolenhiredman: every host I can think of will have some efficient array rep. I agree that's not the case for obj-set/get
18:43dnolenimplementors may need to provide for that. but I doubt it.
18:43dnolenobj-set/get are used for ObjMap which is a JS centric map implementation anyway.
18:43kennethException in thread "main" java.lang.RuntimeException: java.lang.NoClassDefFoundError: clojure/lang/ILookupHost
18:44kennethwhat could this be about? i'm getting this in a clojar dependency (beanstalk)
18:44hiredmankenneth: are mxing code aot compiled with one version of clojure with a different version of clojure
18:44hiredmanyou
18:44hiredmandnolen: so what is the compelling need for obj-set/get again?
18:46dnolenhiredman: making the difference explicit. making it easier to bootstrap new backends.
18:46dnolenhiredman: ObjMap will be easy to get up and running on Python/Ruby/Lua etc.
18:46kennethhiredman: would that be a problem with the library i'm using? is that something i can get around?
18:46dnoleneven if implementations abandon it, it's easy to get up and running.
18:46kennethhttps://gist.github.com/7c21052f4d192abc362d stack trace fwiw
18:47hiredmandnolen: but doesn't ObjMap actually use arrays? exactly what aset and aget are for?
18:47dnolenhiredman: w/o the different I imagine people will need to emit some kind of conditional in the aget/set fn and macro.
18:48hiredmanoh, I guess it doesnt
18:48dnolenhiredman: it does not use arrays, strobj.
18:48hiredmandnolen: I have no idea what strobj is
18:49dnolenhiredman: a JavaScript Object being used a HashMap of String -> Object
18:49hiredman:(
18:50hiredmanjs sure is lousy
18:51hiredmanit should be pretty easy to just have a simple impl of a redblack tree map using arrays
18:51dnolenhiredman: and we have those in sorted-set, but unlikely to beat JS Objects since this use case has been optimized like crazy.
18:51hiredmanor even a rb map based just on deftypes
18:52hiredmandnolen: sure, I am not offering as a replacement for objmap in clojurescript
18:52hiredmanbut for a portable immutable map
18:54hiredmanObjMap is not a very good map, so saying "it would be easily portable everywhere" isn't an argument that I find compelling
18:55hiredmanand I know "just use it to get up and running" but still
18:57dnolenhiredman: well core.cljs is the best we have at the moment, and this was a real hurdle an implementer encountered, which others will as well. I'm not saying this is best solution - but it's not a big change, and doesn't really effect CLJS users much.
18:58dnolenso a temporary fix until we have an optimal simple Map type for small sizes that works in most places reasonably well.
18:59hiredmanerm, cross platform optimal simple Map type?
19:00hiredmanI imagine that would just be array-map
19:00dnolenhiredman: A simple redblack tree could suffice. I've always been curious how skew binary random access lists perform.
19:01dnolenhiredman: array-map is pretty slow. It always funny to see the perf change when you cross into PHM on the JVM.
19:01hiredmandnolen: sure, but you wanted cross platform
19:02hiredmanand simple, and optimal
19:02technomancypick any two
19:03dnolenhiredman: technomancy: heh.
19:04mebaran151so I'm having one strange error now: my build complains that clojure.instant__init.class doesn't exist
19:05hiredmanmebaran151: most likely conflicting versions of clojure
19:05hiredmanclojure.instant is in clojure 1.4, but not before
19:09technomancyis anyone using a BUILDPACK_URL on heroku? would like help testing a change.
19:11rlbtechnomancy: won't be possible, unfortunately.
19:11rlbtechnomancy: though I may go ahead with a backport.
19:11technomancytragic =\
19:12rlbrelease was just too close to the freeze
19:12rlb(when coupled with a little delay on my part -- but even without that, it was pretty close)
19:13tos9Hash maps are unordered, correct? How come the following two seemingly equivalent fns produce hashmaps that println with consistently different orders? http://bpaste.net/show/ABjdNgUA0o7Mow6IETcv/
19:13technomancyrlb: well thanks for your work on it regardless
19:14hiredmantos9: because maps are unordered
19:14technomancyI'll probably stick with nix anyway, but it would have been nice
19:14rlbyou're certainly welcome
19:14mebaran151hiredman: anyway to see who is trying to use 1.4?
19:14rlb(I've also been tied up a bit with bup lately...)
19:14technomancyit's funny that they're worried about stability; in my experience 24 was significantly more stable than 23 even way before it was released
19:15hiredmanmebaran151: why aren't you using 1.4?
19:15technomancybup?
19:15hiredman1.3 is horrible
19:15rlbtechnomancy: sure, but my *packages* might not be ;>
19:15technomancyI guess so =)
19:15rlb(and they weren't -- emacs24 was broken on i386 (completely))
19:15technomancyoh, well there you go
19:15technomancyI guess they have a point
19:15mebaran151hiredman: I just bumped to 1.4, but now I'm getting a strange stackoverflow error
19:16rlbTurns out that there was an upstream bug wrt use of fabs() that our buildd's demonstrated quite clearly.
19:16hiredmanmebaran151: when?
19:16mebaran151the cljs compiler doesn't make it easy to find these things
19:16tos9hiredman: Right, got that. I asked about consistency, so I guess I'm asking in what order the implementation displays them. They are going to be ordered based on hash value and when keys are inserted I'd assume. I'm just curious as to where that differs between the two implementations I had.
19:16hiredmanmebaran151: pastebin
19:16rlb(took me most of debconf to track that down -- with help)
19:16mebaran151I think it's actually in the cljs compiler
19:16hiredmantos9: check the types
19:16technomancyrlb: I do appreciate the radical commitment to stability, but it can be a pain being on the other side of the fence
19:16rlb(though maybe that says more about me than the bug...)
19:16rlbyep -- but if I do get a good backport, then you're set.
19:17rlb(and it shouldn't be hard, assuming I have the time)
19:17tos9hiredman: The types of what?
19:17hiredmanthe maps you produce
19:18emezesketos9: Are you just asking about this out of curiousity?
19:18tos9emezeske: Yes.
19:18emezesketos9: Cool, that's a good reason. I just wanted to make sure you weren't trying to find out so you could rely on the order somehow :)
19:18tos9hiredman: That's going to be something other than what hash-map gives me? (println type ...) for all three says they're PersistentHashMaps.
19:18tos9Dropped a paren there.
19:18tos9emezeske: A noble cause :)
19:19amalloytos9: no way it says PHM for the one built with zipm-2
19:19hiredmantos9: your gist only has 2
19:19tos9hiredman: Sorry. 2, I have a third locally that was uninteresting.
19:20tos9Oh hey. I can't read.
19:20hiredmanwe already know :)
19:20tos9Apologies to you both, yes, it says PersistentArrayMap.
19:20hiredmanPAM infact *must* preserve order
19:20tos9Cool. Guess I'd better figure out what those are then. Thanks.
19:21amalloyhiredman: must?
19:21hiredmanotherwise map literals could execute code in random order
19:21hiredman(random, hashcode ordering)
19:21amalloyhiredman: they already can, if you have a large map literal
19:21hiredmanok, sure, if you have a large map literal
19:21emezeskeWow, I had never thought about that
19:22emezeskeI guess that wouldn't usually cause problems, though
19:22amalloyIMO depending on the order of execution of a map literal is an error, but i'm not sure about that
19:22emezeskeI can't think of any sensible code that would care about the order, but if things had side effects it could be very confusing without this prior knowledge
19:23arrdem,(cons nil [1 2])
19:23clojurebot(nil 1 2)
19:23mebaran151so I think it is time for me to bite the bullet
19:23mebaran151and get rid of noir-cljs
19:23mebaran151I have gotten enough of the other libs running that I don't think I'm going to run into too much trouble with this excision
19:24emezeskemebaran151: I'll be happy to help with lein-cljsbuild on windows, insofar as I can without touching a windows box
19:24mebaran151emezeske: they're not so bad :)
19:26mebaran151let me try and configure the plugin in first to find my files
19:26technomancyemezeske: did you see the "Is that precate TRUE?" thread on the leiningen mailing list?
19:27emezesketechnomancy: Glanced at it just now
19:28technomancyI am also a bit too intimidated to look more closely.
19:29emezesketechnomancy: Good call
19:29technomancyno idea what's going on there or how it became such a mess, but it's insane.
19:30emezeskeAgreed!
19:38mebaran151so emezeske: I'm getting one error, that it can't make an input-stream from nil
19:39mebaran151it looks like it doesn't set up the resources the same way my project does when it loads it
19:40mebaran151though I'm not completely sure why it's trying to compile my clj file anyway
19:40hiredmanmebaran151: sounds like you are missing something in project.clj, so when it looks up the value it gets nil instead of a value
19:42mebaran151it looks like it's coming from the fact it's trying to compile my own code but the cljsbuild plugin has a difference conception of where clojure.java.io/resource should be searching
19:43emezeskemebaran151: resource should always look in the classpath.
19:43mebaran151I have some defs that internally refer to resources via clojure.java.io/resource
19:44mebaran151does cljsbuild use my classpath?
19:44emezeskeWell, it builds up a classpath based on settings in your project.clj file
19:44mebaran151(with-open [stream (io/input-stream (io/resource "encryption/f1.keystore"))]
19:44mebaran151 (doto (KeyStore/getInstance "JKS")
19:44mebaran151 (.load stream keystore-password))) << why would this line fail then
19:45hiredmanah
19:45hiredmanI believe I have it
19:46hiredmanmebaran151: you have that as a def?
19:46mebaran151yep, it's a def
19:46hiredmanand you have macros in that file that are used from clojurescript?
19:46mebaran151no
19:46hiredmandamn
19:47mebaran151I am unclear why clojurescript is compiling my main project anyway
19:47hiredmando you have clojure and clojurescript files in the same directory structure?
19:47mebaran151they both live under src, but I keep the clojurescript with cljs as the extension and in a folder called client
19:48mebaran151okay scoping it to client has helped, but now I'm getting a Stackoverflow error
19:49hiredmanpastebin it
19:51mebaran151https://www.refheap.com/paste/4215 << here's a paste
19:52hiredmanhuh
19:53hiredmanmebaran151: what jvm is this?
19:54hiredmanmebaran151: client? server? 32bit, 64bit?
19:55mebaran1511.7 64bit
19:55hiredmanyou may just try upping the stacksize with -Xss
19:55hiredman-Xss2m or something crazy
19:56mebaran151how do I pass that to lein cljsbuild?
19:56hiredmanhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L242
19:56hiredmanyou set it for lein
19:59mebaran151still overflowing the stack :/
19:59mebaran151if I accidentally had a recursive require, would that lead to a stackoverflow?
19:59emezeskePossible to paste your project.clj?
20:00hiredmanmebaran151: you mean a circular dependency?
20:00hiredmanyeah, that would do it, those are not allowed
20:01hiredman(in clojure or clojurescript)
20:01mebaran151I know, but would it stackoverflow?
20:01mebaran151https://www.refheap.com/paste/4216
20:01hiredmansure
20:01hiredmanthat line is in the ns form part of the analyzer
20:02emezeskemebaran151: Underneat src/f1/client, are the cljs files arranged with their directory structure matching their namespace structure?
20:02mebaran151ok I found the circular flaw
20:02hiredmanemezeske: I have found that cljs-build doesn't seem to are about that
20:02mebaran151I'm surprised it worked before
20:03emezeskehiredman: I think weird things can happen, depending on how a file is loaded
20:03emezeskehiredman: If it's loaded from a build in a different dir, it will break, maybe? I don't remember exactly what the problem was
20:05FrozenlockI just installed lein2 and now I can't `clojure-jack-in'. Is this normal, or is my config messed up?
20:06amalloyFrozenlock: you need the lein2 swank plugin, presumably
20:06FrozenlockOh right
20:10mebaran151it would be nice instead of stack overflowing, to tell me about the mutual depends
20:12technomancyFrozenlock: nrepl.el does though =)
20:13FrozenlockAnd leaving slime behind 0_o
20:13xeqitechnomancy: did the new version come out this week?
20:14technomancynot yet
20:15mebaran151technomancy: hiredman: emezeske: thanks for you help
20:15mebaran151I'm now back to where I was yesterday morning, with an actual working clojurescript stack to boot
20:15emezeskemebaran151: You up and running?
20:15emezeskeNice!!
20:16mebaran151I have some questions about advance compilation coming (i.e. I don't think I'm externing all the symbols I need to; can the compiler help me?)
20:16emezeskeExterns are a persistently painful problem
20:17mebaran151under simple compile, everything works dandy; I'd love to deploy advance compile on release
20:18emezeskeIt's definitely doable -- I have a working project with probably 6-7 external JS dependencies
20:18emezeskeBut there is pretty much no documentation on how to create externs files. It sucks.
20:18mebaran151I just wish the compiler would give me some more guidance as to what I need to extern
20:19mebaran151even if it's just warnings
20:19emezeskeHow could it possibly know?
20:19mebaran151It could track unbound variables
20:19mebaran151the same way the real javascript knows that the function doesn't exist :)
20:20emezeskeWhat is an unbound variable?
20:20mebaran151if I define an f(x) and there is no externs f(x) or f(x) imported in my compilation chain, the compiler could throw a warning
20:21mebaran151basically if sees a reference to something without a definition (either in an externs.js or in another clojurescript file), it could complain
20:22emezeskeIf you define...? You mean if you reference?
20:22mebaran151sorry reference (been a long day)
20:22emezeskeThe compiler can't know in advance what fields may or may not exist on any given JS object
20:22mebaran151oh because some function might create new fields I suppose
20:23emezeskeYes
20:23mebaran151still a warning might be nice to help guide the externs process :)
20:23mebaran151I don't think this object has this field, though it very well might...
20:24emezeskeJust grep for '(\.', that's a good start
20:24mebaran151heh yeah
20:25mebaran151if I use a function from the googe closure library, do I have to declare it in my externs?
20:25emezeskeNo
20:25emezeskeThe closure library is included during advanced optimization, so it's symbols are mangled with the rest
20:25Frozenlocktechnomancy: Could it be that profiles.clj isn't created automatically?
20:26technomancyFrozenlock: it's definitely not
20:26mebaran151I actually think it might not be too many functions
20:26FrozenlockAnd all this time I was scanning my drive because I couldn't find it in .lein :(
20:27emezeskeIt probably isn't. And note that jayq includes its own externs file for jQuery, so that's already covered
20:27emezeske(Although you do need to add it to :externs manually)
20:28mebaran151do I have to put it in my project tree or no?
20:28mebaran151also I think I use more jquery functions than ibdnox wrapped
20:29emezeskeNo, it is included in the jayq JAR so it will be on the classpath, which :externs knows to look for
20:29mebaran151cool
20:29emezeskeYeah, there are lots of non-jayq functions
20:29mebaran151and I'd have to wrap them most likely
20:29emezeskeAnd, for some reason, jayq is inconsistent in how it names functions -- some of them are not named the same as their jquery implementations. Yay!
20:30emezeskeNah, you don't have to wrap them. You might want to, but they'll work file unwrapped
20:30mebaran151I mean extern.js them
20:30emezeskeIf they're in jQuery, you do not need to add them
20:30emezeskeThe jayq externs file covers all of the main jquery lib
20:31mebaran151cool, so that would leave just bootstrap tabs I probably need to externify
20:33mebaran151also parseInt, would I have to externs that?
20:33Frozenlocktechnomancy: The key binding seem to be the same for slime and nrepl, is there any difference for the user?
20:33mebaran151set! expressions too...
20:34technomancyFrozenlock: the switch-ns one is C-c C-n since it discards the "package" terminology inherited from CL
20:34technomancyalso the interrupt binding is different
20:35technomancyI think the rest is the same, for the stuff that's been implemented
20:35technomancythe inspector is still missing =(
20:35emezeskemebaran151: Core JS stuff like parseInt is already handled
20:35danlarkinmy poor muscle memory
20:35FrozenlockAny chance it could run cljscript and clojure at the same time? :P
20:36technomancyFrozenlock: cemerick is working on that
20:38cemerickFrozenlock: yes, coming shortly
20:38FrozenlockFor this, I would drop slime like there's no tommorow!
20:38cemericke.g. with Leiningen: https://gist.github.com/3308381
20:39cemericknrepl.el and reply and ccw use the same backend, so…
20:39FrozenlockOh nvm then... but it will still be terrific!
20:42FrozenlockBtw, anyone can recommend a good read to learn cljscript/javascript? Not knowing javascript, I feel a bit like when I started learning Clojure without knowing Java... I feel like a big ball of slime.
20:43cemericktechnomancy: I see nrepl.el constructs a clojure.core/load-file form; FWIW, that'll need to change once cljs support is taken for granted.
20:43gfredericksFrozenlock: the best way to learn a new language is to use a clojure that compiles to that language
20:44antifuchsgfredericks: …and then find all the places where your expectations clash with the generated code's (:
20:44technomancycemerick: hrm; I spose so, but I don't know what you'd use instead
20:44cemerickactually, it's a bug as-is anyway; won't work with any remote REPL connections
20:44Frozenlockantifuchs: pain
20:44mebaran151for a super lazy clojure, I wonder if anybody has ever considered compiling clojure to Haskell core
20:44mebaran151it's not a bad little asm
20:44technomancycemerick: good point
20:45cemericktechnomancy: clojure.tools.nrepl.helpers/load-file-command is the best there is AFAIK
20:45cemerickThough, that's going to need updating as well.
20:45cemerickAttack of the middlewares!
20:45aperiodicmebaran151: wouldn't you need to figure out how to get a stackless tagless G-machine to run clojure code?
20:46hiredmanI hear they are moving off of the stg
20:46hiredmanthey have some new intermediate rep
20:46aperiodicoh really? i haven't been keeping up
20:46hiredmanI just heard this week sometime
20:47aperiodicwhat's the motivation?
20:47hiredmanhttp://hackage.haskell.org/trac/ghc/blog/newcg-update
20:47Frozenlocklein-gnome.. wait... wait.. is this a way to expand an OS in clojure?
20:48hiredmanI just finished reading the stg paper a month or so ago
20:48technomancyFrozenlock: of course
20:49technomancycemerick: nice
20:58mebaran151aperiodic: probably nice interaction with haskell, though I suspect the impendence mismatch is probably comparable to the JVM for function oriented languages
20:58mebaran151it's optimizer also is very good at in lining little tiny functions like clojure does, so it might produce relatively efficient clojure code
21:01aperiodicmebaran151: i was under the impression that a lot of those optimizations it uses were only possible because everything's pure, or represented as such using a monad
21:03amalloyaperiodic: "represented as such"? everything is pure, for reals
21:07mebaran151In the clojure core, certain functions are most definitely pure, with a quick little :^pure tag, you might be able to compile them outside some sort of monad
21:07mebaran151and then throw the rest of the program execution into monadic flow
21:07aperiodicamalloy: i will confess to not really grokking how monads and purity interact. how does a monad make, say, println pure? because it makes the execution history (the monad?) an argument?
21:08mebaran151aperiodic: the monad doesn't make something pure, it just marks it as impure
21:08mebaran151(well the IO monad)
21:09mebaran151Monads are just containers that have convenient combination properties
21:09amalloyaperiodic: the signature of that function is String -> IO (). it's a function which takes in a string, and returns (roughly) a set of instructions for performing IO at some later date
21:10amalloyfor any given string, it always returns the same set of instructions
21:10mebaran151that's actually a nice description...
21:11amalloyat the top level of your program (ie main), your main function is called with no arguments, and all IO within it is composed into a single gigantic IO "instruction set"
21:11aperiodicso the impurity only comes in when you want to execute those instructions, which you can do after all the pure code has run?
21:11amalloyyes
21:11aperiodic(inc amalloy)
21:11lazybot⇒ 26
21:12amalloy(not only "can do", actually "must do")
21:13aperiodicok, mebaran151's comments make sense to me now
21:18aperiodicmebaran151: so, how would you deal with haskell's auto-currying vs clojure's var args? keep track of which functions came from where and use different calling conventions accordingly?
21:22mebaran151well var args vs auto-currying is the same as just passing a list
21:23mebaran151varargs are syntactic sugar around lists (and the rest argument internally even Clojure looks a lot like a seq)
21:23mebaran151Java does the same thing mapping varargs to Object[]
21:28mebaran151in fact all multiple arity functionality might be a little tricky to emulate in clojure given the auto-currying
21:30aperiodicah... i guess you know when the clojure fns are being called with all of their args, and the haskell functions are totally ok with getting all of their args at once, as you can just apply them one-at-a-time. does that mean this would only work one way?
21:31mebaran151http://www.haskell.org/haskellwiki/Varargs << a nice little discussion
21:32aperiodicoh rad, thanks. i didn't know that was even possible
21:35mebaran151it looks like you just set up your own strategy for currying essentially
21:36mebaran151http://okmij.org/ftp/Haskell/polyvariadic.html#polyvar-fn << for a more detailed overview
21:39aperiodicmmm, I think I'm going to have to do some remedial Haskell before this makes sense to me.
21:40aperiodicthanks, though!
21:40Raynesemezeske: Why does lein-cljsbuild require a version of Clojure?
21:42mkwhat exactly happens when the repl reads (symbolname)? When does var lookup occur? Does the reader produce a symbol?
21:43aperiodicmk: the reader does not evaluate, it produces a symbol. var lookup occurs during evaluation, for details see http://clojure.org/evaluation
21:44aperiodicmk: well, if it reads "(symbolname)" it produces a list containing a symbol, pardon
21:44mkhow does one produce a var?
21:45mebaran151mk, #'symbol
21:45mebaran151,(class #'identity)
21:45clojurebotclojure.lang.Var
21:46mebaran151also (var symbol) can do the trick to if you're running through a macro
21:47mkI guess #'x is essentially converted to (var x) at read-time?
21:47emezeskeRaynes: I forget, but I seem to remember there was a good reason
21:48Raynesemezeske: It's weird though. I'm targeting nodejs, so I don't need Clojure. Stop giving me things I don't need man. Stop it.
21:48Raynes:p
21:48mebaran151doesn't the clojure compiler actually run in java?
21:48mebaran151*clojurescript
21:48emezeskeRaynes: But, you need clojure to build clojurescript
21:48mkfor some reason I was thinking that the reader actually hooks up symbols to vars, or something like that
21:49Raynesemezeske: Yeah, but lein-cljsbuild requires clojurescript, not me.
21:49mebaran151,'(+ 1 2 3)
21:49clojurebot(+ 1 2 3)
21:49emezeskelein-cljsbuild shouldn't depend on clojure
21:49emezeskecljsbuild does (the support jar)
21:49mebaran151,(eval '(+ 1 2 3))
21:49clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:49aperiodic,(class (first (read-string "(+ 1 2 3)")))
21:49clojurebotclojure.lang.Symbol
21:50mebaran151ah it wouldn't let me show, but the + sign in a quoted list doesn't even know t's var for a while
21:50Raynesemezeske: Couldn't lein-cljsbuild check for a version of Clojure in the project and add it itself if it isn't there?
21:50Raynes(if it really needs it in the projects)
21:50RaynesI mean, I don't care about any of this.
21:50RaynesJust discussing.
21:50Raynes<3
21:50emezeskeI don't understand what's happening -- lein-cljsbuild the JAR doesn't depend on clojure
21:50mkare symbols resolved to their namespace at read-time?
21:50emezeskecljsbuild the JAR does, because, well, it depends on clojure
21:52emezeskeRaynes: Oooooooooh I see what you're talking about now
21:52emezeskeRaynes: You are right, it shouldn't require that. That's an accidental side-effect of it trying to warn people when they used clojure 1.2
21:53RaynesI see.
21:53emezeske'Tis a bug, I think!
21:53emezeskehttps://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild/subproject.clj#L26
21:53emezeskeThat's the error message you're seeing?
21:54aperiodicmk: nope. read http://clojure.org/evaluation
21:54mk,(var 'undefined32423)
21:54clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)>
21:54mkwhat's cons got to do with this?
21:55Raynesemezeske: Yessir.
21:55mkaperiodic: thanks
21:56emezeskeRaynes: It's odd, I very specifically made it error out. I can't remember why, though... :(
21:56emezeskeRaynes: That can probably just be removed.
21:58emezeskeRaynes: https://github.com/emezeske/lein-cljsbuild/issues/113
21:58RaynesNice
22:04mkthe reader itself evaluates the contents of lists?
22:11aperiodicmk: no, the only thing the reader does is turn strings into data structures (well, excepting a read-eval reader macro, but let's not talk about that for the moment)
22:14mkwhat is quoting then? I thought that a quote prevented the reader from evaluating certain parts of the... I guess that's wrong though, since all the reader would do is turn the '... into (quote ...)
22:16aperiodicmk: yeah, it's a little subtle. all the reader does is that substitution you mentioned. then, when the resulting form is evaluated, the quote fn does the work of preventing evaluation of its arg
22:16xeqitechnomancy: do you have a template for new heroku/compojure projects?
22:18mkwhen defn is read and then evaluated, what happens to the function-body form after the var bindings?
22:18mkare the symbols in that form converted to vars?
22:21gfredericksthe symbols that resolve to vars are compiled into references to those vars
22:24mkhow might I get the value of what they are compiled into?
22:24gfredericksthe var itself or the value in the var?
22:26mkif I (defn f [] (class 'foo)) I get c.l.Symbol. I was expecting that fn would replace '(class 'foo) with '(class <ref value here>), but that doesn't seem right
22:26gfredericksyou quoted foo
22:26mkyes. That wasn't right.
22:27gfrederickstry (class #'foo)
22:27mkI'd like the var itself, I think... unless I can get what you called the "reference to the var"
22:27gfrederickswhich is equivalent to (class (var foo))
22:27gfredericksmk: I didn't mean anything special by "reference to the var"
22:27gfredericksjust a reference in the sense that anytime you "have" an object in java you have a reference to it
22:27mkI see
22:28gfrederickscompiling the symbol certainly doesn't generate a var, so maybe I was just trying to avoid that interpretation
22:29mkdoes defn evaluate the function body form? I thought that it did something special with symbols, because I wasn't able to ns-unmap vas used in functions, until I unmapped those functions. But I can't replicate that now.
22:29gfredericksdefn mostly just expands to (def foo (fn [...] ...))
22:29mkI can (def foo 1), then (defn f [] foo), and then (ns-unmap *ns* 'foo)
22:30gfredericksand it still returns 1?
22:30mkyes
22:30gfredericksI suppose the var itself still exists, you've just removed it from the namespace
22:30gfredericksnamespaces provide the mapping from symbols to vars
22:31aperiodicyeah, because foo was resolved when you defined f, so it's not a big deal if you remove it later
22:32mkright, but now I do (def foo 2), and then (f) yields 1
22:32gfredericksyep
22:32gfredericksf still refers to the original var
22:32aperiodicyeah, because it's still returning the value of the old var that foo resolved to when you defined f
22:32gfredericksregardless of the fact that you've now wired 'foo in your namespace to a new var that has 2 in it
22:33mkweird, because when I do (def foo 1) (defn f [] foo) (def foo 2), (f) then yields 2
22:33gfredericksdef again just changes the value of the existing var
22:33gfredericksso the fact that you hadn't unmapped it meant there's only one var the whole time
22:34mkI see, right
22:35mkseems a bit... broken.
22:35gfrederickswell ns-unmap is not meant for normal use
22:35gfredericksthe redefining-with-the-same-var behavior is what you want to happen when you redefine things
22:35mkI could have sworn that at an earlier time, when I tried to unmap it threw an exception if the var in question was being used in some function
22:36arrdemdoes Clojure have an 'infinity' constant?
22:37gfredericksjust the Double value
22:39mkhow can I look at the structure that a fn uses as its body?
22:39uvtc,(print Double.MAX_VALUE)
22:39clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: Double.MAX_VALUE, compiling:(NO_SOURCE_PATH:0)>
22:40gfredericksmk: the compiled bytecode?
22:40gfredericks,(print Double/MAX_VALUE)
22:40clojurebot1.7976931348623157E308
22:40uvtc,(print Double/MAX_VALUE)
22:40clojurebot1.7976931348623157E308
22:40uvtcgfredericks: beat me to it. Thanks. :)
22:40mk,(print Double/POSITIVE_INFINITY)
22:40clojurebotInfinity
22:40gfredericksuvtc: that's what #clojure is all about
22:41gfredericks,Infinity
22:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Infinity in this context, compiling:(NO_SOURCE_PATH:0)>
22:41mkgfredericks: right, I guess not the bytecode. I was under the impression that functions merely held on to whatever structure the reader gave them, with a few interesting replacements
22:42gfredericksmk: nope; despite the wishes of various tool-designers the forms are not kept
22:42gfredericksyou can define a macro to replace fn that keeps them of course
22:43gfredericksbut I doubt that would help you
22:43uvtcxeqi regarding a template for new heroku/compojure projects, if you come across one, I'd love to hear about it.
22:43weavejesterlein new compojure blah
22:43mkI doubt it would, because I'm only interested in that weird var-referencing thing
22:43weavejesterwill work with lein2
22:44weavejesterand lein1 if you install the plugin
22:44gfredericksmk: you can play with vars directly using (var foo)
22:44uvtcweavejester: will try that. Thanks.
22:44xeqiweavejester: neat, thanks
22:45gfrederickslein2 is compojure-aware?
22:45weavejesterNo, but it automatically downloads templates
22:45gfredericksfrom where?
22:45weavejesterI believe "lein new foo bar" will look for a project foo/lein-template in the repositories
22:45mkso when fn is called, a new Runnable-implementing class is generated, and an instance of it is assigned to the var (the var that resides in the namespace map)
22:45gfredericksnice
22:46mkis that correct?
22:46xeqigfredericks: it uses lein-newnew underneath which has the autodiscovery
22:46gfredericksmk: fn doesn't necessarily have anything to do with vars
22:46mkoops, defn
22:46gfredericksmk: probably best to think about def and fn separately
22:47mkwhere fn generates the class, creates an instance, and returns that instance
22:47mkgfredericks: right
22:48mkis a new class created every time fn is called?
22:48gfredericksI think every time a fn expression is compiled, yes
22:50mkso are classes garbage collected, just like instances?
22:51gfredericksI doubt it; and I can't think of any normal situation where that would matter
22:51gfredericksmaybe a long-running repl?
22:51mkwell, if I'm looping over a (fn) call millions of times, I seem to be generating millions of classes
22:52gfredericksI don't think that's true unless you're evaling fn a million times
22:52gfredericksor the fn appears a million times in your code
22:52gfredericksit should only be compiled once
22:52mkhmm. What sort of loop might use a fn?
22:53uvtcweavejester: I see two seemingly-related projects at clojars: https://clojars.org/compojure-template and https://clojars.org/compojure/lein-template . But they both point to the same github repository...
22:53gfredericksmk: I don't understand the question
22:53weavejesteruvtc: The first was made before auto-discovery was implemented, or, more likely, before I knew about it :)
22:53mkgfredericks: I'm trying to think of a case where fn would be evaluated millions of times, and this is normal
22:54gfredericksmk: you have to be calling eval directly
22:54gfrederickssimply calling a function is not something that generates a class
22:55gfredericksunder normal circumstances there is just one class for each time you see fn in your code
22:55uvtcweavejester: Ah. So, https://clojars.org/compojure/lein-template is the current/modern one that uses lein2 autodiscovery. Thanks.
22:55mkoh, so if I have a fn inside a fn, this will generate the bytecode for only the outer fn?
22:55weavejesteruvtc: Correct
22:55gfredericksmk: no, a class for both of them
22:55gfredericksmk: they both get compiled at compile-time
22:56antifuchshugod: so I was just reading up on the wire format discussion of 11/06; looks like something I would like to take on in ritz soon, unless you have any objections (:
22:58antifuchs(the websocket derailing and consequent frustration aside, I don't see a technical reason why ritz shouldn't implement that new wire format) (:
22:58mk,(defn makefn [] (fn [] 1))
22:58clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
22:59muhoohmm, i wonder if this is on-topic (clojure being used for these applications IIRC): http://www.technologyreview.com/view/428756/watch-high-speed-trading-bots-go-berserk
22:59mk(makefn) seems to return ... oh, it's the same class, but a different instance: #<user$makefn$fn__22 user$makefn$fn__22@ab7165>
22:59hugodantifuchs: I'm actually pretty close to having nrepl working with ritz
23:00antifuchshugod: ah, ok...
23:00antifuchshugod: well, I'd love to continue using slime (:
23:00antifuchswhatever works best for either of us, I guess. I'm just not ready to give up on it yet (:
23:01mkok, mystery mostly solved I guess
23:01gfredericksmk: yep; that's a good example for why a fn-class could have more than one instance
23:01hugodantifuchs: I'll clean up what I have and push it - lots left to do - I'm not removing slime support
23:01antifuchsoh, neat! (:
23:01antifuchshugod: what does nrepl support mean?
23:01antifuchsjust speaking the nrepl wire protocol?
23:02hugodit means the debugger will work in nrepl - with commands to add breakpoints, enable break on exception, etc
23:02antifuchs! (:
23:02antifuchspretty neat
23:03hugodat the moment it is a separate plugin for lein
23:03hugodwhich starts a headless nrepl session
23:03mkso it's effectively safe to assume that a given read-eval (of a block of potentially nested functions) will generate only one class per function (and potentially many instances, but that doesn't matter)
23:04antifuchsso the current slime wire protocol is pretty nice. three bytes, hex-encoded as length prefix, plus utf-8 code bytes.
23:04antifuchsI'll try and frob rpc.clj to speak that next week when I'm on hackation, then see how much of slime breaks (:
23:04gfredericksmk: yep
23:04hugodthe swank wire protocol is very simple
23:05antifuchshugod: it is!
23:05antifuchshugod: I've never looked too closely at it, but now that I am looking for something to do… (;
23:06hugodantifuchs: sounds like I should get this code cleaned up asap - would really appreciate help with it
23:06antifuchsawesome
23:06antifuchslooking forward to helping in any way I can
23:07antifuchsnow that I've tasted a bit of clojure, I'm getting pretty excited, actually (:
23:07antifuchsnot that I'm going to be using it at work immediately, but it's good to know strengths of things (:
23:07hugodthere will also be elisp code to do for nrepl.el to make using it a pleasant experience
23:07antifuchshah yayyy
23:07antifuchsTHAT I know rather well (:
23:07hugodclojure grows on you pretty quickly
23:08arrdemI'
23:08mkgfredericks: thanks, many things make more sense now
23:08antifuchsI know, it's very very common lispy
23:08antifuchs(which is a very very pleasing thing to me) (:
23:08hugodindeed - with nice hash maps, and atoms, and immutable collections :)
23:10gfredericksmk: success!
23:11arrdemlet's try that one again, hands OFF the enter key. I'm trying to write a Levenshtein distance calculator for arbitrarry Clojure ISeqs. Unfortunartely, the efficint solution to this involves much mucking with 2d arrays. I have a working version written in Clojure, but I was wondering what it would take to write the same function in Java. The algorithm is easy, but where is ISeq documented?
23:13arrdemnvm, found javadocs
23:14arrdemNope, not worth the effort.
23:22hugodantifuchs: just realised you probably meant that you want to use SLIME with a nrepl backend
23:24hugodwhat I'm doing at the moment is an nrepl backend intended for nrepl.el - a nrepl backend for SLIME would have to look a little different. How different depends on how far the nrepl.el ui departs from SLDB.
23:26scottjhugod: are you abandoning ritz for nrepl?
23:27hugodscottj: no, the idea is that ritz will support slime and nrepl
23:27scottjhugod: nice
23:55gfredericks$mail amalloy just pushed a rewrite to currj/master that includes let and works at compile time; implementing amalloy-fn is 8 lines: https://gist.github.com/3310866
23:55lazybotMessage saved.