#clojure log - Oct 18 2014

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

0:01 amalloy: quizme: uhhhh, without seeing your code it's not necessarily clear what's going wrong, but i expect you're using a sort function which disagrees with =

0:01 based on your "sorted by a particular key"

0:03 hiredman: what does subseq even do on a sort-set?

0:03 ,(doc subseq)

0:03 clojurebot: "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"

0:03 hiredman: ah

0:04 quizme: http://pastebin.com/0adaVx3Q

0:05 amalloy: http://pastebin.com/0adaVx3Q

0:10 amalloy: ,(:x 5)

0:10 clojurebot: nil

0:10 amalloy: quizme: what do you expect 5 to mean in that context? calling that comparison function with 5 as one of the arguments doesn't make any sense

0:11 quizme: i want 5 to be the value that the key should be greater than.

0:13 amalloy: what key? your function compares the a and b of of an item to the a and b of 5

0:14 i feel like you are misunderstanding both sorted sets and subseq, but i don't understand your beliefs well enough to correct them

0:15 quizme: i want to select all values of the sorted set whose :a key is bigger than 5

0:16 i mean :a value

0:16 similar to how (subseq [1 2 3 4] > 2) gives you (3 4)

0:17 but i just want to look at the :a values

0:22 hiredman: basically, it lets you do efficient range queries in memory.

0:30 amalloy: well, you could do something like (subseq s > {:a 5}), which kinda does what you want but is fraught with pitfalls

0:30 the point is the thing you use as your query has to be comparable to the items in the set

0:32 quizme: amalloy i see thanks, i think that will do it for me... what's the pitfall?

0:34 amalloy: i mean, like everything. your sorted set can't contain multiple items whose :a and :b are the same, even if other keys are different

0:35 you're comparing against a nil b, and it's not totally clear your comparison function expects that

0:41 it seems more like you want a sorted map, where the keys are the values of :a

0:41 and possibly a second sorted map if the values of :b are also important to sort by

0:42 but who knows, maybe your data is shaped such that the pitfalls of sorted sets are advantages

2:39 SagiCZ1: ,(range 200000)

2:39 clojurebot: (0 1 2 3 4 ...)

2:39 SagiCZ1: how can i tell repl to compute but not print the return value?

2:44 TEttinger: ,(do (range 200000) nil)

2:44 clojurebot: nil

2:45 TEttinger: ,(do (print "starting... ") (range 200000) (print "ending...") nil)

2:45 clojurebot: starting... ending...

2:45 TEttinger: SagiCZ1, does that make sense?

2:47 SagiCZ1: TEttinger: yes it does, thank you

2:47 ,(dorun (range 200000))

2:47 clojurebot: nil

2:47 SagiCZ1: this is what i wanted

2:47 TEttinger: ah ok

2:47 SagiCZ1: im trying to find a case where pmap is faster than map... still havent found one

2:49 TEttinger: how many physical cores do you have?

2:49 if it's 16, you're more likely to find a case than if you have 2 :)

2:54 SagiCZ1: yeah just two

2:54 ok, ordering 16 core xeon

2:54 amalloy: SagiCZ1: you want a function that's expensive to compute, like (map #(do (THread/sleep 5000) %) (apply list (range 10)))

2:55 SagiCZ1: amalloy: yeah so the function computing one element should take a long time.. not the whole operation right?

2:55 amalloy: right

2:55 SagiCZ1: thanks

2:56 TEttinger: SagiCZ1: lol, if you're just after tons of cores, http://www.ebay.com/itm/DELL-C6100-C6105-CLOUD-SERVER-6x-1-8GHz-AMD-6-CORE-HEX-CORE-144GB-RAM-3x-250GB-/181306790824?pt=COMP_EN_Servers&hash=item2a36ba13a8

2:56 36 cores and 144GB RAM should be able to handle a few REPLs

2:56 SagiCZ1: yeah, like two or three right?

2:57 too bad i dont believe AMD can make a good cpu

2:58 wow but isnt that cheap?

2:58 TEttinger: if you were serious about buying for testing anything, http://www.ebay.com/itm/DELL-C6105-CLOUD-SERVER-6x-1-8GHz-AMD-6-CORE-48GB-RAM-3x-250GB-C6100-SERIES/171187983886 is the price of a netbook

2:59 SagiCZ1: yeah that surprised me.. i wonder if my application would really benefit from so many cores.. tehre is some inherent parallel processes in it so maybe

3:00 TEttinger: electrical costs are what kill these things, I have an older server than these that I never turn on because it sounds like a jet engine and probably uses as much electricity as one

3:02 SagiCZ1: oh ok.. thats awful then.. i think amd cpus are pretty inefficient.. i dont think it could make enough money to pay for the running cost but maybe one day..

3:02 TEttinger: I would imagine the cloud ones are cheaper

3:03 these have a fairly low clock speed

3:03 ideal for clojure's intended use, massively concurrent applications like server-side code

3:05 then again, the server I have is a 4 processor, 4U server, single-core Pentium4-based Xeon each one

3:05 quite old, probably not the best example

3:05 justin_smith: TEttinger: google has a server farm not far from here, just because there is a huge hydro generator and large numbers of wind farms (columbia river gorge), and they get cheaper power by being right next door.

3:06 TEttinger: yep

3:06 I've heard they do that

3:06 justin_smith: it's smart placement, bonus that it's green energy too (relatively depends on how important you think salmon are)

3:07 TEttinger: delicious

3:07 I saw the salmon staircase they built at one of those dams

3:07 incredible work

3:07 justin_smith: they invented a salmon hose, it works even better

3:07 literally pumps salmon from the bottom, into a tube, then shoots them to the top

3:08 TEttinger: that's the funniest image I've had in my head all day (all 8 minutes of it)

3:08 justin_smith: hehe

3:08 vid https://www.youtube.com/watch?v=WWpKtTjYo1g

3:11 it is remarkably similar to pneumatic system that was used at some libraries to send requests for books

3:11 now I am imagining people in libraries using dedicated tubing to throw live fish at one another

3:11 scottj: water park for fish

3:12 justin_smith: yeah, I bet that's fun

3:40 dysfun_: clojure doesn't use '&' for anything yet, right?

3:40 justin_smith: only for marking varargs

3:41 ,((fn [& args] args) 1 2 3 4 5)

3:41 clojurebot: (1 2 3 4 5)

3:41 dysfun_: oh yes

3:41 i can live with that

3:41 justin_smith: ,'&

3:41 clojurebot: &

3:41 justin_smith: ,(let [& :OK] &)

3:41 clojurebot: :OK

3:41 justin_smith: it's a valid binding

3:41 dysfun_: also not documented :(

3:42 justin_smith: what isn't documented/

3:42 dysfun_: & isn't listed in the permissible atom syntax

3:42 lazybot: java.lang.RuntimeException: Unable to resolve symbol: isn't in this context

3:42 justin_smith: dysfun_: permissable atom?

3:42 is that common lisp speak?

3:43 dysfun_: er symbol

3:43 "Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined)"

3:43 doesn't mention <> either

3:43 justin_smith: which have been function names from the very beginning

3:44 dysfun_: i'm looking for a punctuation symbol that isn't permitted in clojure symbol names

3:44 justin_smith: .

3:44 dysfun_: or at a minimum that isn't permitted as the first character in clojure symbol names

3:44 justin_smith: ^

3:45 dysfun_: i'm already using dot :(

3:45 justin_smith: ,(let [. :not-ok] .)

3:45 clojurebot: #<CompilerException java.lang.ClassFormatError: Illegal field name "." in class sandbox$eval99, compiling:(NO_SOURCE_PATH:0:0)>

3:45 justin_smith: ,(let [^ :not-ok] ^)

3:45 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

3:45 dysfun_: ^ is metadata

3:46 justin_smith: right, and . is member access

3:46 and both are not allowed in names, that's all I'm saying

3:46 dysfun_: ah, right, i get you

3:46 justin_smith: ' can be in a name, but not as the first character

3:46 so we can be all mathy

3:47 dysfun_: i'm writing a custom reader, but i can use #^ for metadata and use ^ for something else

3:47 justin_smith: ,(let [x 0 x' (inc x) x'' (inc x')] x'')

3:47 clojurebot: 2

3:47 dysfun_: ah yes, but i want to keep convenient quote syntax

3:48 justin_smith: ,(let [  5] )

3:48 clojurebot: 5

3:48 justin_smith: even non breaking space is a valid binding

3:48 dysfun_: what was that? &nbsp; ?

3:48 heh

3:48 justin_smith: "valid" - we can at least say "you can get away with it"

3:49 dysfun_: ,'\'

3:49 clojurebot: \'

3:49 justin_smith: ,(let [\ :?] \)

3:49 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported character: \ :?>

3:49 dysfun_: oooh!

3:49 justin_smith: ahh, it's for character escapes

3:49 you could give up on having a character syntax I guess

3:49 dysfun_: yes, but it doesn't have any other uses

3:49 so i could for example do #\

3:50 as a reader macro, effectively

3:51 #@ is an option too

3:52 only other use for \ is escaping in strings i think

3:57 you couldn't do ~@ either, could you?

3:57 er ~@@

4:00 ah, no, it derefs properly

4:00 justin_smith: anyway, you can use deref instead of the @ syntax

4:01 though that may be inconvenient

4:01 dysfun_: yeah, but i don't want to make it tedious to use atoms. they're quite useful

4:02 ~^ ?

4:02 clojurebot: Excuse me?

4:06 dysfun_: i think i've got enough characters for now, thanks for the help

4:06 m1dnight: Guys, implementation question: Why are the ensure locks retained during transaction retries?

4:06 Is there a specific reason? If you were to release them you simply re-aquire them, so I can't see a reason?

4:08 dysfun_: ooh, ~` wouldn't be valid, would it?

4:10 ah, yes it would

5:04 is the bugtracker the place to suggest a clojure feature?

5:09 amalloy: dysfun_: the clojure-dev mailing list

5:09 dysfun_: ty

5:23 r4vi: where would I put a system.properties file in a clojure project? alongside project.clj?

5:41 foodoo: ,(let [x resolve] (doc x)); prints nothing

5:41 clojurebot: Excuse me?

5:42 foodoo: ,(let [x resolve] (doc resolve)); prints the doc for the function resolve

5:42 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

5:42 foodoo: How can I bind a function/function name so that (doc) can work with it?

5:45 dysfun_: use a macro

5:46 or pass it in as a symbol

5:46 i'd probably do the latter

5:46 doc is a macro itself

5:56 clj-learner: why is this not working?

5:56 (ns fooo

5:56 (:require a.core)

5:56 (:refer [a.core :rename {b b2}]))

5:56 vector cannot be cast to symbol

6:00 TEttinger: clj-learner: refer goes in one of the vectors, if I recalll correctly, and isn't its own section like (:require)

6:01 dysfun_: (ns fooo (:require [a.core :rename {b b2}]))

6:01 although you probably want to refer b as well because otherwise you'll get everything

6:01 TEttinger: clj-learner: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

6:02 clj-learner: thanks

6:08 amalloy: that article is four years old, TEttinger

6:08 it recommends some things which are today considered little better than cannibalism

6:08 TEttinger: wow

6:08 did not know that

6:08 where's the good one?

6:10 amalloy: beats me

6:13 clj-learner: it works like this, but im not sure if i should use refer or use https://www.refheap.com/91953

6:30 TEttinger: refer

6:32 foodoo: What are the current documentation tools for Clojure? Autodoc doesn't seem to be compatible with Leiningen 2

6:33 ro_st: codox is another one

6:34 TEttinger: marginalia?

6:35 foodoo: TEttinger: My current project won't profit from literate programming. But still thanks for your answer

6:35 ro_st: Ring uses codox: http://ring-clojure.github.io/ring/ config: https://github.com/ring-clojure/ring/tree/master/project.clj

6:35 foodoo: ro_st: Thanks, I'll have a look

6:40 ro_st: Just ran codox on my codebase. Nifty! Thanks :)

6:40 ro_st: glad it worked out

6:41 i'm quite looking forward to the simulation testing webinar next friday

6:41 i really hope they show how to use causatum with simulant

6:50 noncom|2: where is the source of "in-ns" ?

6:51 ro_st: in the java source

6:51 -wild guess-

7:16 gfredericks: well I can see where it's created (in RT.java) but not where it gets a proper value...

7:18 oh there it is

7:18 noncom|2: look for "final static IFn inNamespace" in RT.java

7:24 noncom|2: thanks! :)

7:35 simao: what is the best way to test a string against a regex in a clojure test? Just want a func to return true/false, not a match or anything

7:36 ro_st: (boolean (re-find #"" ""))

7:36 simao: thanks

7:37 Would think there was some way more concise ;)

7:37 ro_st: if there was, we'd have boolean variants of all our functions :-)

7:40 simao: eh :) Just thought there would be a better way to write this: (is (true? (boolean (re-find #"slave status unknow" (:status result)))))

7:40 quite awkward no?

7:40 ro_st: (is (boolean ..))

7:40 boolean returns true or false. true? returns true if its arg is `true`

7:41 it's unnecessary to use true?

7:41 you could also just (is (re-find #".." ..))

7:42 i just checked in a repl: (if (re-find #"\d" "a") 1 2) ;; 2

7:42 simao: ah yeah, that looks much better, thanks.

8:15 gfredericks: simao: most boolean-like things in clojure respect general truthiness instead of just true v false

8:15 so it's rarel necessary to actually convert something to a boolean

8:15 simao: I see...

8:16 It's a bit weird then

8:16 gfredericks: I think that's typical for dynamically-typed languages

8:16 * gfredericks can't remember what erlang does

8:17 simao: Is there a nice function that simplifies this? (assoc event :tags (vec (concat (or (:tags event) []) ["always-present-tag"])))

8:17 kind of a deep merge of vecs inside an hash

8:18 gfredericks: ,(def event {:tags ["foo" "bar"]})

8:18 clojurebot: #'sandbox/event

8:18 gfredericks: ,(update event :tags conj "always-present-tag")

8:18 clojurebot: {:tags ["foo" "bar" "always-present-tag"]}

8:21 simao: "Unable to resolve symbol: update in this context"

8:21 ?

8:26 scottj: simao: maybe you want (update-in {} [:tags] (fnil conj [])"foo")

8:26 gfredericks: yeah update is new in 1.7

8:28 simao: ah ok

8:30 that works, thanks

9:41 TimMc: "* gfredericks can't remember what erlang does" is good out of context

9:42 gfredericks: I wasn't even sure what java did when using a boxed boolean that turned out to be null

9:42 TimMc: OK, so I feel like maybe I need to make a fifo transport for nrepl. Anyone want to talk me out of this?

9:42 gfredericks: so I tried it -- compiles fine, but NPE at runtime

9:43 TimMc: what what why?

9:43 TimMc: clojurebot: gfredericks |can't| remember what erlang does

9:43 clojurebot: In Ordnung

9:44 TimMc: The situation is that I want to adapt LiveREPL to open a persistent nREPL session that I can connect to again later. However, that means opening up a port, which *anyone* on the machine could connect to, not just the user who launched the JVM (and therefore the user who connected via liverepl.

9:44 )

9:45 gfredericks: erlang requires a true

9:45 TimMc: I *think* that the only way to secure this without passwords or an SSH lib is to use native filesystem security: Create a fifo (or pair of fifos...) with the correct permissions and read/write from that.

9:46 gfredericks: oh that's what fifo means

9:46 okay no I can't talk you out of that

9:48 mi6x3m: hello, I am trying to define a function with meta in a syntax quote

9:48 TimMc: gfredericks: aw shucks

9:48 mi6x3m: `(defn ^{:foo blabla} ....)

9:48 but somehow when the function is defined I don't see the meta?

9:48 could it be ^ doesn't work that well in syntax quote?

9:53 gfredericks: ,(meta ` ^:foo bar)

9:53 clojurebot: {:foo true}

9:53 thomasfuston: Aloha, are there a recommended gui lib for clojure or just use the jave ones?

9:54 mi6x3m: thomasfuston: seesaw

9:54 it's a wrapper of Swing

9:54 and a fine one

9:54 Gurkenmaster: Why would anyone recommend swing?

9:55 mi6x3m: Gurkenmaster: because Swing is a nice library with great capabilities?

9:55 Gurkenmaster: It's still worse than javafx

9:56 mi6x3m: I think Swing does it's job

9:57 JavaFX does it also

9:57 but one being better than the other

9:57 I don't know

9:57 too bold of a statement

10:11 m1dnight: I'm going to ask again, in case somebody's here who knows: Is there a reason readlocks on refs (ensure) are held between retries in clojure?

10:14 donbonifacio: hello, how can I pass a collection as a variadic "argument" ?

10:16 ToxicFrog: donbonifacio: apply?

10:17 donbonifacio: yessss

10:18 that's it ToxicFrog, thanks :)

10:33 jonh: moo

10:36 dysfun_: what causes defmacro to be run at compile time? is it a special form or is there some sort of metadata that controls it?

10:37 clj-learner: i'm trying to create a function that reads from cmdline using read-line but it doesnt work on the intellij repl, i get "DEBUG: unknown status need-input" and nothing happens if i submit stuff, i need to interrupt current execution

10:37 it works if i open a lein repl

10:38 dysfun_: i expect it's closed STDIN

10:45 clj-learner: how do i open the stdin?

10:50 dysfun_: you don't. if it's that, it's a limitation of the intellij repl

10:53 TimMc: $seen djpowell

10:53 lazybot: djpowell was last seen quitting 10 weeks ago.

10:53 TimMc: :-(

10:54 I demand instantaneous communication!

10:54 clj-learner: is there an alternative to use the windows cmd then?

10:54 for the repl

10:57 justin_smith: dysfun_: regarding macros, there is a :macro true metadata

10:57 ,(:macro (meta #'or))

10:57 clojurebot: true

10:57 dysfun_: yes, which isn't set on defmacro

10:58 justin_smith: ahh, that's what you are asking

10:58 dysfun_: is it a special form?

10:58 Bronsa: dysfun_: it is set on defmacro

10:58 justin_smith: ,(:macro (meta #'defmacro))

10:58 clojurebot: true

10:58 Bronsa: .setMacro sets :macro true

10:58 dysfun_: oh. well it's not in the definition of setmacro. it must be set later

10:58 er defmacro

10:59 so the :macro property just controls whether it's evaluated at compile time?

10:59 Bronsa: dysfun_: immediately after the definition of defmacro there is (.setMacro #'defmacro)

10:59 dysfun_: yeah

10:59 dysfun_: oh. that cut off my screen

11:01 squeedee: why do i need to quote 'and' here? : (reduce 'and '(true true true))

11:01 dysfun_: and is a macro

11:02 squeedee: so quoting it stops it from inlining?

11:02 Bronsa: squeedee: that doesn't do what you think it does

11:02 dysfun_: what he said

11:02 Bronsa: squeedee: you can't use macros as higher order functions

11:02 dysfun_: you are calling the symbol 'and' on every invocation

11:02 Bronsa: ,(reduce 'foo '(true true true))

11:02 clojurebot: true

11:02 Bronsa: ,(reduce 'foo '(true false true))

11:02 clojurebot: true

11:02 Bronsa: ,(reduce 'and '(true false true))

11:02 clojurebot: true

11:03 squeedee: oic

11:03 Bronsa: squeedee: if you need to "apply" or "reduce" and/or, there are a bunch of convenience functions that you can use

11:03 squeedee: look at some/not-any?/every?

11:04 squeedee: ok will do

11:04 thankyou

11:04 dysfun_: the naming of not-any? still bugs me

11:05 squeedee: because its not-every?

11:05 dysfun_: no, it's not, it's not-some

11:05 and nevermind the fact some doesn't end with ?

11:05 squeedee: so some should be any

11:05 that is strange to read

11:06 dysfun_: ,any

11:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: any in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:06 dysfun_: there is an any? in useful, but that does a different thing

11:09 squeedee: (every? true? list) is what i was after. i guess it reads well

11:11 Bronsa: squeedee: unless you need to explicitely test for true rather than for truthy, you should use (every? identity list) instead

11:12 dysfun_: also consider keep

11:12 squeedee: you think that reads as well? given that all arguments will be bool.

11:12 dysfun_: well it's more about making things more general so they can be reused

11:13 squeedee: hmmm

11:15 I am still quite green, but my take is that it would be an overgeneralization. I have a diff of two 'graphs' that tells me if each matching element is the same or not. Sometimes i just want to know if there are any differences.

11:16 its a pretty specific dsl with a specific signature too, which may be where i'm holding on to imperative habbits

11:21 my-way vs a-different-way ? https://gist.github.com/squeedee/bfad8db75f4664e4ad75

11:21 arrdem: $seen nkariniemi

11:21 lazybot: I have never seen nkariniemi.

11:21 arrdem: damnit

11:25 dysfun_: can you change the line number errors will be reported on during compilation?

11:25 perhaps something involving with-meta ?

11:30 justin_smith: ,(require 'clojure.data)

11:30 clojurebot: nil

11:30 justin_smith: ,(every? nil? (take 2 (clojure.data/diff {:a 0 :b 2 :c 3} {:a 0 :b 2 :c 3}))) ; squeedee

11:30 clojurebot: true

11:30 justin_smith: ,(every? nil? (take 2 (clojure.data/diff {:a 0 :b 2 :c 3} {:a 0 :b 2 :c 4}))) ; squeedee

11:30 clojurebot: false

11:31 justin_smith: ,(clojure.data/diff {:a 0 :b 2 :c 3} {:a 0 :b 1 :c 3})

11:31 clojurebot: ({:b 2} {:b 1} {:c 3, :a 0})

11:31 justin_smith: it returns things only in a, things only in b, and the overlap as a three element list

11:32 squeedee: yeah its nice. My data is a sequence tho. unkeyed.

11:32 would have to interpolate the index in i guess

11:32 justin_smith: ,(clojure.data/diff [0 1 2] [0 1 3])

11:32 clojurebot: [[nil nil 2] [nil nil 3] [0 1]]

11:32 squeedee: oic

11:32 justin_smith: ,(clojure.data/diff [0 1 2] [0 1 2])

11:32 clojurebot: [nil nil [0 1 2]]

11:32 squeedee: hah

11:32 useful

11:33 thanks

11:33 justin_smith: np

11:33 it comes with clojure.core iirc

11:34 squeedee: justin_smith: of course some of these helpful tools i don't look for while i just try to excercise my mind a little here, but now i've done it my way i'll switch to that.

11:36 justin_smith: squeedee: clojure.data is one of those hidden gems imho

11:36 squeedee: ugh clear liquid diet is driving me crazy. makes coding hard :P

11:37 dnolen_: Om 0.8.0-alpha1 is out, biggest change is refernce cursors https://github.com/swannodette/om/wiki/Advanced-Tutorial#reference-cursors

11:37 squeedee: hiya dnolen_ , Rasheed here. Glad to see you're still omming it up. One day I might get somewhere useful with it :D

11:38 justin_smith: i am fighting a constant urge to create proxy functions in my namespaces.. like ok, data/diff is ace, but wheres the reminder that you should use it... so I find myself wanting mapper.diff/diff

11:54 christop1e: Guys, is the source for the evaluator bot open?

11:54 I'd like to add it to my own bot :)

12:10 luxbock: m1dnight: https://github.com/hiredman/clojurebot

12:10 there's also https://github.com/Raynes/lazybot

12:14 m1dnight: aha, great! :) thanks guys

12:15 It took my compsci frat a few minutes and they got my Scheme evaluating bot offline :p

12:15 forgot a few key primitives :p

12:56 whodidthis: was there a thingie somewhere that would run a jvm instance and then all lein tasks would use that instance

12:57 squeedee: trampoline?

12:57 clojurebot: trampoline is http://groups.google.com/group/clojure/browse_thread/thread/6257cbc4454bcb85/3addf875319c5c10?#3addf875319c5c10

12:57 mdeboard: Oh, is that what trampoline is?

12:57 squeedee: dont take my word for it

12:58 perhaps not

12:58 whodidthis: i think trampoline was 1 jvm instance per task

12:59 squeedee: yeah just not nested in leins

13:01 weavejester: Trampolining is the same principle in Clojure or Lein

13:01 Essentially instead of executing a function or process

13:01 You return a callback

13:02 In Clojure’s case, that’s a zero-argument function

13:02 In Lein’s case it’s a shell command in a temporary file

13:02 It prevents nesting of either functions or processes

13:06 whodidthis: right, grenchman

13:06 i just remembered it was built by one of the greats so found it from techiemancer's repo list

13:11 mdeboard: techiemancer

13:11 lol

13:11 justin_smith: whodidthis: with something like grenchman, you may also end up finding pallet/alembic useful (in case you need to add deps)

13:11 mdeboard: I approve of the name change

13:11 bundacia: so, I'm brand new to clojure and am trying to get a feel for macros by implementing some if the built in control flow forms. I can't figure out what I'm doing wrong in my attempt to make a "condp" macro.

13:12 this is what I'm trying: (defmacro mycondp [op rhs lhs result & next] `(if (~op ~lhs ~rhs) ~result (mycondp ~op ~rhs ~@next)))

13:12 whodidthis: actually im just wondering how to fit more lein tasks on a 2gb server :S

13:12 m1dnight: refheap.com is easier to show us code bundacia

13:13 bundacia: cool. here it is on refheap: https://www.refheap.com/91973

13:13 the-kenny: dnolen_: You have just simplified the application I write at work in a massive scale on multiple levels. Thank you so much <3

13:13 dnolen_: the-kenny: :)

13:14 egghead: bundacia: do you know the rules of macro club yet?

13:14 bundacia: this is the error I'm getting: https://www.refheap.com/91974

13:15 I do not know the rules of the macro club I guess. Didn't know there was a club =)

13:15 egghead: gfredericks has a pretty nice talk introducing macros bundacia - you should check it out http://www.infoq.com/presentations/macros-clojure-west-2013

13:16 bundacia: thanks egghead, I;'ll check that out.

13:16 the-kenny: dnolen_: I said it some time ago at EuroClojure, and I want to say it again: Thanks for Om. Without it, I'd still fight with Ember.js and build parts of the UI from a string out of deperation

13:19 bundacia: egghead: just googled the "rules" ;-) Mainly just wanting to understand them at this point so I can understand the built-in ones better.

13:22 the-kenny: dnolen_: One question: Are there performance benefits in using (transact! (:foo root-cursor) ...) compared to (swap! app-state update-in [:foo] ...)? (It will at least have the benefit of supporting tx-listen, right?)

13:24 egghead: bundacia: it may help to call (macroexpand '(mycondp < 2 1 :yep)) and consider what will happen if it keeps trying to expand

13:25 does om support querying the tx history with datalog yet

13:26 ;)

13:26 whodidthis: is there a god lein template for clojure project with cider nrepl thingies ready

13:27 bundacia: egghead: got it. Didn't think it would keep trying to expend the false case.

13:29 mdeboard: Anyone have any indentation tweaks for clojure-mode in emacs?

13:30 the-kenny: mdeboard: what kind of tweaks?

13:30 mdeboard: like for example, there are some functions like map that always take a function, then basically an unlimited number of elements to map over

13:31 the-kenny: whodidthis: What do you mean by 'ready'? I just have [cider/cider-nrepl "0.8.0-SNAPSHOT"] in my :user profile and use lein repl (or `cider-jack-in') to connect. If you want something where nrepl+cider is embedded in the application itself, I'm afraid I can't help you :/

13:31 egghead: generally just https://github.com/bbatsov/clojure-style-guide mdeboard

13:32 mdeboard: It's usually about what element "hangs" on the end of a line

13:32 whodidthis: cool

13:33 mdeboard: https://gist.github.com/mattdeboard/614b2f2d1fdd2215133b

13:33 An example

13:33 the-kenny, egghead

13:33 I mean I get *why* it's like that

13:33 all just elements in a list, homoiconicity etc.

13:34 just, feh

13:34 egghead: ya, that is the default and recommended indentation

13:34 whodidthis: i want to try this "emacs" thingie

13:35 mdeboard: whodidthis: It's a flash in the pan

13:36 whodidthis: i did get some of that sexp sexyness in some vim plugin too

13:36 makes one wonder why all languages are not lisp

13:38 egghead: mdeboard: commented on the gist

13:38 whodidthis: https://github.com/weavejester/reloaded.repl is this currently still the state of art

13:39 on the reloaded workflow department

13:40 domokato: does clojure box primitive return values?

13:41 mdeboard: egghead: Yeah, I know that's the thing but just curious if anyone had defined any custom indentation rules for themselves in emacs

13:57 gfredericks: why does `lein release` ask me if I meant to say `lein deploy clojars`?

13:57 i.e., what is the best way to make that the default?

13:59 Ah I bet it is :deploy-repositories [["releases" :clojars]]

14:01 domokato: to answer my own question, looks like the source of float is just a function, so no. But correct me if I'm wrong

14:02 gfredericks: domokato: primitive return values from what? java interop methods?

14:02 domokato: clojure functions

14:02 gfredericks: by default everything is boxed

14:02 you have to go out of your way to get primitives to work across function calls

14:03 domokato: sigh, ok

14:03 thx

14:03 gfredericks: there's some nuances there, but assuming things are boxed is usually safe

14:04 mdeboard: I just want to take a second to acknowledge this hero https://groups.google.com/d/msg/clojurescript/Bd4MthunzkQ/AJxzblvUAG8J

14:05 He had a problem, posted to a newsgroup about it, then solved it *and then posted the solution*

14:05 instead of http://xkcd.com/979/

14:27 gfredericks: just made a plugin for doing `lein vcs tag` without a PGP signature, and for updating version documantation in README files: https://github.com/gfredericks/corncob-cigar

14:28 I used it to release itself

14:30 Jaood: a recursive plugin?

14:31 gfredericks: not more than any other dev tool

14:36 augustl: I have a transient map. Can I create a record from it or do I have to create a persistent map first?

14:39 hyPiRion: have to make it persistent

14:39 Or well, eh.

14:41 augustl: I'm prematurely optimizing, could always write this part in Java if it turns out to matter :)

14:42 gfredericks: ,(def m (transient {:foo 12 :bar 3}))

14:42 clojurebot: #'sandbox/m

14:42 gfredericks: ,(keys m)

14:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentHashMap$TransientHashMap>

14:42 gfredericks: ,(.getKeys m)

14:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getKeys for class clojure.lang.PersistentHashMap$TransientHashMap>

14:42 augustl: I'm getting chunks of messages in sequence, one chunk represents a field, so I create a transient that I assoc into and when I have all the chunks I create a record

14:42 hyPiRion: augustl: yeah, it seems like map->X require a persistent map

14:42 gfredericks: ,(get m :bar)

14:42 clojurebot: 3

14:42 gfredericks: if you know the keys you prollably can

14:42 augustl: hmm didn't know you could get from transients

14:42 gfredericks: ,(source frequencies)

14:42 clojurebot: Source not found\n

14:43 gfredericks: I don't think you could write frequencies otherwise

14:43 hyPiRion: Transients work like persistent data structures, except that you cannot use a transient after you've done an "update"

14:43 gfredericks: you can't "use" it?

14:43 augustl: I expected there to be a separate get! just like there's assoc!

14:43 gfredericks: ,(assoc! m :hypirion 42)

14:43 clojurebot: #<TransientHashMap clojure.lang.PersistentHashMap$TransientHashMap@13b7ce9>

14:44 gfredericks: ,(get m :hypirion)

14:44 clojurebot: 42

14:44 hyPiRion: gfredericks: theoretically I meant

14:44 gfredericks: ooh that right

14:44 augustl: oh I see; yeah there's not really a need for that I guess

14:45 augustl: makes sense, only the "update" part of transients is different

14:47 hyPiRion: ,(count (let [t (transient {})] (dotimes [i 100] (assoc! t i i)) (persistent! t)))

14:47 clojurebot: 8

14:53 augustl: and now for something completely different.. Is there a way to break out of a "loop" other than recur-ing with a value that causes the loop to break based on my own loop code?

14:53 I really should just write this part in Java :) ZMQ sockets are such imperative, wow

14:53 justin_smith: augustl: just don't call recur!

14:53 augustl: justin_smith: ah :D

14:54 justin_smith: I mean, there are various reasons not to call recur, just make sure you don't call it

14:55 ie. sometimes I will stop recurring based on ##(.isInterrupted (Thread/currentThread))

14:55 lazybot: ⇒ false

14:55 justin_smith: that will show as true if someone cancelled the thread (via future-cancel or whatever)

15:11 augustl: when using stuartsierra's components, are there any rules of thumb on what to create in the "create" part and what to create in "start"? Seems cleaner to me to create everything that doesn't have any state and side effects in create, such as connection objects, and call connect on them in start

15:13 kenrestivo: i guess if you will be calling stop and start, you'd put things you want done every time, in there. and things you only done once when first setting up the components, put in create?

15:13 reminds me of the android life cycle onCreate onResume thing

15:15 augustl: kenrestivo: makes sense. If my objects/values I use in stop/start can be restarted (and in this case they can) I might as well reuse them

15:58 justin_smith: yeah, I think things that are values can be in create, things that are state should be in start (so they get a clean slate)

15:59 and if something is both value and state woah dude this is clojure why are you trying to write OO code?

16:39 SagiCZ1: briliant, check out motivational lorem ipsums http://www.loremfuckingipsum.com/

16:39 mdeboard: wtf

16:39 Why does this channel get such an insane a mount of spam

16:40 (relatively insane)

16:40 SagiCZ1: sorry

16:40 im no spam bot though

16:40 mdeboard: Yeah that's what you all say

16:40 Now you issue a pat rejoinder

16:40 SagiCZ1: i seriously thought that was interesting

16:40 mdeboard: Now I respond with how you're definitely a bot, and you say something predictable

16:40 SagiCZ1: (dec mdeboard)

16:40 lazybot: ⇒ 9

16:42 mdeboard: This channel is pretty rife with spam. And when you mention spam after they spam, you all respond "I'm not a bot tho" never, "I'm not a spammer"

16:42 justin_smith: mdeboard: he's a pretty active regular here, I think he was just sharing a silly off topic thing he found

16:42 mdeboard: Ok

16:42 My bad then.

16:42 I just get so many dumb whispers from bots in this room :(

16:42 justin_smith: also, this channel is pretty heavily off topic

16:42 yeah, understood, very annoying

16:43 if you msg technomancy, he has ops and will kick and ban the spammers

16:43 mdeboard: idc about the off-topic at all, doesn't bother me. I just assume people posting random links and nothing else are bots now. Sorry SagiCZ1.

16:43 justin_smith: I think we need more folks with ops though

16:51 squeedee: clojure.org looks mighty slow from here

16:53 lvh: Is there a CLJS-supporting vector addition/mutliplication lib I can use? Don't need much; really just scalar products/linear combinations.

16:54 Right now I'm writing them myself

17:00 justin_smith: lvh: is there any cljs core.matrix support?

17:00 lvh: justin_smith: nope :( that was my first port of call as well

17:00 justin_smith: should have figured

17:08 lvh: justin_smith: fortunately I do not need particularly heavy math ops; it's pretty much just linera combinations of vectors :)

17:47 arrdem: justin_smith: good luck with that

17:48 I suspect tech will be our only op for the forseable future

17:48 at HackTx atm, if you have feature requests for Grimoire 0.4.0 speak now or hold your peace because this release is happening

17:50 justin_smith: arrdem: good luck with what? core.matrix in cljs?

17:50 ahh, regarding ops

17:50 arrdem: justin_smith: yeah ops. sorry.

18:01 pkkm: is there a better way to drop n characters from the beginning of a string than (apply str (drop n my-string)) ?

18:04 nevermind, (subs n my-string)

20:35 andrewhr: anyone here that could enlight me about an issue of ClojureScript compiler? (http://dev.clojure.org/jira/browse/CLJS-851)

21:46 johnwalker: how does one assert that an argument or field satisfies an interface?

21:47 for example, (defn foo [^IFn bar] (bar ..))

21:49 TEttinger: johnwalker: multimethods, probably

21:50 justin_smith: ,(assert (contains? (supers (class [])) java.util.List))

21:50 clojurebot: nil

21:51 justin_smith: ,(assert (contains? (supers (class [])) java.util.Map))

21:51 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (contains? (supers (class [])) java.util.Map)>

21:51 johnwalker: ,(satisfies? IFn (fn []))

21:51 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: IFn in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:51 justin_smith: all the interfaces it implements should show up in the supers (which is returned as a set, so you can use contains, subset, intersection, etc.)

21:52 ahh, satisfies may be more direct yeah :)

21:52 johnwalker: there's a core function thats ,(fn? (fn []))

21:52 ,(fn? (fn []))

21:52 clojurebot: true

21:53 johnwalker: i guess asserts are a start

21:53 justin_smith: (source fn?)

21:53 ,(source fn?)

21:53 clojurebot: Source not found\n

21:53 justin_smith: $source fn?

21:53 lazybot: fn? is http://is.gd/nTvi5s

21:53 johnwalker: good idea

21:53 justin_smith: it uses instance?

21:54 as do the other nearby predicates

21:54 sequential?, coutned? etc.

21:54 johnwalker: ,(fn? {})

21:54 clojurebot: false

21:54 justin_smith: ,(ifn? {})

21:54 clojurebot: true

21:55 johnwalker: ahh

21:55 jcsims: is there an idiomatic way to wrap a subset of routes in a ring app, instead of all of them?

21:56 johnwalker: very helpful

21:56 (inc justin_smith)

21:56 lazybot: ⇒ 95

21:56 johnwalker: thanks!

21:56 weavejester: jcsims: A subset of routes is just a handler. It’s handlers all the way down.

21:57 justin_smith: johnwalker: np

21:57 jcsims: that's what I thought, but I'm trying to track down a new "Invalid anti-forgery token" problem that I didn't have before. I've got an 'anti-forgery-field' in the form

21:58 weavejester: jcsims: Do you have the session middleware applied?

21:58 jcsims: I'm using your ring-defaults library: https://www.refheap.com/91986

22:00 when all routes were wrapped with site-defaults, it worked fine

22:00 weavejester: jcsims: Oh, you’ve got them setup next to each other.

22:00 jcsims: You’re going to run into problems with side-effectful middleware

22:00 jcsims: Anything that acts upon the body, like wrap-params.

22:01 jcsims: I think it’s just wrap-params, actually.

22:02 jcsims: so it is just not possible to use the two different defaults in the same ring app, then?

22:05 weavejester: jcsims: You’d need to make sure that the side-effectful middleware was set at the top level

22:06 jcsims: I think that’s just wrap-params and wrap-multipart-params. It might be worth having a config for middleware that’s side-effectful.

22:07 jcsims: But you can do it manually by turning those off and applying them at the top level. Or just apply wrap-params at the top level, because that’s the only side-effectful middleware used by both your routes.

22:09 jcsims: ok, I'll have to revisit this tomorrow, but I will keep that in mind - when you say 'top level', are you referring to inside 'app's definition, or elsewhere?

22:23 vanila: Did rich hickey write the entire compiler by himself?

22:27 TEttinger: vanila: take a look for yourself, https://github.com/clojure/clojure/graphs/contributors

22:28 weavejester: jcsims: You want to ensure that wrap-params is only applied once.

22:31 vanila: Wow!!!! What a boss

22:31 so much work

22:31 im sure everyones contributions are really valuable but he put so much in!

22:32 justin_smith: vanila: he took years on the project

22:32 (well, I guess that shows in the graphs)

22:32 vanila: yeah!

22:33 johnwalker: damn thats a lot

22:45 TEttinger: vanila, rich hickey kinda discovered a few of the data structure varieties clojure uses. Persistent Immutable Hashmaps are internally represented as 32-tries I think, which was not a common method but allows the sharing of state between similar maps

22:46 amalloy: you gotta remember that 178,000 lines of java is really only like a thousand lines of clojure

22:46 catern: TEttinger: where's his papers on them, then

22:46 amalloy: TEttinger: he didn't invent HAMTs; they're an implementation of phil bagwell's ideas

22:47 TEttinger: amalloy, is clojure the first implementation of them in practice?

22:47 catern: TEttinger: it's not like he's some kind of CS genius (although I will change this opinion if he actually does have papers)

22:47 amalloy: the first that i'm aware of

22:48 catern: every language loves its BFDL

22:48 TEttinger: catern, the fact that he isn't a theorist is part of why clojure's so successful; it's a productive language because rich needed it for work, so it had to work

22:49 catern: TEttinger: okay so don't imply he is, "discovered a few of the data structure varieties clojure uses"

22:49 TEttinger: did I use the term CS genius?

22:50 vanila: but he wrote an entire compiler himself

22:50 so he must be at least a bitof genius

22:50 TEttinger: he's hard-working, certainly

22:50 catern: that's not that big of a deal

22:50 tens of thousands of students write compilers every 3 months

22:50 john2x: he's above average?

22:51 catern: (but yes it's of course somewhat impressive)

22:52 TEttinger: He's a good combination of pragmatic, experienced, and hard-working, but I wouldn't describe any of clojure's underpinnings as especially "above the limits of normal programmer understanding"

22:53 vanila: is there a breakdown of how the compiler works? or a series of blog posts about it

22:53 im realyl intrested in learning about compilers

22:53 TEttinger: clojure happens to inherit most of the advantages of earlier lisp designs, which helps a huge amount design-wise

22:53 catern: vanila: you could read a compiler textbook or read the source of a teaching compiler

22:55 TEttinger: vanila: most compiler writing how-tos with implementation specifics expect you to know C, or sometimes Haskell. there's a good one that walks you through creating your own forth in assembly, an old approach that still works, though it won't be a practical language

22:56 vanila: TEttinger, that forth one sounds really awesome do you remember what it was called?

22:59 TEttinger: http://www.eecs.wsu.edu/~hauser/teaching/Arch-F07/handouts/jonesforth.s.txt

22:59 vanila, it took me a bit to find it, but I think that's it

23:00 there's also the "make your own lisp in haskell" wikibook

23:00 vanila: cheers!

23:01 im going to try to do the forth one :)

23:02 TEttinger: ah, this one https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours

23:02 good luck, vanila! I'd be curious to see it translated to a platform independent assembly-like language such as JVM or CLR opcodes

23:15 kenrestivo: has anyone done a transit implementation for c or c++? my google-fu is failing.

23:17 hmm, nevermind, turns out i don't need it.

23:42 squeedee: Anyone in Manhattan here? Im stuck in hospital and need a decent coffee!

23:44 TEttinger: squeedee, fake the symptoms of methanol poisoning to get them to get you drunk

23:46 (the best cure for methanol poisoning, commonly caused by bad moonshine, is to get your body to digest a ton of regular (grain) alcohol, ethanol. the body prefers to digest ethanol first, and it lets methanol pass if you stay drunk enough)

23:55 kenrestivo: tips every clojure programmer should know

23:55 MrJones98: anyone here familiar with clojure.tools.nrepl.server?

23:56 justin_smith: MrJones98: sure, what about it?

23:56 MrJones98: trying to use the default-handler and pass in some middleware

23:56 justin_smith: oh sorry, I've never used the middleware options at all

23:56 MrJones98: i admit i don’t understand the first thing about it and trying to adapt someone’s PR to lein-ring

23:57 justin_smith: darn

23:57 :-)

23:57 i’m getting a runtime exception - unable to resolve var

Logging service provided by n01se.net