#clojure logs

2014-04-23

00:04cddrIt's an alternative approach to managing a big IT infrastructure
00:36r00kDoes anyone have a link to a plugin that colorizes clojure.test output?
00:37r00klein-difftest appears unmaintained an unworking.
00:49jwmis eval lazy?
00:50amalloyjwm: that's a pretty poorly-defined question
00:50jwmprobably
00:50amalloytry constructing a sample call to eval, decide how it would behave if eval were lazy vs not lazy, and see which answer you actually get
00:51jwmI am trying to do an eval right after (use)
00:51jwmit works when I lein repl but the eval fails when I do lein run
01:04expezjwm: eval isn't lazy. Furthermore, eval isn't called directly very often, so if you're new to Clojure you're probably 'doing it wrong'.
01:05jwmI'm loading some code at runtime based on configuration using 'use' and then calling a init function from there
02:06zanesSo, I have a sequence of data transformations during which I want to perform side effects based on the intermediate values. What’s the most idiomatic way to go about that?
02:07zanesWithout the side effects this is very neatly expressed using the thread last macro.
02:09Si_any one here use caribou at all ?
02:13jwmso lein run leaves me in the "user" namespace?
02:14noidizanes, synthread has ->/aside for that purpose https://github.com/LonoCloud/synthread
02:14zanesAha.
02:15noidior you could do (as-> x (side-effect-1 x) (side-effect-2 x) x)
02:15noidiwithin (-> ...)
02:16zanesnoidi: Those are both really helpful, thanks!
02:17noidiand if your side-effecty functions take the topic as the first parameter, you could do (-> ... (doto side-effect-1 side-effect-2) ...) but that doesn't read very well IMO
02:17zanesI’m threading last, fwiw.
02:18beamsoso, in my programming, i build up maps of information to process. is that what that library is for, in a way?
02:19zanesSo it seems like as-> won’t work for me in here.
02:21noidiah, I forgot that as-> doesn't just give a name to the topic but it does threading as well
02:22noidizanes, this should work
02:22noidi,(-> 2 (as-> x (do (println x) x)))
02:22clojurebot2\n2
02:22zanes,(-> [1 2] (as-> x (do (println x) x)))
02:22clojurebot[1 2]\n[1 2]
02:22zanes,(->> [1 2] (as-> x (do (println x) x)))
02:22clojurebot#<Exception java.lang.Exception: Unsupported binding form: (do (println x) x)>
02:22noidiah, right
02:23zanes,(->> [1 2] #(as-> % (do (println x) x)))
02:23clojurebot#<CompilerException java.lang.Exception: Unsupported binding form: (do (println x) x), compiling:(NO_SOURCE_PATH:0:0)>
02:24noidi,(-> [1 2 3] (as-> xs (map inc xs) (do (println xs) xs)))
02:24clojurebot(2 3 4)\n(2 3 4)
02:24zanesThis seems relevant: http://missingfaktor.blogspot.com/2014/03/dead-simple-threading-with-functions-in.html
02:24noidithat's not as nice as ->> as you have to explicitly name the topic in each step, but it still does threading
02:25zanesAh, I get it.
02:25zanesSo as-> basically lets you choose your own position.
02:25zanesFor each form.
02:25noidiyes
02:26zanesOkay. I was mistaken in my understanding of it. So I’d replace my use of ->> with as->.
02:26zanesProbably.
02:37numbertenquestion
02:37numberteni was trying to write the shortest possible identity function
02:38numberteni thought #(%) might work but it doesn't seem to
02:38numberteni'm curious what makes that any different than (fn [x] x) which seems to work
02:44dbaschnumberten: this answers your question http://stackoverflow.com/questions/13204993/anonymous-function-shorthand
02:44numbertenthanks
02:44numberteni realized that it was the () around it
02:44numbertenthat was breaking it
02:44numberteni guess I don't fully understand the desugaring that happens
02:46dbaschnumberten: #(%) tries to call % as a function, with no arguments
02:47numberteni see
02:58noidi,'#(%)
02:58clojurebot(fn* [p1__25#] (p1__25#))
03:00numbertenwoah
03:00zanes,(#(%) #(print “Hello”))
03:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “Hello” in this context, compiling:(NO_SOURCE_PATH:0:0)>
03:01numberten,#(-> %)
03:01clojurebot#<sandbox$eval132$fn__133 sandbox$eval132$fn__133@ad08de>
03:01numberten,(#(-> %) 5)
03:01clojurebot5
03:09zanesnoidi: Turns out prismatic.plumbing has as->>.
03:09zaneshttps://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L300...L303
03:10jwmhow do I use another namespace than "user" when executing -main from uberjar?
03:12kelseyhey I have a total newb question
03:15kelseygii wanna map a function over a vector of maps
03:16kelseygithe function is select-keys, which takes the map as the first arg & a set of keys as the second arg
03:16kelseygihow do i get each member passed to select-keys in the map call?
03:16amalloyyou have a fixed set of keys you want to select, across all maps?
03:17kelseygiyah
03:17kelseygiit's json--i probably should do something more robust for parsing but now i want to know the answer
03:17amalloy(map #(select-keys % [:x :y :z]) maps), although i would usually write that as (for [m maps] (select-keys m [:x :y :z]))
03:18kelseygiah the placeholder % was what i couldn't google :)
03:18amalloykelseygi: i mean, remember that #(f % x) is just shorthand for (fn [foo] (f foo x))
03:19amalloyyou don't ever need to use it
03:19roelofHello, I have to make a script which checks if someone is older then 12 and younger then 20
03:19amalloyshow them a picture of a VHS tape
03:19roelofSo i did this:http://pastebin.com/06mfqLjh
03:20roelofbut now I see this error message: cannot be cast to clojure.lang.id
03:20roelofhow to solve this ?
03:21ebaxtroelof: (> age 12) not (age > 12)
03:22ebaxtand you don't need the if
03:22kelseygithank you amalloy
03:23roelofoke, still have to think about this,
03:24roeloflast question : Can I do the same with one comparison and three arguments
03:24roelofI now I can do ( < x y x )
03:24amalloy(< 12 age 20)
03:25roelofamalloy: does that not mean lesser then 12 ??
03:25lazybotroelof: What are you, crazy? Of course not!
03:25roeloflazybot: ????
03:27amalloylazybot is right as always
03:27roelofI think lazybot is insulting me. I do not understand what he/she means
03:27amalloyhe's a robot
03:28amalloyhe just knows that if you ask a question with two exclamation marks the right answer is usually, as here, "no"
03:28amalloyer, question marks
03:29roelofoke, I refrase my question then
03:30roelofamalloy: does that not mean lesser then 12 ?
03:30amalloywhy don't you try it on some sample values of x and see?
03:31roelofoke, I will do that
03:31roelofthanks for the help so far
03:56martinklepschI'm using data.zip/data.xml and some other stuff and would like to parse a list of elements to a vector of strings: <parent><a>hello</a><b>you</b></parent> => ["hello" "you"]
03:59martinklepschnevermind, got it
04:08jwmthat is nice
04:09jwmnow I have two repls going at once, one from lighttable and one from lein :)
04:16bars0\quit
04:23sverihi, why does this macro return a stack overflow error? http://pastebin.com/H1eHr6JZ I am wondering, cause it should stop recursion if i give it a map without the key :a
04:26djcoinsveri: as you are outputting
04:26djcoina code that contain a macro, it keeps growing
04:27djcoinand macro expanding I guess - yet, I'm far from being a macro expert
04:27sveridjcoin: if I omit the (println there still is a stackoverflow error
04:29djcoinI think a println call has nothing to do with a stackoverflow error
04:29djcoinMaybe you could paste your error
04:32sveridjcoin: this is the error: clojure.lang.Compiler$CompilerException: java.lang.StackOverflowError, compiling: it occurs at the line with the recursion step
04:33sverithe stackoverflow also happens if you call the macro with no map at all, like a string for instance
04:52augustlsveri: out of curiousity, why the let?
04:52sveriaugustl: I will need the binding later, but left that out in the example because it just complicates things
04:53augustldo you get the stack overflow when the code runs, or when the macro expands?
04:53augustlI assume the former :)
04:54augustlalso, why the ~@, wouldn't (mein (:a ~t)) do the trick?
04:55augustlI seldom write macros so I forget all the terms.. But doesn't ~@ mean "inline this form"?
04:55pyrtsaCorrect.
04:56augustlperhaps that's where you get the overflow, at expansion time, since you try to inline something that isn't around at expansion time.. </wildguess>
04:56sveriaugustl: sry, copy and paste error, its actually ~t jeez
04:56augustlah :)
04:56sverihowever, the error occurs when running the code
04:56augustlwhat is the value of t initially?
04:57sveriit is supposed to be a map, but can be anyhting
04:57sveriI dont want the parameter to be restricted
04:58augustlalso just realized I'm not sure what happens when you recursively call a macro
04:58augustlperhaps that's the problem
04:58augustlthe checks you do are run-time, the macro expands forever? Not sure why that doesn't give you an expansion time stack overflow, though
04:59sverihm, you think you cannot call a macro recursively?
04:59augustlwell, it is called expansion time, not run time
04:59augustlso you can do it, but you need to make sure your recursion check is done expansion time
05:00augustlsounds like a classic case of trying to do too much in a macro? :)
05:00sveri:D
05:01augustlthe fact that you get the overflow run-time makes no sense to me, though
05:01augustlI can guess.. But I don't understand macro expansion, apparently :)
05:02augustlis the inner "mein" expanded expand-time, or when it's called the first time? If so, that explains the run-time stack overflow, at least
05:04sveriok, it also appears during macroexpand-all
05:08sverithis macro: (defmacro rec-macro [x] `(when ~x (rec-macro (first ~x)))) suffers the same problem
05:09sverithe "and" macro should be doing the same
05:14augustlsveri: but the check happens before expansion
05:15augustlsveri: in your case, the check happens inside the quoted form
05:15augustlsveri: in the case of "and", the check happens when the macro is invoked expansion time
05:15sveriaugustl: ok, I think I got a slight feeling what you are telling me (my first time writing a macro ;-))
05:19augustlsveri: stuff that happens inside `(+ 1 2) means + isn't invoked expansion-time
05:19augustlbut if you do (if (= something 1) `(+ 1 2)), that if check before the ` form is actually evaluated expansion-time, not run-time
05:20Kototamahi, any idea how to get rid of this error when using timbre? http://paste2.org/tjDGvDPG
05:20augustlsveri: and vararg macros (which "and" is) are evaluated expansion time
05:21sveriaugustl: ok, thank you
05:21sverithat sounds reasonable :-=
05:21sveri:-)
05:22augustl~reasonable ;)
05:55xsynDoes Clojure have a spec?
05:57clojurenoobhey guys I'm getting a 'No such namespace' error with lein run which I am not getting with lein repl, any ideas ?
06:12clojurenoobhmmm seems I need a specific function level require on the namespace before I call an eval on it
07:03karlsyep
07:04karlswhoops! wrong window.
07:22gfredericksxsyn: no
07:25xsyngfredericks: ta
07:55octei seem to remember a quote in regards to clojure, something like "its better to have a few types which work with all functions instead of many types that work with a few functions"
07:57katratxoocte: chapter 5 of JoC book starts with "It’s better to have 100 functions operate on one data structure than 10 functions on
07:57katratxo10 data structures.
07:57katratxo-- Alan Perlis
07:57octeah
07:57octethats where i got it from
07:57octethanks
07:59katratxohttp://books.google.es/books?id=nZTvSa4KqfQC&amp;pg=PA84#v=onepage&amp;q&amp;f=false
07:59katratxoocte: also found the Clojure Programming
07:59octecan't see that page
07:59katratxonope?
07:59octebut i bought JoC so i have it in pdf form somewhere
08:00octe"You have either reached a page that is unavailable for viewing or reached your viewing limit for this book"
08:00katratxook
08:01agarmanhere's a good page of Alan Perlis quotes http://www.cs.yale.edu/homes/perlis-alan/quotes.html
08:01agarmanquote 9 is what you're looking for
08:38irctchello everyone i am beginner in clojure.I want to be do the unit testing of clojure functions with a new database where i define the new database in a application structure and how,
08:43agarmanclojure has decent test package built in
08:43irctchello everyone i am beginner in clojure.I want to be do the unit testing of clojure functions with a new database where i define the new database in a application structure and how,
08:44beamsohttps://github.com/clojure/java.jdbc
08:45agarmanand an intro to clojure.test http://java.dzone.com/articles/clojuretest-introduction
08:45gtrakirctc: unit test library has little to say on how you expose your database.
08:45gtrakkeep it simple
09:05boodlehi, I'm learning clojurescript and want my ring server to determine if the current 'cljsbuild' build version is :dev or :production.. how do I access the current build version server-side (say using Selmer)
09:07badlambdadoes anyone know of any existing implementations in clojure of this algorithm? http://en.wikipedia.org/wiki/Knuth's_Algorithm_X
09:07clgvbadlambda: not very likely. what is your problem with that one?
09:08badlambdaclgv: I am having some problems coding it up
09:08badlambdawould help to have something to learn from
09:08clgvbadlambda: can you narrow down your problem?
09:09badlambdayeah, inexperience :-|
09:10clgvbadlambda: that's too general to give you good pointers.
09:11badlambdaclgv: sure, but that's the root cause
09:12clgvbadlambda: try to implement it bottom up. first solution encoding. second the operations on the data structure. third one recursion procedure. finally the complete recursion
09:12badlambdathanks, I will give it a go
09:12badlambdabtw, what is the best way to get feedback assuming I produce a solution?
09:13badlambdaI feel like writing elegant, ideomatic clojure is still a problem for me
09:13clgvbadlambda: post a gist on refheap.com and ask here for "live feedback" or on the mailing list
09:14badlambdathanks for the advice clgv
09:14clgvbadlambda: try to make your gist readable and include comments so that people understand what you are trying to do
09:15badlambdagood idea, sometimes I have problems following myself, since my Clojure tends to be a mess of repeated "map":s
09:15badlambdait's the spaghetti code equivalent in functional programming I guess
09:18koalallamacan anybody reproduce this? running lein repl outside of a lein project causes java process to use 100% CPU, and continually grow in memory usage. running lein 2.3.4 on JRE 1.8.0_05
09:18koalallama(on OS X)
09:19clgvkoalallama: it's probably transmitting the contents of your hard drive to the NSA ;)
09:20koalallamaNSA transfer only accounts for 0.1% due to their efficient syncing algorithm though
09:20clgvah damn, well, .... no idea...
09:21beamsokoalallama: not here. do you have a plugin configured that may be causing trouble?
09:27koalallamayes, lein-exec but tried with no profiles.clj and same thing
09:27owl-v-how do i create java class in clojure code? https://www.refheap.com/79100
09:29koalallamaI narrowed it down to when I run lein repl from my home diretory, which has about 100GB+ worth of files
09:29koalallamalein repl from an empty directory is perfectly fine.
09:29beamsoweird
09:30koalallamaI imagine lein is searching through all my files trying to gather project information
09:30beamsoowl-v-: (mymethod (Myclass.))
09:34owl-v-beamso: thanks. ;;(.mymethod (Myclass.))
09:34beamsooops. yes, .mymethod.
09:35pjstadig~source some-when
09:37Bronsa~source when-some
09:37Bronsawell. pjstadig it's when-some anyway
09:42hyPiRion~source when-first
09:44owl-v-o.O
09:45owl-v-java object is not copied. https://www.refheap.com/79106
09:46Bronsaowl-v-: that's the same as in java
09:46tbaldridgeowl-v-: why would it be copied? everything is passed via reference
09:48beamsoi'm trying to think of a language where the object would be copied and i can't.
09:48Bronsabeamso: C++
09:49beamsoreally?
09:49teslanickOnly if you don't put the asterisk in front of everything. :)
09:49Bronsaif you don't explicitely references or pointers, sure
09:49Bronsaexplicitely use*
09:49teslanickstar-this equals star-that deref this. It's as if an entire programming language were written inside a clojure atom. :)
09:50beamsomy c++ must be terrible because i can't think of a case when i wouldn't use references or pointers.
09:50teslanickIt's syntax-compatible with C, where very often you *do* want to pass-by-value.
09:53tbaldridgebeamso: yeah, proper C++ uses copy on argument passing with a bit of & (pass stack value by reference) to improve performance.
09:54beamsookay. i should probably jog my c++ memory one day.
10:05owl-v-does clojure pass reference when calling functions? ex) (function [:1 :2])
10:06owl-v-does clojure pass reference when calling functions? ex) (function 1)
10:07mercwithamouthmy newbie little brain just popped o_O; http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
10:07mercwithamouthseems like a very good tutorial though...i'm going to have to play with this a lot...
10:14teslanickIs there a version of update-in that "upserts" into a map?
10:14teslanick,(update-in {} :foo "HELLO WORLD")
10:14clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Keyword>
10:15teslanicknvm, I think I'm being foolish
10:17`szxteslanick: assoc-in?
10:19teslanickI was getting strange behavior because I didn't realize that update-in wants a vector as its second arguemnt.
10:20teslanick,(update-in {} [:foo] conj :upsert-key)
10:20clojurebot{:foo (:upsert-key)}
10:20teslanick,(update-in {:foo [:existing-key]} [:foo] conj :upsert-key)
10:20clojurebot{:foo [:existing-key :upsert-key]}
10:28stuartsierraowl-v-_: Yes, Clojure always passes function arguments by reference, the same as Java. The only time you get pass-by-value is with primitive numbers, which are rarely used in Clojure.
10:32Bronsastuartsierra: uhm, technically it's always pass by value, only that in case of Objects, the value is a pointer to the object
10:33stuartsierraBronsa: yeah yeah :)
10:35teslanickhttp://i.qkme.me/3oc321.jpg
10:41cbp,
10:41clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:46solussdBronsa: stuartsierra: technically, it’s “pass by sharing”. :D
10:47solussd…with immutuable data though, it’s semantically equivilent to pass by reference
10:47solussd*immutable, even
10:47eggheadhuh?
10:48eggheadisn't it pass by ref anyhow given the jvm and js underneath :p
10:48owl-v-_solussd: is number passed by reference?
10:48eggheadI wouldn't imagine so owl-v-_
10:48solussdfor all intents and purposes… yes.
10:49owl-v-_is list/vector passed by reference?
10:49eggheadbut like.. if you have a java obj and not a clojure datastruct... it matters
10:49eggheadwell a clojure datastruct is just a java obj but you know what I mean ;)
10:49solussdthey’re boxed, so it’s pass by sharing (pass by value, but the value is a pointer)
10:49eggheadif you have a reference to something that exposes a mutable api
10:49solussdright
10:49eggheadthen you'll have to worry about that even in clojure
10:50jcromartiepass by value is pretty unworkable with the amount of data most programs deal with anyway
10:50eggheadhi everyone... i'm currently lamenting standalone jar startup times :(
10:50egghead1: i want to use clojure for command line apps because I love clj so much
10:50egghead2: clojure takes forever to start up
10:51egghead3: i am crying
10:51cbpyou could try clojurescript with node
10:51hyPiRionegghead: As a lein contributor, I've felt the same pain
10:51solussdreal pass by reference with mutable data is madness
10:52owl-v-_but, #clojure is faster to start up :)
10:52eggheadya solussd and yet is the default in langs like java ;)
10:52llasramjcromartie: There's optimizations. R is mostly past-by-value with copy-on-write and elided copying for single-reference values
10:52hyPiRionegghead: Currently, I just try to keep myself busy with other things until a solution pops up.
10:52eggheadlol hyPiRion, ya
10:52hyPiRionBecause it will happen at some point
10:53solussdno, pass by reference with mutable references means I can change the value referred to by the reference passed to the function, not just values inside, say, an object (that’s where the distinction between pass by reference and pass by sharing comes in)
10:53solussdbut, mutability in OO langs is also madness.
10:54eggheadya, clojure doesn't have immutable refs does it?
10:54eggheaddefonce maybe?
10:54owl-v-_atom
10:54technomancyegghead: have you looked at racket?
10:54teslanicksolussd: That would be the equivalent of passing pointers-of-pointers, yes?
10:54jcromartieegghead: different kind of ref
10:54eggheadowl-v-_: that's the other side of the thing, the thing that is referenced is immutable
10:54technomancyit's really good for small, fast-starting programs
10:54jcromartieall Java objects are references
10:54eggheadbut the reference itself can be changed to point to any other thing
10:54jcromartieor treated as such
10:54solussdwell, in clojure a “pointer” to the value is passed, not the var itself
10:55owl-v-_(fun 1) ??
10:55lazybotowl-v-_: Definitely not.
10:55owl-v-_lol lazybot~
10:55egghead,(type 1)
10:55clojurebotjava.lang.Long
10:55egghead^ wrapper type
10:56eggheadso ya, a ref
10:56eggheadhm
10:57eggheadsolussd: what are you getting at btw
10:58eggheadi've wondered if it would be better if clojure def[n]s were final declarations but not sure if it matters
10:58jcromartieit doesn't particularly matter
10:58solussdabsolutely nothing. I just saw Bronsa correct stuartsierra and I figured I might as well be more “technically correct”. :P
10:58eggheadah :p
10:59jcromartiethe JVM deals primarily in objects and those are always essentially references
11:00solussdyup
11:06jcromartiehell is watching other people use a computer
11:06llasramNot a fan of pair programaming?
11:20seangrovehttp://www.w3.org/TR/css3-layout/ ASCII art to define layout grids
11:22technomancywatching people who don't know keyboard shortcuts is the worst
11:23seangrovetechnomancy: Breath. You're going to crush their sense of confidence.
11:23seangroveAhem.
11:23seangroveBreathe*
11:24hyPiRiontechnomancy: I quite enjoy it even more when any non-xmonad person attempt to use my computer.
11:24hyPiRionesp. if they consider themselves techy
11:25gfrederickshyPiRion: my work machine is virtualbox + xmonad + dvorak; completely user-proof
11:25hyPiRionheh
11:26technomancytry an unlabeled dvorak 40% keyboard =)
11:26gfredericks40%?
11:26hyPiRiongfredericks: 0.4
11:26gfrederickshaving the qwerty labeling makes it deceptive
11:26gfrederickshyPiRion: that didn't clear anything up
11:27technomancygfredericks: 40% means no number keys, arrow keys, or function keys
11:27hyPiRiongfredericks: that was my intent
11:27technomancyjust ~40 keys
11:27technomancygiven that 105 keys is "standard" and you can't have fractional keys
11:28gfrederickstechnomancy: a key that works some fraction of the time is like a fractional key
11:28hyPiRiongfredericks: none of my keys work when my computer is off
11:29coventryWow. What do you do for numbers? http://geekhack.org/index.php?topic=47133
11:29Guest34699hi
11:30hyPiRiongfredericks: or perhaps they do. I'm not sure of the definition of "working" is.
11:30coventryOh, they're a chord with the fn key.
11:30gfredericksoh man
11:30gfredericksI kind of want such a keyboard
11:31coventryI'm pretty skeptical about it improving my life.
11:31Guest34699can i use maven in intellij ide?
11:32sqldieryes
11:32sqldierfile>settings>maven
11:37technomancycoventry: fn for numbers means you can put a numpad under your hand even in the home row position
11:38technomancyI actually like it better than having them across the top
11:49pjstadig#1
11:49pjstadigclojurebot: #1
11:49clojurebot1. One man's constant is another man's variable. -- Alan J. Perlis
11:49pjstadighmm
12:04rasmustohow much of paredit.el do people actually use?
12:05owl-v-_clojurebot: #2
12:05clojurebot2. Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process. -- Alan J. Perlis
12:05llasramrasmusto: In what sense? How many of the commands it provides?
12:06rasmustollasram: I guess it's a pretty vague question. Maybe this: /what/ in paredit.el can people not live without?
12:07llasramrasmusto: Mostly the fundamental idea of structural editing :-)
12:07rasmustohah, okay :)
12:07gfredericksthere's probably like 10 basics
12:07gfredericksmoving the cursor around, adding, deleting
12:08rasmustosurround element, slurp, barf, etc.?
12:08gfredericksanything that is a composition of other commands is less fundamental
12:08gfredericksthose are all compositions I think
12:08rasmustoah, alright.
12:08gfredericksI can slurp by cut/paste
12:08gfredericksI don't want to, but I could
12:08seangrovebbloom: When you get a chance, would be nice to hear your thoughts on Famo.us' approach to layout https://famo.us/guides/dev/layout.html. I was a bit confused about their Panel-types initially, but seeing that everything is a composition of transforms makes sense, but it's very, very low-level
12:09bbloomseangrove: transforms != layout
12:10seangrovebbloom: In the famous world, it seems to ;) The grid layouts, etc. are a collection of transforms
12:10seangrove"In this section, we learned that all layout in Famo.us is directed by transforms."
12:11bbloomseangrove: transforms are clearly fundamental to positioning / rendering, but it's totally a lower level construct than layout management
12:11seangroveAnyway, that's just their lowest-level primitive that they build on to achieve actual layouts (grids, etc.), but they expose it as the way to approach layout
12:11bbloomseangrove: ok that makes more sense
12:12bbloommainContext.add(sizeMod).add(originMod).add(rotateMod).add(test);
12:12bbloom*sigh*
12:12bbloomwhen will the rest of the planet earth catch on to this whole immutability thing?
12:13bbloomseangrove: there's not enough info about the grid stuff to say if it's any good
12:14seangrovebbloom: Or even declarative approach. No reason that's that's not {:name mainContext :expanders [{:sizeMod ...}]}
12:14bbloomnearly all layouts are axis aligned, so transforms as simple as offset & scale is totally fine. the full generality of affine matrices is a nice to have
12:15bbloomyou can also have two transforms: one applied before layout and one after layout, but before rendering
12:15coventrytechnomancy: Huh, interesting.
12:18seangrovebbloom: If a child requests more width/height than a parent offers, is a general strategy to clamp the width/height at the offered values, or to allow the child to overgrow the parent's offered boundaries?
12:20bbloomseangrove: depends
12:20bbloomseangrove: CSS defaults overflow visible, right?
12:21seangrovebbloom: Yeah
12:21bbloomseangrove: i think i prefer overflow hidden by default
12:21bbloomseangrove: WPF's overflow: http://msdn.microsoft.com/en-us/library/system.windows.uielement.cliptobounds(v=vs.110).aspx
12:22bbloomnote default: "metadata properties set to true"
12:22bbloomyou can set that to false, then provide arbitrary geometry for a clip region: http://msdn.microsoft.com/en-us/library/system.windows.uielement.clip(v=vs.110).aspx
12:22gfredericksare there any libs of utilities for use with java.jdbc?
12:22gfredericksand if I make one would anybody hate me if I called it java.jdbc++?
12:23bbloomseangrove: actually, i may be reading that wrong
12:23bbloomseangrove: default might be overflow visible
12:23hiredmanjava.kecd
12:23bbloom*shrug*
12:23gfrederickshiredman: :)
12:24gfredericksjava.jdbc++ would mean having "++" in the filename I think?
12:24teslanickbbloom: http://i.imgur.com/Be553NX.png
12:24bbloomteslanick: heh, indeed
12:25llasramgfredericks: I think it would mean having _PLUS__PLUS_ in the filename
12:25hiredmangfredericks: if I recall maven doesn't like + in the artifact name
12:25llasram,(munge "++")
12:25clojurebot"_PLUS__PLUS_"
12:25hiredmanI had a ring-jetty-adapter+ at one point
12:25hiredmanoh, no, it was ring-jetty+-adapter
12:26hiredmanmaybe I am misremembering so other problem with it
12:26seangrovebbloom: Alright, probably have another question re: grid stuff in a bit, but good to go for now.
12:26gfrederickshiredman: fine I'll make the artifact name java.jdbc_PLUS__PLUS
12:26gfredericksjust kidding I will not do that it was a joke.
12:26gfredericksalright I have been dissuaded
12:26bbloomseangrove: if you start selling any of that tooling of yours, i want royalties :-P
12:26seangrovebbloom: I will, however, let you know the good news that the universe has put together a conference perfectly fit for you http://2014.cssconf.com/
12:27bbloomhttp://2014.cssconf.com/style.css
12:28bbloomman, i forgot what CSS looks like. i haven't written anything but sass in a while ;-)
12:28rasmustocssaas
12:39gfredericksin core.async, are timeout channels impossible to GC until they're closed by the timeout mechanism?
12:41hiredmanhttps://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/timers.clj
12:42BobSchackYep they are stored in a skiplist if memory serves me. You could close them manually
12:42BobSchackI think
12:42gfredericksso I probably don't want to create one for every row in my db query result
12:43BobSchackYou can if they are created within about the same time ~ 10ms
12:44BobSchackif you make timeout channels within ~10ms they are actually the same channel
12:44gfredericksthat will not generally be the case
12:44llasramNow that's an interesting optimization
12:44danlamannait seems there are a ton of "ins and outs of clojure" series on the internet. do you guys have a default for recommending?
12:45coventryDoes that mean timeout channels are only accurate to within 10ms?
12:46technomancydanlamanna: aphyr's is pretty good
12:46hyPiRiondanlamanna: Is there anything in particular about Clojure's guts you're in learning?
12:46hyPiRion*interested in learning
12:47danlamannauh, generally just trying to get better at functional programming. i would eventually want to get into multithreading though.
12:47coventry4clojure.org
12:47clojurebotTitim gan éirí ort.
12:47BobSchackcoventry should be look at core async tests for timeout channels
12:50hyPiRiondanlamanna: 4clojure.org is good, and if you're good at math, you could try out project euler
12:51hyPiRionit's not reading/learning, more of a practice place though
12:51coventryProbably better to steer clear of project euler until you're reasonably fluent at functional programming. Trying to solve "how do I express this functionally" at the same time as "how do I do this calculation" tends to slow things down a fair bit.
12:52danlamannayeah, not too worried, i did the first 50 or so problems in python before.
12:52danlamannai think i'm gonna do a combination of aphyr + 4clojure
12:53coventryOh, having the "how do I do this calculation" part solved ahead of the time would work, too. :-)
12:53hyPiRioncoventry: when you pass the 100 mark, it's more about how you should represent the data, more than the calculations themselves
12:54coventryOh, that sounds interesting.
12:54hyPiRion(Of course, you still have to do the calculation, but it's usually trivial to do, even in a new language)
13:01syaohello, I have a question, better explained in image http://www.gliffy.com/go/publish/image/5656201/L.png
13:04syaodata structure, immutability question
13:07eraserhdToday, I work on extracting my new threading macro to a library.
13:09eraserhdI just need a decent name for it. Powerthread? Semantic threading? :/
13:09llasramsyao: It's really not clear (at least to me) what you're asking
13:09llasramsyao: If you express your problem with Clojure's persistent data structures, the result is immutable and persistent
13:11llasrameraserhd: not already covered by 1.6 additions to clojure.core and/or https://github.com/rplevy/swiss-arrows ?
13:11syaollasram, ok, so lets say that the "Data 3" is a list. When I add items to a list, the whole "Virtual Group" should be created.
13:11eraserhdllasram: No.
13:12coventrysyao: You don't add items to a persistent list, you create a brand new list.
13:12coventrysyao: So you make a function which takes D4 and VG1, and returns a new VG1.
13:13llasramsyao, coventry: Or maybe even just use `update-in`
13:13eraserhdllasram: It's a form of -> that threads through if/if-not/if-let/cond/case/etc.
13:13coventryllasram: Maybe, but I assume the edges in the graph represent some subcalculations based on new values for the vertices.
13:14syaocoventry, by saying "add" I mean creating new list with all the old and new values.
13:15coventrysyao: Then the way I suggested should get you what you want.
13:16syaocoventry, wait, in your way the whole immutability I should create my self, it wont be seamless
13:17syaoP.S. why D4 needs to be an argument for the funtion?
13:17coventryIn clojure you leave the seams in. :-)
13:18llasramsyao: A concrete example of exactly what you're trying to do might help
13:20eraserhdAh, clojuredocs.org is on 1.3.0?
13:20llasrameraserhd: Yes. It's a crufty rails app no one wants to work on. There was/is a re-write in Clojure, but seems to have stalled
13:21syaollasram, I can not give you a concrete example as it is global universal (theoretical) problem.
13:22llasramThen I will propose that this is not a problem you need to solve :-)
13:22llasramOr even really a "problem"
13:24eraserhdIt is called 'packthread'.
13:24Glenjaminhi guys, does anyone know of an FRP library that is about data/computation rather than UIs?
13:24eraserhdYay, a name. Now I can code.
13:25GlenjaminI have a fairly large amount of data, and I want to encode relationships and dependencies so that an update propagates throughout the system in a performant way
13:25Glenjaminperhaps this isn't actually called FRP?
13:25coventryGlenjamin: There was one described at the clojure conj last year.
13:26syaollasram, in fact it is, with hierarchical virtual groups I can enforce constraints on data with immutability.
13:27coventryGlenjamin: https://github.com/tgk/propaganda. I think hoplon could also be used this way.
13:28tpopegtrak: first attempt: https://github.com/tpope/cider-nrepl/commit/84ad9fbe946b7245b38b40c1d82da294b8668524
13:28Glenjamincoventry: propagator sounds like what i'm after
13:28Glenjaminthanks
13:28gtraktpope: bbatsov will want a test-case.. though not sure how to generate one.. maybe a with-redefs hack?
13:29Glenjamini'm hoping for performance gains over brute force re-calc, will be interesting to experiment
13:29gtrakotherwise looks good to me
13:29owl-v-_,(prn 04)
13:29clojurebot4\n
13:29tpopegtrak: yeah everything I could come up with was super contrived because (map str (cp/classpath)) is the entire implementation
13:30owl-v-_invalid number 09?
13:30owl-v-_,(println 09)
13:30clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 09>
13:30rasmustoowl-v-_: octal
13:30tpopegtrak: thought I might take the currently unused https://github.com/clojure-emacs/cider-nrepl/blob/master/test/cider/nrepl/middleware/test_transport.clj for a spin
13:30clojurebotCool story bro.
13:30Glenjaminassuming you didn't have this feature, what's the command you wanted to write but couldn't?
13:31gtraktpope: ah, we might need that to test something else, actually. we need a better solution for exceptions.
13:31gtrakwas just thinking about it
13:31dbasch,(prn 632)
13:31clojurebot632\n
13:31dbasch,(prn 0632)
13:32clojurebot410\n
13:32tpopegtrak: also I'm weirded out by the fact that cp/classpath includes system jars and stuff that don't show up in the regular classpath
13:33tpopeI mean it's not a big deal, but feels weird that using a middleware returns a different result
13:33technomancywhat's the regular classpath?
13:33technomancysystem/getproperty?
13:33tpopeyeah
13:33tpopeor $(lein classpath)
13:33tpopeevery other way I've ever retrieved it
13:33Glenjaminis calling classpath an asserting that it contains some colons and ".jar" useful?
13:34technomancyI wouldn't treat the system/getproperty one as canonical
13:34technomancysince it leaves out the bootclasspath
13:34gtraktpope: probably has to do with the recursive classloader traversal.. it doesn't stop until it hits the top
13:34technomancybut you should be able to trust lein classpath
13:34tpopeyeah I know the problems with getproperty
13:34tpopepart of why I want this middleware
13:34technomancy...unless you're playing pomegranate/classloader games
13:35tpopebut lein classpath and cp/classpath differing is weird
13:35tpopethey're both right in their own way
13:36ToxicFrogIs there a convenient/idiomatic way to have multiple output programs in the same lein project? E.g., say I have a program with CLI, GUI, and web interfaces, and I want them in separate jars - is there a good way to do that in lein?
13:36ToxicFrogOr should I just be making it one project per UI + one shared library project?
13:36technomancyToxicFrog: you want separate uberjars or separate libs deployed?
13:36tpopeGlenjamin: I see that as a pretty silly test. plus colons aren't even portable
13:37gtraktpope: lein-specific information might be interesting in itself, but its classpath is just what's used in the java invocation.
13:37gtrakwhereas clojure.java.classpath gives you the reality
13:38tpoperight. I think the reality is preferrable
13:38tpopewhat I'd really like is a way to get the boot classpath statically, I guess
13:38Glenjamintpope: mm, was mainly thinking that faking it or spinning up a controlled JVM isn't worth it, so what's the smallest test that isn't completely useless
13:38Glenjamini guess assert non-empty string is better than nothing
13:39tpopeGlenjamin: I was actually thinking of just checking that it matched the current running classpath
13:39ToxicFrogtechnomancy: separate uberjars. Ideally I want to be able to say 'lein all-uberjars' or something and get foo.jar, foo-gui.jar, and foo-http.jar out.
13:39Glenjamintpope: wouldn't that be your implementation in reverse?
13:39technomancyToxicFrog: an alias to with-profile ... uberjar should do that
13:39tpopeit'd be identical to my implementation afaik
13:40tpope(map str classpath) on both sides
13:40Glenjaminheh
13:40tpopewhich yeah, sigh
13:40hyPiRionToxicFrog: yeah, use something like `:alias {"uberjar" [["with-profile" "+gui" "uberjar"] ...]}`
13:40ToxicFrogtechnomancy: so, I define multiple profiles with different :mains, and then lein with-profile foo uberjar?
13:41technomancyToxicFrog: different :main and different :uberjar-name, yeah
13:41technomancywell
13:42technomancywith-profile profile1,profile2,profile3 uberjar
13:42justin_smithtechnomancy: responding to deep scrollback - here I thought fn for numbers would mean (2 :a) => [:a :a]
13:42ToxicFrogtechnomancy: awesomeness.
13:42ToxicFrogThank you.
13:42justin_smiththat would almost make sense in a math / number theory oriented clj fork
13:43technomancynp
13:48ToxicFrogtechnomancy: bug report: 'lein help' inside a project directory downloads all dependencies before giving you the help text.
13:48Glenjaminthats a feature!
13:48ToxicFrogtechnomancy: question: is there a way I can ask 'lein new' to generate the project.clj for a given template but do nothing else, if, say, I wanted to look at the :deps for it but not actually create such a project?
13:48technomancyToxicFrog: you can't see the docstrings of the plugins if you don't fetch them first
13:49ToxicFrogtechnomancy: no, I mean, all dependencies for the project you're in
13:49ToxicFroge.g. if I'm in a project that depends on ring, 'lein help new' will download ring first
13:49Glenjaminwell, downloading plugins is required for lein help anyway
13:49ToxicFrogOr do you mean...
13:49ToxicFrogOh, I see what happened.
13:49ToxicFrogNo, that makes sense.
13:49ToxicFrogNever mind.
13:50ToxicFrogThe question stands though :P
13:51technomancyToxicFrog: unfortunately templates are imperative, not declarative
13:51technomancyso you pretty much have to run them
13:51ToxicFrogAnd then copy the bits I care about and throw away the rest.
13:51ToxicFrogAlright.
14:06tpopegtrak: with test: https://github.com/tpope/cider-nrepl/commit/59e6a64c2e5327b352dc255dc1a3b650d4a0d35d
14:08justin_smithit would be interesting if someone kept a static archive of the latest version of various lein templates
14:08justin_smithso you could browse what you would get if you created it locally
14:08justin_smithand point to them for reference, etc.
14:21technomancywell ... technically the halting problem.
14:26llasramSince templates can accept arbitrary arguments.... although do many?
14:27technomancynot just arbitrary args; they are fully turing-complete
14:27justin_smithyeah, a template could decide to output completely different files based on time of day...
14:27technomancya template could wipe your home dir and send your private keys to the mafia or whatever
14:27justin_smithlein new jeckyll-hyde...
14:28bbloomtechnomancy: .... correct me if i'm wrong, but aren't templates just kinda automatically downloaded/installed upon use?
14:28justin_smithduring the day it creates an unassuming REST API server, during the night it creates a proxy tunnel for blackhats
14:29technomancybbloom: right; this is the one place where version ranges are arguably defensible
14:29dbaschlein new russianroulette app
14:33koalallamaspeaking of home directories.
14:33amalloy$mail irctc dude, please just ask your questions to #clojure. you won't get any responses if you just ask me via PM when i'm asleep
14:33lazybotMessage saved.
14:33gfredericksI can only have cores+2 futures running at the same time amirite?
14:33llasramThat should be enough for anyone
14:34koalallamatechnomancy: when I run lein repl from my home directory (about 100GB of files), java CPU usage climbs to 100, and memory usage grows constantly
14:34amalloygfredericks: no, futures' pool is unbounded
14:34koalallamatechnomancy: lein 2.3.4 on 1.8.0_05 / os X.. should I just not do this? or is this a bug?
14:34amalloypmap is the function that chooses to spin up only cores+2 futures
14:34gfredericksamalloy: ohhokayIsee
14:35gfredericksgood to know
14:36koalallamatechnomancy: lein repl from an empty directory, or a "normal sized" project doesn't show same behavior
14:36gtraktpope: cool!
14:36gtraki haven't heard any feedback about the op itself, but I don't foresee any pushback
14:37gtrakhere's where I opened it up: https://github.com/clojure-emacs/cider-nrepl/issues/36
14:37technomancykoalallama: is there a src/ dir in your home or something?
14:37tpopegtrak: guess I'll request a pull
14:38amalloytechnomancy: i have src/ in my home, and lein repl starts like a flash
14:38koalallamatechnomancy: there is no ~/src, but there are "src" directories deep inside
14:39eraserhdDoes anyone have an example of using tools.analyzer within a macro?
14:39koalallamacurious if lein repl tries to walk my directories looking for something
14:39coventrySounds like a good application for strace, or whatever the equivalent is on OS X.
14:40eraserhdtbaldridge: IIRC, you were using it for the core.async `go` macro when you gave the tools.analyzer talk, but I don't see that as a dep now.
14:40justin_smithcoventry: or whatever the jvm equivalent is
14:40amalloykoalallama: it should only walk upwards, looking for project.clj. maybe you have some kind of circular symlink? i can't think of a way that's possible on the path from /, but you never know
14:40tbaldridgeeraserhd: it's in a branch called "analyzer"
14:41eraserhdtbaldridge: Oh, hello, there it is. Suhweet!
14:43koalallamaok, 2 minutes later CPU is back to 0.3%
14:44technomancykoalallama: definitely a bug, yeah
14:45justin_smithcoventry: koalallama: the ibm jvm has a trace option (others may also have something, will keep checking it out)
14:45technomancykoalallama: does it happen with `lein run -m clojure.main -e nil` too?
14:45justin_smithalso check out jstack - if you run it enough times you should get a good idea what it is grinding on
14:46koalallamatechnomancy: nope, that runs and ends in about 2 seconds
14:47amalloyyeah, jstack is what i'd try (if i didn't have yourkit already set up)
14:47ghadishaybangfredericks: beware of bounding blocked takes on a channel/timeout to < 1024
14:48coventryjustin_smith: Cool.
14:48ghadishaybans/beware/ensure bounding
14:49technomancykoalallama: how about `lein repl :start` and (in a different terminal) `lein repl :connect`?
14:50gfredericksghadishayban: wat? you mean no more than 1024 consumers trying to read from a single channel?
14:50koalallamahere's a jstack while it's spinning: https://gist.github.com/ctrlrsf/5f21ce7311158b58c1f9
14:51ghadishaybangfredericks: Yes it's intentionally bounding. It's ok to have a channel with whatever size buffer, but not more than 1024 "pending" or blocked takes
14:52koalallamatechnomancy: yup, CPU burns with just lein repl :start, before even :connect is ran
14:52justin_smithhttps://gist.github.com/ctrlrsf/5f21ce7311158b58c1f9#file-jstack-lein-repl-1-L241 this thread is suspicious
14:52ghadishaybangfredericks: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/channels.clj#L168-L171
14:52gfredericksghadishayban: cool; I don't think that's remotely an issue for me
14:53ghadishaybanuse a mult + taps if it is
14:53koalallamanote, the repl is responsive, just notice the CPU usage of the process is high and laptop starts smoking ;)
14:53justin_smithkoalallama: at that point there are a bunch of frames locked on the same shit, and doing something with the fs
14:53gfredericksghadishayban: looks like it would bark loudly if I had a problem?
14:54justin_smithkoalallama: all the frames are locking on the same lazyseq object, and the trace is suspiciously deep
14:54hiredmanreply pulls in clojure-complete
14:54justin_smithcould be a bad recursion
14:54ghadishaybangfredericks: yup. but possibly in some async context somewhere
14:54hiredmanclojure-complete scans files looking for completions
14:55winkcode golf time. can anyone shorten that? :) https://gist.github.com/anonymous/11227866
14:55justin_smithoh yeah, there is a bunch of reply in that stack trace, good call
14:56amalloy(apply + (map read-string) (s/split x #","))
14:56technomancyweird; it should just be scanning the classpath
14:57amalloyer, mis-parenthesized that, but you get the idea
14:57AimHere,((apply + (map read-string) (s/split x #",")) "")
14:57clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:0:0)>
14:57amalloy,(clojure.string/split "" #",")
14:57clojurebot[""]
14:57AimHere,((apply + (map read-string) (string/split x #",")) "")
14:57clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: string, compiling:(NO_SOURCE_PATH:0:0)>
14:57amalloybooo
14:57tpopegtrak: submitted
14:57AimHere,((apply + (map read-string) (clojure.string/split x #",")) "")
14:57clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:57amalloy(apply + (map read-string (filter seq (s/split x #","))))
14:57winkhehe thanks
14:57technomancykoalallama: is it possible something got put on the classpath that shouldn't be there?
14:58eraserhdwink: (apply + (read-string x))
14:58technomancyin any case clojure-complete should have a (take 1024 ...) on its file-seq just to avoid going completely insane
14:58koalallamabtw, find ~/ -type f | wc -l = 271897
14:58AimHere,(#(read-string (str "(+" % ")")) "3,4,5,6")
14:58clojurebot(3 4 5 6)
14:58justin_smith,(#(apply + (map read-string (filter seq (clojure.string/split % #",")))) "")
14:58clojurebot0
14:59gtraktpope: tpope, cool!
14:59eraserhd,(let [x "5,3"] (apply + (read-string (str "0," x))))
14:59clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
15:00eraserhd,(let [x "5,3"] (apply + (read-string (str \[ x \]))))
15:00clojurebot8
15:00justin_smithoh, tricky
15:00koalallamatechnomancy: bingo! here was my CLASSPATH env: ".:/usr/local/lib/antlr-4.1-complete.jar:"
15:00technomancyyouch
15:01eraserhd,(def c #(apply + (read-string (str \[ % \]))))
15:01clojurebot#'sandbox/c
15:01koalallamahow long has that been there?
15:01eraserhd,(c "")
15:01clojurebot0
15:01llasramPulling ANTLR in will do it
15:01eraserhd,(c "5,3")
15:01clojurebot8
15:01winkeraserhd: horrible, but brilliant :)
15:01AimHere,(def c #(eval (read-string (str \( \+ % \)))))
15:01clojurebot#'sandbox/c
15:01AimHere(c "3,4,5,5")
15:01justin_smithllasram: I would have thought . was the problem
15:02AimHere,(c "3,4,5,5")
15:02clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
15:02eraserhdwink: I excel at "horrible". Brilliance is by accident..
15:02llasramjustin_smith: My humor-jokes may need some work
15:02justin_smithheh
15:02koalallamajustin_smith: thanks for the help
15:03justin_smith,(do (def c #(eval (read-string (str \( \+ % \))))) (c "3,4,5,5"))
15:03clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
15:03justin_smithkoalallama: np
15:03winkI think I am forever tainted too much from imperative languages though
15:03koalallamatechnomancy: thanks, sorry for wasting your time. I knew I liked you since I saw your name in my clojure book
15:03winkas I started with let [a (...) b (... a) c(... b)] c)
15:03technomancyheh; no worries
15:03winkand only then rearranged it to short form
15:04technomancykoalallama: I think it'd be reasonable to open an issue with clojure-complete fwiw
15:04koalallamabtw, source of that classpath was: https://github.com/antlr/antlr4 step 3 has this: export CLASSPATH=".:/usr/local/lib/antlr-4.2.1-complete.jar:$CLASSPATH"
15:06justin_smithkoalallama: I think that instead one could just put antlr-complete "4.2.1" in the dev profile in .lein/profiles.clj
15:06justin_smithfor an even more thorough fix
15:07llasramjustin_smith: Well, assuming you are only using leiningen. Well, and populating :dev in profiles.clj is probably bad
15:07koalallamayup, except I don't even need antlr anymore. this has been there from another project almost 1 year ago
15:08eraserhdtbaldridge: The :op :local is specific to the go macro, it's not what analyzer wants, right?
15:08gtraktechnomancy: I yearn for the day when we can remove clojure-complete from leiningen.
15:08justin_smithllasram: if not using lein, then one could use a shell script or whatever your alternative tool uses to manage the path
15:08llasramjustin_smith: totes
15:08tbaldridgeeraserhd: no, in the form (let [x 42] x) the body of the let will be a :local node
15:09tbaldridgeeraserhd: locals can either be arguments or bindings from lets/loops
15:09technomancygtrak: you can omit it if it causes trouble
15:09eraserhdtbaldridge: Oh, OK.
15:09technomancybut I guess you don't always realize it
15:09gtraktechnomancy: I just want everyone else to stop depending on it.
15:10gtrakimplicit deps, bleh.
15:11technomancyat least there are no transitive implicit deps
15:11technomancythat's where I draw the line
15:13koalallamatechnomancy: re: issue with clojure-complete, is there really an issue if I just happened to add a super huge directory to my classpath by mistake? looks like the code that's running eventually completes after 2+ minutes
15:15technomancykoalallama: I think it would be better if clojure-complete only bothered checking the first thousand or so files
15:16koalallamasounds reasonable
15:32gtraktechnomancy: err well, [any elisp completion frontend plus god knows what else] -> lein -> clojure-complete, transitive in some sense.
15:34gtrakcome to think of it, I need an easy way to boot up cider-nrepl middlewares outside of lein
15:38koalallamaI gotta get some rest, I will look into this further and open issue with clojure-complete
15:39koalallamathanks again, all
15:41rasmusto,(some (rest "zzzz"))
15:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/some>
15:41justin_smith,(some rest (rest "zzzz"))
15:41clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
15:42justin_smith,(some #(do %) (rest "zzzz"))
15:42clojurebot\z
15:42rasmustothe whole string -> charseq always felt a bit strange to me
15:42rasmustos/bit/byte
15:42justin_smithI think a string should become chars when treated as a seq, and by extension a char should be treated as bits
15:43jcromartiewat
15:43jcromartieno way
15:43jcromartiethen integers should be too
15:43rasmusto,(seq 1)
15:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
15:43justin_smith /s
15:43justin_smithright :)
15:43jcromartieOK
15:43justin_smithsorry, was a very dry joke
15:43rasmustoturtles all the way down
15:44justin_smithbut it is the same logic - just taken a couple steps too far
15:44llasramAnd also is what Ruby does
15:44justin_smith(dec ruby)
15:44lazybot⇒ -1
15:44llasramSounds about right
15:44jcromartiellasram: how so?
15:44rasmusto(dec seq)
15:44lazybot⇒ -1
15:45hfaafbinc and dec are so stateful :3
15:45hyPiRion$karma rubby
15:45llasramjcromartie: Try `2[0]`, `2[1]` some time
15:45lazybotrubby has karma -1.
15:46jcromartieno...
15:46jcromartiethat's..
15:46jcromartiewell, OK then
15:47jcromartieif I can index it I should be able to get a sequence out of it
15:47jcromartiebut I guess not necessarily… hashes, sets...
15:47justin_smithrubby is ruby's sketchy cousin who isn't allowed near schools or parks
15:47TEttingerwith good reason. rubby on rails was a fiasco
15:48justin_smithlol
15:48gfredericksrubby in ruts
15:49TEttingerjcromartie, you want individual bytes out of the internal representation of objects, when you treat them as seqs, right?
15:50gfredericksI want a timeseries of voltage measurements from the wires
15:51justin_smithhah, try to loop on an array and get the sequence of bits in the pointer...
15:51rasmustowhoa, this right shift key is pretty efficient!
15:52justin_smith,(bit-shift-right 42 1)
15:52clojurebot21
15:52jcromartiehttps://gist.github.com/jcromartie/11229825
15:53llasramPerfect. Ruby takes PRs, right?
15:54gfrederickswhat's Integer in ruby?
15:54gfredericksI thought they had Fixnum and Bignum
15:54jcromartieInteger is the superclass of Fixnum
15:54gfredericksoh righto
15:55devn,(doc add-watch)
15:55clojurebot"([reference key fn]); Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or re...
15:55gfredericksI am rubby rusty; rubsty
16:03mdrogali`Is there a way to pull up a repl from a jar that contains Clojure?
16:03mdrogali`It's a prebuilt uberjar that behaviors differently with production dependencies rather than dev deps.
16:03mdrogali`behaves, rather*
16:04turbofailjava -cp <uberjar-name>.jar clojure.main
16:04michaniskinjava -jar your-file.jar clojure.main
16:04michaniskinoh right
16:04michaniskinnevermind
16:05mdrogali`Thanks guys. I did that, but I wasn't able to require/use any of my namespaces.
16:05turbofailthey must not be in your uberjar then
16:05mdrogali`Oh, hold up! Yeah, this was my mistake.
16:05mdrogali`Thanks guys & gals
16:05justin_smithtry unzipping the jar (it is a zip file) and seeing what is in it
16:06rasmusto.jar.gz
16:06dbaschjar tvf
16:06rasmustotvvvf
16:07justin_smithwell since it is a zip file you can just use whatever tool you would usually use to explore a zip (I open it in emacs for example)
16:09kenrestivomy god, the test coverage on bitcoinj is... impressive
16:09kenrestivocompile takes 2 seconds, tests takes 2 minutes.
16:09justin_smithwell consider that btc is meant to be computationally expensive
16:09justin_smithso I bet the tests spend a lot of time in CPU
16:10kenrestivobtw, https://www.refheap.com/79395
16:10kenrestivothey also fail too :-(
16:11gunsIs anyone aware of any popular Clojure libraries with underscores in the _namespace_ name?
16:11kenrestivowoops wrong chan
16:11justin_smithseems like a bad idea... but no I haven't seen it
16:13dbaschkenrestivo: are you doing something bitcoin-related?
16:14kenrestivodbasch: i was. and might be again. always checking to see how things are progressing
16:14dbaschkenrestivo: I’m working on a cryptocurrency project in clojure
16:15kenrestivodbasch: cool! an altcoin, or something totally different?
16:15dbaschkenrestivo: https://cointipping.com/
16:15rasmustodojecoin
16:15gunsjustin_smith: thanks. You're a pretty good data point
16:16dbaschkenrestivo: but it’s not really about dogecoin, there’s more beyond it
16:16kenrestivodbasch: looks like react, will have to try it on a js enabled browser
16:16dbaschkenrestivo: yes, it’s Om
16:16dbaschkenrestivo: I optimized it for mobile
16:17dbaschwell, “optimized” meaning that it sucks less on mobile
16:17justin_smithguns: aww, shucks
16:18kenrestivodbasch: neat. what are you using for a back end as a bitcoin network client?
16:18dbaschkenrestivo: dogecoind
16:18kenrestivowith REST from clojure, i suppose?
16:19dbaschkenrestivo: yes, https://github.com/aviad/clj-btc
16:19kenrestivowell done, glad to see someone doing that
16:23dbaschkenrestivo: that’s not mine btw
16:23justin_smithoooh - lein search gives a stack trace when you do "lein search _"
16:25justin_smithtechnomancy: lucene barfs on "lein search _" https://www.refheap.com/79444 worth a bug report or just a pointless corner case?
16:26technomancyjustin_smith: how about a patch? =)
16:26justin_smithhah
16:26justin_smithI'll consider it
16:27technomancybug report would be fine
16:27gfredericksjustin_smith: you should whole-heartedly commit to intending to do it
16:27justin_smithis lein search part of the main lein repo?
16:28justin_smithgfredericks: I am setting aside the procrastination time in my calendar as we speak
16:28justin_smithanswering my own question: yes
17:08dbaschtechnomancy: lein search works fine in a random directory, but if I run it inside a project of mine this happens: https://www.refheap.com/79475
17:09technomancydbasch: do you have :repositories set in there?
17:09dbaschyes
17:09technomancyto a server that isn't returning proper response codes for not-found?
17:09dbaschtechnomancy: probably
17:09dbaschif I remove repositories it works fine
17:10technomancystill would be better to get an error message instead of a stack trace
17:10technomancyfeel free to open an issue
17:10dbaschok
17:18eraserhdtbaldridge: Is there something in tools.analyzer to pretty-print an AST (that terminates :). Also, is there a pre-existing function to reconstitute source forms from a modified AST?
17:24tbaldridgeon the latter it something like emit-clj and it's in the analyzer codebase.
17:24tbaldridgeon the first, it pretty-prints if you do a pre/post walk and rip out all the :env values
17:25eraserhdtbaldridge: Cool. Thanks again.
17:29Bronsaeraserhd: if you're using t.a.j/analyze, it already strips the :ns key in :env so there's no problem in prining that
17:30Bronsaeraserhd: also what tbaldridge was talking about is https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/emit_form.clj
17:30tbaldridgeah there we go, it's in the jvm source
17:30danlamannaseems to be nothing out there with regards to comparing binary files in clojure
17:30Bronsatbaldridge: it's in both, the jvm one simply adds support for the jvm specific ops
17:31stompyjkenrestivo: we never REST here in the clojure community!
17:33dbaschdanlamanna: if they are not huge, you can just slurp them and compare them
17:34Frozenlockstompyj: That's why we are FIRST
17:34dbaschdanlamanna: otherwise you’d have to read them lazily
17:34stompyjLOL
17:34stompyji regret nothing!
17:34danlamannadbasch: may or may not be, i think i'm going to follow http://www.jguru.com/faq/view.jsp?EID=66830 as a guideline.
17:40eraserhdBronsa: I didn't think to use t.a.j analyze, I'm just using t.a analyze. Hrmm... should I be?
17:40Bronsaeraserhd: if you want to analyze clojure source, yes
17:40eraserhdI guess supporting clojurescript is a future concern to not worry about now.
18:00dbaschdanlamanna: you can optimize this for performance, but it works https://www.refheap.com/79493
18:00rukorhi please which unit testing framework would you recommend, ive seen clojure.test, midje and speclj and am leaning towards speclj
18:02eggheadgrr, fighting with jsch :(
18:03technomancyrukor: clojure.test would be my recommendation
18:04rukortechnomancy: thanks, are you able to quickly indicate why
18:06technomancyrukor: midje is a lot more complicated and does fancy things that look neat but often cause difficult-to-debug error messages. I don't know much about speclj; it doesn't seem widely used.
18:06rukortechnomancy: thanks, that makes a lot of sense based on what Ive seen so far.
18:06technomancyclojure.test is very obvious how it works
18:08rukoryes
18:10seangrovegiven {:x 10 :y {:z 20}}, how can I destructure x y and z in a single destructuring statement?
18:13gunsseangrove: {x :x y :y {z :z} :y}
18:13Bronsaguns: does that really work?
18:13Frozenlock,(let [a {:x 10 :y {:z 20}}] (let [{x :x y :y {z :z} :y} a] [x y z]))
18:13amalloyBronsa: should, yeah
18:13clojurebot[10 {:z 20} 20]
18:13justin_smithguns - extraneous :y in there
18:13amalloyguns, well, {x :x {z :z :as y}} would be more normal though
18:14Bronsauh.
18:14amalloy{x :x {z :z :as y} :y}
18:14gunsTIL
18:14seangroveAh, interesting, I always use {:keys [...]}, didn't know this syntax before
18:14Frozenlockseangrove: same here
18:14amalloyseangrove: :keys is shorthand for this
18:14justin_smith,(let [{x :x y :y {z :z} :y} {:x 10 :y {:z 20}}] [x y z])
18:14clojurebot[10 {:z 20} 20]
18:14turbofailhm. is requiring the same namespace from multiple threads a Bad Idea™?
18:14seangroveamalloy: Good to know
18:14amalloysee also :syms, :strs
18:15justin_smithI totally would not have intuited that the above would work
18:15gtrakturbofail: this is clojure.
18:15FrozenlockMust have missed it in the official Clojure manual™
18:15hiredmanturbofail: multithreaded code loading is a bad idea
18:15justin_smithgiven the usual map rules etc.
18:15amalloyjustin_smith: actually, making this work is one of the reasons destructuring syntax looks the way it does
18:15justin_smithinteresting
18:15justin_smithahh the two :y instances are rhs, n/m
18:15amalloy{:y y, :y {:z z}} is the alternative syntax, right? but you can't write that because it has a duplicate key
18:16turbofailok guess i'll stick a lock on it then
18:16justin_smithamalloy: oh yeah, makes much more sense now
18:16amalloybut you'll never want to give the same local name to two values, so the actual syntax has no such conflicts
18:16gtrakturbofail: transitive ns's won't get eval'd multiple times, if you're using require. probably best to keep it simple.
18:16seangroveamalloy: Can you then mix that and {:keys ..} ?
18:16amalloynaturally
18:17amalloy{:keys [x y] {:keys [z]} :y} is another way to write it
18:17seangrove(fn [idx {layout :layout {:keys [offer-width offer-height row col row-span col-span]} :layout :as child}])
18:17seangroveI'm not sure if that's a good idea or not. I think probably not.
18:18turbofailgtrak: well the problem is that the same namespace is getting loaded from multiple threads at the same time
18:18justin_smithseangrove: with some well spaced line breaks it is slightly better, but probably simpler to read if broken up a bit into let clauses
18:18gtrakyea, that's a risk until it's fully loaded, seems like
18:18seangrovejustin_smith: Yeah, splitting it up
18:19turbofailit actually works OK right up until i have a macro-defining macro, and then it starts throwing "can't take a value of a macro" things around
18:19oinksofthow do i make a clojure macro refer to itself? i'm having trouble getting a macro to work that should expand itself with default parameters
18:20Bronsaoinksoft: (defmacro x ([] `(x ..)) ..)
18:20justin_smiththe easy way is probably to make a recursive function invoked by the macro
18:20Bronsaoinksoft: you really don't want to do things like (defmacro x ([] (x ..)) ..)
18:21oinksoftBronsa: why is that?
18:22justin_smithextra effort and complexity, with no added functionality
18:22Bronsaoinksoft: because x is not already a macro inside the defmacro body
18:22Bronsajustin_smith: plus it doesn't work :P
18:22justin_smithahh, fair enough :) I would know that if I had seen fit to try I guess :)
18:23amalloyBronsa: eh? x is a macro inside its body. it's just not one you typically want to use
18:23Bronsaamalloy: nope, defmacro expands to (do (defn x ..) (.setMacro #'x true))
18:23oinksoftyes, best practice. ok, so how *do* i do what i said i want to do?
18:23Bronsait's still a function inside the body
18:24justin_smithoinksoft: macros are for special evaluation rules - do that and only that in the macro, and put all actual runtime logic in a function
18:24Bronsaoinksoft: I already told you how in my first reply
18:24oinksoftBronsa: and said it was a bad idea?
18:24amalloythat's really interesting. i knew that, but i hadn't thought about what it meant for referring to x inside its own body
18:24oinksoftthis is what i have now, it doesn't even run. http://www.bpaste.net/show/ykUCiove4b1TQNBDkSvx/
18:25Bronsaoinksoft: no, that was about my second reply. `(x) vs (x)
18:25oinksoftoh, ok
18:25oinksoftwell i guess i was doing the right thing, but this results in a very informative error about not being able to make ISeq from symbol
18:26justin_smith~@ should be ~
18:26clojurebotNo entiendo
18:26Bronsaoinksoft: unless you actually want your macro to be invoked like (deflogger [something] ..), drop the @
18:26justin_smith`(~@(:a :b) :c)
18:26justin_smith,`(~@(:a :b) :c)
18:26clojurebot(:c)
18:27justin_smith,'`(~@(:a :b) :c)
18:27clojurebot(clojure.core/seq (clojure.core/concat (:a :b) (clojure.core/list :c)))
18:27hyPiRionjustin_smith: what are you trying to do? (:a :b) returns nil
18:27justin_smithahh of course :P
18:27justin_smith,`(~@[:a :b] :c)
18:27clojurebot(:a :b :c)
18:27justin_smithgot my quoting mixed up
18:28justin_smith,`(~@:a :b :c) ; this is your error oinksoft
18:28clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
18:28oinksoftBronsa: which one? that's what i always ask clojure too.
18:28Bronsaoinksoft: read above what justin_smith told you
18:28justin_smiththere shouldn't be any ~@ in that code, it should always be ~
18:30oinksoftgot it, thanks
18:31oinksofti don't understand this. i thought ~@ is when you want to include an variable inline, in a list
18:31justin_smith(defmacro deflogger [name & args] `(def ~name (apply new-logger ~args)))
18:31justin_smiththen define new-logger with multiple arities
18:31justin_smithmuch cleaner
18:32oinksofti see, thanks
18:33oinksoftclojure.core/name is defined. shouldn't i not define variables called "name"?
18:33justin_smithit's fine unless the same function needs the name function
18:33justin_smithfair point though, if something is clear and isn't in clojure.core that is likely better
18:34oinksoftok, thanks, just brought it up because i keep wanting to name vars `name' but my editor hihglights it to remind me it's in core
18:34justin_smithI just felt like the name of the macro on the preceding line already tells you about deflogger, so putting that in the name is just noise
18:34oinksofti agree
18:34oinksoftwhy did removing the @ fix the macro?
18:35justin_smithdid you see my demo above of what @ does?
18:35Bronsai wish locals shadowing vars would emit a warning. I've wasted quite some time one day debugging a macro that I wrote that shadowed `name` and then I used it a good amount of numbers above.
18:36oinksofthm clojure core code doesn't seem shy about using `name'
18:36oinksofti was looking for example code, what poeple call variable names :)
18:36oinksoftinteresting Bronsa
18:36TimMcBronsa: I think using a linter would probably be a better choice.
18:36justin_smithI also blatantly call things "count"
18:37TimMccount, name, class, type...
18:37lemonodori liked the CL earmuff thing for globals/specials, which prevented collisions with local vars.
18:37TimMccome at me bro
18:37amalloyi give all my global functions one-letter names, so they don't conflict with my descriptive local-variable names
18:37lemonodorbut it seems that clojure convenion is earmuffs only for vars that you expect users to want to rebind?
18:37hyPiRionTimMc: klass plz.
18:38TimMcclazz
18:38justin_smithcnt is delightfully ambiguous
18:38oinksoftum justin_smith your last example seems to leave out defaulting the first arg to a default value
18:38oinksoftwas that intentional? did i miss something?
18:39hyPiRionjustin_smith: oh my, you just made me realise this. My master thesis uses `cnt` as the size variable.
18:39justin_smithahh, the function can't do that based on arg count?
18:39justin_smithbetter lawyer up before HR gets on your case
18:39justin_smith(or the academic equiv.)
18:40hyPiRionjustin_smith: it's of no worry. If they want to wade through 6k lines of C code with worse #ifdef usage than OpenSSL, they are free to do so.
18:41justin_smithoinksoft: if the fn is already multi-arity I would be inclined to make the fn take one arg or two, and with a collection as the second arg - then take out apply
18:41justin_smithbut I am very eager about taking any complexity out of macros that I possibly can, ymmv
18:42oinksoftjustin_smith: i have no idea what you meant by that
18:42oinksoftjustin_smith: your comments about lawyers/HR/academia
18:42l1xhi
18:42justin_smithoinksoft: cnt as an abbreviation for count is ambigous and to some readers may be seen as offensive / sexist
18:43justin_smithit was a joke, probably too subtle
18:43l1xi have a list (1 2 3 4 5) I need to get pairs from the list like (1 2) (2 3) (3 4) (4 5) what is the best function to do that
18:43oinksoftyea, maybe w/ more time using clojure i'll get it :)
18:44oinksoftthanks again
18:44justin_smith,(partition 2 1 [1 2 3 4 5])
18:44clojurebot((1 2) (2 3) (3 4) (4 5))
18:44hyPiRionoinksoft: It's not Clojure-related: If you accidentally forget the o in count, you know..
18:44justin_smithoinksoft: np
18:44l1xthanks justin
18:45justin_smithnp
18:45hyPiRionI think rhickey seriously decided to name what now is named cond-> to cont->, but when someone in IRC read it out loud and his coworkers laughed, that name was quickly dismissed
18:46hyPiRionyeah, http://clojure-log.n01se.net/date/2012-10-12.html#16:08a
18:46justin_smithit may sound like a Japanese name out loud Kontaro
18:53rasmusto(inc partition)
18:53lazybot⇒ 1
18:55rasmusto(inc ergo->)
18:55lazybot⇒ 1
18:56justin_smithergo->?
18:56rasmustojustin_smith: was one of the names pitched in those irc logs, made me chuckle
18:56justin_smith,(resolve 'ergo->)
18:56clojurebotnil
18:56justin_smithahh
18:57justin_smithassuming->
18:57rasmustohence->
19:40eggheadhuh
19:40eggheadI've got some code that works in a clj repl but not in my main method... what gives
19:41justin_smithdoes it involve a call to for, or map?
19:42amalloyegghead: i'm with justin_smith on this. you're doing something lazy, which gets forced when the repl tries to print the result
19:43eggheaduggu, I wish this problem didn't rear it's head in such a gnarly way
19:43eggheadi'm not using map or anything like that, but I am using futures
19:44joegallohow about you gist your code?
19:45seangrovednolen_: Heh, I was just talking with the Meteor guys about Mori yesterday, they seemed pretty excited about it
19:45dnolen_seangrove: yeah I got a pretty nice email from one of the devs, looks like they got a big performance boost out of it
19:51gfredericksstreaming (jdbc) db query results from an http service takes a surprising amount of extra work
19:52Frozenlockeh.. I'm still in the 'anything' takes a surprising amount of extra work. :-p
19:52pdurbindnolen_: you're the one who was on http://thinkrelevance.com/blog/2014/04/10/david-nolen-cognicast-episode-054 ? great episode
19:52dnolen_pdurbin: yep, thanks
19:53pdurbindnolen_: you prompted me to listen to this: ▶ Pete Hunt: React: Rethinking best practices -- JSConf EU 2013 - YouTube - https://www.youtube.com/watch?v=x7cQ3mrcKaY
19:53hiredmangfredericks: is it really that surprising?
19:53gfrederickshiredman: in as much as I am surprised, yes
19:53hiredmangfredericks: are you paginating?
19:53dnolen_pdurbin: yep that's a pretty awesome talk
19:54gfrederickshiredman: no
19:54eggheadderp
19:54hiredmangfredericks: using ring?
19:54eggheadtry finally, future value, close the connection the future is delivered on
19:54gfrederickshiredman: yep
19:54eggheadWHOOPS
19:54hiredmangfredericks: ah, well, streaming with ring is tricky
19:55gfredericksditto for java.jdbc/postgres
19:55pdurbindnolen_: yeah. I enjoyed it. Next I'm thinking of checking out https://github.com/tastejs/todomvc/tree/gh-pages/architecture-examples/react
20:00dnolen_pdurbin: it's good stuff, #reactjs is great many of the core React devs and many friendly users hang out there
20:17pdurbindnolen_: ah. thanks
20:19bbloomBronsa: are there clj-in-clj ports of the data structures anywhere besides cljs?
20:19bbloomBronsa: and gvec
20:20Bronsabbloom: uhm, not complete that I know of. There's https://github.com/mylesmegyesi/clojure.core/ but I don't think it's even remotely complete
20:21TEttingerclojurec
20:22BronsaTEttinger that's really just cljs
20:23bbloomok thanks guys, i'll just work off cljs
20:23TEttingeryeah, good point
20:23TEttingerhttps://github.com/schani/clojurec for reference
20:23bbloomit's really a shame we don't have a good cross-plat story that we need to repeat this work everywhere
20:24bbloomi'm going to attempt to make eclj work such that the standard if statement works w/ class-plat thanks to partial evaluation
20:24bbloom& abstract interpretation... ie don't barf if a symbol is undefined on a known not to run code path
20:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: abstract in this context
20:24bbloomgoing to take a crack at trying to boot up core under my metacircular interpreter tomorrow :-)
20:25bbloom(after a weekish of no meaningful work done :-P)
20:26TEttingerbbloom: metacircular like maru?
20:26TEttingerthere's a few small lisps I have seen that use metacircular runtimes. Maru and Tort are two of them, Maru does work on windows
20:27bbloomTEttinger: no compiler yet, but that's the goal
20:28TEttingerpretty sure bbloom is one of several people up to the task in here. myself not one of them
20:28Bronsabbloom: good luck w/ loading core. IIRC if you don't get def metadata handling right it might choke when redefining `fn`
20:29Bronsaat least, that's what happened the first time I tried with t.e.j
20:29bbloomthanks guys :-)
20:33gfredericksclojurebot: t.e.j is tools.enterprise.java
20:33oinksoftOK, what does this combination of destructuring do? (defn f [& [a & {:keys [k]}] ...). I know what & and :keys mean in the basic case
20:33clojurebotIn Ordnung
20:34gfredericksoinksoft: a is the first arg, the rest of them are collected into a map, and the :k key is destructured
20:34oinksoftgfredericks: what is the [& [a for?
20:34oinksoftgfredericks: rather than [a
20:34amalloyoinksoft: what gfredericks said, but i'd also add that that kind of & nonsense is pretty tacky imo
20:34gfredericksit allows calling with no args
20:34gfredericks,(defn f [& [a & {:keys [k]}]] [a k])
20:34clojurebot#'sandbox/f
20:34gfredericks,(f)
20:34clojurebot[nil nil]
20:35gfredericks,(f 1 :foo 12 :k 39)
20:35clojurebot[1 39]
20:35gfredericks,(f 42)
20:35clojurebot[42 nil]
20:35oinksoftso people do [& [a & [b & [c]]] to get a function with 0-3 params?
20:35gfredericks[& [a b c]] does the same thing
20:35oinksoftit would seem that form can't accept 1 or 2
20:35gfredericks,(defn g [& [a b c]] [a b c])
20:35clojurebot#'sandbox/g
20:35gfredericks,(g :one-arg)
20:35clojurebot[:one-arg nil nil]
20:35Bronsa,(let [[a b c] [1]] [a b c])
20:36clojurebot[1 nil nil]
20:36oinksoftneat
20:36Bronsa,(let [[a b c] [1 2 3 4]] [a b c])
20:36clojurebot[1 2 3]
20:36gfredericksthat's just how destructuring works, not a specific feature of functions
20:36gfredericksany function that starts with [& ...] can take any number of args
20:37gfredericksI will join amalloy in grumping at you if you write functions like that
20:37amalloyi always write (fn [& [& [& [& [x]]]]] x) to make sure x is really optional
20:37oinksoftback to the original function signature, in which ways could this be called?
20:37gfredericks(inc amalloy)
20:37lazybot⇒ 103
20:37gfredericksoinksoft: I gave a bunch of examples up there ^
20:39oinksoftgfredericks: oh, it's in your first example :)
20:41yedihow would one do this sort of thing in clj (http://stackoverflow.com/questions/286921/efficiently-replace-all-accented-characters-in-a-string)
20:45amalloyyedi: why would you do that? instead, sort the strings according to the right locale
20:45justin_smith,(apply str (replace {\a \z \b \y} "abba")) ; yedi:
20:45clojurebot"zyyz"
20:46yediwell i don't particularly care about the sorting, i just wanna convert strings into their closest ascii equivalent
20:46yedisince the app i'm building only makes sense for english words
20:46justin_smiththere may be a way to do it with string ops only in one pass, which is better than the string / seq / string conversion sequence
20:46amalloyhttp://stackoverflow.com/a/12889868/625403
20:46yedibut sometimes ill get strings like Jesús
20:47amalloyand you're really set on 7-bit ascii? i have to say, allowing people to use whatever characters they want seems like a much nicer solution
20:47yedithe app i'm using literally requires english words, since it's based on an english rhyming dictionary
20:48seangrovebbloom: Part of the gripe of absolute vs fixed vs relative in css yesterday http://stackoverflow.com/questions/6794000/fixed-position-but-relative-to-container
20:49amalloyhow sure are you there are no "funny characters" in english text? eg, coop is pronounced as one syllable, like a chicken coop; coöp is two syllables, like coöperative
20:50amalloyplus english has incorpororated words like voilà
20:50yediamalloy: you're definitely right, but it doesn't seem that this takes that into account: https://raw.githubusercontent.com/yedi/rhyme-finder/master/resources/cmudict.txt
20:51yedii couldn't find a separate coöp
20:51yedibut that doesn't mean i shouldn't allow ppl to add their own pronunctiations to the dictionary that are missing
20:51amalloyso you have an input word that you want to look up in someone else's rudely-ascii rhyming dictionary
20:52yediyea essentially (Carnegie Melon's Rhyming Dictionary, i think it's the most comprehensive one for the english language)
20:52amalloyi think the only realistic thing you can do is what justin_smith suggested: a manually-defined list of character substitutions you want to do
20:52amalloyunicode is wide and weird, and an automated solution will do really surprising things
20:53yedii think i agree with you though, i can always add new entries to that dictionary so it should support other characters. So i'll find an alternate way to fix that issue
20:54justin_smith,{\☃ "snowman"}
20:54clojurebot{\☃ "snowman"}
20:54amalloylike there are stupid characters such as http://www.fileformat.info/info/unicode/char/2075/index.htm: SUPERSCRIPT FIVE
20:54amalloyand java will tell you that's a digit whose value is 5
20:54justin_smiththat is useful⁵
20:55dbaschone of the most abused features of unicode on twitter and facebook: uʍop-ǝpısdn
20:55oinksofti am positively tickled that core has a function named lazy-cat.
20:56justin_smithsadly, stupid-hyper-dog was vetoed
20:58justin_smithstupid-hyper-dog was of course a pointless function that chased its own tailcall
20:58yediamalloy justin_smith: it would be cool if there was a list of all those kinds of odd characters that are used in english words
20:58yedithen i could add them to my letter parsing regex
20:59justin_smithyedi: do you use emacs?
20:59amalloyi prefer to think of english as an infinite fractal of constantly fluctuating word-theft
20:59amalloyanytime you think you can apply logic to english, you start down the wrong path
21:00justin_smithyedi: if so M-x insert-char <tab><tab> then go to the prompt buffer and save it and... - actually there is probably a better way to that
21:00justin_smith*to do that
21:01gfrederickshey where was that regex that matched english words
21:01yedi(dced, did i miss something?)
21:02justin_smithgfredericks: it had false positives
21:02gfredericksjustin_smith: :P I think it was just generated from a word list, so your claim is *LITERALLY IMPOSSIBLE*
21:03justin_smithfalse positive as in it matched words not in the list
21:03justin_smithor was it really that specific?
21:03yedifunnily enough i came across this earlier today: https://github.com/noprompt/frak
21:03amalloygfredericks: in the "not at all news" category, i heard on npr yesterday that someone had written a chrome extension to replace all occurrences of "literally" with "figuratively"
21:04justin_smithnot as good as the classic cloud-to-butt extension
21:04amalloyi have had that installed for a few months
21:04dbasch(def lazy-cat (repeat "😺"))
21:04amalloythe occasional giggles are totally worth the confusion
21:05dbasch,(take 10 (repeat "😺”))
21:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
21:05justin_smithamalloy: slightly less rofl, but still interesting, an old friend made a chrome extension that removes all numbers from the facebook UI
21:05dbasch,(take 10 (repeat "😺"))
21:05clojurebot("😺" "😺" "😺" "😺" "😺" ...)
21:05amalloyi don't use facebook, so the utility of this is not as obvious to me as it must have been to your friend
21:06Platz1.5M regex, yep
21:06gfrederickssomebody should make a generic chrome extension for word substitutions
21:06gfrederickswould be great for pranks
21:06justin_smithfacebook uses metrics to "gamify" the experience, so replacing numbers helps subvert that aspect
21:06gfredericksswap the names of the two major candidates during major election cycles, etc
21:09seangrovebbloom: Alright, grid, align, vertical/horizontal stack all ported over, and the debugger is laying itself out now http://dl.dropbox.com/u/412963/Screenshots/dx.png
21:10yediwoah what is that seangrove
21:10amalloyi don't understand that at all either, but it looks pretty cool
21:10justin_smithgfredericks: is this the one? https://gist.githubusercontent.com/noprompt/6106573/raw/fcb683834bb2e171618ca91bf0b234014b5b957d/word-re.clj
21:11gfredericksjustin_smith: prollably
21:11seangroveyedi: It's our time-traveling debugger + layout manager + event simulator + state inspector
21:11yediwell them
21:11yedithen*
21:11justin_smithgfredericks: so far, slurping that file into clojure and making it an re, it matches cat but not cats
21:11seangroveyedi: To show an example https://dl.dropboxusercontent.com/u/412963/zensight/time_travel.mp4 /ht dnolen_
21:11justin_smithchecking for false positives
21:12amalloycats might not be a word
21:12justin_smithhaha, it matches cond
21:12yediseangrove: that is going to be killlllller
21:12justin_smithmaybe because it was written using clojure :)
21:12seangroveyedi: That video was pre-layout manager. Just finished up porting a proper recursively-pluggable layout manager system
21:13justin_smithmatches consolidate but not consolidating
21:13justin_smithseems it doesn't attempt to cover conjugations, makes sense
21:13gfredericksjustin_smith: that's false negatives no?
21:13seangroveThat was the last *big* piece before things could be really cleaned up. Pretty excited to clean up and start optimizing for speed, I think we can edge out the default Om strategy if React opens up the right hooks, plus building reusable components this way is just a thing of beauty
21:13justin_smithgfredericks: yeah
21:14amalloymakes sense??????? it should just cover whatever's in /usr/dict/words, which should include most conjugations
21:14seangroveSerializable state and time-traveling is just icing on the cake :)
21:14justin_smithgfredericks: first false positive: catting
21:14gfredericksjustin_smith: http://en.wiktionary.org/wiki/catting#English
21:15gfredericksthis regex speaks english better than you do :P
21:15justin_smithI guess so
21:15justin_smithcond is still an issue though
21:16gfredericksamalloy: somehow my computers never have /usr/dict/words
21:16justin_smithunless it also includes abbrevs
21:16amalloygfredericks: i forgot where it's stored. it's actually in /usr/share/dict/words for me
21:16gfredericksah there it is
21:16gfredericksI copied mine into a git repo a while ago
21:17amalloyhttp://www.merriam-webster.com/dictionary/cond
21:17gfrederickswould be fun to get a corpus from different languages and search for the smallest regex that matches one language but not the other >95% of the time
21:17justin_smithit is inconsistent with conjugations - either having catting or lacking dogging is an error
21:18justin_smithamalloy: I explicitly mentioned abbrevs
21:18justin_smithit is an abbrev
21:18yediseangrove: oh man, i can't wait till i can play with it
21:18gfredericksclojurebot: either having catting or lacking dogging is an error
21:18clojurebotRoger.
21:19justin_smithI am glad I finally thought to try this re out
21:19justin_smitherr rather, was inspired
21:19seangroveyedi: To be honest, bbloom has done ~90% of the work on the layout stuff, I just want it more than him right this moment
21:19dbaschit doesn’t match antidisestablishmentarianism
21:19amalloythat's just antidisestablishmentarianism refusing to match
21:19justin_smithalso does not match caked
21:20dbaschdisestablishmentarianism doesn’t match either, they can’t both agree
21:20bbloomseangrove: were you able to basically copy paste my code in to om land and get it to work?
21:21bbloomseangrove: or was there some mismatch you had to patch up?
21:21dbaschjustin_smith: but it matches caker (?)
21:21justin_smithone of my favorite things is the unit test in gnu grep that tests an re that matches like 20 different spellings of muammar gaddafi's name
21:22dbaschcaker is not a word
21:22seangrovebbloom: No major mismatches, just a few things to get it tied into our tree structure. Other than that, just grokking all the (admittedly simple) concepts was the major difficulty
21:22justin_smith(all of which used by some english language newspaper at some point)
21:22bbloomseangrove: took me months to make sense of it in my head :-)
21:23justin_smithdbasch: perhaps debatable https://www.google.com/search?q=regex+maumar+khadaffi&amp;oq=regex+maumar+khadaffi&amp;aqs=chrome..69i57.5680j0j4&amp;sourceid=chrome&amp;es_sm=93&amp;ie=UTF-8#q=define:caker&amp;safe=off
21:23seangrovebbloom: It's not too horrendous, even though I'm still shakey. And I'm sure that *using* it is much simpler than implementing it all, especially with the right tools for immediate feedback
21:23bbloomseangrove: pretty cool that it just mapped over considering i had written that back when i had only hypothesized the design of react.js!
21:23amalloyhuh. your previous search for define:caker snuck into that url, justin_smith
21:23dbaschgoogle will define anything
21:23justin_smithamalloy: no, that is what I meant to share
21:24amalloyor for khadaffi, whatever
21:24dbaschincluding proper names
21:24justin_smithoh, ok, weird
21:24seangrovebbloom: Impressive stuff ;)
21:24justin_smithhah
21:24bbloomseangrove: the trickest part of using it is when things don't have a "natural" size, so they wind up being (0,0) or (inf,inf)
21:25bbloomseangrove: but i think that the blend ppl ultimately addressed that with "design size" width/height properties on the standard controls
21:25seangrovebbloom: Virtualized scroll panels will be tricky, I expect. Some of the stuff winjs is doing is pretty fantastic in that regard
21:26bbloomseangrove: early versions of blend would default to align x/y both stretch
21:26Frozenlockseangrove: May I ask what you are talking about? It looks interesting
21:27seangroveFrozenlock: Layout managers for building apps in the browser (or anywhere, really)
21:27justin_smithmy webapp library is not letting me return a synthesized document as application/rss+xml - it would be easier to take if I did not know I have commit access to whatever repo this bug is in
21:27bbloomseangrove: later versions defaulted to some fixed initial "design size" and then would force the margins to make that design size work... much nicer user experience b/c you'd get a fixed size thing and add layout behavior to it by other UI means, much better
21:27Frozenlockseangrove: Yes, but one bbloom did?
21:27bbloomFrozenlock: i shared it w/ him privately
21:28Frozenlockah
21:28bbloomFrozenlock: it's part of a totally half baked UI framework i started on before react.js came out
21:29seangrovebbloom: I'll have to check out blend (or the old version at least). The grid layout was the last major piece before cleaning things up and pulling off some low-hanging optimizations, adding some linting tools, etc. After that, Going to be very interested in what Blend does :)
21:29bbloomseangrove: don't look at the old versions, they got lots of UX badly wrong
21:30bbloomnew versions have design issues, but they are like photoshop-level "this shit is too complicated" rather than "this shit is just plain stupid"
21:30seangrovebbloom: Didn't the new version get integrated into VS?
21:31bbloomseangrove: oh yeah, i'm just saying don't look at version < 3 for any msft product ever :-P
21:31bbloomi think i have blend 3 on my windows vm
21:31bbloomdunno what the new VS version is like
21:32yedihah amalloy
21:32arrdemooh. nice catch!
21:36arrdemBronsa: compared to LLVM t.a.jvm is a pleasure to read. thank you.
21:37bbloomarrdem: he's gone, but yes, yes it is a pleasure compared to basically anything else
21:40kras,(reduce (partial merge-with vector) {} (#(for [x %2] {(% x) x}) #(> % 5) [1 3 6 8]))
21:40clojurebot{true [6 8], false [1 3]}
21:41kras,(reduce (partial merge-with vector) {} (#(for [x %2] {(% x) x}) #(apply / %) [[1 2] [2 4] [4 6] [3 6]]))
21:41clojurebot{2/3 [4 6], 1/2 [[[1 2] [2 4]] [3 6]]}
21:41amalloyoh man. vector is not a good choice
21:41krastrying to solve a 4clojure problem
21:41amalloyyeah, for that reason
21:41TEttingert.a.jvm ?
21:41bbloomTEttinger: clojure.tools.analyzer.jvm
21:41TEttingerah thanks
21:41arrdemTEttinger: https://github.com/clojure/tools.analyzer.jvm/
21:42krasamalloy: vector anyways seems not right
21:42amalloykras: you want to convert everything to singleton vectors first, and then combine them in your merge-with. then you won't be changing the data type once per merge
21:42krasit breaks for the second case
21:42amalloyor anyway that's one reasonable and common solution
21:43bbloomarrdem: amusing to me is how much more code there is in jvm than in the main analyzer
21:43bbloomarrdem: most of the complexity in clojure comes from the JVM
21:43bbloomperhaps unsurprising, but amusing all the same
21:43arrdembbloom: shrug. If we didn't need hardware software would be easy.
21:43arrdembbloom: I happen to like that complexity, but that's my own crazy =D
21:44bbloomarrdem: hardware does not need to be as complex as it is either :-P
21:45arrdembbloom: I'll be entertained to see how complex the final JS analyzer is in comparison. My $2 says they'll be close.
21:45arrdembbloom: hey man... I like my prefetched hardware with multiple caches and out of order processors
21:46bbloomarrdem: assuming he still relies on Google Closure, i expect it to be dramatically simpler b/c we can rely on google for source level optimizations during code gen
21:46arrdembbloom: fair point.
21:47bbloommuch simpler "type system" too
21:47TEttingerif we didn't have hardware who'd make keyboard pants https://www.flickr.com/photos/technomancy/4397554484/in/photolist-7GABJU-kivjUp-kix7eb-kiuGX6-kiuDbi-kiuC5k-kga9Xn-aiZCQ
21:47arrdem(inc TEttinger)
21:47lazybot⇒ 16
21:47TEttingerI'm still amazed that people can make their own keyboards
21:47jcromartienothing like tracking time to the 1/10 hours in three different places
21:48arrdembbloom: type system. javascript. right.
21:48jcromartieand having to enter "reason codes" to adjust time on the same day
21:48jcromartieEXPLAIN YOURSELF, DRONE
21:48bbloomarrdem: it's got one, but it deserves "quotes"
21:48jcromartieI'm just bitching
21:48arrdemjcromartie: #clojure-social is that way sir
21:49arrdemjcromartie: it's almost as on topic as #emacs!
21:57oinksoftis there sometihng like erlnag's ETS in clojure?
21:59arrdem,(true 1)
21:59clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
21:59arrdem,(true false)
21:59clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
22:00arrdem,(doc true)
22:00clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol>
22:05krasamalloy: thanks for the clue
22:05kras,(reduce (partial merge-with concat) {} (#(for [x %2] {(% x) [x]}) #(apply / %) [[1 2] [2 4] [4 6] [3 6]]))
22:05clojurebot{2/3 [[4 6]], 1/2 ([1 2] [2 4] [3 6])}
22:06yedianything i should worry about / look out for when converting some of my maps to pmaps?
22:07arrdemyedi: benchmark everything and make sure it's actually a win
22:22Frozenlockyedi: There's a single case where I used pmap with a major win; when the function called was retrieving data from different endpoints over the network.
22:23danneuFrozenlock: did you use futures or something to hit the endpoints in parallel with pmap?
22:23seangroveFrozenlock: Wouldn't futures work better?
22:23Frozenlockdanneu: no
22:24Frozenlockseangrove: perhaps
22:25seangroveFrozenlock: No worries, if pmap works for you :)
22:25dbaschseangrove: pmap is implemented with futures
22:25danneusometimes i yearn for a 'pmap for io' like (pooled-map send-request! all-urls {:threads 4})
22:26seangrovedbasch: But it's limited to cpu-cores + 2 or something, I believe
22:26seangroveIf you're not CPU-bound, might be better off managing your pool
22:26FrozenlockStop complicating my code! :-p
22:30dbaschdanneu, seangrove: that would be pretty easy to implement
22:31dbaschall you have to do is take the pmap code and remove the restriction
22:42amalloydbasch: don't forget to fix the OS scheduler so that spinning up a million threads isn't expensive
22:47amalloyalso, an unbounded version of pmap can potentially hold the head of the entire sequence at once, which currently pmap doesn't do
22:50amalloythe point is that attempts to superficially fix pmap don't lead to a pmap that's more useful than the existing one, just to versions of pmap that are useless in novel ways
22:54oinksoftwhat is the idiom for some default reference? i see in korma the use of a @_default, which is being driven by the transaction macro. are macros the way to make this api? or bindings, or something else?
22:54oinksofthttps://github.com/korma/Korma/blob/master/src/korma/db.clj#L7
22:57dbaschamalloy: my point is that you could create a pmap that is optimized for I/O instead of cpu. Sure, it wouldn’t be trivial.
23:01oinksofti could see this being done w/ binding, and precondition to ensure *default-whatever* is not nil? i dunno
23:02akhudekoinksoft: are you asking about general api advice? If so I would use java.jdbc as a reference rather than korma
23:03oinksoftakhudek: no, i want my api to look like (defwhatever bizbaz ...), which sets some global value to bizbaz for convenience
23:04oinksoftakhudek: korma does this using macros but i think maybe korma is overusing macros? but this seems like it is a common thing in clojure code, i see other code with global atom refs shared by some functions
23:04oinksoftakhudek: i figured people who write APIs using this would know very quickly what the cleanest solution is
23:05akhudekoinksoft: where bizbaz is a var? yeah, you should use a macro to do that. But it is probably worth making a normal function too and then have the macro use that.
23:05oinksoftakhudek: yea, absolutely
23:06oinksoftakhudek: hm ok, actually there is another level to korma because it is storing the connection in jdbc too
23:06akhudekoinksoft: regarding binding, it’s often preferable to just pass values around rather than rely on thread local bindings
23:07akhudekoinksoft: I haven’t looked at it in a while, but korma stored a fair number of global defaults in vars, such as the db connection map, and that pattern can often be annoying.
23:08akhudekoinksoft: in contrast, jdbc requres a db map in every function, which seems more complicated but can often be much simpler e.g. if you have multiple dbs, or your are passing things around to different threads
23:10danneuseangrove: maybe this would work as a fix-pool map - https://www.refheap.com/79544
23:11danneuwell it should be a lazy seq i guess
23:11danneuno it shouldnt
23:21danlamannaif anyone is interested, and wants to judge my first real attempt at functional programming (and clojure) - feel free https://gist.github.com/danlamanna/11240257
23:31amalloydanlamanna: i'd write #(<= 0 % 2), since that's apparently what you want to validate
23:31amalloythe -1 and 3 are confusing
23:32danlamannaamalloy: yeah, they are, i knew that when i wrote it. not sure why i left it
23:32amalloydanlamanna: (let [x foo] (if (not x) nil y)) is (when-let [x foo] y)
23:33amalloy(> (count x) 0) is (seq x)
23:33amalloyalso it's super-weird that you're putting whitespace on the inside of [] bindings
23:33gunsdanlamanna: And you are also using def for local bindings within functions
23:33amalloy(let [x foo]), not (let [ x foo ])
23:33gunsbut +1 for using tools.cli correctly!
23:34danlamannaguns: mostly copy/paste from the example :P
23:34danlamannaamalloy: are you referring to regex-filter for when-let?
23:34amalloyi was looking at size-str-to-bytes, but it's a general point
23:34danlamannaamalloy: still trying to figure out the coding standards. still trying to process that the if and else sexps are indented at the same level.
23:35amalloyyeah, i think guns is right that the most important issue here is using def for locals
23:35amalloyi'm just pointing out minor stylistic issues, whereas his point is about functional programming, which you asked specifically about
23:35danlamannaamalloy guns - yeah i was unsure, not used to let blocks being immutable
23:38gunsdanlamanna: oh, the :default value in tools.cli is always nil, so you don't need to specify those
23:38gunsWRT let blocks, you can bind values sequentially, if that helps
23:39danlamannaguns: for example, in -main - i have to keep a running list of mentioned-files, how would you suggest i keep track of that variable?
23:40amalloyreduce, or loop
23:40gunsdanlamanna: you don't seem to be using that outside of its lexical scope; use a set #{} and conj/disj
23:40gunsor set/union or (into #{} …)