#clojure logs

2015-09-26

00:10crockethi
00:10crocketClojureScript has seqable?, but clojure doesn't.
00:11crocketIs there a shared function for checking seqability in clojure and clojurescript?
00:11justin_smithno, clojure lacks that function
00:12justin_smithcrocket: but you can write it by looking up the code behind jvm seq
00:15crocketI am starting to guess seqable? is not a generic function.
00:15justin_smithjvm clojure makes a bunch of different weird things into seq
00:17sdegutisWhich Clojure version has the #cljs{} stuff?
00:18justin_smithsdegutis: 1.7 has #?(:cljs ...)
00:18justin_smithif that's what you mean
00:18sdegutisah nice!
00:19sdegutissweet, we'er on 1.7
00:19sdegutiswhich Clojure has the .cljc files?
00:19justin_smithsee also #?@(:cljs ...)
00:19justin_smiththat is cljc
00:19sdegutisoh nice
00:19sdegutisso if I'm using Clojure 1.7, I have no need for the cljx hack?
00:20justin_smithno, I'd avoid cljx now if you can
00:21sdegutisyay
00:23sdegutisgnite
00:47nxqdhi guys, what's the best way to toggle a boolean value in an atom. ex : (def a (atom {:test true})) (!swap a assoc :test (not (:test @a)))
00:48justin_smithnxqd: (swap! a update :test not)
00:48justin_smith,(def test (atom {:a true}))
00:48clojurebot#error {\n :cause "denied"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojureb...
00:48justin_smith:P
00:48nxqdjustin_smith: thanks ! It's exactly I'm looking for :D
00:48justin_smithit seems clojurebot is less permissive now
00:49nxqd,(def test (atom {:a true}))
00:49clojurebot#error {\n :cause "denied"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojureb...
00:49nxqdhaha :D
00:49justin_smith,(def test' (atom {:a true}))
00:49clojurebot#'sandbox/test'
00:49justin_smithaha!
00:49justin_smith,(swap! test' update :test not)
00:49clojurebot{:a true, :test true}
00:49justin_smith,(swap! test' update :test not)
00:49clojurebot{:a true, :test false}
00:49justin_smithwell, I messed that up, but I hope the idea carries
00:50nxqdyeah, thx :D
01:07jeayeI need to spawn a child process, feed its stdin, and process its stdout interactively. Anyone have suggestions for a good lib to use?
01:07justin_smithjeaye: I use ProcessBuilder via interop, but there is also conch if you prefer something wrapped up in clojure code
01:08jeayeI'd prefer a wrapper. Checking out conch now, thanks.
01:57jeayejustin_smith: It seems like sh/done needs to be called before sh/stream-to-string can be used.
01:57jeayeAre you aware of how to read the stdout without killing the process? I know we get back a BufferedInputStream; I'm just sure of the best way to handle it.
02:00diqye,,,
02:00clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
02:51crocketAre all collections seqable?
02:51crocketWhat else is seqable?
03:03ianhedoesitcrocket: anything that implements Seqable
03:05ianhedoesitcrocket: why do you ask?
03:26crocketClojure doesn't have seqable? function.
03:26crocketianhedoesit, ^^
03:29ianhedoesitseq?
03:29ianhedoesit,(doc seq?)
03:29clojurebot"([x]); Return true if x implements ISeq"
03:29ianhedoesitwhich isn't exactly what you want, depending on what you're doing. it seems like an XY problem
03:30crocket,(seq? [1 2 3])
03:31clojurebotfalse
03:31crocket,(seqable? [1 2 3])
03:31clojurebot#error {\n :cause "Unable to resolve symbol: seqable? in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: seqable? 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: seqable...
03:31crocketianhedoesit, ^^
03:31crocketClojureScript has seqable?
03:31crocketClojureScript is supposed to be shadowing Clojure, but ClojureScript already has functions that Clojure doesn't have.
03:31crocketIt is deviating from Clojure.
03:32crocketPerhaps, seqable? is not a generic function.
03:36ianhedoesitseqable? returns true if s (the collection) satisfies ISeqable, whereas seq? returns true if it satisfies ISeq
03:37crocketianhedoesit, only in clojurescript
03:37ianhedoesityes
03:37crocketseqable? is not in clojure
03:38ianhedoesitI know
03:39crocketI was reminded that it is impossible to decide whether there'll be unhandled exceptions in clojure.
03:39crocketAt least, it's practically impossible
03:39crocketunhandled exceptions would crash a program.
03:39kenrestivoi'm baffled and stuck by this: https://www.refheap.com/109975
03:40crocketa million pieces?
03:40ianhedoesitcrocket: I'm still unsure what you're trying to get at.
03:41crocketianhedoesit, clojure is not the final language.
03:41kenrestivocrocket: about a dozen lines of stacktrace
03:41crocketDoes that create a lot of threads?
03:41ianhedoesitI'm assuming that there being a seqable? function in clojurescript is an implementation detail because of what clojurescript is
03:41kenrestivoi'm sorry, 37 lines of stacktrace, but who's counting
03:41kenrestivocrocket: no, it's one thread
03:42jeayeWhen using conchy, I can interactively write to the process, but I stream-to-string, for reading, doesn't run until the process has finished. How can I also interactively read?
03:42crocketOther engineering disciplines stick to one final language.
03:42crocketProgramming can do the same.
03:42crocketMath, and electrical engineering did it
03:42ianhedoesitcrocket: still, I don't understand what you're trying to ask or say or anything?
03:43crocketianhedoesit, From the perceived imperfections in clojure, I surmise clojure is not the last language programmers will agree to use as the only language.
03:43kenrestivoanyway, if there's any insight on to how to cancel a future inside a map in in an atom, without causing an exception any time the atom is touched after that, i'd like to know
03:43jeayes/conchy/conch/ and s/I s/ s/
03:44crocketkenrestivo, Dereffing a future can't wait forever, so there's a timeout.
03:44ianhedoesitcrocket: of course not. again, what is the relevance or importance of that? nothing is the final or last or best language.
03:44crocketianhedoesit, I"m looking forward to the best language for all.
03:44ianhedoesitis the fact that Elixir or PureScript have different implementation details make Haskell a worse language?
03:45ianhedoesitHaskell/Erlang*
03:45crocketI also mentioned that it's practically impossible to determine whether a clojure program will crash due to unhandled exceptions.
03:46TEttingercrocket: the problem domains for computing have changed a lot more over the last 20 years than they have for, say, statistics.
03:46TEttingerit makes sense that we have stable terminology for statistics
03:46TEttingerit does not yet for computing
03:46crocketnot yet
03:46TEttingerlook up the history of numeral systems :P
03:47crocketTEttinger, I get your point.
03:47TEttingerthe problem is that quantum computing will probably change everything again, and who knows what after that
03:49TEttingerquantum algorithms are an extremely new field of computing... mainly because they're almost all theoretical except for the tinest couple-of-quantum-gates scenarios
03:49kenrestivo,(str "a picture is worth " (clojure.pprint/cl-format nil "~@R" 1024) " words")
03:49clojurebot#error {\n :cause "clojure.pprint"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassNotFoundException: clojure.pprint, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.ClassNotFoundException\n :message "clojure.pprint"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :tra...
03:50TEttingerhuh, that isn't included?
03:50kenrestivo,(require 'clojure.pprint)
03:50clojurebotnil
03:50kenrestivo,(str "a picture is worth " (clojure.pprint/cl-format nil "~@R" 1024) " words")
03:50clojurebot"a picture is worth MXXIV words"
03:50kenrestivo:/
03:50TEttingerha!)
03:51TEttinger,(clojure.pprint/cl-format nil "~@R" -1024)
03:51crocketI expect to see lots of quantum computers in 2 decades.
03:51clojurebot"-1,024"
03:51TEttinger,(clojure.pprint/cl-format nil "~@R" 4/3)
03:51clojurebot"I"
03:51crocketWill quantum processors be able to run linux?
03:51TEttingerinteresting
03:51TEttingeralmost assuredly not
03:52crocketThen, I guess graphene processors will replace silicon processors.
03:52kenrestivosomeone will figure out a way to run the x86 instruction set on them so all the legacy code will still run
03:53TEttingerquantum bits almost assuredly won't be able to be represented in C without heavy changes to the language. there's no concept of probabilistic program state...
03:53crocketCan you simulate determinism in quantum processors?
03:53TEttingerthe halting problem?
03:54crocketCan quantum processors run pure functions in clojure?
03:54crocketlike (fn [a b] (+ a b))
03:54TEttingerwell anything quantum is going to need truly radical changes to the way the program is handled and runs
03:54TEttingerno modern OSes will run without emulation
03:55crocketHow far are we from genuine quantum processors?
03:55TEttingerthey were estimating 2015 10 years ago. so the predictions are bad.
03:55crocketWe sort of have a variant of quantum processor.
03:55crocketcalled D-Wave.
03:55TEttingerwe have "quantum adiabatic" crappy stuff
03:56TEttingeryes that
03:56crocketdiabetic?
03:57TEttingeradiabatic in there means it's only capable of solving simulated annealing problems and some other well-defined optimization problems, and there is insufficient evidence to say they perform better at that than conventional non-quantum-adiabatic machines
03:57TEttingerD-Wave is not bogus, it's just really early and it isn't actually using qubits
03:58TEttingerit's another way of approaching computing problems, specific ones
03:58crocketqubit
03:58TEttingerquantum bit
03:58crocketqubit sounds cute
03:58TEttingera bit that can be simultaneously 1 and 0 in different probabilities
03:59crocketCan a qubit be 1 or 0?
03:59crocketYou said different possibilities.
03:59TEttingerthe snide answer is "yes"
03:59crocket1 can be emulated.
03:59crocket1 100% 0 0%
03:59kenrestivowow, that's screwy, this is also a death: https://www.refheap.com/109976
03:59crocketkenrestivo, deref timeout is normal.
04:00crocketkenrestivo, If you disable deref timeout, it will just wait forever.
04:00kenrestivohow can i make it stop being normal?
04:00crocketIt is not useful
04:00crocketUse deref or some other function to disable timeout.
04:01crocketAnd, it'll freeze.
04:02kenrestivoi am not at all clear what you mean.
04:02TEttingeryeah, I'm by no means knowledgeable on this, but... a qubit can probably be made to produce a result 100% of the time, but only at absolute 0 with a perfect semiconductor, no interference, etc. -- runtime conditions being imperfect in every possible case due to physics being a thing, you can't get 100% probability I think. and that's why quantum computing is probabilistic.
04:03kenrestivolook, i just want to be able to continue to use the other useful things in that atom and not have it made inaccessible because there's a cancelled future in it
04:04crocketkenrestivo, Your future never returns a value.
04:04crocketDereferencing the future will freeze.
04:05crocketThat's it
04:05crocketHow is it useful?
04:05TEttingerit isn't derefed
04:05kenrestivothat's what i'm saying.
04:05TEttingerhowever, futures start calculating immediately, right?
04:05crocketok
04:06crocketI wasn't really looking at the code
04:06crocket,(doc future)
04:06kenrestivothat was evident.
04:06clojurebot"([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also - realized?."
04:07kenrestivobut the repl obviously derefs it in order to print it, causing explosions.
04:07crocketok
04:07crocketThe repl
04:07TEttingerhm, does it?
04:08kenrestivo,(def foo (atom {:baz 1}))
04:08clojurebot#'sandbox/foo
04:08kenrestivo,foo
04:08clojurebot#object[clojure.lang.Atom 0x280e3568 {:status :ready, :val {:baz 1}}]
04:08kenrestivoit must, in order to print out :baz 1
04:08kenrestivohowevaaaa
04:09kenrestivo,(def foo (atom {:baz 1 :quux (future (while true (Thread/sleep 1000)))}))
04:09clojurebot#error {\n :cause "no threads please"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.SecurityException: no threads please, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3661]}\n {:type java.lang.SecurityException\n :message "no threads please"\n :at [clojurebot.sandbox$enable_security_manager$fn__857 invoke "sa...
04:09kenrestivofine
04:09TEttingerI'm testing in my repl
04:09kenrestivoanyways, the refheap has the stuff.
04:09kenrestivothanks TEttinger
04:11TEttingertry (@foo :bar)
04:11TEttingerin mine, I can still access :bar but not the whole thing or :quux once the future has been cancelled
04:11crocketkenrestivo, I see "java.util.concurrent.CancellationException"
04:11crocketIt is normal
04:12crocketjava.util.concurrent.CancellationException in :quux
04:12TEttingerI wonder...
04:12TEttingermaybe you can replace the future with a different value
04:13kenrestivoi was thinking that, swap! foo assoc-in :quux nil) might do it
04:14kenrestivo,(swap! foo assoc-in [:quux] nil)
04:14clojurebot{:baz 1, :quux nil}
04:16TEttingerha! it isn't swap!, but I tried (send foo assoc :quux 0)
04:16crocketkenrestivo, But, you'll leak memory
04:16TEttingerit still threw the exception but did assign it
04:16crocketor not
04:16crocketCan a frozen future be ever destroyed?
04:17TEttingerin my agent, the state no longer references the future
04:17TEttingerso I assume GC will pick it up now that it's no longer referenced
04:18crocketmaybe not
04:18crocketThe future will never resolve to a value.
04:19kenrestivoi generally trust the GC, but might fire up some monitoring tools and check later.
04:19kenrestivoindeed, just assoc'ing nil in there does the trick, so i'm over this hurdle. thanks!
04:21Trioxinis scala good too?
04:21TrioxinI never even read anything about it until I just realized it also uses the JVM lol
04:28TEttingerTrioxin: people have... strong opinions on Scala.
04:28TEttingerI'm not a fan, having used it, java, and clojure
04:28TEttingerI've found I'm most productive in clojure, then java, then scala.
04:29TEttingerpart of that is being new to scala, a big part of that is the maze of complicated collections they use
04:29TEttingerscala doesn't add... a whole lot of stuff that java can't do
04:30Trioxinok cool. yeah I have no desire to use Java beyond libs I can get away using in clojure
04:30muhukTEttinger: I also feel more productive using clojure.
04:30TrioxinI'm still new to clojure. is it safe to say that if there's any Java lib someone has written I can use it with clojure?
04:30muhukTEttinger: not to be one of those people with strong opinions on Scala... but it isn't really designed to add stuff to java.
04:31muhukTEttinger: it's designed to bridge the gap between java & haskell (fp).
04:31muhukTrioxin: yes. So far. Possibly with the exception of some java8 stuff.
04:31Trioxinuh oh
04:32Trioxinthings breaking? :(
04:32TEttingerI used to be averse to using java, I've since started using it more and I've found it's easier to get churning out "dumb code" that operates on mutable arrays and similar data structures than to do the rough equivalent in Scala.
04:33TEttingermuhuk: not sure about that. lambdas are just implementing an interface IIRC, so they should be compatible with clojure as if they are objects implementing that interface
04:33TEttingerassuming you run clojure on JDK 8
04:33muhukTEttinger: hence; "possibly"
04:33TEttingerright
04:34Trioxinis that something clojure can address in an update?
04:34muhukeventually
04:34muhukI'm pretty sure one can find 3rd party libs with lambda support etc. even today.
04:34TEttingerI strongly suspect clojure is compatible with java 8 new features if you use it like other java interop
04:35TEttingerwhich isn't "pretty"
04:35TEttingerbut isn't hard
04:35muhukTEttinger: yeah, that's a more accurate way to say it.
04:36Trioxinfinally, my new coils are tasting like metal and it's terrible no matter how good I prime them. My Amigo Donner coils were awesome till my local shop ran out so I grabbed some nickel coils to try out temp control mode on my mod. Any suggestions?
04:37muhukTrioxin: did you do a search in clojars?
04:38Trioxini was jk that was a vaping question
05:37crocketTEttinger, What is research interst?
05:37crocketinterest*
05:38TEttingercrocket: what are my interests in research stuff?
05:39TEttingerI am uh not in academia, to say the least
05:40benhudahi all
05:40benhudaanyone got a reasonable experience building CLI tools with clojure (re startup time)
05:41benhudai've just explored chicken and gambit for this use case, but the ecosystem is prehistoric in comparison
05:41benhudaim wondering if java8/9 does any good?
05:42crocketTEttinger, I am not in academia, either.
05:42crocketBut, I have research intersts.
05:42benhudaor perhaps cljs and emscripten make this better ? not sure
05:42crocketbenhuda, a clojure program takes 1-2 seconds to start up.
05:43crocketbenhuda, ClojureScript on nodejs might start up better, but clojurescript tooling is inferior to that of clojure.
05:44crocketIf your CLI program needs to be invoked multiple times repetitively in a short period, clojure will be slow.
05:44TEttingerbenhuda: I believe java 9 starts up a bit faster. it isn't noticeably faster for maven, haven't tried with lein, small java apps start up much faster
05:44TEttingerjava 9 is also not done yet
05:44crocketprehistoric ecosystem!!
05:45crocketbenhuda, Did you check out racket?
05:45muhukbenhuda: you'd get the best advice if you describe what your program does, use case, context etc...
05:45crocketClojure is decent for long-running processes.
05:45crocketLong-running processes that can consume a lot of RAM.
05:45crocketClojure is hungry of RAM.
05:46TEttingerbenhuda: for CLI usage of a lisp, it's possible Pixie has much better startup time at the expense of a somewhat less polished JIT compiler (affecting long-term performance), and it's rather similar to Clojure in features. I haven't used it but CLI seems to be an ideal case
05:46crocketPixie is not useable yet.
05:47crocketIt lacks documentation and tutorials
05:47TEttingerRacket also has good startup time and has absolutely excellent docs
05:47crocketAt this stage, it is suitable for pioneers.
05:47crocketRacket's long-term performance is not nearly as good as that of clojure.
05:48TEttingerbut for CLI, it should be better
05:48TEttingersmall short-running apps?
05:48crocketshort-lived apps
05:53noncom|2benhuda: crocket: TEttinger: i asked this question yesterday and was advised to look at drip and cake
05:53noncom|2and nailgun
05:54TEttingerindeed, that and technomancy's lein-in-OCaml thing
05:54noncom|2oh yes, that one too
05:54noncom|2i too think that clojure is rocks for cli tools. startup time is the only issue
05:55benhudayes id love to do cli with clojure. its great for personal development
05:55benhudai find myself hacking tools in my spare time, a lot more than building production systems from scratch
05:55TEttingerhttp://leiningen.org/grench.html#download
05:55benhudaand it's the greenfield feeling that makes me happy
05:55noncom|2cool!
05:56TEttingeralso, I was surprised how relatively easy OpenJDK 9 was to build on windows
05:56noncom|2i maintain a cli tool for our CI, which does all the work actually. clojure is really great in glueing up wonderful java/clojure libs and doing the script
05:56benhudaTEttinger i'll be annoying and say i love "shipping" tools to friends.. so any of the nail-like solutions dont work
05:57benhudabasically if clojure compiled to Go (and i've just finished sifting through all those dead clj-to-go projects), it would be heaven
05:57benhudai see Go as the next assembly for systems
05:58TEttingerhm. I'd be curious what the biggest hurdle to JVM startup time is for any significant application or any application that uses a large library (like clojure's standard lib)
05:58TEttingeroh!
05:58TEttingerhttp://clojure-android.info/skummet/
05:58TEttingerskummet works on desktop too
05:59benhudaTEttinger very interesting
05:59TEttingerit's a subset of clojure technically. but it should work on quite a lot of code
06:01benhudai guess time is on our side? some day someone will make clojure good on CLI?
06:01TEttingerskummet might do it already. startup seems to be about a third
06:01benhudatrying out the sample now..
06:02TEttingerit may be slower to compile, not sure
06:03TEttingerbut for producing an app that will be run many times, it seems like a good choice
06:03benhudaargh... 'Cloud not find or load main class'
06:04benhudamy bard.
06:04benhuda*bad
06:04benhudaah.. not much sleep
06:06benhudanope, main doesnt get loaded
06:08benhudagood now
06:08benhudajava -jar target/lein-skummet-sample-0.0.1-SNAPSHOT-standalone.jar 0.50s user 0.06s system 155% cpu 0.357 total
06:08benhudambp core i7 2.2ghz
06:10TEttingerthat's pretty good
06:11benhudaits reasonable, feels like a heavy Ruby CLI app. which is good
06:11TEttingerit's better than feeling like a heavy java CLI app, like uh Maven
06:11benhuda:)
06:12TEttingerbenhuda: which generation i7, I wonder?
06:12benhudathis is a mid 2014 mbp
06:13TEttingerthey get faster every generation but not by the same amounts it seems. I'd guess that's a haswell proc, could be a Q or a U model
06:13TEttingerthe U are ultralow voltage and are dual-cores
06:14ianhedoesitI'm on a pretty low end hp and the sample skummet project takes about 800ms
06:14benhudathat's more encouraging
06:15benhudawhat java is that, ianhedoesit ?
06:15TEttingerjava 8, I'd hope
06:15ianhedoesitand by low end I mean a $300 laptop I bought about five years ago.
06:15ianhedoesitnope
06:15benhudai think he's using 7
06:16ianhedoesitjava version "1.7.0_79"
06:16ianhedoesitOpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)
06:16ianhedoesitOpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
06:16benhudayea
06:16TEttingerjava 7 is nearing EoL I think. I'm surprised it's still so common
06:16benhudanot the first time i see 7 being faster than 8
06:16TEttingerI'm using the Zulu OpenJDK build
06:16TEttingerreally?
06:16ianhedoesitmine isn't faster than yours?
06:16ianhedoesityours ran in 500ms, no?
06:17benhudaianhedoesit yes, but factor in the huge difference in hardware.. i'm saying 7 is faster than 8
06:17TEttinger0.8 on old HP vs. 0.5 on rather-new-MBP, but OS differences are possible too. SSD especially too
06:17benhudanow look at the benchmarks on the website, and that's running 0.45
06:17benhudaand on 7
06:17ianhedoesitI suppose, yeah.
06:17TEttingerit's likely you're both getting limited by disk rate alone
06:18ianhedoesitI'm using a 7200rpm hdd
06:18benhudassd here
06:18benhudai really want to pack on some libraries and build a small CLI tool. that would be a better evaluation
06:18winkjust noticed I neevr installed a lein plugin it seems
06:18ianhedoesitwhich doesn't really matter, does it? there's no io in the sample
06:18TEttingerthere was a while when HP was actually good about using 7200RPM drives in laptops. now it's all 5400 on their (newly redesigned for awfulness) website
06:18TEttingerianhedoesit: loading clojure.jar from disk
06:18ianhedoesitTEttinger: most of the internals on this aren't what I bought, to be fair.
06:19ianhedoesitoh duh
06:21TEttingerI'm kinda amazed that Carly Fiorina can actually try to get any job, much less commander-in-chief, after being in charge of HP during one of its worst periods. it may have been that the employees wouldn't trust any CEO after the guy who canceled trash pickup to save money at HP offices. Yes, there were cockroaches, and rats.
06:21TEttingerworking at HP seems like a nightmare
06:21winkwhy does GitHub for Windows have to be so horrible? grr
06:22TEttingerwink: I like it. it's very resource-intensive for some reason
06:22winkTEttinger: I can't even find how to clone something that's not in my user/orgs
06:22winkused shell now
06:22TEttingerbut it seems OK. occasionally I need to "git push origin master" when syncing fails
06:22winkin anger
06:22TEttingeroh!
06:22ianhedoesitbenhuda: re: "pack on some libraries and build a small CLI tool," do you have anything in mind? obviously it doesn't really matter, but something that is reasonably complex but still something that an average developer may want to use would be good.
06:22TEttingeryou can drag a repo link onto it
06:22winkm(
06:23benhudaianhedoesit i'm trying to take jsoup and fetch a url, then run a selector on the markup
06:23ianhedoesitsounds reasonable.
06:24TEttingerwink: do you have a gitlab? you can even use github for windows for non-github URLs
06:24winkTEttinger: I just try to code as little as possible on windows (this is main gaming/surfing box at home)
06:25benhudaianhedoesit yikes. i have some macro errors. clojure-soup uses the $ macro. there was some blurb about macros on the skummet webpage
06:26winkand apparently I cant build this lein-skummet example
06:26TEttingerha! try dragging this onto your github for windows... window: https://gitlab.com/gitlab-com/www-gitlab-com.git
06:26TEttingerit will ask to confirm, you don't need to
06:27TEttingerbenhuda: $ as in inner class $?
06:27winkthat's nice yeah. once you knwo it :D
06:27benhudaTEttinger well, i'm just taking the sample here as-is (attr "abs:href")) ;; attribute selector
06:27ianhedoesitbenhuda: would using the :skummet-skip-vars option?
06:27ianhedoesithelp*
06:27benhudawhoops. meant this https://github.com/mfornos/clojure-soup
06:28winkbenhuda: how exactly did you run the skummet sample? just go to lein-skummet\sample and "lein uberjar" or did you add something to a profile before?
06:29benhudawink go into sample, add clojure-soup, sprinkle some soup code, then lein do skummet compile, skummet jar
06:29ianhedoesitwink: https://github.com/alexander-yakushev/lein-skummet/wiki#example
06:29TEttingerbenhuda: I suspect https://github.com/mfornos/clojure-soup/blob/master/src/jsoup/soup.clj#L20 is the trouble
06:29ianhedoesitlein do skummet compile, skummet run
06:29winkianhedoesit: ah, thanks. there was no readme. *sigh*
06:29benhudawink yea its on the wiki
06:30ianhedoesitand then to see the real time test, I would use java -jar foo-standalone.jar because the lein option still incurs normal lein times
06:33winkoh right, now if only I had "time $@" :P
06:33winkthanks, but at least it worked
06:34wink304 ms
06:34winkaccording to Measure-Command {}
06:34wink3,5e-06 days. thanks, powershell
06:39winknice, it's indeed twice as fast
06:40ianhedoesitwhat is?
06:40ianhedoesitoh, skummet's standalone jar?
06:41TEttingerI'm glad I remembered finding skummet a few days ago! someone linked the clojure-android project and I clicked around to skummet from there. I wonder why it isn't more widely-known yet? (probably because not many clojure devs are targeting android?)
06:42ianhedoesitI also don't think many clojure devs are too interested in CLI projects, or really anything lightweight.
06:43TEttingerit does also reduce memory usage, which I think is a concern
06:47TEttingerah! benhuda, I think the problem with clojure-soup and skummet is related to `get!` and not `$`
06:48ianhedoesitTEttinger: why do you say that?
06:49TEttingerthat goes roundabout to calling invoke
06:49TEttingerinvoke is: (clojure.lang.Reflector/invokeInstanceMethod instance method (to-array args)))
06:49TEttingerwhich I am pretty sure is not compatible with skummet's skimming off of Vars
06:50ianhedoesitI'm using get! right now with skummet
06:51TEttingerhm!
06:51TEttingerthen I have no idea what the problem was
06:51ianhedoesitbenhuda: how are you trying to use it? I'm using jsoup with skummet
06:51benhudaianhedoesit it works?
06:52ianhedoesitit is for me, yes.
06:52TEttinger(inc ianhedoesit)
06:52TEttinger(dec lazybot uptime)
06:52ianhedoesitlol
06:52benhudaianhedoesit i'm using clojure-jsoup.. perhaps that's the difference?
06:52ianhedoesitI'm using the library you linked me to, I mean.
06:53TEttingeryeah, no get! in a java lib, no ! in java names, heh
06:53benhudaah, well i do no more than just using the first sample on the clojure-jsoup readme
06:53ianhedoesitI just added the first example in the README for clojure-jsoup to my project and am using skummet
06:53TEttingerinteresting!
06:53benhudahmmm..
06:53ianhedoesitian@ian-g7:sample$ java -jar target/lein-skummet-sample-0.0.1-SNAPSHOT-standalone.jar
06:53TEttingerto the refheap!
06:53ianhedoesitHello, World! 42
06:53ianhedoesitfoobar
06:53ianhedoesitsorry for the multiline output!
06:53ianhedoesit(http://www.google.com/chrome/browser/?hl=en&amp;brand=CHNG&amp;utm_source=en-hpp&amp;utm_medium=hpp&amp;utm_campaign=en http://www.google.com/advanced_search?hl=en&amp;authuser=0 http://www.google.com/language_tools?hl=en&amp;authuser=0)
06:54TEttingerwhat?
06:54clojurebotwhat could possibly go wrong
06:54benhudaianhedoesit sure it gets executed?
06:55ianhedoesitwhat do you mean?
06:55TEttingerthat looks like it yeah
06:55benhudathe output looks like the default sample output. can you print out something out of a web page you're scraping with jsoup?
06:55TEttingerthat last google thing is the intended output I think
06:55benhudaah
06:55benhudasorry :)
06:55benhudai was blind for that link
06:55TEttingerlinks scraped off google
06:58ianhedoesithttps://www.refheap.com/109980
06:58ianhedoesittoo lazy to trim it down to the relevant functionality
06:58ianhedoesitbut you get the point - that runs just fine
06:59benhudaso i use that sample and keep getting errors. i guess this is something wrong with my own project
06:59ianhedoesitalso the jar is quite fast. 1.872s for the jar and 4.912s for lein skummet run
07:00benhudaianhedoesit how is your project.clj looking?
07:00ianhedoesitobviously the majority of that time seems to be the actual getting of google (very slow and touchy internet here)
07:01ianhedoesithttps://www.refheap.com/109981
07:01benhudait might be my lein
07:01benhudahttps://github.com/alexander-yakushev/lein-skummet/issues/4
07:01ianhedoesitwhich, again, is not as small as it should be if I want to just show off skummet
07:01benhudadamn. it is. i'm on lein 2.5.1
07:02ianhedoesitI'm on 2.5.2
07:02benhudaupgrading..
07:03ianhedoesitI'm upgrading to 2.5.3. assuming that it'll still work. :)
07:04ianhedoesitthis is actually pretty exciting. I've wanted to use clojure for some CLI applications but I wouldn't ever use it if it took five seconds to run.
07:06benhudai think good CLI experience is the tipping point for every language
07:07benhudaso... nothing works for me. not 2.5.1/2, and not 2.4.3
07:07ianhedoesitseems to work
07:07ianhedoesit2.5.3 works for me, that is.
07:08ianhedoesityou did say you're on java 8 right?
07:08benhudayep
07:08ianhedoesithm
07:08ianhedoesit2.5.2 and 2.5.3 work fine for me :/
07:09benhudayea, i guess i should give up. too much time :)
07:09benhudahave fun!
07:09ianhedoesithm, sad.
07:10benhudaok one last try worked
07:10benhudawhat to know what it was?
07:10benhudarm -rf target :)
07:10benhudadamn it
07:10ianhedoesitoh, by the way
07:10ianhedoesithttps://github.com/alexander-yakushev/lein-skummet/issues/6
07:10ianhedoesitthat's probably why
07:10ianhedoesityou need to call lein clean yourself ;)
07:10benhudahehe
07:11ianhedoesitI probably should've said something since I already ran into that.
07:11ianhedoesitso it works now?
07:11benhudayup
07:11ianhedoesitawesome!
07:11benhudai made a print right before the network call, to see if the extra jar is affecting startup time
07:12benhudaso this is awesome
07:13benhudai think all in all, we have the startup time of racket
07:13crocketIs it possible and easy to shorten the startup time?
07:13benhudabut not chicken or gambit, which i guess if its acceptable for racket, its acceptable for clojure cli tools
07:13benhudacrocket yes, we've just been discussing this and experimenting together.. its been fun.. read up :)
07:14crocketSo, what is the winner?
07:14ianhedoesitskummet seems promising.
07:15benhudaindeed. for me, this completes around 5 hours total of going through a few scheme implementations.
07:16benhudai just verified - racket and skummet 300ms/362ms respectively
07:16benhudagood enough?
07:16crocketskummet?
07:16ianhedoesitI don't know, those 62ms concern me.
07:16benhudaclojure with skummet
07:16crocketDoes scummet lead to fast startup time?
07:17crocketI thought skummet was for android
07:18crocketWhy does rich hickey not adopt skummet?
07:18benhudawell, looks like it works... scroll up to catch up
07:19crocketToo long; didn't read
07:19benhuda:)
07:19crocketGive me a summary
07:19crocketWhat is the best?
07:20benhudathere's no best actually.. there's only skummet
07:20crocketWhy is skummet no integrated into clojure yet?
07:20benhudai.. don't know..?
07:22wasamasait's fine, just ignore the crockpot
07:23ianhedoesitusing core.async with skummet, and making a request to google and scraping for attributes using a third party library takes ~3-3.5s on my terrible laptop with a terrible internet connection
07:24crockethttp://clojure-android.info/blog/2015/07/01/gsoc2015-skummet-faster-now/#sec-2 is funny
07:25crocketwasamasa, Ignore yourself
07:30ianhedoesitbenhuda: I think if you remove the :skummet-skip-vars key in project.clj you can save a few hundred ms as well. that seems to slow down compile time and run time (but I can't actually say for compile time - it just seemed that way)
07:31ianhedoesitfor runtime it seemed about 100-150ms slower if I had the one var being skipped. in a real project I don't think you'd actually need that at all.
07:32ianhedoesitalso, using core.async with skummet gives me about a 2.5s runtime. that's pretty fantastic.
07:32scottjcrocket: rich played with some similar techniques last year in the fastload branch. I think there were issues that motivated them to not merge it.
07:33crocketlike what
07:33scottjcrocket: idk, have you searched JIRA?
07:34scottjyou could also read skummet website and mailing list looking for issues
07:34crocketI didn't know JIRA.
07:34wasamasalol
07:34benhudaianhedoesit wow
07:34wasamasacrocket: did you assume clojure has no bugs?
07:35ianhedoesitbenhuda: yeah. ~2.5s vs ~5.8s on my laptop
07:35ianhedoesitpretty speedy.
07:35wasamasaFWIW, I can't find any mentions on the bugtracker
07:35benhudaianhedoesit interesting. no diff. here after removing skip vars (i did a clean)
07:36crocketwasamasa, That's not useful
07:36scottjcrocket: afaik the fastload branch sped up start time but slowed down runtime.
07:37crocketI heard it
07:37borkdude_what's the general idea behind the socker repl server in clojure 1.8, compared to what we have already with lein, nrepl, etc?
07:38crocketRight now, ClojureScript on nodejs is fast to load.
07:38crocketnot easy to set up.
07:39justin_smithborkdude_: I think the idea is to have something official, and built into the core of the lang (as opposed to nrepl which is unofficial and has a bunch of extra deps)
07:39justin_smithborkdude_: I think rhickey had some design differences with nrepl that he wants to implement too
07:39borkdude_justin_smith ok, like with cljx --> reader conditionals
07:39ianhedoesitbenhuda: to be fair it is only 100ms. there's a lot of reasons I could've seen that :)
07:39justin_smithexactly, yeah
07:40justin_smithborkdude_: and I would expect a similar result - something lighter weight and cleaner to work with
07:41justin_smithborkdude_: it would even help us with start up time potentially, because based on my experimentation, lein itself and nrepl each take slightly more time to start than the core of clojure itself, so there's room for speedup there
07:42borkdude_I also saw they're working on making things more static, as in, not being able to redefine vars, which would make things a bit faster maybe
07:42justin_smithborkdude_: oh, potentially a lot faster to start up, that's awesome
07:43TimMcGood for apps, but not as interesting for servers.
07:44TimMc(Then again, who cares about JVM startup time on servers?)
07:44justin_smiths/JVM/clojure/
07:45crocketTimMc, People who write CLI apps
07:45crocketServers rely a lot on CLI apps.
07:45justin_smithTimMc: I was looking at this OS the other day - it can launch an instance of an ocaml VM in response to an incoming request faster than my clj app can serve a request
07:45crocketWriting CLI apps in clojure is beneficial.
07:45anejustin_smith: what os is this? Mirage?
07:45justin_smithTimMc: I mean launch a fresh vm and calculate and return a reply
07:46justin_smithane: yeah
07:46anethat thing is a work of art
07:47crocketMirage is restricted to Xen.
07:47crocketIts usefulness is not great.
07:50ianhedoesitbenhuda: well I've enjoyed learning a bit with you tonight. thanks for that. :)
07:51benhudaianhedoesit same here, a lot of fun! :)
07:57TimMccrocket, justin_smith: Mmm, I meant the long-running services themselves.
07:58TimMcThat's pretty cool about OCaml. :-)
07:58justin_smithTimMc: yeah, but quicker startup time opens up the potential / flexibility to do other cool things
07:58TimMcI would turn off any var-immutability perf feature on a server.
07:59justin_smithbut then again ocaml doesn't have good support for real threads, so they use processes instead...
07:59TimMcIt's too valuable to be able to liverepl in and start redefining things.
07:59justin_smithTimMc: your server code rebinds vars in core?
07:59justin_smithahh
07:59TimMconly in emergencies :-)
07:59TimMcWould this only be in core, though?
08:00justin_smithTimMc: maybe I misunderstood
08:00justin_smithI didn't think it would be a global "can or cannot rebind any vars" switch
08:01justin_smithTimMc: I guess I naively imagined something like "freezing a namespace" as an explicit thing
08:01TimMcpresumably it would exempt vars that were specially marked
08:01justin_smithTimMc: right, like *out* for example
08:03ashwink005I can't understand whats the difference between :strs and :keys
08:03justin_smithashwink005: they expect different types as keys in the map
08:04justin_smith,(let [{:strs [a b c]} {:a 0 :b 1 :c 2}] [a b c])
08:04clojurebot[nil nil nil]
08:04justin_smith,(let [{:keys [a b c]} {:a 0 :b 1 :c 2}] [a b c])
08:04clojurebot[0 1 2]
08:04TimMcjustin_smith: The other day I was trying to debug something for a customer so I fired up a server just for them, liverepl'd in, and pinned request debugging to full throttle.
08:04justin_smith,(let [{:strs [a b c]} {"a" 0 "b" 1 "c" 2}] [a b c])
08:04clojurebot[0 1 2]
08:05TimMcIt was super nice to be able to do that.
08:05ashwink005justin_smith, Oh! thanks!
08:05justin_smithTimMc: I've been using edn inside kafka for similar stuff, but retroactive
08:06ashwink005wonder why there's so little written about them in clojure.org
08:06ashwink005thanks again
08:06justin_smithashwink005: it would be under "destructuring"
08:07justin_smithashwink005: http://clojure.org/special_forms#Special Forms--Binding Forms (Destructuring)
08:07justin_smitherr
08:08justin_smithhttp://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)
08:08justin_smithoh wow, that doesn't even mention :strs
08:08ashwink005justin_smith, yes I'm on the same page. There's just one line without examples there.
08:09justin_smithoh wait it does
08:09ashwink005yeah
08:09ashwink005very little
08:09justin_smithyeah, pretty terse on that topic
08:09justin_smithashwink005: http://conj.io tends to have more detailed info / examples
08:16ashwink005yes I saw that :)
08:19TimMcjustin_smith: /me looks up kafka
08:20TimMcWhat do you mean by retroactive?
08:20justin_smithTimMc: basically it's a persistent distributed message queue, so the same mechanism that allows requests to hit the processing backend or replies back to the gateway server the client talks to also allows looking up ~24 hours of messages for examination or replay
08:21TimMcHmm, I wonder what kind of load it can take.
08:21justin_smithTimMc: kafka uses the disk as the backing for the queue, which means a client can ask for old messages and get up to speed quickly in a pub/sub scenario, but also allowing replays
08:22justin_smithand we use transit to encode all the messages
08:23TimMcHow many messages/second can it handle, though? I'm thinking about rate more than queue depth.
08:24justin_smithkafka has excellent throughput, I don't know if there's a higher throughput open source message system with any reliability to it
08:24justin_smiththe disk usage started as a perf optimization (it can use the disk linearly faster than it can manage the heap in the vm, is their claim)
08:25justin_smiththe fact that this allows logging and replay is a nice side effect
08:25justin_smithTimMc: https://engineering.linkedin.com/kafka/benchmarking-apache-kafka-2-million-writes-second-three-cheap-machines
08:28justin_smithTimMc: the system is still under development, but we can get enough info from the kafka messages to narrow down where the handling of some request broke down, and get a reusable payload that we can potentially use in a unit test
08:42TimMcNeat!
08:43TimMcThat's about 500x one of our current needs, I think.
08:44winkI just kafka to be horrible in development. (or aything that uses ZK, really)
08:44winkif you let it run, it will run for months
08:44winkif you put it on vagrant and start/stop it or redo parts, you're in for a treat
08:50justin_smithyeah, zk is not so elegant about shutdowns
09:32xtrntrhi, if i was simulating something like a jellyfish
09:33xtrntrand i need to keep track of state like orientation and coordinates
09:33xtrntrhow do i do that in clojure?
09:33xtrntri'm guessing the clojure init would be one big loop where i redraw the jellyfish
09:33xtrntrwith each update i get the new state variables and redraw a new jellyfish?
09:37justin_smithxtrntr: what drives your render loop?
09:37xtrntri'm looking at some example code
09:38xtrntrit looks like this guy uses doseq and a callback-fn
09:47justin_smithxtrntr: depending on how the graphics loop works (whether it calls some callback you provide, or renders some data you give to it, etc.) that will change the top level, how things interface
09:47justin_smithbut usually the pattern in clojure would be to use iterate or recur to create a new state at each step, and then repeat the process starting with your new state
09:48xtrntrjustin_smith: okay, i'll try stuff out and see what works. thanks!
10:09rritochHi, I have a question or possibly a bug regarding gen-class.
10:10rritochI guess the important question is if I have :init init :prefix "foo-" my initialization function is supposed to be foo-init correct?
10:12rritochIf I am right about that than this situation seems to be a bug. I'm getting a class cast exception because my init takes an argument which should NOT be passed to the parent constructor.
10:12rritochThe parent has a single arg constructor and a no arg constructor, I expect my init function to call the no-arg constructor (defn foo-init [bar] [[] bar]) and set the state to the passed argument.
10:14rritochI think it is instead trying to call the single arg constructor which isn't going to be of the same type as my state.
10:15rritochIs this a mistake on my part or a bug?
10:27rritochI'm not even sure its a bug since the arity probably need to be determined at compile time, but there should be some kind of syntax for this type of situation.
10:42rritochI also tried pushing up a null via (def foo-init [bar] [[nil] bar]) but it's still passing bar to the constructor.
10:42rritochThe super-class constructor that is.
10:44rritochIt seems I can only resolve this with a setter and a mutable state accepting no args to init.
10:48rritochWell, before I take that option I'll try using the :constructors paramter, I guess that's what I did wrong.
12:30akkadcider seems to cause a lot of hangs in emacs when I hit line return while defining a function
12:59RedNifreHi.
12:59RedNifreWhich of your languages did clojure replace, if any?
13:05akkadclojure have a (type or (type-of?
13:06akkadRedNifre: Common Lisp
13:06akkadruby
13:06RedNifreyes, there is (type
13:06akkadk
13:07akkadthanks
13:07RedNifreInteresting, I also thought that, for me, clojure might a good replacement for ruby...
13:07RedNifrewhich other languages do you use?
13:07akkadconcurrency, memory usage
13:07akkadpython
13:07RedNifreso why doesn't clojure replace python for you?
13:08akkaddifferent domain. config management through ansible.
13:08akkadwe'll see if I can get jamvm to replace scripts
13:20Trioxinlol clojure replace PY
13:21RedNifreTrioxin ?
13:21Trioxinthat statements is kind of like "Who cares" because if you know PY you should be happy to also know PY. So much out of academia is done in PY that to not know it almost a crime these days. Replace it for your own projects sure I guess but PY is PY and Clojure is Clojure
13:30winkthen gain python is one of the easiest to learn
13:38mungojellycouldn't we just start a python as well as a jvm and have some sweet syntax for talking to it
13:40timothywQuestion.
13:40timothyw`reductions` returns a lazy sequence of intermediate stages of what `reduce` would have returned.
13:41timothywso `reductions` is like a lazy `reduce`, except it has all these intermmedite lists
13:41timothywi'd like to map over an infinite list, but in this case, I don't know how to take just the last value.
13:41timothywis there a trick to always getting the last value in that infinite sequnce... as if I were just dealing with 1 lazy sequence?
13:44justin_smithtimothyw: an infinite list has no last value
13:45justin_smithperhaps you mean the last value you care about... or you don't really mean an infinite list?
13:50timothywjustin_smith: yes, the last value I care about
13:51justin_smithtake-while or drop-while might help there
13:51timothywI’d like 1 infinite sequence, without all the intermmediate stuff…
13:51timothywhmm, lemme try
13:52justin_smith(first (drop-while not-good-enough (reductions f coll)))
13:52justin_smithsomething of that general shape maybe?
13:53akkadyou can (first any sequence.... that is soo damn nice
13:55timothywjustin_smith: it’d be nice to have (drop-while #(not (last? %))(reductions f coll))
13:55timothywexcept, there’s no last? function
13:56justin_smithtimothyw: if you aren't finding the actual last item you need your own predicate
13:56justin_smithunless the sequence stops, in which case just do (reduce f coll) and be done with it
13:57justin_smith(that is, if coll is not infinite)
13:57timothywakkad: I’d need the “last” thing of a `reductions` call - ie I need 1 lazy seq instead of the intermmediate values
13:57justin_smithtimothyw: if you want the last thing reductions returns, just use reduce, I thought you said the result was infinite?
13:58justin_smith,(reduce +' (range 10000000))
13:58clojurebot49999995000000
13:58timothywjustin_smith: i need the state accumulation offered by `reductions`, but would like just 1 infinite seq at the end
13:58timothywso I’m between a rock and a hard place
13:59justin_smiththen you need some function that decides if you are done yet
14:00justin_smithand if you can't write a function that makes that decision, your code is impossible to write
14:00timothywwell, I need i) the state accumulation and ii) i need for it to operate on a lazy seq
14:00justin_smithtimothyw: lazy seq is different
14:00timothywhmm, but reductions is doing its thing somehow…
14:01timothywit’s able to consume a lzy seq and produce a lazy seq
14:01justin_smithtimothyw: reductions is lazy, it doesn't care how long its input coll is
14:01justin_smithso what's the problem?
14:01timothyw… I just don’t want the intermmediate values
14:01timothywjustin_smith: exactly
14:01justin_smithwhich value do you want/
14:02timothywjustin_smith: I need i) the state accumulation and ii) i need for it to operate on a lazy seq AND iii) I don’t want to intermmediate values as output
14:02justin_smithOK, which value isn't intermediate?
14:02rhg135reduce
14:02justin_smithrhg135: he said the input was infinite
14:02rhg135Oh
14:03justin_smiththe thing he is asking for can't exist
14:03rhg135Is that possible?
14:03akkadare [ and ( interchangeable?
14:04justin_smithakkad: absolutely not
14:04akkadk
14:04mungojellyakkad: no, [ starts a vector and ( starts a list (which are evaluated)
14:04akkadgotcha
14:04justin_smithrhg135: infinite sequences definitely exist eg. (cycle [0]) or indefinite like range
14:05timothywif I (take 10 (reductions f coll)), the last value is the accumulation of everything I’ve done so far
14:05justin_smithsure
14:05justin_smithbut you wanted the "last value" and if your input is infinite, there is no such thing
14:05justin_smithso you need some criteria that decides you are done
14:05timothywso, it would be nice to just get that tail value in a lazy fashion
14:06justin_smiththat's what a lazy seq is, a lazy seq of tails
14:06justin_smithso just call reductions, and that's what you get
14:06justin_smithbut before you talked about only getting a last item. That just isn't a thing you can do if the input doesn't terminate.
14:07rhg135Justin_smith, I meant an infinite reduce
14:07timothyw“last” value is a crude way of putting it
14:07justin_smithrhg135: sure, it just wouldn't return, just like a loop that always calls recur
14:07timothywsince the tail is the accumulation of all previous operations, I’d just like that
14:08rhg135A returning one
14:08justin_smithrhg135: as long as you don't create a messed up state, it will chug along until you kill it
14:08rhg135:-P
14:08timothyw… and I don’t want it to return. In fact, I need it to be lazy
14:08justin_smithtimothyw: not returning and being lazy are different things
14:08justin_smith(loop [] (recur)) doesn't return, and is not lazy
14:09justin_smith(range) returns immediately, and is lazy
14:10timothywFair enough (cut the “return” statement) - I just need the result to be lazy (without giving me the intermmediate values)
14:10justin_smithtimothyw: that's absurd
14:10justin_smithall values in a lazy-seq are intermediate
14:10justin_smithuntil the seq ends, and yours wont (or so you'
14:10justin_smithve said)
14:11timothywOk, let me think about it some more.
14:11timothywMaybe I’ll just need to change my algorithm
14:13justin_smithtimothyw: any algorithm that uses an indefinite series needs some logic to decide if it is done (unless the point of the algorithm is to make another indefinite series, one element at a time)
14:13trisshey all. I'm getting the following error when trying to parse a file with clojure.xml/parse: UnknownHostException D java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:184)
14:14trissi.e. after running the following `(parse (file (resource "test.xml")))`
14:14timothywjustin_smith: yes, passing different transformed lazy sequences around is what I’m doing
14:14trisswhy would i be seeing an UnknownHostException here?
14:15timothywso map > filter > etc
14:15trissthe file can be slurped just fine
14:15justin_smithtriss: the xml has a bad url for some schema element?
14:16timothywwith that, we’re only getting a lazy seq of final values, or tails, or whatever… we’re not getting all the intermediate values
14:16justin_smitheg. a dtd that points at a bad host
14:16trissah... so I need to have the schema somewhere if its referenced in the DOCTYPE?
14:16trissah that makes sense
14:17justin_smithtriss: frankly xml confuses the fuck out of me, but yeah I think the schema URLs in dtds have to exist somewhere I think?
14:18trissjustin_smith: yeah I've never really enjoyed it.
14:18trissdeleting the DOCTYPE's fixed everything anyway. thanks fore the hint
14:19justin_smithtimothyw: your reductions should follow along with a map or whatever, one ouput of reductions for each element coming in from map, it's just that each element coming out of reductions is potentially also a sequence, and it can reflect previous values in the input
14:19justin_smithtriss: haha, that's how I deal with xml too, if it's confusing, delete it :P
14:21timothywjustin_smith: I’m taking a look at `reduced` and `reduced?` to see if they can help
14:25justin_smithtimothyw: reduced is just a way you can say "stop now, this is the end result"
14:25justin_smithit's basically early return from reduce, it gets called inside your reducing function, and makes it stop using more input
14:26justin_smiths/it gets called/you can call it if you like/
14:26timothywjustin_smith: it seems to be a flag that can be seen by `reduced?`
14:26justin_smithtimothyw: no, it's a data type that causes reduce to return with your value
14:26justin_smith,(reduced 10)
14:26clojurebot#object[clojure.lang.Reduced 0x1ade79f0 {:status :ready, :val 10}]
14:27justin_smith,(reduce (fn [_ x] (if (= x 10) (reduced x)) (range))
14:27clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:27justin_smith,(reduce (fn [_ x] (if (= x 10) (reduced x))) (range))
14:27clojurebot10
14:27justin_smithnote that the input to that reduce was indefinite, but it returns quickly
14:27timothywright. understood
14:27timothywyep, I get that.
14:28timothywI’m just gonna play with it a bit… that with drop-while
14:30justin_smithtimothyw: if all you care about is the "end result", and you have some logic that can take a value in your reduce and decide if it is an "end result", all you need is reduce / reduced, you don't need reductions or drop-while at all
14:33timothywjustin_smith: `reduce` would be perfect, except I need to know i) the accumulating state in the previous iteration (think partition, but each partition affects the next)
14:34timothywand ii) i need it to consume a lazy seq
14:34timothywSo I’m going to have a play and see how far I get
14:51justin_smithtimothyw: reduce can do both of those things
14:51timothywjustin_smith: oh?! that’s interesting to me
14:52justin_smith,(reduce (fn [[prev acc] i] (if (> i 10) acc [i (+ prev i)]) [0 0] (range))
14:52clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:52justin_smith,(reduce (fn [[prev acc] i] (if (> i 10) acc [i (+ prev i)])) [0 0] (range))
14:52clojurebot#error {\n :cause "nth not supported on this type: Long"\n :via\n [{:type java.lang.UnsupportedOperationException\n :message "nth not supported on this type: Long"\n :at [clojure.lang.RT nthFrom "RT.java" 940]}]\n :trace\n [[clojure.lang.RT nthFrom "RT.java" 940]\n [clojure.lang.RT nth "RT.java" 890]\n [sandbox$eval47$fn__49 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Iterate reduce "Iterate...
14:52justin_smithhmm...
14:52justin_smith,(reduce (fn [[prev acc] i] (if (> i 10) (reduced acc) [i (+ prev i)])) [0 0] (range))
14:52clojurebot19
14:53justin_smithtimothyw: the above uses the previous return value at each step
14:53justin_smithand also the previous input value
14:55timothywjustin_smith: right, but the result isn’t lazy
14:55timothywand like you said, maybe it’s impossible to get all three
14:55timothyw… all three conditions
14:56timothywbut it doesn’t strike me as impossible that could get all the properties of `reductions`, with 1 flat result sequence
14:56timothyw… or maybe it is
14:56timothyw… or maybe it is impossible
15:22mungojelly(clojure.string/join (flatten (interpose "\n" (doall (partition-all 5 "string to be wrapped")))))
15:22mungojellywhat's a better way to say that :/
15:25rhg135(clojure.string/join "\n" (partition-all 5 "stuff is awesome"))
15:26mungojelly"clojure.lang.LazySeq@80233d7\nclojure.lang.LazySeq@7b1487f\nclojure.lang.LazySeq@3a4674f\nclojure.lang.LazySeq@83ea932\nclojure.lang.LazySeq@106a"
15:26rhg135hmm
15:28rhg135,(clojure.string/join "\n" ["line1" "line2"])
15:28clojurebot"line1\nline2"
15:28rhg135weird
15:29oddcully,(clojure.string/join "\n" (map (partial apply str) (partition-all 5 "string to be wrapped")))
15:29clojurebot"strin\ng to \nbe wr\napped"
15:29rhg135ah, I see
15:30mungojellypartition tears up its stringiness
15:30oddcullybetter? i don't know. but interpose and join in one line looks funny
15:30mungojellyso i'm not missing some wrap-string i should say? oh maybe there's a wrap method in the java
15:30rhg135strings think they are so special
15:32rhg135,(sequential? "string")
15:32clojurebotfalse
15:34rhg135,(= "hi" [\h \i])
15:34clojurebotfalse
15:35mungojellywhere's your EGAL now
15:39rhg135that may be equal in cljs
15:39rhg135probably not though
16:21justin_smithmungojelly: btw
16:21justin_smith~flatten
16:21clojurebotflatten 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.
16:22justin_smithrhg135: in cljs it would be equivalent to (= "hi" ["h" "i"]) which I really hoped would not be true (and was not)
16:23mungojellyjustin_smith: i knew i had the wrong answer, i just thought asking for a refinement of the wrong answer was more polite than just saying, help me do this :)
16:23justin_smithrhg135: since in cljs (= \h "h")
16:23justin_smithmungojelly: yes, that was just an aside that I like to bring up whenever I see flatten
16:23mungojellyi have to play more with mapcat i don't get it
16:24justin_smithmungojelly: with mapcat for each input you return either a sequence or nil
16:24justin_smithmungojelly: nils are thrown away, sequences are concatenated
16:24justin_smithor, equivalently, nils are just empty seqs that disappear in the concatenation
16:25rhg135I later realize that
16:25justin_smith,(mapcat identity [[1 2 3] nil [] [4 5] [[6]]])
16:25clojurebot(1 2 3 4 5 ...)
16:25justin_smithof course mapcat identity is just apply concat
16:26mungojellybut it just flattens that first level. so it's if you want to blow something up a little and then immediately tie it back together.
16:27justin_smithit removes one level of inner nesting, yes
16:28justin_smithmungojelly: but compare these:
16:28justin_smith,(flatten "hello")
16:28clojurebot()
16:28justin_smith,(apply concat "hello")
16:28clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
16:28justin_smithheh, equally terrible
16:28justin_smith,(flatten ["hello" "world"])
16:28clojurebot("hello" "world")
16:29justin_smith,(apply concat ["hello" "world"])
16:29clojurebot(\h \e \l \l \o ...)
16:29justin_smithman, that print limit
16:29justin_smith,(apply str (apply concat ["hello" "world"]))
16:29clojurebot"helloworld"
16:35trisshave any libraries been written fro manipulating xml-seq in a nice way?
16:36trissI've just written a filter-tag and filter-attr method and bet any awful lot of other people have too
16:36justin_smithI bet you could use some stuff from hiccup or maybe enlive?
16:36justin_smithI'm not sure though
16:36justin_smithtriss: I hear zippers combine nicely with xml-seq
16:37trissjustin_smith: i don't really like the look of zippers.......
16:37trissmaybe im missing out though.... all that up down left right stuff
16:37trissintresting to think about hiccup/enlive tho...
16:37trissI'm gonna take a peek
16:43justin_smithtriss: the thing with zippers is that they are a purely functional way to walk through a tree of data
16:43justin_smithtriss: so up means "go to this node's parent" (for example) and returns a new zipper where you are at the parent node
16:43trissyup... it's just my tree is pretty shallow really
16:44justin_smithyeah, so you can probably get away with not using zippers at all. I keep meaning to find a project where I can really do something interesting with zippers, heh
16:44trissI'm parsing MusicXML... which is just sequences of notes in sequences of measures
16:44justin_smithoh, that seems straightforward, yeah
16:44trissyeah. i'd like a big tree to drive about in one day too!
16:45justin_smithI wonder if zippers are useful for driving around in big graphs - I have a bunch of those...
16:46justin_smithwhaddyaknow https://github.com/jarohen/graph-zip
16:46mungojellyeveryone's rewriting the same things here because there's no simple way to share and reuse a single function
16:46justin_smithmungojelly: eh, there's some really small libs out there
16:47justin_smithmungojelly: for example weavejester's env lib - hardly more than one function
16:47mungojellythe dependency architecture is so heavy that it's impractical to share under a certain size. hmm ok i'll check that one out!
16:47justin_smithmungojelly: I think what's more important here in IRC is providing examples of approaches, and the really good stuff ends up a lib of its own, or something like flatland/useful
16:48justin_smithmungojelly: once you do it a couple of times, making a lib and putting it on clojars with lein is very light weight
16:48mungojellybut you should just be able to write a single function and publish it and then we can all work from there
16:49justin_smithwho says your lib can't just have a namespace with a single function in it? Like I said, environ is effectively that for example
16:49mungojellylike when we say something to clojurebot there's no reason we can't give canonical permanent names to all those functions and refer to them in later work and actually provide useful code from here
16:50justin_smithmungojelly: 6 functions, one which you would ever use https://github.com/weavejester/environ/blob/master/environ/src/environ/core.clj
16:50justin_smithmungojelly: I'd rather use actual libs and dependencies and not some tooling built around our IRC bot
16:51mungojellyhmm yeah things become less "actual" at some point if they get small enough-- but why? aren't tiny things actually easier to reason about?
16:53justin_smithI'm fine with using a lib that only has one useful function, but I want it in a jar, in a repo where I can reliably find it, with proper versioning etc.
16:57rhg135I agree, using functions people write as a POC in production code is a very bad idea
16:59mungojellywhat i'm concerned with is that packaging code up like this is useful, sure, and simple enough once you get the hang of it, sure, but for beginners aka 99.999% probably not enough nines of humanity it's just a big "no thank you" sign turning away anything they write
16:59rhg135and broken code is a bigger "no thank you" sign
16:59justin_smithmungojelly: the barrier to publishing to clojars is extremely low
17:00mungojellyby programmer standards, but not by nonprogrammer standards, if you don't already know all this stuff it feels like a million things to learn before you can say any code in any way that'll be accepted by anyone as even being like real
17:01mungojellynot all code is constantly controlling flying aircraft. beginners should be able to say code that does simple things and have it accepted as reality and responded to.
17:01justin_smithmungojelly: a) if you are writing code good enough to be used by other people, you are a programmer b) if your code is not good enough, it shouldn't get reused
17:01rhg135I understand
17:01rhg135that doesn't exist yet
17:01rhg135CHALLANGE ACCEPTED
17:02rhg135it's not a good idea, but I'm bored
17:02mungojellyquil does accept simple examples for http://quil.info i think it is, so that's nice! i'm planning to write something pretty for that sometime
17:02justin_smithmungojelly: we will definitely read anyone's code here - give advice, help you improve it if needed. But I think if code is good enough to share, it's good enough to share it the right way.
17:04rhg135he means without having to even package a jar
17:04rhg135which I get. programmers are lazy bunch :P
17:04justin_smithrhg135: the friction to making a jar is so low though - it's literally one command line to take your project and put it in a jar on clojars
17:04justin_smith"lein deploy clojars"
17:04mungojellyi'm working on something called stringplayground that'll accept submissions of functions that do simple fun things to strings
17:05rhg135what if I only have a vim buffer of code
17:05justin_smithrhg135: then use a gist or refheap?
17:05rhg135then I'd have to copy and paste
17:05mungojellylike the first one i put was cellos->armadillos that's just (replace input #"cello" "armadillo") or w/e. i can't package that up as a jar-- i mean i could but that would be the silliest jar.
17:05rhg135laziness
17:06justin_smithrhg135: but if I am going to write code that uses your code, I'd like you to at least take 10 seconds to make a jar and upload it
17:06justin_smithmungojelly: there are sillier jars, I promise
17:06rhg135it takes far longer than that
17:06justin_smithmungojelly: and there's no reason not to put many examples in one jar
17:06rhg135but I would too
17:07justin_smithrhg135: more than 30 seconds for "lein deploy clojars" to run to completion?
17:07justin_smithmaybe 10 is low, OK
17:07justin_smithhaha
17:07rhg135for me to create a project, lookup my open my gpg keyring, then deploy
17:08mungojellybut i mean if any beginners are here right now they can literally say a simple little silly function like that and i'll actually go put it into stringplayground for them, so at least there's that
17:08mungojellyi don't see why there shouldn't be nice homes for any simple functions anyone wants to write, we should have standards for what we use to build seriously on but also we should accept everything, it just takes a few bytes of disk to store people's ideas
17:08rhg135I'll still do this, it'll be fun to see the chaos that ensues
17:11bitraider,(prn "Hello")
17:11clojurebot"Hello"\n
17:11bitraidercool
17:14rhg135somethink feels off here, https://www.refheap.com/109993, but I can't place it
17:14mungojellyit's difficult to build beautiful things out of the materials here because everything here is very plain. everything's red yellow and blue-- so technically you could make anything! you go to get a shirt-- red shirts, blue shirts, yellow shirts. use this shirt-combiner and technically you can make any color and pattern of shirt! but you'll have to make it yourself.
17:15mungojellyand a program that just says "combine a blue and yellow shirt to make a green shirt" is too simple to publish, so you have to make your own green shirt even though it's simple.
17:17justin_smithrhg135: if resolve-a-pending! got called in parallel, you could easily put objs on the same last-pending twice
17:17justin_smithrhg135: because you read from an atom and swap! it as separate ops
17:17rhg135Ah I see
17:17rhg135thx
17:17justin_smithrhg135: so if you had [a b] as last-pending, you could write to b twice, and drop both a and b
17:17justin_smithI think
17:18rhg135yeah
17:18justin_smithrhg135: also my inclinatin would be to bind [::pending-ops conection-id] to a symbol, and I think you meant to use update-in on line 6
17:18rhg135but how do I ensure the put! is only done once
17:19justin_smithbecause line 6 does something pretty weird as it is now that I look closer :)
17:19rhg135yeah, I saw that too
17:20justin_smithmy calculations say it would get "wrong number of args (2) passed to: PersistentVector"
17:20rhg135I think so
17:21akkaddoes cider jump to a project based on what clj buffers you have open?
17:21rlanderjoin #reaget
17:21akkadodd it finds the namespace but "no such var" on ns/function which is clearly in the required too-hot.core
17:21rhg135maybe using a PersistentQueue of pending puts!
17:24justin_smithakkad: do you have multiple projects open?
17:25justin_smithrhg135: or refactor so that the read and change are both in the same function call (just be careful of the fact that the function you use with swap! will get called multiple times)
17:25justin_smithretries, everyone seems to forget retries
17:25rhg135not me, I am very aware
17:26rhg135but, justin_smith, I don't understand what you mean?
17:27justin_smithto prevent the race condition, the read that gets the vector you peek, and the calculation of its new value via pop, need to both happen inside the swap! call
17:27justin_smithor you could use a ref / transaction
17:28rhg135I get that, but if it is called concurrently, then one will retry the put
17:28akkadjustin_smith: human error.
17:28justin_smithrhg135: yes, that is another concern
17:28akkadam I correct to assume clojars is the package repo for pulling down libraries? and that lein would facilitate dependencies automatically?
17:29rhg135and that may be ok
17:29justin_smithakkad: you need to manually specify top level deps in project.clj, and lein resolves the recursive deps
17:29akkadk
17:29rhg135I'll just have increasing numbers of parked go blocks
17:29justin_smithrhg135: yeah, when you need to alter a value and produce a visible side effect as a single action, things can get tricky
17:29akkadlooking at testing a few with repl and was not sure if it required to edit/restart repl everytime
17:30justin_smithakkad: if you want to add deps without a repl restart, pallet/alembic is a lib that makes that easy
17:30justin_smithakkad: I have that in my profiles.clj so I can always pull up a lib and try it out without a project edit or restart
17:31akkadexcellent thank you
17:31rhg135I could make pending-ops a channel itself
17:31justin_smithalembic uses the same syntax as the deps vector in project.clj too, which is handy
17:31rhg135channels are for communicating accross go blocks is it not?
17:32justin_smithrhg135: yes, you shouldn't read and write the same channel in a single go block
17:32rhg135no, I pull a channel off a channel which I then write to and close
17:33justin_smithrhg135: I was agreeing, putting emphasis one the *across* part, not contradicting
17:33rhg135oh
17:33rhg135yes that'd be very bad
17:36rhg135how about this, https://www.refheap.com/109993
17:40akkad"for a leiningen based project" are there projects that are not lein based? or alternatives to lein? just curious
17:41oddcullyboot
17:41oddcullygradle
17:41oddcullymaven
17:41akkadoic, thanks
17:43justin_smithoddcully: I hear honey-badgers build up their classpath by hand using jars in their ~/Downloads/ directory that they find via torrent sites and email attachments
17:44justin_smithrhg135: that looks more reasonable, though what if the same connection-id is used twice? what would you expect to happen?
17:45rhg135akkad: plain clojure.jar
17:45rhg135no deps
17:45oddcullyjustin_smith: if you see them doing it, shoot them
17:47rhg135justin_smith: I'd expect it to fire an error event if the server is derping, else let the last op now what the server said
17:47justin_smithalso, a neat trick for a quick starting repl with known deps is to save the output of "lein cp" in a project with the right deps, then use that to construct a shell script that just invokes clojure.jar with that classpath
17:47clojurebotIn Ordnung
17:47justin_smithclojurebot: I wasn't talking to you
17:47clojurebotexcusez-moi
17:47justin_smith~also, a neat trick for a quick starting repl with known deps
17:47clojurebotalso, a neat trick for a quick starting repl with known deps is to save the output of "lein cp" in a project with the right deps, then use that to construct a shell script that just invokes clojure.jar with that classpath
17:47justin_smith:P weirdo
17:49akkadjustin_smith: so once you distill a package, do you require it by name for it to be available within the repl?
17:49justin_smithakkad: exactly, you use require like normal
17:49justin_smithyou distill packages, you require namespaces (which are inside packages)
17:49akkadfile not found
17:49akkadmust be different name than the package
17:49justin_smithakkad: don't require the package name, require the namespace you want in that package
17:50akkadk. so api docs for a given package would be on clojars.org? or is there a more immediate interface via lein/repl?
17:51justin_smithakkad: you can peek inside the jar or check out clojars. Usually a README for a lib will tell you the main namespace to use.
17:51akkadI'll rtfm, thanks this helps a lot
17:51justin_smithakkad: np, best of luck
17:51akkadthis stuff is very well documented
17:54kenrestivoi'm running into a very weird problem with components. i'm trying to assoc an element to nil in the stop function, and it will not go away. it's still in there.
17:55justin_smithkenrestivo: do you mean assoc nil to some key the component provides? the component's key will still be in the system map
17:57kenrestivoyep. the key is there, but also so is the data i thought i'd overwritten with nil
17:57justin_smithkenrestivo: my typical stop method ends with (dissoc component :k :k2 :k3) to remove all the keys pointing to my own component's resources
17:57kenrestivoooh good, i'll try dissoc
17:57justin_smithkenrestivo: I assume you are using the return value of stop?
17:58justin_smithit's still functional, it doesn't replace the old map directly
17:58akkadwow these libraries are documented and actually work
17:58justin_smithkenrestivo: the component is immutable, so you have to make sure you propagate the new value as needed
17:58justin_smithakkad: haha, nice
17:59akkadrecovering from a year of CL dev
17:59justin_smithakkad: ovarall, deps in clojure have been a huge breath of fresh air compared to all the other things I have tried
17:59kenrestivolet's use ALL CAPS to make the transition easier
18:00akkadwell having consistent (first '(any sequence))
18:01akkad"oh it's a vector of chars, use aref, it's a listp use nth/elt/" all with different syntax
18:01justin_smithyeah, protocols are very nice too
18:02amalloy"it's a list, use remove / it's a map, use dissoc / it's a set, use disj..."
18:02justin_smithamalloy: oh, wouldn't it be nice...
18:02kenrestivoit's a record... use dissoc and have it not go away!
18:02justin_smithkenrestivo: umm?
18:02kenrestivowhich is precisely what just happened :/
18:03justin_smith,(defrecord R [a])
18:03kenrestivocomponents are recordds
18:03clojurebotsandbox.R
18:03justin_smith,(->R 1)
18:03clojurebot#sandbox.R{:a 1}
18:03justin_smith,(dissoc (->R 1) :a)
18:03clojurebot{}
18:03justin_smithkenrestivo: I think your problem is elsewhere, because records definitely allow removal of keys
18:04kenrestivoyeah, so i did that (stop (dissoc this :thing-i-want-gone)) and it's still there
18:04justin_smithkenrestivo: and you are using the return value of stop?
18:04justin_smithor are you checking the original after calling stop (because checking the original will show the key still there, because records are immutable)
18:05kenrestivoi agree, this doesn't seem right. no, the stop function returns this. and it's supposed to go into the system map
18:06kenrestivohttps://www.refheap.com/109994
18:07kenrestivodur, sorry https://www.refheap.com/109995
18:07clojurebotI don't understand.
18:07justin_smithwhy do you call stop recursively?
18:07rhg135I've never had to manually call stop
18:07kenrestivoaha, it's a different stop.
18:08rhg135also dissocing a record's named keys yields a plain map
18:08rhg135ah I see
18:08kenrestivoi have a stop function. name collision? i tried (assoc this :scheduler-internal nil)
18:08rhg135that's better
18:08kenrestivoit still doesn't make :scheduler-internal go awy tho :/
18:09justin_smithkenrestivo: I wonder if reference to stop inside a stop method will properly refer to your function vs. being resolved as a manual self call
18:09rhg135don't make it a named field if you need to dissoc it
18:09kenrestivoi don't want to dissoc it, just to nil it.
18:09kenrestivoi'll try renaming stop.
18:10justin_smithkenrestivo: and of course you have abranch on your if that does not do the dissoc
18:10rhg135justin_smith is probably right
18:10justin_smithkenrestivo: I assume you double checked that branch is not getting hit?
18:11kenrestivoyeah, i'm seeing the log, the correct branch is getting hit
18:12kenrestivothis is where i'm at, still, same problem: https://www.refheap.com/109996
18:14kenrestivoafter doing that, the system map still does not have that key's data nil'ed out
18:15kenrestivoi.e. this should be nil: (-> @sys/system :scheduler :scheduler-internal keys) but it's not. hmm. might leave this for a while and come back to it.
18:16justin_smithand you are doing (swap! sys/system component/stop) or the equivalent with alter-var-root ?
18:17justin_smithsorry, I know that seems like a stupid question but the behavior you are describing makes no sense to me
18:24kenrestivome neither
18:25justin_smithkenrestivo: what about adding another key (like ::stopped true) and seeing if that key shows up?
18:25justin_smithkenrestivo: because that would narrow down what kind of error you have
18:25kenrestivo(swap! sys/system assoc-in [:scheduler :scheduler-internal] nil) works, but that's not how components are supposed to work
18:25justin_smithno, not at all
18:26kenrestivothe stop method of the component/Lifecycle is supposed to return the component, so that's what i'm doing.
18:27kenrestivogood call, i'll try a test key. then i'll try a minimum repro case with a totally bogus test component. hours will go by. fun for everyone. but right now i have to eat.
19:51generic_userHi anyone ever gotten a weird instaparse compiler error?
19:58kenrestivopilot error. fixed: (swap! sys/system component/stop-system [:scheduler]) . i had been doing (-> @sys/system :scheduler component/stop). phew.
19:58justin_smithkenrestivo: HAHA I asked you precisely how you were doing that, at least twice!
19:59justin_smithI'm releived it was that simple
20:01kenrestivoyeah "i'm using component's stop function" was not sufficiently specific. i was using the wrong one, wrongly.
20:02kenrestivojustin_smith: thanks for the sanity check though. made it clear to me it was pilot error here.
20:03mungojellytwo part question (a) is println really always effectual, is there any way i can trap something with a println in it and redirect the print, and (b) if not how come there are println everywhere wtf
20:04justin_smithmungojelly: you can use with-out-str
20:04justin_smithor you can set *out* however you like, that will decide which writer gets your prints
20:05justin_smithand println everywhere is a sign of an immature lib or someone who hasn't commited on a logging library I guess?
20:19xtrntrif i have a function call (fill-rect surface [0 0 width height] [200 200 200])
20:19xtrntrcan i do it in a let binding?
20:20justin_smithxtrntr: any valid function call is valid in a let binding
20:21justin_smithxtrntr: the hard part is making sure you use the return value in the right place and manner
20:21xtrntrcan i name this function call?
20:21xtrntrim still used to doing things in an imperative manner..
20:21justin_smithxtrntr: if you mean bind the result, yes this is mandatory in let bindings
20:22justin_smith(let [rect (fill-rect surface ...)] (do-something rect))
20:22justin_smithxtrntr: the tricky part is whether fill-rect is functional - does it return a useful value?
20:22justin_smithxtrntr: if fill rect mutates its args, it might be useless to make a binding of the result
20:22justin_smithbecause it might return nil, I would need to know more about fill-rect
20:23xtrntrno.. it's just for me i guess
20:23xtrntri like to name my function calls so its more readable
20:23xtrntrlike the purpose of fill-rect is set-background-color
20:23justin_smithxtrntr: ahh, so if fill-rect returns a new filled rect, that's a perfectly reasonable way to do it, bind it in a let and then use it
20:35mungojellyi want both the output and the value, so (defmacro with-out-str-and-value [& body] `(let [s# (new java.io.StringWriter)] (binding [*out* s#] (let [v# ~@body] [(str s#) v#])))) -- does that exist or should i use that one?
20:37mungojellyi basically just want to know when i'm reading whether "println" means "this code is irreparably effectual" or "this code would be mildly difficult to wrap up so it's not effectual"
20:57gfredericksmungojelly: [v# ~@body] → [v# (do ~@body)]
21:03justin_smith(inc gfredericks)
22:20Oberhow can you access keys on a Persistent Array Map?
22:23Oberhttps://gist.github.com/7bc575c5e69574af27e9 cider makes emacs eat 100% cpu
22:30hiredmand
22:35TEttinger,(get (array-map :a 1 :b 2) :a)
22:35clojurebot1
22:35TEttinger,((array-map :a 1 :b 2) :a)
22:35clojurebot1
23:17akkad(count (:objects (s3/list-objects cred "cloudtrail-cs" [:max-keys 1000001]))) => 1000 even though the :max-keys returned says what I passed.
23:19kavkazHas anybody here used Overtone with emacs?
23:30tmtwdno
23:31akkadbriefly
23:31akkadEmacs is not meant for such things
23:31tmtwdlol
23:31tmtwdlivemacs was designed by the overtone team
23:31akkadsingle threaded and not-evented
23:34tmtwdwhat is the carrot in this code? ^{:key (:id todo)}
23:34tmtwdcan someone point me to the place that documents this?
23:34tmtwdfor reagent
23:36tmtwdnvm
23:36tmtwdfound it
23:51amalloyPS it's caret
23:56TEttingercircumflex.