#clojure log - Jun 11 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:02 ddellacosta: sneak_peek: no, just spit out the records as they are, is all I'm arguing for: {:users [{:id 1 :name "..."} {:id 2 :name "...}]} ...etc.

0:02 sneak_peek: and lean on your relational database's power. Or else use datomic. :-)

0:04 sritchie: ddellacosta: we’re switching off heroku in the next month or so, then probably onto datomic

0:04 excited :)

0:05 ddellacosta: sritchie: awesome! I have to admit I've barely touched datomic...but look forward to getting more into it.

0:05 sneak_peek: ddellacosta: oh wow okay - now that is a radical idea. how does it work going int he opposite direction e.g. UPDATE's

0:05 umpa: (doseq [group (partition 3 (range 10))] (println group))

0:05 how do I get vertical seq from this grid ?

0:05 devn: ,(map first (partition 3 (range 10)))

0:06 clojurebot: (0 3 6)

0:06 devn: ?

0:06 ddellacosta: sneak_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

0:06 sneak_peek: and then from there it's just your standard insert/update/delete

0:06 sneak_peek: for that CRUD stuff I think REST maps quite well and simply

0:08 umpa: devn: nice

0:08 sneak_peek: ddellacosta: 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

0:09 ddellacosta: sneak_peek: well, let us know how it goes. :-)

0:09 sneak_peek: ddellacosta: will do. thanks for all the help

0:09 ddellacosta: sneak_peek: and yeah, I think KISS is a good principle to start with here. Sure thing, cheers!

0:26 umpa: how can i can get all of the 3 sets of vertical values into a partitioned list ?

0:35 amalloy: are you looking to transpose a matrix, umpa? ##(apply map list '((a b) (1 2)))

0:35 lazybot: ⇒ ((a 1) (b 2))

0:38 umpa: amalloy: yep thats it

0:40 how do I get the diagonals of the grid into a list?

0:43 this grid ,(doseq [group (partition 3 (range 10))] (println group))

0:51 TEttinger: umpa, uh that isn't square

0:51 ,(partition 3 (range 10))

0:51 clojurebot: ((0 1 2) (3 4 5) (6 7 8))

0:51 TEttinger: oh yes it is

0:51 thinking of partition-all

0:51 jonasen: umpa: something like (map nth (partition 3 (range 10)) (range)) ?

0:53 ,(map nth (partition 3 (range 10)) (range))

0:53 clojurebot: (0 4 8)

0:55 umpa: jonasen: neat, how about the other diagonal

0:56 jonasen: ,(map #(nth %1 (- 3 %2)) (partition 3 (range 10)) (range))

0:56 clojurebot: #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>

0:56 jonasen: ,(map #(nth %1 (- 2 %2)) (partition 3 (range 10)) (range))

0:56 clojurebot: (2 4 6)

0:57 jonasen: ,(map nth (partition 3 (range 10)) (range 2 -1 -1))

0:57 clojurebot: (2 4 6)

1:01 umpa: jonasen: nice

1:04 ddellacosta: is there any reason why I shouldn't use the (->SomeType ...) syntax vs. importing/using (SomeType. ...) syntax?

1:04 I'm getting strange inconsistencies otherwise

1:05 ...when running in the repl

1:07 amalloy: map nth. that's cute, jonasen

1:21 engblom: Is there a tool for making a *.clj file tidy? Sometimes when you paste stuff from net the indentation gets completely messed up.

1:22 amalloy: nothing better than just pasting it into emacs and asking for a reindent there

1:27 engblom: I 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?

1:27 Those project I have found are using clojure 1.2

1:29 wildnux: hi, 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?

1:30 ddellacosta: wildnux: check out https://github.com/rkneufeld/lein-try

1:30 wildnux: ddellacosta: thank you :) will try

1:39 ambrosebs: does this index OOB exception deep inside clojure.test look familiar to anyone? http://build.clojure.org/job/core.typed/533/console

1:45 oh that error is evil!

1:45 https://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L337-339

1:46 that code threw an OOB exception

1:49 devn: given '(((\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)))

1:51 maybe easier to read as

1:52 [[[1 2 3] [4 5 6]] [[7 8 9] [10 11 12]]] => [[[1 2 3] [7 8 9]] [[4 5 6] [10 11 12]]]

1:55 jonasen: devn: destructuring? (defn swap [[[a b] [c d]]] [[[a c] [b d]]])

1:55 amalloy: devn: isn't that just transposing it?

1:55 (apply map list [[[giant-mess]]])

1:57 devn: amalloy: that's exactly what i needed

1:57 thanks

1:57 ambrosebs: how does that work?

2:02 apparently if you blow the memory lots of strange things start to happen..

2:06 wildnux: ddellacosta: 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

2:06 CompilerException java.lang.ClassNotFoundException: net.cgrand.enlive-html, compiling:(NO_SOURCE_PATH:1:1)

2:08 ddellacosta: that error is when i do: (:require [net.cgrand.enlive-html :as html])

2:08 ddellacosta: wildnux: are you doing that in the repl?

2:11 works fine for me, if I require in the repl like so: (require '[net.cgrand.enlive-html :as html])

2:11 wildnux: 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.

2:12 wildnux: ddellacosta: thank you

2:12 ddellacosta: i was missing '

2:12 i am very new :)

2:13 ddellacosta: wildnux: you're welcome. :-)

2:14 stkim1: Help! I’m using LT 0.6.6 and trying to connect to a project but nothing happens. nothing!

2:14 I’m on ubuntu 12.04

2:25 engblom: Is something wrong with my setup? I am not able to get almost anything graphical to work. I am using openjdk1.7.

2:32 ambrosebs: mrb_bk: hi

2:33 dbasch: engblom: what happens if you type java.awt.Frame into the repl?

2:34 engblom: user=> java.awt.Frame

2:34 java.awt.Frame

2:35 dbasch: engblom: what OS are you running?

2:35 yeoj___: 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?

2:35 engblom: dbasch: OpenBSD

2:37 When running: 'java -jar nightcode-0.3.6-standalone.jar' I get an empty window. When I close it, I get graphical confirmation question.

2:37 The console is full of lines containing awt because of some exception.

2:38 I 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.

2:38 dbasch: yeoj___: what is a map with three entries? maps need an even number of entries

2:40 engblom: I’ve never used the jdk on OpenBSD, so I have no idea. It does sound like a problem with your setup.

2:41 engblom: dbasch: Which jdk do you use: openjdk or the one from oracle?

2:41 dbasch: engblom: both, on linux and osx

2:42 engblom: dbasch: And you have had no problem by using openjdk?

2:42 dbasch: none

2:42 yeoj___: i think i explained it wrong... i have this: https://www.refheap.com/86472

2:42 dbasch: are you exporting your display variable correctly?

2:43 yeoj___: 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

2:43 s/dictionaries/map/

2:43 engblom: Yes, and the frame (window) is appearing when I try to run a jar. The content inside of it is missing.

2:44 TEttinger: engblom: i wonder if it has to do with the skin nightcode uses

2:45 engblom, can you take a screenshot?

2:45 engblom: Also, I am using dwm as wm. Could this be a problem?

2:45 TEttinger: I'd like to see what the missing content is replaced with, though I have no experience with openBSD

2:45 bob2: sure, dwm will make java X apps behave in useless ways

2:46 TEttinger: (inc bob2)

2:46 lazybot: ⇒ 2

2:47 bob2: http://awesome.naquadah.org/wiki/Problems_with_Java

2:51 engblom: bob2: That solved the problem with NightCode! Thanks!

2:53 dbasch: yeoj___: https://www.refheap.com/86473

2:54 yeoj___: close enough to what you need, I think

2:54 yeoj___: dbasch: thats awesome. i'm going to have to stare at it for a few hours.

2:54 dbasch: ugh this stuff bends my brain.

2:55 dbasch: I’m sure there’s a cleaner way too

2:56 engblom: I 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

2:56 The gray area to the left is nightmod running.

2:57 dbasch: yeoj___: (map vector [a b c] [d e f]) gives you [a d] [b e] [c f]

2:57 engblom: The console down to the right is the latest errors appearing when running nightmod.

2:59 TEttinger: geez that's a stacktrace

2:59 can you figure out what causes it, where in your code?

3:00 (guessing play-clj calls something native in libGDX that isn't supported without some finagling on BSD)

3:04 engblom: TEttinger: http://pastie.org/9279253

3:06 TEttinger: yep.

3:08 https://github.com/libgdx/libgdx/blob/478756ac89700d10dfe844aba809e4a85870ec20/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglNativesLoader.java#L52-L71

3:08 the error leads to there, which shows it never tests for BSD

3:11 engblom: TEttinger: Thanks. That explains.

3:12 TEttinger: sorry it won't work without source changes to the lib... there might be a fork

3:23 engblom: Is there any other game-making library anyone could recommend besides play-clj as libgdx is not available for my platform?

3:24 TEttinger: not sure what Morgawr's Cloister engine uses

3:25 https://github.com/Morgawr/Cloister-engine keep in mind the heavy alpha notice :)

3:25 I don't even know if lwjgl is portable to BSD

3:26 libgdx uses LWJGL, cloister uses LWJGL without the intermediate libGDX, play-clj with libgdx

3:27 engblom: Thanks

3:29 TEttinger: ha! yes it is

3:29 http://www.lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL

3:29 LWJGL considers bsd another linux

3:36 engblom: Exception in thread "main" java.lang.LinkageError: Unknown platform: OpenBSD

3:36 lwjgl is not working directly either.

3:36 I tried the test line from http://www.lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL

3:38 TEttinger: damn

3:39 to be fair, OpenBSD's gaming selection generally consists of nethack

3:39 (for which there is lanterna and squidlib)

3:40 (I've used squidlib, it's good)

3:40 engblom: OpenBSD has come quite far the latest time. We have flightgear among other

3:40 TEttinger: I was under the impression that BSD was ideal for servers since it's so reliable, less so for desktop usage

3:41 (less ideal)

3:42 engblom: It is true that server stability is prioritized when it comes to OpenBSD, but not all devs are working with that.

3:43 I 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.

3:43 TEttinger: well if you're not doing 3D then you can get pretty far with swing

3:43 or AWT even

3:43 engblom: Is quil advanced enough for simple 2d platform games?

3:43 TEttinger: oh yeah

3:44 engblom: Or is it just a library for creating images?

3:44 TEttinger: quil is based on processing, which has been used for plenty o' gams

3:44 $google wayfarer processing

3:44 lazybot: [Wayfarer (alpha)] http://benhem.com/games/wayfarer/

3:44 amalloy: clojure 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

3:45 kzar: ZZT 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

3:45 TEttinger: I'd argue JS offers the most immediate feedback

3:45 Glenjamin: amalloy: i've seen the argument "but what if you didn't have to unlearn mutable state", not sure how much i agree though

3:46 amalloy: Glenjamin: i'm not arguing functional vs pure. scheme is a great first language

3:46 clojure is just very "batteries included", which is confusing if you don't know what all those bells and whistles are for

3:46 Glenjamin: makes sense

3:47 TEttinger: also, 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

3:47 kzar: I suppose there's always the possibility of making a library for them that's simple to use to do what they want

3:48 hmm 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

3:48 engblom: TEttinger: I am teaching them web design too

3:48 TEttinger: host on dropbox, get them to sign up with you as referrer. get 100 GB free dropbox

3:48 Glenjamin: engblom: are you familiar with code club?

3:48 TEttinger: this is what a friend who is a teacher did with several classes

3:50 Glenjamin: there might be some good suggestions/resources on here https://www.codeclub.org.uk/

3:50 engblom: kzar: 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.

3:50 Glenjamin: Thanks, I am looking it up!

3:51 kral: namaste

3:51 kzar: I 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

3:52 (Kudos for giving it a try)

3:53 allenj12: if 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?

3:56 engblom: kzar: From earlier experience, kids have more difficult to understand recursive functions than lazy sequences.

3:56 kzar: Adults too I guess

4:00 Is there something like the -> macro for when you need to call java methods? Something that would work for this (.replace (.getName file) old new)

4:08 How do you delete a directory from Clojure?

4:08 jonasen: (-> file .getName (.replace old new))

4:09 kzar: you could use raynes/fs: http://raynes.github.io/fs/me.raynes.fs.html#var-delete-dir

4:10 kzar: jonasen: cheers

4:17 visof: if 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>"]] ?

4:18 i 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

4:18 and then he suggest to use CSV lib to do this

4:18 is there a good solution for this problem?

4:19 nixn: visof: you could search for a library which handles inner quoted strings

4:20 or give a complex regex

4:20 for the splits

4:27 rurumate: is there a not-lazy version of concat? the lazyness is munging the stack trace, great headache when debugging

4:28 nixn: visof: 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 ...)

4:28 re-matches, not re-groups

4:29 rurumate: ,(apply concat [[1] [2] [3]])

4:29 clojurebot: (1 2 3)

4:30 stain: ,(doall (concat [:a :b] (range 5)))

4:30 clojurebot: (:a :b 0 1 2 ...)

4:35 rurumate: ,(reduce (fn ([] nil) ([a b] (conj a (first b)))) [] [[1] [2] [3]])

4:35 clojurebot: [1 2 3]

4:36 rurumate: ,(reduce (fn ([] nil) ([a b] (into a b))) [] [[1] [2] [3 4]])

4:36 clojurebot: [1 2 3 4]

4:37 allenj12: i should be able to require a local file right?

4:40 o silly require instead of use lol i always do that

4:41 rurumate: I think use is deprecated, use refer :all

4: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"))

4:42 clojurebot: (("<x>" "<y>" "\"Hello\"") ("<xx>" "<yy>" "\"hello\nworld.\"") ("<a>" "<b>" "<z>"))

4:42 rurumate: it's still all over many open source projects though

4:42 allenj12: o rly?

4:42 _ato: visof: ^ heh

4:42 rurumate: ,(require '[clojure.string :refer :all])

4:42 clojurebot: #<SecurityException java.lang.SecurityException: denied>

4:43 nixn: ,(re-seq #"\".*?\"|[^\s\"][^\s]*" "<x> <y> \"Hello\"\n<xx> <yy> \"hello\nworld.\"\n<a> <b> <z>\n")

4:43 clojurebot: ("<x>" "<y>" "\"Hello\"" "<xx>" "<yy>" ...)

4:45 visof: _ato: thanks

4:45 _ato: it's a complex, can i do it simpler ?

4:46 allenj12: ,(clojure.walk/postwalk #(if (seq? %) (reverse %) %) [1 3 5 [3 1 9]])

4:46 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>

4:46 allenj12: does that work for anyone btw?

4:46 in repl :p

4:47 should reverse everyithng

4:47 _ato: visor: 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

4:48 rurumate: thumbs up if your company wants to fire you for using LISP but can't because not everything could be rewritten in java yet!

4:48 allenj12: lol

4:56 is there a way to reverse a coll but keep the original data structure?

4:57 (reverse2 [1 2 3]) => [3 2 1] (reverse2 '(3 2 1)) => '(3 2 1)

5:02 Glenjamin: ,(defn reverse-keep [coll] (into (empty coll) (reverse coll)))

5:02 clojurebot: #'sandbox/reverse-keep

5:02 GrannyXXX: clojurebot

5:02 Ehh

5:02 Glenjamin

5:02 Glenjamin: ,(reverse-keep [1 2 3])

5:02 clojurebot: [3 2 1]

5:02 GrannyXXX: Do you believe that console gamers are genetically inferior to PC gamers?

5:02 Glenjamin: ,(reverse-keep '(1 2 3))

5:02 clojurebot: (1 2 3)

5:02 Glenjamin: hrm

5:02 oh, conj

5:02 damn

5:03 allenj12: Glenjamin: thanks

5:03 Glenjamin: that doesn't actually work on lists

5:04 i guess its more important to ask, why do you want to keep the original structure

5:04 allenj12: Glenjamin: it did for me...

5:04 Glenjamin: doing a macro talk soon and wanted to me Psil, lisp but everyithing backwards

5:05 ((1 1 +) [] two defn)

5:05 clgv: ,(into () (range 19))

5:05 clojurebot: (18 17 16 15 14 ...)

5:06 clgv: allenj12: wouldnt it be better to use useful macros in such a talk?

5:06 allenj12: clgv: well i figured it would be macro that used that function

5:06 clgv: allenj12: if your point is to convince someone about the usefulness of macros you'll defeat that point by useless examples

5:07 allenj12: clgv: it was just for fun rly

5:07 clgv: allenj12: easy but useful examples are e.g. `when-let` then go for extending it to `when-let-all` with multiple bindings

5:08 custom looping macros for problem specific data structures...

5:08 allenj12: clgv: yea i already had stuff like that planned out :)

5:08 Glenjamin: i've got a fairly neat (plet) macro that runs each binding in a future

5:08 kzar: (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?

5:09 clgv: Glenjamin: a `plet` with dependency resolution would be a more advances but fun example

5:09 allenj12: clgv: like i said it was more for like a little fun thing to put in there

5:09 Glenjamin: yeah, so far i haven't needed dependencies

5:09 but if i do, i'm looking forward to writing that macro

5:09 clgv: allenj12: depending on your goal, it could do harm ;)

5:10 allenj12: clgv: you think so? i thought a little comedy would help. it would also show that macros can be taken too far.

5:11 clgv: well regardless, i wanna do it for now for shits and giggles, ill think about actually putting it in more.

5:13 clgv: allenj12: it all depends on the context and the goal of the talk. if it is a clojure group meeting just go for it ;)

5:14 allenj12: clgv: no its a meeting with people of all different backgrounds, mostly c python programmers.

5:15 clgv: allenj12: hummm, and the goal of the talk is?

5:15 allenj12: clgv: to show the flexibility and power that a lisp can offer

5:15 clgv: allenj12: then better choose another usefull example ;)

5:16 allenj12: clgv: haha alright, i dont know how you get more flexible than writing the language backwords tho :p

5:17 clgv: still gonna do this tho, its fun either way hehe :)

5:17 clgv: allenj12: yeah but the c guys will say "how is inverting the syntax ever going to be usefull?"

5:17 allenj12: yeah, exercising is good ;)

5:18 allenj12: clgv: yea, i was hoping people would just take it as a joke, but your right more harm than good

5:18 clgv: allenj12: stuff like "transparently" parallelizing will amaze them ;)

5:19 wei: does 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

5:19 ^ re: Datomic, that is

5:20 clgv: allenj12: 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

5:20 allenj12: I did something similar in a lisp course for the task of computing julia sets

5:21 allenj12: clgv: o yea that would pretty awsome! definatley getting added on

5:21 kzar: magnars: Any idea why (stasis.core/slurp-directory "public/" #".*") isn't working? (the public directory does exist)

5:23 allenj12: clgv: like this right?

5:24 clgv: http://stackoverflow.com/questions/10969708/parallel-doseq-for-clojure

5:26 clgv: allenj12: 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

5:28 allenj12: clgv: ahh kk

5:41 engblom: Could 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

5:43 allenj12: engblom: ill look at it after im done with this if i can.

5:44 engblom: allenj12: The only thing differing is that I used quil 2.0.0 (newest)

5:47 nbeloglazov: allenj12: show the code you're running. From tutorial it hard to understand where it fails.

5:48 allenj12: nbeloglazov: for what?

5:50 engblom: nbeloglazov: I guess you meant me... http://pastie.org/9279628

5:50 nbeloglazov: Ah, sorry :)

5:50 engblom: It is copy & paste from the tutorial

5:50 nbeloglazov: Ok, the problem is that you have var snake defined twice

5:51 magnars: kzar: 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

5:51 nbeloglazov: First time on line 10 and second time on line 64

5:51 Just rename (q/defsketch snake ...) to (q/defsketch snake-sketch ...)

5:51 kzar: magnars: Not in resources no

5:52 magnars: 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

5:52 "FileNotFoundException public java.io.FileInputStream.open..."

5:53 engblom: nbeloglazov: Thank you! You are right about that. Now it is working

5:53 magnars: kzar: please open an issue with the relevant info, and I'll take a look.

5:54 kzar: Ok one moment

5:54 nbeloglazov: engblom: you're welcome :)

5:55 engblom: nbeloglazov: Even though it is working as intended, I get this: http://pastie.org/9279636

5:56 nbeloglazov: engblom: are you trying 'lein run' or something similar?

5:58 engblom: nbeloglazov: Yes, that is what I am doing

5:59 kzar: magnars: How's this? https://github.com/magnars/stasis/issues/9

5:59 engblom: nbeloglazov: Do I need to create a dummy main function?

6:00 nbeloglazov: Then I'd suggest to look at "Runnable jar" wiki article: https://github.com/quil/quil/wiki/Runnable-jar

6:00 If you want run it only via 'lein run', then yes, dummy main function should be sufficient.

6:01 engblom: Thank you!

6:01 nbeloglazov: If you want to create runnable jar - look at the article.

6:06 allenj12: https://www.refheap.com/86475 what im i missing here?

6:06 im getting parameters should be vector

6:09 nbeloglazov: allenj12: have you looked at the result of macroexpand-1? (macroexpand-1 '((psil ((1 2 +) [] three defn)))

6:10 allenj12: nbeloglazov: o geez i did but i saw the parens wrong lol

6:13 nbeloglazov: weird tho deep reverse of [] should be []

6:14 engblom: nbeloglazov: Thank you, that article was exactly what I needed!

6:14 allenj12: engblom: btw how is quil i never tried it

6:15 engblom: allenj12: So far it is looking very nice, but then I have not done anything than a copy & paste project for checking it out.

6:15 allenj12: engblom: ahh kk lol

6:17 nbeloglazov: allenj12: aaah, found bug in your code I think :)

6:17 (into (empty coll) (rseq %)) should be (into (empty %) (rseq %))

6:17 allenj12: nbeloglazov: where?

6:18 nbeloglazov: wow that was it! so stupid hahaha

6:19 (inc nbeloglazov )

6:19 lazybot: ⇒ 1

6:19 nbeloglazov: probably it would be better to extract #(cond ...) function as separate top-level function to avoid such bugs

6:20 allenj12: how do you check your value on here anway

6:20 nbeloglazov:

6:20 nbeloglazov: yea

6:22 nbeloglazov: allenj12: sorry?

6:22 allenj12: nbeloglazov: sorry for what? the first blank was a mistake lol

6:37 clgv: $karma nbeloglazov

6:37 lazybot: nbeloglazov has karma 0.

6:38 clgv: allenj12: 11

6:38 allenj12: ^^

6:39 allenj12: clgv: wait but i gave him one hmmm

6:39 nbeloglazov: :'(

6:39 allenj12: $karma allenj12

6:39 lazybot: allenj12 has karma 0.

6:39 allenj12: (inc nbeloglazov )

6:39 lazybot: ⇒ 2

6:39 allenj12: what!

6:40 wat!

6:40 clgv: allenj12: you have to omit the last blank

6:40 (inc nbeloglazov)

6:40 lazybot: ⇒ 1

6:40 allenj12: (inc nbeloglazov)

6:40 lazybot: ⇒ 2

6:40 allenj12: $karma nbeloglazov

6:40 lazybot: nbeloglazov has karma 2.

6:40 allenj12: weird

6:40 (inc allenj12)

6:40 lazybot: You can't adjust your own karma.

6:40 allenj12: dam

6:40 clgv: allenj12: lazybot uses the whole string until the closing parantheses

6:41 (inc 42

6:41 oh he ignores defect inputs^^

6:41 (inc 42)

6:41 lazybot: ⇒ 4

6:41 allenj12: (inc 42)

6:41 lazybot: ⇒ 5

6:42 nixn: $karma 42

6:42 lazybot: 42 has karma 5.

6:42 allenj12: haha

6:42 clgv: a bit too low right? :P

6:42 nixn: 42 karma for 42 is 100%

6:42 allenj12: (+ 30 42)

6:42 clojurebot: *suffusion of yellow*

6:42 allenj12: lol

6:44 engblom: Is anyone having a link to any documentation showing the html for loading an applet created with 'lein uberjar'

6:45 * clgv is still searching for an easily composable DSL for describing arbitrary charts

6:45 nixn: clgv: which charts?

6:47 clgv: data plots aka everything you can possibly do via jfreecharts

6:47 it's just a pain in the ass to be forced to program each of these in a lowlevel fashion.

6:49 there 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

8:12 engblom: When 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

8:19 clgv: engblom: create the sketch via a function?

8:20 engblom: you can use `sketch` instead of `defsketch`

8:21 engblom: clgv: 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?

8:23 clgv: engblom: you want to change those parameter values while the sketch is running?

8:24 roppongininja: boom! a ninja appears out of nowhere

8:25 noidi: engblom, I wrote a little wrapper around Quil to make it more functional https://github.com/solita/inkwell

8:25 here's an example project that can be used as a starting point https://github.com/solita/inkwell-playground

8:27 https://github.com/solita/inkwell-playground/blob/master/src/inkwell_playground/core.clj

8:29 it's written for a Clojure intro class I held, which is why the "playground" is structured the way it is

8:33 engblom: clgv: Yes, I want to change them while it is running

8:34 noidi: Thanks! This was what I wanted exactly, to make use more functional programming

8:47 clgv: engblom: but then you need some atom/ref or mutable properties of a deftype

8:48 engblom: clgv: It was this I wanted to avoid...

8:49 clgv: engblom: 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

8:49 it's a shame you cant use quil without GUI - I was tempted to render a graphic offscreen which did not work without a GUI

9:02 nbeloglazov: engblom: there will be Quil 2.1.0 release soon, which introduces functional-mode in Quil

9:04 hm, and looking at noidi's inkwell - it is pretty similar.

9:05 noidi: cool! :)

9:06 clgv: nbeloglazov: offscreen rendering is not an option due to processing, right?

9:07 nbeloglazov: clgv: I think so

9:08 clgv: nbeloglazov: hmm the concrete scenario was a server application so maybe the GSOC project for CLJS might help in the future

9:10 nbeloglazov: clgv: I think you still need browser for running cljs version. I mean it probably uses Canvas and WebGL api.

9:13 noidi: 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)...

9:16 umpa: why does this work ? ,(map nth (partition 3 (range 10)) (range ))

9:17 engblom: nbeloglazov: 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

9:19 nbeloglazov: engblom: I usually use (q/fill 0) (q/text "Hello, world" 20 20). Draws text on screen using black color.

9:27 jonasen: umpa: do you know what the pieces mean? map, nth, partition and range?

9:28 prachetasp: anyone have any experience with social network analysis in Clojure? any library suggestions I should look at first?

9:28 umpa: jonsen: yes, i don't understand how range can be used as a parameter for nth

9:28 jonasen: umpa: it

9:29 it's not. (map nth (<seq of rows>) <seq of indices>)

9:29 engblom: nbeloglazov: That looks a lot easier :)

9:30 jonasen: so for eact row: (nth <row> <index>)

9:30 s/eact/each/

9:41 umpa: jonasen: how does it know where to stop since range goes on forever ?

9:42 jonasen: umpa: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/map

9:42 umpa: map runs until "one of the colls are exhausted"

9:42 umpa: in this case the seq of rows

9:44 prachetasp: ,(print "hello")

9:44 clojurebot: hello

9:44 prachetasp: ,(map #(% %2) (range 1 5) (range 1 10))

9:44 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

9:45 prachetasp: ,(map #(identity [% %2]) (range 1 5) (range 1 10))

9:45 clojurebot: ([1 1] [2 2] [3 3] [4 4])

9:45 jonasen: ,(map vec (range 1 5) (range 1 10))

9:45 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec>

9:45 jonasen: ,(map vector (range 1 5) (range 1 10))

9:45 clojurebot: ([1 1] [2 2] [3 3] [4 4])

9:45 prachetasp: :)

9:45 much better

9:46 Nikentic: :)

9:52 engblom: How could I get a vector created instead of a list: (repeatedly 3 #(inc (rand-int 8)))

9:53 augustl: engblom: what's wrong with a list? :)

9:53 Bronsa: engblom: (vec ..)

9:54 engblom: Bronsa: Thanks!

9:59 augustl: I do not know, is destructuring possible with a list (fn [(a b c)] (do-some-things a b c))

10:00 Bronsa: ,(let [[a b & rest] (range 10)] [a b rest])

10:00 clojurebot: [0 1 (2 3 4 5 6 ...)]

10:00 Bronsa: engblom: ^

10:00 engblom: the vector destructuring syntax works for every seq

10:00 augustl: engblom: no you have to destructure with a vector

10:01 as in, the actual destructuring statement in the signature has to be written with a vector so (fn [(a b c)]) won't work

10:01 engblom: augustl: That is why I was asking in the first place how I get that as a vector and not as a list :)

10:01 augustl: engblom: not sure why that is relevant in your case of having a function that returns 3 random numbers, though

10:01 but you can destructure a list, using a vector. What Bronsa said

10:02 destructuring cannot be a statement anyway

10:03 umpa: ,(println "hello")

10:03 clojurebot: hello\n

10:03 engblom: ,(/ 1 0)

10:03 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

10:04 umpa: , (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:04 clojurebot: ((0 1 2) (3 4 5) (6 7 8) (0 3 6) (1 4 7) ...)

10:09 prachetasp: augustl: I know destructuring cannot be a statement but what would it be considered? syntactic sugar?

10:11 Glenjamin: is there a map-values function in core that maps over map values while preserving keys?

10:11 and if not, what is the usual name for such a thing?

10:12 ToxicFrog: Glenjamin: there isn't. I called it map-values because there's already a 'mapv' that does something completely different.

10:16 prachetasp: ,(into {} [[:x "y"] [:z "a"]])

10:16 clojurebot: {:x "y", :z "a"}

10:16 prachetasp: Glenjamin: could use destructuring and a reduce then into to jam it back into a map - thats usually how I do it

10:16 Glenjamin: (reduce-kv f {} coll) is close

10:19 prachetasp: yeah probably your best bet

10:20 Glenjamin: ,(defn map-values [f m] (reduce-kv #(assoc %1 %2 (f %3)) (empty m) m))

10:20 clojurebot: #'sandbox/map-values

10:20 Glenjamin: (map-values inc {:a 1 :b 2})

10:20 ,(map-values inc {:a 1 :b 2})

10:20 clojurebot: {:a 2, :b 3}

10:22 prachetasp: are 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:22 Glenjamin: there's http://clojure.github.com/api-index.html

10:34 engblom: I 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:37 clgv: engblom: replace `cond` with `or`

10:38 llasram: engblom: Use refeap.com instead of pastie.org ;-)

10:38 Er, refheap.com

10:39 engblom: It's also pretty trivial to extend to arbitrary heap-count Nim

10:40 Which may or may not be clearer

10:40 But might provide more opportunity for higher-order functional programming

10:42 engblom: Thanks!

10:43 llasram: engblom: Oh, and usually Clojure names use "kebob case" not camel case

10:43 So `winning-heaps` vs `winningHeaps`

10:43 Further, the name of boolean-returning predicate will frequently end in a question mark, so `winning-heaps?`

10:47 clgv: engblom: and the `cond` is unnecessary.

10:48 engblom: clgv: Thanks, I fixed it to or, as you suggested. I should have been thinking about it myself.

10:49 At 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:49 Glenjamin: #(and %1 %2)

10:50 ,(apply and [true true true])

10:50 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)>

10:50 Glenjamin: ,(apply #(and %1 %2) [true true true])

10:50 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox/eval50/fn--51>

10:50 Glenjamin: oh right

10:50 ,(reduce #(and %1 %2) [true true true])

10:50 clojurebot: true

10:51 Glenjamin: ,(reduce #(and %1 %2) [true true true false])

10:51 clojurebot: false

10:51 engblom: Thanks!

10:51 Glenjamin: ,(doc every?)

10:51 clojurebot: "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

10:51 Bronsa: ,(every? identity [true true true false])

10:51 clojurebot: false

10:57 engblom: My new function: https://www.refheap.com/86477 . I changed the vector for a list as I will take any numbers of heaps.

11:00 cbp: Does anyone know how can I scp to clojars my jar, pom and .asc files and have clojars realize I'm signing them?

11:03 jcromartie: is 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:03 or does Jetty etc. usually prevent a request that large?

11:04 ddellacosta: cbp: lein deploy?

11:04 cbp: ddellacosta: there is no project.clj

11:04 ddellacosta: cbp: d'oh, sorry I missed that part

11:04 cbp: just a pom a jar and the signatures

11:05 I tried using maven which does the signing part but somehow messes up the path inside the jar..

11:05 ddellacosta: jcromartie: I suspect there's an upper limit, perhaps this is the relevant config? http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size

11:06 cbp: yeah, sorry...I suspect technomancy could give you some better advice on that though

11:06 jcromartie: ddellacosta: yeah I thought it might be headed off at the HTTP server

11:06 llasram: Why is there a cider 0.6.0 release, but the latest package in marmalade is 0.5.0 ?

11:10 technomancy: llasram: 0.6.0 isn't stable iirc

11:10 llasram: Hmm

11:10 Ok

11:11 technomancy: llasram: also because the current maintainer seems to only care about melpa

11:11 llasram: Then why even make releases?

11:11 technomancy: I don't pretend to understand his release philosophy =\

11:11 llasram: gtrak: You're bouncing things to stable-land when stable or something, right?

11:12 gtrak: yes, some day.

11:12 llasram: coo

11:12 gtrak: seems like we're talking about this once a day at least :-)

11:12 llasram: My boss is using el-get, just updated to current HEAD, was showing off the shiny new exception reporting, and I got jealous :-)

11:13 Not jealous enough to spend <n> hours updating everything to some compatible collection of untracked revisions, mind you

11:13 cbp: U x y y

11:14 and fingers crossed

11:14 llasram: I suppose I could just back up my current package installation directory, add melpa, and do that

11:15 gtrak: I'm going to rewrite mine with el-get next time I have to od anythign.

11:16 oof dlyesxic. :-)

11:16 llasram: od all the thigns!

11:17 gtrak: turning a knob on my right hand to add 20ms delay, that should do it.

11:20 cbp: That's what C-t is for

11:40 engblom: Going 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:44 clgv: engblom: cartesian product of the ranges defines by the numbers on each heap

11:44 *defined

11:45 cbp: clgv: that's not exactly a cartesian product

11:48 fenrock: i have a couple of methods i use in euler problems for this, as it comes up quite often.

11:48 clgv: cbp: ah you are only allowed to take from one? ok.

11:49 fenrock: (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:49 (defn all-combos [coll] (reduce into #{} (map #(choose-k coll %) (range 1 (inc (count coll))))))

11:49 clgv: cbp: much easier to implement then^^

11:49 fenrock: then just call (all-combos list)

11:50 might have to go and rerun that myself to check it does what i think :)

11:53 and 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:54 cbp: ,(let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range))))

11:54 clojurebot: ([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)

11:55 clgv: ,(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:55 clojurebot: ([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)

11:55 clgv: ah damn... ;)

11:55 ,(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:55 clojurebot: ([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] [3 2 0])\n

11:56 clgv: ,(prn (let [xs [3 2 1]] (mapcat (fn [[x idx]] (for [y (range x)] (assoc xs idx y))) (map vector xs (range)))))

11:56 clojurebot: ([0 2 1] [1 2 1] [2 2 1] [3 0 1] [3 1 1] ...)\n

11:56 clgv: :D

11:56 cbp: engblom: anyhow that's one way to do it

12:00 clgv: ,(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:00 clojurebot: #'sandbox/poss

12:00 clgv: ,(poss [3 2 1])

12:00 clojurebot: ((0 2 1) (1 2 1) (2 2 1) (3 0 1) (3 1 1) ...)

12:01 clgv: though the `nth` is not optimal. sometimes having access to an index in `for` would be awesome

12:01 engblom: Thanks

12:02 justin_smith: clgv: what about (for [[i n] (map list (range) s)] ...)

12:03 clgv: justin_smith: yeah I dont like that additional noise

12:04 rasmusto: justin_smith: not (map-indexed vector (range)) ?

12:04 clgv: rasmusto: not even shorter ;)

12:04 rasmusto: oh hm, why do I always use it then... ;(

12:04 I guess it's more flexible

12:04 clgv: justin_smith: I wanted to do the implementation with a single `for`

12:05 justin_smith: rasmusto: or that

12:05 clgv: well if you want an extra linear time lookup on each step, I guess you can do that

12:05 clgv: rasmusto: you replaced the wrong one ;) infinite seq :D

12:06 rasmusto: you didn't want ([0 0] [1 1] [2 2] [3 3] ...)? :p

12:06 clgv: justin_smith: yeah that would not be necessary if there was a way to access the position within `for`

12:07 justin_smith: for-indexed

12:07 clgv: justin_smith: but I am not sure how you'd add that syntactically to `for` ;)

12:08 maybe similar to a :let after the iteration description, e.g. (for [e some-list, :index i, k other-list :index j] ... )

12:09 rasmusto: oh, just use a nested for

12:09 clojurebot: Pardon?

12:09 rasmusto: and index the inner :p

12:09 justin_smith: rasmusto: how would a nested for help? you want an index that follows the output iteration, not one that convolves it

12:10 clgv: rasmusto: dont know how that should work for the application example. I wanted to avoid `concat` as well ;)

12:16 justin_smith: gtrak: 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:17 is the issue that the input may also be needed elsewhere, so it needs to be stored on the heap as it comes in ?

12:19 gtrak: justin_smith: yea I'm not sure I follow the details there.

12:21 cbp: hrm how do you deal with NaN in cljs?

12:22 (not= NaN NaN)

12:22 silasdavis: if 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:23 can I initialise a vector of the right length and assoc in to it

12:23 justin_smith: cbp: does javascript have and isNaN function or method?

12:23 silasdavis: to avoid sorting

12:23 cbp: justin_smith: Oh I guess it does

12:23 justin_smith: cbp there is always (if (!= n n) ...)

12:25 gfredericks: does that catch undefined as well?

12:25 silasdavis: I can do (vec (repeat (count coll)))

12:25 cbp: oh gods wtf is this language https://www.refheap.com/86479

12:25 justin_smith: ,(vec (repeat 5 0)) silasdavis

12:25 clojurebot: [0 0 0 0 0]

12:25 silasdavis: I can do (vec (repeat (count coll) nil))

12:25 ah

12:26 justin_smith: cbp: lowat

12:26 mikerod: cbp: that made me laugh

12:27 Javascript is a great comedian

12:27 justin_smith: I was finely balanced between the watol and lowat responses

12:27 technomancy: cbp: O_O

12:27 justin_smith: dwim in action, or something

12:29 broquaint: cbp: FWIW I see consistent behaviour in Firebug (i.e false in both cases).

12:34 mikerod: This quote “the correctness of your program has been coerced to false.” - Javascript

12:34 from https://www.usenix.org/system/files/1403_02-08_mickens.pdf

12:34 Is probably my favorite

12:35 technomancy: https://twitter.com/tomzalt/status/469464496860569601

12:36 hyPiRion: hahha

12:36 justin_smith: lol

12:36 mikerod: :)

12:37 prachetasp: what are the main benefits of edn over json

12:37 technomancy: the main one is dates afaict

12:37 justin_smith: prachetasp: it maps directly to clojure, so it is more convenient when you are going clojre -> clojure

12:38 any defrecord will define a reader / writer for edn right?

12:39 prachetasp: i 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:39 justin_smith: right, also it helps someone know who creates / cares about that key

12:39 because they should be able to find that namespace and see what is done there

12:40 prachetasp: ah so if pieces are added along the way it helps from an organizational and code readability/maintainability standpoint?

12:41 justin_smith: yeah, it is just a convention though mind you

12:41 ,:this-namespace/does-not-exist

12:41 clojurebot: :this-namespace/does-not-exist

12:43 hyPiRion: ,(namespace :this-namespace)

12:43 clojurebot: nil

12:44 arrdem: mikerod: love that paper :D

12:45 mikerod: arrdem: yes, it is great

12:50 prachetasp: justin_smith: what do you mean just a convention? aka dont rely on it?

12:53 gtrak: cbp: wat.

12:54 justin_smith: prachetasp: the namespace of a symbol is not guaranteed to exist

12:54 *keyword

12:54 sorry

12:54 but it can be helpful to namespace a keyword to indicate where the code is that cares about / creates that key

12:55 gtrak: ,::wat ;; also useful within that namespace, prachetasp

12:55 clojurebot: :sandbox/wat

13:16 prachetasp: ,(namespace :sandbox)

13:16 clojurebot: nil

13:17 prachetasp: ,(namespace sandbox)

13:17 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sandbox in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:17 justin_smith: ,(namespace 'sandbox)

13:17 clojurebot: nil

13:18 justin_smith: ,(doc namespace)

13:18 clojurebot: "([x]); Returns the namespace String of a symbol or keyword, or nil if not present."

13:31 Glenjamin: ,(namespace ::wat)

13:31 clojurebot: "sandbox"

13:33 justin_smith: ,(map namespace [::OK :user/OK :not/OK])

13:33 clojurebot: ("sandbox" "user" "not")

13:34 johnwalker: ,(println "foo")

13:34 clojurebot: foo\n

13:34 johnwalker: ,(dotimes [x 2] (println "foo"))

13:34 clojurebot: foo\nfoo\n

14:43 Psy-Q: whiskey and rich hickey presentations. it's a great mix.

14:45 stompyj: Takes a shot of Bulleit.

14:45 Are we there yet?

14:45 Takes another shot of Bulleit

14:45 Are we there yet?

14:46 nullptr: Psy-Q: you forgot the hammock

14:46 Psy-Q: nullptr: oh yeah, that

14:47 well, the whiskey isn't helping with understanding all the timeline and observation stuff from "are we there yet?"

14:47 the hammock talk went down more easily

14:48 stompyj: Psy-Q: It sounds like what we need is “A drinkers guide to Rich Hickey Presentations"

14:48 where we pair alcohol with specific talks

14:48 Psy-Q: stompyj: 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:49 ooh! yeah! that's a good idea

14:49 i'd recommend light beers for "are we there yet?"

14:49 stompyj: hahahah

14:50 Stella + Are We There Yet

14:50 database as a value == Guinness

14:51 mdeboard: high abv ipa for simple made easy

14:51 Psy-Q: i only have whiskey left :( and a local amber

14:52 but i can't follow are we there yet at all now (at the 1h mark)

14:52 jcromartie: I need a drink.

14:52 mdeboard: ditto

14:52 i'm in an all-day meeting

14:52 hour 6

14:52 Psy-Q: i 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:52 so that was good enough

14:53 stompyj: wow

14:53 nice

14:53 Psy-Q: it's a REST service, not a web application per se

14:53 stompyj: rails -> go is getting popular here in NYC

14:53 that was my first move here, ruby -> clojure for a REST service

14:53 low impact

14:53 huge upside

14:53 Psy-Q: some 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:53 stompyj: oh, good to know!

14:54 mdeboard: where's 'here'

14:54 Psy-Q: not that i want to influence the guys' decision-making :P

14:54 oh, zürich area, switzerland

14:54 mdeboard: rails -> node just makes me angry

14:54 stompyj: npm has been a disaster for us

14:54 its down often

14:54 and people get indignant if you ask questions

14:54 sometimes its just painfully slow, and takes us 2 mins to deploy to prod

14:54 Psy-Q: stompyj: 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:55 stompyj: hahahahahahahahahahah

14:55 I guess fault tolerance wasn’t on the checklist

14:55 Psy-Q: not really :) but node wasn't seriously there either

14:55 mdeboard: npm managed to be worse that pip somehow (Python's pkg mgr)

14:55 s/that/than

14:57 Psy-Q: it's next whiskey for me, i can't follow the more complicated hickey talks, need to find a simpler one

14:59 Language of the System maybe?

15:01 stompyj: haha

15:40 SegFaultAX: Have you watched Are We There Yet?

15:40 That might be his best talk. That or Simple Made Easy.

15:43 Psy-Q: yeah, watched both, but i can't follow Are We There Yet? in this state of mind

15:44 AlwaysBCoding: quick 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:45 bbloom: (doc some) ; AlwaysBCoding

15:45 clojurebot: "([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:46 amalloy: bbloom: except it doesn't return the first x such that f, it returns the first (f x)

15:46 bbloom: amalloy: ah yes

15:46 amalloy: which always makes me mad. that's so much less useful *and* less natural-sounding

15:47 AlwaysBCoding: bbloom: can you give me an example of how to use some? I couldn't figure it out from the docs

15:47 amalloy: AlwaysBCoding: it's just (first (filter ...)). you can def that if you want, or (comp first filter)

15:47 AlwaysBCoding: like if I wanted the first number greater than 4 ... (first (filter #(> % 4) (range 10)))

15:48 how do you write that using some?

15:48 bbloom: ,(some #(when (> % 4) %) (range 10))

15:48 clojurebot: 5

15:48 bbloom: i'd just use (first (filter ...)) there though

15:49 amalloy: yeah. and you can't use that (when (f x) x) trick if (f nil) is true anyway

15:50 stuartsierra: ,(loop [[x & xs] (range 10)] (if (> x 4) x (recur xs)))

15:50 clojurebot: 5

15:51 stuartsierra: I think of that as "seek"

15:51 If you put in a proper check for end-of-sequence of course

15:53 Glenjamin: Psy-Q: mdeboard - do you generally rely on external infra for deploys when not using node?

15:55 mdeboard: oh yes

15:56 we deploy code via jenkins

15:56 Glenjamin: i guess in ruby-land "bundle install" on prod via capistrano is fairly common

15:56 jenkins that you run yourselves presumably?

15:56 mdeboard: yes

15:57 Glenjamin: i'm surprised when people don't run some sort of caching-proxy type thing for deploys etc

15:57 it's like how everyone complains about their deployment toolchain when github goes down

15:58 mdeboard: What do you mean

15:58 we don't rely on github at all, or anything except our "own" infrastructure

15:58 technomancy: Glenjamin: it's fairly common

15:58 Glenjamin: you were saying earlier how npm being down affected ability to deploy, and speed in general

15:58 mdeboard: I didn't say that

15:58 i just said it managed to be worse than pip

15:58 Glenjamin: oh, sorry

15:58 that was stompyj

15:59 i misread

15:59 stompyj: Glenjamin: yeah, that’s been us

15:59 Glenjamin: you can deploy a caching proxy rather easily

15:59 put it next to your CI server, and things will be much snappier

16:00 stompyj: yeah, moving away from node seems to be a better choice for us

16:00 Glenjamin: i would recommend that whatever you move to, you still use a caching proxy for whatever package registry it uses

16:00 stompyj: this kind of stuff is a bellweather for the community

16:01 Glenjamin: technomancy: on a related note, do you know if heroku cache/proxies clojars, or goes direct?

16:01 stompyj: Glenjamin: thats’s something we’d consider down the road. that feels like a 80/20 optimization

16:01 Glenjamin: heh, had never heard that term before

16:01 IME its one of those things that you dont care about, until you do

16:01 technomancy: Glenjamin: it proxies central, but the way clojars mixes in snapshots with releases makes it problematic.

16:01 Glenjamin: like database backups

16:03 stompyj: Glenjamin: database backups is a 20/80 optimization :)

16:03 but good point

16:03 I have been burned by that in the 90s

16:03 and have never forgotten that lesson :)

16:03 are a*

16:03 yeesh

16:03 skinkitten: how does get work? http://goo.gl/0vjzQk

16:04 more specifically why is lines 3 and 5 returning nil?

16:04 Glenjamin: skinkitten: it's zero-indexed

16:04 ,(get [:a :b :c :d] 3)

16:04 clojurebot: :d

16:05 skinkitten: oh thanks Glenjamin this isn't the method I'm looking for. :p

16:07 TEttinger: ,(some #{3} [2 44 3 3])

16:07 clojurebot: 3

16:07 TEttinger: sets can be used as fns

16:08 ,(some #{3} [2 4])

16:08 clojurebot: nil

16:08 TEttinger: is that what you're after, skinkitten

16:10 danneu: what's a preferred way to evaluate `letters` once? https://www.refheap.com/86487

16:11 hiredman: (def letters ...)

16:11 tbaldridge: danneu: let outside the defn is probably the most common, but personally I just create a new def

16:11 (inc hiredman)

16:11 lazybot: ⇒ 47

16:12 danneu: yeah, i avoid top level helpers like this when i can these days

16:14 my 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:14 AlwaysBCoding: stuartsierra: 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:15 Bronsa: ,`(~@[])

16:15 clojurebot: nil

16:15 hiredman: danneu: you should push as much as possible in to top level defs, if you have too many, split off more namespaces

16:16 danneu: (first (filter ...)) + clojure's laziness being performant is what often makes it so easy to write performant clojure code without doing anything extra

16:16 stuartsierra: AlwaysBCoding: maybe a little, because `filter` is lazy, but not much.

16:17 You still have to `seq` on the initial input.

16:17 I guess, since `filter` creates a second lazy sequence, there's a tiny amount of additional overhead.

16:21 turbofail: or you could just use (some pred coll)

16:22 oh looks like that was discussed earlier

16:26 amalloy: stuartsierra: 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:27 stuartsierra: amalloy: Yeah, that was half-assed. :)

16:27 amalloy: that's a mistake i made a *lot* of times

16:30 umpa: how do I do partial match of (0 1) on ,(partition 3 (range 10)) ?

16:31 ,(partition 3 (range 10))

16:31 clojurebot: ((0 1 2) (3 4 5) (6 7 8))

16:40 justin_smith: umpa: partial match?

16:41 ,(filter (comp #(= % [0 1]) #(take 2 %)) (partition 3 (range 10)))

16:41 clojurebot: ((0 1 2))

16:42 amalloy: justin_smith: comping together two lambdas is weird. why not just write #(= [0 1] (take 2 %))?

16:43 justin_smith: amalloy: just how my brain modularized the problem I guess

16:43 I guess that is weird

16:53 tolstoy: When 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:54 M-x cider and M-x cider-connect produce the same problem.

16:54 Cider 0.7 snapshot, btw. ;)

16:55 technomancy: one way would be to use 0.5.0

16:55 tolstoy: technomancy: Is it pretty much a no-go to use cider outside a project in later versions?

16:56 technomancy: dunno, I haven't tried the new verison

16:56 Glenjamin: tolstoy: in the latest cider i believe you have to add some middleware to your user profiles.clj

16:56 arrdem: whether this is a bug or a feature has not been clarified by the cider guys.

16:57 tolstoy: Hm. I've got that, but is it only picked up when running "lein repl" in the context of a project?

16:57 umpa: justin_smith: yeah partial match works. Would it work with multipple matches ?

16:57 ,(filter (comp #(= % [0 1]) #(take 2 %)) (partition 3 (range 10)))

16:57 clojurebot: ((0 1 2))

16:58 umpa: ,(filter (comp #(= % [0 1 3 4 8]) #(take 2 %)) (partition 3 (range 10)))

16:58 tolstoy: Hm. I might have the 6.1 middlware spec'd.

16:58 clojurebot: ()

16:59 tolstoy: Glenjamin: I had the old middleware. Amazed my other projects actually worked. ;)

17:01 justin_smith: umpa: 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:04 umpa: maybe you want a function like this https://www.refheap.com/86490

17:05 amalloy: justin_smith, umpa: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L254

17:05 justin_smith: amalloy: nice

17:06 amalloy: anytime you want a function that's not in core, it's already in useful. that's the plan, anyway

17:06 speaking of, there's https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L7 too, of course

17:06 justin_smith: wouldn't (prefix-of? [0 1 2] [0 1 2]) return false?

17:06 amalloy: no? it shouldn't. i'll try it

17:06 mi6x3m: hey clojure, assuming I am writing a function navigate! to change the url of a web browser

17:07 is it a good idea to allow 4 types of an argument

17:07 :back, :forward, Url or a string

17:07 arrdem: -! is for STM only, not for side-effect naming.

17:07 amalloy: (seq/prefix-of? [0 1 2] [0 1 2]) ;; => true

17:08 justin_smith: you're probably confused because (boolean ()) is true

17:08 justin_smith: ahh, I had no idea

17:08 ,(boolean ())

17:08 clojurebot: true

17:08 Glenjamin: arrdem: what would you use for side effecting? !!, !?!, nothing?

17:08 justin_smith: that was the source of my confusion

17:08 amalloy: i mean, () is truthy, because it's not nil or false

17:08 justin_smith: one of these days I will learn to read clojure

17:08 (my mind is polluted by too many other lisps)

17:09 arrdem: Glenjamin: _I_ just have docstrings explicitly stating what is side-effected, with no paired function naming convention.

17:10 Glenjamin: i like the idea of (defn side-effecting!?!)

17:10 arrdem: hehe

17:11 sdegutis: 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:11 While I love Clojure's dynamic nature, this feels a lot cleaner and simpler.

17:12 justin_smith: (defn ¡viva-la-mexico! [x] (assoc x :salsa true))

17:12 wheeee: Do folks in this IRC room go to/run meetups?

17:12 Glenjamin: i run a local FP meetup

17:12 justin_smith: wheeee: sometimes I go to clojerks, which is the local portland clojure group

17:13 ticking: wheeee: yeah, I run one in bremen germany

17:13 toast: Hi, I noticed that (= '(1 2 3) [1 2 3]) returns true. Is there a way to compare them that returns false?

17:13 ( = …

17:13 amalloy: justin_smith: you gotta go all out: ¡viva-la-méxico!

17:13 justin_smith: amalloy: and I think the la was a mistake too

17:14 umpa: justin_smith: i guess i would pull all lists in the partitioned collection that have at least 2 matches ?

17:14 mi6x3m: guys, is this a good idea?

17:14 http://pastebin.com/p3gYJYPV

17:14 ticking: sdegutis: sorry, what feels cleaner ^^?

17:14 mi6x3m: or should I split it in 3 methods: navigate, navigate-front, navigate-back ?

17:14 amalloy: yeah, i guess you're confusing it with vive la france?

17:15 llasram: wheeee: I co-organize the Atlanta Clojure meet-up

17:15 justin_smith: umpa maybe you want to put things in sets and test set/intersection ?

17:15 sdegutis: wheeee: pretty sure there's no one to meet up with within an hour of me

17:15 Glenjamin: mi6x3m: seems fairly ok either way to me

17:15 wheeee: llasram, 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:15 mi6x3m: thanks Glenjamin :)

17:15 llasram: wheeee: Uhhhh, nope

17:16 Just friendly people talking about Clojure

17:16 sdegutis: I 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:16 technomancy: wheeee: that happened at the boston one a few times when I was in town

17:16 wheeee: This has been at two separate meetups in my city with different groups of people.

17:16 Glenjamin: nerd-sniping/IOC ?

17:16 technomancy: it 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:16 justin_smith: wheeee: international olympic committee? inversion of control?

17:16 wheeee: IOC — inversion of control

17:17 Glenjamin: inversion of control of the talk?

17:17 wheeee: yeah

17:17 justin_smith: oh man, design patterns in social events...

17:17 wheeee: nerd-snipe is the wrong word. I mean more like constantly correcting/qualifying

17:17 Glenjamin: oh, we get a little bit of that

17:18 but it seems mostly positive

17:18 TimMc: justin_smith: Singleton. :-(

17:18 justin_smith: I thought that was how nerds flirted

17:18 Glenjamin: as in "oh, so that's a bit like X in (lang-i-know)"

17:18 justin_smith: by correcting pedantic mistakes

17:18 arrdem: #clojure is -Wpendantic

17:18 amalloy: by pedantically correcting trivial mistakes, justin_smith

17:19 Glenjamin: we're a mixed language FP group, so there's quite a lot of questions during the talk

17:19 * justin_smith blushes

17:19 amalloy: wink wink

17:19 ticking: wheeee: 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:19 wink: nudge nudge

17:20 arrdem: https://www.youtube.com/watch?v=M7HycFnH26U&feature=kp

17:20 wheeee: justin_smith, the best pedants don't correct mistakes, they provide more nuanced understandings or the mostly correct views other people have.

17:20 whidden: chinese watch

17:21 sdegutis: ticking: because production doesn't need the whole source code

17:21 Glenjamin: no live code reloading in production?

17:21 wheeee: But seriously, I'm sort of curious how people actually feel about this.

17:21 Glenjamin: i heard that's what makes lisps agile :p

17:22 arrdem: Glenjamin: there's a guy at the ATXCLJ meetup who's entire company does that 0₀

17:22 ticking: sdegutis: 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:22 Glenjamin: it seems to work for hacker news :D

17:22 sdegutis: ticking: 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:23 justin_smith: wheeee: 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:23 wheeee: Put directly — I think its a bad introduction to the community for people who might be interested.

17:23 ticking: sdegutis: 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:23 TimMc: technomancy: Oh yeah, the talk Alec gave.

17:23 wheeee: justin_smith: I agree with you on the code side but I don't think the context is right.

17:23 justin_smith: wheeee: 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:24 right

17:24 gtrak: justin_smith: someone once told me I'm really concrete in my thinking, I corrected her and said I'm also very abstract.

17:24 justin_smith: heh

17:24 TimMc: I think he actually had a point he was trying to make but between him and various audience members it devolved into "no u"/

17:24 ticking: speaking of pedantics, am I alone in feeling that instaparses custom error handling is an inconvenience?

17:25 cbp: The 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:25 ticking: cbp: I've gone tired of PL

17:26 cbp: 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:26 cbp: funny thing is, that turned about 40% into clojurians ^^

17:27 gtrak: I don't think I've ever persuaded someone by calling them an idiot.

17:27 I've tried.

17:28 wheeee: Thanks for the responses everyone, just curious to see what folks think and had encountered

17:28 TimMc: wheeee: Most of my meetup experiences have been fine in that regard, though.

17:28 ticking: gtrak: it admittedly depends heavily on how well you know the person

17:28 cbp: Well in any case, I don't see that many mechanical sympathy guys programming with really high level functional languages

17:28 sdegutis: ticking: oh good idea, I can embed an nREPL client into the jar and toggle it via arguments

17:29 ticking: sdegutis: yeah I do that as well :)

17:30 wheeee: Thanks TimMc

17:30 justin_smith: cbp: that is part of why ats seemed intreguing - for that blend of high level expressiveness with absolute control of low level representation

17:31 maybe some day it will be mature enough for me to do something interesting with it

17:31 cbp: justin_smith: is it just 1 person working on it?

17:32 justin_smith: cbp: like a three person team, one uses it to teach a graduate class

17:32 arrdem: cbp: there's only what, seven people working even indirectly on cljs?

17:32 justin_smith: (and is the original author)

17:32 arrdem: for some perspective community wise, there are 0 SO posts with the [ats] tag

17:33 maybe I will make one just on principle

17:33 amalloy: justin_smith: [meta] Why are there no posts tagged [ats]?

17:33 ticking: justin_smith: have you seen proofmarket where you can trade bitcoin for coq proofs?

17:34 cbp: justin_smith: is there a reddit forum? =p

17:34 justin_smith: heh

17:34 TimMc: ticking: :-D

17:34 justin_smith: cbp: oh, yeah http://www.reddit.com/r/ats but this is all very OT

17:35 ticking: justin_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:35 justin_smith: ticking: oh wow

17:35 arrubin: The Chicago Clojure meetups are great.

17:35 Jaood: arrdem: isn't cognitect pouring resources into cljs?

17:35 cbp: "We can tell there are exactly 11 ats users because that's the most any topic has ever gotten"

17:35 arrdem: Jaood: maybe I haven't been paying attn.

17:36 cbp: the most upvotes*

17:37 justin_smith: heh

17:37 cbp: I am seeing some posts with 8 ups, 3 down

17:37 but yeah 11 max votes seems consistent here...

17:39 visof: Hello

17:40 sdegutis: arrubin: sometimes wish I lived a little closer

17:40 but it's about 60 miles away

17:41 johnwalker: is there a nice way to keep track of writers in clojure?

17:42 i was looking at timbre earlier and noticed that the appender-fn just uses spit

17:42 visof: i 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:42 amalloy: johnwalker: http://en.wikipedia.org/wiki/List_of_notable_20th-century_writers

17:42 visof: the code is here https://www.refheap.com/86491

17:42 johnwalker: lol

17:43 arrdem: (inc amalloy)

17:43 lazybot: ⇒ 123

17:43 visof: (inc visof)

17:43 lazybot: You can't adjust your own karma.

17:43 visof: haha

17:43 (inc arrdem)

17:43 lazybot: ⇒ 30

17:44 Jaood: (inc Jaood)

17:44 lazybot: You can't adjust your own karma.

17:45 fo1234: (inc Jaood)

17:45 lazybot: ⇒ 1

17:45 fo1234: (inc Jaood)

17:45 lazybot: ⇒ 2

17:45 fo1234: (inc Jaood)

17:45 lazybot: ⇒ 3

17:45 fo1234: (inc Jaood)

17:45 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

17:45 johnwalker: lol

17:45 Jaood: owned

17:46 justin_smith: visof: in that let statement, try (let [[s p o] l] ...)

17:46 amalloy: brb gonna set Jaood's karma to -5

17:46 Jaood: :(

17:46 arrdem: amalloy: database hacking is cheating :p

17:47 $karma so

17:47 lazybot: so has karma -28.

17:47 visof: justin_smith: is there a good way to rewrite this?

17:47 johnwalker: 8 points from hufflepuff, Jaood

17:47 amalloy: visof: map is lazy

17:47 justin_smith: visof: also (swap! h conj {p [o]}) looks wrong, given h is a map

17:48 arrdem: justin_smith: should be a type error wrong

17:48 amalloy: justin_smith: for reasons unknown, (conj m1 m2) is the same as (merge m1 m2)

17:48 visof: justin_smith: it's working

17:48 without errors

17:48 justin_smith: oh, wow, ok...

17:49 I still think (swap! h assoc p [o]) is better though

17:50 prachetasp: how do i cleanly manage and close db connections in a ring application

17:51 visof: justin_smith: try (let [[s p o] l] ...) can't understand what did you mean?

17:51 justin_smith: prachetasp: c3p0 is a drop in to the clojure.data.jdbc connection map

17:52 visof: I literally mean that, it binds each symbol positionally

17:52 ,(let [[a b c] (range)] c)

17:52 clojurebot: 2

17:52 visof: ah got it

17:52 justin_smith: it is clearer than manually asigning with nth repeatedly

17:53 visof: justin_smith: it still return empty map

17:54 but when tried without defining h it's working

17:54 justin_smith: visof: like we mentioned map is lazy

17:54 you need to use doseq instead of map, or put the map in a dorun, or use the result of map, or something

17:54 ,(do (map print (range 100)) nil)

17:54 clojurebot: nil

17:55 justin_smith: ,(do (dorun (map print (range 100))) nil)

17:55 clojurebot: 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899

17:55 amalloy: better still, don't use an atom at all, and just use reduce instead of map

17:55 justin_smith: yeah, good point

17:57 amalloy: in fact, i think the implementation is just https://www.refheap.com/e2fc8d9eda0121f4ce444c46b

17:59 martinklepsch: I guess there is a function for that: (that-fn #(str %) [:a :b]) => [:a "a" :b "b"}

18:00 arrdem: martinklepsch: mapv

18:00 amalloy: martinklepsch: (partial mapcat (juxt identity f))?

18:01 justin_smith: martinklepsch: you probably need name instead of str?

18:01 arrdem: amalloy: I think he wants an (into {}) there..

18:01 amalloy: arrdem: maybe. i saw the [, didn't notice it was mismatched with }

18:02 either way, juxt

18:02 martinklepsch: justin_smith, you're right, name is correct in that example.

18:02 arrdem: ,(str ::foo)

18:02 clojurebot: ":sandbox/foo"

18:02 arrdem: ,(name ::foo)

18:02 clojurebot: "foo"

18:02 * arrdem red pill blue pill

18:02 justin_smith: martinklepsch: also #(str %) is just str plus an enforced single argument

18:02 and enforcing a single argument gets you nothing, especially in that context

18:04 martinklepsch: sorry for the wrong bracket, it's almost unreadable with that font here

18:04 justin_smith, yeah just string would have done it too, but what do you mean with "gets you nothing"?

18:06 justin_smith: #(str %) does nothing str doesn't do

18:06 other than enforce a single argument

18:06 and in that context, you can only get a single argument

18:06 martinklepsch: justin_smith, ah ok, right

18:09 umpa: so this does intersection for one node ,(set/intersection #{1 2 3} (into [] (map set (partition 3(range 10)))))

18:09 ,(set/intersection #{1 2 3} (into [] (map set (partition 3(range 10)))))

18:09 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: set, compiling:(NO_SOURCE_PATH:0:0)>

18:10 umpa: How do I itterate through all the nodes and intersect ?

18:12 visof: amalloy: (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:12 ?

18:12 martinklepsch: this is what I have right now:

18:12 ,(for [strings ["abc" "efh"]] (into {} ((fn [s] {s (keyword s)}) strings)))

18:12 clojurebot: ({"abc" :abc} {"efh" :efh})

18:12 visof: amalloy: also your code is great

18:12 martinklepsch: I'd like to merge these maps as well

18:12 amalloy: you 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:14 justin_smith: ,(map #(set/intersection #{1 2 3} %) (map set (partition 3 (range 10)))) visof: something like this?

18:14 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: set, compiling:(NO_SOURCE_PATH:0:0)>

18:15 justin_smith: ,(map #(clojure.set/intersection #{1 2 3} %) (map set (partition 3 (range 10)))) visof: something like this?

18:15 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>

18:15 amalloy: martinklepsch: you want (into {} (for ...)), not the other way around

18:15 clojurebot: Cool story bro.

18:15 arrdem: justin_smith: set/intersection shouldn't be defined for a single element anyway...

18:15 map set

18:16 justin_smith: arrdem: that's not a single argument

18:16 arrdem: justin_smith: yep just realized that.

18:16 martinklepsch: amalloy, that makes sense

18:16 amalloy thank you!

18:17 canweriotnow: ,(str :foo)

18:17 clojurebot: ":foo"

18:17 canweriotnow: I <3 clojurebot

18:17 martinklepsch: is that the idiomatic way of doing it as well? amalloy

18:18 amalloy: yes, i use (into {} (for ...)) often

18:19 martinklepsch: amalloy, ok thanks!

18:19 amalloy, thinking about it I feel stupid for that initial approach now haha :D

18:19 umpa: justin_smith: nice

18:21 justin_smith: umpa: oh oops, highlighted the wrong user, but I guess you saw it anyway

18:26 umpa: justin_smith: haha yeah i was confused there for a sec. Thought someone else had the exact same question.

18:27 jack_rabbit: So, 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:27 hiredman: how are you running the tests?

18:28 jack_rabbit: lein test

18:28 hiredman: because lein test prints out test failure information

18:28 jack_rabbit: well... That's what I thought, but it doesn't seem to be doing that this time.

18:28 amalloy: those failure prints can get lost if your tests print out a sea of unrelated nonsense

18:28 hiredman: definitely

18:28 jack_rabbit: amalloy, indeed that's what's happening.

18:28 hiredman: so don't do that, of course

18:28 jack_rabbit: Are there keywords i can grep?

18:29 cbp: FAIL ERROR

18:29 amalloy: jack_rabbit: you can probably grep for :only

18:29 hiredman: jack_rabbit: think of this as an opportunity to clean up your tests and not print out garbage

18:30 jack_rabbit: hiredman, yeah. that would take weeks of work. This project is huge.

18:30 amalloy: i 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:30 hiredman: amalloy: uh, if you configure logging to log to a file it won't go to the console?

18:30 jack_rabbit: Anyway, i found *something* with 'ERROR in whatever.clj'

18:30 hiredman: just stick a log4j.properties in tests/

18:31 jack_rabbit: yeah, we might have to do that.

18:31 hiredman: I don't understand how you can live with out that

18:31 do you just not see log messages when you fiddle at the repl?

18:33 jack_rabbit: no, I get none of that garbage at the REPL.

18:33 Only tests for some reason.

18:33 hiredman: right, it is going to stdout which is god knows where at the repl

18:34 but if you just configur your tests to log to a file, then you always have the log output, there, in that file

18:34 jack_rabbit: That's how it runs in production. I don't know why the tests haven't been configured to do that.

18:35 skinkitten: thanks TEttinger3 that helped

18:36 hiredman: jack_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:36 jack_rabbit: sure.

18:45 arrdem: Anyone have a java IDE they'd suggest for working with the Clojure core? Emacs isn't cutting it for slogging through Compiler.java.

18:46 amalloy: eclipse

18:52 visof: amalloy: is there a good way to do it, sorry to be late

18:52 amalloy: still there?

19:01 jack_rabbit: arrdem, I'm using emacs with cider and ac-cider-compliment, and it works beautifully. Are there particular features you're looking for?

19:01 johnwalker: is ac-cider-compliment faster than ac-nrepl?

19:01 jack_rabbit: not sure, actually.

19:01 I think it might just be newer.

19:02 johnwalker: does your emacs stutter when you use ac-cider-compiliment*?

19:02 jack_rabbit: not at all.

19:03 johnwalker: i'm going to give it a shot ;p thanks

19:03 jack_rabbit: :) no problem. Hope it works better for you.

19:03 johnwalker: me too lol

19:15 aperiodic: go dork

19:18 umpa: why no work ? https://www.refheap.com/86496

19:21 hiredman: ,(doc filter)

19:21 clojurebot: "([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:29 stephenjudkins: i have two vectors. is this the most efficient way to append one to the other?

19:29 , (apply conj [1 2 3] [4 5 6])

19:29 clojurebot: [1 2 3 4 5 ...]

19:31 hiredman: the most efficient way to do anything is not to

19:32 so I suggest restructuring your program in a way that avoids the need to concat vectors

19:32 (and if you must, use into)

19:33 stephenjudkins: hiredman: why avoid it? what's wrong with into?

19:33 hiredman: why do it?

19:34 aperiodic: if you need to concatenate vectors that suggests you might not want to be making vectors in the first place

19:34 stephenjudkins: aperiodic, hiredman : any other data structures you'd recommend?

19:34 aperiodic: seqs

19:35 hiredman: seqs 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:36 https://github.com/clojure/core.rrb-vector says it has o(log n) concat

19:45 stephenjudkins: aperiodic, hiredman : thanks. i'm new to clojure and appreciate your help.

20:01 hyPiRion: stephenjudkins: I'd recommend to use (into [1 2 3] [4 5 6]) unless you really notice that it is too slow

20:01 If 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:02 Usually you can get away with a lot as long as you know how to use those data structures

20:02 stephenjudkins: hyPiRion: when i see something is O(log n) i tend to not worry about it until it's time to profile

20:02 o(n) or worse can get you into trouble

20:04 bbloom: stephenjudkins: i love O(N^3) algorithms

20:04 .... for small Ns

20:04 everybody else ignroes them

20:04 they work great :-)

20:04 hyPiRion: floyd-warshall to the rescue

20:06 hiredman: may your constant factors always be small

20:59 deathknight: clj-gapi looks freaking great

21:27 Frozenlock: Is there a way to prevent cljs dependencies to be included in a uberjar?

21:27 goog is taking almost 20mo...

22:49 skinkitten: how do I replace 1 2 in here without using the key? {1 2, 2 2, 3 5}

22:50 beamso: ,(rest {1 2, 2 2, 3 5})

22:50 clojurebot: ([3 5] [2 2])

22:51 skinkitten: thats removing it. what about replacing it e.g with 11 11

22:52 beamso: ,(assoc (into {} (rest {1 2, 2 2, 3 5}) 11 11)

22:52 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

22:52 beamso: (assoc (into {} (rest {1 2, 2 2, 3 5})) 11 11)

22:53 skinkitten: ,(assoc {} (rest {1 2, 2 2, 3 5}) 11 11)

22:53 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: assoc expects even number of arguments after map/vector, found odd number>

22:54 skinkitten: and if I wanted to do it to 2 2, or 3 3,

22:55 or any n index in the array map

22:56 beamso: you'd probably have to use dissoc, keys and nth

23:01 skinkitten: hm. thanks

Logging service provided by n01se.net