#clojure logs

2015-12-15

00:00pyonDoes the suffix "-SNAPSHOT" have any particular meaning in package versions?
00:00justin_smithyes, it means it's experimental, and a new version could be released at any time
00:01pyonAh, thanks.
00:01justin_smithif it's been more than 24 hours since lein last checked, it will check for a newer version of the SNAPSHOT
00:01pyonAh, smart. :-)
00:02justin_smithin general, I avoid SNAPSHOT releases, they are big sources of weirdness
00:02justin_smithsince you can have code that works one day but is broken the next due to the auto-update
00:32ben_vulpesso uh what's the best way to get a bower/npm shitshow package wired into my clojurescript project; clone it locally and stick src/* into my cljapp resources/js/ folder?
00:40ben_vulpesoh man i wish it were this easy. GRUNT UP.
00:41tolstoyAre you integrating CLJS into a node project, or trying to use random libs in a basically full CLJS project?
00:44Seyleriustolstoy: Well, damn. I just looked at that cluj thing you linked. Shiny.
00:44SeyleriusVery shiny
00:44tolstoyIt's fun! ;)
00:45tolstoyI'm actually using it now to create a repl with datomic stuff to try and explore a model. Which is not what I intended. ;)
00:56tolstoyCider's getting really nice. Even has that thing where the function has the font-lock applied if it has been defined, not if not. One of those old IDE features.
01:20ben_vulpestolstoy: the latter
01:20ben_vulpesand the answer turned out to be "grunt build" and then cp ~/where/i/want/this.js
01:20ben_vulpescp thinger ~/where/i/want/it.js
01:20tolstoyI've little experience with that stuff, but I've just used the non-NPM versions dumped in the resources dir.
01:20ben_vulpesnah i got it tolstoy
01:21tolstoyYeah.
01:21ben_vulpesi'm attempting to set {:style {:color "red"}} on reagent elements made via a do loop, but just getting react-y STYLE strings interspersed in the dom, anyone run into something like this before?
01:22tolstoyDo loop doesn't return the whole sequence?
01:22tolstoyUse "for"?
01:23ben_vulpesderpdorp attributes first then element value
01:23ben_vulpesbetcha i won't bollox that up again
01:39pyonIs there some way to do file I/O without using Java's standard library? (FileReader, etc.)
01:40tolstoypyon clojure.java.io
01:40pyonAh, thanks, will look.
01:40tolstoyhttps://clojure.github.io/clojure/clojure.java.io-api.html
01:40tolstoyThere's also Raynes' nice lib: https://github.com/Raynes/fs/
01:41pyonChecking.
01:59pyonWhoa, tentacles is an awesome library. :-)
02:19pyonHow do I tell Leiningen to fetch dependencies from http://clojars.org/ ?
02:20tolstoyI think it does by default.
02:20tolstoyBut there's a :repositories key in project.clj.
02:20pyonAh, thanks. :-)
02:20j-pbtolstoy: it looks in multiple places, leiningen is one of them
02:21tolstoyThe bible: https://github.com/technomancy/leiningen/blob/master/sample.project.clj
02:21pyonChecking.
02:22tolstoypyon That's show you the syntax for adding repos if you're unsure about clojars.
02:22tolstoyAlso, "lein sample".
02:45beakyhello
02:45beakyhow do i make http requests in clojure
02:46TEttingerI mean, you can sometimes get away with slurp on a URI, though that is not exactly a way to make a proper request
02:46TEttinger(don't think it sets parameters)
02:46beakyoh
02:46TEttingerI don't uh do webdev
02:46TEttingerjustin_smith, and/or amalloy, heroes of #clojure, assemble?
02:47tolstoybeaky: You can use one of the clojure libs for that.
02:47tolstoyFor instance, https://github.com/dakrone/clj-http or http://www.http-kit.org/client.html
02:48beakywow thanks
02:48beakywill try those
02:48tolstoyOh, and: http://aleph.io/aleph/http.html
02:49tolstoyThe great thing about aleph is you can implement a server-side web-socket client.
02:49tolstoyBut http-kit has no dependencies, which is nice.
02:51beakyi love clj-http
02:53tolstoyIs clj-http async?
02:54beakyi think not
02:55beakyhttpkit is async out of the box i think
02:55tolstoyAlso aleph.
03:01TEttingeraw, we had lazybot briefly
03:08slesterfor some reason, this code is really really slow... anyone want to take a look? :(
03:09TEttingerto the refheap!
03:10slesterhttps://www.refheap.com/112706
03:10TEttingerslester: what's some general background info on the type of application, what it does, what "really slow" means...
03:10slesterspoilers on advent of code if that matters
03:11TEttingerheh, it has spoilers?
03:11slesterwell, it's taking 5+ minutes to run that when I was assuming others are in 30 seconds or so
03:11slesterwell if you don't want to see a slow working solution :(
03:11slesterit gets the right answer, just in 5 minutes
03:11TEttingerhuh
03:13slestersimilar to a thing I was doing with strings -- right answer, but because of how I built it, took forever
03:13TEttingerI forgot the site for advent of code
03:13slesteradventofcode.com?
03:13slesterthis is day 15
03:14TEttingerI did day 3 in a one-liner, sorta didn't keep up not doing that whole time traveler jesus birthday spending season thing
03:15TEttinger(history puts jesus as being born in the spring even when you account for the months getting shifted around... but that overlaps with easter and not the stolen pagan holidays at the solstice)
03:17TEttingerah, day 15 is an optimization problem
03:18slesterthis is really about santa, not jesus
03:18TEttingertaking the christ out of christmas eh? bold move
03:18TEttingerWAR ON CHRISTMAS EVERYBODY NEEDS MORE GUNS
03:19slesteryep sounds about right!
03:20TEttinger(yes hanukkah is over, technically. but in a world of make-believe, can't the oil have lasted for 16 nights?)
03:21slesterback in those days, 2 of their days was 1 of our days
03:21slesterso yeah!
03:22TEttingerneed moar scifi
03:22slesteryes something like that
03:22slestermore parsecs
03:22TEttingerlol
03:23TEttingerI'm pondering this problem as best I can... but since I'm not creating an account, making their tracking telemetry just that much more onerous...
03:25slesterjust block trackers/ads
03:25slesterhaha
03:26TEttingerthe dude seems like he isn't doing it for the tracker sales revenue, he contributed to OSCON... but I'm still a grinch
03:26slesternot really sure what the bottleneck is
03:26TEttingerquick stuff:
03:26TEttinger(pmap #(bake-cookies %) ...) can be changed to (map bake-cookies)
03:26TEttingererr
03:27TEttinger(pmap #(bake-cookies %) ...) can be changed to (map bake-cookies ...)
03:27TEttingerfor the same ...
03:27TEttingerthat avoids creating a zillion anon fns in parallel
03:27slesteroops, yeah, refactored codes
03:27TEttingerand it may only give it one core, so pmap ends up being much slower
03:28pyonHow do I read a password from stdin, without display it on the screen? (Assuming I'm running my program from a shell.)
03:28slestergotcha.
03:28TEttingeris it running on your machine or a sandboxed one, slester?
03:28slestermy machine
03:28TEttingerpyon: hm, check the docs for uh whatever type System/out is
03:28TEttinger,(class System/out)
03:29clojurebotjava.io.PrintStream
03:29TEttingeror System/in too
03:29TEttinger,(class System/in)
03:29clojurebotjava.io.BufferedInputStream
03:29beaky,(doc System/out)
03:29clojurebotNo entiendo
03:29beaky:(
03:29TEttingerit's java it doesn't have clojure docs
03:29slesterbeaky, why does clojurebot hate you?
03:29slesteroh
03:29slesterright, haha
03:31TEttingerslester: so pmap can still have a lot of overhead if the problem isn't both massively parallel and sufficiently time-consuming for each item
03:31slesterthis is apparently super time consuming :| not sure if it's for the (apply max) part or bake-cookies
03:32pyonTEttinger: Thanks! Checking.
03:32TEttingermore overhead from creating Threads for the more items, which can be offset to be a gain if and only if each item takes a while to process and can be completed without needing other threads
03:32TEttinger(doc time)
03:32clojurebot"([expr]); Evaluates expr and prints the time it took. Returns the value of expr."
03:33slesteryeah... ok, well the map takes like 3 seconds
03:33slesterso it's the apply max part that's taking an eternity
03:33TEttingerwow
03:33TEttingerso half and half
03:34TEttingerwait I thought.... oh 30 seconds
03:34slesterso apply max is taking 4 minutes
03:34TEttingeroh more
03:34TEttingerha
03:34TEttingeroh!
03:34TEttingerthat's because pmap is lazy
03:34slesterwhich is ... confu... oh
03:34slesterright
03:34slesterhaha
03:35TEttingerit isn't running until it gets applied... so the timing is gonna be tricky
03:35slestermap took 0.0600 msecs haha
03:35TEttingeroh man everything in there is lazy
03:35TEttingermap is just creating a recipe for how to calculate the whole sequence
03:36slesteryesh.
03:36TEttinger(could be an infinite sequence!)
03:36slesterit does finish.
03:36TEttinger,(map inc (range))
03:36clojurebot(1 2 3 4 5 ...)
03:36slestereventually.
03:38TEttinger(doc keys) ;; is this lazy...
03:38clojurebot"([map]); Returns a sequence of the map's keys, in the same order as (seq map)."
03:38TEttingerdon't think it could be
03:38slesteryeah, don't think it is
03:39TEttingerI feel like there's gotta be a simpler piece of code for this
03:41slestermaybe!
03:41slesterI am but a newb.
03:44slesterif it's any consolation I get the right answer for both parts
03:45TEttingersweet
03:46slesterit just takes no joke 7 minutes per
03:46slesterand my computer is pretty good
03:52jessicakhi
03:54jessicakquestion: not really sure what these things are called but i'm looking for a list of all the .. hmm.. non-lisp.. syntax constructs? that exist in clojure. like #() is one because for the shorthand anonymous function the pound sign isn't in the list
03:54jessicakbasically a list of all the exceptions to the whole "everything is a list and the first element is a function/macro and the rest are arguments"
03:55yenda#() is still a macro
03:56yendajessicak: maybe this is what you are looking for http://clojure.org/cheatsheet
03:56slesterjessicak, all I found is this youtube video: https://www.youtube.com/watch?v=cPNkH-7PRTk
03:56jessicaki've seen the cheat sheet
03:56jessicakim just lookign for a comprehensive list of all these "exceptions"
03:56jessicakwait why's everyone linking this intro stuff
03:58jessicakmaybe i'm not being clear.. not really sure how to word this question .. hmm .. like, #() is an exception because the pound sign isn't in a list. it's extra syntax to the language. i want all of those
03:58hyPiRionjessicak: This is a good list I think: https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
03:59hyPiRioncontrary to the 6 month disclaimer, I don't think any of it is outdated
03:59j-pbjessicak: it's called a reader macro
03:59jessicakyeah i know
04:00jessicaklike #() turns it in to an actual function with variable names under the hood, etc.
04:00j-pbhttp://clojure.org/reader#The%20Reader--Macro%20characters
04:01j-pbshould be a comprehensive list of all the reader macros in clojure
04:01jessicak! perfect
04:06slesterother people's python solutions run in <2 seconds
04:06slestermann.
04:06MJB47on same hardware?
04:06j-pbslester: not part of the system?
04:06slesteryes
04:07slestermy clojure solution takes 5 minutes :(
04:08MJB47so now you get to do the most fun part of algorithms
04:08MJB47optimizing!
04:08MJB47i will point out that the problem here is 99.9% likely to be the implementation details
04:08MJB47rather than the choice of language
04:08j-pbslester: what are you running?
04:09j-pbmatrix stuff with numpy as the reference?
04:09j-pbbecause that is like comparing with C on a GPU directly ;P
04:10slestermine: https://www.refheap.com/112707 vs. https://www.reddit.com/r/adventofcode/comments/3wwj84/day_15_solutions/cxzhpua
04:12slesterthe things I can think of: my possible-amounts is definitely overcounting and then filtering
04:13j-pbslester: generally speaking
04:13j-pbmany threaded sequences are slow
04:14MJB47how many cpu cores do you have?
04:14j-pbuse the new transducer stuff instead of that
04:15yendaslester: first i'd rewrite your solutions with let bindings rather than def
04:15slesterj-pb, whatsit
04:16slesteryenda, are there benefits other than code organization? Why do you suggest that?
04:16j-pb(into [] (map inc) []) for example
04:16beakyin clojure how do i
04:16beakyhow do i emulate maybe
04:17j-pbhttp://clojure.org/transducers
04:17beakylike a do maybe
04:17ridcullybeaky: some-> ?
04:17beakyah
04:18beaky,(some-> (#(3)) (#(nil)))
04:18clojurebot#error {\n :cause "Can't call nil"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "Can't call nil"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6876]}]\n :t...
04:18beaky,(some-> (#(3)) nil))
04:18clojurebot#error {\n :cause "Can't call nil"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "Can't call nil"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6876]}]\n :t...
04:18j-pbslester: you can also write the thing in a large for in clojure
04:18beakysome-> is perfect
04:18j-pb(for [i (range 100), j (range 100), k (range 100)] stuff)
04:19slesterj-pb, right, just wondering if there is something 'wrong' with what I did that would cause a slowdown, or of it's simply the algorithm itself
04:19j-pbthe code is very hard to read tbh
04:19beakyoh
04:19yendaslester: also the python version makes at tops 1 000 000 iterations
04:19beakyis there osmething like haskell mplus or <|>
04:19beakyin clojure
04:19beakytry x, if nil try y
04:20beakyx <|> hy
04:20MJB47(or x y) ?
04:20beakyoh
04:20beakysilly me :D
04:20MJB47it took me forever to realise it too lol
04:21amalloyof course c.c/or only works with nil/false, rather than being general like <|>
04:21beakyttps://www.refheap.com/112708 well i relly want to refactor this kind of thing
04:21beakyso when the if-let of the thing inside if-let fails i can just return 'world'
04:21beakys/of/or/
04:22amalloy(or (when-let [...] (move...)) world)
04:22beakywow
04:23beakythat works even better
04:23beakyi just need to hoist the or out
04:24yendaslester: are you trying all the possible combinations of ingredients then filtering them to 100 ?
04:25beakyis there an or-let
04:26MJB47no
04:26MJB47but you can do
04:26amalloysomething you would row a little boatlet with?
04:26MJB47(if-let [z (or x y)] ...)
04:27beakyamal haha
04:27slesteryenda, yeah :(
04:28slesteryenda, if there's a better way please let me know, that part is the bottleneck
04:28slesterjust wanted to avoid doing a for loop I guess
04:28MJB47you could do it the same way the python guy did it
04:29MJB47with just O(n**3) for
04:29amalloywhy would you want to avoid using for? it's lovely
04:29slesteryeah, this is what I did before I looked at other solutions haha
04:30slesterI guess I felt like it might be shoehorning other languages' approaches into clojure, but maybe there's no better way
04:31MJB47nah our for is better than their for
04:31MJB47nest for loops are a 1 liner
04:31MJB47and its still lazy
04:31MJB47and you get awesome stuff like :when
04:31MJB47and its a function
04:33beakyhttps://www.refheap.com/112709 ok i refactored to this :D
04:40ridcullya rough transscript of that python version (without the manual unrolling) runs with 2s here (vs .5s of the python version)
04:49l1xhi guys
04:50l1xwondering if this holds onto the head
04:50l1xhttps://www.refheap.com/112710
05:00pyon,(#(%) 1)
05:00clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval26$fn__27 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval26$fn__27 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval26 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval26 invoke "NO_SOURCE_FILE" -1...
05:00pyon^ Why?
05:01pyonShouldn't #(%) be the identity function?
05:01MJB47no
05:01MJB47because that tries to do (1)
05:01MJB47which doesnt owrk
05:01MJB47if you wanted to do that you would need to do
05:01MJB47((fn [x] x) 1)
05:02MJB47though ofcourse you could just use identity
05:02pyonOh.
05:02pyonOh, I didn't know identity existed.
05:02pyonI'm using that. :-p
05:06aurelianhi there... is there a way to invoke a lein task from lein repl?
05:20hyPiRionaurelian: What would you need that for?
05:21aurelianwell, I want to start the figwheel and at the same time a garden watcher
05:21hyPiRionaurelian: I think you can do that with lein-pdo, but lein repl itself attempts to make lein invisible to the project
05:22aurelianI see
05:30poweredwhy doesn't lein always trampoline
05:32j-pbpowered: perfomance I'd guess
05:33hyPiRionpowered: not all tasks needs to run in a trampoline, and it turns messy with the `do` task
05:34poweredperformance in startup time?
05:34hyPiRioner, needs to run a subprocess
05:34poweredI need to wait 3+ seconds anyway to even run lein, so I don't care about the performance
05:34poweredI do care about 10% extra of my ram
05:34winkdamn, ran into #2000 today myself
05:35aurelianI think I may need something like this: https://github.com/bhauman/lein-figwheel#scripting-with-component to have figwheel watcher and garden watcher at the same time :)
05:37yendaaurelian: or use boot :)
06:08aurelianI think I can plug this into figwheel as an exercise
06:30noncomi heard there was a thread on integrating a sane repl into clojure, how is it going?
06:30noncomi mean, in the clojure core jar
06:31ridcullydo you mean the socket repl?
06:31ghost_Hey, how can I "unpack" a data structure? [[1 2] [2 3]] -> [1 2 2 3]
06:32ridcully,(mapcat identity [[1 2] [2 3]])
06:32clojurebot(1 2 2 3)
06:33ridcully,(apply into [[1 2] [2 3]])
06:33clojurebot[1 2 2 3]
06:33ghost_thank you, ridcully
06:33ridcully~flatten
06:33clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
06:33ridcullyalso check the log of this channel - iirc there where some similar discussion yesterday or so
06:35ridcullythat apply into one falls apart quite fast
06:35ghost_flatten is the best option in my situation (I think)
06:37ghost_*actually checks if it works*
06:37ghost_nah, mapcat is better
06:37noncomridcully: yeah, the socket one
06:39ridcullynoncom: it's part of the changelog for 1.8 and it's in the current pre-releases
06:40noncomoh really
06:40noncomcool!
06:40noncomis 1.8 okay to use already?
06:41MJB47its in rc3
06:41MJB47so go ahead and use it, but maybe wait before using it in production for a little bit
06:41ridcullycan't tell. saw a post from David Nolen about usage with cljs some time ago and fooled around with it
06:42noncomheh, what's really interesting is that clojure is advancing rather fast on its versions, like 1.5, 1.6, 1.7, 1.8 ... soon it will make to 2!
06:42noncomunless, ofc, they do 1.10...
06:42MJB47they likely will
06:42MJB472.0 would usually mean API changes
06:42noncomyeah, so i was just imaginging what kind of a revolution that could be
06:43noncommaybe some radical changes for the bes
06:43noncom*best
06:43poweredif get changed to if-else
06:43noncompowered: yeah :D
06:43poweredsemantically correct names ftw!
06:43noncomor maybe they could finally fix the ns system
06:44noncomso it wont be in the previous age comparing to the rest of the language
06:44MJB47clojure 2.0: fix typo in name, now known as "closure"
06:44yendaif was already like that in common lisp
06:47noncomis anyone using clojure for system scripting? like "#!/usr/bin/env clojure"... stuff?
06:55domgetterI think most people use python/bash/ruby/perl. I don't think I've ever seen "#!/usr/bin/env java" but I'm sure you could find it if you looked
06:57hyPiRionnoncom: I do it for long running programs, but not very small scripts
07:01noncomyeah, i have found python to be far better than bash, but still not clojure enough
07:01noncomhyPiRion: you mean startup time is long?
07:06ridcullyso hylang then?
07:08hyPiRionnoncom: yeah, startup time is too slow for small tasks
07:09TrioxinI've heard Clojure contrasted to languages that stress mutable data and it stated that for instance a common OOP language vs Closure isn't as correct a way to describe "The World," however; assuming that our reality is virtual/computed (Which I believe it is), why would immutable data constructs be a better way to represent that? Information In this reality is always seeming to change rather than a variation of it being created unle
07:14visofhi guys, what is the best GUI lib for clojure to use for interactive GRAPHICS?
07:15ghost_how can I prevent a map from mixing its values? if I declare it like this {:a 1 :b 2} I want it to stay in this order
07:15ghost_not {:b 2 :a 1}
07:16dnolenghost_: maps aren't ordered, use sorted maps if you need order
07:16domgetterghost_: a map is an unordered list of key-value pairs where the keys are unique
07:17ghost_dnolen: How do I create one? sorted-map?
07:17Trioxinvisof, clplay? You could also use webkit (My fav) such as with nwjs
07:17dnolenghost_: yep
07:17domgetterghost_: https://clojuredocs.org/clojure.core/sorted-map there's a few examples
07:17MJB47keep in mind that sorted-map will sort yourmap for you
07:17MJB47instead of keeping it in the order you give them
07:18TrioxinIs it efficient to transfer data between processes u
07:19ghost_MJB47: it stays the way I've implemented it
07:19TrioxinPiping stdout? **
07:20MJB47,(sorted-map :c 1 :b 2)
07:21clojurebot{:b 2, :c 1}
07:21MJB47,(sorted-map :a 1 :b 2)
07:21clojurebot{:a 1, :b 2}
07:22ghost_MJB47: so it puts keys in alphabetical order?
07:22MJB47if they are strings/keywords yes
07:22ghost_neat
07:22domgetterIf you only need sorting from a map for one thing, but you don't care about order generally, you can sort it on the fly
07:23domgetter,(sort {:a 3 :b 5 :z 6 :c 8})
07:23clojurebot([:a 3] [:b 5] [:c 8] [:z 6])
07:23domgetterbut it will produce of list of vector tuples
07:23ghost_dogmetter: I needed a sorted map for extracting values from it with drop/take later
07:23ghost_dogmetter: cause it's more convenient than with keywords and ranges and stuff
07:24domgetterah okay sounds god
07:24domgettergood*
07:40noncomvisof: try quil
07:41noncomvisof: it's based on https://processing.org/
07:43noncomTrioxin: as to your question on immutable structures: it is really just a POV. however, often the immutability POV is cleaner because it eliminates time from the variables. then you can perceive all the data existing at once
07:45noncomTrioxin: no change is ever done to data. data is always constant. your pointers change - that's what, but not the data they point to, it's matter is always still, like zero on kelvin
07:46tdammers'immutable data structures' means you cannot modify them in-place, you can only create new ones derived from existing ones
07:46tdammerse.g., when you call (assoc) on a map, it doesn't modify the map, it creates a new one that is based on the old one, but with an extra key
07:47noncomtdammers: yeah, that's what we get in practice, the way it is implemented. but Trioxin question was about the conceptual value as i understood it
07:47tdammersthe old one still exists though, and anything that uses it will not be impacted
07:47TrioxinWhat about my notion of destroying data that has become redundant such as if I create a new data structure that's more than less different than the original?
07:47tdammerswell, the conceptual value is that when you "modify" something, you aren't impacting anything else
07:47noncomtdammers: agreed
07:48tdammersthe "destroying data" part is basically what garbage collection boils down to
07:48noncomTrioxin: you don't destroy data, you just let it go
07:48tdammersyou produce a modified version of a data structure, and just don't keep any references to the old one around, so the GC picks it up and destroys it
07:48tdammersor not, as the case may be, but the observable effect is the same
07:49Trioxinhmm. So code doesn't have to handle that.
07:50noncomTrioxin: the STM + GC are clever enough to manage all the implementation details of your journey in the datascapes. the data that is no more visible to you makes for free memory
07:50noncomyes, code does not have to handle anything like that
07:50noncomjust be sure that the data you care about fits into your heap, that's all
07:51TrioxinWhat about my question of using stdout to communicate between processes?
07:52TrioxinI know there shmem but that doesn't sound like fun.
07:52noncomTrioxin: of course you can use stdout, but what's the exact question?
07:53noncomTrioxin: btw: a good insight into cell lists memory: http://www.cs.usfca.edu/~galles/cs345/LispImpHandout.pdf
07:53noncom*memory model
07:53Trioxinnoncom, for instance process 1 needs to steam video to process 2
07:53Trioxinstream*
07:54noncomTrioxin: umm.. well, yes, you could do that... did you face any problems?
07:55noncomTrioxin: although, i think i'd prefer a network interface rather than rely on system piping
07:56TrioxinI haven't gotten to it yet but I will. The problem is that in my use case process 2 is nwjs
07:56TrioxinSo I guess I can run the jar from node in the dom
07:57noncomTrioxin: quite possibly
07:59ghost_How to check if collection contains only the same values? [1 1 1 1] -> true; [1 2] -> false
07:59TrioxinSockets are more familiar to work with of course but then I'm involving the network stack
08:01MJB47,(apply = [1 1 1])
08:01clojurebottrue
08:01MJB47,(apply = [1 2 3])
08:01clojurebotfalse
08:01ghost_damn, it's clever
08:01noncomTrioxin: but you know, the network stack is far more reliable and versatile. also, there're enough libs for supporting various data transfer formats and stuff
08:02noncomwhat if later you will want to stream over network?
08:02noncombut of course, that's just a decision to make, maybe you see that piping is what you really need...
08:02Trioxinnoncom, true.
08:05TrioxinI don't even know how I would use the stdout and get the stream to work in the video player. I know it can be done but haven't worked it out yet in the dom. Socket streaming is straightforward.
08:18ghost_I need to apply 8 functions on one map. How can I do that in a pretty way? They all return vectors
08:18noncomyou want to get all the 8 results back?
08:18ghost_I want to have 8 vectors at once
08:19noncom(map #(% data) fs) ?
08:19luma((apply juxt fns) data)
08:19ghost_(func1 func2 ... func8 map) -> ([vec1] [vec2] ... [vec8])
08:20lumaor ((juxt f1 f2 ... f8) data)
08:20noncomhey, they should not be applied in sequence, right? rather in parallel
08:20ghost_yeah, in parallel
08:20ghost_independent calls
08:21noncomjuxt is a good solution
08:21noncomprobably cleaner than mapping over
08:21ghost_yeah, juxt is perfect
08:21ghost_thanks you
08:21ghost_thank*
08:22ghost_brain farts are with me today
08:23noncomit is okay. there are times when winds blow, you know
08:24ghost_I'm also having some kind of food poisoning right now, so it's not only about brain farts
08:25noncomoh, yeah, that happens too... i hope your body gets to norm soon :)
08:25ghost_thank you for kind words :D
08:26noncom:)
08:26ghost_also, is it bad when I make my functions only work with one input? like with only one map I'm working with
08:26ghost_or is it idiomatic to use "reusable" functions all the time
08:28noncomghost_: you mean the function is taylored to parse the specific map?
08:28ghost_noncom: yeah
08:29oracle`how to let lein to download jar from http://mvnrepository.com/?
08:29TrioxinHas anyone here ever used LispWorks? It looks to be very portable without platform specific code. It's always been a curiosity to me.
08:30noncomghost_ i suppose this is ok, since otherwise how do you get your map processed. sure enough that separating some common functionality is better, but don't try to force it at the beginning of your construction, if it does not come easily by itself. it will come naturally later and you will be able to decompose and separate, maybe create a lib
08:30noncomoracle`: just specify the dep
08:31ghost_noncom: I'm doing a tictactoe and this function extracts diagonal rows
08:31ghost_noncom: didn't know how to make it "generic"
08:31noncomoracle`: on page of any jar there you can see the "Leiningen" tab - there from you can just take the dep vector and put it into your project.clj dependencies
08:31oracle`but there is no jar found in the default repository.
08:31noncomoracle`: could you be more specific? what is the jar?
08:32noncomghost_: so you have a square of rows and it extracts diagonals?
08:32oracle`I tried to use core.async with clojure 1.7
08:32oracle`but it failed to download org.ow2.asm:asm-all:jar:4.2
08:32oracle`looks like core.async depends on org.ow2.asm:asm-all:jar:4.2
08:32oracle`but on the default repository, it can't find org.ow2.asm:asm-all:jar:4.2
08:33ghost_noncom: entire board is like {:1A "-" :2B "-" ...} ("-" means empty)
08:33noncomoracle`: ummm.. everything should just work if you specify the core.async dep
08:34ghost_noncom: my func is like (select-keys board [:1A :2B :3C])
08:35noncomuh, then i don't think it is possible to extract any meaningful generic out of this... probably you could create a function that generates the keys [] for diagonal N
08:35noncomoracle`: i think core async is hosted on https://clojars.org/ and it should be fully functional if you just request it in your deps
08:35ghost_but I won't be doing anything beyond 3x3 board, I think
08:36noncomghost_: well, actually i see no reason to use a {} here instead of a []
08:36ghost_noncom: it's a sorted map in my program
08:36noncomand if you turn it into a [] then extracting specific elements by indices can be generalized
08:36ghost_noncom: you mean k-v vector would be better?
08:37oracle`maybe I need to fix a warning first before fix the core.async depends issue.
08:37noncomno, like [ [x o x] [- - -] [x - o] ]
08:37oracle`when run lein repl, it has the following warning
08:37oracle`WARNING: reader-conditional already refers to: #'clojure.core/reader-conditional in namespace
08:37oracle`I am using clojure 1.7, anybody know the meaning of the warning?
08:38noncomoracle`: does not look like a critical thing to me :/
08:38ghost_noncom: I'm extracting rows and such with things like (take 3 board), map was the best way for updating a board for me
08:38ghost_noncom: maybe I'll try that when I finish the entire thing
08:38noncomoracle`: how do you find that core async is not available in your program? the require statement fails?
08:39noncomghost_: yeah, you know, it's hard to say.. things depend on specifics and algorithms much
08:40noncomghost_: updating a nested vector is no less easy
08:40noncom,(assoc-in [[1 2 3][5 6 7][8 9 0]] [1 0] 4)
08:40clojurebot[[1 2 3] [4 6 7] [8 9 0]]
08:40noncom,(assoc-in [[1 2 3][5 6 7][8 9 0]] [2 1] "heeeey maaaaan")
08:40clojurebot[[1 2 3] [5 6 7] [8 "heeeey maaaaan" 0]]
08:41ghost_noncom: maps are neat for those kinds of things, I just validate input, turn it into a keyword and assoc
08:42noncomghost_: not the same thing for ^^ ?
08:42noncom[2 1] looks like a good 2d coordinate representation
08:44ghost_didn't see your code above, lol
08:44noncomalso:
08:44noncom,((fn [[x y]] (keyword (str x (get {\A 0 \B 1 \C 2} y)))) "2B")
08:44clojurebot:21
08:45noncomif you want user to input like "2A", then this turns "A" into an integer coordinate
08:45noncomyeah, well, i'm just making the point that the task can be seen from many various POVs
08:46noncomand some may be more friendly for generic representation thatn other
08:46ghost_yeah, for me it's not that clean
08:46ghost_it may be better for you or someone
08:46ghost_it all depends
08:46noncomright
08:47ghost_also, is there a place where I can put my code and smart people will review it?
08:47noncomghost_: well, there's code review stack exchange website...
08:48ghost_noncom: we don't have our own thing? oh, well
08:48noncomalso, you can try posting your code to something like refheap and ask here, in this IRC, but it is not guaranteed that it will get much response, especially if it is very big
08:49noncomthings less than a page can usually get some response
08:49noncomheh, well, not many languages have their personal code review places? :)
08:50ghost_it's 116 lines now, with comments
08:50ghost_but clojurians always have all the good stuff!
08:51beakyhello
08:51beakywhats a good mail client for clojure
08:51beakyso i can pull mail from gmail
08:54noncombeaky: https://github.com/owainlewis/clojure-mail ?
08:54noncomghost_: hehe yeah, and more good stuff is comin! :)
08:54ghost_noncom: you mean?
08:54noncomwell, 116 lines looks like you could post it here for getting some advice
08:55ghost_I need to write a function for checking if someone has won, so it'll be ~130 lines
08:55noncomghost_: well idk, clojure is in active development :) who knows what may come if people keep being that adventurous
08:55pyon,(-> 1 #(* 2 %) #(+ 3 %))
08:55clojurebot#error {\n :cause "clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.ClassCastException\n ...
08:56pyon^ Why does that fail?
08:57ghost_noncom: I hope it we won't become code cowboys like CL guys
08:57noncompyon: because it does not work the way you thing it works
08:58pyonHow does it work, then? :-O
08:58noncompyon: the 1 gets inserted in the second place of the list
08:58noncomso you get (-> 1 (fn [a] (* 2 a)) ...) on the first iteration, when reader expands the #() form
08:58noncomthen:
08:58noncom(fn 1 [a] (* 2 a))
08:58noncomand it crashes
08:59pyonOops.
09:02noncomif you read docs on ->, you'll see it says that the thing gets put into the 2nd place in the next form
09:02powered,(macroexpand '(-> 1 #(* 2 %) #(+ 3 %)))
09:02clojurebot(fn* (fn* 1 [p1__51#] (* 2 p1__51#)) [p1__52#] (+ 3 p1__52#))
09:02pyonThe example I saw on Stack Overflow was (-> 5 zero? not)
09:02noncompyon: that's different, it'll work, right
09:02pyonSo I assumed it was sugar for function composition.
09:02noncomnah :)
09:02pyonAh!
09:02noncomcomp is the sugar i guess
09:02noncom((comp f2 f1) x)
09:02noncomghost_: yeah, i hope very much too. really wish clojure spread more and more
09:02pyonI wouldn't call `comp` sugar. It's the normal function composition HOF AFAICT. :-p
09:02noncomyeah :) i was overly figurative :)
09:02pyonWhat's the difference between -> and ->> ?
09:02noncompyon: ->> puts the thing on the last place
09:03pyonAh!
09:03domgetterpyon: (-> 5 even?) becomes (even? 5), so (-> 5 (fn [n] nil)) becomes (fn 5 [n] nil) which makes no sense
09:03ghost_noncom: it's the first language I can normally write with, without headaches, being angry or bored
09:03noncom-> and ->> are just suitable for different cases of threading. for example, (map) and (reduce) kind of things would more likely to thread with ->>
09:03domgetter-> doesn't "call the functions in order" it rewrites the whole list
09:04pyonAh...
09:04ghost_noncom: or write in*, I dunno
09:04pyonGiven those descriptions, I can see myself wanting to use ->> more often than ->.
09:04noncomghost_: hahah :) well, yes, i see clojure having this magic power :)
09:05pyon,(macroexpand '(->> #(read-once prompt) repeatedly (drop-while pred) first))
09:05clojurebot(first (drop-while pred (repeatedly (fn* [] (read-once prompt)))))
09:05noncompyon: right, but never forget about this: https://github.com/rplevy/swiss-arrows
09:05pyonnoncom: Checking.
09:06noncomthat's the holy shit of threading apex
09:06pyon:-O
09:06noncomor i mean, holy graal..
09:06noncom:D
09:06pyonWhoa, -<> looks really cool.
09:07ghost_noncom: do we have all this weird (and beautiful) stuff with function composition haskell has?
09:07noncomfeel like a data wizard with these magic wands, eh ? :D
09:07yendaI'm so happy writing when I'm writing clojure too :)
09:07ghost_yeah, with clojure you can smile
09:08yendaI even found a mission where I do mostly clojure all day
09:08ghost_with go, the only thing you can do is google and cry
09:08yendaso I've been smiling a lot lately
09:08noncomghost_: well, it depends :) much of haskell stuff is there for the strict type system, which of clojure is deprived. so you have to account for that. other than that, i guess, it's all here
09:08ghost_noncom: do we have a dollar? func1 $ func2 ?
09:09noncomumm, i am no pro in haskell but is not it same as comp?
09:10pyonEh, as a Haskeller (sometimes), the dollar is one of my least favorite operators.
09:10ghost_oh, yeah, it's basically comp
09:10ghost_pyon: why?
09:11pyon`a $ b c d e f g` means `a (b c d e f g)`
09:11ghost_I know, but why don't you like it
09:11pyonghost_: Because they hide nesting.
09:11pyons/they hide/it hides/
09:12pyonIf an expression contains lots of $s, it's actually more nested than the parentheses show.
09:12ghost_pyon: isn't haskell all about hiding stuff behind hundreds of abstractions?
09:13pyonDunno... I like Haskell (sometimes) because it's pedantically precise (sometimes), not because it hides anything. :-|
09:14pyonBut, anyway, back to Clojure. I like it because it remains elegant even when interacting with a messy world. :-)
09:15noncomeheh, clojure can get strange from time to time too :)
09:16pyonDoes this look like idiomatic Clojure? (defn read-many [prompt invalid?] (->> #(read-once prompt) repeatedly (drop-while invalid?) first))
09:16ghost_by the way, do you guys know if there is a working library for doing indie games in clojure?
09:16pyonread-once itself is (defn read-once [prompt] (print prompt) (read-line))
09:17dnolenghost_: play-clj
09:17dnolenghost_: http://www.indiedb.com/games/ticks-tales-a-knight-to-remember
09:17MJB47there is also arcadia for unity
09:18dnolenghost_: also various activity around ClojureScript as well
09:18ghost_dnolen: play-clj couldn't recognize keyboard input last time I've used it
09:19noncomyeah, all that and also i am quite successful in using JMonkeyEngine 3 with clojure for my main works
09:19ghost_oh man, I'm so excited now
09:19noncomdid not settle with libgdx (play-clj) because it has its 3d support in the early infancy...
09:19noncomghost_: also, for easy starters you could try the quil library (which also works for clojurescript)
09:20noncomquil is based on https://processing.org/
09:20ghost_noncom: I was typing straight from the tutorial while doing play-clj, it still didn't work, I don't know why
09:21pyonIf I add a dependency to my project.clj, do I need to restar the REPL in CIDER?
09:21pyonrestart*
09:21ghost_noncom: and isn't quil about animating stuff?
09:22noncomdon't know... i did not get much pro in libgdx, but in its niche it is very mature. idk about the play-clj wrapper though, but it looked ok and functional when i last time saw it
09:22noncomghost_: well, quil is just a wrapper for processing. and processign can surely be used to make games
09:22ghost_okay, so I'll try that tomorrow or something, thanks
09:23ghost_noncom: wrapper for a language?
09:24noncomghost_: processing is simply a java library :) all that hassle about processing language is just about a dedicated IDE for it. the IDE aimed at artists and other people who are not professional programmers but want to do something codey]
09:24noncomghost_: but no use for the ide, just take the core library and you're good to go
09:24noncompyon: afaik yes
09:25ghost_noncom: damn, Hickey is my god now
09:27noncomghost_: if you ever get to the thing, this may serve as a source of inspiration: http://www.openprocessing.org/
09:28noncombut for serious opengl i'd go for libgdx/play-clj, jmonkeyengine or bare lwjgl / jogl if i really mean it
09:30noncomserious i mean like AA or even AAA
09:32ghost_I'd be doing 2d games, even if it would be "serious developing"
09:37l1xhi guys
09:38l1xhas anybody seen this with data.json?
09:38l1xhttps://usercontent.irccloud-cdn.com/file/zmZZVZoo/Screen%20Shot%202015-12-15%20at%2015.37.33.png
09:39m1dnight_I recall from my thesis that clojure has a thraedpool somewhere taht defaulted to 30-40ish threads. but i ncant find it in the source.
09:40m1dnight_Some threadpool for some concurrency mechanism. The source in Agents.java defines N threads in the threadpool. But this used to be different or am I thinking of something else?
09:45l1xhttps://github.com/StreamBright/riak-loader/blob/master/src/riak_loader/core.clj#L193
09:50beakyah thanks nomcom
09:50beakypyon because you need to surround the #() with () :D
09:51beaky,(-> 1 (#(+ 1 %)) (#(* 2 %)))
09:51clojurebot4
09:51noncoml1x: and why would anyone use clojure json instead of cheshire json ?
09:52l1xnoncom: dont know
09:52noncombeaky: pyon: hah, a good point. forgot about this
09:54poweredbecause they're too lazy to add the dependency
09:55noncoml1x: looks like a case worthy of an issue
09:55alive876hi, i tried on the clojure beginner channel but no luck, I was wondering about this code from http://www.braveclojure.com/read-and-eval/ (def addition-list (list + 1 2)) (eval addition-list) ; => 3 ?
09:57ghost_,(eval '(+ 1 2))
09:57clojurebot3
09:57beakyhello alive
09:58beaky,(eval `(+ 1 2))
09:58clojurebot3
09:58beaky,(eval '(+ 1 2))
09:58clojurebot3
09:58beaky,(eval (list + 1 2))
09:58clojurebot#error {\n :cause "EvalReader not allowed when *read-eval* is false."\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]}\n {:type java.lang.RuntimeException\n :message "EvalReader not allowed when *read-eval* is false."\n :at [clojure.lang.Util runtimeException "Util....
09:58beaky,(list + 1 2)
09:58clojurebot(#object[clojure.core$_PLUS_ 0x2e17e73d "clojure.core$_PLUS_@2e17e73d"] 1 2)
09:59ghost_,(eval (list (+ 1 2)))
09:59clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval185 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval185 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval185 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69...
09:59ghost_oh, darn
09:59beaky,(eval (list '+ 1 2))
09:59clojurebot3
09:59beaky:D
10:00powered, (eval '(eval (list + 1 2)))
10:00clojurebot#error {\n :cause "EvalReader not allowed when *read-eval* is false."\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]}\n {:type java.lang.RuntimeException\n :message "EvalReader not allowed when *read-eval* is false."\n :at [clojure.lang.Util runtimeException "Util....
10:00ghost_why didn't (eval (list + 1 2)) work?
10:01poweredbecause
10:01powered,(list + 1 2)
10:02clojurebot(#object[clojure.core$_PLUS_ 0x5acd290d "clojure.core$_PLUS_@5acd290d"] 1 2)
10:02powered,(list '+ 1 2)
10:02clojurebot(+ 1 2)
10:02poweredI don't get the "*read-eval*" error at my own repl though
10:05mpenetm1dnight_: you're probably thinking about core.async threadpool https://github.com/clojure/core.async/blob/a833f6262cdaf92c6b16dd201d1876e0de424e14/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L16-L22
10:06mpenetwell, one of them, there s also at least one other globally defined (unbound) threadpool in there
10:06mpenetwhich is kind of sad
10:09mpenetIn clojure itself the situation isn't better either, you have a globally defined threadpool used for agents/futures, you can redef it, but it's always a global pool that will be shared by all these constructs instread of an argument, agents have a way to use a separate pool (using send-via) but that's it.
10:10l1xnoncom: not sure if this is coming from data.json
10:10l1xbut looks like
10:10mpenetif you need control over threadpool ressources, use libraries that do this right instead of the built-ins
10:11noncoml1x: what's the exception message? this stack trace does not give it.. is it a OOM ?
10:11l1xthere is no exception, my code runs out of heap
10:12l1xfor no good reason
10:13l1xstarted to dig in and it turns out that the most memory goes to json/read-str json/wrt-str
10:14noncoml1x: so it is a OOM (Out of Memory)
10:14l1xyes
10:14noncoml1x: yeah, i think you should rise this in the issues
10:14l1xi am replacing data.json with chesire to confirm that it is 100% that lib
10:14noncoml1x: as a proposal you might try to replace the builtin json library they use with cheshire and see what difference it makes
10:14l1xand not something unrelated
10:14noncomyeah :)
10:15l1xyes :)
10:37domgetterIf I (apply max seq) does it lazily realize the seq?
10:37beakydoes clojrue have toolkits for language processing
10:37domgetterbeaky: just google "clojure nlp"
10:38beakyhttps://github.com/dakrone/clojure-opennlp there we go
10:38beakyi want to parse language samples to a grammaer
10:38beakyor regex
10:39beakye.g. ["123" "456" "123"] -> #"\d{3}"
10:39beaky,(re-find #"\d{3}" "123")
10:39clojurebot"123"
10:39l1xnoncom: test running
10:39beaky,(re-find #"\d{3}" "abc123abc")
10:39clojurebot"123"
10:40noncoml1x: good! let's see what it brings..
10:40beakyhttps://github.com/Engelberg/instaparse wow
10:40MJB47domgetter: no, max will realise the entire seq
10:41noncombeaky: also look for parsers here: http://www.clojure-toolbox.com/
10:41ghost_How to apply or to vector of booleans?
10:41noncom*parsing
10:41beakyah thanks nom
10:41noncomghost_: yeah, a known quirk. reduce can do
10:42noncomthere was another way, but i don't recall. not much more graceful though iirc
10:42domgetterMJB47: would I have to write my own max-finder so that I use constant aux space?
10:42MJB47i dont see how you can have "max" be not-lazy
10:42MJB47unless you only find the max value of any elements already realised?
10:42ghost_noncom: (reduce or [false true])?
10:43ghost_noncom: also, why do we need reduce here?
10:43noncomghost_: http://stackoverflow.com/questions/2891707/reduce-or-apply-using-logical-functions-in-clojure
10:43noncomghost_: look very bottom: https://clojuredocs.org/clojure.core/and
10:43noncomghost_: coz or and and are macros
10:44domgetterMJB47: I'm not concerned with time complexity. I know I'll have to traverse the list. I'm wondering if (apply max seq) loads the whole seq into ram, or if it just looks at one member of the seq at a time
10:44ghost_noncom: uh, they told me macros were awesome
10:44ghost_noncom: thanks
10:44MJB47oh
10:44noncomahahaha :)))
10:45ridcully,(some true? [false false true])
10:45clojurebottrue
10:45noncom>:) maaaacros
10:45MJB47thats not what lazy means i think
10:45MJB47but idk the specifics of max so i cant help you :(
10:46domgetterIs there a way to ask how much memory a form took to process?
10:46ghost_ridcully: oh, thanks you, it's so much better than (some identity [])
10:46troydmhow do I convert a function that returns boolean into a goal function in core.logic?
10:47ghost_ridcully: thank*! my god I'm weird
10:47domgetter,(some identity [false false 2])
10:47clojurebot2
10:47domgetter,(some true? [false false 2])
10:47clojurebotnil
10:47noncomghost_: yeah, true? will only work for booleans while identity will work for any non-nils and non-false
10:47troydmwell besides (== (f ...) true)
10:48ghost_noncom: I've always found functions using identity confusing
10:49noncomwhy?
10:49clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
10:49noncomit's just (fn [x] x)
10:50powereddidn't know clojurebot does anything else than execute clojure
10:50domgetter,(source identity)
10:50clojurebotSource not found\n
10:51domgetter(defn identity "Returns its argument." {:added "1.0" :static true} [x] x)
11:02beakyhello
11:02beakyhow do i evolve a regex
11:02beakyusing https://github.com/vollmerm/fungp
11:05l1xnoncom: similar issue
11:05noncoml1x: :(((
11:05l1xeven though cheshire is faster and smaller
11:05l1xbut it still leaks
11:06l1xhttps://github.com/StreamBright/riak-loader/blob/master/src/riak_loader/core.clj#L225
11:06l1xhere
11:06l1x(same with Cheshire)
11:07pseudonymousIs there any alternative to maven for easy management of private packages ?
11:07noncombeaky: well, in general, like, define the fitness function, the genes for regex.. and run it
11:07noncompseudonymous: not really, but waht do you mean by "easy management of private packages"
11:07noncom?
11:08noncoml1x: at which stage of json processing does it choke?
11:08pseudonymousnomcom: with python (pip) I can add a custom git repo. With racket, I can even distribute zip files if I so desire. I just want to share some code between two services which shouldn't be released publicly
11:08l1xnoncom: I show you, give me a sec
11:08noncoml1x: if it reaches the limit due to storing huge strings in memory, then one has to think about a better storage paradigm
11:09noncompseudonymous: 1) local maven - best, 2) jar, 3) in-project source copy-paste, 4) project-project dep (see lein checkouts thing)
11:10pyonbeaky: Sorry, I was away. But thanks.
11:10noncompseudonymous: using maven does not mean release to public at ll
11:10noncom*at all
11:10pyonbeaky: After they explained to me how -> and ->> work, it was clear.
11:11beakyello pyon
11:11l1xhttps://usercontent.irccloud-cdn.com/file/gakeeMne/Screen%20Shot%202015-12-15%20at%2017.09.49.png https://usercontent.irccloud-cdn.com/file/t4bVNznU/Screen%20Shot%202015-12-15%20at%2017.10.01.png https://usercontent.irccloud-cdn.com/file/pygnBy31/Screen%20Shot%202015-12-15%20at%2017.10.32.png
11:11beakyi love -> and ->> they are like arrows
11:11sdegutisHey y'all, I'm workin' on a new Clojure-to-CSS lib that's meant to be very lenient on where you place things. https://gist.github.com/sdegutis/459f552dcbc1d3acf950
11:11beakysilve arrows to automatically make code elegant
11:11beakysilver bullets
11:11pseudonymousnoncom: I know.. But I'm just *one* guy and I'm already managing way too much. It seems overkill to try and wrap my head around maven also.
11:12l1xnoncom: i think this function is the trouble: http://basho.github.io/riak-java-client/2.0.1/com/basho/riak/client/core/util/BinaryValue.html
11:12sdegutisIt's not quite done yet, there's one bug left that I haven't quite figured out. But it feels like I'm using Sass or Less which is nice.
11:12l1xit seems create does something like this: Create a BinaryValue containing a copy of the supplied string encoded using the supplied Charset.
11:13noncompseudonymous: a very very known feeling, but actually it's just a couple of minutes away. you just have to create a pom.xml, specifying the groupid, artefactid and version for your library, that's all
11:13l1xi might switch to byte[] and see how does that impact the heap allocations
11:13noncomnoncom: then maven install and you're through
11:13noncomah, misclicked the nic :)
11:13noncoml1x: hmmm...
11:14noncompseudonymous: but if you still don't want - try the other options i've mentioned
11:14pseudonymousnoncom: and I can somehow keep this stuff in git still? Did you do any of this and if so, do you have a resource on hand which you yourself found helpful ?
11:15ToxicFrognoncom: doesn't lein have a git-dependencies plugin?
11:16noncompseudonymous: sure, you just commit the repo to git. the fact that it contains some pom.xml does not change anything. maven is the most solid solution, but the other issue is that you'll have to call "maven install" on each change to your library. that's why you could try using the lein checkouts feature!
11:16noncomToxicFrog: pseudonymous: oh maybe, i did not hear about it. could be a good option too
11:16ToxicFrognoncom, pseudonymous: will this do the job? https://github.com/tobyhede/lein-git-deps
11:17noncomToxicFrog: pseudonymous: wow that looks really interesting
11:17noncompseudonymous: that does not free you from learning some maven anyway :P
11:17pseudonymousToxicFrog: will definitely read/look into this. You may have saved my day
11:18noncompseudonymous: this guide: https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
11:18pseudonymousnoncom: I never should've looked at clojure. I just knew the Java EE monster would come out from under my bed to eat me :'(
11:18noncompseudonymous: after reading this, you're all set for your requirements
11:18ToxicFrogI used it for a project of mine, depending on a github repo, and it seemed to work fine
11:18ToxicFrogYou should be able to point it at an internal git repo just as easily, if the repo contains a valid clj project
11:18noncomyeah, i'll look into git deps plugin too, but not because i shy asway from maven :)
11:18ToxicFrog(caveat: I am assuming you're already using lein)
11:19noncompseudonymous: don't be afraid, try reading the maven in 5 minutes doc several times over several days, and then try to make a dummy pom.xml according to it :)
11:20noncompseudonymous: one thing of maven is: there's no way back. the world is immenently moving toward it and similar systems
11:20ToxicFrognoncom: personally, one of the things I like about clojure is that using lein means never having to care about ant or maven
11:20ToxicFrogBecause they are awful
11:21noncomahahaha, true enough :)
11:21noncombut these are tools which do the job which has to be done
11:21noncomand if you're doing anything more or less customized or advanced, the lein maven facade won't work that easily...
11:21ToxicFrogSo is machine code, that doesn't mean I want to touch it with my bare hands :P
11:21noncomyeah, depends on the need
11:22acron^try existing in a world without dependency management before knocking maven :p
11:22pseudonymousToxicFrog: as someone who got bitten *bad* by Java a few years back. That was Lein's selling point to me, too.. :P
11:22noncomacron^: yeah :) i remember that..
11:22ToxicFrogacron^: oh, don't get me wrong, dependency management is hugely important
11:22ToxicFrogBut using maven is anti-fun
11:22pseudonymousNot all dependency management systems are made equal, though.
11:23ToxicFrogLike, maven does an important job, and does it well, but actually interacting with it directly is painful. Ditto ant.
11:23MJB47after using the shit show that is npm, maven is workable
11:23ghost_Do we have something like truthy? function?
11:23MJB47atleast its consistent
11:23noncomghost_: what sould it do? the truthy?
11:23beakybtw how do i learn maven
11:23ToxicFrogMentally, I have filed them as "backend tools": things that fill an important ecological niche, but if I ever have to interact with them directly rather than using other, better tools that hand off to them, something is broken.
11:24pseudonymousnoncom: oh, and thanks for the link btw :) I'll look at it and ponder it all.
11:24noncombeaky: the official docs are rather good. also sonatype docs.
11:24ghost_noncom: (truthy? true) -> true ; (truthy? 2) -> true ; (truthy? false) -> false
11:24acron^No, you're totally correct, I am trolling a bit. Lein is a breath of fresh air compared to "the others".
11:24noncomghost_: try (boolean)
11:24ghost_noncom: I can just map boolean, but I dun- oh, okay
11:24noncom:))
11:26ToxicFrogacron^: yeah, I haven't touched pip or npm, really, but lein is so much more pleasant to use than luarocks or maven it's unreal.
11:27beakyi love npm
11:27beakyits so awesome
11:27MJB47i have found npm to be incredibly inconsistant and useless
11:27MJB47:(
11:27acron^^ this
11:28MJB47you can run npm install 3 different times
11:28MJB47and get 3 different outcomes
11:28MJB47its amazing
11:28beakyyes esp on windows
11:28beakywith long path
11:29MJB47lol
11:29beakyand different node versions
11:29MJB47one of our servers we cant run locally on windows
11:29MJB47because the dependency path is too long
11:29MJB47XD
11:29MJB47there are workarounds but still
11:29pseudonymouswaaaaiit a second. So can I stuff the code I want to share into a lein library project and somehow gain the necessary pom files and whatnot ?
11:39gfredericksapparently if you stub something in specl and the stub function throws an arity exception *at all*, specl will report it as the wrong number of args passed to the stub function
11:39ToxicFrogpseudonymous: AIUI, if you are using lein-git-deps, it doesn't even need the pom file; it derives everything from the project.clj
11:39ToxicFrogAt least, the one I was depending on didn't have a pom
11:39ToxicFrogThat said, I'm pretty sure lein has a "generate a pom for this library" command.
11:42pseudonymousToxicFrog: from what I gathered, the project you pull in will be resolved, but not its dependencies - in that sense, you're still managing a lot yourself.
11:43sdegutisIs there a function that can tell if a thing is a list or vector or lazy sequence, but not a map?
11:43pseudonymousI think I'm shelving it, for now. Think I'll give clojure a long hard think, too. Has been a bit of a bumpy ride.
11:43gfrederickssdegutis: sequential?
11:44domgettersdegutis: just out of curiosity, what are you doing that makes you want to check?
11:44sdegutisAhhhh nice.
11:45sdegutisI'm writing a little Clojure-to-CSS thing that uses data as its API, so whether an element is a string, map, or list/vector makes the difference as to how it's used.
11:45sdegutisBecause with CSS positioning shouldn't matter, if you have some maps and then some vectors of children and some more maps, those maps should be considered your own attributes.
11:46ghost_Again need help with bools. How to write it correctly? (take-while (not false?) coll)
11:46sdegutisghost_: take-while already does that
11:47ghost_sdegutis: But my call doesn't work, it throws an error
11:47ghost_,(take-while (not false?) [true false])
11:47clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
11:47roninhacker,(take-while even? [2 2 2 22 2 2 3 2])
11:47clojurebot(2 2 2 22 2 ...)
11:47ghost_I know, darn
11:47roninhacker[2 2 2 22 2 2 3 2])
11:47sdegutisghost_: you probably want to create an anonymous function
11:47pseudonymoussdegutis: I may be mistaken but. Most likely it's not hard to cobble together a function from the existing ones (vector? list?). That said, if you mean to act differently depending on its type, you should look into protocols
11:47roninhacker,(take-while even? [2 3 2 22 2 2 3 2])
11:48clojurebot(2)
11:48sdegutisghost_: you're passing (not false?) as a function, when it's actually a function call of its own that probably throws an error
11:48sdegutis,(not false?)
11:48clojurebotfalse
11:48roninhacker,(fn? (not false))
11:48clojurebotfalse
11:48sdegutisghost_: okay so (not false?) just returns false, and you're passing false in where a (predicate) function is expected
11:48ghost_sdegutils: can you show me that function? I have no idea how to write it
11:50roninhackeranonymous functions in clojure are easy and pleasant: start off w/a #, and refer to arguments as %,%2, %3
11:50ridcully,(fn? (complement false?))
11:50clojurebottrue
11:50roninhacker(let [our-addition #(+ % %2)] (our-addition 3 5))
11:50roninhacker,(let [our-addition #(+ % %2)] (our-addition 3 5))
11:50clojurebot8
11:51ridcullyit's polite to use %1 in that case
11:51roninhackeroh, really? i apologize for my barbaric manners then, ha
11:51ghost_damn, you're telling me stuff I already know
11:51domgetter,(let [+ *] (+ 3 3))
11:51clojurebot9
11:52roninhackerwell, to put it together w/ take-while
11:52roninhackerthe function you’re prolly looking for
11:52roninhackeris not an anon one, but `identity`
11:53roninhacker,(take-while identity ‘(true (even? 2) (odd? 3) (odd? 4)))
11:53clojurebot#error {\n :cause "Unable to resolve symbol: ‘ in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: ‘ in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: ‘ in this context"\n ...
11:53roninhacker,(take-while identity [true (even? 2) (odd? 3) (odd? 4)])
11:53clojurebot(true true true)
11:53ghost_I have a vector of strings and falses
11:54ghost_I want to get first string out
11:54roninhackerah
11:54roninhacker,(doc drop-while)
11:54clojurebot"([pred] [pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false. Returns a stateful transducer when no collection is provided."
11:54roninhacker,(first (drop-while [false false “hi”]))
11:54clojurebot#error {\n :cause "Unable to resolve symbol: “hi” in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: “hi” in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: “hi” in this co...
11:55roninhackerha, whoops
11:55roninhacker,(first (drop-while identity [false false “hi”]))
11:55clojurebot#error {\n :cause "Unable to resolve symbol: “hi” in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: “hi” in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: “hi” in this co...
11:55ghost_(first (drop-while #(= false %) coll))
11:55ghost_that's what I meant
11:55ridcully(some identity [false false "lerl"])
11:55ghost_thanks
11:55roninhackergreat!
11:55MJB47roninhacker: you arent using " somehow
11:56roninhackerMJ:thanks, but weird
11:56roninhackerYeah, you’re right
11:56domgetter,(first (filter string? [false false "asdf"]))
11:56clojurebot"asdf"
11:57ridcully,(some string? [false false "lerl"])
11:57clojurebottrue
11:57MJB47in general if you are doing (first (filter ... you can just use (some
11:57ridcully,(some identity [false false "lerl"])
11:57clojurebot"lerl"
11:57roninhackerright…I always forget some
12:00l1xnoncom: i am going nuts
12:00noncoml1x: whats up?
12:00l1xi have no idea why i am holding onto the that piece of data
12:02l1xi am changing approach and pass strings around and convert it to clojure data strucutre in the last moment
12:07sdegutisghost_: you probably want #(not= false %) or (fn [x] (not= false x)) which are the same.
12:08sdegutisghost_: or maybe you want #(false? x) which is the same as #(= false %) and (fn [x] (= x false))
12:08ghost_sdegutils: they didn't work, I used (first (drop-while #(= false %) coll))
12:09Bronsaor more simply `false? `
12:16noncoml1x: yeah, maybe a change in the approach would solve something
12:16momerathis there a way to set a dynamic var at the repl, outside a binding form?
12:16sdegutilsghost_: are you trying to match false items? What does your input data (i.e. coll) look like?
12:16noncommomerath: you can certainly get the var
12:16noncommomerath: the var itself, but what value do you expect it to have outside a binding?
12:16ghost_sdegutils: like [false "-" false false "-"]
12:16sdegutilsghost_: okay and what data do you want to end up with?
12:16ghost_sdegutils: and I've found good solution, don't worry
12:16ghost_sdegutils: "-"
12:16sdegutilsghost_: okay then
12:16sdegutils(->> coll (drop-while false?) (first))
12:17momerath? maybe the specifics will help: I want to disable ansi-color printing when I'm debugging at the repl, since cider currently doesn't handle the escape codes well
12:17sdegutils,(->> [false "-" false false "-"] (drop-while false?) (first))
12:17clojurebot"-"
12:17momerathand I don't want to type (binding [*ansi-capable* false] stuff) every time
12:17noncommomerath: hmm, maybe alter-var-root will do ?
12:18ghost_sdegutils: yeah, I used that
12:18momerathsame result as var-set: boolean cannon be cast to var
12:18noncom,(def ^:dynamic *z* 1)
12:18clojurebot#'sandbox/*z*
12:19noncom,*z*
12:19clojurebot1
12:19noncom,(alter-var-root *z* (constantly 42))
12:19clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.Var"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.Var"\n :at [clojure.core$alter_var_root invokeStatic "core.clj" 5273]}]\n :trace\n [[clojure.core$alter_var_root invokeStatic "core.clj" 5273]\n [clojure.core$alter_var_root doInvoke "core.clj" -1]\n [clojure.lang.RestFn...
12:19noncom,(alter-var-root #'*z* (constantly 42))
12:19clojurebot42
12:19momerath"already refers to..."
12:19noncom*z*
12:19noncom,*z*
12:19clojurebot42
12:19noncomsee
12:19ystaelIf you accidentally change the binding of user/*1 in the repl, is there a way to get it back?
12:20noncomystael: unlikely
12:20Bronsaystael: there's *2 and *3
12:20ystaelwell, yes, but you have to skip one to use those :)
12:21noncommomerath: what do you mean "already refers to.."? the example above worked - i think it'll work 4 u
12:22ystaelthe binding of *1 in other namespaces is still right (I can (in-ns 'another.namespace) and then *1 works again)
12:22momerathhmm- ok, it did once I added the constantly
12:22momeraththanks noncom!
12:22ystaelbut I can't (def *1 another.namespace/*1)
12:23noncommomerath: (constantly x) is just (fn [& whateva-i-don-care] x)
12:23noncommomerath: i think it was #' missing
12:24momerathyeah- I'm reading that now. I tried the #' without constantly in either place
12:24noncombtw #'x is (var x)
12:25momerathi get boolean cannot be cast to IFn
12:27noncommomerath: you do now?
12:27noncom,(def ^:dynamic *ansi-color?* true)
12:27domgetterSay I have two lists of the same size. What's the idiomatic way to consume one element from each list at the same time?
12:27clojurebot#'sandbox/*ansi-color?*
12:27noncom,*ansi-color*
12:27clojurebot#error {\n :cause "Unable to resolve symbol: *ansi-color* in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: *ansi-color* in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol:...
12:28noncom,*ansi-color?*
12:28clojurebottrue
12:28noncom,(alter-var-root #'*ansi-color?* (constantly false))
12:28clojurebotfalse
12:28MJB47domgetter interleave?
12:28noncom,*ansi-color?*
12:28clojurebotfalse
12:28domgetterIn this case, I want to sum to corresponding elements: (3 4 5) ( 7 8 9) --> ((+ 3 7) (+ 4 8) (+ 5 9))
12:28MJB47or
12:28noncommomerath: ^^^ ?
12:28MJB47oh*
12:28momerathwithout the constantly, i def it in my module, can get the val at the repl, but if i alter-var-root, i get cannot cast bool to ifn
12:29noncomdomgetter: btw if you awnt to map on it, just (map f coll-1 coll-2 coll-3 ...)
12:29momerathif i add constantly just at the repl, that works too - my problem is solved, but I don't grok the need for constantly when doing the alter-var-root
12:29noncomah
12:29MJB47,(map + [1 2 3] [4 5 6])
12:29clojurebot(5 7 9)
12:30noncommomerath: you see, alter-var-root expects a function which will accept your current value and return a new one, *not* just the new value
12:30momerathahh
12:30domgetter,(map + (3 4 5) (7 8 9))
12:30clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval161 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval161 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval161 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69...
12:30noncom,(map + '(3 4 5) '(7 8 9))
12:30clojurebot(10 12 14)
12:30domgetteroh drr
12:31domgetterthank you
12:31domgetterhaha
12:31noncomtry to stick to []s for data instead of ()s
12:31domgetternoncom: I have a thing that is returning a seq
12:31noncomthen it's ok :)
12:31domgetter:P
12:31justin_smith,(seq? '(1 2 3))
12:31clojurebottrue
12:32slestersilly seqs
12:32noncomseqsy sills
12:33noncomyeah, the clojuric subliminal dualism between [] and () sometimes gets me
12:34domgetterIt's similar to Ruby's dualism between arrays and enumerators
12:36JodyAnyone use dubtrack.fm?
12:37JodyI only ask here because this is a room full of coders and I've started a coding music room
12:39jweissif i am creating a lazy-seq representing a queue at a remote endpoint (where i am repeatedly dequeuing and adding to my lazy-seq), is there a way to timeout reading the next item from the seq (in case the remote queue stands empty for a long time)? or is this something for core.async (or similar) to handle
12:40noncomjweiss: looks like a task for core async
12:40jweissnoncom: ok that's what i figured thanks
12:41noncomJody: not really. you mean , ther's good music to listen to while coding?
12:42JodyLol, I find that video game music tends to be a good choice
12:42JodyDesigned to provide pleasant noise, but not be the focus of attention
12:43noncomyeah.. to me, while coding, music is to sink the unnecessary noise around and inside my head :)
12:44noncomthings like this one do very good also: http://mynoise.net/NoiseMachines/catPurrNoiseGenerator.php
12:44noncomor some movie soundtracks, true
12:44noncommovie/game
12:49ToxicFrogpseudonymous: it definitely resolves dependencies, or did when I used it; Clearley requires math.numeric-tower and criterium, among other things, and neither were required by other parts of my project.
12:51ystaelRight now the ndarray implementation of core.matrix treats indices as offsets into a flat array instead of doing bounds checking: (m/mget (m/array [[0 1] [1 0]]) 0 2) yields 1 instead of an IndexOutOfBoundsException.
12:51ystaelIf this is as designed, is there a way to get bounds checking instead?
12:51ystael(that is, without implementing it myself)
12:59beakyhello
12:59beakyhow do i nillify an exception
12:59beakye.g. if i attempt to create a regex with invalid pattern, i wanna get nil instead of exception
12:59noncomjust (try your-code (catch Exception e nil))
13:00beakyah
13:01noncombeaky: you can also (try your-code (catch Exception e (println "OOPS!" (.getMessage e)) nil))
13:01noncomso that at least some info you get
13:01noncomif you need it ofc
13:02noncomalso, nil would be redundant here
13:02beaky,(try (re-pattern "\@ lol inavald regex") (catch Exception e nil))
13:02clojurebotbeaky: I don't understand.
13:02beakywha
13:02noncomhaha
13:02noncomits his reaction on exceptions i think
13:02beaky,(try (re-pattern "\@ lol inavald regex") (catch Exception e nil))
13:02clojurebotbeaky: It's greek to me.
13:02beakyoh
13:02noncom,(throw (Exception. "AARGH"))
13:02clojurebot#error {\n :cause "AARGH"\n :via\n [{:type java.lang.Exception\n :message "AARGH"\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6943]\n [clojure.lang.Compiler eval "Compiler.java" 6906]\n [clojure.core$eval invokeStatic "core....
13:03noncomhmmmm
13:03noncom,(try (throw (Exception. "AARGH")) (catch Exception e (println "CLOJUREBOOOT")))
13:03clojurebotnoncom: Pardon?
13:03noncomsee
13:03beakyoh
13:03schmir,(defn maybe-re [s] (try (re-pattern s) (catch Throwable err nil)))
13:03clojurebotschmir: Titim gan éirí ort.
13:04TimMc,(/ 0)
13:04clojurebot#error {\n :cause "Divide by zero"\n :via\n [{:type java.lang.ArithmeticException\n :message "Divide by zero"\n :at [clojure.lang.Numbers divide "Numbers.java" 158]}]\n :trace\n [[clojure.lang.Numbers divide "Numbers.java" 158]\n [clojure.lang.Numbers divide "Numbers.java" 3784]\n [clojure.core$_SLASH_ invokeStatic "core.clj" 994]\n [clojure.core$_SLASH_ invoke "core.clj" -1]\n [sandbox$ev...
13:04schmir,(maybe-re "[")
13:04clojurebot#error {\n :cause "Unable to resolve symbol: maybe-re in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: maybe-re in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: maybe-r...
13:04noncomschmir: it did not define the function heh
13:04Glenjaminanyone know if there's a way to get Prismatic's schema to not throw exceptions?
13:04lumayou can't use try-catch on clojurebot
13:04schmiryear, looks like the bot hates me
13:06justin_smithbeaky: do you mean catch one?
13:06ystaelGlenjamin: if you want the error object back instead of an exception thrown, you can use s/check instead of s/validate
13:06justin_smithn/m I got lagged
13:06ystaelif you are doing coercions, s/coerce! throws, s/coerce doesn't
13:07schmir,(let [maybe-re (fn [s] (try (re-pattern s) (catch Throwable err nil)))] (maybe-re "."))
13:07clojurebotschmir: Pardon?
13:07justin_smithschmir: try/catch does not work with clojurebot
13:08schmirah.ok.
13:20Glenjaminystael: perfect, thanks
13:21ghost_Hey guys, I've made a tic tac toe game, it's my first program. Tell me what do you think (140 lines)
13:21ghost_https://github.com/youarebeautiful/tictactoe
13:24slesterghost_, "it's meant to crash" haha
13:25ghost_slester: it crashes if you give it wrong input, it's your fault!
13:26slesterI'm a pentester at heart.
13:26justin_smithghost_: instead of performing an illegal function call, you could raise an exception. Same consequences, slightly more clear about the intention.
13:26ghost_justin_smith: hadn't had it in my course yet
13:27ghost_justin_smith: I'll fix that
13:27ghost_(also, courses are boring)
13:27justin_smith(throw (Exception. "You done messed up."))
13:27justin_smith,(throw (Exception. "You done messed up."))
13:27clojurebot#error {\n :cause "You done messed up."\n :via\n [{:type java.lang.Exception\n :message "You done messed up."\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6943]\n [clojure.lang.Compiler eval "Compiler.java" 6906]\n [clojure.c...
13:28justin_smithghost_: another explicit option is (System/exit 0)
13:28justin_smithor you can return a value other than 0 if you like
13:29justin_smithI forget what the unix command line convention is for a return code that means "somebody cheated"
13:29ghost_justin_smith: Updated
13:30justin_smithheh, didn't expect you to use my exact message, but I guess it works
13:31ghost_I think someone who helps me deserves a place in my program
13:32ghost_also, how to get it to work on windows? my friend said me that it doesn't fire up terminal
13:32ghost_it just loads up and does nothing
13:33justin_smithright, you would have to make sure they launch from a terminal, or use some other UI
13:33justin_smithghost_: maybe there's a windows flag you can set on the jar "run in terminal" ? I have no idea though, maybe TEttinger2 has some clue
13:34ghost_justin_smith: o-kay, thanks. any comments about the code?
13:39justin_smithghost_: what's with all the vec calls?
13:39tolstoyMakes it easier to print the board, I bet.
13:40justin_smith,(let [[board first-row second-row third-row] (iterate (partial drop 3) [1 2 3 4 5 6 7 8 9])] third-row) ; ghost_
13:40clojurebot()
13:40justin_smith,(let [[first-row second-row third-row] (iterate (partial drop 3) [1 2 3 4 5 6 7 8 9])] third-row) ; ghost_
13:40clojurebot(7 8 9)
13:41justin_smithheh, fixed
13:41ghost_it didn't work without that, 'cause the output was like ("-" "-")
13:41justin_smith,(let [[first-row second-row third-row] (partition 3 [1 2 3 4 5 6 7 8 9])] third-row)
13:41clojurebot(7 8 9)
13:42ghost_see? :D
13:42justin_smithghost_: then why not change your print function?
13:42tolstoyYou could move the "vec" stuff to the presentation layer, but, eh. The code is clean, imho.
13:43ghost_sec, I'll take a look
13:43ghost_my juxt'd function wouldn't work, iirc
13:44ghost_but I might be wrong, I'm a bit tired
13:44justin_smithghost_: it would just return seqs instead of vecs
13:45ghost_uhm.. what about vec-vals function?
13:45justin_smithvec-vals ?
13:45ghost_it'd be a helper for these rows and such
13:46ghost_(defn vec-vals [row] (vec (vals row)))
13:46ghost_ugh, it's nonsense
13:46justin_smithghost_: my suggestion was that they don't need to be a vec except where you are printing, but sure, that would also simplify things a bit
13:46ghost_but looks prettier!
13:47ghost_justin_smith: I'll try to do something about this tomorrow
13:47justin_smithghost_: also I would prefer (get board (keyword move)) over ((keyword move) board)
13:47ghost_justin_smith: for now, I'll just make vec-vals
13:47ghost_justin_smith: why?
13:47justin_smith,(def vec-vals (comp vec vals))
13:47clojurebot#'sandbox/vec-vals
13:47ghost_ohh, that's neat
13:48justin_smith,(vec-vals {:a 0 :b 1 :c 2})
13:48clojurebot[0 1 2]
13:48tolstoyNot (-> (drop 6 board) vals vec)? ;)
13:48justin_smithghost_: regarding get vs. putting (keyword ...) in the calling position, I just find that is more readable
13:48justin_smith(-> 6 (drop board) vals vec)
13:48justin_smithhaha
13:49ghost_justin_smith: I'll change that too
13:50ghost_seems idiomatic :D
13:50ghost_can I use that?
13:50tolstoyOr (->> board (drop 6) vals vec) ;; to keep the focus on the board. ;)
13:50justin_smithtolstoy: yes, I was thinking (-> 6 (drop board) ...) was silly
13:50tolstoyYeah. ;)
13:51tolstoy6 takes a little journey.
13:51ghost_so, not a good idea? sniff.
14:00slestertolstoy, laughed at '6 takes a little journey' :) thanks for that.
14:03andonilssonCIDER question: how do I turn off instrumentation of a fn after a debug session?
14:07andonilssoncider-load-buffer was the answer
14:08justin_smithandonilsson: just reloading that one function should do it too
14:10andonilssonjustin_smith: you're right, that'll be the easiest. Thx
14:13tolstoySpeaking of Cider, pretty nice that #_ now de-font-locks the commented out expression.
14:18sdegutisI like how with CIDER you can just C-u M-. on anything and it'll take you to the source, even when the source part of clojure itself and written in Java. Like, do it on str/join or StringBuilder and it'll just work.
14:19kungitolstoy: This is sweet :-)
14:19sdegutisOh my bad, StringBuilder is part of Java itself. But it still takes you right to the source. Nice.
14:19sdegutisCIDER is a pretty great IDE.
14:20kungisdegutis: StringBuilder does not work for me
14:20sdegutisHmm. It takes me right to StringBuilder.java
14:20tolstoyIf I fire up something like Intellij, I start turning off stuff (docked side windows, popups, etc, etc) and end up with a bare window, a basic text editor. I like Emacs/Cider's opt-in strategy.
14:20sdegutiskungi: perhaps you don't have Java JDK installed?
14:21sdegutistolstoy: yeah that's pretty great
14:21sdegutisAlthough I have mixed feelings about the Emacs part. Sometimes it feels a bit too bare-bones, and when I install packages to fix that, it feels a bit ad-hoc and weird still.
14:22sdegutisAlmost like every feature is an afterthought turned into a prototype written in a rush and published as soon as it resembles something like what the person had in mind in the first place.
14:22tolstoysdegutis Have you tried that "literate emacs init files" thing?
14:23sdegutisHmm never heard of it.
14:23sdegutisBut I just put comments around stuff that's not obvious.
14:23kungisdegutis: I work with emacs for a couple of years every day.
14:23kungisdegutis: Sometimes packages break but most of the time it's great
14:23pseudonymoussdegutis: and eventually you'll see the brilliance of it all. If given enough time, you'll be able to customise emacs in every which way you want, to suit you.
14:23sdegutisAnd I ignore the majority of my emacs dotfiles, considering most of them ought to have been default settings and not stuff I had to manually set.
14:23tolstoysdegutis: Mine https://github.com/zentrope/.emacs.d/blob/master/config.org, but this one is more complete: https://github.com/danielmai/.emacs.d/blob/master/config.org
14:24sdegutiskungi, pseudonymous: yeah I've been using emacs full time (40+ hours per week) for the last 3 or 4 years, it's definitely useful
14:24tolstoyEmacs is kind of like Siracusa's "Naked Robotic Core". Stripped down to the primitives. You build your editor on top. Kinda like Clojure, come to think of it.
14:24tolstoyWhich doesn't really counter what you're saying. ;)
14:25sdegutisI'd like a version of for that's compatible with ->>
14:25sdegutisI know technically map works, but it feels not nearly as readable as for.
14:25sdegutistolstoy: I guess my main gripe with Emacs is that it can't do per-pixel scrolling like literally every other modern text editor (except maybe vim).
14:26sdegutisIt has to scroll per-line(s) and that isn't as easy to visually follow as I'm scrolling.
14:26tolstoysdegutis: I'm with you there.
14:26sdegutisBut hey I'm still using it so I guess it's not a deal breaker :D
14:28sdegutisI was rooting for some Electron-based editor to take over for a while. But by golly web pages are such an inefficient UI, I just can't get past that.
14:28tolstoyAnd the javascript.
14:28sdegutisAnd from what I hear, Atom is slow enough to bother even most Atom advocates. So that seems to confirm the idea that you just can't use web apps to render text editors and still sleep well at night.
14:28tolstoyI sure wish LightTable had just stuck with being super good for Clojure.
14:29sdegutistolstoy: it's not anymore?
14:29tolstoyIt supports multiple languages.
14:29sdegutistolstoy: I mean I know they tried to make language agnostic, but did that somehow hurt its niceness toward Clojure?
14:29tolstoyIt's written in ClojureScript, but I wonder what it would be like if it was just _for_ CLJS and CLJ.
14:30tolstoyWell, at first, it was going to be a cool new re-thinking of what an IDE meant. De-emphasis on files, for instance. But then it turned into a regular editor.
14:31sdegutisMy main concern about LT was that it tried to abstract away the concept of files, and let you move and place context-less snippets of code around your screen. That's not a feature I would ever want or use. My code lives in files and I'm fine with that, trying to abstract that away seems like going the completely wrong direction.
14:31tolstoySo, you're not a fan of the Smalltalk environments?
14:32sdegutisNope.
14:32sdegutisFiles/folders are a simple and familiar paradigm, they happen to work great with computers.
14:32tolstoyI think there are environment for people who need to use programming to get their own work done (like scientists), and for those who need to write static software. Smalltalk and Lisp Machines are the former.
14:33justin_smithreminds me of something I saw recently that brought up the difference between building a doghouse vs. a highrise
14:33justin_smithcertain things that totally work when building a doghouse stop working once you are building a highrise - you just need to cross more ts and dot more is
14:34justin_smith(on the other hand, building a doghouse as if it were a highrise would be silly too)
14:34tolstoyjustin_smith: I've heard that recently, too. Something on Cognicast?
14:35justin_smithhmm... I think stuartsierra or maybe cemerick tweeted about the article?
14:36beakyi love clojure
14:37mavbozoi think it is that story about a guy applying software engineering project discipline when building a dog house
14:37pseudonymousjustin_smith: I heard a story like that retold from a Python presentation. The way I remember it, the speaker said that *he* heard it from a language designer who gave a talk many years ago (smalltalk?)
14:37justin_smithahaha - the plot thickens
14:38beakytig
14:38beakyoops wrong window
14:41tolstoyDoghouse / skyscraper: http://www.uml.org.cn/UMLApplication/pdf/booch.pdf
14:42tolstoyAlso mentioned: http://c2.com/cgi/wiki?SoftwareArchitecture
14:42tolstoyAlas, tainted by the UML chimera.
14:45justin_smithtolstoy: cool, thanks!
14:48tolstoyI guess my point, though, was that there's a place for a fancy environment that uses code, but doesn't produce applications. Today, most people do that with Excel.
14:48tolstoyI think the Smalltalk and Lisp Machine environments were in that mode, and are mis-characterized when thought of as over-the-top IDEs.
14:50tolstoySo, now you have Chris Granger and his Eve project, maybe some of what Brett Victor is after.
14:50justin_smithso basically something more powerful than your scientific calculator but not real software architecture either
14:50justin_smithI think wolfram aims for that niche too
14:50mavbozotolstoy, i think Mathematica is one such fancy environment although never met someone who uses it seriously in scientific or engineering
14:51tolstoyYeah.
14:51justin_smithmavbozo: jynx
14:51mavbozoaaarghhhh
14:51tolstoyThe idea of those "image based" thing was that you install one, and then customize and customize as you work toward solving problems.
14:52tolstoyNot unlike what we do with dot files and emacs config files. Except for non software dev purposes.
14:52tolstoyI wonder, who uses Mathematica?
14:55TimMcStephen Wolfram, I guess.
14:55justin_smithplus the people whose intellectual labor he "appropriates"
14:55futuroDoes anyone know how to make M-./cider-find-var open the buffer in the current window in emacs?
14:56futuroI've tried passing changing the prefix, calling it with M-;, etc, and it opens the buffer in a different window every time
14:57scottjfuturo: you can use shackle.el for that
14:58scottjfuturo: s/can/may be able to/
14:58futuroscottj: I'll look into that, thank you
15:02sdegutisI'm really deep into an algorithm that should be simple, and I'm getting my types so confused that I'm coming up with a string like "a,c,c,o,u,n,t" somehow.
15:06scottjfuturo: maybe you have popwin or something else loaded that's causing a window to be created when emacs wouldn't by default
15:07futuroscottj: no, no popwin here
15:07futuroand I don't remember ever setting something up to do that, since i've pretty much always hated this mechanic
15:07futurobut it's something worth thinking about, for sure
15:22sdegutis,(for [i (range 10) j (range 5)] [i j])
15:22clojurebot([0 0] [0 1] [0 2] [0 3] [0 4] ...)
15:23sdegutis,(for [i (range 4) j []] [i j])
15:23clojurebot()
15:23sdegutisDang. That's my bug.
15:23sdegutisTried to get clever with for, for out-clevered me.
15:56sdegutisThis stupid algorithm. Ugh!
15:57beakyi love algorithms
15:57sdegutis(f [] ["a" "b]) => ["a" "b"], (f ["x"] ["a" "b]) => ["x a" "x b"], (f ["x" "y"] ["a" "b]) => ["x a" "x b" "y a" "y b"], what the heck is f?
15:59justin_smithsdegutis: something in clojure.core.combinatorics?
15:59sdegutisI sure hope not.
15:59justin_smithor at least something using it...
15:59justin_smithhaha
16:01sdegutishttps://gist.github.com/sdegutis/f549b7ece0badf6fd26d
16:02sdegutisThis *almost* works: (for [x xs y ys] (str x " " y))
16:04matthavenerjust do (if (empty? xs) [""] xs) :D
16:04matthavenerer, hrm, that would add a leading space
16:05sdegutisOh hmm, turn into coll, then remove nil?, then str/join " "
16:06sdegutisNope, doesn't work.
16:07beakyye looks combinatorialy
16:07sdegutisOkay this works. (fn [xs ys] (for [x (or (not-empty xs) [nil]), y ys] (if x (str x " " y) y)))
16:07beakyspeaking of combinators and combinatorials, how do i permute a string
16:07sdegutisI'm not proud, but it works.
16:08beakyto generate all possible combinations of elements a set
16:08sdegutisAll tests pass. Woo!
16:08sdegutisbeaky: but (for) is great for that.
16:08sdegutisI just needed a hack for when one of the sets was empty.
16:08sdegutisThis works great.
16:09sdegutisNow I can do this! https://gist.github.com/sdegutis/d7a03b9aa5b797b74a8e
16:09beakyyes for is the ultimate
16:09beakyit is like set builder notation
16:10sdegutis:)
16:11jessicakhi i'm trying to get https://github.com/clojure/tools.analyzer working but getting errors. here's what i did. 1) made a new lein app, 2) added [org.clojure/tools.analyzer.jvm "0.6.9"] as a dependency in project.clj, 3) executed this code http://pastebin.com/Fi2B757G 4) i get an error java.lang.RuntimeException: Unable to resolve symbol: create-var in this context on the defn analyze line. any ideas?
16:12jessicak(the pastebin is the code verbatim from the tools.analyzer link)
16:16tolstoySpeaking of "6 takes a journey", clj-time allows for (-> 3 days ago) and (-> 6 days from-now).
16:18Bronsajessicak: hi, that's not supposed to be code you should use, the README says "Here's a simplified version of how clojure.tools.analyzer.jvm/analyze is defined"
16:19Bronsajessicak: just use `clojure.tools.analyzer.jvm/analyze`
16:21jessicakBronsa: thanks that worked!
16:25Bronsajessicak: feel free to ping me at any time if you have questions/issues about t.a
16:26jessicakBronsa: perfect i actually have a ton of questions but didn't want to be a bother! lol
16:26tolstoyreloaded.repl is not working for me anymore. It can't find namespaces. WTF!
16:27jessicakBronsa: is there any way to get the output shorter? i passed in a multiline function (around 5 lines) and the output was 300,000 characters. i'm mostly interested in just a tree of commands and their children
16:33Bronsajessicak: http://sprunge.us/iFHj?clj something like this maybe?
16:34Bronsait just shows the shape of the AST and the node types
16:34Bronsakeep in mind that the output of t.a will be an AST for the fully macroexpanded form, so that's going to include a lot more code than you might expect
16:36jessicakyeah.. hmm
16:36jessicakmaybe i'll just do it manually.. i think tools analyzer might be a bit too advanced for what i'm trying to do
16:37jessicaki'm just trying to convert any clojure expression in to a json tree with text and children keys for each node
16:37amalloyjessicak: one way to get a general idea of how to achieve what you want is to do it once manually. what's a very simple input you could give, and the output you would want?
16:39justin_smithjessicak: also, it sounds like some of what you want might overlap with technomancy's serializable-fn project? https://github.com/technomancy/serializable-fn
16:39justin_smithor maybe not
16:39jessicakamalloy: sure. something like this: (+ 1 2) ---> { "text": "+", "children": [ { "name": "1" }, { "name": "2" } ] }
16:39jessicaknot sure if i typed that right but that's the basic idea
16:39jessicakerr /s/name/text
16:40jessicakit could even be a lisp edn tree instead because there's always clj->js
16:41amalloyand what do you want to happen to maps in the input?
16:42amalloylike (assoc {:x 1} :y 2)
16:42jessicakamalloy: yeah that's a bit of a problem with all the reader macro stuff .. i wasn't exactly sure about how to handle all those special cases yet and was going to first work with standard lisp syntax stufff
16:42devnAnyone know where typed clojure is at with gradual typing?
16:42amalloyokay
16:43amalloywell, then you just want to do a postwalk like somebody suggested, but with a different function
16:43amalloy,(use 'clojure.walk)
16:43clojurebotnil
16:43amalloy,(doc postwalk)
16:43clojurebot"([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall."
16:45amalloybleh, i can never figure out how to use postwalk. i'd jsut write it recursively by hand :P
16:45turbofailheh
16:46amalloy,((fn tree [form] (if (coll? form) {:text (first form), :children (map tree (rest form))}, {:text form})) '(+ 1 2))
16:46clojurebot{:text +, :children ({:text 1} {:text 2})}
16:46tolstoyAh hah! invokeStatic in clojure 1.8 breaks weavejester's reloaded.repl reset function.
16:47Bronsa:(
16:47Bronsatolstoy: how so?
16:47jessicak! that looks good!
16:47amalloyand of couse your format presumes that your tree always has a plain old symbol in the first position: it can't handle something like ((juxt inc dec) 1)
16:47tolstoyBronsa: It can't find dependent namespaces, I think.
16:47jessicakoh yeah my format was just an example
16:49justin_smithjessicak: so what's going to be done with this data structure once it's on the cljs side?
16:49jessicakjustin_smith: tree visualization!
16:49justin_smithoh, cool
16:50tolstoyBronsa: https://github.com/weavejester/reloaded.repl/issues/3
16:50amalloyanyway jessicak, the general idea is to write a function that recursively maps itself over all the children. my example was a simple version conforming to your example, but if you have more detailed stuff you can write just about anything following the same general structure
16:51Bronsatolstoy: that doesn't look like a DL issue to me
16:51jessicakamalloy: ok thanks so much! i'll probably be back soon with more questions :p
16:51tolstoyDL?
16:51Bronsadirect linking
16:51Bronsathe invokeStatic thing :)
16:52tolstoyOh. I don't know what the issue is. I just see "invokeStatic" and fuzzy match on half-read mailing list posts.
16:53amalloyyeah that doesn't look related to invokeStatic at all
16:54tolstoyMaybe an issue with tools.namespace?
16:55Bronsaare you sure it's tied to the clojure version you're using and not an actual issue in your project?
16:55tolstoyBronsa: Well, the project compiles and runs. I can "reload" when using Clojure 1.7.0. So, I don't know. Reasonably confident?
16:56sdegutisAnyone know of a clever way to convert a byte array to a hex string?
16:56justin_smithsdegutis: map a format across it and reduce to combine the strings?
16:56tolstoySomething like (apply str (map #(format "%x" %) bytes))?
16:56amalloysdegutis: i would start by typing into google: java convert byte array hex string
16:57Bronsa`google is something sdegutis is apparently not too familiar with
16:57Bronsa`tolstoy: can you track down the earliest clojure version that makes this fail?
16:57sdegutisBronsa`, amalloy: I done that. The solutions look fine, but I thought maybe you guys know a better way.
16:57justin_smith,(apply str (map #(format "%x" %) (.getBytes "hello")))
16:57clojurebot"68656c6c6f"
16:58Bronsa`tolstoy: TBH i'm skeptical that this is a clojure issue, but if it is I'd like to understand it :)
16:58sdegutisjustin_smith: looks neat!
16:58sdegutisjustin_smith: I never saw that solution in my google search :D
16:58tolstoyBronsa` Yeah. First I'll try upgrading tools.namespace, then go back to that.
16:58Bronsa`cool
16:58sdegutisamalloy, Bronsa`: you might fit in better in #swift, they're a lot like you over there
16:59sdegutisThe only two things ever said in that channel is questions or answers containing lmgtfy.com.
16:59TimMcsdegutis: This is one of those things that one might expect to find in a stdlib... but it's not.
16:59justin_smithsdegutis: for cleanliness, it's good to add "UTF-8" as the last arg to .getBytes
16:59sdegutisTimMc: Well it looks like it mostly works with (format "%x"), but that kind of cheats since it uses java.util.Formatter
16:59justin_smithsdegutis: and if that's the wrong encoding, you are doing it worng
17:00sdegutisTimMc: plus I heard it goes negative if the first byte is 1
17:00rhg135I have lmgtfy as a command in my client
17:00TimMcjustin_smith: There's a nice simple flowchart waiting to happen there.
17:00justin_smithTimMc: :)
17:00sdegutis:D
17:01tolstoyBronsa` Hm. Upgrading to [org.clojure/tools.namespace "0.3.0-alpha2"] seems to fix it.
17:02sdegutis,(defn md5 [s] (->> (-> (MessageDigest/getInstance "md5") (.digest (.getBytes s "UTF-8"))) (map #(format "%x" %)) (apply str)))
17:02clojurebot#error {\n :cause "No such namespace: MessageDigest"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such namespace: MessageDigest, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "No such namespace: MessageDigest"\n :at [clojure.lang.Util runtimeE...
17:02Bronsa`tolstoy: ¯\_(ツ)_/¯
17:02sdegutisOh right.
17:02sdegutisAnyway, no need to pull in the digest lib for md5, this is simple!
17:02justin_smithsdegutis: I think you need to do the import for MessageDigest
17:02TimMc,(apply str (map #(format "%02x" %) (.getBytes "☃" "UTF-8")))
17:02clojurebot"e29883"
17:03TimMcsdegutis: %02x
17:03justin_smithTimMc: oh yeah, 02x is definitely better
17:03justin_smiththanks for that one
17:03sdegutis,(do (import '[java.security MessageDigest]) (defn md5 [s] (->> (-> (MessageDigest/getInstance "md5") (.digest (.getBytes s "UTF-8"))) (map #(format "%02x" %)) (apply str))))
17:03clojurebot#'sandbox/md5
17:04sdegutis(md5 "foo")
17:04sdegutis,(md5 "foo")
17:04clojurebot"acbd18db4cc2f85cedef654fccc4a4d8"
17:04sdegutis:)
17:04justin_smith$ md5 -s foo => MD5 ("foo") = acbd18db4cc2f85cedef654fccc4a4d8
17:04justin_smithnice!
17:05sdegutis:D
17:05justin_smithnice work, team
17:06sdegutisThanks so much justin_smith and TimMc for making this dream come true!
17:08TimMcyou'll be receiving our bill in 2-3 business days
17:09l1xamalloy: any ide why inside a go-loop i have following memleak? i am calling this method http://basho.github.io/riak-java-client/2.0.1/com/basho/riak/client/core/util/BinaryValue.html#create(byte[])
17:10sdegutis(->> (for [_ (range 1000)] (let [s (str (java.util.UUID/randomUUID))] (= (md5 s) (digest/md5 s)))) (remove true?) (count) (zero?)) => true ;; yay!
17:10l1xhttps://usercontent.irccloud-cdn.com/file/pygnBy31/Screen%20Shot%202015-12-15%20at%2017.10.32.png
17:10amalloyme? why are you asking me?
17:10l1xcant examplain
17:10amalloyask the channel
17:10l1xsorry :)
17:10l1xchannel: anybody has any idea why this is happening?
17:11Bronsa`possibly http://dev.clojure.org/jira/browse/ASYNC-138
17:11l1xBronsa`: wow
17:11l1xdamn this is not good
17:12l1xalright I rewrite it without go-loop
17:12l1xBronsa`: thank you very much
17:13sdegutisI'm finding that I can remove a good portion of third party libs I'm using by replacing it with 50 lines of code or less.
17:15justin_smithl1x: it's a good thing to minimize code inside go to coordination and dispatch code, and do the real work in thread or future anyway (in general) - though that bug is scary
17:15justin_smithmakes me wonder if I need to move some things out of go blocks in my app...
17:16Bronsa`or test the patch and bump the ticket? :P
17:17justin_smithBronsa`: haha, there's that too
17:18l1xjustin_smith: thx
17:21sdegutisHmm.
17:21sdegutisHmmmmmm.
17:22sdegutisPhew, only using <! and >! inside (go)
17:45l1xjustin_smith: what is the best way of getting rid of go and go-loop? i see one option with https://gist.github.com/l1x/3dacf952f70370d9c158
17:45tolstoysdegutis What was the issue with a go block??
17:46sdegutistolstoy: See Bronsa`'s link
17:46sdegutisBronsa`: lol what's with the backtick in ur nick
17:47Bronsa`sdegutis: don't ping me for those useless questions thanks
17:47tolstoyHe's logged in from two different places.
17:47sdegutiswhoa okay then
18:04devnAnyone here handy with datascript?
18:05devnI want to pull datoms for a namespace
18:06devnlike '{:find [?x] :in [$ ?ns] :where [[:?x (namespace ?ns) _]]}
18:23devnNote, not in datomic.
18:46slestergreetings, clojurians. just wondering if people made the switch from vim to cursive and what their thoughts were? I'm pondering it because IDEs are "the future" or whatever.
19:14justin_smithslester: I'm sure someone has done this.
19:15slesterand now, I wait :D
19:15cflemingslester: Yeah, there are quite a few ex-vimmers using Cursive
19:15slesterex-vimmer makes me sad :(
19:15cflemingWell, perhaps current vimmers using Cursive for their Clojure needs :)
19:16slesterhehe
19:16cflemingIdeaVim is the emulation plugin - I'm not a vim person myself, but reports say it's about evil-mode level
19:16slesterI am feeling a few of the rough edges of vim with regards to REPLing and doc lookups and such
19:19cflemingslester: Ok, give it a whirl. There are some issues, as with all emulations I guess, but it mostly seems ok. Let me know if you have issues, I'm in and out over the next day or two. I'm off for a bit now but I'll be back later on.
19:20slestercfleming: thankee
19:21cflemingI'm planning to put some more serious effort into vim/emacs emulation in the new year.
19:21slesterI just miss my vimrc.
19:22slesternotably things like jk mapping to esc
19:23cflemingYeah, I don't really know what that means :)
19:23cflemingLike I say, I'm planning to investigate it and get more familiar with it next year.
19:23slesterinstead of going over to hit escape, I can type jk really quickly and it'll exit insert mode
19:23slesteryes I'm that lazy :(
19:23slesterbut escape is so very far away
19:24cflemingYeah, esc is problematic. What about Ctrl-[, with caps lock as control?
19:24slesterhmm, well, my brain is already trained to jk :(
19:24cflemingI know IdeaVim is customisable, but I don't know how that works or if it's doable to that extent.
19:24slesterI'll look more into IdeaVim
19:25justin_smithslester: jk totally works in evil mode with emacs
19:26justin_smith(if you have the right emacs stuff set up of course - "evil leader mode")
19:26slesterjustin_smith: back, ye heathen! never, emacs, never!
19:26slester:D
19:27justin_smithslester: If I get tired of evil I'll try out cursive, but it's my thing for now.
19:30slesterjustin_smith: all jokes.
20:27sdegutisDoes the "stack" in a stack-based virtual machine mean, like, an array of values that variables are talking about in that scope? So like if I have "a=1" in some pseudolanguage, it'll probably compile "a" into some index on this array, and reference that index of the "stack" array every time "a" is used?
21:25WickedShellI was working through some boxed math warnings today when I came across 3 warnings that all point at the same async/go but the 3 math functions its compaining about aren't anywhere in my code (indeed the functions aren't used within 200 lines of where the warning is) http://pastebin.com/E1Xh52Ja has the (async/go that it's upset about, lin 431 is the line that the async/go is on)
21:25WickedShellIs there any reason why I apparently have a lt nth and inc there?
21:27amalloysounds like go's transformation of doseq involves some math
21:28WickedShellIs there a way I can look at whats its translating it to without having to drop to java byte code?
21:34pyonI added [me.raynes/fs "1.4.6"] to my project.clj, ran `lein deps`, and got the following error: http://ix.io/mPb.
21:35pyonI'm at home, and most certainly not behind a proxy. So I don't know what the error could be.
21:35spiedenanyone know how to load a repl with a certain dep on the classpath with boot?
21:36spiedenintuition said this but it didn't work: boot -d hashids:0.1.0 repl
21:39spiedenhmm, actually not working when i add it to lein project either
21:41spiedenderp, wrong artifact -- works
22:03liuchonghi
22:04liuchongare you using boot or lein? what's the difference?
22:12tolstoylein is declarative, boot is scripty
22:51princesoit seems hard to work with a (:gen-class) Class from java, since you cant access the whole namespaces like you do when working in the REPL --- [java.lang.ClassNotFoundException: schema.core, compiling:]
22:52princesoyuo are forced to (:require) in the (ns).
22:58princesoHow to translate those REPL capabilities to the VM
23:00princesoclasspaths are the same
23:02justin_smithprinceso: you can use clojure.lang.RT
23:03justin_smithwith that you can require namespaces, get vars from the namespaces, etc.
23:14owlbirdhow to convert (sql, {:name "alice" :age 20 ...}) to [sql where name=? and age=? .... "alice" 20], should use "recur" ?