#clojure logs

2014-06-11

00:02ddellacostasneak_peek: no, just spit out the records as they are, is all I'm arguing for: {:users [{:id 1 :name "..."} {:id 2 :name "...}]} ...etc.
00:02ddellacostasneak_peek: and lean on your relational database's power. Or else use datomic. :-)
00:04sritchieddellacosta: we’re switching off heroku in the next month or so, then probably onto datomic
00:04sritchieexcited :)
00:05ddellacostasritchie: awesome! I have to admit I've barely touched datomic...but look forward to getting more into it.
00:05sneak_peekddellacosta: oh wow okay - now that is a radical idea. how does it work going int he opposite direction e.g. UPDATE's
00:05umpa(doseq [group (partition 3 (range 10))] (println group))
00:05umpahow do I get vertical seq from this grid ?
00:05devn,(map first (partition 3 (range 10)))
00:06clojurebot(0 3 6)
00:06devn?
00:06ddellacostasneak_peek: I mean, for that I don't have a great answer other than provide an API of the fields you want to allow users to update
00:06ddellacostasneak_peek: and then from there it's just your standard insert/update/delete
00:06ddellacostasneak_peek: for that CRUD stuff I think REST maps quite well and simply
00:08umpadevn: nice
00:08sneak_peekddellacosta: yeah youre right. I guess I'm trying to emulate https://stripe.com/docs/api/curl which bundles a lot of resources together to cut down on chatter. perhaps I'll design it differently. lots to think about
00:09ddellacostasneak_peek: well, let us know how it goes. :-)
00:09sneak_peekddellacosta: will do. thanks for all the help
00:09ddellacostasneak_peek: and yeah, I think KISS is a good principle to start with here. Sure thing, cheers!
00:26umpahow can i can get all of the 3 sets of vertical values into a partitioned list ?
00:35amalloyare you looking to transpose a matrix, umpa? ##(apply map list '((a b) (1 2)))
00:35lazybot⇒ ((a 1) (b 2))
00:38umpaamalloy: yep thats it
00:40umpahow do I get the diagonals of the grid into a list?
00:43umpathis grid ,(doseq [group (partition 3 (range 10))] (println group))
00:51TEttingerumpa, uh that isn't square
00:51TEttinger,(partition 3 (range 10))
00:51clojurebot((0 1 2) (3 4 5) (6 7 8))
00:51TEttingeroh yes it is
00:51TEttingerthinking of partition-all
00:51jonasenumpa: something like (map nth (partition 3 (range 10)) (range)) ?
00:53jonasen,(map nth (partition 3 (range 10)) (range))
00:53clojurebot(0 4 8)
00:55umpajonasen: neat, how about the other diagonal
00:56jonasen,(map #(nth %1 (- 3 %2)) (partition 3 (range 10)) (range))
00:56clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
00:56jonasen,(map #(nth %1 (- 2 %2)) (partition 3 (range 10)) (range))
00:56clojurebot(2 4 6)
00:57jonasen,(map nth (partition 3 (range 10)) (range 2 -1 -1))
00:57clojurebot(2 4 6)
01:01umpajonasen: nice
01:04ddellacostais there any reason why I shouldn't use the (->SomeType ...) syntax vs. importing/using (SomeType. ...) syntax?
01:04ddellacostaI'm getting strange inconsistencies otherwise
01:05ddellacosta...when running in the repl
01:07amalloymap nth. that's cute, jonasen
01:21engblomIs there a tool for making a *.clj file tidy? Sometimes when you paste stuff from net the indentation gets completely messed up.
01:22amalloynothing better than just pasting it into emacs and asking for a reindent there
01:27engblomI am trying to find a game project around 100 +-30 LOC. All projects I have found so far will not run on clojure 1.6. Is anyone having any suggestion?
01:27engblomThose project I have found are using clojure 1.2
01:29wildnuxhi, how do i use external libraries like 'enlive' in nrepl? Is there a way to use it in the REPL without declaring them in project files?
01:30ddellacostawildnux: check out https://github.com/rkneufeld/lein-try
01:30wildnuxddellacosta: thank you :) will try
01:39ambrosebsdoes this index OOB exception deep inside clojure.test look familiar to anyone? http://build.clojure.org/job/core.typed/533/console
01:45ambrosebsoh that error is evil!
01:45ambrosebshttps://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L337-339
01:46ambrosebsthat code threw an OOB exception
01:49devngiven '(((\a \b \c) (\d \e \f)) ((\g \h \i) (\j \k \l))), i want '(((\a \b \c) (\g \h \i)) ((\d \e \f) (\j \k \l)))
01:51devnmaybe easier to read as
01:52devn[[[1 2 3] [4 5 6]] [[7 8 9] [10 11 12]]] => [[[1 2 3] [7 8 9]] [[4 5 6] [10 11 12]]]
01:55jonasendevn: destructuring? (defn swap [[[a b] [c d]]] [[[a c] [b d]]])
01:55amalloydevn: isn't that just transposing it?
01:55amalloy(apply map list [[[giant-mess]]])
01:57devnamalloy: that's exactly what i needed
01:57devnthanks
01:57ambrosebshow does that work?
02:02ambrosebsapparently if you blow the memory lots of strange things start to happen..
02:06wildnuxddellacosta: i tried "lein try enlive" and looks like it downloaded the jars, but it is giving error, can you try if it works on your end
02:06wildnuxCompilerException java.lang.ClassNotFoundException: net.cgrand.enlive-html, compiling:(NO_SOURCE_PATH:1:1)
02:08wildnuxddellacosta: that error is when i do: (:require [net.cgrand.enlive-html :as html])
02:08ddellacostawildnux: are you doing that in the repl?
02:11ddellacostaworks fine for me, if I require in the repl like so: (require '[net.cgrand.enlive-html :as html])
02:11ddellacostawildnux: not sure if that's the problem you're having, but the syntax you listed is only going to work inside an ns form as far as I know.
02:12wildnuxddellacosta: thank you
02:12wildnuxddellacosta: i was missing '
02:12wildnuxi am very new :)
02:13ddellacostawildnux: you're welcome. :-)
02:14stkim1Help! I’m using LT 0.6.6 and trying to connect to a project but nothing happens. nothing!
02:14stkim1I’m on ubuntu 12.04
02:25engblomIs something wrong with my setup? I am not able to get almost anything graphical to work. I am using openjdk1.7.
02:32ambrosebsmrb_bk: hi
02:33dbaschengblom: what happens if you type java.awt.Frame into the repl?
02:34engblomuser=> java.awt.Frame
02:34engblomjava.awt.Frame
02:35dbaschengblom: what OS are you running?
02:35yeoj___If i have three vectors of length L how can i create L maps with t hree entries in each? Should this be done all with map or is there an easier way?
02:35engblomdbasch: OpenBSD
02:37engblomWhen running: 'java -jar nightcode-0.3.6-standalone.jar' I get an empty window. When I close it, I get graphical confirmation question.
02:37engblomThe console is full of lines containing awt because of some exception.
02:38engblomI wanted to actually use https://github.com/oakes/play-clj but as I could not get this to work, I decided to see if I can run any graphical program made with clojure.
02:38dbaschyeoj___: what is a map with three entries? maps need an even number of entries
02:40dbaschengblom: I’ve never used the jdk on OpenBSD, so I have no idea. It does sound like a problem with your setup.
02:41engblomdbasch: Which jdk do you use: openjdk or the one from oracle?
02:41dbaschengblom: both, on linux and osx
02:42engblomdbasch: And you have had no problem by using openjdk?
02:42dbaschnone
02:42yeoj___i think i explained it wrong... i have this: https://www.refheap.com/86472
02:42dbaschare you exporting your display variable correctly?
02:43yeoj___dbasch: i have a map, and each key is a vector. i want to normalized it (right word?) to a vector, with a bunch of dictionaries in it. like so: https://www.refheap.com/86472
02:43yeoj___s/dictionaries/map/
02:43engblomYes, and the frame (window) is appearing when I try to run a jar. The content inside of it is missing.
02:44TEttingerengblom: i wonder if it has to do with the skin nightcode uses
02:45TEttingerengblom, can you take a screenshot?
02:45engblomAlso, I am using dwm as wm. Could this be a problem?
02:45TEttingerI'd like to see what the missing content is replaced with, though I have no experience with openBSD
02:45bob2sure, dwm will make java X apps behave in useless ways
02:46TEttinger(inc bob2)
02:46lazybot⇒ 2
02:47bob2http://awesome.naquadah.org/wiki/Problems_with_Java
02:51engblombob2: That solved the problem with NightCode! Thanks!
02:53dbaschyeoj___: https://www.refheap.com/86473
02:54dbaschyeoj___: close enough to what you need, I think
02:54yeoj___dbasch: thats awesome. i'm going to have to stare at it for a few hours.
02:54yeoj___dbasch: ugh this stuff bends my brain.
02:55dbaschI’m sure there’s a cleaner way too
02:56engblomI still have problems. nightmod (which is using play-clj) is still not running. Here is a screenshot: http://picpaste.com/pics/screenshot_1.1402469695.jpg
02:56engblomThe gray area to the left is nightmod running.
02:57dbaschyeoj___: (map vector [a b c] [d e f]) gives you [a d] [b e] [c f]
02:57engblomThe console down to the right is the latest errors appearing when running nightmod.
02:59TEttingergeez that's a stacktrace
02:59TEttingercan you figure out what causes it, where in your code?
03:00TEttinger(guessing play-clj calls something native in libGDX that isn't supported without some finagling on BSD)
03:04engblomTEttinger: http://pastie.org/9279253
03:06TEttingeryep.
03:08TEttingerhttps://github.com/libgdx/libgdx/blob/478756ac89700d10dfe844aba809e4a85870ec20/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglNativesLoader.java#L52-L71
03:08TEttingerthe error leads to there, which shows it never tests for BSD
03:11engblomTEttinger: Thanks. That explains.
03:12TEttingersorry it won't work without source changes to the lib... there might be a fork
03:23engblomIs there any other game-making library anyone could recommend besides play-clj as libgdx is not available for my platform?
03:24TEttingernot sure what Morgawr's Cloister engine uses
03:25TEttingerhttps://github.com/Morgawr/Cloister-engine keep in mind the heavy alpha notice :)
03:25TEttingerI don't even know if lwjgl is portable to BSD
03:26TEttingerlibgdx uses LWJGL, cloister uses LWJGL without the intermediate libGDX, play-clj with libgdx
03:27engblomThanks
03:29TEttingerha! yes it is
03:29TEttingerhttp://www.lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL
03:29TEttingerLWJGL considers bsd another linux
03:36engblomException in thread "main" java.lang.LinkageError: Unknown platform: OpenBSD
03:36engblomlwjgl is not working directly either.
03:36engblomI tried the test line from http://www.lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL
03:38TEttingerdamn
03:39TEttingerto be fair, OpenBSD's gaming selection generally consists of nethack
03:39TEttinger(for which there is lanterna and squidlib)
03:40TEttinger(I've used squidlib, it's good)
03:40engblomOpenBSD has come quite far the latest time. We have flightgear among other
03:40TEttingerI was under the impression that BSD was ideal for servers since it's so reliable, less so for desktop usage
03:41TEttinger(less ideal)
03:42engblomIt is true that server stability is prioritized when it comes to OpenBSD, but not all devs are working with that.
03:43engblomI am teaching in an elementary school, and I also teach some programming to the kids there. At this moment, I am exploring if it would be possible to use clojure in teaching. I know the kids would want to do simple games.
03:43TEttingerwell if you're not doing 3D then you can get pretty far with swing
03:43TEttingeror AWT even
03:43engblomIs quil advanced enough for simple 2d platform games?
03:43TEttingeroh yeah
03:44engblomOr is it just a library for creating images?
03:44TEttingerquil is based on processing, which has been used for plenty o' gams
03:44TEttinger$google wayfarer processing
03:44lazybot[Wayfarer (alpha)] http://benhem.com/games/wayfarer/
03:44amalloyclojure isn't a very good "first programming language". it includes a lot of stuff that's a great idea if you know what you're doing, but a distraction if you're just getting the hang of talking to computers
03:45kzarZZT was pretty good for kids learning programming but might be a bit dated for them now if they're used to playing XBOX I guess
03:45TEttingerI'd argue JS offers the most immediate feedback
03:45Glenjaminamalloy: i've seen the argument "but what if you didn't have to unlearn mutable state", not sure how much i agree though
03:46amalloyGlenjamin: i'm not arguing functional vs pure. scheme is a great first language
03:46amalloyclojure is just very "batteries included", which is confusing if you don't know what all those bells and whistles are for
03:46Glenjaminmakes sense
03:47TEttingeralso, web design skills for kids are great to have. let them understand how all the modern web stuff they spend so much time on is put together, and know how to help people with that kind of problem
03:47kzarI suppose there's always the possibility of making a library for them that's simple to use to do what they want
03:48kzarhmm but I guess if you start having to explain to young children who have never coded before what a lazy sequence is you're probably sunk
03:48engblomTEttinger: I am teaching them web design too
03:48TEttingerhost on dropbox, get them to sign up with you as referrer. get 100 GB free dropbox
03:48Glenjaminengblom: are you familiar with code club?
03:48TEttingerthis is what a friend who is a teacher did with several classes
03:50Glenjaminthere might be some good suggestions/resources on here https://www.codeclub.org.uk/
03:50engblomkzar: I actually think a lazy sequenze is easy to explain. They do not know much about boundaries and if you compare it to how we work ourselves: we know we could count eternally, still we only use the numbers we actually need.
03:50engblomGlenjamin: Thanks, I am looking it up!
03:51kralnamaste
03:51kzarI don't know, maybe you're right. I just remember kids at my school struggling with the most basic concepts that's all. My teacher wasn't hanging out in #clojure though so hopefully these ones will get a bit further
03:52kzar(Kudos for giving it a try)
03:53allenj12if im doing a post walk on the list but dont wanna apply the function to the top-most layer, whats the best way to test for that?
03:56engblomkzar: From earlier experience, kids have more difficult to understand recursive functions than lazy sequences.
03:56kzarAdults too I guess
04:00kzarIs there something like the -> macro for when you need to call java methods? Something that would work for this (.replace (.getName file) old new)
04:08kzarHow do you delete a directory from Clojure?
04:08jonasen(-> file .getName (.replace old new))
04:09jonasenkzar: you could use raynes/fs: http://raynes.github.io/fs/me.raynes.fs.html#var-delete-dir
04:10kzarjonasen: cheers
04:17visofif i have a string with this format "<x> <y> \"Hello\"\n<xx> <yy> \"hello\nworld.\"\n<a> <b> <z>\n" , how can i get triples [["<x>" "<y>" \"Hello\"], ["<xx>" "<yy>" \"hello\nworld.\"], ["<a>" "<b>" "<z>"]] ?
04:18visofi asked this yesterday and someone suggest me to do 2 splits and i should get it, but there is \"hello\nworld.\"\n<a> inside the string there is \n if i'll split by \n
04:18visofand then he suggest to use CSV lib to do this
04:18visofis there a good solution for this problem?
04:19nixnvisof: you could search for a library which handles inner quoted strings
04:20nixnor give a complex regex
04:20nixnfor the splits
04:27rurumateis there a not-lazy version of concat? the lazyness is munging the stack trace, great headache when debugging
04:28nixnvisof: if you are sure, that it's always 3 elements ("triples" as you say), you could re-groups matching the elements and split them with (partition 3 ...)
04:28nixnre-matches, not re-groups
04:29rurumate,(apply concat [[1] [2] [3]])
04:29clojurebot(1 2 3)
04:30stain,(doall (concat [:a :b] (range 5)))
04:30clojurebot(:a :b 0 1 2 ...)
04:35rurumate,(reduce (fn ([] nil) ([a b] (conj a (first b)))) [] [[1] [2] [3]])
04:35clojurebot[1 2 3]
04:36rurumate,(reduce (fn ([] nil) ([a b] (into a b))) [] [[1] [2] [3 4]])
04:36clojurebot[1 2 3 4]
04:37allenj12i should be able to require a local file right?
04:40allenj12o silly require instead of use lol i always do that
04:41rurumateI think use is deprecated, use refer :all
04:42_ato,(map #(map second (re-seq #"((?:(?:\"[^\"]*\"|[^ ]+)+))(?: |$)" (second %))) (re-seq #"((?:(?:\"[^\"]*\")+|[^\"\n]+)+)(?:\n|$)" "<x> <y> \"Hello\"\n<xx> <yy> \"hello\nworld.\"\n<a> <b> <z>\n"))
04:42clojurebot(("<x>" "<y>" "\"Hello\"") ("<xx>" "<yy>" "\"hello\nworld.\"") ("<a>" "<b>" "<z>"))
04:42rurumateit's still all over many open source projects though
04:42allenj12o rly?
04:42_atovisof: ^ heh
04:42rurumate,(require '[clojure.string :refer :all])
04:42clojurebot#<SecurityException java.lang.SecurityException: denied>
04:43nixn,(re-seq #"\".*?\"|[^\s\"][^\s]*" "<x> <y> \"Hello\"\n<xx> <yy> \"hello\nworld.\"\n<a> <b> <z>\n")
04:43clojurebot("<x>" "<y>" "\"Hello\"" "<xx>" "<yy>" ...)
04:45visof_ato: thanks
04:45visof_ato: it's a complex, can i do it simpler ?
04:46allenj12,(clojure.walk/postwalk #(if (seq? %) (reverse %) %) [1 3 5 [3 1 9]])
04:46clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
04:46allenj12does that work for anyone btw?
04:46allenj12in repl :p
04:47allenj12should reverse everyithng
04:47_atovisor: other ways would be write a character-by-character parser or use a parser library that takes it as a more readable grammar than regex
04:48rurumatethumbs up if your company wants to fire you for using LISP but can't because not everything could be rewritten in java yet!
04:48allenj12lol
04:56allenj12is there a way to reverse a coll but keep the original data structure?
04:57allenj12(reverse2 [1 2 3]) => [3 2 1] (reverse2 '(3 2 1)) => '(3 2 1)
05:02Glenjamin,(defn reverse-keep [coll] (into (empty coll) (reverse coll)))
05:02clojurebot#'sandbox/reverse-keep
05:02GrannyXXXclojurebot
05:02GrannyXXXEhh
05:02GrannyXXXGlenjamin
05:02Glenjamin,(reverse-keep [1 2 3])
05:02clojurebot[3 2 1]
05:02GrannyXXXDo you believe that console gamers are genetically inferior to PC gamers?
05:02Glenjamin,(reverse-keep '(1 2 3))
05:02clojurebot(1 2 3)
05:02Glenjaminhrm
05:02Glenjaminoh, conj
05:02Glenjamindamn
05:03allenj12Glenjamin: thanks
05:03Glenjaminthat doesn't actually work on lists
05:04Glenjamini guess its more important to ask, why do you want to keep the original structure
05:04allenj12Glenjamin: it did for me...
05:04allenj12Glenjamin: doing a macro talk soon and wanted to me Psil, lisp but everyithing backwards
05:05allenj12((1 1 +) [] two defn)
05:05clgv,(into () (range 19))
05:05clojurebot(18 17 16 15 14 ...)
05:06clgvallenj12: wouldnt it be better to use useful macros in such a talk?
05:06allenj12clgv: well i figured it would be macro that used that function
05:06clgvallenj12: if your point is to convince someone about the usefulness of macros you'll defeat that point by useless examples
05:07allenj12clgv: it was just for fun rly
05:07clgvallenj12: easy but useful examples are e.g. `when-let` then go for extending it to `when-let-all` with multiple bindings
05:08clgvcustom looping macros for problem specific data structures...
05:08allenj12clgv: yea i already had stuff like that planned out :)
05:08Glenjamini've got a fairly neat (plet) macro that runs each binding in a future
05:08kzar(file-seq (clojure.java.io/file "public/")) works fine but (stasis/slurp-directory "public/" #".*") gives me a file not found exception, it can't find the directory. Any ideas?
05:09clgvGlenjamin: a `plet` with dependency resolution would be a more advances but fun example
05:09allenj12clgv: like i said it was more for like a little fun thing to put in there
05:09Glenjaminyeah, so far i haven't needed dependencies
05:09Glenjaminbut if i do, i'm looking forward to writing that macro
05:09clgvallenj12: depending on your goal, it could do harm ;)
05:10allenj12clgv: you think so? i thought a little comedy would help. it would also show that macros can be taken too far.
05:11allenj12clgv: well regardless, i wanna do it for now for shits and giggles, ill think about actually putting it in more.
05:13clgvallenj12: it all depends on the context and the goal of the talk. if it is a clojure group meeting just go for it ;)
05:14allenj12clgv: no its a meeting with people of all different backgrounds, mostly c python programmers.
05:15clgvallenj12: hummm, and the goal of the talk is?
05:15allenj12clgv: to show the flexibility and power that a lisp can offer
05:15clgvallenj12: then better choose another usefull example ;)
05:16allenj12clgv: haha alright, i dont know how you get more flexible than writing the language backwords tho :p
05:17allenj12clgv: still gonna do this tho, its fun either way hehe :)
05:17clgvallenj12: yeah but the c guys will say "how is inverting the syntax ever going to be usefull?"
05:17clgvallenj12: yeah, exercising is good ;)
05:18allenj12clgv: yea, i was hoping people would just take it as a joke, but your right more harm than good
05:18clgvallenj12: stuff like "transparently" parallelizing will amaze them ;)
05:19weidoes anyone know where the transactor is running when you use DynamoDB? I’ve set it up successfully following the docs, but am quite confused why everything works without starting a transactor
05:19wei^ re: Datomic, that is
05:20clgvallenj12: e.g. you have something like (doseq [e lst] ...) and can exachnage that by (doseq-parallel [e lst] ...) - the implementation of that doseq-parallel is not too complicated to show on slides
05:20clgvallenj12: I did something similar in a lisp course for the task of computing julia sets
05:21allenj12clgv: o yea that would pretty awsome! definatley getting added on
05:21kzarmagnars: Any idea why (stasis.core/slurp-directory "public/" #".*") isn't working? (the public directory does exist)
05:23allenj12clgv: like this right?
05:24allenj12clgv: http://stackoverflow.com/questions/10969708/parallel-doseq-for-clojure
05:26clgvallenj12: better not the accepted solution. if you want to use a defined number of thread, you can do a similar split of the work for those. but then I'd just use futures instead of pmap. for a real application I'd set up a threadpoolexecutor
05:28allenj12clgv: ahh kk
05:41engblomCould someone kindly help to understand why this is happening http://pastie.org/9279602 when I use this code: http://noobtuts.com/clojure/2d-snake-game-tutorial
05:43allenj12engblom: ill look at it after im done with this if i can.
05:44engblomallenj12: The only thing differing is that I used quil 2.0.0 (newest)
05:47nbeloglazovallenj12: show the code you're running. From tutorial it hard to understand where it fails.
05:48allenj12nbeloglazov: for what?
05:50engblomnbeloglazov: I guess you meant me... http://pastie.org/9279628
05:50nbeloglazovAh, sorry :)
05:50engblomIt is copy & paste from the tutorial
05:50nbeloglazovOk, the problem is that you have var snake defined twice
05:51magnarskzar: is the public directory in resources/ (slurp-directory) operates on files, not class path. use (slurp-resources) for that. feel free to open an issue if you can't figure it out
05:51nbeloglazovFirst time on line 10 and second time on line 64
05:51nbeloglazovJust rename (q/defsketch snake ...) to (q/defsketch snake-sketch ...)
05:51kzarmagnars: Not in resources no
05:52kzarmagnars: It seems like it's doing slurp on the directory which gives same exception? (slurp (first (file-seq (clojure.java.io/file "public/")))) gives same thing
05:52kzar"FileNotFoundException public java.io.FileInputStream.open..."
05:53engblomnbeloglazov: Thank you! You are right about that. Now it is working
05:53magnarskzar: please open an issue with the relevant info, and I'll take a look.
05:54kzarOk one moment
05:54nbeloglazovengblom: you're welcome :)
05:55engblomnbeloglazov: Even though it is working as intended, I get this: http://pastie.org/9279636
05:56nbeloglazovengblom: are you trying 'lein run' or something similar?
05:58engblomnbeloglazov: Yes, that is what I am doing
05:59kzarmagnars: How's this? https://github.com/magnars/stasis/issues/9
05:59engblomnbeloglazov: Do I need to create a dummy main function?
06:00nbeloglazovThen I'd suggest to look at "Runnable jar" wiki article: https://github.com/quil/quil/wiki/Runnable-jar
06:00nbeloglazovIf you want run it only via 'lein run', then yes, dummy main function should be sufficient.
06:01engblomThank you!
06:01nbeloglazovIf you want to create runnable jar - look at the article.
06:06allenj12https://www.refheap.com/86475 what im i missing here?
06:06allenj12im getting parameters should be vector
06:09nbeloglazovallenj12: have you looked at the result of macroexpand-1? (macroexpand-1 '((psil ((1 2 +) [] three defn)))
06:10allenj12nbeloglazov: o geez i did but i saw the parens wrong lol
06:13allenj12nbeloglazov: weird tho deep reverse of [] should be []
06:14engblomnbeloglazov: Thank you, that article was exactly what I needed!
06:14allenj12engblom: btw how is quil i never tried it
06:15engblomallenj12: So far it is looking very nice, but then I have not done anything than a copy & paste project for checking it out.
06:15allenj12engblom: ahh kk lol
06:17nbeloglazovallenj12: aaah, found bug in your code I think :)
06:17nbeloglazov(into (empty coll) (rseq %)) should be (into (empty %) (rseq %))
06:17allenj12nbeloglazov: where?
06:18allenj12nbeloglazov: wow that was it! so stupid hahaha
06:19allenj12(inc nbeloglazov )
06:19lazybot⇒ 1
06:19nbeloglazovprobably it would be better to extract #(cond ...) function as separate top-level function to avoid such bugs
06:20allenj12how do you check your value on here anway
06:20allenj12nbeloglazov:
06:20allenj12nbeloglazov: yea
06:22nbeloglazovallenj12: sorry?
06:22allenj12nbeloglazov: sorry for what? the first blank was a mistake lol
06:37clgv$karma nbeloglazov
06:37lazybotnbeloglazov has karma 0.
06:38clgvallenj12: 11
06:38clgvallenj12: ^^
06:39allenj12clgv: wait but i gave him one hmmm
06:39nbeloglazov:'(
06:39allenj12$karma allenj12
06:39lazybotallenj12 has karma 0.
06:39allenj12(inc nbeloglazov )
06:39lazybot⇒ 2
06:39allenj12what!
06:40allenj12wat!
06:40clgvallenj12: you have to omit the last blank
06:40clgv(inc nbeloglazov)
06:40lazybot⇒ 1
06:40allenj12(inc nbeloglazov)
06:40lazybot⇒ 2
06:40allenj12$karma nbeloglazov
06:40lazybotnbeloglazov has karma 2.
06:40allenj12weird
06:40allenj12(inc allenj12)
06:40lazybotYou can't adjust your own karma.
06:40allenj12dam
06:40clgvallenj12: lazybot uses the whole string until the closing parantheses
06:41clgv(inc 42
06:41clgvoh he ignores defect inputs^^
06:41clgv(inc 42)
06:41lazybot⇒ 4
06:41allenj12(inc 42)
06:41lazybot⇒ 5
06:42nixn$karma 42
06:42lazybot42 has karma 5.
06:42allenj12haha
06:42clgva bit too low right? :P
06:42nixn42 karma for 42 is 100%
06:42allenj12(+ 30 42)
06:42clojurebot*suffusion of yellow*
06:42allenj12lol
06:44engblomIs anyone having a link to any documentation showing the html for loading an applet created with 'lein uberjar'
06:45nixnclgv: which charts?
06:47clgvdata plots aka everything you can possibly do via jfreecharts
06:47clgvit's just a pain in the ass to be forced to program each of these in a lowlevel fashion.
06:49clgvthere are different problem scopes: (1) selecting data to plot from nested clojure data structures easily, (2) have a combosable way to describe series in a plot, combined plots (vertically/horzontally), aggregate multiple plots in one view
08:12engblomWhen using quil, is there any other way to pass parameters to the draw function than to use atoms or refs? I would like a way to pass them like function arguments
08:19clgvengblom: create the sketch via a function?
08:20clgvengblom: you can use `sketch` instead of `defsketch`
08:21engblomclgv: But once I have created the sketch, (draw) will be called n times/second and how do I reach to pass values from where draw is called?
08:23clgvengblom: you want to change those parameter values while the sketch is running?
08:24roppongininjaboom! a ninja appears out of nowhere
08:25noidiengblom, I wrote a little wrapper around Quil to make it more functional https://github.com/solita/inkwell
08:25noidihere's an example project that can be used as a starting point https://github.com/solita/inkwell-playground
08:27noidihttps://github.com/solita/inkwell-playground/blob/master/src/inkwell_playground/core.clj
08:29noidiit's written for a Clojure intro class I held, which is why the "playground" is structured the way it is
08:33engblomclgv: Yes, I want to change them while it is running
08:34engblomnoidi: Thanks! This was what I wanted exactly, to make use more functional programming
08:47clgvengblom: but then you need some atom/ref or mutable properties of a deftype
08:48engblomclgv: It was this I wanted to avoid...
08:49clgvengblom: but if the sketch is running there is no functional way without mutation to change some of the custom params you use in your draw function
08:49clgvit's a shame you cant use quil without GUI - I was tempted to render a graphic offscreen which did not work without a GUI
09:02nbeloglazovengblom: there will be Quil 2.1.0 release soon, which introduces functional-mode in Quil
09:04nbeloglazovhm, and looking at noidi's inkwell - it is pretty similar.
09:05noidicool! :)
09:06clgvnbeloglazov: offscreen rendering is not an option due to processing, right?
09:07nbeloglazovclgv: I think so
09:08clgvnbeloglazov: hmm the concrete scenario was a server application so maybe the GSOC project for CLJS might help in the future
09:10nbeloglazovclgv: I think you still need browser for running cljs version. I mean it probably uses Canvas and WebGL api.
09:13nbeloglazovnoidi: idea with pausing sketch on exception is cool! As well as redirecting exceptions to *out* (which probably should have been implemented long time ago). I think pause-on-exception can be implemented as middleware (another upcoming 2.1.0 feature)...
09:16umpawhy does this work ? ,(map nth (partition 3 (range 10)) (range ))
09:17engblomnbeloglazov: Looking at how to get text on screen, an easier way than this could be cool: http://www.unexpected-vortices.com/blog/2013/clojure-quil-text-example.html
09:19nbeloglazovengblom: I usually use (q/fill 0) (q/text "Hello, world" 20 20). Draws text on screen using black color.
09:27jonasenumpa: do you know what the pieces mean? map, nth, partition and range?
09:28prachetaspanyone have any experience with social network analysis in Clojure? any library suggestions I should look at first?
09:28umpajonsen: yes, i don't understand how range can be used as a parameter for nth
09:28jonasenumpa: it
09:29jonasenit's not. (map nth (<seq of rows>) <seq of indices>)
09:29engblomnbeloglazov: That looks a lot easier :)
09:30jonasenso for eact row: (nth <row> <index>)
09:30jonasens/eact/each/
09:41umpajonasen: how does it know where to stop since range goes on forever ?
09:42jonasenumpa: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/map
09:42jonasenumpa: map runs until "one of the colls are exhausted"
09:42jonasenumpa: in this case the seq of rows
09:44prachetasp,(print "hello")
09:44clojurebothello
09:44prachetasp,(map #(% %2) (range 1 5) (range 1 10))
09:44clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
09:45prachetasp,(map #(identity [% %2]) (range 1 5) (range 1 10))
09:45clojurebot([1 1] [2 2] [3 3] [4 4])
09:45jonasen,(map vec (range 1 5) (range 1 10))
09:45clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec>
09:45jonasen,(map vector (range 1 5) (range 1 10))
09:45clojurebot([1 1] [2 2] [3 3] [4 4])
09:45prachetasp:)
09:45prachetaspmuch better
09:46Nikentic:)
09:52engblomHow could I get a vector created instead of a list: (repeatedly 3 #(inc (rand-int 8)))
09:53augustlengblom: what's wrong with a list? :)
09:53Bronsaengblom: (vec ..)
09:54engblomBronsa: Thanks!
09:59engblomaugustl: I do not know, is destructuring possible with a list (fn [(a b c)] (do-some-things a b c))
10:00Bronsa,(let [[a b & rest] (range 10)] [a b rest])
10:00clojurebot[0 1 (2 3 4 5 6 ...)]
10:00Bronsaengblom: ^
10:00Bronsaengblom: the vector destructuring syntax works for every seq
10:00augustlengblom: no you have to destructure with a vector
10:01augustlas in, the actual destructuring statement in the signature has to be written with a vector so (fn [(a b c)]) won't work
10:01engblomaugustl: That is why I was asking in the first place how I get that as a vector and not as a list :)
10:01augustlengblom: not sure why that is relevant in your case of having a function that returns 3 random numbers, though
10:01augustlbut you can destructure a list, using a vector. What Bronsa said
10:02augustldestructuring cannot be a statement anyway
10:03umpa,(println "hello")
10:03clojurebothello\n
10:03engblom,(/ 1 0)
10:03clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
10:04umpa, (let [nums (partition 3 (range 10))](concat nums (apply map list nums) (list (map nth nums (range)))(list (map nth nums (range 2 -1 -1)))))
10:04clojurebot((0 1 2) (3 4 5) (6 7 8) (0 3 6) (1 4 7) ...)
10:09prachetaspaugustl: I know destructuring cannot be a statement but what would it be considered? syntactic sugar?
10:11Glenjaminis there a map-values function in core that maps over map values while preserving keys?
10:11Glenjaminand if not, what is the usual name for such a thing?
10:12ToxicFrogGlenjamin: there isn't. I called it map-values because there's already a 'mapv' that does something completely different.
10:16prachetasp,(into {} [[:x "y"] [:z "a"]])
10:16clojurebot{:x "y", :z "a"}
10:16prachetaspGlenjamin: could use destructuring and a reduce then into to jam it back into a map - thats usually how I do it
10:16Glenjamin(reduce-kv f {} coll) is close
10:19prachetaspyeah probably your best bet
10:20Glenjamin,(defn map-values [f m] (reduce-kv #(assoc %1 %2 (f %3)) (empty m) m))
10:20clojurebot#'sandbox/map-values
10:20Glenjamin(map-values inc {:a 1 :b 2})
10:20Glenjamin,(map-values inc {:a 1 :b 2})
10:20clojurebot{:a 2, :b 3}
10:22prachetaspare there any docs available for v1.4 and above that are like these 1.2.0 and 1.3.0 docs? http://clojuredocs.org/clojure_core/1.2.0/clojure.core/map
10:22Glenjaminthere's http://clojure.github.com/api-index.html
10:34engblomI have taken my first baby-steps towards creating own code in clojure. This is my first function: http://pastie.org/9280299 . What could be improved in this one? (This function takes a Nim state and calculates if it is in a winning position)
10:37clgvengblom: replace `cond` with `or`
10:38llasramengblom: Use refeap.com instead of pastie.org ;-)
10:38llasramEr, refheap.com
10:39llasramengblom: It's also pretty trivial to extend to arbitrary heap-count Nim
10:40llasramWhich may or may not be clearer
10:40llasramBut might provide more opportunity for higher-order functional programming
10:42engblomThanks!
10:43llasramengblom: Oh, and usually Clojure names use "kebob case" not camel case
10:43llasramSo `winning-heaps` vs `winningHeaps`
10:43llasramFurther, the name of boolean-returning predicate will frequently end in a question mark, so `winning-heaps?`
10:47clgvengblom: and the `cond` is unnecessary.
10:48engblomclgv: Thanks, I fixed it to or, as you suggested. I should have been thinking about it myself.
10:49engblomAt this moment I am trying to figure out how to reduce a list with and. and is a macro, so it seem to not be trivial
10:49Glenjamin#(and %1 %2)
10:50Glenjamin,(apply and [true true true])
10:50clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)>
10:50Glenjamin,(apply #(and %1 %2) [true true true])
10:50clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox/eval50/fn--51>
10:50Glenjaminoh right
10:50Glenjamin,(reduce #(and %1 %2) [true true true])
10:50clojurebottrue
10:51Glenjamin,(reduce #(and %1 %2) [true true true false])
10:51clojurebotfalse
10:51engblomThanks!
10:51Glenjamin,(doc every?)
10:51clojurebot"([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
10:51Bronsa,(every? identity [true true true false])
10:51clojurebotfalse
10:57engblomMy new function: https://www.refheap.com/86477 . I changed the vector for a list as I will take any numbers of heaps.
11:00cbpDoes anyone know how can I scp to clojars my jar, pom and .asc files and have clojars realize I'm signing them?
11:03jcromartieis the use of slurp here a potential DOS waiting to happen? https://github.com/ring-clojure/ring/blob/1.3.0/ring-core/src/ring/middleware/params.clj#L27
11:03jcromartieor does Jetty etc. usually prevent a request that large?
11:04ddellacostacbp: lein deploy?
11:04cbpddellacosta: there is no project.clj
11:04ddellacostacbp: d'oh, sorry I missed that part
11:04cbpjust a pom a jar and the signatures
11:05cbpI tried using maven which does the signing part but somehow messes up the path inside the jar..
11:05ddellacostajcromartie: I suspect there's an upper limit, perhaps this is the relevant config? http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size
11:06ddellacostacbp: yeah, sorry...I suspect technomancy could give you some better advice on that though
11:06jcromartieddellacosta: yeah I thought it might be headed off at the HTTP server
11:06llasramWhy is there a cider 0.6.0 release, but the latest package in marmalade is 0.5.0 ?
11:10technomancyllasram: 0.6.0 isn't stable iirc
11:10llasramHmm
11:10llasramOk
11:11technomancyllasram: also because the current maintainer seems to only care about melpa
11:11llasramThen why even make releases?
11:11technomancyI don't pretend to understand his release philosophy =\
11:11llasramgtrak: You're bouncing things to stable-land when stable or something, right?
11:12gtrakyes, some day.
11:12llasramcoo
11:12gtrakseems like we're talking about this once a day at least :-)
11:12llasramMy boss is using el-get, just updated to current HEAD, was showing off the shiny new exception reporting, and I got jealous :-)
11:13llasramNot jealous enough to spend <n> hours updating everything to some compatible collection of untracked revisions, mind you
11:13cbpU x y y
11:14cbpand fingers crossed
11:14llasramI suppose I could just back up my current package installation directory, add melpa, and do that
11:15gtrakI'm going to rewrite mine with el-get next time I have to od anythign.
11:16gtrakoof dlyesxic. :-)
11:16llasramod all the thigns!
11:17gtrakturning a knob on my right hand to add 20ms delay, that should do it.
11:20cbpThat's what C-t is for
11:40engblomGoing to arbitrary number of heaps in NIM made one thing much more difficult: How do I get a list of all possible moves? A state like '(3 2 1) should give '((2 2 1) (1 2 1) (0 2 1) (3 1 1) (3 0 1) (3 2 0))
11:44clgvengblom: cartesian product of the ranges defines by the numbers on each heap
11:44clgv*defined
11:45cbpclgv: that's not exactly a cartesian product
11:48fenrocki have a couple of methods i use in euler problems for this, as it comes up quite often.
11:48clgvcbp: ah you are only allowed to take from one? ok.
11:49fenrock(defn choose-k [coll k] (let [n (count coll)] (if (<= k 1) (map vector coll) (reduce into (sorted-set) (for [i (range 1 (inc n))] (map #(into [(nth coll (dec i))] %) (choose-k (drop i coll) (dec k))))))))
11:49fenrock(defn all-combos [coll] (reduce into #{} (map #(choose-k coll %) (range 1 (inc (count coll))))))
11:49clgvcbp: much easier to implement then^^
11:49fenrockthen just call (all-combos list)
11:50fenrockmight have to go and rerun that myself to check it does what i think :)
11:53fenrockand i think i missed the point of your question, you're not simply after the combinations of elements, you want valid moves. I'll go back to work *shuffles off*
11:54cbp,(let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range))))
11:54clojurebot([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)
11:55clgv,(binding [*print-length* 20] (let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range)))))
11:55clojurebot([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)
11:55clgvah damn... ;)
11:55clgv,(binding [*print-length* 20] (prn (let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range))))))
11:55clojurebot([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] [3 2 0])\n
11:56clgv,(prn (let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range)))))
11:56clojurebot([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)\n
11:56clgv:D
11:56cbpengblom: anyhow that's one way to do it
12:00clgv,(defn poss [s] (for [i (range (count s)), :let [n (nth s i)], e (range n)] (concat (take i s) [e] (drop (inc i) s))))
12:00clojurebot#'sandbox/poss
12:00clgv,(poss [3 2 1])
12:00clojurebot((0 2 1) (1 2 1) (2 2 1) (3 0 1) (3 1 1) ...)
12:01clgvthough the `nth` is not optimal. sometimes having access to an index in `for` would be awesome
12:01engblomThanks
12:02justin_smithclgv: what about (for [[i n] (map list (range) s)] ...)
12:03clgvjustin_smith: yeah I dont like that additional noise
12:04rasmustojustin_smith: not (map-indexed vector (range)) ?
12:04clgvrasmusto: not even shorter ;)
12:04rasmustooh hm, why do I always use it then... ;(
12:04rasmustoI guess it's more flexible
12:04clgvjustin_smith: I wanted to do the implementation with a single `for`
12:05justin_smithrasmusto: or that
12:05justin_smithclgv: well if you want an extra linear time lookup on each step, I guess you can do that
12:05clgvrasmusto: you replaced the wrong one ;) infinite seq :D
12:06rasmustoyou didn't want ([0 0] [1 1] [2 2] [3 3] ...)? :p
12:06clgvjustin_smith: yeah that would not be necessary if there was a way to access the position within `for`
12:07justin_smithfor-indexed
12:07clgvjustin_smith: but I am not sure how you'd add that syntactically to `for` ;)
12:08clgvmaybe similar to a :let after the iteration description, e.g. (for [e some-list, :index i, k other-list :index j] ... )
12:09rasmustooh, just use a nested for
12:09clojurebotPardon?
12:09rasmustoand index the inner :p
12:09justin_smithrasmusto: how would a nested for help? you want an index that follows the output iteration, not one that convolves it
12:10clgvrasmusto: dont know how that should work for the application example. I wanted to avoid `concat` as well ;)
12:16justin_smithgtrak: https://github.com/clojure-emacs/cider/issues/421#issuecomment-45740986 regarding this, it seems odd that cider would need to read the whole input before knowing it is being printed
12:17justin_smithis the issue that the input may also be needed elsewhere, so it needs to be stored on the heap as it comes in ?
12:19gtrakjustin_smith: yea I'm not sure I follow the details there.
12:21cbphrm how do you deal with NaN in cljs?
12:22cbp(not= NaN NaN)
12:22silasdavisif I have a large lazy seq of datum-index pairs, [di i], that I want to convert to a vector where each datum di is at index i in the vector
12:23silasdaviscan I initialise a vector of the right length and assoc in to it
12:23justin_smithcbp: does javascript have and isNaN function or method?
12:23silasdavisto avoid sorting
12:23cbpjustin_smith: Oh I guess it does
12:23justin_smithcbp there is always (if (!= n n) ...)
12:25gfredericksdoes that catch undefined as well?
12:25silasdavisI can do (vec (repeat (count coll)))
12:25cbpoh gods wtf is this language https://www.refheap.com/86479
12:25justin_smith,(vec (repeat 5 0)) silasdavis
12:25clojurebot[0 0 0 0 0]
12:25silasdavisI can do (vec (repeat (count coll) nil))
12:25silasdavisah
12:26justin_smithcbp: lowat
12:26mikerodcbp: that made me laugh
12:27mikerodJavascript is a great comedian
12:27justin_smithI was finely balanced between the watol and lowat responses
12:27technomancycbp: O_O
12:27justin_smithdwim in action, or something
12:29broquaintcbp: FWIW I see consistent behaviour in Firebug (i.e false in both cases).
12:34mikerodThis quote “the correctness of your program has been coerced to false.” - Javascript
12:34mikerodfrom https://www.usenix.org/system/files/1403_02-08_mickens.pdf
12:34mikerodIs probably my favorite
12:35technomancyhttps://twitter.com/tomzalt/status/469464496860569601
12:36hyPiRionhahha
12:36justin_smithlol
12:36mikerod:)
12:37prachetaspwhat are the main benefits of edn over json
12:37technomancythe main one is dates afaict
12:37justin_smithprachetasp: it maps directly to clojure, so it is more convenient when you are going clojre -> clojure
12:38justin_smithany defrecord will define a reader / writer for edn right?
12:39prachetaspi also read that namespacing was helpful - is that so that i can have fields that are named the same in different namespaces in the same map
12:39justin_smithright, also it helps someone know who creates / cares about that key
12:39justin_smithbecause they should be able to find that namespace and see what is done there
12:40prachetaspah so if pieces are added along the way it helps from an organizational and code readability/maintainability standpoint?
12:41justin_smithyeah, it is just a convention though mind you
12:41justin_smith,:this-namespace/does-not-exist
12:41clojurebot:this-namespace/does-not-exist
12:43hyPiRion,(namespace :this-namespace)
12:43clojurebotnil
12:44arrdemmikerod: love that paper :D
12:45mikerodarrdem: yes, it is great
12:50prachetaspjustin_smith: what do you mean just a convention? aka dont rely on it?
12:53gtrakcbp: wat.
12:54justin_smithprachetasp: the namespace of a symbol is not guaranteed to exist
12:54justin_smith*keyword
12:54justin_smithsorry
12:54justin_smithbut it can be helpful to namespace a keyword to indicate where the code is that cares about / creates that key
12:55gtrak,::wat ;; also useful within that namespace, prachetasp
12:55clojurebot:sandbox/wat
13:16prachetasp,(namespace :sandbox)
13:16clojurebotnil
13:17prachetasp,(namespace sandbox)
13:17clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sandbox in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:17justin_smith,(namespace 'sandbox)
13:17clojurebotnil
13:18justin_smith,(doc namespace)
13:18clojurebot"([x]); Returns the namespace String of a symbol or keyword, or nil if not present."
13:31Glenjamin,(namespace ::wat)
13:31clojurebot"sandbox"
13:33justin_smith,(map namespace [::OK :user/OK :not/OK])
13:33clojurebot("sandbox" "user" "not")
13:34johnwalker,(println "foo")
13:34clojurebotfoo\n
13:34johnwalker,(dotimes [x 2] (println "foo"))
13:34clojurebotfoo\nfoo\n
14:43Psy-Qwhiskey and rich hickey presentations. it's a great mix.
14:45stompyjTakes a shot of Bulleit.
14:45stompyjAre we there yet?
14:45stompyjTakes another shot of Bulleit
14:45stompyjAre we there yet?
14:46nullptrPsy-Q: you forgot the hammock
14:46Psy-Qnullptr: oh yeah, that
14:47Psy-Qwell, the whiskey isn't helping with understanding all the timeline and observation stuff from "are we there yet?"
14:47Psy-Qthe hammock talk went down more easily
14:48stompyjPsy-Q: It sounds like what we need is “A drinkers guide to Rich Hickey Presentations"
14:48stompyjwhere we pair alcohol with specific talks
14:48Psy-Qstompyj: yeah, though i think you'd have to slow each of them down by 50% and interleave simple english explanations of what's going on
14:49Psy-Qooh! yeah! that's a good idea
14:49Psy-Qi'd recommend light beers for "are we there yet?"
14:49stompyjhahahah
14:50stompyjStella + Are We There Yet
14:50stompyjdatabase as a value == Guinness
14:51mdeboardhigh abv ipa for simple made easy
14:51Psy-Qi only have whiskey left :( and a local amber
14:52Psy-Qbut i can't follow are we there yet at all now (at the 1h mark)
14:52jcromartieI need a drink.
14:52mdeboardditto
14:52mdeboardi'm in an all-day meeting
14:52mdeboardhour 6
14:52Psy-Qi had a big meeting where they decided to reimplement something we did in rails in clojure instead to see if they like it better
14:52Psy-Qso that was good enough
14:53stompyjwow
14:53stompyjnice
14:53Psy-Qit's a REST service, not a web application per se
14:53stompyjrails -> go is getting popular here in NYC
14:53stompyjthat was my first move here, ruby -> clojure for a REST service
14:53stompyjlow impact
14:53stompyjhuge upside
14:53Psy-Qsome of the big guys here are doing rails -> node :\ but even though NPM is good, the modules published sometimes just aren't up to it
14:53Psy-Qstompyj: oh, good to know!
14:54mdeboardwhere's 'here'
14:54Psy-Qnot that i want to influence the guys' decision-making :P
14:54Psy-Qoh, zürich area, switzerland
14:54mdeboardrails -> node just makes me angry
14:54stompyjnpm has been a disaster for us
14:54stompyjits down often
14:54stompyjand people get indignant if you ask questions
14:54stompyjsometimes its just painfully slow, and takes us 2 mins to deploy to prod
14:54Psy-Qstompyj: our architect person said npm is so much better than maven and bundler because they learned from both of their mistakes, but he didn't factor in reachability :)
14:55stompyjhahahahahahahahahahah
14:55stompyjI guess fault tolerance wasn’t on the checklist
14:55Psy-Qnot really :) but node wasn't seriously there either
14:55mdeboardnpm managed to be worse that pip somehow (Python's pkg mgr)
14:55mdeboards/that/than
14:57Psy-Qit's next whiskey for me, i can't follow the more complicated hickey talks, need to find a simpler one
14:59Psy-QLanguage of the System maybe?
15:01stompyjhaha
15:40SegFaultAXHave you watched Are We There Yet?
15:40SegFaultAXThat might be his best talk. That or Simple Made Easy.
15:43Psy-Qyeah, watched both, but i can't follow Are We There Yet? in this state of mind
15:44AlwaysBCodingquick question: Is there a Clojure function that can filter a collection with a predicate function and return the only first logical true? Kind of like detect in ruby. It would be the same thing as (first (filter ...)) ... figure that there's a function that does this
15:45bbloom(doc some) ; AlwaysBCoding
15:45clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
15:46amalloybbloom: except it doesn't return the first x such that f, it returns the first (f x)
15:46bbloomamalloy: ah yes
15:46amalloywhich always makes me mad. that's so much less useful *and* less natural-sounding
15:47AlwaysBCodingbbloom: can you give me an example of how to use some? I couldn't figure it out from the docs
15:47amalloyAlwaysBCoding: it's just (first (filter ...)). you can def that if you want, or (comp first filter)
15:47AlwaysBCodinglike if I wanted the first number greater than 4 ... (first (filter #(> % 4) (range 10)))
15:48AlwaysBCodinghow do you write that using some?
15:48bbloom,(some #(when (> % 4) %) (range 10))
15:48clojurebot5
15:48bbloomi'd just use (first (filter ...)) there though
15:49amalloyyeah. and you can't use that (when (f x) x) trick if (f nil) is true anyway
15:50stuartsierra,(loop [[x & xs] (range 10)] (if (> x 4) x (recur xs)))
15:50clojurebot5
15:51stuartsierraI think of that as "seek"
15:51stuartsierraIf you put in a proper check for end-of-sequence of course
15:53GlenjaminPsy-Q: mdeboard - do you generally rely on external infra for deploys when not using node?
15:55mdeboardoh yes
15:56mdeboardwe deploy code via jenkins
15:56Glenjamini guess in ruby-land "bundle install" on prod via capistrano is fairly common
15:56Glenjaminjenkins that you run yourselves presumably?
15:56mdeboardyes
15:57Glenjamini'm surprised when people don't run some sort of caching-proxy type thing for deploys etc
15:57Glenjaminit's like how everyone complains about their deployment toolchain when github goes down
15:58mdeboardWhat do you mean
15:58mdeboardwe don't rely on github at all, or anything except our "own" infrastructure
15:58technomancyGlenjamin: it's fairly common
15:58Glenjaminyou were saying earlier how npm being down affected ability to deploy, and speed in general
15:58mdeboardI didn't say that
15:58mdeboardi just said it managed to be worse than pip
15:58Glenjaminoh, sorry
15:58Glenjaminthat was stompyj
15:59Glenjamini misread
15:59stompyjGlenjamin: yeah, that’s been us
15:59Glenjaminyou can deploy a caching proxy rather easily
15:59Glenjaminput it next to your CI server, and things will be much snappier
16:00stompyjyeah, moving away from node seems to be a better choice for us
16:00Glenjamini would recommend that whatever you move to, you still use a caching proxy for whatever package registry it uses
16:00stompyjthis kind of stuff is a bellweather for the community
16:01Glenjamintechnomancy: on a related note, do you know if heroku cache/proxies clojars, or goes direct?
16:01stompyjGlenjamin: thats’s something we’d consider down the road. that feels like a 80/20 optimization
16:01Glenjaminheh, had never heard that term before
16:01GlenjaminIME its one of those things that you dont care about, until you do
16:01technomancyGlenjamin: it proxies central, but the way clojars mixes in snapshots with releases makes it problematic.
16:01Glenjaminlike database backups
16:03stompyjGlenjamin: database backups is a 20/80 optimization :)
16:03stompyjbut good point
16:03stompyjI have been burned by that in the 90s
16:03stompyjand have never forgotten that lesson :)
16:03stompyjare a*
16:03stompyjyeesh
16:03skinkittenhow does get work? http://goo.gl/0vjzQk
16:04skinkittenmore specifically why is lines 3 and 5 returning nil?
16:04Glenjaminskinkitten: it's zero-indexed
16:04Glenjamin,(get [:a :b :c :d] 3)
16:04clojurebot:d
16:05skinkittenoh thanks Glenjamin this isn't the method I'm looking for. :p
16:07TEttinger,(some #{3} [2 44 3 3])
16:07clojurebot3
16:07TEttingersets can be used as fns
16:08TEttinger,(some #{3} [2 4])
16:08clojurebotnil
16:08TEttingeris that what you're after, skinkitten
16:10danneuwhat's a preferred way to evaluate `letters` once? https://www.refheap.com/86487
16:11hiredman(def letters ...)
16:11tbaldridgedanneu: let outside the defn is probably the most common, but personally I just create a new def
16:11tbaldridge(inc hiredman)
16:11lazybot⇒ 47
16:12danneuyeah, i avoid top level helpers like this when i can these days
16:14danneumy namespaces usually have too many top level def/defns over time at which point i need to traverse them all to remember how i intended to knit them together in the first place
16:14AlwaysBCodingstuartsierra: would there be a performance reason for using (loop [[x & xs] collection] ... (recur xs)) to find the first true opposed to doing (first (filter ...))? thanks again
16:15Bronsa,`(~@[])
16:15clojurebotnil
16:15hiredmandanneu: you should push as much as possible in to top level defs, if you have too many, split off more namespaces
16:16danneu(first (filter ...)) + clojure's laziness being performant is what often makes it so easy to write performant clojure code without doing anything extra
16:16stuartsierraAlwaysBCoding: maybe a little, because `filter` is lazy, but not much.
16:17stuartsierraYou still have to `seq` on the initial input.
16:17stuartsierraI guess, since `filter` creates a second lazy sequence, there's a tiny amount of additional overhead.
16:21turbofailor you could just use (some pred coll)
16:22turbofailoh looks like that was discussed earlier
16:26amalloystuartsierra: beware of using [x & xs] to consume a lazy sequence: you end up realizing one more element than you need to, because & xs forces the first element of xs, to decide whether to return nil or a seq
16:27stuartsierraamalloy: Yeah, that was half-assed. :)
16:27amalloythat's a mistake i made a *lot* of times
16:30umpahow do I do partial match of (0 1) on ,(partition 3 (range 10)) ?
16:31umpa,(partition 3 (range 10))
16:31clojurebot((0 1 2) (3 4 5) (6 7 8))
16:40justin_smithumpa: partial match?
16:41justin_smith,(filter (comp #(= % [0 1]) #(take 2 %)) (partition 3 (range 10)))
16:41clojurebot((0 1 2))
16:42amalloyjustin_smith: comping together two lambdas is weird. why not just write #(= [0 1] (take 2 %))?
16:43justin_smithamalloy: just how my brain modularized the problem I guess
16:43justin_smithI guess that is weird
16:53tolstoyWhen I use "lein repl" outside of a project, I get a repl. When I attempt to attach to it via CIDER, I get a message about cider middleware, and Emacs is locked up. How do you use emacs with cider outside of a project?
16:54tolstoyM-x cider and M-x cider-connect produce the same problem.
16:54tolstoyCider 0.7 snapshot, btw. ;)
16:55technomancyone way would be to use 0.5.0
16:55tolstoytechnomancy: Is it pretty much a no-go to use cider outside a project in later versions?
16:56technomancydunno, I haven't tried the new verison
16:56Glenjamintolstoy: in the latest cider i believe you have to add some middleware to your user profiles.clj
16:56arrdemwhether this is a bug or a feature has not been clarified by the cider guys.
16:57tolstoyHm. I've got that, but is it only picked up when running "lein repl" in the context of a project?
16:57umpajustin_smith: yeah partial match works. Would it work with multipple matches ?
16:57umpa,(filter (comp #(= % [0 1]) #(take 2 %)) (partition 3 (range 10)))
16:57clojurebot((0 1 2))
16:58umpa,(filter (comp #(= % [0 1 3 4 8]) #(take 2 %)) (partition 3 (range 10)))
16:58tolstoyHm. I might have the 6.1 middlware spec'd.
16:58clojurebot()
16:59tolstoyGlenjamin: I had the old middleware. Amazed my other projects actually worked. ;)
17:01justin_smithumpa: what do you want #(= % [0 1 3 4 8]) to do? because what it does is test if something is the same sequence as [0 1 3 4 8]
17:04justin_smithumpa: maybe you want a function like this https://www.refheap.com/86490
17:05amalloyjustin_smith, umpa: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L254
17:05justin_smithamalloy: nice
17:06amalloyanytime you want a function that's not in core, it's already in useful. that's the plan, anyway
17:06amalloyspeaking of, there's https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L7 too, of course
17:06justin_smithwouldn't (prefix-of? [0 1 2] [0 1 2]) return false?
17:06amalloyno? it shouldn't. i'll try it
17:06mi6x3mhey clojure, assuming I am writing a function navigate! to change the url of a web browser
17:07mi6x3mis it a good idea to allow 4 types of an argument
17:07mi6x3m:back, :forward, Url or a string
17:07arrdem-! is for STM only, not for side-effect naming.
17:07amalloy(seq/prefix-of? [0 1 2] [0 1 2]) ;; => true
17:08amalloyjustin_smith: you're probably confused because (boolean ()) is true
17:08justin_smithahh, I had no idea
17:08justin_smith,(boolean ())
17:08clojurebottrue
17:08Glenjaminarrdem: what would you use for side effecting? !!, !?!, nothing?
17:08justin_smiththat was the source of my confusion
17:08amalloyi mean, () is truthy, because it's not nil or false
17:08justin_smithone of these days I will learn to read clojure
17:08justin_smith(my mind is polluted by too many other lisps)
17:09arrdemGlenjamin: _I_ just have docstrings explicitly stating what is side-effected, with no paired function naming convention.
17:10Glenjamini like the idea of (defn side-effecting!?!)
17:10arrdemhehe
17:11sdegutisPretty soon we'll be deploying just a .jar file and running it in production, instead of pulling our source code up and running `lein ring server-headless` on the production server.
17:11sdegutisWhile I love Clojure's dynamic nature, this feels a lot cleaner and simpler.
17:12justin_smith(defn ¡viva-la-mexico! [x] (assoc x :salsa true))
17:12wheeeeDo folks in this IRC room go to/run meetups?
17:12Glenjamini run a local FP meetup
17:12justin_smithwheeee: sometimes I go to clojerks, which is the local portland clojure group
17:13tickingwheeee: yeah, I run one in bremen germany
17:13toastHi, I noticed that (= '(1 2 3) [1 2 3]) returns true. Is there a way to compare them that returns false?
17:13toast( = …
17:13amalloyjustin_smith: you gotta go all out: ¡viva-la-méxico!
17:13justin_smithamalloy: and I think the la was a mistake too
17:14umpajustin_smith: i guess i would pull all lists in the partitioned collection that have at least 2 matches ?
17:14mi6x3mguys, is this a good idea?
17:14mi6x3mhttp://pastebin.com/p3gYJYPV
17:14tickingsdegutis: sorry, what feels cleaner ^^?
17:14mi6x3mor should I split it in 3 methods: navigate, navigate-front, navigate-back ?
17:14amalloyyeah, i guess you're confusing it with vive la france?
17:15llasramwheeee: I co-organize the Atlanta Clojure meet-up
17:15justin_smithumpa maybe you want to put things in sets and test set/intersection ?
17:15sdegutiswheeee: pretty sure there's no one to meet up with within an hour of me
17:15Glenjaminmi6x3m: seems fairly ok either way to me
17:15wheeeellasram, ticking, justin_smith: The last two I've been at have been markedly different from other lang's meetups. Seemed like an extra amount of nerd-sniping/IOC from the speaker to one member of the audience and their desired soliloquy topic. Do ya'll see that at your respective groups?
17:15mi6x3mthanks Glenjamin :)
17:15llasramwheeee: Uhhhh, nope
17:16llasramJust friendly people talking about Clojure
17:16sdegutisI once went to a Cocoa/iOS "meet-up" that was about a 75 minute drive. It was pretty much a waste of an evening. It made me assume all meet-ups are. Maybe I'm wrong.
17:16technomancywheeee: that happened at the boston one a few times when I was in town
17:16wheeeeThis has been at two separate meetups in my city with different groups of people.
17:16Glenjaminnerd-sniping/IOC ?
17:16technomancyit was a scheme user who really really wanted everyone to know how great hygenic macros are and how you should be ashamed of using defmacre
17:16justin_smithwheeee: international olympic committee? inversion of control?
17:16wheeeeIOC — inversion of control
17:17Glenjamininversion of control of the talk?
17:17wheeeeyeah
17:17justin_smithoh man, design patterns in social events...
17:17wheeeenerd-snipe is the wrong word. I mean more like constantly correcting/qualifying
17:17Glenjaminoh, we get a little bit of that
17:18Glenjaminbut it seems mostly positive
17:18TimMcjustin_smith: Singleton. :-(
17:18justin_smithI thought that was how nerds flirted
17:18Glenjaminas in "oh, so that's a bit like X in (lang-i-know)"
17:18justin_smithby correcting pedantic mistakes
17:18arrdem#clojure is -Wpendantic
17:18amalloyby pedantically correcting trivial mistakes, justin_smith
17:19Glenjaminwe're a mixed language FP group, so there's quite a lot of questions during the talk
17:19amalloywink wink
17:19tickingwheeee: well, we have 2 people that know clojure and around 7 that are very interested in it but haven't any real world experience so it has basically been a public clojure tutorial for a few months now ^^
17:19winknudge nudge
17:20arrdemhttps://www.youtube.com/watch?v=M7HycFnH26U&amp;feature=kp
17:20wheeeejustin_smith, the best pedants don't correct mistakes, they provide more nuanced understandings or the mostly correct views other people have.
17:20whiddenchinese watch
17:21sdegutisticking: because production doesn't need the whole source code
17:21Glenjaminno live code reloading in production?
17:21wheeeeBut seriously, I'm sort of curious how people actually feel about this.
17:21Glenjamini heard that's what makes lisps agile :p
17:22arrdemGlenjamin: there's a guy at the ATXCLJ meetup who's entire company does that 0₀
17:22tickingsdegutis: I'm sorry I joined when you said, that you liked clojures dynamism but found something else more elegant, so I was wondering what that was
17:22Glenjaminit seems to work for hacker news :D
17:22sdegutisticking: Pretty soon we'll be deploying just a .jar file and running it in production, instead of pulling our source code up and running `lein ring server-headless` on the production server.
17:23justin_smithwheeee: I've caught myself doing it, but I try not to. That kind of pickiness and not letting little things drop leads to good code, but bad interpersonal interatctions, especially when dealing with group dynamics
17:23wheeeePut directly — I think its a bad introduction to the community for people who might be interested.
17:23tickingsdegutis: Ah I see, well you should be able to embed a repl into a jar anyway, so you don't really lose any dynamism
17:23TimMctechnomancy: Oh yeah, the talk Alec gave.
17:23wheeeejustin_smith: I agree with you on the code side but I don't think the context is right.
17:23justin_smithwheeee: from the nitpcker's point of view, they are saving someone hours of pain they would otherwise suffer if they made a wrong choice on incomplete information, but big picture they are disrupting an event and making it unpleasant
17:24justin_smithright
17:24gtrakjustin_smith: someone once told me I'm really concrete in my thinking, I corrected her and said I'm also very abstract.
17:24justin_smithheh
17:24TimMcI think he actually had a point he was trying to make but between him and various audience members it devolved into "no u"/
17:24tickingspeaking of pedantics, am I alone in feeling that instaparses custom error handling is an inconvenience?
17:25cbpThe only meetup I've been to (on fp) was a bunch of mostly haskell guys bashing java when half of the room were just java programmers :-P
17:25tickingcbp: I've gone tired of PL
17:26tickingcbp: I've gone tired of PL tollerance, if people start a non corporate project in a shitty language, I freely call them idiots by now
17:26tickingcbp: funny thing is, that turned about 40% into clojurians ^^
17:27gtrakI don't think I've ever persuaded someone by calling them an idiot.
17:27gtrakI've tried.
17:28wheeeeThanks for the responses everyone, just curious to see what folks think and had encountered
17:28TimMcwheeee: Most of my meetup experiences have been fine in that regard, though.
17:28tickinggtrak: it admittedly depends heavily on how well you know the person
17:28cbpWell in any case, I don't see that many mechanical sympathy guys programming with really high level functional languages
17:28sdegutisticking: oh good idea, I can embed an nREPL client into the jar and toggle it via arguments
17:29tickingsdegutis: yeah I do that as well :)
17:30wheeeeThanks TimMc
17:30justin_smithcbp: that is part of why ats seemed intreguing - for that blend of high level expressiveness with absolute control of low level representation
17:31justin_smithmaybe some day it will be mature enough for me to do something interesting with it
17:31cbpjustin_smith: is it just 1 person working on it?
17:32justin_smithcbp: like a three person team, one uses it to teach a graduate class
17:32arrdemcbp: there's only what, seven people working even indirectly on cljs?
17:32justin_smith(and is the original author)
17:32justin_smitharrdem: for some perspective community wise, there are 0 SO posts with the [ats] tag
17:33justin_smithmaybe I will make one just on principle
17:33amalloyjustin_smith: [meta] Why are there no posts tagged [ats]?
17:33tickingjustin_smith: have you seen proofmarket where you can trade bitcoin for coq proofs?
17:34cbpjustin_smith: is there a reddit forum? =p
17:34justin_smithheh
17:34TimMcticking: :-D
17:34justin_smithcbp: oh, yeah http://www.reddit.com/r/ats but this is all very OT
17:35tickingjustin_smith TimMc: this seems like the killer feature for dependent typing, you just write down the type of the transformation you want to do and autocompletion will find a function that does that in _all functions ever written_
17:35justin_smithticking: oh wow
17:35arrubinThe Chicago Clojure meetups are great.
17:35Jaoodarrdem: isn't cognitect pouring resources into cljs?
17:35cbp"We can tell there are exactly 11 ats users because that's the most any topic has ever gotten"
17:35arrdemJaood: maybe I haven't been paying attn.
17:36cbpthe most upvotes*
17:37justin_smithheh
17:37justin_smithcbp: I am seeing some posts with 8 ups, 3 down
17:37justin_smithbut yeah 11 max votes seems consistent here...
17:39visofHello
17:40sdegutisarrubin: sometimes wish I lived a little closer
17:40sdegutisbut it's about 60 miles away
17:41johnwalkeris there a nice way to keep track of writers in clojure?
17:42johnwalkeri was looking at timbre earlier and noticed that the appender-fn just uses spit
17:42visofi have write a code to convert [[1 2 3] [3 4 5] [2 2 0]] two {2 [3 0] 4 [5]} , and my code return empty {} but if i tried the map without @h in repl it's working
17:42amalloyjohnwalker: http://en.wikipedia.org/wiki/List_of_notable_20th-century_writers
17:42visofthe code is here https://www.refheap.com/86491
17:42johnwalkerlol
17:43arrdem(inc amalloy)
17:43lazybot⇒ 123
17:43visof(inc visof)
17:43lazybotYou can't adjust your own karma.
17:43visofhaha
17:43visof(inc arrdem)
17:43lazybot⇒ 30
17:44Jaood(inc Jaood)
17:44lazybotYou can't adjust your own karma.
17:45fo1234(inc Jaood)
17:45lazybot⇒ 1
17:45fo1234(inc Jaood)
17:45lazybot⇒ 2
17:45fo1234(inc Jaood)
17:45lazybot⇒ 3
17:45fo1234(inc Jaood)
17:45lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
17:45johnwalkerlol
17:45Jaoodowned
17:46justin_smithvisof: in that let statement, try (let [[s p o] l] ...)
17:46amalloybrb gonna set Jaood's karma to -5
17:46Jaood:(
17:46arrdemamalloy: database hacking is cheating :p
17:47arrdem$karma so
17:47lazybotso has karma -28.
17:47visofjustin_smith: is there a good way to rewrite this?
17:47johnwalker8 points from hufflepuff, Jaood
17:47amalloyvisof: map is lazy
17:47justin_smithvisof: also (swap! h conj {p [o]}) looks wrong, given h is a map
17:48arrdemjustin_smith: should be a type error wrong
17:48amalloyjustin_smith: for reasons unknown, (conj m1 m2) is the same as (merge m1 m2)
17:48visofjustin_smith: it's working
17:48visofwithout errors
17:48justin_smithoh, wow, ok...
17:49justin_smithI still think (swap! h assoc p [o]) is better though
17:50prachetasphow do i cleanly manage and close db connections in a ring application
17:51visofjustin_smith: try (let [[s p o] l] ...) can't understand what did you mean?
17:51justin_smithprachetasp: c3p0 is a drop in to the clojure.data.jdbc connection map
17:52justin_smithvisof: I literally mean that, it binds each symbol positionally
17:52justin_smith,(let [[a b c] (range)] c)
17:52clojurebot2
17:52visofah got it
17:52justin_smithit is clearer than manually asigning with nth repeatedly
17:53visofjustin_smith: it still return empty map
17:54visofbut when tried without defining h it's working
17:54justin_smithvisof: like we mentioned map is lazy
17:54justin_smithyou need to use doseq instead of map, or put the map in a dorun, or use the result of map, or something
17:54justin_smith,(do (map print (range 100)) nil)
17:54clojurebotnil
17:55justin_smith,(do (dorun (map print (range 100))) nil)
17:55clojurebot0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
17:55amalloybetter still, don't use an atom at all, and just use reduce instead of map
17:55justin_smithyeah, good point
17:57amalloyin fact, i think the implementation is just https://www.refheap.com/e2fc8d9eda0121f4ce444c46b
17:59martinklepschI guess there is a function for that: (that-fn #(str %) [:a :b]) => [:a "a" :b "b"}
18:00arrdemmartinklepsch: mapv
18:00amalloymartinklepsch: (partial mapcat (juxt identity f))?
18:01justin_smithmartinklepsch: you probably need name instead of str?
18:01arrdemamalloy: I think he wants an (into {}) there..
18:01amalloyarrdem: maybe. i saw the [, didn't notice it was mismatched with }
18:02amalloyeither way, juxt
18:02martinklepschjustin_smith, you're right, name is correct in that example.
18:02arrdem,(str ::foo)
18:02clojurebot":sandbox/foo"
18:02arrdem,(name ::foo)
18:02clojurebot"foo"
18:02justin_smithmartinklepsch: also #(str %) is just str plus an enforced single argument
18:02justin_smithand enforcing a single argument gets you nothing, especially in that context
18:04martinklepschsorry for the wrong bracket, it's almost unreadable with that font here
18:04martinklepschjustin_smith, yeah just string would have done it too, but what do you mean with "gets you nothing"?
18:06justin_smith#(str %) does nothing str doesn't do
18:06justin_smithother than enforce a single argument
18:06justin_smithand in that context, you can only get a single argument
18:06martinklepschjustin_smith, ah ok, right
18:09umpaso this does intersection for one node ,(set/intersection #{1 2 3} (into [] (map set (partition 3(range 10)))))
18:09umpa,(set/intersection #{1 2 3} (into [] (map set (partition 3(range 10)))))
18:09clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: set, compiling:(NO_SOURCE_PATH:0:0)>
18:10umpaHow do I itterate through all the nodes and intersect ?
18:12visofamalloy: (triples-to-hash [[1 2 3] [1 2 4] [1 2 5] [1 3 7]]) => {1 {3 [7], 2 [3 4 5]}} , can i make [7] as 7 , so if n of elems is one it need not to use list
18:12visof?
18:12martinklepschthis is what I have right now:
18:12martinklepsch,(for [strings ["abc" "efh"]] (into {} ((fn [s] {s (keyword s)}) strings)))
18:12clojurebot({"abc" :abc} {"efh" :efh})
18:12visofamalloy: also your code is great
18:12martinklepschI'd like to merge these maps as well
18:12amalloyyou don't want that, visof. it's much easier to deal with something that's always a list than something that might be a list, might not, who knows
18:14justin_smith,(map #(set/intersection #{1 2 3} %) (map set (partition 3 (range 10)))) visof: something like this?
18:14clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: set, compiling:(NO_SOURCE_PATH:0:0)>
18:15justin_smith,(map #(clojure.set/intersection #{1 2 3} %) (map set (partition 3 (range 10)))) visof: something like this?
18:15clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
18:15amalloymartinklepsch: you want (into {} (for ...)), not the other way around
18:15clojurebotCool story bro.
18:15arrdemjustin_smith: set/intersection shouldn't be defined for a single element anyway...
18:15arrdemmap set
18:16justin_smitharrdem: that's not a single argument
18:16arrdemjustin_smith: yep just realized that.
18:16martinklepschamalloy, that makes sense
18:16martinklepschamalloy thank you!
18:17canweriotnow,(str :foo)
18:17clojurebot":foo"
18:17canweriotnowI <3 clojurebot
18:17martinklepschis that the idiomatic way of doing it as well? amalloy
18:18amalloyyes, i use (into {} (for ...)) often
18:19martinklepschamalloy, ok thanks!
18:19martinklepschamalloy, thinking about it I feel stupid for that initial approach now haha :D
18:19umpajustin_smith: nice
18:21justin_smithumpa: oh oops, highlighted the wrong user, but I guess you saw it anyway
18:26umpajustin_smith: haha yeah i was confused there for a sec. Thought someone else had the exact same question.
18:27jack_rabbitSo, I've got a large leiningen project that tells me "5 failures, 1 errors" on 'lein test,' but doesn't seem to tell me what failed. Is there a place I can grab this information from?
18:27hiredmanhow are you running the tests?
18:28jack_rabbitlein test
18:28hiredmanbecause lein test prints out test failure information
18:28jack_rabbitwell... That's what I thought, but it doesn't seem to be doing that this time.
18:28amalloythose failure prints can get lost if your tests print out a sea of unrelated nonsense
18:28hiredmandefinitely
18:28jack_rabbitamalloy, indeed that's what's happening.
18:28hiredmanso don't do that, of course
18:28jack_rabbitAre there keywords i can grep?
18:29cbpFAIL ERROR
18:29amalloyjack_rabbit: you can probably grep for :only
18:29hiredmanjack_rabbit: think of this as an opportunity to clean up your tests and not print out garbage
18:30jack_rabbithiredman, yeah. that would take weeks of work. This project is huge.
18:30amalloyi wish i always had that option, hiredman. i've inherited projects with gobs of clojure.tools.logging stuff and no obvious way to turn them off in testing
18:30hiredmanamalloy: uh, if you configure logging to log to a file it won't go to the console?
18:30jack_rabbitAnyway, i found *something* with 'ERROR in whatever.clj'
18:30hiredmanjust stick a log4j.properties in tests/
18:31jack_rabbityeah, we might have to do that.
18:31hiredmanI don't understand how you can live with out that
18:31hiredmando you just not see log messages when you fiddle at the repl?
18:33jack_rabbitno, I get none of that garbage at the REPL.
18:33jack_rabbitOnly tests for some reason.
18:33hiredmanright, it is going to stdout which is god knows where at the repl
18:34hiredmanbut if you just configur your tests to log to a file, then you always have the log output, there, in that file
18:34jack_rabbitThat's how it runs in production. I don't know why the tests haven't been configured to do that.
18:35skinkittenthanks TEttinger3 that helped
18:36hiredmanjack_rabbit: do it, just make sure to put the logging configuration under tests or dev-resources so production logging configuration can make indepedent decisions about logging
18:36jack_rabbitsure.
18:45arrdemAnyone have a java IDE they'd suggest for working with the Clojure core? Emacs isn't cutting it for slogging through Compiler.java.
18:46amalloyeclipse
18:52visofamalloy: is there a good way to do it, sorry to be late
18:52visofamalloy: still there?
19:01jack_rabbitarrdem, I'm using emacs with cider and ac-cider-compliment, and it works beautifully. Are there particular features you're looking for?
19:01johnwalkeris ac-cider-compliment faster than ac-nrepl?
19:01jack_rabbitnot sure, actually.
19:01jack_rabbitI think it might just be newer.
19:02johnwalkerdoes your emacs stutter when you use ac-cider-compiliment*?
19:02jack_rabbitnot at all.
19:03johnwalkeri'm going to give it a shot ;p thanks
19:03jack_rabbit:) no problem. Hope it works better for you.
19:03johnwalkerme too lol
19:15aperiodicgo dork
19:18umpawhy no work ? https://www.refheap.com/86496
19:21hiredman,(doc filter)
19:21clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
19:29stephenjudkinsi have two vectors. is this the most efficient way to append one to the other?
19:29stephenjudkins, (apply conj [1 2 3] [4 5 6])
19:29clojurebot[1 2 3 4 5 ...]
19:31hiredmanthe most efficient way to do anything is not to
19:32hiredmanso I suggest restructuring your program in a way that avoids the need to concat vectors
19:32hiredman(and if you must, use into)
19:33stephenjudkinshiredman: why avoid it? what's wrong with into?
19:33hiredmanwhy do it?
19:34aperiodicif you need to concatenate vectors that suggests you might not want to be making vectors in the first place
19:34stephenjudkinsaperiodic, hiredman : any other data structures you'd recommend?
19:34aperiodicseqs
19:35hiredmanseqs concat fast, but because concat is lazy depending on how many concats you are stacking up you can end up blowing the stack when you go to realize them
19:36hiredmanhttps://github.com/clojure/core.rrb-vector says it has o(log n) concat
19:45stephenjudkinsaperiodic, hiredman : thanks. i'm new to clojure and appreciate your help.
20:01hyPiRionstephenjudkins: I'd recommend to use (into [1 2 3] [4 5 6]) unless you really notice that it is too slow
20:01hyPiRionIf you're new to Clojure, I'd just recommending sticking with lazy seqs, maps, sets and vectors and get to know them well first
20:02hyPiRionUsually you can get away with a lot as long as you know how to use those data structures
20:02stephenjudkinshyPiRion: when i see something is O(log n) i tend to not worry about it until it's time to profile
20:02stephenjudkinso(n) or worse can get you into trouble
20:04bbloomstephenjudkins: i love O(N^3) algorithms
20:04bbloom.... for small Ns
20:04bbloomeverybody else ignroes them
20:04bbloomthey work great :-)
20:04hyPiRionfloyd-warshall to the rescue
20:06hiredmanmay your constant factors always be small
20:59deathknightclj-gapi looks freaking great
21:27FrozenlockIs there a way to prevent cljs dependencies to be included in a uberjar?
21:27Frozenlockgoog is taking almost 20mo...
22:49skinkittenhow do I replace 1 2 in here without using the key? {1 2, 2 2, 3 5}
22:50beamso,(rest {1 2, 2 2, 3 5})
22:50clojurebot([3 5] [2 2])
22:51skinkittenthats removing it. what about replacing it e.g with 11 11
22:52beamso,(assoc (into {} (rest {1 2, 2 2, 3 5}) 11 11)
22:52clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:52beamso(assoc (into {} (rest {1 2, 2 2, 3 5})) 11 11)
22:53skinkitten,(assoc {} (rest {1 2, 2 2, 3 5}) 11 11)
22:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: assoc expects even number of arguments after map/vector, found odd number>
22:54skinkittenand if I wanted to do it to 2 2, or 3 3,
22:55skinkittenor any n index in the array map
22:56beamsoyou'd probably have to use dissoc, keys and nth
23:01skinkittenhm. thanks