#clojure logs

2014-07-30

00:00Balvedano clojurebot?
00:01Balvedathis if tells me that it has too few arguments
00:01jeremyheilerneed a comman before the sexp
00:01jeremyheiler,(inc 1)
00:01clojurebot2
00:01jeremyheilerBalveda: count your parens ;-)
00:02jeremyheilerBalveda: balance them correctly, rather.
00:03Balvedathanks
00:04jeremyheilernp
00:05Balvedaoh
00:05Balvedanm
00:06Balveda'cause the main issue is I was having some issues with this func
00:06Balveda(if (< 3 (count data)) ((doall (take 3 data)) ((doall (drop 3 data))))) where data is a vector of vectors
00:07Balvedai'm putting the doalls (not to well admittedly) because it's giving me that a LazySeq can't be casted to IFn
00:07amalloythat is way too many parens, Balveda
00:07jeremyheileryeah
00:08Balvedaagreed
00:08gwsit's not like other languages where they're just used for grouping - you're actually changing the semantics of your program by adding parens
00:10BalvedaHow should I deal with the LazySeq issue?
00:10jeremyheilerBalveda: the problem is different than you thinking
00:11jeremyheilerLazySeq cannot be cast to an IFn because you're trying to invoke the lazy sequenece as a function because you have too many parens.
00:11BalvedaMind you that these doalls are me trying to fix thsi
00:11Balvedathis*
00:12jeremyheilerwhy did you do that?
00:12BalvedaAs I understand it, the doall evaluates the stuff I'd be passing, so it's not a LazySeq
00:13jeremyheilerso, what is it after you doall it?
00:13jeremyheiler,(type (doall (map inc [1 2 3])))
00:13clojurebotclojure.lang.LazySeq
00:14Balvedahm.
00:14BalvedaWhat would be a good way to deal with this issue?
00:14jeremyheilerlets back track and look at the original error
00:15TEttinger,(def data [1 2 3 4 5])
00:15clojurebot#'sandbox/data
00:15TEttinger,(if (< 3 (count data)) (doall (take 3 data)) (doall (drop 3 data)))
00:15clojurebot(1 2 3)
00:15TEttinger,(if (> 3 (count data)) (doall (take 3 data)) (doall (drop 3 data)))
00:15jeremyheilerwhen you see "LazySeq can't be casted to IFn", it's saying that whatever you're trying to use (LazySeq in this case) is being used as a function.
00:15clojurebot(4 5)
00:16jeremyheilerand... that it's wrong to do so
00:16TEttingerI suspect you may have meant > instead of <
00:16BalvedaTrue
00:16jeremyheilerwhy do you think it's trying to call a lazyseq as a function?
00:16Balveda,(doc take)
00:16clojurebot"([n coll]); Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n."
00:16Balveda,(doc drop)
00:16clojurebot"([n coll]); Returns a lazy sequence of all but the first n items in coll."
00:17TEttingerno, that's not it at all
00:17jeremyheileryes, those fns returns lazy seqs
00:17jeremyheilerlook at your code. why is it trying to invoke those lazy seqs as functions?
00:17TEttinger,(+ 1 2 3)
00:17clojurebot6
00:17TEttinger,((+ 1 2 3))
00:17clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
00:18BalvedaI'm not too sure.. if you're saying it's a parens issue I imagine I mucked it up somewhere but I can't quite see it
00:18jeremyheilerlook at TEttinger's example carefully.
00:18jeremyheilerwhat's different between teh two expressions?
00:19Balvedaah
00:20Balvedagod it
00:20Balvedagot it*
00:20Balvedathanks!
00:20jeremyheiler:-)
00:20Balveda,(inc jeremyheiler)
00:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: jeremyheiler in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:20Balvedaheh
00:20jeremyheileri don't actually exist
00:20BalvedaSpooky
00:21jeremyheiler(inc Balveda)
00:21lazybot⇒ 1
00:21TEttinger(inv jeremyheiler)
00:21TEttinger(inc jeremyheiler)
00:21lazybot⇒ 1
00:22TEttingerthe (inc) thing isn't actually evaluating code, I think it actually allows spaces in names
00:22TEttinger(inc #())
00:22lazybot⇒ 1
00:22Balvedaoh, the , is for evaluatinc code?
00:22TEttinger(dec #())
00:22lazybot⇒ 0
00:22Balvedajeez i'm typing bad
00:22TEttingeryep
00:22jeremyheilerthe inc thing is just a custom lazybot plugin
00:22BalvedaI just hooked up this usb keyboard to my laptop and I'm readapting
00:22Balveda(inc jeremyheiler)
00:22lazybot⇒ 2
00:23Balvedaall these parens and brackets were killing my right hand, heh
00:23TEttingerand #() is not a valid clojure identifier, which is why I picked it to check if the thing was doing any code stuff
00:23kelseygiCookedGryphon i'm totally creeping on the logs right now but did you ever get your emojis encoded right?
00:23TEttingerare the logs up again?
00:23BalvedaIs the take/drop method proper, though?
00:23TEttingerwhat are you trying to do though?
00:23BalvedaIt seems a little brute force imo knowing that things like reduce exist, but I'm not too acquainted yet
00:24kelseygii was looking at this http://clojure-log.n01se.net/date/2014-03-07.html
00:24TEttingerwoah, march
00:24BalvedaAs a whole, I'm taking an excel and making pdf tables so as to make cards, right? I have a 3x3 grid per page, so I need to split the data I'm recieving
00:24kelseygiyeah i'm tryna do exactly what they were doing there
00:24TEttinger(doc partition-all)
00:24clojurebot"([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."
00:25TEttinger(doc partition)
00:25clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
00:25TEttinger##(partition-all (range 50)) ; the ## is to eval with lazybot, which prints full sequences
00:25lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$partition-all
00:25TEttinger##(partition-all 3 (range 50)) ; the ## is to eval with lazybot, which prints full sequences
00:25lazybot⇒ ((0 1 2) (3 4 5) (6 7 8) (9 10 11) (12 13 14) (15 16 17) (18 19 20) (21 22 23) (24 25 26) (27 28 29) (30 31 32) (33 34 35) (36 37 38) (39 40 41) (42 43 44) (45 46 47) (48 49))
00:26TEttingerBalveda, does that look like the kind of output that you want?
00:26BalvedaYes, it's perfect
00:27BalvedaOr, hang on;
00:27TEttingerha, I'm notostraca, kelseygi
00:27BalvedaI suppose I could have the whole set of data partitioned into threes and iterate over it with the row generator
00:27TEttingerindeed
00:28BalvedaRather than feed a list into the function and have it exhaust the initial coll
00:28BalvedaList, vector, same thing
00:28kelseygiheh TEttinger, i was secretly hoping someone had been inspired to create an emoji-handling library in the time since that convo happened
00:28TEttingerpartition guarantees items of 3, partition-all will give items of 1, 2 or 3 as the last thing just to use up the whole collection
00:29BalvedaPartition would return nils though for the empty items in the list?
00:29TEttinger##(print (partition-all 3 (range 8))" " (partition-all 3 (range 8)))
00:29lazybot⇒ ((0 1 2) (3 4 5) (6 7)) ((0 1 2) (3 4 5) (6 7))nil
00:29TEttingererr
00:29TEttinger##(print (partition3 (range 8))" " (partition-all 3 (range 8)))
00:29lazybotjava.lang.RuntimeException: Unable to resolve symbol: partition3 in this context
00:29TEttinger##(print (partition 3 (range 8))" " (partition-all 3 (range 8)))
00:29lazybot⇒ ((0 1 2) (3 4 5)) ((0 1 2) (3 4 5) (6 7))nil
00:29TEttingerI'm not typing well either
00:29BalvedaWhat's your timezone?
00:30TEttingerpacific standard, GMT - 8 or so
00:30BalvedaAh, alright; I'm GMT -3, so it's getting late
00:30Balvedanot like I have a schedule anyways
00:30TEttingerpartition will just not use elements if they wouldn't fill up 3, partition-all will use them up and make less-than-3-many colls
00:31TEttingerwhich you want depends a lot on whether you're expecting exactly 3 (or any number) or 3 or less
00:31BalvedaIt's the same thing either way, I'd still be making empty cards
00:31BalvedaIt's not a guarantee I'll have a multiple of 3
00:31TEttingerpartition-all then, I'd say
00:32TEttingeryou can trim unneeded ones later
00:32BalvedaYeah, either way it's if count is < 3 or if item is nil, make an empty card
00:32TEttingercool
00:34Balvedathanks for all the help!
00:34BalvedaI'll be sure to pester you soon enough
00:34BalvedaI like how clojure has these functions for handling things rather than just having to iterate al ot
00:35TEttingeroh yeah, you should see the stuff I can pull off in one IRC message using "clever" partition and other seq stuf
00:36Balvedacoming from enterprise java it's a breath of fresh air
00:36Balvedathe less I can touch that stuff the better, the things i've seen.. ugh
00:36TEttinger##(clojure.string/join " "(repeatedly 2000(fn [](apply str(concat[(rand-nth ["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth ["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth ["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth ["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])])))))
00:36lazybot⇒ "zeoxitum thaurkum gausteochus phthaustachium kourkofon neopaunor moganium thomon geortoutus koneosis paspanes zaumus zemouxophon rhastenis chagaufophon chourtor rhoges gamiam phthesaspus leochortus zoupeobor somanes somiam rhangiam tachertos poirkasophon soibum logi... https://www.refheap.com/88708
00:36TEttingerforgive the ugliness, but lazybot only takes single lines
00:37Balvedanice
00:37TEttingerthat's within about 30 chars of the limit for Freenode messages IIRC
00:38BalvedaI'm getting on a project where I can choose what I want to dev in and despite me not having much experience with Clojure I'd rather use it than anything else
00:39aeikenberrycan i ask a few more?
00:39aeikenberryi've changed my macro to accept any number of argument
00:39aeikenberryand i want to do something like this:
00:40aeikenberry(list 'cond test (list 'map 'do (:then chunkmap))
00:40TEttingerBalveda, it's an awesome language
00:40aeikenberrybut i guess you can no map do
00:40aeikenberrydo i need to do a for?
00:40TEttingerthat looks like a loop/recur or reduce problem; how did you solve the first, aeikenberry?
00:41jeremyheileraeikenberry: mapping do doesn't make much sense
00:41aeikenberryyeah, i'm not making a new coll
00:41aeikenberryi just want to iterate over and do that stuff
00:42jeremyheileraeikenberry: remember, macros jobs are to spit out code.
00:42jeremyheilerdo you really need to "iterate" over anything?
00:44jeremyheiler(cons 'do (:then chunkmap))
00:45jeremyheilerif the value of :then in the map is a list of expresions, you can just cons do to the front
00:45jeremyheiler(you could also dive into using syntax-quote and unquote-splicing to create a more literal macro)
00:45aeikenberryhttps://dpaste.de/cKOb
00:46jeremyheilerso,
00:46jeremyheiler,(list 'do '(1 2 3))
00:46clojurebot(do (1 2 3))
00:46jeremyheilervs
00:46jeremyheiler,(cons 'do '(1 2 3))
00:46clojurebot(do 1 2 3)
00:47aeikenberryah
00:47aeikenberrythanks jeremyheiler
00:47jeremyheilernp!
00:49aeikenberryif you are stuck in repl
00:50TEttingerctrl-d to exit
00:50aeikenberrythanks
00:50TEttingermight be z or c
00:50jeremyheilerburn your computer and buy a new one
00:51aeikenberrymy exp isn't terminating
00:51aeikenberryno number of ))'s or "'s
00:51aeikenberrywill let me finish
00:51aeikenberryhow do i scrap that but not leave repl?
00:52jeremyheilerctrl+c if you're just in a lein repl
00:53aeikenberrydoesn't seem to work for me
00:56aeikenberrythanks for all the help
00:58aeikenberryhttps://dpaste.de/srFZ
00:58aeikenberrylast one
01:00aeikenberry,(do (quote ok) (quote cool))
01:00clojurebotcool
01:02aeikenberry,(do (println 'ok) (println 'cool))
01:02clojurebotok\ncool\n
01:02aeikenberrywhat's going on there?
01:02TEttingeraeikenberry, there's no way to do an early terminate and stay in repl
01:03aeikenberryTEttinger, oh ok. thanks
01:03TEttingerlike if you try to assign a variable to the evaluation of an infinite sequence, terminating and staying in repl would be bad
01:03TEttinger(unless you have infinite ram)
01:03aeikenberrythat makes sense
01:03jeremyheiler,(println "hi")
01:03clojurebothi\n
01:03jeremyheileraeikenberry: so, clojurebot is hiding it, but println returns nil
01:03TEttingeraeikenberry, also, do returns the last element
01:04TEttingerbut it evals the others, it doesn't print them unless you tell it to print
01:04aeikenberryah
01:08aeikenberryoff to bed. you guys rock. great first day of clojure
01:08aeikenberrythanks again
01:08TEttingerno prob, glad to help
01:08jeremyheilergood night!
02:48swgillespiehi all, is there a way to read a single character from stdin without calling into java?
02:48TEttingerwell seeing as... #(class *in*)
02:48TEttingerwell seeing as... ##(class *in*)
02:48lazybot⇒ clojure.lang.LineNumberingPushbackReader
02:49TEttingerinteresting
02:49TEttingerit's different here than at a command line repl
02:49TEttinger,(class *in*)
02:49clojurebotclojure.lang.LineNumberingPushbackReader
02:49TEttingermaybe not
02:50TEttingerswgillespie, is this at the repl or in a running application like a jar?
02:50swgillespieShouldn't it be the same in both scenarios?
02:50swgillespieI'm writing a brainfuck interpreter as an intro to clojure
02:50TEttingerrepl I think uses a different class for *in*, likely has the same API
02:52TEttinger,(.read *in*)
02:53TEttingern
02:53swgillespieTEttinger: (read *in*) reads until a newline for me
02:53clojureboteval service is offline
02:53TEttingeroh whaaaaat
02:53TEttingerno, .read
02:53TEttingerread is ##(doc read)
02:53lazybot⇒ "([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."
02:53TEttingeran object
02:53swgillespieoh jeez
02:53TEttingerbut .read is a method on Reader, which is what *in* implements
02:54swgillespiegotcha
02:54TEttingerit is java, but the only clue is that there's a .
02:54swgillespieI see, I didn't catch the dot
02:58swgillespieoh, I see - even if you put in multiple characters to the terminal, (.read *in*) pops them off one at a time
02:58swgillespiethanks TEttinger
03:01TEttingerno prob, swgillespie
03:28blunteQ: is it possible to do something like this? (defrecord RecBar [a b]) (defn foo [rectype a b] (->rectype a b)) ?
03:29blunteit's not able to compile the function (because it has no idea what a "rectype" is)
03:32blunteI'm trying to make a function that can accept any type of defined record, read a file, and populate records from the file. But I can't figure out how to define that function (how to tell the compiler that it should expect some generic "class")
03:32pyrtsablunte: If it helps, you could construct a RecBar instance with assoc, like this: (assoc (map->RecBar {}) :a 1 :b 2), or just use map->RecBar.
03:33pyrtsaDoes the returned type of record depend on the contents of the file somehow? Or only the contents?
03:33blunteyes, I'm making a file reader that should populate and return a set of the appropriate type of record
03:33blunteso I want to call load-file with the RecBar or RecBoo or whatever the appropriate record type is for the associated file
03:34pyrtsaSo the caller tells that "read this file, it should return a RecBar", right?
03:34blunteI need some way of saying (defn foo [this-is-a-class-that-has-arrow-operator filename] ...)
03:34blunteyes
03:35pyrtsaThen assoc could just work.
03:35blunteI'll read about assoc. I'm quite new, so it doesn't mean much to me yet. Thanks!
04:38engblomWhat free and open-source data storage library would you use if you do not want a separate database server (like mysql, postgresql)? I would even prefer something not being SQL at all as that requires a lot of mapping between clojure data-structures and SQL.
04:39ssiderisengblom: I happily use honeysql, but that might be too close to SQL for your liking
04:40ssiderisbut I don't end up doing many conversions really
04:40hyPiRionengblom: So what's the use case? That's seems pretty important when deciding on DB.
04:40hyPiRionI mean, do you have structural data? Or is it not that important with schemas etcs?
04:40Glenjaminwhat sort of load, do you need to access from multiple processes
04:40ssiderisengblom: sorry, I mis-read your question, ignore me
04:44TEttingerengblom, I have seen an article that mentioned how easy it is to use clojure's built-in transactional memory to make in-memory DBs
04:45TEttingerhttp://blog.malcolmsparks.com/?p=67
04:47engblomThe typical projects would be in size of a personal project manager keeping track of how many hours I have been working on different projects and a short description.
04:47TEttingeroh wow, hat one isn't in-memory
04:48TEttingerheh, engblom: 30 lines enough? I'm curious if anyone has improved on that example
04:48engblomIn memory DB would be great if it had some durability by writing in the background to disk.
04:49engblomTEttinger: That one I found earlier today when I googled for this question
04:50TEttingeryeah, it's number one on my search, but it is good. I will check github for improvements other people made
04:50Glenjaminspit on change / slurp on boot might be enough for that case
04:52Glenjaminoh right, thats what this does
04:52hyPiRionengblom: You could probably use Monger, which has this automatic conversion to and from Clojure data structures if I read it right
04:53TEttingerthere's also https://github.com/ibdknox/simpledb/blob/master/src/simpledb/core.clj
04:53hyPiRionI've never used MongoDB though, so take that with a grain of salt.
04:53TEttingerI have, it does need a server
04:54hyPiRionOh, so we're talking bundling everything up in the same application?
04:54Glenjaminthere are few, if any, good reasons to use mongo in my experience
04:55Glenjamineither your app is too small to get any benefits over a normal DB, or its too big and scaling is a pain
04:55TEttingerGlenjamin, yeah I'm curious what the better alternatives are?
04:55Glenjaminme too
04:55Glenjaminwe use it quite a bit here, and we all hate it now
04:56engblomI wonder if MongoDB is a server-client database or just a library storing to a local file?
04:56hyPiRionIt is a "proper" database.
04:57engblomOK, thanks!
04:57engblomI might still look into it as monger seem to do what I wish to do, from the short description.
05:00TEttingerbut yeah mongodb does have a server (daemon) running
05:00engblomThe reason I wish it would not be a server-client database is because I would want to be able to upload whatever I make to any java-server and know it will run regardless of if they provide mysql-, postgresql-, whatever-server
05:00TEttingermongod
05:01TEttingerit might be the most flexible to use something like what ibdknox provides in that sample
05:01TEttingerslurp and spit can serialize non-binary data
05:01TEttingeror rather with the right toString things for the types you use
05:11engblomWhat do you think about this one: https://github.com/gcv/cupboard ?
05:11TEttingerthat looks excellent
05:12TEttingerbut I know nothing about Berkeley DB
05:12engblomSadly it seem to not be actively developed anymore
05:13TEttingerah, AGPL
05:24teemu_fClojureScript q: I'd like to filter data based on search term (basic search box). How do I use js/RegExp properly? Basic (filter #(term (:name %)) data-chunk) works but accepts only direct matches.
05:34ebaxtI'm looking for a light-weight solution for scheduling jobs across multiple clojure apps. I need to make sure only one application runs the job for each trigger. I've looked at Quartzite, but it only supports this via JDBC-JobStore, and were not using any RDMS. Does anyone here use any other solution for this type of scenario?
05:47gwsmaybe it wouldnt' be too hard to plug yours in, or maybe a library already exists
05:51ebaxtgws: I noticed that as well. Currently the mongodb adapter doesn't support clustering (https://github.com/michaelklishin/quartz-mongodb/issues/66), so I'm trying to figure out if there are other options that already support this before adding the feature myself
05:59gwsah, i see - yeah given your requirements either etcd/zookeeper for coordination or adding that feature to the existing mongodb adapter seem like the paths of least resistance
06:00gwsthere are some lighter weight schedulers but none attempt to run "singleton" jobs across a cluster, at least not that i'm aware of
06:04ebaxtgws: ok, I'm currently using chime, but this is the first time I need synchronization across multiple servers. We also use redis so I guess I could use a global lock as well. Anyways, I was hoping there was a small idiomatic clojure lib that I didn't know about that solved it for me :)
06:06schmirebaxt: RabbitMQ may be an option. but that's not really light-weight
06:11ebaxtschmir: Thanks, but I would prefer not to add another pice of infrastructure :)
06:17sveriHi, I am using http-kit and lein cljsbuild on windows 7. Now, when I run the cljsbuild in advanced|whitespaced mode and start up my server the rebuild of the cljs file fails because the server or leiningen or whatever still has a handle on it, causing that the cljsbuild cannot write the js file. Did someone experience the same? Any Ideas how to solve it (switching to linux is not rly a valid proposal in my case ;-))
06:30engblomIn *nix you have dot-folders in $HOME for storing data. In Windows you have AppData under your profile. Other OS might have other places... How do you best store data belonging to the user? Do I need manually to detect OS and take different actions depending on OS?
06:31engblomIs there a ready library for this?
06:32impermanengblom: OS checking is the safest way, I think. Check this also - https://github.com/derekchiang/Clojure-Watch
06:34katratxosveri: i guess that is a common windows issue and not a lein cljsbuild specific problem, right? https://en.wikipedia.org/wiki/File_locking#In_Microsoft_Windows
06:35impermanengblom: here is also some platform-neutral examples - http://stackoverflow.com/questions/21198361/clojure-file-system-portability
06:38sverikatratxo: Yea, that's my guess too, I was just wondering if anyone knows a workarund, besides that, It works if I compile the cljsbuild without any optimization
06:49teemu_fOkay, having lunch helped with my regex problem..
06:49teemu_f(filter #(not (nil? (re-matches (re-pattern search-term) (:name %)))) (:persons app))
06:52nobodyzzz(not (nil? ...)) is not nesseccary i suppose
06:53teemu_fyup, I just removed them
06:54teemu_ffirst you make it work, then clean up afterwards :)
06:54ro_styou can just use re-find, btw
06:55ro_st(->> app :persons (filter (comp (partial re-find (re-pattern search-term) :name))))
06:56ro_sterk
06:56ro_st(->> app :persons (filter (comp (partial re-find (re-pattern search-term)) :name)))
06:57blunteIs it possible to pass in a class (such as a defined record) to a function, and then within the function use operations from that class?
06:58blunte(defrecord R [a b]) (defn foo [a-rec-class val1 val2] (->a-rec-class val1 val2))
07:01teemu_fro_st: thanks for alternative solution. I'm not that familiar with comp function yet, have to try it
07:04scape_why do I get a "no matching field for class" error? https://www.refheap.com/88710
07:05ro_stinit is a static method
07:05ro_stBullet/init
07:05scape_public static
07:05scape_yes
07:05scape_oh ok
07:07scape_thanks
07:14clgvblunt: just pass in the appropriate function
07:14blunteclgv: I'm not sure I understand?
07:15clgvblunte: you can pass any function as parameter to any other function in clojure
07:16blunteclgv: so I pass ->R instead of R ?
07:16clgvblunte: yes
07:17clgv,(do (defrecord R [a b]) (defn foo [f a b] (f a b)) (f 1 2))
07:17clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: f in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:18clgv,(do (defrecord R [a b]) (defn foo [f a b] (f a b)) (foo ->R 1 2))
07:18clojurebot#sandbox.R{:a 1, :b 2}
07:18blunteclgv: that's great, and simple
07:18clgvblunte: but that minimal function is actually pretty useless^^
07:19blunteclgv: yes, there's actually more going on in my foo. data will be read from a file, and records will be generated. the details come down to the filename (what's in the file) and the type of record I'm stuffing it into
07:19blunteclgv: much thanks :)
07:19clgvnp#
07:59razum2umhow to load a jar with -javaagent options with lein ?
08:01clgvrazum2um: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L252
08:01razum2umclgv: thanks
08:21mbachttp://dev.clojure.org/display/community/Clojure+Success+Stories
08:21mpenethow do you even put stuff in a c.core.async/sliding-buffer?
08:21mpenet>!! >! put! seems all to fail
08:22mbacthat success stories link is a bit hand wavey. e.g. i believe citigroup usees clojure *somewhere* but it doesn't say what for
08:22ro_stmpenet: don't you pass the sliding buffer as an arg to chan, and write to the chan?
08:23mpenetah, might be!
08:23mpenetright, chan!=buffer
08:26AeroNotixgfredericks: can I depend on this code for production uses? https://github.com/gfredericks/vcr-clj
08:26AeroNotixlooks like it would be useful for some stuff we're doing here
08:27teemu_fHooray, there's a new euroclojure 2014 video on vimeo! Hope the rest will be there soon..
08:28ro_stlink teemu_f?
08:28teemu_fhttp://vimeo.com/euroclojure
08:29mbacis there a macro like defn, but where if you call the function with too few arguments it returns a function that takes the remaining arguments?
08:30mbacthat is, it auto partially applies the function?
08:30ro_stno. not even slightly.
08:30mbacit seems like it should be doable
08:30ro_stoh, wait. i read that as 'is macro like defn, but'
08:30ro_stisn't that like fnil?
08:31ro_sthttp://grimoire.arrdem.com/1.6.0/clojure.core/fnil
08:31ro_stit's kinda similar
08:32clgvmbac: https://github.com/gfredericks/currj ?
08:32ohpauleezmbac: You want to curry
08:33mbacright
08:33ohpauleezthere are a few curry macros out there, including one in definition of reducers (called defcurry)
08:33pyrtsaI think #'clojure.core.reducers/defcurried does it but it's unfortunately declared private.
08:34ohpauleezIt's also fun to write that macro, so as a thought exercise, you can take a stab at writing it before looking at others ( mbac )
08:34mbacbasically i have a form like this:
08:34mbac(defn date-to-string [date] (time-format/unparse (time-format/formatters :year-month-day) date))
08:34mbacand i want to be able to factor out the date
08:34mbac(def date-to-string (time-format/unparse (time-format/formatters) :year-month-day))
08:35mbacand i can, by using partial, but that's almost as long as the original
08:36gfredericksAeroNotix: by "production" do you mean "testing code used in production"?
08:37AeroNotixgfredericks: yeah
08:37AeroNotixsame diff :)
08:37gfredericksclgv: mbac: currj is like three things at once, and currying is one of them; it's not complete though
08:38gfredericksAeroNotix: I've been using it for that for over a year now
08:38AeroNotixgfredericks: ok, I'll take 'er for a spin
08:38AeroNotixthanks :)
08:38gfredericksnp
08:41gfredericksAeroNotix: I'm reminded now of the "library extensibly serializing" problem that I didn't know how to solve; now I'm wondering if transit could do it, but of course we're not supposed to persist transit...
08:42gfredericksAeroNotix: be aware of issue #2; there's a separate release described there with a haxy fix
08:43gfredericksmight have to write my own damn edn printer to fix it properly
08:45mbachttp://stackoverflow.com/questions/5329079/higher-order-functions-in-clojure
08:45mbacthe answer below the accepted answer, defn-ho, seems like the business
08:49mbacoh currj. hmm.
08:49H4nsso i have this clojure application packed in an uberjar and now i wonder where i would put a suitable log4j.properties file so that it is seen when i run the application. can anyone help?
08:50gfredericks,(defn curry [f arg-num] (if (pos? arg-num) (fn [& args] (curry (apply partial f args) (- arg-num (count args)))) f))
08:50clojurebot#'sandbox/curry
08:50gfredericks,(defn plus (curry + 3))
08:50clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Parameter declaration curry should be a vector>
08:50gfredericks,(def plus (curry + 3))
08:50clojurebot#'sandbox/plus
08:50gfredericks,(plus 8)
08:50clojurebot#<sandbox$curry$fn__25 sandbox$curry$fn__25@c5a44e>
08:50gfredericks,(plus 8 9 10)
08:50clojurebot#<core$partial$fn__4232 clojure.core$partial$fn__4232@1b66659>
08:51gfredericks,(plus 8 9 10 11)
08:51clojurebot#<core$partial$fn__4234 clojure.core$partial$fn__4234@1ccad9c>
08:51gfredericksoops
08:51ohpauleezclose
08:52gfredericksI guess if you call curry with a non positive number it should just call your function :D
08:52gfredericks,(defn curry [f arg-num] (if (pos? arg-num) (fn [& args] (curry (apply partial f args) (- arg-num (count args)))) (f)))
08:52clojurebot#'sandbox/curry
08:52gfredericks,(def plus (curry + 3))
08:52clojurebot#'sandbox/plus
08:52gfredericks,(curry 8 9 10)
08:52clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox/curry>
08:52gfredericks,(plus 8 9 10)
08:52clojurebot27
08:52gfredericks,(plus 8 9)
08:52clojurebot#<sandbox$curry$fn__166 sandbox$curry$fn__166@1d57c7>
08:52gfredericks,((plus 8 9) 10)
08:52clojurebot27
08:52gfredericks,(((plus 8) 9) 10)
08:52clojurebot27
08:52gfredericks,((plus 8) 9 10)
08:52clojurebot27
08:52gfredericks,(curry + 0)
08:52clojurebot0
08:53gfrederickscould also get it to support extra args getting called on the return value
08:53drbobbeatyH4ns: I put mine in the resources/ directory at the top-level of the leiningen project, and it is (by definition) in the classpath, and will get picked up.
08:53H4nsdrbobbeaty: ah, thanks, i'll try that!
08:54drbobbeatyH4ns: let me know if it fails for you - but it shouldn't.
08:57H4nsdrbobbeaty: it appears not to be picked up. i probably make a very basic mistake. maybe i'm not even using log4j, but java.utils.logger. i'll have a look.
09:00Mandarhello
09:00Mandarquick leiningen question
09:00Mandari've just started a new project with 'lein new sg
09:00drbobbeatyH4ns: when I `lein uberjar` it places my log4j.properties file from my resources/ directory at the top-level of the generated jar in the target/ directory - both the stand-alone jar, and the non-standalone version.
09:01Mandaradded [org.clojure/math.combinatorics "0.0.8"] to my project.clj file
09:01Mandarand ran lein deps
09:01Mandarbut looks like nothing got downloaded
09:01H4nsdrbobbeaty: yeah, i think what i was missing was log4j itself. trying that right now.
09:01H4nstada!
09:02H4nsdrbobbeaty: thanks! i've added it to my project.clj and the props from the resources directory are picked up.
09:02Mandarand when adding (:require [clojure.math.combinatorics :as combo]) to my core.clj file, I only get an exception (java.io.FileNotFoundException)
09:02hyPiRionMandar: does project.clj look like this? https://www.refheap.com/88713
09:03drbobbeatyH4ns: Great! :)
09:03MandarhyPiRion, yes it does
09:03hyPiRionMandar: well, that's strange, because it works fine over here.
09:04Mandarhmm
09:04Glenjaminanyone know where i can find a decent levenstein distance function?
09:05MandarhyPiRion, lein deps :tree shows the dependency as well
09:05hyPiRionGlenjamin: there's one in Lein main. It's levensthein-damerau though, and not particularly performance tuned
09:06hyPiRionMandar: ohh
09:06hyPiRionMandar: wait no, I thought I understood why, but I don't.
09:07hyPiRionMandar: this happens when you do `lein repl`, right?
09:08Mandarit happens when I eval the require line in Lighttable
09:08hyPiRionHm. I'm not sure how Lighttable and Lein works together, so I'm not sure how I could help you there
09:09hyPiRionOther than just restart Lighttable and/or ensure that the :require call is within a file in the project.
09:09MandarI'll try with the repl first, you're right
09:10hyPiRionAt least we can trace it down to some specific software
09:11Mandarheh, restarting LightTable worked
09:11Mandarthank you hyPiRion
09:12hyPiRionYou're welcome. I guess LT has to reload the dependencies somehow – I wouldn't be surprised if there is some feature which makes you able to do so without restarting it
09:12hyPiRionBut I'm no LT person, so that's just a guess
09:23teslanickIf you disconnect from the connected client and then reconnect, it will re-retrieve dependencies.
09:23teslanick(usually)
09:24teslanick(with relevant caveats about disconnecting from running state possibly screwing up your development process)
09:31Mandarteslanick, thanks
09:31razum2umI wonder why do all lein plugins exist if putting a lib into ~/.lein/profiles.clj under :dependencies is way better than that. why should i start another jvm and force my clojure to be scripty-like when i can require lib (not plugin!) in my repl an feed it with any clojure structure as argument
09:35TimMcrazum2um: Well, for one thing, that would require having a buildable project.
09:36TimMcFor another, some tasks require varying the dependencies, so you wouldn't want the plugin in that same dependency space.
09:36razum2umTimMc: plugins like expectations or midje (for continous testing) don't do any good if project isn't buildable anyway
09:37TimMcI mean, I agree that if your plugin *could* just be a library, maybe it *should* be, but that's just not always the case.
09:37clgvrazum2um: if you want to customize build related stuff, then you'll probably need a leiningen plugin
10:58tvanhensx
11:11technomancyhm; he left. I was going to tell him that he's right, and most plugins being created nowadays should just be libs.
11:34raj91Is there any rationale for why `for` doesn't wrap body-expr in an implicit do?
11:34jcromartieraj91: because `for` is a sequence comprehension and not for side effects
11:35jcromartiealso, it basically does
11:35jcromartieit uses let
11:35jcromartieand do
11:35jcromartieso
11:36jcromartie,(first (for [i (range 100000)] (println "i =" i) i))
11:36clojurebot#<CompilerException clojure.lang.ArityException: Wrong number of args (3) passed to: core/for, compiling:(NO_SOURCE_PATH:0:0)>
11:37jcromartie,(first (for [i (range 100000)] i))
11:37clojurebot0
11:37clgvthe ultimative laziness check is with (range) ;)
11:39AWizzArdclgv: as soon you want to produce the full range the jvm can be everything, but lazy ;)
11:41raj91jcromartie: thanks your explanation makes sense -- but as you showed, only one body-expr is allowed
11:42clgvAWizzArd: I always do that to heat my office ;)
11:42jcromartieclgv: oh neat, I didn't know there was a 0-arity version
11:58elbenwhen running (clojure.core.typed/check-ns), I get the message below, even though (meta *ns*) is nil:
11:58elbenFinished collecting myapp.core
11:58elbenCollected 1 namespaces in 1021.73551 msecs
11:58elbenNot checking myapp.core (tagged :collect-only in ns metadata)
11:58elbensorry for the multi-line. any ideas why it would say “not checking myapp.core”?
12:04ambrosebselben: can you share the ns form?
12:04elbenambrosebs: (ns myapp.core (require [clojure.core.typed :refer [check-ns ann] :as t]))
12:05ambrosebselben: should be :require instead of require
12:05ambrosebselben: core.typed uses tools.namespace, which is (correctly) rather picky about the ns form
12:06ambrosebselben: what happened here is core.typed doesn't pick up the ns dependncy of clojure.core.typed, which means the namespace isn't type checked.
12:06elbeninteresting—so some other module is the one that is “non-picky” and allows ‘require?
12:06stuartsierraThe `ns` macro is notoriously lax about what it accepts.
12:12edwIn CIDER, is there a(n easy) way to get C-u C-x C-e to automagically put some text (e.g. ";; => ") in between point and the inserted result?
12:19TimMc,(ns sandbox (:+ 1 2))
12:20clojurebotnil
12:20TimMc,(ns sandbox (:println hello))
12:20clojurebothello\n
12:21technomancy~egalitarian-ns
12:21clojurebotGabh mo leithscéal?
12:21technomancydang it clojurebot
12:21technomancyhttp://p.hagelb.org/egalitarian-ns.html
12:22Raynestechnomancy: We should storm into Rich Hickey's home playing Nirvana with that patch in hand.
12:22technomancyclojurebot: egalitarian-ns is seizing power from those who have held it exclusively for too long: http://p.hagelb.org/egalitarian-ns.html rise up, workers
12:22clojurebotOk.
12:23RaynesPhil and I have grand plans for if that damned thing is ever accepted.
12:23RaynesGrand plans, I say.
12:23technomancywell it would have to be submitted before it could be accepted
12:23RaynesConch, for starters, would become orders of magnitudes more often.
12:23stuartsierraMaking tools.namespace even harder to maintain? :P
12:23Raynestechnomancy: It says something that neither of us is brave enough to do it :(
12:24Raynesstuartsierra: I also maintain a similar library. I'm cool with it :p
12:24Rayness/often/awesome/
12:24Raynesnot enough coffee, can't brain
12:24stuartsierraI guess it wouldn't be too bad, but why do you want arbitrary code in the ns declaration?
12:24technomancyRaynes: I read that as "conch would come into being orders of magnitude more often" and started wondering if you have some paranormal ability to cross into multiple time streams
12:25RaynesWell, yeah, but not relevant.
12:25technomancystuartsierra: because clojure.core/require is not the be all and end all of code loading?
12:25technomancyhttps://code.google.com/p/clj-nstools/ for one
12:25technomancythe :like clause is really nice
12:25stuartsierratechnomancy: I don't claim it is, but why does the alternative have to be *inside* the ns form?
12:25technomancyplus it's a requirement for experimenting with nix-like namespaces
12:26technomancystuartsierra: it just looks gross otherwise
12:26Raynesstuartsierra: Yes.
12:26Raynes:p
12:26technomancynstools has existed for years, and no one uses it because it's so hideous to hack around not having it in proper ns
12:26RaynesI think conch is a pretty great example of why this would be awesome. It'd make it darn near as seamless as amoffat's Python lib.
12:27RaynesWithout silly metahax
12:27gfredericksRaynes: referring shellout commands?
12:27Raynesgfredericks: ?
12:27gfredericks(:me.raynes.conch/require-commands [ls])
12:27RaynesSure
12:28gfrederickswasn't sure if that's what you meant by "it"
12:28stuartsierraWhat's wrong with just putting stuff at the top-level after `ns`? It's all side-effects anyway, even `ns`.
12:28RaynesWhat's wrong with just having this three line change?
12:28Raynes:p
12:29RaynesI mean, we could do without (ns ..) entirely.
12:29technomancystuartsierra: it's ugly
12:29technomancythere's value in maintaining the illusion of declarativity
12:29RaynesIf this wasn't so trivial, I'd be more opposed.
12:30technomancyliterally all of functional programming is just making changes to bits in memory somewhere
12:30technomancybut we like to be able to pretend it's clean and pure and purty
12:31tbaldridgeMy favorite comeback to those who claim functional purity "yeah, but you malloc call has side effects...."
12:31technomancyanyway I've come to grips that it's never going to happen, but it's an interesting thought experiment
12:32stuartsierraI'll be the first to line up and say I don't like the syntax of `ns`, but I'm not convinced that adding arbitrary code execution would make it better. :)
12:32Raynesstuartsierra: I'll fight you.
12:32technomancyallowing experimentation in userspace is always preferable to requiring patches to get applied to clojure itself
12:32gfredericksit already has mostly arbitrary code execution
12:32gfredericksit's just ugly
12:33technomancygfredericks: (ns my.thingy (:eval (my.other.ns with-args)))
12:33technomancywooo
12:33gfredericksright
12:33stuartsierraheh
12:34RaynesI need a new editor color scheme
12:35technomancyactually kinda wish I had somewhere I could sneak this :eval ns thing in
12:35technomancysomewhere that isn't leiningen I mean
12:38gfrederickstechnomancy: huh?
12:39gfrederickstechnomancy: oh like you just want to use :eval so that people can see you using it?
12:40technomancy"We've secretly replaced these clojure programmers' reasonable ns forms with something containing :eval. Let's see if they notice."
13:06mirfhi jimmybot
13:07mirfI'm pleased to meet you
13:28daGrevisyelp! https://gist.github.com/876ad28c7d70d70bbefa
13:30stuartsierradaGrevis: something called `concat` in a loop.
13:30daGrevishmm
13:31daGrevishttps://gist.github.com/10dc0db756867c4662bf
13:31daGrevisonly place I'm using concat is build-chain and it always should get the same input
13:31daGrevisso why is it failing randomly
13:32jcromartiedaGrevis: inside build-words you have your loop binding backwards
13:32jcromartieI think
13:32daGreviswhat does it mean?
13:33jcromartiesorry, I misinterpreted the loop binding
13:34stuartsierraIt's `merge-with concat` that's the problem. `concat` is lazy, so each time you call it you build a deeper "stack" of lazy sequences.
13:35daGrevis<daGrevis> only place I'm using concat is build-chain and it always should get the same input
13:35daGrevis<daGrevis> so why is it failing randomly
13:35stuartsierraWhen one of those lazy sequence nestings is deeper than the max Java stack size, you get a stack overflow.
13:36daGrevisok I guess I understand
13:36daGrevishow could I fix it?
13:36stuartsierraReplace the sequences with vectors, and use `into` instead of `concat`.
13:37daGrevisgreat! you're awesome :)
13:39stuartsierradaGrevis: Thanks! Good luck.
13:59seangrovednolen_: What do you think about a cljs patch that lets users supply a munging function? Then when exporting a js-oriented library, you could export updateIn and swapDanger instead of update_in and swap_BANG_?
14:01dnolen_seangrove: I don't see how this isn't already solved by existing export support in Closure and thus ClojureScript
14:01gfredericksclojurebot: swapDanger |would be| a decent name for a character in an adventure story
14:01clojurebotc'est bon!
14:01dnolen_this types of things inline well
14:02seangrovednolen_: Thinking specifically about Mori and the complaints about the naming
14:03seangrovednolen_: What's the existing option that closure supports?
14:03dnolen_^:export works
14:03seangrovednolen_: Ah, you mean one-by-one, rather than a systemic approach
14:04dnolen_for methods you can use externs.
14:04dnolen_seangrove: something like that is super low priority
14:04Farehi
14:04seangroveYeah, I'm not saying it's on the critical path for cljs support
14:05dnolen_seangrove: feel free to make a ticket and low priority ticket + patch - I'll take a look if you do
14:05dnolen_er, you know what I mean
14:05seangroveHeh, sure
14:05Fareis it possible to have resources that are only available during testing?
14:05mdrogalisdnolen_: Saw the Facebook immutable JS library you tweeted about. Pretty neat that it came out of there.
14:05Farei.e. test files for my compiler to execute?
14:05dnolen_mdrogalis: very neat, React may very well bring immutability to masses
14:05mdrogalisFare: Check out Leiningen profiles. You can change the resource path.
14:06mdrogalisdnolen_: For sure. :)
14:06ro_stdnolen_: you must be stoked :-)
14:07dnolen_ro_st: exciting times
14:07Fare(inc mdrogalis)
14:07lazybot⇒ 5
14:08Farels test_resources a good name for such a resources directory?
14:08lazybothome mnt proc sbin srv usr var
14:09Fareis, not ls
14:09arrdemas good a name as any..
14:09arrdem/resources/{test,production} could work too..
14:09ro_sto/ arrdem. round two begins
14:10arrdemro_st: o/
14:11arrdemro_st: I'm gonna grab some food and get started on Oxcart for the day, hit me up if I can help
14:13ro_stfor sure
14:49ben_vulpesi'd like to do (clojure.java.shell/sh "cp" "place/dir/*"), but the wildcard isn't hitting bash correctly. how should i use a wildcard with c.j.s/sh?
14:49amalloyben_vulpes: sh does not go through your shell at all
14:49amalloyif you want to call bash instead of calling cp, then shell out to bash instead of to cp
14:50ben_vulpesgotcha.
14:50amalloy(eg, with bash -c)
14:50ben_vulpes(sh "bash" "-c" "cp")
14:50amalloyyep
14:50ben_vulpesthanks, amalloy !
14:50ben_vulpesderp dorp o'clock
14:51amalloyguys you know what would be amazing? a bash history file that's context-sensitive, so i can see what i did last time i was in this stupid directory a month ago
14:51technomancyoh man
14:51technomancyI bet that would be pretty easy to write in eshell
14:52technomancyas horrible as hash tables are in elisp, it'd be a lot nicer than bash
14:53hiredmanhttps://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/per-directory-history
14:53hiredmanlinks to some bash versions I guess
14:58justin_smithyou'd think someone would have made a shell with a decent simple language underlying it (something like sh with extensions using scheme or lua) ... then again I bet it exists and nobody uses it. Hell, it's probably been done a few hundred times by now.
15:02technomancyjustin_smith: that's kind of exactly what eshell is?
15:02technomancyalso scsh, but that seems to have stalled out
15:03xeqisounds like a repl
15:03justin_smithdid scsh ever have proper sh syntax reading though?
15:03tuftamalloy: maybe this? http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
15:03justin_smithxeqi: repl with convenient process invocation / chaining, yeah
15:06arrdemjustin_smith: seems like you just need a faster starting interpreter with a | operator defined...
15:06llasramThere's some interesting ideas in the Python `sh` library: http://amoffat.github.io/sh/
15:07llasramAside from the fact that Python's syntax makes REPL usage kind of awkward
15:08justin_smithllasram: yeah, there are a bunch of languages that can almost do it, but they make normal shell usage awkward / don't fully support | > >> & etc. functionality
15:09justin_smitheven eshell doesn't have all the redirects
15:10llasramjustin_smith: One of the interesting thing about the Python `sh` library is that it instead has pretty Pythonic equivalents
15:11llasrame.g. instead of having a literal "|" pipe syntax, the return values of subprocess functions are objects which cause the `sh` library to setup process pipelines when passed as input to other subprocess functions
15:13jinks_I guess what people are really looking for is not "a shell implemented in $language and leveraging those features" but more of a "bash linked against $language" so they can carry 100% of their bash-isms across
15:13llasramYeah, maybe so
15:14justin_smithjinks_: yeah, maybe an escape syntax to embed the extension language, and then define extensions as standard compatible bash functions
15:14jinks_shells like bash and zsh have decades of accumulated features and use-cases, so every "new" player on the field has to deal with a torrent of "that's nice, but can it do X like in bash"
15:15justin_smithbecause of course eshell can take input from a file or put output in a file in many elaborate ways (elisp is an editor extension language after all), it just isn't ready for some of my first attempt command line building syntaxes
15:25amalloygfredericks: i need your damn system-exit library, so i can hook it to fire whoever is calling System/exit without even logging a warning saying where or why
15:25gfrederickssystem-slash-exti
15:25gfrederickss/exti/exit/
15:26Raynesamalloy: grep . -R 'System/exit'
15:26Raynesstfu gtfo
15:26amalloyRaynes: sure, bro. let me know when you've got that searching all the libraries in my project
15:26justin_smithRaynes: I bet there is some git command that will search commits for a string, and report the usernames of people who have checked in said commits
15:27arrdemBronsa: how did you get GitHub to email you diffs on commits?
15:27arrdemBronsa: I can't find that option
15:29alandipertamalloy, lein cp | tr : '\n' | grep 'jar$' | xargs grep -R 'System/exit'
15:30arrdemAh. email service. got it.
15:31amalloyjustin_smith: git log -SSystem/exit --pretty=%an
15:35amalloygit log -p -SSystem/exit '--pretty=format:%h %an' is a little better so you can tell why they touched System/exit
15:37justin_smithcool, I figured it was possible
15:37amalloytoday i learned about -S
15:42Bronsaarrdem: AFAIK github doesn't offer a way to email all the commits, I just use the dashboard rss feed + rss2email
15:42arrdemBronsa: that works. there's also an email service you can enable per-repo that sends an email with the message and link on commits pushed
15:42Bronsarly
15:52ro_stmy kingdom for a way to add deps to a lein project without restarting my jvm
15:52ro_stok, maybe not my kingdom. this cookie, perhaps?
15:52arrdemhave karma need libs
15:54llasramro_st: alembic? https://github.com/pallet/alembic
15:55llasramro_st: And... you mentioned something about a cookie?
15:55ro_st:cookie:
15:55arrdem(inc llasram)
15:55lazybot⇒ 30
15:55ro_stif your client supports emoji, eat up :-)
15:55ro_stthanks llasram i'll try that!
15:55arrdemI need to post my erc-emoji mode..
15:55ro_st-adds yak to queue-
15:56justin_smith🍪
16:04mi6x3mevening, can someone tell me of a project using expectations?
16:06schmeemi6x3m: using what?
16:06mi6x3mschmee: the library expectactions...
16:06schmeeahh, didn
16:06schmee't know about that, looks cool
16:07mi6x3mschmee: popular and nice testing library :)
16:07mi6x3mbut cant figure out the naming scheme for test files
16:09justin_smithmi6x3m: what kind of content?
16:11mi6x3mjustin_smith: well give a namespace x.y.z how would you name the test file?
16:11mi6x3mx.y.z-expectations?
16:13justin_smithx.y.test.z
16:13justin_smithunder a parallel source tre under test/ rather than src/
16:13justin_smith*tree
16:14mi6x3mjustin_smith: yeah that one's clear :)
16:15mi6x3mjustin_smith: I would rather use the same tree just append "-test" to every leaf
16:16justin_smithsure, that's another option
16:25mi6x3mjustin_smith: what is the difference between use :only and require :refer ?
16:27justin_smithmi6x3m: off the top of my head, I forget, I do know that require :refer is preferred though - it may have something to do with the namespace mappings that are generated
16:28mi6x3mjustin_smith: seems to be equivalent http://stackoverflow.com/questions/10358149/in-clojure-1-4-what-is-the-use-of-refer-within-require
16:28arrdemgfredericks: how is lein lein possibly useful
16:28justin_smithmi6x3m: yeah, I just experimented, and they led to identical ns mappings it seems
16:28technomancyarrdem: 無
16:28gfredericksarrdem: so say you needed to run a leiningen task
16:29gfredericksbut for some reason you were using leiningen
16:29gfrederickslein-lein lets you tie those two together
16:29gfrederickswe all love using leiningen, but sometimes you just need to run a leiningen task
16:29technomancy"It's synergy"
16:29gfredericksclojurebot: lein-lein is https://github.com/gfredericks/lein-lein
16:29clojurebotOk.
16:29arrdemhttp://www.arrdem.com/i/upset.gif
16:31technomancygfredericks: what the heck did you do to your readme
16:31justin_smithtechnomancy: it bothers me that emacs tells me that is "CJK IDEOGRAPH-7121" rather than anything mentioning "mu"
16:31gfrederickstechnomancy: huh?
16:32ro_sttechnomancy: where can i find intel on getting a list of all the jars that will load in a lein project?
16:32technomancygfredericks: the copyright sign
16:32Rayneswhat
16:32technomancyjustin_smith: oh, that is regrettable
16:32RaynesI stop in here for 5 minutes
16:32RaynesAnd I get lein-lein
16:32technomancygfredericks: it copies as :copyright: instead of ©
16:32gfrederickstechnomancy: the plugin profile does that
16:33justin_smithRaynesRaynes: that's what you get for joining #clojureclojure
16:33technomancyhuh... maybe github screwed up their rendering
16:33technomancythe raw version is fine
16:33mikerodgfredericks: is lein-lein a serious thing?
16:33technomancythey always seemed a bit loopy for emoji
16:33mikerodI'm debating if it is a joke
16:33technomancyro_st: I'm not sure what you mean
16:34gfredericksmikerod: I'm interested to see how people use it.
16:34justin_smithro_st: perhaps you want "lein deps :tree"
16:34amalloygfredericks: yes lein | xargs lein
16:35mikerodhmmm
16:35mdrogalisgfredericks: Gonna fork it to lein-lein-lein. An improvement. One more, you see.
16:35mikerod`lein lein lein lein lein lein lein with-profile -user repl` hmmm
16:35mikerodI can see that being useful!
16:35technomancymdrogalis: careful... it's a slippery slope
16:35mikerod:P
16:35arrdemjust in case you type lein a bunch of times thoughtfully before you select a command..
16:36mdrogalistechnomancy: I don't have a problem! Just one more!!
16:36amalloyi could stand to have git-git
16:36mikerodarrdem: yes I was thinking if you accidentally forget how many times you've typed lein
16:36mdrogalisFor hesitation?
16:36mdrogalis`git`... "Ah, what did I want to type?.." `-git`....
16:36arrdemamalloy: if you build a git-git lemme know..
16:36arrdemor I may later today
16:36amalloyarrdem: it's easy to build; the trouble is i don't know how to make the tab-completion work for it
16:36ro_sttechnomancy: so i have a project.clj in a lein project. i want to load that project with lein.core, and generate a list of the jars on disk that would result from the dependencies in that project
16:37technomancyarrdem: https://twitter.com/technomancy/status/327234371813781505
16:37amalloywithout which it's pretty pointless
16:37ro_stso that i can walk through them doing… things
16:37arrdemtechnomancy: my god
16:37mdrogalisSoo good
16:38justin_smith(inc technomancy)
16:38lazybot⇒ 127
16:38justin_smiththat command line was fucking amazing
16:39justin_smithand congrats, you are almost too big for a byte now
16:40aeikenberryhello again!
16:40aeikenberryI have my macro working for the most part
16:40aeikenberryhttps://dpaste.de/Ou0T
16:40aeikenberrybut getting an exception afterwards that I can't seem to shake
16:40aeikenberryany ideas?
16:41aeikenberry(noob)
16:42technomancyro_st: sounds like `lein classpath` with the directory entries filtered out
16:42TimMcjustin_smith: Nah man, he's unsigned.
16:42technomancynot on the JVM!
16:43TimMc:-)
16:43TimMcI wish Java allowed you to use char as an unsigned int or whatever.
16:44justin_smithaeikenberry: have you tried macroexpanding your call?
16:44aeikenberryyeah
16:45aeikenberry(if (= 1 8) ((println (quote ok)) (println (quote cool))) ((println (quote nooooo)) (println (quote noooo)) (println (println (quote wellok)))))
16:45justin_smith,((println "OK")) aeikenberry:
16:45clojurebotOK\n#<NullPointerException java.lang.NullPointerException>
16:45justin_smithit prints, that returns nil, then it tries to call nil as a function
16:45justin_smithyou want do
16:46justin_smith(cons 'do (for ...))
16:46justin_smithon each branch
16:46justin_smithand after that, if you use macros again, learn ` / ~ / ~@
16:46aeikenberrythat's what i had before, but it would only print the last quote
16:46aeikenberryi need a way to ensure they all get printed
16:47justin_smithdo will not prevent that
16:47aeikenberryi still plan on using the those symbols once it's 100%
16:48aeikenberryneed to learn more about them though
16:48aeikenberrylike the difference between ~ and ~@
16:48justin_smith,(do (defn first-if-key [coll] (if (or (= (first coll) :then) (= (first coll) :else)) (first coll) coll)) (defmacro multi-if [test & args] (let [chunks (partition-by #{:then :else} args)] (let [chunkmap (apply hash-map (map first-if-key chunks))] (list 'if test (cons 'do (for [x (:then chunkmap)] (list 'println x))) (cons 'do (for [x (:else chunkmap)] (list 'println x))))))) (multi-if (= 1 8) :then 'ok 'cool :else 'nooooo 'noooo
16:48justin_smith(println 'wellok)))
16:48clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
16:48justin_smithtoo big :(
16:49justin_smithanyway, that version (which should be reformatted of course) does work
16:49aeikenberryah! i see what you mean now
16:52aeikenberrythanks man
16:52justin_smithalso, you could simplify first-if-key: (if (or (= coll [:then]) (= coll [:else])) ...)
16:52justin_smithnp
16:52justin_smithat least I find the above simpler, that's a style thing I guess
16:57dagda1anybody here familiar with the devcards source?
17:01justin_smithbhauman is sometimes on this channel (isn't here now it seems)
17:01justin_smith$seen bhauman
17:01lazybotbhauman was last seen quitting 3 weeks and 4 days ago.
17:10gfredericks$ lein do lein do lein do lein do lein do version
17:10gfredericksLeiningen 2.4.2 on Java 1.7.0-release OpenJDK Client VM
17:10gfredericks^ protip
17:10aperiodicgfredericks: time that
17:12gfredericksokay
17:12gfrederickssys 0m0.190s
17:12gfredericksreal 0m1.729s
17:13gfredericksis there a lein-time
17:13aperiodicthat's not too bad!
17:14mdrogalisAre we still going on about lein-*? D:
17:14mdrogalisThe revenge of lein-lein-lein.
17:14gfredericksaperiodic: it's all just one jvm
17:16aperiodichuh, is `do` implemented in the shell wrapper?
17:17gfredericksno...that's why it's one jvm
17:19aperiodicwell, if it were in the shell bit, then wouldn't the only jvm it would need to launch be the one needed for the version task?
17:20gfredericksleiningen tasks can run other leiningen tasks without needing another jvm
17:20gfrederickslike so: https://github.com/technomancy/leiningen/blob/master/src/leiningen/do.clj#L39-40
17:21aperiodicand so lein-lein treats the `lein` task as a no-op since there's already a lein running?
17:23gfrederickswell it's not a noop
17:23gfredericksit's the exact same thing that happens when you use `lein do` without any commas
17:25aperiodicah, that makes sense
17:27hyPiRionbut guess what happens when you do `lein do repl, trampoline repl, repl, trampoline repl`
17:27gfredericksO_O
17:28technomancyit tears a hole in the fabric of spacetime
17:29amalloyi bet lein doesn't like to have some tasks trampolined and others not
17:30adamtHi. Does anybody know when clojars.org will be back up again?
17:30hyPiRionamalloy: that's the "tears a hole in the fabric of spacetime" part, along with some repl bugs during shutdown
17:30technomancyadamt: it's just the splash page that's down
17:30aperiodicheh, `lein trampoline trampoline repl` works
17:30technomancyhttps://clojars.org/cheshire
17:31amalloydo you hear that, adamt? that's the sound of hundreds of programmers frantically checking that their builds still work
17:31aperiodicfor certain definitions of "works"
17:31adamtamalloy: most of all i just hear the noise of the fan, trying to keep this room calm..
17:32adamttechnomancy: thanks :-)
17:32technomancyhttps://github.com/ato/clojars-web/issues/235
17:32adamttechnomancy: and thanks for all the work you've put into various projects i depend on.
17:33technomancywish I had the time to actually fix it
17:34gfredericks(inc technomancy)
17:34lazybot⇒ 128
17:36technomancysweet; I made it.
17:36technomancywell, it's been fun. catch you cats and dogs later.
17:37gfrederickswait wait but what about unicode
17:37amalloytechnomancy has ascended to join me in #two-byte-clojure
17:38justin_smithamalloy: I prefer to call it #short-clojure
17:38amalloyjustin_smith: i like that better too, but i decided it wasn't quite as obvious, and misses the nice pun on two-bit
17:38justin_smithoh, I missed the two-bit pun
17:38technomancyalso I'm tall
17:39amalloyhah
17:39technomancythen again, tall is what they call the smallest drinks at starbucks
17:39amalloyjustin_smith: insensitive clod
17:42ro_stRaynes: does refheap expect pygmentize to be executable at the project root?
17:42ro_sti'm grabbing your highlight code for grimoire
17:43Rayneshttps://github.com/Raynes/refheap#usage
17:43ro_stoh, nm. i see :dir says where to do things
17:43Raynesbootstrap snatches pygments
17:43RaynesPuts it in the correct place
17:43ro_stcool, tx
17:44Raynesro_st: All you really need is pygmentize though
17:44gfrederickstechnomancy: they have short drinks too it's just a secret
17:44Raynesro_st: So if you can just pip install a recent version of pygments, you should be fine.
17:44ro_stok, cool, ta
17:44technomancygfredericks: inconceivable.
17:44Raynesro_st: The reason I'm fetching from bitbucket is because I needed to make patches frequently at first.
17:45technomancygfredericks: some places will even make a cup of french press for you if you ask nicely
17:45technomancywhat's weird is going to a place where you ask that and they're like "what's a french press?"
17:45justin_smithtechnomancy: I wonder if they will do pour-overs
17:45technomancyjustin_smith: a bridge too far
17:46technomancyfrench presses are pretty hard to screw up, even if you're not trained. but it's too easy to make a bad pour over.
17:47technomancyI had an indie place near where I live stop doing pour overs since there wasn't demand for it... I have to do puppy-dog eyes to get it now, and even then it only sometimes works.
17:47gfredericksthey've been doing pour-over every time I ask for a decaf for years
17:48technomancyno kidding?
17:48technomancylike on one of those ceramic cone things?
17:49hyPiRiontechnomancy: what? I think French presses are really easy to work with
17:49gfrederickstechnomancy: eeh, it mighta been plastic
17:49gfredericksno guarantees
17:49amalloyhyPiRion: that's what he said
17:49technomancyhyPiRion: yeah, hard to screw up -> easy to work iwth
17:50technomancygfredericks: still... hum. I will check next time I am forced to fall back on starbucks
17:50ro_stthanks Raynes i'm sorted
17:50amalloyi figured every building in seattle was a starbucks
17:50technomancyamalloy: that's what makes avoiding them such a challenge!
17:50hyPiRionoh. I have no idea why I thought you meant they were hard to work with. hrm
17:51gfredericksStarbucks: Fall back on us.
17:51technomancygfredericks: it's an acceptable plan B
17:51ChousukeI've only drunk coffee at starbucks once. In Japan :P
17:52technomancyactually they've started rolling out the clover brewer now supposedly, which might make things more interesting
17:52Chousukethey pretty much don't exist in Finland
17:52technomancyI guess it all depends on whether they're featuring any blends that aren't dark-roasted to hell on that particular week
17:52hyPiRionChousuke: It's the same over all of Fennoscandia
17:52gfrederickstechnomancy: I use starbucks when I get out of the city
17:52hyPiRionNo Starbucks here either
17:53gfredericksStarbucks: Let us be your lower bound
17:53technomancyChousuke: are there strong existing chains that have filled the gap?
17:53gfredericksmaybe they don't have the gap
17:54ChousukeAlso the best coffee ever I had in Japan too. some random old (like, 70-90 years old) guy kept a cafe on the Hachijoujima island. best coffee ever.
17:54technomancyChousuke: from what I can tell the pour-over renaissance in the US is largely fueled by imports from japan
17:54Chousuketechnomancy: I don't think we have a single chain so much as random coffee shops everywhere.
17:54hyPiRionThere are incredibly many small ones over here, but no big one.
17:55technomancykind of like how the west lost access to aristotle and only rediscovered his works through arabic translations
17:55technomancyhuh
17:55technomancybut yeah, all the pour over gear is Hario this, Yama that.
17:56gfrederickschemex
17:56technomancyhyPiRion: is there a general preference for supporting independent shops vs megacorps?
17:56ChousukeI make my own coffee with an aeropress mostly because it's decent and very easy.
17:56Chousukeit's also trivial to clean, which is really nice.
17:57technomancyyeah, taste:effort ratio of aeropress can't be beat =)
17:57hyPiRiontechnomancy: No, I don't think it is intentional.
17:57technomancycurious
17:58Chousukethere might not be enough people to support massive chain franchises
17:58Chousukeevery place needs a coffee shop in finland anyway
17:59hyPiRiontechnomancy: I think it's just that Norwegians drink insanely much coffee, and that small companies can actually live fine after bootstrapping
17:59hyPiRionI think every person over 15 year old drink 4 cups a day on average.
18:00technomancyyeah my grandmother is swedish and she guzzles it like water
18:00ChousukeFinns held the world record at some point. don't know if we still do
18:01amalloyhttp://en.wikipedia.org/wiki/List_of_countries_by_coffee_consumption_per_capita
18:01nathan7so have y'all built a Clojure-powered coffee maker yet
18:01hyPiRionChousuke: you still do by a large margin
18:02Chousukeseems so
18:02technomancysweden's gotta step up their game
18:02amalloynathan7: we can make a mean cup of java
18:02technomancymake for an all-scandanavian top-10
18:02nathan7amalloy: <3
18:02ChousukeI wonder why coffee is so popular in the nordic countries
18:03technomancyI'd be interested in seeing it by percentage of adult population that drinks coffee
18:03technomancyrather than by kg
18:03hyPiRionChousuke: yeah, it's strange that it's such a dramatic difference
18:04hoverbearHey folks, I'm getting a cljs error (I think?) https://gist.github.com/Hoverbear/3bd455c73786c7ffb70f#file-gistfile1-txt-L66 any suggestions on how to dig into this? My project.clj is at the bottom in comment
18:06Guest58805Hi, I have a question about def: https://gist.github.com/kurtenbachkyle/866136fba285385badc9
18:06Guest58805Am I missing something about how def works?
18:07gfredericksnope
18:07gfredericksyou're missing something about how quote works
18:07gfredericks,(def foo-1 {:a 1})
18:07clojurebot#'sandbox/foo-1
18:07gfredericks,(def foo-2 {:a 2})
18:07clojurebot#'sandbox/foo-2
18:07gfredericks,(def foos '(foo-1 foo-2))
18:07clojurebot#'sandbox/foos
18:07gfredericks,foos
18:07clojurebot(foo-1 foo-2)
18:07caternfoos is a list of the symbol "foo-1" and the symbol "foo-2"
18:08gfredericks,(str foo-1)
18:08clojurebot"{:a 1}"
18:08gfredericks,(str (first foos))
18:08clojurebot"foo-1"
18:09caternif you want instead to make foos be a list of the values of those variables, use ` and ~
18:10catern,`(~foo-1 ~foo-2)
18:10clojurebot({:a 1} {:a 2})
18:10justin_smithor you could call list
18:10justin_smithor use a vector literal
18:10caternbut preferably call list, yeah
18:10Guest58805ok. That makes sense.
18:10mdrogalistechnomancy: Your cousin, I presume? https://github.com/technoweenie
18:10gfredericks,(def other-foos [foo-1 foo-2])
18:10clojurebot#'sandbox/other-foos
18:10gfredericks,other-foos
18:10clojurebot[{:a 1} {:a 2}]
18:10technomancymdrogalis: yeah, we used to get confused for each other all the time
18:10technomancyback when I did ruby all the time
18:11mdrogalistechnomancy: I can't tell if that's serious or not.
18:11technomancyno, for reals
18:11amalloytechnomancy: "get confused for each other" sounds vaguely flirtatious
18:11mdrogalisOh man, haha.
18:11gfredericks(inc amalloy)
18:11lazybot⇒ 152
18:11Guest58805thanks for the help.
18:11mdrogalisPretty good way to hint at someone that you've had an affair.
18:12mdrogalis"We were uh.. Confused for each other. Or something."
18:12amalloylike, not that people confuse you with him, but that you two run into each other and are like...whoa. hey. sorry if i'm uh. not very articulate. you just confuse me
18:12technomancyI blame cycling tab completion
18:12technomancyhaha
18:12amalloytechnomancy: i wish my bike had tab completion
18:12mdrogalisHeh
18:13technomancyfor changing gears?
18:13amalloyjust because technology is fun
18:13amalloyi'd be riding along, hit tab, and be content to know that my bike is thinking of a file, or a user in #clojure or something, even if i don't know who
18:13gfredericksyeah like when I get on the lake front trail I would hit tab and I'd be at the end
18:14hyPiRionnothing like good old M-x bicycle-mode
18:14amalloyhyPiRion: i don't think it's possible to resist seeing if that exists
18:14justin_smithI tried it, but got pushed off the road by eclipse
18:14amalloybut even M-x bic<tab> doesn't work. you'd think there'd be a bic-lighter-mode at least
18:15technomancyif there's not a guy out there with a raspberry pi duct-taped to his water bottle holder then I don't even know what the point is
18:15amalloythere are probably enough such people to form a small city
18:17justin_smithhttps://sites.google.com/site/unipiper/ speaking of cities with weirdoes and foot powered wheeled vehicles
18:18justin_smithhttps://sites.google.com/site/unipiper/_/rsrc/1402983008858/home/gandalf_banner.jpg
18:23technomancyclassic
18:33arohnertab completion is magical though. I started getting into the habit of hitting tab for things that couldn't possibly be completed, like this text box
18:33arohner"tab completion is mag<tab>"
18:34technomancyhehe
18:34justin_smitharohner: the "it's on the tip of my tongue" button
18:35hiredmanI had an irssi plugin that would tab complete based on the system dictionary
18:35caterntab completion for the english language. driven by a markov chain generator that analyzes all your emails
18:35caterngood thought
18:41arrdemevery android keyboard ever tho
18:43caternyes
18:45TimMcarohner: That's completeable.
18:45danielcomptonarrdem: and iOS8 keyboards soon
18:45arohnerTimMc: that specific example was
18:45arohnerbut what about "TimcMc: <tab>"?
18:45TimMcwasn't there an XKCD about this...
18:45arohnerprobably
18:45amalloyTimMc: tab completion is magenta
18:45arohner<tab>
18:47justin_smith,(partial \tab)
18:47clojurebot\tab
18:47justin_smithlol
18:47TimMcarohner: http://xkcd.com/1068/
18:48hoverbearAre NREPLs TCP or UDP based?
18:49hiredmanI believe the bencoded nrepl transport is tcp based
18:50hiredmanbut nrepl sits on top of a transport, so there are http transports, message queue transports, etc
18:50hiredmanthe bencoded nrepl transport is what lein uses I think
18:50technomancyUDP nrepl transport sounds super sketch
18:50hoverbearYeahh....
18:51justin_smithwell, localhost only would be fine
18:51hoverbearHaving a hell of a time connecting to an nrepl in a docker container :S
18:51justin_smithhoverbear: by default it is localhost only
18:51justin_smithit probably thinks your host container is not "local"
18:51hoverbearjustin_smith: That'd be a problem.
18:51justin_smithhoverbear: you could use ssh -X to make a forwarded port
18:52justin_smithor maybe there is a config hiding somewhere to open it to outside hosts (with the scary implications that come with that...)
18:52hoverbearjustin_smith: I can probably bind it to 0.0.0.0
18:52rlbdoes anyone know to what extent the EPL and LGPL are (in)compatible? i.e. could I use EPLed code to create a guile module, for example?
18:52hiredmanhoverbear: how are you starting the nrepl server?
18:53justin_smithhoverbear: since the idea of opening nrepl to other boxes seems terrifying to me, I always just make an ssh tunnel, but when connecting to a vm, you may want to do things differently, dunno
18:53hoverbearhiredman: Via immutant
18:53hoverbearhttps://gist.github.com/tobias/24770e9514cf60752f7c
18:53hoverbearjustin_smith: For sure, thankfully it's a private link to my host behind a firewall
18:54amalloyjustin_smith: -X? why would you want to forward the X server?
18:54amalloyi think you mean -L or -R, but if i'm wrong i'd be curious to hear why
18:54hoverbearjustin_smith: You were right, +1!
18:54sritchiedoes anyone know how to do a nested validation with validateur?
18:55justin_smithamalloy: yeah, sorry, brain-fart, I meant -L
18:58danielcomptonjustin_smith: https://github.com/mtnygard/ssh-repl
18:58justin_smithdanielcompton: nice!
18:59danielcomptonhoverbear: you could use https://github.com/mtnygard/ssh-repl but don't deploy to prod
18:59rksmhoverbear: with vagrant I usually have vbox setup a private network and start repl on 0.0.0.0 (config.vm.network :private_network, ip: "192.168.50.4")
18:59danielcomptonhoverbear: just thinking about it makes me cringe a little
19:03rlbAfter some advice from technomancy I started working on an authenticated repl (shared random token for now), but only got to the server-side before being side-tracked. With any luck I'll get back to it soon.
19:03rlbBut you'd still need an ssh tunnel (or similar) for remote use.
19:03hoverbeardanielcompton: Hey, I understand. It's behind a firewall though and the docker link is 127.0.0.1 so it can't be touched outside.
19:04rlbThis would mostly be to keep from opening up your account to everyone else on the machine when you run the repl.
19:06amalloyi look forward to seeing 'privilege escalation via nrepl' hit the front page of hacker news. that's when we'll know we've made it big
19:07arrdemlol
19:08danielcomptonamalloy: "How to take control of any Clojure programmer's computer"
19:09amalloydanielcompton: tell him about this new shell that's purely functional. he downloads and runs it. remote code execution
19:09danielcomptonhahaha
19:10mthvedtpurely functional shell?
19:10mthvedtdon’t give haskell programmers ideas
19:10hoverbearamalloy: It's not purely functional then
19:11hoverbearPure programs are useless, theres no side effects, like output.
19:11hoverbear(Snicker)
19:11amalloymthvedt: to install it, run `echo 'rm -rf --no-preserve-root /' > funshell`; then `sudo funshell` to start it up and you'll be a cool kid in no time!
19:12mthvedtamalloy: can’t infer instance of monad
19:12amalloy(for the safety of those following at home by just typing in random crap they see, this command will not actually work)
19:12danielcomptonamalloy: that looks like it would work?
19:13amalloydanielcompton: there's no chmod +x
19:13amalloyplus . shouldn't be in your PATH for sudo to find
19:13danielcomptonamalloy: don't worry, I chmod -r +x / in the background on every shell exeution
19:14mthvedtamalloy: i automatically set everything to +x for convenience
19:14amalloydanielcompton: -R; -r is different
19:14mthvedtthat way i never have annoying chmod messages
19:14danielcomptonmthvedt: I know right?
19:16danielcomptonyou know what they say, everything's a hoot when you're root
19:27DomKMDesign/performance question: If you have a function that returns an object that implements a protocol using the function's arguments, would you use reify within that function or create a type with deftype that implements the protocol? I realize that you can do either, and I'd personally prefer reify if the type isn't used otherwise, but I don't fully
19:27DomKMunderstand the performance implications of reify. Here's an example: https://www.refheap.com/88733
19:28amalloyDomKM: reify
19:28amalloythe performance difference is basically zero: reify is much like an anonymous deftype
19:29DomKMGreat, reify it is. Thanks amalloy
19:29mlb-How might I find the directory my uberjar is running from?
19:29technomancymlb-: (System/getProperty "user.dir") iirc
19:30mlb-err, I mean to say, the directory the uberjar is in, not the working directory where the java -jar incantation takes place
19:30justin_smith,(.getCanonicalPath (java.io.File. ".")) here's a fun one
19:30clojurebot#<SecurityException java.lang.SecurityException: denied>
19:30justin_smithclojurebot: you're no fun
19:30clojurebotGabh mo leithscéal?
19:32mlb-technomancy: but thanks, I might be able to make some headway with that =]
19:33justin_smithmlb-: well, that gets neither, it gets the directory the user who ran the jar is currently in (the working directory)
19:34justin_smith(as does my example)
19:36mlb-I'm aware. At $DAYJOB, I'm shipping Clojure code to Windows machines, but the "java -jar" command will be issued by a batch file. Provided the batch file sets the working directory to where the uberjar lives, it should provide the path I'm looking for.
19:40justin_smithas for the location of the jar itself... (-> #'myns.core/init meta :file java.io.File. .getCanonicalPath) is one hack
19:40justin_smithor wait, that won't get the path to a jar containing myns.core...
19:41justin_smithmlb-: bigger picture, an invocation of java could have multiple jars, in multiple directories, all in classpath
19:41amalloyi'm not really sure you're entitled to know what jar you're running from
19:41amalloyyou might not be running from a jar at all
19:43mlb-Sorry to be asking an XY Problem. What I've got is my uberjar and a separate jar containing resources I want to access. When deployed upon the end user's machine, they'll reside in the same directory.
19:44hiredmanis there a reason not to just put the second jar on the classpath?
19:44amalloyor indeed include it in the uberjar
19:46mlb-hiredman: unless I'm reading wrong, the -jar option clears both the -cp and -classpath options, and the CLASSPATH env var.
19:46hiredmanmlb-: sure, just don't use the -jar option
19:46hiredmanjava -cp uberjar.jar:other.jar mainclass
19:46mlb-amalloy: It's intentionally decided to be kept out of the uberjar to allow a 3rd party service to replace the secondary jar
19:47mlb-hiredman: oh? I'll have to try that!
19:47hiredman'java -cp uberjar.jar:other.jar clojure.main -m main.namespace' is good too
19:52mlb-hiredman: okay, so I certainly see the other jar in the classpath, but how do I access the resources in it? I've tried (clojure.java.io/resource "other.jar"), but no luck :(
19:53amalloy(resource "whatever.txt"). you don't need to know what jar it's in
19:53justin_smithmlb-: if other.jar is in the classpath, you can access its contents relative to its top level
19:55mlb-that's useful!
19:56mlb-wait, what if there are resources by the same name in different jars in the classpath?
19:57hiredmanresources will return a list
19:57technomancyhuh, I didn't know that was built-in
19:57amalloyi didn't either
19:58hiredman*tada*
19:59amalloyhiredman: where is resources?
19:59technomancyum ... yeah
19:59technomancyabout that
20:00hiredmandamn
20:00hiredmanreally?
20:00hiredmansorry, I could have sworn that existed
20:00technomancyit should exist
20:01hiredmanhttps://gist.github.com/hiredman/aeb55c7b54c4a6b48ca1
20:01hiredmanerr
20:01justin_smithhiredman: man, I was gonna say, mind=blown because I assumed first resource matching a path hid all else...
20:01amalloyjustin_smith: i think it does, really
20:01technomancyjustin_smith: turns out I implement resources twice in Leiningen
20:02hiredmanyeah, just not in clojure.java.io
20:02technomancyjustin_smith: you can "see through" the first thing if you learn the secret
20:02hiredmanbut you can call getResources on a classloader
20:02hiredmanI could have sworn that existed
20:02hiredmanheh
20:03hiredmanit does, in the utils namespace at work
20:03hiredmanand getResources returns an enumeration yetch
20:03amalloyhiredman: at least there's enumeration-seq
20:03hiredmanyep
20:03technomancyavert your eyes because this is terrible, but https://github.com/technomancy/leiningen/blob/master/src/leiningen/release.clj#L106
20:04hiredmanhttp://stackoverflow.com/questions/948194/difference-between-java-enumeration-and-iterator
20:04hiredmanso it sounds like enumerations are 100% better than iterators
20:05amalloyhah
20:05mlb-so.. the actual answer is that clojure.java.io/resource will return the file belonging to the *last* .jar in the classpath?
20:07hiredmanmlb-: it is slightly more complicated than that, because in reality resources are loaded from classloaders, the most basic of uses this thing called a classpath, but there are many others that don't
20:07mlb-ah, okay. Good to know
20:08hiredmanI could point a a url classloader to a jar on a webserver somewhere, set that as the context classloader, then io/resource would load from the jar file on the webserver
20:10gfrederickshiredman: ha re SO
20:12amalloygfredericks: 'ha' is not a musical note
20:12mlb-hiredman: so then... I should do my own conflict resolution bit?
20:13amalloywhy is there a conflict? this resource is supposed to be in other.jar; are you expecting it to be somewhere else as well?
20:13mlb-amalloy: Yes. I make mistakes and I've got coworkers.
20:15amalloybut you think you can write code that will automatically and correctly handle that conflict? i think you're better off just saying "don't have two of these"
20:18mlb-amalloy: Were I not working on a team, such a simple soltuion would suffice.
20:19mlb-instead, I'll just write code to compare the name of the jar that contains a resource.
20:27technomancywho was asking about names yesterday? http://random-name-generator.info/
20:27technomancyI still prefer gfredericks' approach if you need something in a jiffy, but there you have it
20:28technomancy[dakota/lightfoot "0.1.0"] ; works for me
20:29justin_smith(mana/quarles "0.0.1-SNAPSHOT")
20:29technomancyneeds an api and a lazybot plugin
20:39mlb-technomancy: Now I want to know, what's the gfredericks' approach?
20:40technomancymlb-: hit wikipedia's "random article" till you find a person; use their name
20:40technomancyor maybe it's just till you find a proper noun?
20:40gfrederickspersonal name
20:40technomancythere we go
20:41gfredericksI am known primarily for my library naming strategies
20:41TEttinger##(clojure.string/join " "(repeatedly 998(fn[](apply str(concat(rand-nth[[(rand-nth["B""D""G""C""F""T""K"])(rand-nth["r"""""""""])][(rand-nth["S""L""Th""Ch""Sh""L""Y""W""Z""V""M""N""T"])]])(take(+ 2 (rand-int 3))(interleave(repeatedly #(rand-nth ["a""o""e""i""u""a""o""e""i""au""oi""ou""oo""ai""ee"]))(repeatedly #(rand-nth ["s""p""t""n""m""b""mb""rd""g""st""f""rt""sp""ch""rl""x""sh""y""ng"])))))))))
20:41lazybot⇒ "Kourt Wey Frespo Gosh Tog Baifaust Dorda Chombi Diy Nost Thetosh Yoonasp Toirdord Leng Yoyi Mang Lerla Tispemb Soorlerd Bairtoy Cuchoo Ceebo Vespa Zarl Noim Mooti Lap Tusoof Gigort Wogit Yaub Moospu Wapamb Taum Bartoost Meeng Faufe Daitu Fif Moonging Chaub Goox Vegu... https://www.refheap.com/88735
20:42TEttingerstar wars names!
20:42technomancythat's eerily good for something that looks like a swearjure program gone wrong
20:42TEttingerhaha it really hits the limits of an IRC message
20:44gfrederickswhat's a swearjure program gone right look like?
20:44TEttinger(imv gfredericks)
20:44TEttinger(inc gfredericks)
20:44lazybot⇒ 78
21:05technomancygfredericks: well, it has fewer alphanumerics than the above =)
21:13gfrederickstechnomancy: alphanumerics in a swearjure project are technical debt
21:15gfredericksomg guys these toy train sets are so topological
21:16gfredericksI just accidentally discovered a sort of semi-orientable track layout
22:17TimMcgfredericks: C-loop?
22:20gfrederickseh?
22:20TimMcMaybe that's not the name for it.
22:20gfredericksI'm thinking a track is orientable if a train, by only moving forward, cannot flip itself around
22:20TimMcyeah
22:21TimMcA C-loop allows a train to turn around.
22:21gfredericksand this track allows the train to flip one way but not back
22:21TimMcMaybe it's just called a reverse loop.
22:21TimMcheh, nice
22:22TimMcgfredericks: I had a moment the other day while trying to maneuver a large desk up a flight of stairs where I was thinking "OK, we have to make sure to turn it the right number of times so that it doesn't end up inverted front to back" and then I remembered that my house is at least locally an orientable space.
22:23gfredericksha
22:23gfrederickshere's the simplest version of the semi-orientable track: http://upload.gfredericks.com/butt.png
22:23gfredericks(it kinda looks like a butt)
22:23TimMcA housemate pointed out that this would have been OK with them (just turn it around), but I think it would have made any future disassembly with a screwdriver rather surprising.
22:24gfredericksif you're heading north up the middle you can't ever switch to heading south down the middle
22:24gfredericksbut the opposite is the opposite
22:25TimMcgfredericks: And you can only traverse the top bar once.
22:26gfrederickstrue
22:26gfredericksI realized you can formalize it as a directed graph, where the track pieces between the intersections correspond to two vertices
22:26gfredericksone for heading one way and another for heading the opposite way
22:26gfredericksand the intersection specifies what points to what
22:28gfredericksso in this case the graph would have two connected components, where one has two edges into the other, both of which are the top bar
22:30TimMcgfredericks: So what is the simplest track such that for all points there is a direction a train may be placed on that point such that it has the possibility to traverse the entire track and also may make a decision that will restrict it from ever reaching certain portions of the track but will still ahve the opportunity for indefinite forward motion.
22:31TimMcI believe it is this: https://i.imgur.com/9LaZFDg.png
22:32TimMcHmm, no. That violates the "any point" rule.
22:32TimMcHow about "there exists a point and direction".
22:33gfrederickswe need a word for point + orientation
22:34TimMcLet us definte point to include orientation. :-P
22:35TimMc"directed point"
22:36mthvedti studied the topology of paths over topological spaces in colleg
22:36mthvedte
22:36mthvedtbut i can’t help because i forgot all of it
22:37Jabberzso question on functions that call databases... would it be better to pass in the db-spec/connection pool as a parameter, or retrieve it within the function via a var or calling another function
22:38Jabberzie should something like (defn lookup-user..) be more pure, by taking a db-spec as a param
22:39sritchiednolen_: for a case where a parent component needs to distribute some async state to a bunch of subcomponents,
22:39sritchiednolen_: (thinking data for autocomplete fields),
22:39sritchiednolen_: would you recommend a core.async mult, or just sticking a future in init-state?
22:40sritchieoh, I guess there’s no future in cljs
22:40TimMcgfredericks: Here's the graph of the "g" track: https://i.imgur.com/YrzZzZw.png Three pairs of points for the three intersection-divided segments.
22:41jeremyheilerJabberz: pass the db in.
22:41sritchiednolen_: I can jam it into the global state so everyone can just share
22:42Jabberzjeremyheiler: that's what I was leaning to, eliminate those internal dependencies within the functions
22:43jeremyheileryep. if you really need to, you could close over the db with an anonymous fn and pass that somewhere that doesn't have access to it.
22:43jeremyheilerJabberz: ^
22:49Jabberzjeremyheiler: does this naturally lead you towards something like component or trapperkeeper? I feel like as soon as you start managing abstractions with closures or partials, might as well formalize the dependency relationships between, for lack of a better term, modules or groups of functions
22:55TimMcsritchie: You heard it here, folks, "there’s no future in cljs".
22:55sritchie:)
23:02jeremyheilerJabberz: at a system level, yes. internally, not really.
23:22justin_smithTEttinger: silly 80 column restriction of your star wars name generator https://www.refheap.com/88737
23:22TEttingerha, 16 lines in a single message
23:23justin_smithwell, 16 is one way to break it up
23:23justin_smithdid you make it as a one liner, or do you have a more normal breakup of the original?
23:25TEttingerI made it as a one liner submitted to lazybot
23:25TEttingerlazybot is not here?
23:26timsgHey, has anyone here used Clojure-CLR, or, better, have a Clojure-CLR project set up that they can run a repl against? I’m mutating records with set! and need a sanity check, maybe I messed up the build or something
23:28justin_smithtimsg: how do I run it?
23:28justin_smith(I installed it ages ago, and I forget)
23:28justin_smithnever mind, I have it
23:29justin_smithtimsg: got a repl log I can follow along?
23:29timsgjustin_smith: great, I’ll send you a refheap thing in a minit
23:30timsgjustin_smith: https://www.refheap.com/88738
23:30timsgjustin_smith: oops, typed too fast, that won’t work
23:30timsgjustin_smith: https://www.refheap.com/88739
23:32danielcomptonIn Cider, is there a way to set the point back onto the repl entry point? So if I've scrolled up three pages and want to get back to the 'REPL' input line, what would I press?
23:34jeremyheilerdanielcompton: M-> wil jump to the end of the buffer
23:34danielcomptonjeremyheiler: thanks! That's just what I needed
23:34jeremyheilerdanielcompton: that's a general emacs trick. not cider specific
23:35justin_smithtimsg: I got identical results
23:35timsgjustin_smith: o god that’s terrible
23:35danielcomptonjeremyheiler: yeah, I was trying it on other buffers and noticed that.
23:35timsgjustin_smith: I think this means all user-defined types in Clojure-CLR are mutable
23:37timsgjustin_smith: what version of Clojure-CLR are you using, and what are you running it against (Mono or something else?) I’m using 1.5.0 and running it against Mono on OSX. I hope this is some undiscovered bug endemic to that configuration
23:39timsgmono 3.4.0
23:40justin_smithI have an old one, 1.4.1
23:40timsgbbloom: if you’re there, might need some clr insight
23:43swgillespiei've got clr insight but not clojure insight :p
23:45mindbender1How can I resolve the following clojure compilation errors: https://gist.github.com/johnbendi/9b4f5f1f46c270f63b51#file-clojure-compilation-failure ?
23:46sritchiecan anyone help me figure out how to call this .typeahead function via cljs? https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md
23:46sritchieit looks like the jquery plugin has added the function to any object
23:47sritchieBUT I can’t just call .typeahead, that seems to fail
23:51amalloyit doesn't put .typeahead on every object (it can't); it just puts it on all jquery elements
23:51DomKMsritchie: Can you call it on any object from plain js instead of cljs? The readme leads me to believe it's available on jquery objects, not any object.
23:51trptcolingfredericks: good job on lein-lein. you’re truly doing the Lord’s work
23:51sritchielooks like I had to wrap it in $, yeah, my bad
23:51sritchieokay, getting closer, thanks