#clojure logs

2015-03-31

00:00mavbozoxphillyx: what do you mean 'generically'?
00:01xphillyxWere it a vector i could say [[x y z]] but if it's a list, I can't do that right?
00:01mavbozo,(let [[a b c] '(1 2 3)] [a b c])
00:01clojurebot[1 2 3]
00:02amalloysequential destructuring works on anything sequential
00:03xphillyxHmmm.. maybe I'm misunderstanding if-let then. If I pass a 2 element sequence to an if-let expecting 3, it should jump into the else, correct?
00:03amalloyno
00:03cflemingdnolen: Ok, I'll see what I can do - I'm unlikely to be implementing custom REPLs before Clojure/West unfortunately.
00:03amalloyxphillyx: (if-let [x y] ...) is just (if y (let [x y] ...) ...)
00:04amalloyit doesn't somehow test whether the destructuring is "going to work"
00:04amalloyie, it is not pattern matching
00:04xphillyxOh! That explains it. Thank you.
00:34cflemingrhg135: You were right about loading clj into cljs REPLs being a bug - macros can't be loaded via load-file
00:35cflemingrhg135: Will be fixed in the next drop
00:35rhg135well, cfleming, I guess I was wrong about being wrong lol
00:35rhg135my subconcious is a better programmer than me it seems
00:36cflemingHehe
00:37cflemingThere's also another annoying bug - send top form to REPL doesn't work in cljs over clojure.main
00:37cflemingAlso fixed for the next release
00:37rhg135haven't noticed that
00:38rhg135but i haven't tried either
00:38cflemingIf you try, you will notice it :)
00:39rhg135i've been using figwheel for loading code; I only use the repl to muck with the state
00:43cflemingYeah, that seems pretty common - I don't think many people use a straight CLJS REPL like you would in Clojure
00:45rhg135well it didn't exist tillo a few months ago
00:45rhg135ppl found alternatives i guess
00:46rhg135although for nodejs it would be useful
01:08Lutin`@seen raynes
01:09Raynes@saw raynes
01:10Lutin`Raynes: you need to renew 4clojure.com!
01:10RaynesI do not. It isn't my website.
01:10Lutin`Oh I thought it was.
01:10Lutin`woops
01:10Lutin`ignore me
01:10Raynesamalloy_: ^
01:10justin_smithLutin`: it's been renewed
01:11RaynesOh.
01:11elvis4526How do you require clojure macro from clojurescript ?
01:11elvis4526(#cljs is empty at the moment)
01:12Lutin`justin_smith: ah I see
01:12Lutin`comcast dns was just behind
01:12justin_smithwhat else is new, heh
01:13RaynesLutin`: Alan and I share a VPS where he runs 4clojure.com (a domain which another fellow, David Byrne, owns).
01:13RaynesSo it was a reasonable assumption to make.
01:13justin_smithRaynes: I wouldn't trust that David Byrne guy. He's a psycho killer and he burns down houses.
01:13Lutin`haha
01:14RaynesI've totally never heard that joke every time I say that dude's name
01:14justin_smithfigures
01:14Raynes:P
01:15Lutin`Ah nice it has an expiration date of 2020 now
01:16amalloyLutin`: 4clojure was renewed like 12 hours ago
01:16Lutin`yeah I see that
01:17Lutin`I just saw mihailp's message in #4clojure and no one had responded
01:17Rayneshttp://www.developers.meethue.com/tools-and-sdks holy shit
01:17Lutin`didn't want anything bad to happen
01:17RaynesI didn't know they added clhue to this page
01:17RaynesThose assholes never gave me any swag or anything!
01:17RaynesWunderlist gave me swag!
01:17RaynesI've been cheated!
01:17RaynesEr
01:18RaynesWunderground
01:18RaynesThe weather site
01:18Lutin`Raynes: I'll bug my friend who works at Phillips lol
01:18RaynesNot the todo list.
01:18RaynesTell him I love his bulbs.
01:18Lutin`He only does QA, but maybe he has some connections
01:18RaynesHe should send me a light strip :3
01:19Lutin`Apparently every bulb in his office is a hue
01:19amalloyRaynes: "i love your bulbs, baby". not weird at all
01:21Lutin`I've been wanting to get one to mess with some audio visualizations
01:26Lutin`Raynes: he noticed that since they aren't using HTTPS he could just grab someone's username in flight
01:26Lutin`and they use the same username throughout the office haha
01:33arrdemhehe
01:33arrdemthis is how real devs do security...
01:33arrdemRaynes: REDEPLOY LAZYBOT ALREADY DAGNAMBIT
01:36Lutin`so I know this is a touchy subject but just a survey
01:37Lutin`who uses emacs and who uses vim?
01:37justin_smithLutin`: we have civil discussions about editors here
01:37justin_smithbelieve it or not
01:37arrdemSTAKES AND PITCHFORKS, GET 'EM HERE
01:37justin_smithI use evil mode in emacs because my fingers like it better
01:38Lutin`I've been using vim for years but elisp is enough to convince me to switch
01:38justin_smithI don't use cider because it changes and I'm too stupid to keep it working
01:38arrdemI used to use vim before fireplace.vim came out, switched to emacs for CIDER, don't regret it at all
01:39Lutin`I've noticed there are several starter packs for emacs. Any ones you can recommend?
01:40justin_smithstarter packs are a bad idea, because you inevitably end up customizing things, and they just make it more complicated to do that. But technomancy's better-defaults is a great alternative to that.
01:40arrdem+1 starter packs are a bad idea
01:40justin_smithhttps://github.com/technomancy/better-defaults <- use this if you try emacs
01:40Lutin`Oh it's not like I would stick with the pack
01:41Lutin`just something to kind of get exposed to the different plugins
01:41Lutin`but I'll definitely check that out
01:41justin_smithLutin`: the problem is you either a) loose everything nice about the pack or b) deal with a huge pointless pain in the ass trying to customize
01:41justin_smithLutin`: and we don't have plugins, we have libraries
01:41justin_smithjust use better-defaults
01:41justin_smithand then install libs and try them
01:41Lutin`ah alright, I was unsure about the terminology used
01:42justin_smithLutin`: in emacs, ~95% of the editor is written in elisp
01:42justin_smithso elisp isn't just an extension language, it is the language that implements the editor
01:42Lutin`yep, I get that much
01:43justin_smithso yeah, it's not plugins, it's enhancements / replacements for the default implementation
01:43Lutin`so calling them libraries does make more sense
01:43justin_smithyup
01:43justin_smithor even "forks"
01:43justin_smiththe emacs you install by default is just RMS' .emacs file writ large :)
01:44justin_smithanyway, you won't regret better-defaults
01:44justin_smithunless you hate emacs, which is fine and fair, it's not for everyone
01:44Lutin`I love the architecture
01:45Lutin`But it's hard to stop thinking in motions and text objects
01:45amalloyLutin`: i'm an emacser, but from what i understand text objects are pretty cool and you can use evil-mode or something to get stuff that maybe feels a bit like that?
01:46Lutin`last time I tried Emacs was with Evil mode was a few years ago
01:46amalloyie you shouldn't have to stop thinking in terms of stuff that is cool
01:46amalloybut Raynes will know better than i do
01:46Raynesevil-mode is basically vim.
01:46RaynesJust go get it
01:46RaynesYou likely won't notice you're in Emacs.
01:47RaynesIt supports everything in vim that matters.
01:47amalloy^ most convincing liar in #clojure
01:47justin_smithhaha
01:47RaynesAnd I said it so it's true.
01:49Lutin`hmm I need to rebind Ctrl-Z
01:49amalloyoh? why's that?
01:49Lutin`hard to `fg` from the gui client
01:50Lutin`unless there's a keybind I don't know about
01:50justin_smithLutin`: (global-set-key (kbd "C-z") #'undo)
01:50justin_smithis what I do
01:50justin_smithLutin`: minimize and then maximize again does the "fg"
01:50justin_smithLutin`: with evil mode, C-z would switch from emacs mode to vim emulation mode
01:50Lutin`Ah okay that works
01:51Lutin`and I can't minimize in i3 lol
01:51justin_smithLutin`: oh man I use i3 too and I forget how I did it but I have done it...
01:51justin_smithmaybe float then pack again?
01:52Lutin`evil mode just installed so will we ever know!?!?
01:52justin_smithin terms of waking emacs up after C-z that is
01:52amalloyyeah i guess i bound C-z to do-nothing in gui mode too
01:52justin_smithI guess not :)
01:52Lutin`oh awesome better-defaults enables flex matching
01:52justin_smithLutin`: i3 is the only wm where I don't hate how it handles multiple monitors, and what to do when they are added/removed
01:53justin_smithincluding non-linux stuff
01:53amalloy(when (window-system) (global-unset-key "\C-z") (global-set-key (kbd "C-x C-c") (lambda () (interactive) (message "Why would you ever leave?"))))
01:53amalloybest part of my .emacs
01:53justin_smithhaha, I like that
01:54Lutin`justin_smith: A friend has been pushing me to try out awesomewm
01:54amalloyi can still quit with alt-f4, but in practice i accidentally quit more often than i intentionally quit
01:54Lutin`But I'm not sure if I like permonitor workspaces
01:56justin_smithLutin`: with 3 monitors, having a keybinding to jump to each workspace, and being able to move each workspace to an arbitrary monitor is a huge win for me
01:59arrdemjustin_smith: you should check out xmonad
01:59justin_smitharrdem: I did, after the 10th customization to make it more like i3, I switched back to i3
02:00arrdemlaem
02:00justin_smithit didn't do anything I wanted that i3 doesn't do
02:02Lutin`I'm sure xmonad is awesome if you spend a lot of time customizing, or use someone elses
02:02Lutin`But I couldn't justify it when i3 had plenty sane defaults
02:02arrdemI've found the defaults to be sufficiently sane
02:03Lutin`also muscle memory with a wm is hard to break haha
02:03arrdem^ yeha
02:04Lutin`I'm really liking awesome though
02:05arrdemI switched off of awesome because I had real issues with it freezing up
02:06rhg135it's written mostly in lua
02:06rhg135iirc
02:06arrdemyep
02:06Lutin`yep
02:07Lutin`I love Haskell but the paradigm shift between it and shell scripting was more cognitive burden than I had time to deal with
02:07rhg135hope their test suite is comprehensive
02:08Lutin`uh oh..
02:08Lutin`oh nevermind wrong folder
02:09Lutin`Yeah they could use better test coverage
02:10Lutin`maybe I'll check xmonad out again when I have the time
02:11arrdemOne of these days I'll mess with my xmonadrc to make it auto-pace the emacs and other instances I spawn on xinit.. but that's all more I'd really want
02:25Lutin`ugh I need to switch out conky for something else
02:25Lutin`I keep getting json parse errors from i3bar
02:25Lutin`and debugging them is nigh impossible
02:35anei3 is indeed really nice
02:50bbloomjoe124: ... huh?
03:01Lutin`Raynes: still around?
03:02Lutin`Have you changed the structure of your .emacs.d recently?
03:29ggherdovHello. Can I call a var "atom" without clashing with... well, "atom" is already a thing in clojure.
03:29ggherdovcan i ?
03:30justin_smithggherdov: well you can specifically use clojure.core/atom by its full name
03:30justin_smithbut it will likely still read weird to someone looking at your code
03:30ggherdovjustin_smith: ok
03:31Lutin`and you can use (ns yournamespace (:refer-clojure :exclude [atom]))
03:31Lutin`but the question is more, should you?
03:31ggherdovLutin`: yeah
03:32Lutin`I'm a clojure noob, but it seems like a bad idea
03:43Lutin`justin_smith: you use emacs, yeah?
03:43Lutin`Do you just use package.el for package management?
03:43Lutin`I see some people like el-get and use-package
03:43justin_smithyeah
03:43justin_smithI use package
03:44Lutin`use-package looks nice
04:01Lutin`oh man use-package is nice
04:02justin_smithoh look, a nice clean way to do the total hack I have set up :)
04:02justin_smith(it checks for availability, loads another el file with all my related stuff if it is there)
04:03justin_smithso I have one file with all my evil related things, and it only gets loaded if evil gets loaded
04:03justin_smithetc.
04:03Lutin`yeah
04:03Lutin`with this you could just do (use-package evil :ensure t :config (require 'init-evil))
04:03justin_smithoh nice, it even has a nice clean syntax for the conditional key bindings to add if that package is there
04:03justin_smithright
04:04Lutin`Yep :)
04:04Lutin`really clean
04:04Lutin`I like
04:05Lutin`and you can add your own keywords :D
04:07elvis4526Why this: http://pastie.org/10064247
04:07elvis4526is finishing with an NullPointer
04:08elvis4526(i know define-func is useless, i'm just trying to understand macros)
04:08Lutin`well for one there's a typo
04:08elvis4526yep its not present on my version
04:08justin_smithelvis4526: nam != name
04:08elvis4526http://pastie.org/10064250
04:08elvis4526updated
04:09elvis4526sorry
04:09justin_smithalso, ~body should be ~@body, or else the body will be wrapped in extra parens
04:09justin_smithand the extra parens will make things like npes happen
04:09elvis4526oh thats why
04:09justin_smith,`(~(range 10))
04:09clojurebot((0 1 2 3 4 ...))
04:09justin_smith,`(~@(range 10))
04:09clojurebot(0 1 2 3 4 ...)
04:09justin_smithsee the diff
04:10elvis4526why there extra parenthese ?
04:10elvis4526are*
04:10justin_smithbecause it is a collection
04:10justin_smithso they really aren't "extra"
04:10justin_smiththat's what & does - it takes all the remaining args, and puts them in a list
04:10justin_smithor list-like thing
04:10elvis4526okay this has nothing to do with the macro itself
04:10elvis4526okay okay
04:10justin_smithso you need ~@ to take them back out again
04:11Lutin`justin_smith: so what makes that cause npes?
04:11Lutin`,((0))
04:11clojurebot#error{:cause "java.lang.Long cannot be cast to clojure.lang.IFn", :via [{:type java.lang.ClassCastException, :message "java.lang.Long cannot be cast to clojure.lang.IFn", :at [sandbox$eval73 invoke "NO_SOURCE_FILE" -1]}], :trace [[sandbox$eval73 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784] [clojure.lang.Compiler eval "Compiler.java" 6747] [clojure.core$eval invoke...
04:12justin_smithLutin`: it turns (fn [x] (print x)) into (fn [x] ((print x)))
04:12justin_smithprint returns nil
04:12Lutin`ah alright yeah
04:12justin_smithmany other things do too
04:12Lutin`that's what I was thinking
04:26otfrommorning
04:26otfromI know about iterator-seq, but is there a way of turning a seq into a java iterator? I'm sure I'm missing something simple and googling is only giving me iterator-seq.
04:30amalloyotfrom: clojure collectoins are all java.lang.Iterable
04:30amalloyyou just call .iterator on them
04:31TEttinger,(.iterator (map + [1 2] [10 20]))
04:31clojurebot#object[clojure.lang.SeqIterator "clojure.lang.SeqIterator@77d90d5b"]
04:31TEttinger(inc amalloy)
04:31lazybot⇒ 245
04:31TEttinger(identity justin_smith)
04:31lazybotjustin_smith has karma 229.
04:31TEttingerit's a battle for the ages
04:43hyPiRionhuh, the new notation is interesting
04:44hyPiRion,(.root (vec (range 1000)))
04:44clojurebot#object[clojure.lang.PersistentVector$Node "clojure.lang.PersistentVector$Node@19289b86"]
04:44hyPiRionOh, it wasn't _that_ interesting
04:49TEttingerhyPiRion:
04:49TEttinger,clojure-version
04:49clojurebot#object[clojure.core$clojure_version "clojure.core$clojure_version@3cb250e7"]
04:49TEttingerso useful
04:50hyPiRionwait what
04:50hyPiRion,(prn clojure-version)
04:50clojurebot#object[clojure.core$clojure_version "clojure.core$clojure_version@3cb250e7"]\n
04:51hyPiRionoh
04:51TEttinger(str ,clojure-version)
04:51hyPiRion,*clojure-version*
04:51clojurebot{:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true}
04:51TEttingerha
04:52TEttingerI knew something was weird there...
04:52hyPiRionThat makes it really hard to distinguish functions and objects though
04:53hyPiRionOr maybe not, when I think about it
04:53TEttinger,#(+ %)
04:53clojurebot#object[sandbox$eval118$fn__119 "sandbox$eval118$fn__119@1eafcafa"]
04:53otfromamalloy and TEttinger thx!
04:53otfromthought I was missing something simple(TM)
04:53TEttingerI didn't do anything, amalloy's the hero!
04:57otfromTEttinger you gave me the example code, but I agree that amalloy is a hero :-D
04:57TEttingerhehee
05:00otfrom(inc amalloy)
05:00lazybot⇒ 246
05:00otfrom(inc TEttinger)
05:00lazybot⇒ 46
05:15elvis4526Is it possible to "apply" each things in a vector as arguments to a function?
05:18mavbozo,(map + [0 1 2 3 4])
05:18clojurebot(0 1 2 3 4)
05:18mavbozoelvis4526: ^like that ?
05:18elvis4526but this still count as one argument if you pass this to a function
05:18elvis4526(i believe)
05:19mavbozo,(map inc [0 1 2 3 4])
05:19clojurebot(1 2 3 4 5)
05:19Niacuser=> (doto (Graphics.) (.create 10 10 10 10)) CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.awt.Graphics, compiling:(NO_SOURCE_PATH:45:7)
05:19elvis4526map will always return a sequence
05:20mavbozo,(apply + [0 1 2 3])
05:20clojurebot6
05:20elvis4526initially i tought apply was what im looking for
05:21xulferyou want to convert a vector into individual function arguments?
05:21elvis4526yeah
05:22Niacso how can i use java.awt.Graphics package?
05:26martinklepschwhen I deploy an uberjar, what's the best way to provide some additional resources (static files) when I start the service? is this only possible by wrapping these resources in jars?
05:27martinklepschthe files I want to provide to my clojure process are periodically updated by an external process
05:34mavbozomartinklepsch: if you use ring, you can use ring.middleware.file/wrap-file
05:34mavbozomartinklepsch: i'm assuming you're running a webapp
05:34martinklepschmavbozo: I'm not intending to serve the file
05:35martinklepschAn alternative to providing the file via resources is to just use (io/file "/usr/share/my.file") but that feels a bit as if it's unclean
05:35martinklepschmaybe someone has an opinion to offer on that
05:41mpenetit's a config file of some sort?
05:42martinklepschmpenet: not really. it's a ip->geolocation database
05:43oddcullyand who updates it? ops? os-update?
05:44martinklepschoddcully: ops via a separate updater process
05:44elvis4526So I wrote a macro to solve my problem, again lol. http://pastie.org/10064396
05:46mavbozojava -cp /var/geoip:/home/web-app/web-app.jar com.web.app
05:46oddcullythen i'd put it in /var/db/<yourappname> or something and find a way to trigger reloading
05:46mpenetpreferably not hardcoding the path in your app, ex via an env var and a default value
05:47martinklepschmavbozo: so can I just supply random dirs as classpath and their contents will be reachable via io/resource ?
05:47mavbozomartinklepsch: yup!
05:47oddcullyyes
05:48martinklepschok, great. that wasn't entirely clear to me tbh
05:50oddcullyif your ops isn't aware either, it might be easier to have the location in a config and read it via file, as mpenet suggested
05:50oddcullyless java magic
05:53martinklepschmakes sense. I think the java-magic is the easier route for now
05:56mavbozoelvis4526: what's the usage example of your macro?
05:57mpenetI gave up on messing with classpath/resources, too much indirection
05:58ARM9how do I :use several libraries? something like (ns foo.bar (:use [seesaw.core seesaw.font]))
05:58mpenet~use
05:58clojurebotuse is don't use use.
05:58ARM9~require
05:58clojurebotIt's greek to me.
06:09danlentzARM9: a ns form can have multiple use/require clauses
06:09ARM9what would be the equivalent :require to :use
06:11martinklepschARM9: (:require [lib.ns :refer :all])
06:11martinklepschARM9: but don't do it!
06:11ARM9I tried that but it did not work in this case
06:11martinklepschARM9: do something like (:require [lib.ns :as n])
06:11danlentzSomething like (:require [clj-uuid [constants :refer :all] [util :refer :all]])
06:13danlentzBut it is usually better to do the :require ... :as like martinklepsch suggests
06:18ARM9I see
06:18ARM9thanks
06:37kungiWhat does "minting cost" mean in the following context? UUIDs are one of the URNs with the lowest minting cost? Minting is as I recall the process of creating coins.
06:39danlentzMinting is just creating
06:39kungidanlentz: Thank you
06:39danlentzWhere did you read it?
06:40kungirfc4122
06:40kungiPage 3
06:41danlentzNeat. I've spent some time reading RFC4122 myself :)
06:42danlentzYou've seen clj-uuid?
06:43kungidanlentz: yes. At the moment I just use java.util.UUID to create the ones I need
06:44danlentzThere are various versions of UUID, each with specific use-cases and performance characteristics
06:45danlentzSo, java.util.UUID/randomUUID uses a cryptographic random number generator, which is unguessable, but very slow
06:45kungidanlentz: But sadly the one I need in my use case.
06:46kungidanlentz: I have to create UUIDs that are unguessable
07:01tahmidquit
07:01tahmidoops! sorry
07:24danlentzkungi: do you have an interesting use-case you are using UUID's for? I understand if its proprietary and you can't discuss -- I am just collecting examples because sometimes people ask
07:24kungidanlentz: query
07:45arossouwjust wondering, when you create a standalone jar with leiningen and deploy it to a webserver. Is there a way to do it without interrupting the website?
07:47raspasovarossouw: one approach would be using a load balancer, either manually setup or via AWS/Rackspace/et al...
07:47arossouwok
07:47raspasovthe process would be something like: 1. setup a load balancer with at least 2 JVM nodes serving requests
07:47raspasovwhen you want to deploy...
07:47oddcullyarossouw: search the web for blue-green-deployment
07:48raspasov2. remove one server from circulation
07:48raspasov3. update the uberjar on that server
07:48raspasov4. put that server back in circulation
07:48raspasov5. repeat on all servers
07:48arossouwthanks, i'll experiment with both approaches
07:49raspasovI think there's better approaches than that, prob blue-green is better
07:49raspasovthat gets into "immutable infrastructure" and these kinds of topics
07:49arossouwload balancer is a good idea for high availability
07:49oddcully3.1 run your smoketests against that server
07:50arossouwok
07:50raspasovoddcully: yea :)
07:53arossouwhehe, we dont have app servers, our servers are hosted on site
07:53Glenjaminyou can still have a load balancer and more than one process on a single node
07:53raspasovarossouw: so physical servers, not AWS/Rackspace etc?
07:54raspasovGlenjamin: good point
07:54arossouwraspasov: correct
07:54arossouwi see, good idea
07:55raspasovarossouw: yea so in this case I think things like immutable infrastructure become more challenging, unless you have the whole API/virtualization layer ala-Amazon/Rackspace
07:55arossouwok, might be time to persaude management to go with Amazon/Rackspace
07:56arossouwbandwith is very pricy in south africa and we'd need plenty of bandwithd for database operations
07:57raspasovarossouw: well don't jump and that wagon just because I threw in some buzzwords :) carefully evaluate benefits/trade offs
07:57arossouwyes, just thinking of it now, haven't made decision yet
07:57raspasovarossouw: you mean if you go with Amazon/Rackspace?
07:57raspasovabout bandwidth?
07:58raspasovis your database remote, i.e. not in the same data center?
07:58raspasovor you're thinking of keeping your DB on premise and going with AWS for app servers? I wouldn't do that
07:58arossouwthe applications are desktop apps, we also have web applications ,but the business core is from desktop apps, there's a major defect with performance on database queries from client to server. with the desktop environment
07:59arossouwraspasov: no i thought of moving the database servers to a hosted environment on a lan at a server-farm/designated place
08:00arossouwraspasov: virtualizing databases not a good idea i think
08:00raspasovyea one thing I would say is that AWS/Rackspace is like an all or nothing proposition, either all your servers, both DB and JVM app servers are there or not
08:00arossouwok
08:00arossouwraspasov: which do you prefer aws or rackspace?
08:01raspasovarossouw: hardware has gotten much better in the last few years; but you definitely dont want to be paying the latency cost of talking to a DB cross-data center
08:01arossouwyes, definately
08:01borkdudein clojure, is there a "failing" version of map lookup?
08:01borkdudethat throws an exception when they was not found
08:01raspasovarossouw: I have been using Rackspace for the longest time, but recently started using Amazon... they are comparable, I think Amazon has the advantage of bigger ecosystem around it because of more developers using it
08:02arossouwraspasov: they create a database connection for every query instead of grouping querries, looks like syn flood on database , hehe
08:02raspasovarossouw: wow, yea that's not good :) what Database is it?
08:02arossouwmysql
08:02raspasovarossouw: haha, is it EVERY. SINGLE. query?
08:03arossouwindeed. instead of select columns from table where id in (12,3), its select columns from table where id = 12, select columns from table where id =3, simple example but get the point
08:04cemerickdnolen: you can stop muttering about me under your breath ;-P
08:04arossouweven created code with c++ and qt to prove with graphs that, that is stupid
08:04dnolencemerick: lol
08:04arossouwhttps://github.com/arossouw/study/tree/master/c%2B%2B/qt5-mysql-basic/testcases
08:04raspasovarossouw: oh ok, but at least does it REUSE a socket/connection pool or just straight up makes a new connection? :)
08:04dnolencemerick: need to fix a bug cfleming found with load-file and will then likely cut a release
08:05arossouwdoesn't reuse, creates a socket for each connection, waits for os to time out, also known as timeout_wait tcp
08:05arossouwusually timeout_wait is 60 from what i've read
08:05arossouw60/secs
08:05raspasovarossouw: yea that's nasty... a lot of load on the DB I'm sure
08:05arossouwaha, 24 cpu xeon , massive server. load on 400%
08:05arossouwlots of context switching
08:06raspasovarossouw: look into http://jolbox.com/
08:06cemerickdnolen: works. Speaking of, it's possible that piggieback's load-file operation is slightly borked (it just uses load-stream), but I haven't seen any breakages so far in everyday use.
08:06arossouwhad to optimize linux kernel to handle more connections, for their broken performance code
08:07arossouwraspasov: i think qtsql is good, no?
08:07dnolencemerick: yeah using load-stream is not the right way to do it, breaks source mapping
08:07cemerickwell, there we go
08:07raspasovarossouw: never used it, have used BoneCP though
08:07dnolencemerick: but it's also not a show stopper, people and load-file doesn't work atm the moment
08:08arossouwraspasov: will it work with visual studio 8?
08:08arossouwhehe
08:08raspasovarossouw: lol what does that mean
08:08arossouwvisual studio 2008
08:08arossouwthe desktop app is coded with ms visual c++
08:08cemerickdnolen: the only reason I'm not just using the load-file special fn is it assumes the file is on disk
08:08raspasovarossouw: hahah yea I know what Visual Studio is, but it's a library, how can a library WORK or NOT WORK with an IDE lol?
08:08dnolencemerick: er "people" will be happy that so much stuff now works.
08:09dnolencemerick: yeah you need that for source mapping to work
08:09oddcullyyou are in clojure land. so this is either emacs (or vim *ducksandruns*)
08:09arossouwoh, ok . was stupid question
08:09raspasovarossouw: it's ok :)
08:09dnolencemerick: in general REPLs have to be disk oriented for this reason - debuggability and how source mapping works across runtimes
08:09cemerickdnolen: I can provide the source file's path, if that's what's necessary
08:10dnolencemerick: browser & Node.js specifically which are the two most popular options
08:10arossouwwould it be difficult to create an offline leiningen installer?. bandwith in south africa very expensive
08:10dnolencemerick: there's nothing you can do fix this without a ton of work
08:10dnolencemerick: use load-file when I fix it
08:11arossouwraspasov: i thought jdbc was stricly a java thing
08:11arossouwsee boneCP can connect to jdbc
08:11raspasovarossouw: yes it is, are using a Clojure CLR?
08:11raspasovare you*
08:11cemerickdnolen: will do
08:12dnolencemerick: in the browser you just have to use a script tag, in Node.js it has to be on disk - load-stream is just not the right solution for ClojureScript
08:12arossouwi download leiningen standalone and clojure 1.6. I'll tinker abit to see if i can just copy the .lein folder and make it work that way on windows
08:14arossouwis the job market for clojure programmers improving?
08:16arossouwraspasov: ok, boneCP will work for my clojure web apps, but they are using visual c++ for their desktop bloatware app
08:17raspasovarossouw: I've setup BoneCP before, you can take a look at this file (no guarantees provided :) ) https://github.com/raspasov/neversleep/blob/master/src/neversleep_db/mysql_lib.clj
08:17arossouwraspasov: whats wrong with the standard jdbc?
08:18dnolenborkdude: there is not
08:18arossouwok, still have lots to learn on clojure, whats that doto do?
08:18borkdudednolen ok
08:18oddcully,(doc doto)
08:19clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
08:19raspasovarossouw: http://clojure.org/java_interop
08:19arossouwaha
08:19arossouwwould it be worth time to dissect java calendar widget and rewrite it to clojurescript?
08:20raspasov"doto thisObject someStuff1, someStuff2, etc"
08:20arossouws/java/javascript/
08:20arossouwok
08:21arossouwso why not create a hash-map instead of doto?
08:22Glenjaminsometimes you have a java object
08:22arossouwo, i see its to transform java classes
08:22Glenjamin,(doto (HashMap.) (.add "a" 1) (.add "b" 2))
08:23clojurebot#error{:cause "Unable to resolve classname: HashMap", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalArgumentException: Unable to resolve classname: HashMap, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.IllegalArgumentException, :message "Unable to resolve classname: HashMap", :at [clojure.lang.Comp...
08:23Glenjaminmeh, my java is rubbish
08:24arossouwmakes sense now, neat thing
08:24oddcullyGlenjamin: clojurebot says put! ;P
08:25arossouwis it practical to build desktop apps with clojure?
08:25Glenjamin,(doto (java.util.HashMap.) (.add "a" 1) (.add "b" 2))
08:25clojurebot#error{:cause "No matching method found: add for class java.util.HashMap", :via [{:type java.lang.IllegalArgumentException, :message "No matching method found: add for class java.util.HashMap", :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}], :trace [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53] [clojure.lang.Reflector invokeInstanceMethod "Reflector.jav...
08:25arossouwlike gui app (qt, wxwidgets, gtk)
08:25tahmid_(doc doto)
08:25clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
08:25Glenjaminoh, i see .put
08:25Glenjaminanyway, you get the idea
08:26arossouwso you have to escape strings every time?
08:26oddcullyno
08:26oddcullysee Glenjamin code, but s/.add/.put/g
08:26oddcullythis is just because of the bot
08:26arossouwok
08:26arossouwoh, phew.
08:28arossouwwanted, a calendar widget in clojure script :-)
08:29alejandrozfHi all!
08:29alejandrozfa
08:31peterk87arossouw: is this what you're looking for? https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/bootstrap-datepicker
08:32arossouwpeterk87: i've been googling like crazy, thanks. i'll try github next time
08:34alejandrozfstill getting network errors installing leiningen, exist another way to download the dependencies?
08:35peterk87arossouw: you mentioned desktop apps, I remember seeing this https://github.com/breach/thrust - Haven't tried it though...
08:36arossouwpeterk87: looks great, i'll experiment
08:37arossouwand easier than c++ with qt5
08:38waltermmHi, i'm a clojure(script) beginner and im having trouble to debug "cannot read call of undefined". I use lein-figwheel template and chrome console doesnt help anything ;(
08:38waltermmCan anybody help?
08:38dysfunarossouw: i'm not sure how writing qt c++ helps you get a calendar widget in your browser :)
08:39arossouwlol, no thats another project. just learning gui development with qt
08:39peterk87waltermm: are you trying to call some JS code?
08:40tahmid_waltermm: share your project.clj
08:40waltermmno.. i'm using reagent
08:41waltermmi dont think the problem is in the project.clj since it was working just a few line of code ago..
08:42waltermmpeterk87 and tahmid_: maybe its a typo or something, but im unable to find the origin ;/
08:42dnolenwaltermm: ClojureScript supports source mapping which is enabled by default
08:42peterk87waltermm: are you using advanced compilation?
08:42arossouwpeterk87: reagent looks impressive
08:43dnolenpeterk87: doubtful if they are using piggieback
08:43dnolenwaltermm: figure out how source mapping support works in your dev browser, it will save you a lot of time
08:43waltermmdnolen: thank you very much.. i will do some research about source maps!
08:43waltermmthanks for the help guys
08:44dnolenwaltermm: in Chrome in the dev console there is a settings button (the gear), click it, find the source map option, enable it, refresh your browser, you should see a ClojureScript stack trace
08:44dnolenwaltermm: if you enable Catch Exceptions then it will drop you into the ClojureScript file at the line/column where the error occurred
08:45dnolenwaltermm: I strongly recommend spending the time to sort this out as it will save you countless hours in the future
08:46waltermmdnolen: nice! thanks for the advice and i will learn it
08:46dnolenwaltermm: np
08:47tahmid_dnolen: when om-native is coming out ?
08:47dnolentahmid_: no idea, there's various things that need looking into first
08:47tahmid_dnolen: are there plans for android ?
08:48dnolentahmid_: only in so far as we let React Native sort it out
08:52arossouwis it possible to build apps for the android platform with clojure? (since android underhood is java)
08:54arossouwoh, found this, http://clojure-android.info/, not production ready yet though
09:01borkdudeClojure and S3: https://github.com/weavejester/clj-aws-s3 or https://github.com/mcohen01/amazonica?
09:02borkdudethe first one seems more maintained
09:03raspasovborkdude: I actually used Amazonica a little bit, it's pretty neat how the API is designed to escape Java-lang nastiness
09:03borkduderaspasov thanks
09:03borkduderaspasov I'll go for that one
09:03raspasovborkdude: the Amazon API actually helps, since all the Java classes are designed as pure data holders basically
09:04raspasovborkdude: I think weavejester's stuff is also top notch
09:04borkduderaspasov yeah
09:04raspasovif you just need S3, I'd go with clj-aws-s3
09:04raspasovif need entire AWS, I'd look into Amazonica
09:07Guthuris there any defacto stander HTTP server for clojure?
09:07Guthurs/stader/standard
09:08borkdudeGuthur jetty, immutant (jboss or undertow), httpkit are used a lot
09:08raspasovGuthur: https://github.com/ztellman/aleph based on Netty, with great performances, there's other options as well but Netty is a very solid project
09:08raspasovperformance*
09:09borkduderaspasov the clj-aws-s3 seems to be lagging a bit behind. it uses [com.amazonaws/aws-java-sdk "1.7.5"], amazonica uses [com.amazonaws/aws-java-sdk "1.9.13" :exclusions [joda-time]]
09:09borkduderaspasov I'm kind of worried that if I go with clj-aws-s3 I have to migrate because this project is abandoned
09:09raspasovborkdude: yea I was just poking around with Amazonica 1-2 weeks ago, I believe it was up-to-date, which was nice to see
09:13Guthurborkdude, raspasov: cheers
09:13arossouwneat, https://github.com/SnootyMonkey/lein-sphinx
09:14arossouwmidje vs deftest, which one is preferred?
09:16raspasovarossouw: I go for simple, deftest
09:16arossouwok
09:17danlentzWithout taking anything away from the greatness of tools like Grimoire, I want to mention that Dash for Mac and iOS is pretty awesome.
09:17danlentzhttps://kapeli.com/dash
09:17arossouwfor the life of me, dont get how our software engineers get by without version control
09:18danlentzClojure, java, emacs, clhs, Scala, ...
09:21oddcullyarossouw: maybe the like to life dangerous?
09:22arossouwhehe, cowboy coding and monkey patching
09:22arossouwliving on the edge
09:23mavbozothe original extreme programming
09:24oddcullyand since you used the plural: how do they sync their effords?
09:24slipsetI'm working on this little rest-client a la post-man for chrome
09:24arossouwdoes anyone here rebase git repositories?
09:24slipsetusing http-kit
09:24danlentzDash is paid software though I should mention, well... paid-ish.
09:25slipsetour server sends us a cookie which is new on each request, so I need a way to store it for each request, and apply it for the subsequent request
09:25slipsetany good patterns for doing this?
09:26bjaoddcully, xtreme cowboys only use highly interactive environments like common lisp or GDB and thus don't need to coordinate. They just inspect what is running.
09:26slipset(do-cookie-stuff (http/post ".." ) doesn
09:26slipsett look to good.
09:27bjasince cowboys are so expensive and prone to race conditions, you only need to hire 2-3 for each codebase, offset appropriately around the world so they don't overlap each other.
09:27oddcullybja: at least that would work. i'd rather fear some shared drive or insane copy actions
09:28mavbozoslipset: you want to find better pattern than this https://github.com/dakrone/clj-http#cookie-stores ?
09:28slipsetmavbozo:problem is that I'm not using clj-http
09:28bjaoddcully, you're mistaking Xtreme Cowboys(tm) for my auto industry employer ~2005
09:28mavbozoslipset: i thought they have same client apis
09:28slipsetfor some none-obvious reason, and http-kit doesn't seem to support cookie-store
09:34arossouwbja: maybe thats why it managers should at least have a bsc in computer science
09:34arossouwso that they can appoint skilled software engineers
09:35arossouwbut, that also might be subjective, it would depend on the knowledge that the it manager has
09:39sveriHi, I tried to use test-refresh within a leiningen plugin, but it fails because it cannot find the test files. When I comment this line: :eval-in-leiningen true in the project.clj file it works and runs the tests. Are there any known defects for this?
09:52joe124hi can someone explain why my duplicating function doesn't work http://pastebin.com/ZqsH4PtG
09:57mavbozo(duplicate-nums 1 2 3) returns (1 1 2 2 3 3) is what you expect right?
10:00really_clojurehello. I'm trying to run my compojure app. I'm attempting to have routes for various parts of the site in their own files.
10:00joe124mavbozo: yes
10:00really_clojureWhen the main route maker attempts to pull one of the sub routes, I get this error: No such var: clojure.core/home-management.routes.profile
10:00justin_smithjoe124: a few things about that
10:00really_clojureThe (ns) declaration looks good.What am I missing?
10:01justin_smithjoe124: because clojure collections are immutable (seq args) is the same as args
10:01justin_smithjoe124: also, copy-of-coll is the same as coll
10:01justin_smithjoe124: so you can just write (defn duplicate-args [& coll] (interleave coll coll))
10:01justin_smithand the get the same exact result
10:02joe124what does seq do though?
10:02oddcully,(let [col [1 2 3]] (interleave col col))
10:02clojurebot(1 1 2 2 3 ...)
10:02justin_smithjoe124: it coerces the input to a seq
10:02oddcullyjustin_smith is just to quick
10:02justin_smith,(seq "hello")
10:02clojurebot(\h \e \l \l \o)
10:02justin_smithoddcully: if I knew you were trying to answer I would have let you
10:03oddcullyno worries
10:03justin_smithjoe124: also, let bindings can see prior bindings, so you never actually need (let [...] (let [...] ...)) with nothing in between
10:04justin_smith,(let [a 1 b (+ a a) c (* b b)] c)
10:04clojurebot4
10:05joe124ok cool didn't know you could do multiple bindings in the same let declaration
10:05joe124thank you oddcully that solution is perfect
10:06justin_smithjoe124: your version already worked
10:06justin_smithit was just awkward for the reasons I listed
10:07oddcullyso what didn't work then?
10:07justin_smithoddcully: I copy/pasted his version, it worked
10:08joe124not for me, if my version took [1 2 3 4 5] it outputted [1 2 3 4 5][1 2 3 4 5]
10:08joe124or something like that
10:08justin_smithjoe124: you must have been using a prior definition
10:08justin_smithjoe124: I promise, that version worked
10:08justin_smithI put it in my repl, and got the correct output
10:09patrkrisis it good practice to have a (satisfies? SomeProtocol x) in the precondition of functions at "the edge" of an API?
10:09oddcullyno he called it like this: (duplicate-nums [1 2 3])
10:09justin_smithoddcully: that's just using it wrong
10:09joe124yah you're right it does work
10:09justin_smithoddcully: if you expect to use it like that, take the & out of the parameter declaration
10:10justin_smith,(defn dup-nums [& coll] (interleave coll coll))
10:10clojurebot#'sandbox/dup-nums
10:10justin_smith,(dup-nums :a :b :c)
10:10clojurebot(:a :a :b :b :c ...)
10:11mavbozo,(apply dup-nums [:a :b :c])
10:11clojurebot(:a :a :b :b :c ...)
10:11justin_smith(inc mavbozo)
10:11lazybot⇒ 4
10:11justin_smithgood point
10:11oddcully,(apply dup-nums [1 2 3])
10:11clojurebot(1 1 2 2 3 ...)
10:11oddcullydarn! ;P
10:12joe124why does (fn duplicate-nums [& coll] (interleave coll coll)) fail http://www.4clojure.com/problem/32
10:13justin_smithjoe124: because it doesn't get varargs, it just gets args
10:13justin_smithjoe124: delete the &
10:13mavbozojustin_smith: in fairness, i think justin_smith uses his touch-screen keyboard again.
10:13joe124what's the difference?
10:14mavbozojustin_smith typing is slower than usual
10:14joe124i mean why woudl that change anything
10:14sm0kecemerick: hello regaring piggieback issue #57, you there?
10:14oddcullyhaha
10:14justin_smith,((juxt (fn [a] a) (fn [& a] a)) :a)
10:14clojurebot[:a (:a)]
10:14justin_smithjoe124: ^ that's the difference
10:14justin_smithalso, the first one only takes one arg
10:14joe124so the & collects everything into a list
10:14justin_smithexactly
10:15joe124even if it's only one thing, ok neat
10:15justin_smithjoe124: notice how I got sneaky and taught you to use juxt too just for the hell of it
10:15cemericksm0ke: for 2m, what's up?
10:15joe124and i understood what it did too lol amazing
10:15sm0kecemerick: just wanted to ask that this would need a minor patch for fireplace right?
10:16sm0kecemerick: just remove the :repl-env?
10:16cemericksm0ke: If the piggieback stuff is encapsulated in a vim command, yeah. Not sure why it is, though?
10:17sm0kecemerick: i guess fireplace takes the :repl-env as a !Piggieback param
10:17sm0kewill try it out, thanks for answering all question!! cemerick
10:18cemericksm0ke: Not sure what that means. :-) In any case, it really shouldn't hide `cljs-repl`, as that's the only way you'll get REPL / compiler configuration flags set, etc.
10:19joe_1246sorry i dc
10:19mavbozojoe124: did you managed to create max function?
10:24joe_1246no i tried but it started getting really complicated http://pastebin.com/jeGuVySz.
10:24joe_1246i feel embarrassed to paste it but hey lol
10:25justin_smithjoe_1246: it's not super bad. try adding a second line to the let: (let [cur-max (first coll) coll (rest coll)] ...)
10:25justin_smiththat should get you closer to the answer
10:25justin_smithif not making the code work right away
10:26justin_smitherr wait
10:26justin_smiththat does not suffice because you are returning a function...
10:26justin_smithbut I think it gets you within a step or three of fixing it
10:27joe_1246i kinda just want to start over on this function because its so big
10:27justin_smithjoe_1246: to make it smaller you would need to learn some new functions
10:27justin_smithas is, it's a fairly succinct recursive loop
10:27mavbozojoe_1246, you can put the loop-function in let binding
10:28mavbozo[cur-max (first coll) loop-function (fn [cur-max coll] ....
10:28justin_smithor just replace "fn loop-function" with "loop" I think :)
10:29joe_1246 idont like having the loop at all though, the only reason it exists is because i needed cur-max to equal the first coll
10:30joe_1246but i only wanted to do that once
10:30joe_1246not every recursion
10:32justin_smithjoe_1246: you need the recursion, and the repeated binding to cur-max in order for that function to work
10:32justin_smithjoe_1246: until you learn reduce, this is the right way to get a single result based on a collection
10:33joe_1246is that a correct functional style?
10:33justin_smithyes
10:34joe_1246ok i will learn reduce
10:34justin_smithjoe_1246: the principle being applied here is that since our variables are not mutable, we need to call a function with different args to move forward
10:34justin_smithjoe_1246: I think it's good to make the recur based version work
10:34justin_smithit will help in understanding how reduce works
10:34oddcullyis this a builtup on that site or is reduced not allowed to solve it?
10:34joe_1246is it possible to make a recur based version without using an extra loop inside my function?
10:35joe_1246reduce is allowed on that problem
10:35justin_smithjoe_1246: yes, using extra arities
10:35justin_smithjoe_1246: but I don't think that would make it that much simpler
10:35justin_smithjoe_1246: reduce will make it a lot simpler, but I think it's a good learning exercise to learn how to do it with loop or regular recursion first
10:36joe_1246i will try to do it wi th regular recursion
10:37joe_1246g2g be back later afternoon thx guys
10:37justin_smithjoe_1246: one think that I think will help: reduce is a way to express a common kind of recursion where each step you make a sequence shorter, and update a "accumulator" or "result" var
10:58danlentzI've been playing with vinyasa. Convenient idea of "." as a default namespace to inject useful functions
11:18noncomdanlentz: wow, vinyasa is cool
11:19danlentzThere have definitely been some changes since 0.2.0 which was the last time I looked at it
11:20noncomi see it for the first time and it kinda contains lots of functional i have been dreaming of but had no time to implement
11:20noncomvinyasa not only implements it, but does that vey stylishly
11:21Lutin`I'm going to go insane..
11:21danlentzAlthough the setup as described on the website seems to omit the Apache commons http client dependency
11:21Lutin`Writing a distributed programming system in APL
11:21clojurebotTitim gan éirí ort.
11:21Lutin`someone shoot me
11:21noncomdanlentz: hmm, i also see, the last commit was like 8 months ago?
11:22noncomLutin`: what do you mean? you had a bad dream? :)
11:22Lutin`no this is my current job haha
11:22noncom8O
11:22danlentzI really don't think that is a useful way to evaluate software
11:22Lutin`math professor at my uni is only comfortable with APL and wants to turn some of his APL programs into distributed ones
11:24danlentzIf people are using it and it has been stable, why consider that a defect?
11:26noncomdanlentz: you mean what? apl?
11:26danlentzOf course, I'm coming from common-lisp, where some of the packages are so old they actually use dust as part of the syntax
11:26noncomLutin`: i will be surprised if apl can support any sane networking at all
11:27Lutin`It's basically a thin layer over the winsocket api
11:27Lutin`oh yeah I forgot to mention the APL distribution he uses is windows only
11:27danlentznoncom: no, I mean just because it hasn't been recently updated isn't necessarily a bad omen
11:28Lutin`noncom: he was talking about vinyasa
11:28Lutin`I believe
11:28noncomdanlentz: ah, yeah, i agree. especially that sometimes there is just not that much to improve, if all is working good already
11:30noncomLutin`: there is a project: https://github.com/shaunxcode/apl-to-clojure
11:30noncombut.. it never was finished...
11:30Lutin`hahahahahaahahaha
11:30Lutin`my sides!
11:31Lutin`ahhhh
11:31Lutin`that's exactly how I feel right now
11:32noncom:)
11:32justin_smithhaha
11:33Lutin`the worst part is it pays pretty well
11:33Lutin`but it takes so much work just to convince myself to start working on it haha
11:33Lutin`I have to do version control by hand..
11:33noncomomg...
11:33noncombut, actually, APL is not that bad in itself..
11:33justin_smithwait, you aren't allowed to use a vcs? couldn't you be sneaky and use one in secret?
11:34Lutin`But how?
11:34justin_smithnoncom: agreed, it has some nice higher level abstractions for arrays
11:34oddcullyjust use git on your own box and be done with it
11:34Lutin`The files are a proprietary binary format
11:34oddcullyno one need to know. we won't tell
11:34noncomalso, this is the modern flavor of it that i have most experience with: http://www.jsoftware.com/index.html
11:34Lutin`I literally cant even
11:34justin_smithLutin`: you can put binary objects in source control (it's just not as helpful as text, of course)
11:34oddcullyyet you can commit your stuff
11:35oddcullywould give you bisect etc
11:35Lutin`yeah
11:35Lutin`I mean that's basically what I'm doing, but it just means I don't really get diffs
11:35danlentzI looked at J but had a hard time memorizing all the mountains of syntax that had no mnemonic recognition to me
11:35justin_smithLutin`: I had no idea about the proprietary format. Who thought this would be a good idea?
11:36noncomyeah. i think that J would be great if all of its operators be turned into pictures so you could play with them like a combinatorics game
11:36Lutin`The same people who charge $1,750 for a 2 year license
11:36danlentz(J is I think the successor to APL?)
11:36Lutin`J is the spiritual successor
11:36noncomLutin`: yeah, sort of
11:37Lutin`tbh I like APL's character set :X
11:37noncomthere is also K, but it is highly commercial and mainly used in database things
11:37Lutin`Easier to read at a glance than J
11:37noncomcoz them are pictures :)
11:37noncomnot punctuation signs like in J
11:37Lutin`But this damn version of APL doesn't even have lambdas
11:38noncomwhooa
11:38Lutin`And I think they added multithreading last year
11:38Lutin`but it's not even what you would think
11:39noncomdoes this APLs flavour have awebsite?
11:39Lutin`http://www.apl2000.com/index.php
11:39Lutin`"(Note: The Google Chrome browser is not supported.)"
11:39oddcullycool name ;P
11:39Lutin`That's actually on their site
11:39danlentzApl2000 -- sounds... Um... Modern.
11:40Lutin`Yeah the company and APL2000 and the software is APL+Win
11:40danlentzWay better than APL1973 I guess
11:40Lutin`and their form of multithreading is called APLNextSupervisor
11:41Lutin`but what it really does is start up several versions of apl and then acts as a message bus
11:41Lutin`several 'workspaces'
11:42noncomthere are still weird creatures left on the face of the earth since the age of giants.. and they walk under the sun, ever looking for a place to rest...
11:42Lutin`I wish they would just die already
11:42Lutin`the software, not the people!
11:42noncom:D
11:42justin_smithLutin`: shared-nothing concurrency is a solid model
11:42clojurebot'Sea, mhuise.
11:43danlentzSend them all to New Jersey
11:43justin_smith~Lutin`: shared-nothing concurrency
11:43clojurebotLutin`: shared-nothing concurrency is a solid model
11:43justin_smithhaha
11:43justin_smithclojurebot: weirdo
11:43clojurebotPardon?
11:43Lutin`justin_smith: well yeah that's what I'm doing for this distributed system
11:44Lutin`It's just that it's not like a library
11:44danlentzDo you have "green threads"?
11:44Lutin`It's a separate program with a separate install and license
11:44Lutin`danlentz: hahahahahaha
11:44Lutin`what is a thread
11:44justin_smithyeah, just saying, there's not too many steps from that to something much like core.async for example
11:44Lutin`justin_smith: it's not the underlying model I have a problem with, it's the execution
11:44danlentzYes, like some form of cooperative multitasking
11:45justin_smithLutin`: oh, if they implemented it badly haha yeah
11:45justin_smith"forget your mind and you'll be free"
11:45Lutin`I mean I'm basically writing what their thing probably does
11:45Lutin`but he doesn't want to upgrade to the most recent version
11:45Lutin`so we're on the one from 2009
11:46Lutin`anyways I shouldn't spend too much time complaining
11:46Lutin`I have a meeting in about an hour
11:47justin_smithLutin`: clearly this is time to turn off brain and excrete APL code
11:47noncomLutin`: well, I hope you will gain some secret abilities and some higher understanding on your way in that land..
11:49Lutin`well I've learned that people still use labels and gotos
11:49clojurebotPardon?
11:49Lutin`I know right cljbot?
11:55timvisheranyone using alembic with private repositories? is that supposed to work?
11:56justin_smithtimvisher: I know it takes optional args to specify the repo to use
12:00timvisherjustin_smith: ok
12:01justin_smith`:repositories`: specify a map of leiningen style repository definitions to be used when resolving. Defaults to the repositories specified in the current lein project.
12:01justin_smithit uses the same syntax as lein for specifying repositories
12:02justin_smithso if you can use the private repo from lein, you can likely use it with alembic
12:02justin_smith(that was from the doc string from alembic.still/distill)
12:03timvisherthis is the stack i'm getting https://gist.github.com/timvisher/ca838b094c9415d59323
12:03timvisheryeah, i would think that if lein can resolve it, alembic should be able to resolve it
12:04justin_smithtimvisher: odd. I haven't used private repos so I can't speak to this specific issue, but I would have expected it would work. Maybe cemerick is around and has more to say about the issue?
12:05timvishercemerick: ooo! erc says he's online. :)
12:05timvisherdoes hugo duncan ever hang around here?
12:06justin_smithtimvisher: I remember seeing him in #clojure-emacs more often, when I was in there
12:06timvisherthat's true.
12:06timvisheri have seen him there a couple of times
12:06justin_smith$seen hugoduncan
12:06lazybothugoduncan was last seen quittingPing timeout: 264 seconds 1 week and 2 days ago.
12:08hugodjustin_smith, timvisher: I'm more often here as hugod
12:08justin_smithaha!
12:08Lutin`hehe
12:08timvisherwhoa! :)
12:09timvisherhugod: any knowledge on whether alembic should work with private repos?
12:09timvisheror if the stack i posted a little while ago indicates a problem in that area?
12:11hugodtimvisher: seems that the constructor pomegranate is expecting to use hasn't got the expected signature - not sure if that is just an aether version issue, or something wrong with the arg types alembic is passing, or some other issue with pomegranate itself
12:12timvisherhugod: neat :)
12:12hugodthe easiest might be to check what alembic is passing to pomegranate, and compare it to what lein passes
12:13hugodassuming the repo works with lein
12:13justin_smithsomething like (alter-var-root #'f (fn [f] (fn [& args] (conj debug args) (apply f args)))
12:14justin_smithactually that conj should be a (swap! debug conj args)
12:14justin_smithof course
12:19Bronsa1.7.0-alpha6 is out
12:19justin_smithI decided to try that locally - ended up altering a function called by apply
12:19justin_smithwhich was fun
12:20justin_smithBronsa: awesome
12:20Bronsacomes with lots of new goodies and bug fixes :P
12:20mavbozoYESSSS!!!
12:20mavbozo(inc Bronsa)
12:20lazybot⇒ 101
12:21Bronsamavbozo: I didn't release it but thanks for the internet points I guess :P
12:22justin_smithBronsa: it's the opposite of shooting the messenger
12:22justin_smithBronsa: if you'd told us clojure was being discontinued, he would have dec'd you instead
12:23timvisherjustin_smith, hugod: good points all around. maybe i'll mess with it later. i hate closing my repl :)
12:29justin_smithtimvisher: clearly, or you wouldn't be using alembic
12:36vasHi. I'm trying to store the results of a function. When I try invoking (memoize) and then later trying to get a value using 'nth' it says operation not supported. any ideas?
12:39timvishervas: post a paste :)
12:39justin_smithvas: that's not how memoize works
12:40aduvas: off-by-one? maybe?
12:40justin_smithvas: memoize returns a new function, it does not modify the function you supply. And it doesn't result in something you can call nth on.
12:41vasjustin_smith: aha. thanks
12:41vaswell, perhaps i can just describe what i wish to achieve, i'm not attached to any particular implementation at the moment
12:41vasfxn does a datomic query and has nine elements. how can i make sure i only query when the list is empty and not when it has stuff already?
12:42justin_smithvas: would it suffice to query when you first look for results, and reuse the result next time?
12:42justin_smithvas: if so (def query-results (delay (query ...)))
12:42justin_smiththen access as @query-results
12:42justin_smithfirst time you access, it will do the query
12:43vasthe query should be repeated every page refresh. but it should not happen multiple times during a page rendering, which is what's going on now
12:43vashmm. that could work. maybe i can unset a flag when all the things are rendered to query again and use @results again for the next time
12:44noncomdo you know of any working MUDs created in clojure?
12:44justin_smithvas: inside your page rendering, use let over a delay
12:44justin_smithvas: thus, when the page is rendered again, you get a new result
12:45vas(delay ) is new to me. shall investigate ^_^
12:45justin_smithnoncom: I've fantasized about making one, but as a recovering addict I cannot safely approach such a thing
12:45vasthank you brave parenthetical knight justin_smith et. al
12:45noncom:D
12:45justin_smith,(def a (delay (do (println "realizing") 42)))
12:45clojurebot#'sandbox/a
12:45justin_smith,@a
12:45clojurebotrealizing\n42
12:45vaswhat's a mud?
12:45justin_smith,@a
12:45clojurebot42
12:45justin_smithvas: like WoW but no graphics
12:45justin_smithtextual interface
12:46vasoh like nethack?
12:46noncomhttps://en.wikipedia.org/wiki/MUD
12:46vasbut multiplayer o.O?
12:46justin_smithno, that's ascii pictorial
12:46justin_smiththis is just textual
12:46justin_smithand multi-player
12:46justin_smithlike multi player zork
12:46vasi need some ... textual heaaalin
12:46noncomnethack is more like a top-down, while mud is more book-text like
12:46justin_smithhaha
12:46noncomalso, there is something like tradewars2002...
12:46noncomwhich is a different sort..
12:47vascool!
12:47justin_smithmud's are very addicting, much like any of those multiplayer online rpgs
12:47justin_smithmy intro to programming was largely automating mud clients
12:47noncomvas: just in case if you're not afraid to get lost http://www.mudconnect.com/
12:48justin_smithit's straightforward, because input and output are all text, right...
12:48vas*falls into rabbit hole*
12:48justin_smithmy first experience with race conditions was trigger actions that could trigger again before the previous was done responding :)
12:48justin_smithI "invented" debouncing
12:48justin_smithlol
12:49vas,@a
12:49clojurebot42
12:50noncomjustin_smith: cool!
12:51vasdelay is super cool! :D
12:55vasthanks for your help fellow clojurians/pros/homies/neophytes/dungeon masters
12:55vasgrow the love
12:55noncomwelcome! :)
12:56justin_smithnoncom: eventually I was around long enough, and trusted enough, that I became one of the immortals that built the mud. There were "mprogs" that allowed scripted actions within the game engine, but they had no math operators.
12:57justin_smithnoncom: I implemented a virtual machine to do math, using rooms as registers, and objects as bits (one object represented 1, another represented 2, another 4, etc.)
12:57justin_smithwhen they saw what I did (and that it worked) they promoted me to developer and gave me access to the code base
12:57noncomha :) very clever
12:57justin_smithlol
12:57noncomwow!
12:57noncomthat wac c/c++ i suppose?
12:57justin_smithc
12:58justin_smiththis was ages ago
12:58noncomhey, but you were like neo!
12:58justin_smithhaha
12:58noncomyou saw the reality as code and started programming with it
12:58justin_smithyup, yup
12:59noncoma very good story, i like this kind
12:59noncomthey bear something transcendental within
13:00danlentzso in order of efficiency: unboxed objects, boxed objects, rooms with boxes of objects.
13:01TimMc(inc danlentz)
13:01lazybot⇒ 3
13:02talvdav-lt-irchi
13:02talvdav-lt-irc/j #lighttable
13:02talvdav-lt-ircsry
13:07noncomjustin_smith: i think about creating something mud-like, using neo4j, how do you think, is this meaningful?
13:08danlentznoncom: you should look at a book called "Land of Lisp"
13:09danlentzit is in common-lisp, but it will walk you through a series of exercises to build your own MUD
13:09danlentzit is also a really funny, weird, inspired piece of art
13:10danlentzbut it doesn't necessarily give you the best introduction to common-lisp best practice
13:10noncomoh, i saw this title, yeah, the website look intriguing :)
13:10noncomneed to look into it
13:11danlentzThe guy who wrote the book is not only a talented artist and developer, but also a very highly regarded kidney surgeon
13:12danlentzis it really necessary for people to be genius at THREE different things? I mean, come on. After two isn't it just showing off?
13:12justin_smithnoncom: where neo4j would be the persistence layer for all the game object state?
13:13justin_smith(inc danlentz)
13:13lazybot⇒ 4
13:13justin_smithfor the "rooms of boxes of objects"
13:14justin_smithdanlentz: yes, it was very inefficient, luckily all I was doing was multiplying a number by two
13:15danlentznoncom: basically everything from chapter 5 on is about "building a text adventure game"
13:16danlentzGrand Theft Wumpus
13:16bjathe author of land of lisp has an interesting renaming of defmacro as defspel
13:16danlentzthat works based on a structural representation of a graph using cons cells and symbols
13:16justin_smithdanlentz: they figured out that I was less dangerous if they gave me access to a real programming language, rather than the odd mprog hacks I used to force it to be turing complete. At least they could understand C code
13:17noncomabout being genius in many things: i remember someone, probaly tim leary, said "intelligence of a person can be expressed as the number of worlds this person can live in simultaneously"
13:17bjaI don't know if it'd be better or worse for me at work if I talked about writing spells vs writing macros
13:17timvisherjustin_smith: sometimes i miss my medievia days :)
13:17timvisherbut i'm too obsessed with nethack to play much else these days
13:17justin_smithheh, I have to avoid that too
13:17justin_smithI get sucked in
13:17timvisherjustin_smith: badly :)
13:17timvisherweren't we talking about time managament the other day? ;)
13:18bjatalking about time management in IRC?
13:18timvisherbja: that's somewhere in the definition of meta right?
13:18justin_smitheveryone knows time is the hardest thing in computer science
13:19bjaI saw that the spacemacs distribution of emacs that I use has irc client bindings now. That is the absolute last thing I need if I want to stay employed. At least now I can alt+tab away from xchat into a full-screen emacs and forget about everything but code.
13:21noncomjustin_smith: yeah, well, objects relations. the world of a mud is literally built of relations..
13:21justin_smithnoncom: indeed
13:21justin_smithand the map is a graph, where rooms are nodes and exits are edges
13:22noncomand objects too
13:22noncomthey are "in" something
13:22justin_smithand objects / players / mobs are three other kinds of edges
13:22justin_smithright
13:22noncomor room has some "objects" like exits and so on
13:22justin_smithnoncom: the mud I played had a NULL room, so bugs would make people end up there
13:22timvisherbja: i have an emacs instance running on a server that i mosh to for irc, and i have a dedicated virtual desktop with nothing but that on it
13:22justin_smithit was the room with id=0
13:22timvishermakes it easy to avoid if i need to/easy to get to if i want to :)
13:23justin_smithnoncom: our version of NPE were often a player letting us know they were stuck in "the void"
13:23timvisheri'm working on getting a notification system together that will remote notify me if i'm inactive for some period of time but erc's server status hooks are a little buggy/hard to discover :)
13:24sobelis there a first-nth? i want something like nthrest for the first n
13:24justin_smithsobel: take
13:24justin_smith,(take 3 [:a :b :c :d :e :f :g])
13:24clojurebot(:a :b :c)
13:25sobelty
13:29noncomjustin_smith: haha, that's nice :)
13:29noncomhaving a null room
13:30justin_smithnoncom: I think you could likely avoid the need in a clojure based mud
13:30noncomwhy?
13:30justin_smithnoncom: because the only way for a player to end up in null was a race condition (an exit still exists, the target does not)
13:30clojurebotnoncom: because you can't handle the truth!
13:30justin_smithhaha
13:30noncom:D
13:31justin_smithor for the room to get deleted while the player was still in it
13:31justin_smithclojure can ensure these sorts of inconsistent states are not possible
13:32noncombut you said about avoiding the need in clojure based mud - what that means?
13:33justin_smithnoncom: by using the clojure mutable containers
13:33justin_smithatom, ref, agent etc.
13:34justin_smiththey can ensure that you don't get inconsistent states like players in rooms that don't exist, or exits existing but the destination room does not, etc.
13:34noncomah, i thought you said "avoid the need in mud"
13:34noncomyeah! i think clojure can give many benifits
13:34noncomesp when used with a graph db
13:35justin_smithyeah
13:35justin_smithI'm sure it would open up a lot of interesting possibilities
13:35justin_smithI could see using atoms for things relevant to all players, and refs for other things, and per-room transactions
13:36justin_smith(for things like exchanging items)
13:36justin_smithanother classic pair of bugs: the object duplication and object destruction bugs. Either can ruin your game (players getting free items, players losing valuable items, players scamming nice items by claiming they had one and it was destroyed...)
13:36BinaryResultQuick reminder that we are hiring clojure devs https://docs.google.com/document/d/1GvnrSCUbYgbY9XdFs_DUx-0QZG2bIYT8Mbr0zdpTeew/edit?usp=sharing
13:36justin_smitha transaction can ensure that you don't get duplicate objects, and you don't lose them
13:39malthenewbie question: can I use httpkit to power a server that I start with $ lein ring server-headless
13:40justin_smithmalthe: no, lein-ring uses the embedded jetty server
13:40maltheoh okay
13:40noncomjustin_smith: yeah, concurrency would be handled just fine!
13:40malthehow do I start httpkit's server through lein then?
13:40maltheor is that not a recommended way.
13:40justin_smithmalthe: but you can make a -main method in your primary ns, and launch the http-kit server there
13:40justin_smithit's not super complicated
13:40maltheno, I see that they do that in the examples.
13:40maltheI just wondered if the more "declarative" approach was better.
13:40malthelike we call you, don't call us :-)
13:41noncomalso i think that gtraph representation will give many possibilities in manipulating the world
13:41justin_smithmalthe: the advantage of lein-ring is if you are deploying to a container
13:41justin_smithmalthe: with http-kit, you are not deploying to a container
13:41maltheright
13:41maltheawesome, thx a bunch
13:41justin_smithmalthe: with a container, you wouldn't want your code to embed a server, because in soviet aws, container embeds you
13:41justin_smithI should stop trying to make jokes
13:42noncomhaha :)
13:44korpse_Is there something like partition-by but omitting the partitioning element?
13:44timvisheris it possible to disable {:pre [] :post []} conditions at run time?
13:44justin_smithtimvisher: yes https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L259
13:45timvisherah! there it is :)
13:45justin_smithor you can similarly initialize those variables from your -main for uberjar
13:45timvisherthanks :)
13:45justin_smithnp
13:45timvishercan i mess with that var at the repl?
13:45justin_smithtimvisher: sure, but because of how dynamic vars behave, some code can escape the dynamic scope
13:46timvisherah
13:46justin_smithso it's more reliable to set it from the very root
13:46malthejustin_smith, hehe yeah ... trying to get my feet wet with clojure, coming from slow Python for 10+ years.
13:46justin_smith(which lein can do, or in an uberjar, -main can do)
13:46malthethere's a bit to learn.
13:47justin_smithmalthe: yeah, that's true - there's a mix of our unique fp stuff to learn, and our lispy heritage, and the jvm stuff, and the wonderful inventions/ tasteful borrowings of rich hickey from other langs and research...
13:47justin_smithso there is a lot that will be unfamiliar
13:48justin_smitha veritable gumbo of learning
13:49timvishertasty…
13:50maltheright
13:50malthejustin_smith, but its pretty fast.
13:50malthewhich is a good motivation :-)
13:51justin_smithalso, despite all the new things to learn, it is more self-consistent than most
13:54sobelare there take and nthrest that don't return lazy-seqs?
13:55gfrederickswhat else would they return?
13:55justin_smithsobel: subvec, kind of, if the input is a vector
13:55sobeljustin_smith: that's probably what i'm looking for
13:56justin_smithsobel: subvec is a little weird though, but it's fast if you can fit its constraints
13:57malthewhat's this mean: No such var: response/url-response
13:57gfredericksmalthe: do you have "response/url-response" in your code somewhere?
13:57malthenope
13:57malthegoogled around and it suggests bad dependencies
13:57justin_smithmalthe: could be a bug in some lib you are using
13:58gfredericksmalthe: could be, check the output at the top of `lein deps :tree`
13:58gfrederickswhich will tell you about conflicts
13:58justin_smithmalthe: basically it's saying that someone is trying to use a var in another lib, and the lib did not define that var
13:58maltheoh ok
13:59justin_smithand yeah, gfredericks has the best idea - it could be a newer / older version is there than expected, which doesn't have the var
13:59justin_smithand lein deps :tree will show where that is happening
14:00malthehmm I'll try and play with it
14:12borkdudewhat's a good irc channel to ask a question about s3 file uploads?
14:20justin_smithborkdude: dunno, but I've done it extensively from clojure
14:21justin_smithusing clj-aws-s3
14:24borkdudejustin_smith I was wondering if it's possible to delete a bunch of files with the same prefx
14:25borkdude*prefix
14:25borkdudejustin_smith like /foo/bar/...
14:25justin_smithhmm... I haven't tried, but I'll check the api
14:26borkdudejustin_smith do you also use direct upload with s3?
14:26justin_smithborkdude: yeah, and I forked clj-aws-s3 to allow uploading from an outputstream even if I don't have a file
14:27borkdudejustin_smith from a browser I mean?
14:27justin_smithno, I did a stream from browser -> jvm clj -> s3
14:27justin_smithbecause otherwise I would need to give the client my credentials
14:27justin_smithunless there is some other clever option...
14:28borkdudejustin_smith you can use pre-authorized upload links to a form
14:28borkdudejustin_smith so the user can upload a file to a certain key
14:28justin_smithborkdude: this is news to me, and seems like a nice enough way to do it
14:29borkdudejustin_smith but this introduces a new problem: I want to keep track of the filename, because else next time I don't know what image to show to the user
14:29justin_smiththough my case was a cms, where it was still simpler to have the user send the media to the server (and do some things on the server side before uploading)
14:29borkdudejustin_smith yes, probably I'll do that too. did you use direct downloads though, or also via the server?
14:30justin_smithborkdude: I embeded s3 links in my html
14:30justin_smiththe uploads were for creating page content
14:31justin_smith(so the client uses the cms UI to create content, uploading the images to put on a certain templated page etc., then their visitor gets s3 links to that media in the rendered page)
14:31justin_smithwhich speeds page load because it parallelizes better
14:32justin_smithborkdude: would the thing you wanted with deleting a directory be covered by delete-bucket?
14:33justin_smithor do you want a more granular subdirectory within a bucket...
14:33borkdudejustin_smith subdirectory
14:34justin_smithyeah, at least clj-aws-s3 lacks that functionality
14:34borkdudejustin_smith I've now solved my problem by keeping track of who uploaded which file, for example a profile picture
14:34borkdudejustin_smith next time the same user uploads a profile picture I have to know which previous file to delete
14:34borkdudejustin_smith I'm saving the filename in a database
14:34justin_smiththat makes sense, in our cms we had a db reification of the asset, with the file name, what cms model it is attached to, and the location on s3
14:34justin_smithwhich is basically the same thing, yeah
14:35borkduderight
14:36borkdudejustin_smith also one thing I wanted to check: deleting file costs time, so I'm doing that in a future, does it make sense?
14:36justin_smithsure, I think so
14:37justin_smithsince your further actions don't depend on that completing, clearly
14:37justin_smithmaybe one concern would be finding out if it failed? you could check that future before function exit I guess
14:38justin_smithfailing to delete seems like something you could log and come back and deal with later
14:38justin_smithunless you expect masive user profile churn :)
14:38borkdudejustin_smith good one
14:38pandeirois it possible to have comments in yesql query files that yesql will ignore?
14:38borkdudepandeiro good question, I also want to know
14:39justin_smithpandeiro: I'd expect it to ignore sql comments, but I haven't had a chance to really play with yesql in anger yet
14:39justin_smithpandeiro: it explicitly allows comments https://github.com/krisajenkins/yesql#one-file-one-query
14:39cemerickjustin_smith, timvisher: I'm not *actually* here :-P What's the issue?
14:40justin_smithcemerick: timvisher had an issue with using a private repo via alembic (that was using pomegranate)
14:40borkdudejustin_smith that comments will be in the docstring
14:41borkdudejustin_smith do you also use pregenerated urls, or is everything public on your s3?
14:42justin_smithborkdude: we used default-public, you can set access when uploading
14:42justin_smithbut in practice we specified public every time
14:43pandeirojustin_smith: yeah so my question is how to create comments in SQL files used by yesql that are *not* query fn names or docstrings... some digging makes me think this use case is not supported
14:43cemerickjustin_smith: not sure I'd have any insights. Pomegranate is stable (i.e. I haven't looked at its code in > a year)
14:44borkdudepandeiro my question too, it seems a forgotten feature
14:44borkdudeI'm tending more and more towards jdbc only though..., especially for updates/inserts
14:44justin_smithcemerick: and private repos are known to work?
14:45pandeiroborkdude: yeah i often go that route too
14:45pandeirosqlingvo as well
14:45cemerickjustin_smith: yup, I have a number of them, and work with a few others that do as well
14:45justin_smithcool, so if anything this is an alembic bug
14:45justin_smith(until we can prove otherwise)
14:46cemerickjustin_smith: everyone uses https://github.com/technomancy/s3-wagon-private AFAIK
14:47mavbozo(inc technomancy)
14:47lazybot⇒ 163
14:48cemerickthe authentication mechanism is very flexible, but it's pretty hard to beat s3
14:50cemerickjustin_smith: oh yeah, and deploying to nexus-style repos (which might just use basic auth?) is as easy as having a :username :password map in ~/.lein/credentials.clj, etc
15:08danielamany idea what cider's tab completion isn't working? cider-repl-tab-command is set to cider-repl-indent-and-complete-symbol but I keep getting "No match" in the repl.
15:16alpheusHaving trouble compiling a Clojure/Clojurescript app on just one machine. Works everywhere else. I've removed .m2/repository, installed the same Java version and am out of ideas.
15:17alpheusI realize this is not a very good question, but I can furnish complete details if needed.
15:17arohneralpheus: define "trouble"
15:17alpheusOK to paste the exception?
15:17arohneralpheus: gist is better
15:17arohnergist.github.com
15:19alpheussure, one moment
15:20alpheushttps://gist.github.com/craig-ludington/2d8bf9804cbbc93731a9
15:21alpheusFWIW, the exception always refers to something in piggieback, but it's been a different source in the past. (Just upgraded JDK)
15:21arohneralpheus: 'Unable to resolve var: cemerick.piggieback/wrap-cljs-repl'
15:22arohnerI bet you either don't have piggieback installed locally, or it's the wrong version
15:22arohneralpheus: is there something in your ~/.lein/profiles?
15:22alpheusAh, good question!
15:22arohneralso, pointing out that line is far more helpful than "it doesn't work"
15:23alpheusSure, thanks.
15:37alpheuspiggieback was indeed out-of-date. Thanks for your help, and sorry for my vaguely-worded request for help.
15:40patrkrishi everyone. would someone here spend 30 seconds looking over a function I've written in Clojure that handles a Ring request. I am looking for pointers in improving the code to become more idiomatic. I'm used to working in languages where it's possible to do "early returns" and so on. here it is: https://www.refheap.com/99108
15:41justin_smithpatrkris: some more destructuring might help, eg min-days and max-days
15:42patrkrisjustin_smith: oh yeah, thanks
15:42justin_smithpatrkris: also, I would put the orders/update! call inside a when, separate from the calculation of the return value
15:43justin_smitheven if that when has the same condition as the response generation
15:43patrkrisjustin_smith: great
15:43justin_smithpatrkris: also, I think some-> might help some of your code be clearer
15:44justin_smithoh, never mind, that wouldn't help
15:44justin_smithI thought there was deeper chainging
15:44patrkrisjustin_smith: is the use of `when` right in your book to skip evaluation of code instead of having "early returns"? do you understand what I mean?
15:44justin_smith*chaining
15:44patrkrisokay :)
15:44justin_smithpatrkris: that is exactly what when is for - conditional side effects
15:45justin_smithsome-> can chain multiple when, stopping at the first nil
15:45justin_smitheffectively that is
15:45patrkrisjustin_smith: oh, clever
15:46patrkrisso that is the primary difference between a when and a one-clause if? (they have the same effect, but when is typically used for skipping potential side effects)
15:46justin_smithright
15:46justin_smithotherwise you could use and (to indicate the value is interesting - same semantics effectively)
15:47justin_smithwhere when is about the action, and would be about the value
15:47justin_smithso you may want to switch when to and on line 10 for example
15:47justin_smithand line 8
15:47patrkriscool, thanks
15:47amalloythat is kinda a political topic. i would leave it as a when, personally
15:48justin_smithyeah, it's not unanimous
15:48amalloysometimes i wonder if justin_smith is really technomancy in disguise
15:48justin_smithpatrkris: also, I think line 18 could cause problems
15:48justin_smithpatrkris: you should add :otherwise nil to the end of the cond I think
15:49patrkrishow about assigning `error` multiple times in the let form? is that kosher?
15:49patrkrisjustin_smith: okay, i'll check
15:49justin_smithpatrkris: never mind
15:49amalloyjustin_smith: :else nil is the default for cond
15:49justin_smithI always have a default
15:49justin_smithyeah, I just checked it, :else nil is implicit
15:49amalloyi do too, but you don't actually *have* to
15:49justin_smithI guess I am so conservative I forgot what actually works :)
15:49amalloyjustin_smith: i remember this causing some surprising issues with unboxed math
15:49justin_smithinteresting
15:50amalloystuff like (+ 1 2 (cond (even? x) 3 :else 4))
15:50amalloyresults in all the math being boxed, because the cond "might" fall off the end and return nil
15:50justin_smithbecause of an invisible fallover to nil
15:50justin_smithright
15:50justin_smithtricky tricky
15:50amalloyi don't remember if that was resolved or what
15:50patrkrishmmm... I thought it was nice not having to specify the default case in cond
15:51Bronsaamalloy: I have a patch in jira that fixes this
15:51justin_smithpatrkris: yet another thing that is basically style, I initially brought it up because I honestly forgot if lacking a default could lead to an error
15:51patrkrisalso since it is specified behavior as far as the docstring goes
15:51justin_smithyes
15:51patrkrisyes
15:52Lutin`I survived the meeting ;D
15:52justin_smithpatrkris: what's up with binding error twice?
15:52patrkrisjustin_smith: yeah, that is also one of my questions
15:52justin_smithpatrkris: that first binding of error will never survive to the end of the binding vector
15:52justin_smithbecause it is shadowed, so it will get thrown away as inaccessable
15:53patrkrisjustin_smith: you're right... stupid mistake :S
15:53Bronsaamalloy http://dev.clojure.org/jira/browse/CLJ-1598
15:53justin_smithpatrkris: I would make it data-error and order-status-error
15:53patrkrisnoted
15:53justin_smithand then check both in the if, or create error by or
15:54patrkrisgood idea
15:54gfredericksBronsa: before I looked at the ticket I thought "there's no good way to fix that problem" and then I looked and "oh of course that makes sense"
15:55justin_smithpatrkris: luckily it looks like this is nice and idempotent / functional, so you don't have to block side effects conditionally mid controller
15:55gfredericksthe cond macro itself could fix it too I suppose, but the if fix is more general
15:55justin_smitherr... handler, or whatever, I keep screwing up that terminology, I should know better
15:56patrkrisjustin_smith: I know what you mean :)
15:56patrkrisI guess what trips me up the most is, again, not being able to return early, like you would do in Go or other imperative languages
15:58justin_smithyou can get similar semantics via delay
15:58justin_smithand then simply not having a code path that accesses the delay as your "early return"
15:58justin_smiththough it is odder to read, especially at first
15:58justin_smithbut it ends up being similar to haskell's lazy evaluation in a way - things that don't get accessed don't get calculated
16:02patrkrisjustin_smith: thanks again. I would like to see some "enterprise software" written by The Masters sometime. one thing is watching Rich Hickeys codeq, which has a fairly technical problem domain - another is to see Clojure used to write enterprisey, boring software.
16:03tbaldridgepatrkris: you might be interested in this Clojure/West talk then : http://clojurewest.org/speakers#amarcar
16:04patrkristhanks, will check it out
16:04patrkristbaldridge: do you know when/if it will be online?
16:05tbaldridgepatrkris: not sure, but the past few conferences puredanger has put on have hand same or next day video releases
16:05clojurebotExcuse me?
16:05tbaldridge*have had
16:05patrkrisnice
16:06rhg135ooh I forgot clojure/west was coming up
16:06tbaldridgewhen I gave my talk at ClojureWest last year I think the video was online 3 hours after I gave the talk.
16:07amalloyyeah alex has been amazing with the videos
16:10gfredericks(inc puredanger)
16:10lazybot⇒ 40
16:34sobeli've gotten lots out of Conj videos. i just wish PostgreSQL confs had the video support y'all did.
16:35sobelbut i definitely soak up a lot from the clojure channel on youtube
16:45vermaanyone here used nightcode on a osx system, can't figure out how to get the paredit shortcuts to work :(
17:28mavbozoi get some weird exception from destructuring using 1.7.0-alpha6
17:28mavbozohttps://www.refheap.com/99113
17:28gfredericksI don't think you're supposed to expect that to work in general
17:28mavbozoam i doing destructuring wrong?
17:29gfredericksyeah I wouldn't use other keys in the :or expressions
17:30mavbozo,(let [{:keys [b a] :or {b (or a :b)}} {:a "A" :b "B"}] [a b])
17:30clojurebot#error{:cause "Unable to resolve symbol: a in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: a in this context", :at [clojure.lang.Ut...
17:30justin_smith,*clojure-version*
17:30clojurebot{:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true}
17:32mavbozothat works in 1.6.0. what happened?
17:32amalloymavbozo: just random chance
17:32amalloy,(macroexpand-1 '(let [{:keys [b a] :or {b a)}} m])
17:32clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:32amalloy,(macroexpand-1 '(let [{:keys [b a] :or {b a}} m]))
17:32clojurebot(let* [map__95 m map__95 (if (clojure.core/seq? map__95) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__95)) map__95) b ...])
17:32amalloy&(macroexpand-1 '(let [{:keys [b a] :or {b a}} m]))
17:32lazybot⇒ (let* [map__46082 m map__46082 (if (clojure.core/seq? map__46082) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__46082)) map__46082) a (clojure.core/get map__46082 :a) b (clojure.core/get map__46082 :b a)])
17:35mavbozoit become somewhat close to certainty in 1.7.0-alpha6
17:36Bronsamavbozo: try the one that's working in 1.7.0-alpha6, in 1.6.0. I bet it won't work
17:36amalloymavbozo: maps aren't ordered, so the order in which :or destructuring happens is undefined
17:37amalloyif you refer to bindings which may or may not exist, you get code that may or may not compile
17:38mavbozonot working in 1.6.0
17:39mavbozothx guys
17:39pmonks(inc Bronsa)
17:39lazybot⇒ 102
17:39dxlr8ris there a library for sending signals to running application in clojure? I use the great clojure.tools.cli library to send arguments on the command line, but would like to send the application more data from my commandline at runtime
17:39mavbozo(inc amalloy)
17:39lazybot⇒ 247
17:39mavbozo(inc Bronsa)
17:39lazybot⇒ 103
17:42mavbozothat's why carmine breaks https://github.com/ptaoussanis/carmine/blob/v2.9.1/src/taoensso/carmine/connections.clj#L55-L59
17:43gfredericksmavbozo: I can sense a pull request in carmine's future
17:44bbloom_guys. i'm writing some go for work... i miss you
17:44pmonks(dec bbloom_)
17:44lazybot⇒ 0
17:44bbloom_,(class (max 5 10))
17:44clojurebotjava.lang.Long
17:45gfredericksbbloom_: what is an "int max"?
17:46bbloom_gfredericks: the signature of go's max function is Max(float64, float64) float64
17:46gfredericksoh god
17:46bbloom_there's no Max(int, int) int
17:46amalloybbloom_: sounds like java's
17:46bbloom_amalloy: java has double, float, int, and long overloads
17:46gfredericks,(class (Math/max 5 10))
17:46clojurebotjava.lang.Long
17:46pmonks(dec go)
17:46amalloyoh i'm wrong
17:46lazybot⇒ -1
17:47dxlr8rany way to send signals to a running jvm running clojure without having some sort of socket server etc?
17:47dxlr8rlike sending signals with "kill"
17:47amalloydxlr8r: my advice would be to use a socket server
17:47Bronsaamalloy: you can still save it by claiming you meant javascript
17:47gfredericksdxlr8r: there's a thing with a SignalHandler somewhere
17:47amalloybbloom_: i guess i was thinking of Math/exp
17:48gfredericksdxlr8r: this worked for me for casual usage, no idea what the drawbacks/pitfalls are https://github.com/clojure/test.check/blob/gfredericks/prng-comparison/src/dev/clojure/clojure/test/check/prng_comparison.clj#L8-11
17:48hyPiRionbbloom_: Have you seen http://golang.org/pkg/bytes/#Map ? :p
17:48bensubbloom_: I'm curious about go routines composition
17:49bbloom_hyPiRion: weeeee
17:49bbloom_bensu: after a fair amount of core.async experience... i'm not a huge fan of CSP. a little dab will do ya
17:49bensubbloom_: in Go the compiler can make a state machine out of the go routines of arbitrary depth
17:50bbloom_bensu: no that's what core.async does
17:50bbloom_ to be fair, go is much better than core.async in this regard
17:50bbloom_it can park full stacks
17:50bbloom_rather than finite state machines
17:50bensubbloom_: ok, that is exactly the sort of thing I'm interested in
17:51bensubbloom_: what else are you going to miss when you use core.async
17:51bensueven if it's not your favorite
17:53cluelessHey all. I'm stuck with this. http://pastebin.com/uGH57jb9. 'draw-world' doesn't work when being run from 'setup'. Even if I put prints inside there they aren't shown. Seems like the loop isn't even being run. I really can't figure out why. The function executes flawlessly when being run individually in the REPL.
17:54cluelessSo, help is very appreciated!
17:54gfredericksThis paste has been removed!
17:54gfredericksno it hasn't
17:54gfredericksthat was my fault for including the '.'
17:54gfredericks(inc computers)
17:54lazybot⇒ 1
17:55cluelessHmm?
17:55justin_smithclueless: draw-world is lazy
17:55justin_smithclueless: draw-world will do nothing unless you consume its values
17:56cluelessOh, right...
17:56justin_smithclueless: perhaps you should s/for/doseq/
17:56TEttinger(doc doseq)
17:56clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
17:56justin_smithclueless: also for and doseq both support a :let key in the binding vector, that can be nicer than a let block inside the body
17:57TEttingerif you do want a sequence of results, you can use doall
17:57justin_smithnested doall, for the nested for
17:57cluelessThanks a lot, really appreciated.
17:58cluelessWill try to wrap my head around this now!
18:05dxlr8rgfredericks: thanks, that actually worked :)
18:08weiI’m building a native java package using “mvn install” and confirmed it’s in ~/.m2/repositories/… However, I can’t seem to depend on the library using leiningen. Is there anything else I have to do?
18:08gfredericksdxlr8r: w00t
18:09gfrederickswei: how does it fail?
18:09weilein deps -> “Could not find artifact XXX in clojars"
18:10justin_smithwei: do the coords in your project.clj match the pom.xml that lein created and put under .m2/ ?
18:13weijustin_smith: I’m looking at maven-metadata-local.xml inside .m2, and the groupId, artifactId, and version all seem to match
18:13dxlr8rgfredericks: only problem is that it won't compile with uberjar
18:13gfredericksdxlr8r: uhmwhat?
18:14dxlr8rjava.lang.IllegalArgumentException: Signal already used by VM or OS: SIGUSR1, compiling
18:15gfredericksdxlr8r: are you running it at the top level like in my code?
18:15justin_smithwei: can you share the pom.xml and the relevant line from your project.clj in a paste?
18:16justin_smithsorry, not pom.xml, but foo.pom
18:16justin_smithit will be in the dir with the jar
18:16weijustin_smith: thanks, give me a sec
18:17dxlr8rgfredericks: yeah
18:17dxlr8rjust after ns
18:17gfredericksdxlr8r: maybe throw it in a function and call it from your main then
18:20weijustin_smith: https://gist.github.com/yayitswei/134ac7d9f5d74b1cf74b
18:22justin_smithOK yeah, that looks just fine
18:22justin_smithand how are you accessing the lib?
18:22weiI’m just running lein deps
18:22justin_smithoh, .. .right
18:23dxlr8rgfredericks: same error :/
18:23dxlr8rcalling from main
18:23justin_smithand it's an error on the lib, and not one of its transitive deps? if so, that's super weird
18:24gfredericksdxlr8r: no ideas, I can't make sense out of that
18:24weijustin_smith: the error is Could not find artifact org.bitcoinj:bitcoinj-core:jar:0.13-SNAPSHOT in clojars (https://clojars.org/repo/)
18:24dxlr8rhttp://stackoverflow.com/questions/1050370/java-error-java-lang-illegalargumentexception-signal-already-used-by-vm-int found something there gfredericks
18:25dxlr8rbut I don't know how to input "-XX:-AllowUserSignalHandlers" to lein
18:25dxlr8rlein -> jvm
18:25weijustin_smith: the installed repo is in ~/.m2/repository/org/bitcoinj/bitcoinj-core/0.13-SNAPSHOT is that correct? why do some packages get installed in ~/.m2 and some in ~/.m2/repository
18:25justin_smithwei: that is so weird - maybe it has to do with the SNAPSHOT thing? maybe try lein install without the SNAPSHOT version suffix?
18:26justin_smithbecause there are behaviors associated with SNAPSHOT, like checking upstream once a day for a new version, even if you already have a version
18:26justin_smithso maybe change SNAPSHOT to pre-release (or something that differentiates from the true 0.13 stable, but isn't going to trigger a check)
18:27weii’ll try that, thanks
18:28gfredericksdxlr8r: lein has a :jvm-opts option, and after making an uberjar you'd specify it to `java` directly
18:33gfredericksstill weirds me out that the compiler can tell what kind of signal you're trying to handle
18:34justin_smithgfredericks: well, for proper behavior the signal handling would have to get promoted out of the VM directly into OS Syscalls...
18:34justin_smithand I guess it might as well whitelist those
18:38dxlr8rwell, got it to compile now with that flag to jvm-opts
18:59TimMcgfredericks: I'd be really curious what the bytecode difference is!
18:59seangroveWhenever I use ring.middleware.resource/wrap-resource in an uberjar and give it a uri of "/", it seems to think there's a file there
18:59seangroveThat sound familiar to anyone?
19:06gfredericksTimMc: it's a compile-time error is the thing
19:07justin_smithseangrove: so you are using (wrap-resource handler "/") ?
19:10dxlr8rI don't get it to run thought. not through "lein run" nor the uberjar
19:11dxlr8rsame error. have tried "java -XX:-AllowUserSignalHandlers file.jar" gfredericks
19:12gfrederickseliphino
19:16Lewixim looking for an alternative book to
19:16Lewixclojure programming
19:16justin_smithLewix: what are you looking for specifically?
19:16Lewix(i feel like it's moving too fast at times)
19:17Lewixjustin_smith: learn clojure from beginner to mastery ^^
19:18justin_smithhave you looked at clojure for the brave and true or clojure from the ground up online? I think they are both a little slower in pace / less dense
19:18dxlr8rhttp://www.4clojure.com/problems that to
19:19justin_smithoh, yeah, 4clojure and the clojure koans are good
19:21Lewixjustin_smith: i started with clojure for the brave then felt like it didn't dive deep enough - eventually bought the book as per your advise (i think)
19:21Lewixdxlr8r: I do the clojure koans sometimes
19:23seangrovejustin_smith: Nah, (my-wrap-resource "public")
19:23justin_smithLewix: yeah, probably my advice
19:23justin_smithseangrove: odd, I have not seen wrap-resources try to serve /
19:23seangroveOk, maybe I'm misunderstanding it
19:23gfredericksdoes anybody know of any differences between clojure string syntax and json string syntax?
19:24Lewix justin_smith did you read the book cover to cover
19:24justin_smithgfredericks: I think json supports \ in places clojure does not
19:24justin_smithLewix: no, not yet
19:25justin_smithLewix: to be honest, I had gotten a job doing Clojure, had never done it before, and I just crammed 3/4 of the book to get my bearings as fast as I could.
19:26Lewixjustin_smith: what books where they?
19:26justin_smithClojure Programming, and Joy of Clojure
19:26justin_smiththat plus a lot of dumb mistakes and eventually I figured it out
19:27Lewixjustin_smith: ok. I'll force through it -
19:29justin_smithI think trying stuff is under-rated. Just doing something (with the best advice you can find for not developing bad habits of course). You may have noticed, whenever someone shares some source code here they get helpful tips.
19:29justin_smithmake some things, ask questions, we can help you avoid the bigger mistakes
19:29justin_smithand make more things
19:32Lewixjustin_smith: good point
19:34dxlr8rgfredericks: for future referance: https://gist.github.com/nicoulaj/3758045
19:34dxlr8rdon't use SIGUSR1, I couldn't get it to work no matter what
19:36Lewixjustin_smith: i wanna make a web app = maybe i should read a web app clojure book instead and use programming clojure as reference along the way
19:40dxlr8rLewix: try sente
19:40dxlr8rgood web lib
19:41TimMcgfredericks: ...the hell.
19:42TimMcdxlr8r: Do you get the same compile error if you use "INTX".substring(0,3) or whatever?
19:43TimMcor rather, what does happen?
19:46Lewixdxlr8r: How about liminus - i might start reading web programming with liminus
19:48justin_smithWeb Development with Clojure comes from a source I would trust
19:49justin_smithLewix: in fact, it was written by yogthos
19:50Lewixjustin_smith: I know, I attend the clojure meetup sometimes - he's our prof
19:51justin_smithoh, cool
19:51dybaI'm trying to write a macro where I'm using a case statement
19:51Lewixjustin_smith: yea im gonna jump straight to the book and use programming clojure as ref
19:51dybaI'm thinking the better way to do it would be to use an if rather than a case statement
19:52justin_smithdyba: using a case statement to create the macro, or generating a case statement via a macro?
19:52dybaOh, generating a case statement via a macro
19:53justin_smithdepends how many conditions you plan on having I guess?
19:54dybajustin_smith: https://gist.github.com/dyba/1d9a3551e2bb9f75111c
19:56justin_smithdyba: would it be one defmacro generated per symbol / number pair?
19:57justin_smithoh, no, one macro (eg unit-of-time)
19:57dybajustin_smith: I just updated the gist to provide more info
19:57dybaI'm thinking maybe I need to ( apply case... )?
19:57justin_smithyou can't apply a macro
19:57dybaBut case is a macro
19:58dybaand I wasn't sure if you can treat macros like functions
19:58dybai.e. (map a-macro-here ...) fails
19:58justin_smithI think you'll want something like (case un# ~@units)
19:59justin_smith,`(case ~'x ~@[:a 0 :b 1])
19:59clojurebot(clojure.core/case x :a 0 :b ...)
19:59justin_smiththat's the right structure, yeah?
19:59justin_smithyou don't need the ~'x, that was for simplicity and you already have un#
20:00dybaright, ok. I'm going to try that out
20:23johnmendoncawhat does it mean when a name ends with #, like foo#
20:24gfredericksit's a macro thing; it makes sure the name is unique
20:24gfredericksin case there are other foos around when the macro expands
20:24johnmendoncagfredericks: gotcha thanks
20:25gfredericks,`foo ;; more accurately it's a ` thing
20:25clojurebotsandbox/foo
20:25gfredericks,`foo#
20:25clojurebotfoo__49__auto__
20:25gfredericks,'foo
20:25clojurebotfoo
20:25johnmendoncaseems like that would be common for symbol inside a macro?
20:27gfredericksmacros use that almost all the time, yes
20:27gfredericksit's difficult to not use it
20:27johnmendoncacool, macros are one area i have not dived into yet, slowing wrapping my head around quoting, splicing, etc
20:31gfredericks~macros
20:31clojurebotI added a ~' and it worked.
20:31gfredericks~macros
20:31clojurebotmacros are like dessert
20:31gfredericks~macros
20:32clojurebotI added a ~' and it worked.
20:32amalloygfredericks: i remember the first time i saw '~' in a macro
20:32amalloyand i was like, the guy who wrote this is off his rocker
20:36gfredericksI refuse to read any macro with nested `
20:36amalloygfredericks: you can need '~' without using nested `
20:36amalloy`(require ['~'foo.core ...]]
20:37amalloyand i dunno, in theory maybe `(require '[foo.core ...])) is fine because require just calls 'name on the namespace name, but i don't know if that's the case or what
20:37hyPiRiongfredericks: nested as in `(~@(foo `...)) or ``(..)?
20:42gfrederickshyPiRion: the latter
20:42hyPiRionthey don't make much sense I think
20:43gfredericksmaybe for macro macros
20:43gfredericksI know it's happened and that I'm ethically opposed to it
20:44hyPiRionIs it like triple pointers in C? Because I've not seen it yet
20:44gfredericksI bet if you looked through some ztellman code carefully enough...
20:46hyPiRionheh
20:54SeyleriusHere's my solution to 4clojure #50. Any ideas on how to make it non-ugly? http://sprunge.us/SdgJ
20:55amalloySeylerius: first thing that jumps out at me is to remove the repetition of (first remainder) and (rest remainder) all over the place
20:55amalloyalso your paste is cut off at the end
20:56Seyleriushttp://sprunge.us/OUYJ
20:58amalloySeylerius: on a larger scale, it is pretty sad to have exactly four special cases here? what if someone added, say, a map? or a list? you'd have to add another loop variable, another cond clause...
20:59Seyleriusamalloy: Yeah, that's why I don't like this solution.
20:59amalloySeylerius: have you looked at anyone else's solutions?
20:59SeyleriusNo.
20:59SeyleriusI try not to.
20:59SeyleriusAt least until after I've solved it at least once.
20:59amalloywell, consider the function (type)
20:59SeyleriusHrm.
20:59amalloywhich is hinted at by the problem title/description
21:00SeyleriusOoh. Just had a thought.
21:17justin_smiththanks for the warning
22:08justin_smithvas: on the opening day of Clojure / West I am going to see Acid Mothers Temple - this reminds me I need to see if there are any visiting clojurists who would be into going to that show.
22:09vasjustin_smith: dude sweet. what's one of your favorite songs by them?
22:10justin_smithI dunno about favorites, but this one is good https://www.youtube.com/watch?v=c7888r_vKX4
22:10vaswould "scope" be an appropriate term for the access a fxn has to its goodies?
22:11justin_smithSure. Also you can describe each of those goodies as being "closed over"
22:11justin_smithand call the whole thing a closure
22:11vasjustin_smith: yo thanks for the link! video is also suitably trippy and to my liking.
22:12vaslike an umbrella !
22:15vasare there alternatives to (shuffle) ?
22:16justin_smithalternative in what way?
22:17cflemingIs it true that for a splicing reader conditional, the list that gets spliced in must be a constant list, i.e. it's unevaluated?
22:17timgHi all, I got a noob question...
22:18amalloycfleming: i haven't been following jira or -dev or whatever, but: probably. the reader reads, not evaluates
22:18amalloyand compare it to, eg, the record literal syntax, which is unevaluated
22:18cflemingamalloy: That's what I figured, thanks - I'll see if someone can confirm
22:18timgIf I have a vector like (def x [+ 1 2 3]), is there a more idiomatic way to apply it than (apply (first x) (rest x)) ?
22:19amalloytimg: no. that's a weird vector to have, but if you do have it that's what you want to do
22:19timgOk, thanks cfleming.
22:19cflemingping puredanger
22:20cflemingtimg: You're welcome, but all thanks should go to amalloy there
22:20timgOh, sorry! Thanks amalloy.
22:21vasho snap vectors are FAST
22:21justin_smithvas: so what kind of alternative to shuffle did you have in mind?
22:22vasjustin_smith: well i only have 9 elements and I want to mix them up. shuffle works but adds quite a bit of overhead time (from 14ms to 189ms)
22:22justin_smithbased on the source, it looks like it's a pretty low level implementation
22:23vasAlright. I'll brainstorm it a bit. maybe I can achieve what I want later on in the process of rendering
22:23justin_smithyou could maybe look and see if someone has a fast alternative for java.util.Collections/shuffle
22:23justin_smithwhich is what it uses
22:24vasis there a way to have (nth-rand [collection]) never return a duplicate for a given coll?
22:24vasah good thinking
22:24amalloyi have a lazy-shuffle somewhere
22:24justin_smithalso, if the input was already an ArrayList or array, that would skip a step I guess...
22:26vas"After a little bit of Googling, I discovered that the Collections.shuffle() method uses the "Fisher-Yates" algorithm. This approach loops backwards over the array and swaps the current element with another randomly-selected element in the array. "
22:27vaswell it's not mission critical, thanks for your mind awareness anyway :)
22:27vasalso: acid mothers temple = amaze
22:29justin_smithI posted on facebook a while back, asking if anyone wanted to go to their concert. I guess Mitsuru Tabata had an alert or something, because he sent me a friend request. Now I get to see what he eats for lunch every day, because that's what he uses facebook for.
22:40vasjustin_smith: that's all-star
22:40justin_smithhe pretty much has curry or ramen every day
22:41cflemingCan anyone point me to the source in Clojure that handles the new #error and #object forms? I'd expected them to be in default-data-readers but they're not, and searching for "error" or "object" brings back a lot of results.
22:43justin_smithcfleming: here's the commit https://github.com/clojure/clojure/commit/692645c73c86d12c93a97c858dc6e8b0f4280a0b
22:44justin_smithoh, that only adds the printing part, huh...
22:44cflemingjustin_smith: Thanks, I missed that scanning the log
22:44cflemingjustin_smith: Yeah, you're right
22:45cflemingjustin_smith: Maybe that's not in master yet, if it's part of the socket REPL stuff
22:46amalloyfeature request: rename socket repl to rocket repl
22:46justin_smith,(Exception. "except")
22:46clojurebot#error{:cause "except", :via [{:type java.lang.Exception, :message "except", :at [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]}], :trace [[sandbox$eval25 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784] [clojure.lang.Compiler eval "Compiler.java" 6747] [clojure.core$eval invoke "core.clj" 3078] [clojure.core$eval3$fn__4$fn__14 invoke "NO_SOURCE_FILE" 0] ...]}
22:47justin_smith,(read-string (pr-str (Exception. "except")))
22:47clojurebot#error{:cause "No reader function for tag error", :via [{:type java.lang.RuntimeException, :message "No reader function for tag error", :at [clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180]}], :trace [[clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180] [clojure.lang.LispReader$CtorReader invoke "LispReader.java" 1164] [clojure.lang.LispReader$DispatchReader ...
22:47justin_smithcfleming: I think that is your answer ^
22:48cflemingjustin_smith: Looks like it, yeah
22:49cflemingIt seems like the lack of reading would make the printing fairly useless, doesn't it? Or am I missing something?
22:49justin_smithcfleming: it adds the option of defining a reader?
22:50justin_smithif you chose to
22:50cflemingjustin_smith: I guess so
22:50justin_smithor maybe 1.7 will have a reader, and it's just not in yet
22:50cflemingActually, I don't think you can do that for non-namespaced reader tags
22:51Seylerius,(defn type-splitter [coll] (loop [remainder coll result {}] (cond (empty? remainder) result (contains? (type (first remainder)) result) (recur (rest remainder) result) :else (recur (rest remainder) (conj result [(type (first remainder)) (filter (partial = (type (first remainder))) remainder)])))))
22:51clojurebot#'sandbox/type-splitter
22:51cflemingOr maybe you can, and you're just not supposed to, I forget
22:51Seylerius,(type-splitter [1 :a 2 :b 3 :c])
22:51clojurebot#error{:cause "contains? not supported on type: java.lang.Class", :via [{:type java.lang.IllegalArgumentException, :message "contains? not supported on type: java.lang.Class", :at [clojure.lang.RT contains "RT.java" 772]}], :trace [[clojure.lang.RT contains "RT.java" 772] [clojure.core$contains_QMARK_ invoke "core.clj" 1419] [sandbox$type_splitter invoke "NO_SOURCE_FILE" 0] [sandbox$eval96 invoke ...
22:51justin_smithcfleming: I'd guess it is just bad form
22:51justin_smithSeylerius: contains? doesn't work that way
22:52justin_smith,(doc contains?)
22:52clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
22:52SeyleriusGot the key and coll reversed.
22:52justin_smithSeylerius: if the input is a vector, the only thing that will return true is a digit arg
22:52justin_smith,(contains? [:a :b :c] 1)
22:52clojurebottrue
22:52justin_smith,(contains? [:a :b :c] :a)
22:52clojurebotfalse
22:52Seylerius,(defn type-splitter [coll] (loop [remainder coll result {}] (cond (empty? remainder) result (contains? result (type (first remainder))) (recur (rest remainder) result) :else (recur (rest remainder) (conj result [(type (first remainder)) (filter (partial = (type (first remainder))) remainder)])))))
22:52clojurebot#'sandbox/type-splitter
22:52Seyleriusjustin_smith: the input is a map.
22:53justin_smithOH, OK
22:53Seylerius,(type-splitter [1 :a 2 :b 3 :c])
22:53clojurebot{java.lang.Long (), clojure.lang.Keyword ()}
22:53Seylerius...
22:53justin_smithSeylerius: it's filtering for things that are equal to the type
22:53justin_smithisn't it?
22:54SeyleriusYeah. But I've got my type-filter wrong.
22:54justin_smithSeylerius: I think the issue there is nothing in the input is the type of anything else in the input
22:54justin_smiththough they share types
22:54SeyleriusYeah. I see what I mixed up.
22:55SeyleriusI need to put in an anonymous function that takes two things and returns true if they share types.
22:56justin_smithyeah, that sounds right
22:56SeyleriusAlso, I need to make an emacs function that squashes an arbitrary bit of clojure onto a single line.
22:56SeyleriusBecause that would make pasting in here simpler.
22:56justin_smithSeylerius: heh M-x one-line-defun
22:56SeyleriusOh R'lyeh?
22:56justin_smithno, that would be a thing to name it
22:56justin_smithit doesn't exist yet
22:57SeyleriusAh, well it will in a few minutes.
22:57SeyleriusMostly it just requires whitespace squashing.
22:57justin_smithSeylerius: join-line
22:57justin_smithit does the whitespace squashing for you
22:58justin_smithwith truthy arg joins with next line, otherwise joins with previous
22:59SeyleriusNeat
23:00justin_smithI have it bound to C-c j
23:00SeyleriusGood idea.
23:00justin_smithbecause I find it useful (even with my evil-mode J binding that acts in reverse)
23:00SeyleriusHrm. What's the #() function syntax for multiple args?
23:00Seylerius%1 and %2?
23:01justin_smithyup, and %& does what you might expect
23:01SeyleriusThat being all?
23:01justin_smith,(#(do % %2 %&) 1 2 3 4 5 6)
23:01clojurebot(3 4 5 6)
23:01justin_smithremaining ^
23:02SeyleriusNice!
23:03Seylerius,(defn type-splitter [coll] (loop [remainder coll result {}] (cond (empty? remainder) result (contains? result (type (first remainder))) (recur (rest remainder) result) :else (recur (rest remainder) (conj result [(type (first remainder)) (filter #((= (type %1) (type %2))) remainder)])))))
23:03clojurebot#'sandbox/type-splitter
23:03Seylerius,(type-splitter [1 :a 2 :b 3 :c])
23:03clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/type-splitter/fn--56>
23:04justin_smithSeylerius: I think you have extra parens on that lambda
23:04justin_smithalso, why are you passing a two arg predicate to filter?
23:04SeyleriusJust spotted that.
23:05Seylerius,(defn type-splitter [coll] (loop [remainder coll result {}] (cond (empty? remainder) result (contains? result (type (first remainder))) (recur (rest remainder) result) :else (recur (rest remainder) (conj result [(type (first remainder)) (filter #(= (type (first remainder)) (type %)) remainder)])))))
23:05clojurebot#'sandbox/type-splitter
23:06Seylerius,(type-splitter [1 :a 2 :b 3 :c])
23:06clojurebot{java.lang.Long (1 2 3), clojure.lang.Keyword (:a :b :c)}
23:06justin_smithSeylerius: ##(group-by type [1 :a 2 :b 3 :c])
23:06lazybot⇒ {java.lang.Long [1 2 3], clojure.lang.Keyword [:a :b :c]}
23:06SeyleriusOkay. Mostly there. Now I just returns the values of each key, rather than the map itself.
23:06Seylerius...
23:06SeyleriusR'lyeh? Srsly?
23:06justin_smithSeylerius: the former was still a good learning exercise
23:06SeyleriusI did not know that existed.
23:06justin_smithSeylerius: http://conj.io
23:07SeyleriusI just reimplemented group-by...
23:08justin_smithcongratulations
23:09Seylerius,(defn type-splitter [coll] (keys (group-by type coll)))
23:09clojurebot#'sandbox/type-splitter
23:09Seylerius,(type-splitter [1 :a 2 :b 3 :c])
23:09clojurebot(java.lang.Long clojure.lang.Keyword)
23:09Seylerius,(defn type-splitter [coll] (vals (group-by type coll)))
23:09clojurebot#'sandbox/type-splitter
23:09Seylerius,(type-splitter [1 :a 2 :b 3 :c])
23:09clojurebot([1 2 3] [:a :b :c])
23:09SeyleriusAnd win.
23:31TimMcSeylerius: Another "wait, that exists?" is frequencies.
23:31TEttingerI love frequencies
23:32arrdem(inc Seylerius)
23:32lazybot⇒ 2
23:32TEttinger,(frequencies (repeatedly 10000 #(rand-int 5)))
23:32clojurebot{0 2026, 2 1928, 3 2037, 4 1973, 1 2036}
23:32elvis4526I have trouble understanding futures and promises.
23:33elvis4526What happen if you try to access one of them before the computation is over ?
23:33TEttingerelvis4526, in my experience, they're awesome and handy
23:33TEttingerI think futures block if they haven't completed yet
23:33justin_smithelvis4526: it will wait until it finishes
23:33elvis4526alright that's pretty simple lol
23:33TEttingerthey're guaranteed to have some value
23:35TEttingerin a clojure dungeon crawler I worked on, I used futures for level gen. if you descended a floor, it would start generating the next level of the dungeon, which wasn't something that you needed immediately and was something that I didn't want to calculate immediately when it was requested
23:36TEttingerbut you also couldn't descend to a non-existent level, which is nice :)
23:36TEttingerif you somehow speed-demoned your way through a level to get to the next one, it would block until it had the next level finished and ready, which probably wouldn't be long
23:37elvis4526that's nice thanks for the example
23:37TEttingerplus, it was an amazingly elegant solution with clojure futures
23:37TEttingerI was thinking how hard it would be to do all that in another thread with java, not pretty
23:37justin_smithTEttinger: did you ever finish that crawler?
23:38justin_smithI guess the followup is "is a crawler ever finished?"
23:38TEttingertbh? I'm starting up a new one tonight. not graphical. going to use my quixotic 200 class project for data.
23:39TEttingerI decided I need a better handle on state to do what I want to be doing, and I can't do the kind of state shenanigans I want in C#
23:39TEttingerwell, not concisely
23:41TEttinger(and I think, despite not being very good with macros yet, I know how to write good Clojure better than I know how to write good C#)
23:46bbloomshit, i'm falling behind :-P
23:47justin_smithbbloom: time lag again?
23:47bbloomwho wants to submit a patch to fipp for #object and #error? :-)
23:48bbloomjustin_smith: apparently.
23:49bbloomit must be my machine or client, b/c i'm on a different ISP 2500 miles away from the last time i experienced time travel...
23:52TEttingerfipp?
23:52justin_smithbbloom: looks like you're OK actually
23:52justin_smith$ping bbloom
23:52bbloomi just closed & reopened my client
23:52justin_smithahh
23:52TEttinger$ping bbloom
23:52TEttinger$help ping
23:52lazybotTEttinger: Pings an IP address or host name. If it doesn't complete within 10 seconds, it will give up.
23:53justin_smithoops, wrong command
23:53justin_smithhaha
23:53bbloomTEttinger: fipp is a pretty printer i wrote. should get the new clojure 1.7 #error and #object things
23:53bbloombut i don't wanna write it right now :-)
23:55justin_smithahh, it's /ping user, and it will tell you the round trip time between you (and thus show any lag)
23:55justin_smith~0.7 seconds
23:55clojurebotIt's greek to me.
23:55bbloomdepends on your client
23:55justin_smithof course, yeah
23:55justin_smithbut there is an underlying CCTP ping op
23:56justin_smithwhich I guess some clients might not even respond to
23:56justin_smith*CTCP
23:56TEttingerwhat's the general convention on multiple-word project names? lein rejects DungeonRising, if I have a hyphen in there will I need to do shenanigans with replacing - with _ ?
23:56justin_smithTEttinger: not really, lein will generate the folder / files with the right deal
23:57bbloomTEttinger: come up with a better project name ;-)
23:57bbloomor just mash the words together
23:57bbloomor deal w/ the -/_ of doom
23:57justin_smithTEttinger: also, I recommend "lein new biz.TEttinger/dungeon-rising" (if you own TEttinger.biz)
23:57justin_smithI don't actually think you own a .biz
23:57TEttingerI believe I don't own any domain names
23:58TEttingerI get by with subdomain redirects to github pages if I desparately need a better URL
23:58justin_smithdungeon-rising: in clojure land, dungeon crawls you
23:58TEttingerhttp://doge.csproject.org
23:58justin_smithdogeon-crawl
23:59codesineI'm trying to do a radix sort in clojure and was setting up the buckets like
23:59codesine(take 10 (repeat []))