#clojure log - Sep 26 2015

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

0:10 crocket: hi

0:10 ClojureScript has seqable?, but clojure doesn't.

0:11 Is there a shared function for checking seqability in clojure and clojurescript?

0:11 justin_smith: no, clojure lacks that function

0:12 crocket: but you can write it by looking up the code behind jvm seq

0:15 crocket: I am starting to guess seqable? is not a generic function.

0:15 justin_smith: jvm clojure makes a bunch of different weird things into seq

0:17 sdegutis: Which Clojure version has the #cljs{} stuff?

0:18 justin_smith: sdegutis: 1.7 has #?(:cljs ...)

0:18 if that's what you mean

0:18 sdegutis: ah nice!

0:19 sweet, we'er on 1.7

0:19 which Clojure has the .cljc files?

0:19 justin_smith: see also #?@(:cljs ...)

0:19 that is cljc

0:19 sdegutis: oh nice

0:19 so if I'm using Clojure 1.7, I have no need for the cljx hack?

0:20 justin_smith: no, I'd avoid cljx now if you can

0:21 sdegutis: yay

0:23 gnite

0:47 nxqd: hi 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)))

0:48 justin_smith: nxqd: (swap! a update :test not)

0:48 ,(def test (atom {:a true}))

0:48 clojurebot: #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...

0:48 justin_smith: :P

0:48 nxqd: justin_smith: thanks ! It's exactly I'm looking for :D

0:48 justin_smith: it seems clojurebot is less permissive now

0:49 nxqd: ,(def test (atom {:a true}))

0:49 clojurebot: #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...

0:49 nxqd: haha :D

0:49 justin_smith: ,(def test' (atom {:a true}))

0:49 clojurebot: #'sandbox/test'

0:49 justin_smith: aha!

0:49 ,(swap! test' update :test not)

0:49 clojurebot: {:a true, :test true}

0:49 justin_smith: ,(swap! test' update :test not)

0:49 clojurebot: {:a true, :test false}

0:49 justin_smith: well, I messed that up, but I hope the idea carries

0:50 nxqd: yeah, thx :D

1:07 jeaye: I need to spawn a child process, feed its stdin, and process its stdout interactively. Anyone have suggestions for a good lib to use?

1:07 justin_smith: jeaye: I use ProcessBuilder via interop, but there is also conch if you prefer something wrapped up in clojure code

1:08 jeaye: I'd prefer a wrapper. Checking out conch now, thanks.

1:57 justin_smith: It seems like sh/done needs to be called before sh/stream-to-string can be used.

1:57 Are 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.

2:00 diqye: ,,,

2:00 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

2:51 crocket: Are all collections seqable?

2:51 What else is seqable?

3:03 ianhedoesit: crocket: anything that implements Seqable

3:05 crocket: why do you ask?

3:26 crocket: Clojure doesn't have seqable? function.

3:26 ianhedoesit, ^^

3:29 ianhedoesit: seq?

3:29 ,(doc seq?)

3:29 clojurebot: "([x]); Return true if x implements ISeq"

3:29 ianhedoesit: which isn't exactly what you want, depending on what you're doing. it seems like an XY problem

3:30 crocket: ,(seq? [1 2 3])

3:31 clojurebot: false

3:31 crocket: ,(seqable? [1 2 3])

3:31 clojurebot: #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...

3:31 crocket: ianhedoesit, ^^

3:31 ClojureScript has seqable?

3:31 ClojureScript is supposed to be shadowing Clojure, but ClojureScript already has functions that Clojure doesn't have.

3:31 It is deviating from Clojure.

3:32 Perhaps, seqable? is not a generic function.

3:36 ianhedoesit: seqable? returns true if s (the collection) satisfies ISeqable, whereas seq? returns true if it satisfies ISeq

3:37 crocket: ianhedoesit, only in clojurescript

3:37 ianhedoesit: yes

3:37 crocket: seqable? is not in clojure

3:38 ianhedoesit: I know

3:39 crocket: I was reminded that it is impossible to decide whether there'll be unhandled exceptions in clojure.

3:39 At least, it's practically impossible

3:39 unhandled exceptions would crash a program.

3:39 kenrestivo: i'm baffled and stuck by this: https://www.refheap.com/109975

3:40 crocket: a million pieces?

3:40 ianhedoesit: crocket: I'm still unsure what you're trying to get at.

3:41 crocket: ianhedoesit, clojure is not the final language.

3:41 kenrestivo: crocket: about a dozen lines of stacktrace

3:41 crocket: Does that create a lot of threads?

3:41 ianhedoesit: I'm assuming that there being a seqable? function in clojurescript is an implementation detail because of what clojurescript is

3:41 kenrestivo: i'm sorry, 37 lines of stacktrace, but who's counting

3:41 crocket: no, it's one thread

3:42 jeaye: When 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?

3:42 crocket: Other engineering disciplines stick to one final language.

3:42 Programming can do the same.

3:42 Math, and electrical engineering did it

3:42 ianhedoesit: crocket: still, I don't understand what you're trying to ask or say or anything?

3:43 crocket: ianhedoesit, From the perceived imperfections in clojure, I surmise clojure is not the last language programmers will agree to use as the only language.

3:43 kenrestivo: anyway, 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

3:43 jeaye: s/conchy/conch/ and s/I s/ s/

3:44 crocket: kenrestivo, Dereffing a future can't wait forever, so there's a timeout.

3:44 ianhedoesit: crocket: of course not. again, what is the relevance or importance of that? nothing is the final or last or best language.

3:44 crocket: ianhedoesit, I"m looking forward to the best language for all.

3:44 ianhedoesit: is the fact that Elixir or PureScript have different implementation details make Haskell a worse language?

3:45 Haskell/Erlang*

3:45 crocket: I also mentioned that it's practically impossible to determine whether a clojure program will crash due to unhandled exceptions.

3:46 TEttinger: crocket: the problem domains for computing have changed a lot more over the last 20 years than they have for, say, statistics.

3:46 it makes sense that we have stable terminology for statistics

3:46 it does not yet for computing

3:46 crocket: not yet

3:46 TEttinger: look up the history of numeral systems :P

3:47 crocket: TEttinger, I get your point.

3:47 TEttinger: the problem is that quantum computing will probably change everything again, and who knows what after that

3:49 quantum algorithms are an extremely new field of computing... mainly because they're almost all theoretical except for the tinest couple-of-quantum-gates scenarios

3:49 kenrestivo: ,(str "a picture is worth " (clojure.pprint/cl-format nil "~@R" 1024) " words")

3:49 clojurebot: #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...

3:50 TEttinger: huh, that isn't included?

3:50 kenrestivo: ,(require 'clojure.pprint)

3:50 clojurebot: nil

3:50 kenrestivo: ,(str "a picture is worth " (clojure.pprint/cl-format nil "~@R" 1024) " words")

3:50 clojurebot: "a picture is worth MXXIV words"

3:50 kenrestivo: :/

3:50 TEttinger: ha!)

3:51 ,(clojure.pprint/cl-format nil "~@R" -1024)

3:51 crocket: I expect to see lots of quantum computers in 2 decades.

3:51 clojurebot: "-1,024"

3:51 TEttinger: ,(clojure.pprint/cl-format nil "~@R" 4/3)

3:51 clojurebot: "I"

3:51 crocket: Will quantum processors be able to run linux?

3:51 TEttinger: interesting

3:51 almost assuredly not

3:52 crocket: Then, I guess graphene processors will replace silicon processors.

3:52 kenrestivo: someone will figure out a way to run the x86 instruction set on them so all the legacy code will still run

3:53 TEttinger: quantum 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...

3:53 crocket: Can you simulate determinism in quantum processors?

3:53 TEttinger: the halting problem?

3:54 crocket: Can quantum processors run pure functions in clojure?

3:54 like (fn [a b] (+ a b))

3:54 TEttinger: well anything quantum is going to need truly radical changes to the way the program is handled and runs

3:54 no modern OSes will run without emulation

3:55 crocket: How far are we from genuine quantum processors?

3:55 TEttinger: they were estimating 2015 10 years ago. so the predictions are bad.

3:55 crocket: We sort of have a variant of quantum processor.

3:55 called D-Wave.

3:55 TEttinger: we have "quantum adiabatic" crappy stuff

3:56 yes that

3:56 crocket: diabetic?

3:57 TEttinger: adiabatic 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

3:57 D-Wave is not bogus, it's just really early and it isn't actually using qubits

3:58 it's another way of approaching computing problems, specific ones

3:58 crocket: qubit

3:58 TEttinger: quantum bit

3:58 crocket: qubit sounds cute

3:58 TEttinger: a bit that can be simultaneously 1 and 0 in different probabilities

3:59 crocket: Can a qubit be 1 or 0?

3:59 You said different possibilities.

3:59 TEttinger: the snide answer is "yes"

3:59 crocket: 1 can be emulated.

3:59 1 100% 0 0%

3:59 kenrestivo: wow, that's screwy, this is also a death: https://www.refheap.com/109976

3:59 crocket: kenrestivo, deref timeout is normal.

4:00 kenrestivo, If you disable deref timeout, it will just wait forever.

4:00 kenrestivo: how can i make it stop being normal?

4:00 crocket: It is not useful

4:00 Use deref or some other function to disable timeout.

4:01 And, it'll freeze.

4:02 kenrestivo: i am not at all clear what you mean.

4:02 TEttinger: yeah, 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.

4:03 kenrestivo: look, 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

4:04 crocket: kenrestivo, Your future never returns a value.

4:04 Dereferencing the future will freeze.

4:05 That's it

4:05 How is it useful?

4:05 TEttinger: it isn't derefed

4:05 kenrestivo: that's what i'm saying.

4:05 TEttinger: however, futures start calculating immediately, right?

4:05 crocket: ok

4:06 I wasn't really looking at the code

4:06 ,(doc future)

4:06 kenrestivo: that was evident.

4:06 clojurebot: "([& 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?."

4:07 kenrestivo: but the repl obviously derefs it in order to print it, causing explosions.

4:07 crocket: ok

4:07 The repl

4:07 TEttinger: hm, does it?

4:08 kenrestivo: ,(def foo (atom {:baz 1}))

4:08 clojurebot: #'sandbox/foo

4:08 kenrestivo: ,foo

4:08 clojurebot: #object[clojure.lang.Atom 0x280e3568 {:status :ready, :val {:baz 1}}]

4:08 kenrestivo: it must, in order to print out :baz 1

4:08 howevaaaa

4:09 ,(def foo (atom {:baz 1 :quux (future (while true (Thread/sleep 1000)))}))

4:09 clojurebot: #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...

4:09 kenrestivo: fine

4:09 TEttinger: I'm testing in my repl

4:09 kenrestivo: anyways, the refheap has the stuff.

4:09 thanks TEttinger

4:11 TEttinger: try (@foo :bar)

4:11 in mine, I can still access :bar but not the whole thing or :quux once the future has been cancelled

4:11 crocket: kenrestivo, I see "java.util.concurrent.CancellationException"

4:11 It is normal

4:12 java.util.concurrent.CancellationException in :quux

4:12 TEttinger: I wonder...

4:12 maybe you can replace the future with a different value

4:13 kenrestivo: i was thinking that, swap! foo assoc-in :quux nil) might do it

4:14 ,(swap! foo assoc-in [:quux] nil)

4:14 clojurebot: {:baz 1, :quux nil}

4:16 TEttinger: ha! it isn't swap!, but I tried (send foo assoc :quux 0)

4:16 crocket: kenrestivo, But, you'll leak memory

4:16 TEttinger: it still threw the exception but did assign it

4:16 crocket: or not

4:16 Can a frozen future be ever destroyed?

4:17 TEttinger: in my agent, the state no longer references the future

4:17 so I assume GC will pick it up now that it's no longer referenced

4:18 crocket: maybe not

4:18 The future will never resolve to a value.

4:19 kenrestivo: i generally trust the GC, but might fire up some monitoring tools and check later.

4:19 indeed, just assoc'ing nil in there does the trick, so i'm over this hurdle. thanks!

4:21 Trioxin: is scala good too?

4:21 I never even read anything about it until I just realized it also uses the JVM lol

4:28 TEttinger: Trioxin: people have... strong opinions on Scala.

4:28 I'm not a fan, having used it, java, and clojure

4:28 I've found I'm most productive in clojure, then java, then scala.

4:29 part of that is being new to scala, a big part of that is the maze of complicated collections they use

4:29 scala doesn't add... a whole lot of stuff that java can't do

4:30 Trioxin: ok cool. yeah I have no desire to use Java beyond libs I can get away using in clojure

4:30 muhuk: TEttinger: I also feel more productive using clojure.

4:30 Trioxin: I'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?

4:30 muhuk: TEttinger: not to be one of those people with strong opinions on Scala... but it isn't really designed to add stuff to java.

4:31 TEttinger: it's designed to bridge the gap between java & haskell (fp).

4:31 Trioxin: yes. So far. Possibly with the exception of some java8 stuff.

4:31 Trioxin: uh oh

4:32 things breaking? :(

4:32 TEttinger: I 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.

4:33 muhuk: 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

4:33 assuming you run clojure on JDK 8

4:33 muhuk: TEttinger: hence; "possibly"

4:33 TEttinger: right

4:34 Trioxin: is that something clojure can address in an update?

4:34 muhuk: eventually

4:34 I'm pretty sure one can find 3rd party libs with lambda support etc. even today.

4:34 TEttinger: I strongly suspect clojure is compatible with java 8 new features if you use it like other java interop

4:35 which isn't "pretty"

4:35 but isn't hard

4:35 muhuk: TEttinger: yeah, that's a more accurate way to say it.

4:36 Trioxin: finally, 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?

4:37 muhuk: Trioxin: did you do a search in clojars?

4:38 Trioxin: i was jk that was a vaping question

5:37 crocket: TEttinger, What is research interst?

5:37 interest*

5:38 TEttinger: crocket: what are my interests in research stuff?

5:39 I am uh not in academia, to say the least

5:40 benhuda: hi all

5:40 anyone got a reasonable experience building CLI tools with clojure (re startup time)

5:41 i've just explored chicken and gambit for this use case, but the ecosystem is prehistoric in comparison

5:41 im wondering if java8/9 does any good?

5:42 crocket: TEttinger, I am not in academia, either.

5:42 But, I have research intersts.

5:42 benhuda: or perhaps cljs and emscripten make this better ? not sure

5:42 crocket: benhuda, a clojure program takes 1-2 seconds to start up.

5:43 benhuda, ClojureScript on nodejs might start up better, but clojurescript tooling is inferior to that of clojure.

5:44 If your CLI program needs to be invoked multiple times repetitively in a short period, clojure will be slow.

5:44 TEttinger: benhuda: 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

5:44 java 9 is also not done yet

5:44 crocket: prehistoric ecosystem!!

5:45 benhuda, Did you check out racket?

5:45 muhuk: benhuda: you'd get the best advice if you describe what your program does, use case, context etc...

5:45 crocket: Clojure is decent for long-running processes.

5:45 Long-running processes that can consume a lot of RAM.

5:45 Clojure is hungry of RAM.

5:46 TEttinger: benhuda: 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

5:46 crocket: Pixie is not useable yet.

5:47 It lacks documentation and tutorials

5:47 TEttinger: Racket also has good startup time and has absolutely excellent docs

5:47 crocket: At this stage, it is suitable for pioneers.

5:47 Racket's long-term performance is not nearly as good as that of clojure.

5:48 TEttinger: but for CLI, it should be better

5:48 small short-running apps?

5:48 crocket: short-lived apps

5:53 noncom|2: benhuda: crocket: TEttinger: i asked this question yesterday and was advised to look at drip and cake

5:53 and nailgun

5:54 TEttinger: indeed, that and technomancy's lein-in-OCaml thing

5:54 noncom|2: oh yes, that one too

5:54 i too think that clojure is rocks for cli tools. startup time is the only issue

5:55 benhuda: yes id love to do cli with clojure. its great for personal development

5:55 i find myself hacking tools in my spare time, a lot more than building production systems from scratch

5:55 TEttinger: http://leiningen.org/grench.html#download

5:55 benhuda: and it's the greenfield feeling that makes me happy

5:55 noncom|2: cool!

5:56 TEttinger: also, I was surprised how relatively easy OpenJDK 9 was to build on windows

5:56 noncom|2: i 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

5:56 benhuda: TEttinger i'll be annoying and say i love "shipping" tools to friends.. so any of the nail-like solutions dont work

5:57 basically if clojure compiled to Go (and i've just finished sifting through all those dead clj-to-go projects), it would be heaven

5:57 i see Go as the next assembly for systems

5:58 TEttinger: hm. 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)

5:58 oh!

5:58 http://clojure-android.info/skummet/

5:58 skummet works on desktop too

5:59 benhuda: TEttinger very interesting

5:59 TEttinger: it's a subset of clojure technically. but it should work on quite a lot of code

6:01 benhuda: i guess time is on our side? some day someone will make clojure good on CLI?

6:01 TEttinger: skummet might do it already. startup seems to be about a third

6:01 benhuda: trying out the sample now..

6:02 TEttinger: it may be slower to compile, not sure

6:03 but for producing an app that will be run many times, it seems like a good choice

6:03 benhuda: argh... 'Cloud not find or load main class'

6:04 my bard.

6:04 *bad

6:04 ah.. not much sleep

6:06 nope, main doesnt get loaded

6:08 good now

6:08 java -jar target/lein-skummet-sample-0.0.1-SNAPSHOT-standalone.jar 0.50s user 0.06s system 155% cpu 0.357 total

6:08 mbp core i7 2.2ghz

6:10 TEttinger: that's pretty good

6:11 benhuda: its reasonable, feels like a heavy Ruby CLI app. which is good

6:11 TEttinger: it's better than feeling like a heavy java CLI app, like uh Maven

6:11 benhuda: :)

6:12 TEttinger: benhuda: which generation i7, I wonder?

6:12 benhuda: this is a mid 2014 mbp

6:13 TEttinger: they 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

6:13 the U are ultralow voltage and are dual-cores

6:14 ianhedoesit: I'm on a pretty low end hp and the sample skummet project takes about 800ms

6:14 benhuda: that's more encouraging

6:15 what java is that, ianhedoesit ?

6:15 TEttinger: java 8, I'd hope

6:15 ianhedoesit: and by low end I mean a $300 laptop I bought about five years ago.

6:15 nope

6:15 benhuda: i think he's using 7

6:16 ianhedoesit: java version "1.7.0_79"

6:16 OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)

6:16 OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

6:16 benhuda: yea

6:16 TEttinger: java 7 is nearing EoL I think. I'm surprised it's still so common

6:16 benhuda: not the first time i see 7 being faster than 8

6:16 TEttinger: I'm using the Zulu OpenJDK build

6:16 really?

6:16 ianhedoesit: mine isn't faster than yours?

6:16 yours ran in 500ms, no?

6:17 benhuda: ianhedoesit yes, but factor in the huge difference in hardware.. i'm saying 7 is faster than 8

6:17 TEttinger: 0.8 on old HP vs. 0.5 on rather-new-MBP, but OS differences are possible too. SSD especially too

6:17 benhuda: now look at the benchmarks on the website, and that's running 0.45

6:17 and on 7

6:17 ianhedoesit: I suppose, yeah.

6:17 TEttinger: it's likely you're both getting limited by disk rate alone

6:18 ianhedoesit: I'm using a 7200rpm hdd

6:18 benhuda: ssd here

6:18 i really want to pack on some libraries and build a small CLI tool. that would be a better evaluation

6:18 wink: just noticed I neevr installed a lein plugin it seems

6:18 ianhedoesit: which doesn't really matter, does it? there's no io in the sample

6:18 TEttinger: there 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

6:18 ianhedoesit: loading clojure.jar from disk

6:18 ianhedoesit: TEttinger: most of the internals on this aren't what I bought, to be fair.

6:19 oh duh

6:21 TEttinger: I'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.

6:21 working at HP seems like a nightmare

6:21 wink: why does GitHub for Windows have to be so horrible? grr

6:22 TEttinger: wink: I like it. it's very resource-intensive for some reason

6:22 wink: TEttinger: I can't even find how to clone something that's not in my user/orgs

6:22 used shell now

6:22 TEttinger: but it seems OK. occasionally I need to "git push origin master" when syncing fails

6:22 wink: in anger

6:22 TEttinger: oh!

6:22 ianhedoesit: benhuda: 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.

6:22 TEttinger: you can drag a repo link onto it

6:22 wink: m(

6:23 benhuda: ianhedoesit i'm trying to take jsoup and fetch a url, then run a selector on the markup

6:23 ianhedoesit: sounds reasonable.

6:24 TEttinger: wink: do you have a gitlab? you can even use github for windows for non-github URLs

6:24 wink: TEttinger: I just try to code as little as possible on windows (this is main gaming/surfing box at home)

6:25 benhuda: ianhedoesit yikes. i have some macro errors. clojure-soup uses the $ macro. there was some blurb about macros on the skummet webpage

6:26 wink: and apparently I cant build this lein-skummet example

6:26 TEttinger: ha! try dragging this onto your github for windows... window: https://gitlab.com/gitlab-com/www-gitlab-com.git

6:26 it will ask to confirm, you don't need to

6:27 benhuda: $ as in inner class $?

6:27 wink: that's nice yeah. once you knwo it :D

6:27 benhuda: TEttinger well, i'm just taking the sample here as-is (attr "abs:href")) ;; attribute selector

6:27 ianhedoesit: benhuda: would using the :skummet-skip-vars option?

6:27 help*

6:27 benhuda: whoops. meant this https://github.com/mfornos/clojure-soup

6:28 wink: benhuda: 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?

6:29 benhuda: wink go into sample, add clojure-soup, sprinkle some soup code, then lein do skummet compile, skummet jar

6:29 ianhedoesit: wink: https://github.com/alexander-yakushev/lein-skummet/wiki#example

6:29 TEttinger: benhuda: I suspect https://github.com/mfornos/clojure-soup/blob/master/src/jsoup/soup.clj#L20 is the trouble

6:29 ianhedoesit: lein do skummet compile, skummet run

6:29 wink: ianhedoesit: ah, thanks. there was no readme. *sigh*

6:29 benhuda: wink yea its on the wiki

6:30 ianhedoesit: and then to see the real time test, I would use java -jar foo-standalone.jar because the lein option still incurs normal lein times

6:33 wink: oh right, now if only I had "time $@" :P

6:33 thanks, but at least it worked

6:34 304 ms

6:34 according to Measure-Command {}

6:34 3,5e-06 days. thanks, powershell

6:39 nice, it's indeed twice as fast

6:40 ianhedoesit: what is?

6:40 oh, skummet's standalone jar?

6:41 TEttinger: I'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?)

6:42 ianhedoesit: I also don't think many clojure devs are too interested in CLI projects, or really anything lightweight.

6:43 TEttinger: it does also reduce memory usage, which I think is a concern

6:47 ah! benhuda, I think the problem with clojure-soup and skummet is related to `get!` and not `$`

6:48 ianhedoesit: TEttinger: why do you say that?

6:49 TEttinger: that goes roundabout to calling invoke

6:49 invoke is: (clojure.lang.Reflector/invokeInstanceMethod instance method (to-array args)))

6:49 which I am pretty sure is not compatible with skummet's skimming off of Vars

6:50 ianhedoesit: I'm using get! right now with skummet

6:51 TEttinger: hm!

6:51 then I have no idea what the problem was

6:51 ianhedoesit: benhuda: how are you trying to use it? I'm using jsoup with skummet

6:51 benhuda: ianhedoesit it works?

6:52 ianhedoesit: it is for me, yes.

6:52 TEttinger: (inc ianhedoesit)

6:52 (dec lazybot uptime)

6:52 ianhedoesit: lol

6:52 benhuda: ianhedoesit i'm using clojure-jsoup.. perhaps that's the difference?

6:52 ianhedoesit: I'm using the library you linked me to, I mean.

6:53 TEttinger: yeah, no get! in a java lib, no ! in java names, heh

6:53 benhuda: ah, well i do no more than just using the first sample on the clojure-jsoup readme

6:53 ianhedoesit: I just added the first example in the README for clojure-jsoup to my project and am using skummet

6:53 TEttinger: interesting!

6:53 benhuda: hmmm..

6:53 ianhedoesit: ian@ian-g7:sample$ java -jar target/lein-skummet-sample-0.0.1-SNAPSHOT-standalone.jar

6:53 TEttinger: to the refheap!

6:53 ianhedoesit: Hello, World! 42

6:53 foobar

6:53 sorry for the multiline output!

6:53 (http://www.google.com/chrome/browser/?hl=en&brand=CHNG&utm_source=en-hpp&utm_medium=hpp&utm_campaign=en http://www.google.com/advanced_search?hl=en&authuser=0 http://www.google.com/language_tools?hl=en&authuser=0)

6:54 TEttinger: what?

6:54 clojurebot: what could possibly go wrong

6:54 benhuda: ianhedoesit sure it gets executed?

6:55 ianhedoesit: what do you mean?

6:55 TEttinger: that looks like it yeah

6:55 benhuda: the output looks like the default sample output. can you print out something out of a web page you're scraping with jsoup?

6:55 TEttinger: that last google thing is the intended output I think

6:55 benhuda: ah

6:55 sorry :)

6:55 i was blind for that link

6:55 TEttinger: links scraped off google

6:58 ianhedoesit: https://www.refheap.com/109980

6:58 too lazy to trim it down to the relevant functionality

6:58 but you get the point - that runs just fine

6:59 benhuda: so i use that sample and keep getting errors. i guess this is something wrong with my own project

6:59 ianhedoesit: also the jar is quite fast. 1.872s for the jar and 4.912s for lein skummet run

7:00 benhuda: ianhedoesit how is your project.clj looking?

7:00 ianhedoesit: obviously the majority of that time seems to be the actual getting of google (very slow and touchy internet here)

7:01 https://www.refheap.com/109981

7:01 benhuda: it might be my lein

7:01 https://github.com/alexander-yakushev/lein-skummet/issues/4

7:01 ianhedoesit: which, again, is not as small as it should be if I want to just show off skummet

7:01 benhuda: damn. it is. i'm on lein 2.5.1

7:02 ianhedoesit: I'm on 2.5.2

7:02 benhuda: upgrading..

7:03 ianhedoesit: I'm upgrading to 2.5.3. assuming that it'll still work. :)

7:04 this 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.

7:06 benhuda: i think good CLI experience is the tipping point for every language

7:07 so... nothing works for me. not 2.5.1/2, and not 2.4.3

7:07 ianhedoesit: seems to work

7:07 2.5.3 works for me, that is.

7:08 you did say you're on java 8 right?

7:08 benhuda: yep

7:08 ianhedoesit: hm

7:08 2.5.2 and 2.5.3 work fine for me :/

7:09 benhuda: yea, i guess i should give up. too much time :)

7:09 have fun!

7:09 ianhedoesit: hm, sad.

7:10 benhuda: ok one last try worked

7:10 what to know what it was?

7:10 rm -rf target :)

7:10 damn it

7:10 ianhedoesit: oh, by the way

7:10 https://github.com/alexander-yakushev/lein-skummet/issues/6

7:10 that's probably why

7:10 you need to call lein clean yourself ;)

7:10 benhuda: hehe

7:11 ianhedoesit: I probably should've said something since I already ran into that.

7:11 so it works now?

7:11 benhuda: yup

7:11 ianhedoesit: awesome!

7:11 benhuda: i made a print right before the network call, to see if the extra jar is affecting startup time

7:12 so this is awesome

7:13 i think all in all, we have the startup time of racket

7:13 crocket: Is it possible and easy to shorten the startup time?

7:13 benhuda: but not chicken or gambit, which i guess if its acceptable for racket, its acceptable for clojure cli tools

7:13 crocket yes, we've just been discussing this and experimenting together.. its been fun.. read up :)

7:14 crocket: So, what is the winner?

7:14 ianhedoesit: skummet seems promising.

7:15 benhuda: indeed. for me, this completes around 5 hours total of going through a few scheme implementations.

7:16 i just verified - racket and skummet 300ms/362ms respectively

7:16 good enough?

7:16 crocket: skummet?

7:16 ianhedoesit: I don't know, those 62ms concern me.

7:16 benhuda: clojure with skummet

7:16 crocket: Does scummet lead to fast startup time?

7:17 I thought skummet was for android

7:18 Why does rich hickey not adopt skummet?

7:18 benhuda: well, looks like it works... scroll up to catch up

7:19 crocket: Too long; didn't read

7:19 benhuda: :)

7:19 crocket: Give me a summary

7:19 What is the best?

7:20 benhuda: there's no best actually.. there's only skummet

7:20 crocket: Why is skummet no integrated into clojure yet?

7:20 benhuda: i.. don't know..?

7:22 wasamasa: it's fine, just ignore the crockpot

7:23 ianhedoesit: using 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

7:24 crocket: http://clojure-android.info/blog/2015/07/01/gsoc2015-skummet-faster-now/#sec-2 is funny

7:25 wasamasa, Ignore yourself

7:30 ianhedoesit: benhuda: 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)

7:31 for 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.

7:32 also, using core.async with skummet gives me about a 2.5s runtime. that's pretty fantastic.

7:32 scottj: crocket: rich played with some similar techniques last year in the fastload branch. I think there were issues that motivated them to not merge it.

7:33 crocket: like what

7:33 scottj: crocket: idk, have you searched JIRA?

7:34 you could also read skummet website and mailing list looking for issues

7:34 crocket: I didn't know JIRA.

7:34 wasamasa: lol

7:34 benhuda: ianhedoesit wow

7:34 wasamasa: crocket: did you assume clojure has no bugs?

7:35 ianhedoesit: benhuda: yeah. ~2.5s vs ~5.8s on my laptop

7:35 pretty speedy.

7:35 wasamasa: FWIW, I can't find any mentions on the bugtracker

7:35 benhuda: ianhedoesit interesting. no diff. here after removing skip vars (i did a clean)

7:36 crocket: wasamasa, That's not useful

7:36 scottj: crocket: afaik the fastload branch sped up start time but slowed down runtime.

7:37 crocket: I heard it

7:37 borkdude_: what's the general idea behind the socker repl server in clojure 1.8, compared to what we have already with lein, nrepl, etc?

7:38 crocket: Right now, ClojureScript on nodejs is fast to load.

7:38 not easy to set up.

7:39 justin_smith: borkdude_: 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)

7:39 borkdude_: I think rhickey had some design differences with nrepl that he wants to implement too

7:39 borkdude_: justin_smith ok, like with cljx --> reader conditionals

7:39 ianhedoesit: benhuda: to be fair it is only 100ms. there's a lot of reasons I could've seen that :)

7:39 justin_smith: exactly, yeah

7:40 borkdude_: and I would expect a similar result - something lighter weight and cleaner to work with

7:41 borkdude_: 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

7:42 borkdude_: 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

7:42 justin_smith: borkdude_: oh, potentially a lot faster to start up, that's awesome

7:43 TimMc: Good for apps, but not as interesting for servers.

7:44 (Then again, who cares about JVM startup time on servers?)

7:44 justin_smith: s/JVM/clojure/

7:45 crocket: TimMc, People who write CLI apps

7:45 Servers rely a lot on CLI apps.

7:45 justin_smith: TimMc: 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

7:45 crocket: Writing CLI apps in clojure is beneficial.

7:45 ane: justin_smith: what os is this? Mirage?

7:45 justin_smith: TimMc: I mean launch a fresh vm and calculate and return a reply

7:46 ane: yeah

7:46 ane: that thing is a work of art

7:47 crocket: Mirage is restricted to Xen.

7:47 Its usefulness is not great.

7:50 ianhedoesit: benhuda: well I've enjoyed learning a bit with you tonight. thanks for that. :)

7:51 benhuda: ianhedoesit same here, a lot of fun! :)

7:57 TimMc: crocket, justin_smith: Mmm, I meant the long-running services themselves.

7:58 That's pretty cool about OCaml. :-)

7:58 justin_smith: TimMc: yeah, but quicker startup time opens up the potential / flexibility to do other cool things

7:58 TimMc: I would turn off any var-immutability perf feature on a server.

7:59 justin_smith: but then again ocaml doesn't have good support for real threads, so they use processes instead...

7:59 TimMc: It's too valuable to be able to liverepl in and start redefining things.

7:59 justin_smith: TimMc: your server code rebinds vars in core?

7:59 ahh

7:59 TimMc: only in emergencies :-)

7:59 Would this only be in core, though?

8:00 justin_smith: TimMc: maybe I misunderstood

8:00 I didn't think it would be a global "can or cannot rebind any vars" switch

8:01 TimMc: I guess I naively imagined something like "freezing a namespace" as an explicit thing

8:01 TimMc: presumably it would exempt vars that were specially marked

8:01 justin_smith: TimMc: right, like *out* for example

8:03 ashwink005: I can't understand whats the difference between :strs and :keys

8:03 justin_smith: ashwink005: they expect different types as keys in the map

8:04 ,(let [{:strs [a b c]} {:a 0 :b 1 :c 2}] [a b c])

8:04 clojurebot: [nil nil nil]

8:04 justin_smith: ,(let [{:keys [a b c]} {:a 0 :b 1 :c 2}] [a b c])

8:04 clojurebot: [0 1 2]

8:04 TimMc: justin_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.

8:04 justin_smith: ,(let [{:strs [a b c]} {"a" 0 "b" 1 "c" 2}] [a b c])

8:04 clojurebot: [0 1 2]

8:05 TimMc: It was super nice to be able to do that.

8:05 ashwink005: justin_smith, Oh! thanks!

8:05 justin_smith: TimMc: I've been using edn inside kafka for similar stuff, but retroactive

8:06 ashwink005: wonder why there's so little written about them in clojure.org

8:06 thanks again

8:06 justin_smith: ashwink005: it would be under "destructuring"

8:07 ashwink005: http://clojure.org/special_forms#Special Forms--Binding Forms (Destructuring)

8:07 err

8:08 http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)

8:08 oh wow, that doesn't even mention :strs

8:08 ashwink005: justin_smith, yes I'm on the same page. There's just one line without examples there.

8:09 justin_smith: oh wait it does

8:09 ashwink005: yeah

8:09 very little

8:09 justin_smith: yeah, pretty terse on that topic

8:09 ashwink005: http://conj.io tends to have more detailed info / examples

8:16 ashwink005: yes I saw that :)

8:19 TimMc: justin_smith: /me looks up kafka

8:20 What do you mean by retroactive?

8:20 justin_smith: TimMc: 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

8:21 TimMc: Hmm, I wonder what kind of load it can take.

8:21 justin_smith: TimMc: 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

8:22 and we use transit to encode all the messages

8:23 TimMc: How many messages/second can it handle, though? I'm thinking about rate more than queue depth.

8:24 justin_smith: kafka has excellent throughput, I don't know if there's a higher throughput open source message system with any reliability to it

8:24 the 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)

8:25 the fact that this allows logging and replay is a nice side effect

8:25 TimMc: https://engineering.linkedin.com/kafka/benchmarking-apache-kafka-2-million-writes-second-three-cheap-machines

8:28 TimMc: 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

8:42 TimMc: Neat!

8:43 That's about 500x one of our current needs, I think.

8:44 wink: I just kafka to be horrible in development. (or aything that uses ZK, really)

8:44 if you let it run, it will run for months

8:44 if you put it on vagrant and start/stop it or redo parts, you're in for a treat

8:50 justin_smith: yeah, zk is not so elegant about shutdowns

9:32 xtrntr: hi, if i was simulating something like a jellyfish

9:33 and i need to keep track of state like orientation and coordinates

9:33 how do i do that in clojure?

9:33 i'm guessing the clojure init would be one big loop where i redraw the jellyfish

9:33 with each update i get the new state variables and redraw a new jellyfish?

9:37 justin_smith: xtrntr: what drives your render loop?

9:37 xtrntr: i'm looking at some example code

9:38 it looks like this guy uses doseq and a callback-fn

9:47 justin_smith: xtrntr: 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

9:47 but 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

9:48 xtrntr: justin_smith: okay, i'll try stuff out and see what works. thanks!

10:09 rritoch: Hi, I have a question or possibly a bug regarding gen-class.

10:10 I guess the important question is if I have :init init :prefix "foo-" my initialization function is supposed to be foo-init correct?

10:12 If 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:12 The 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:14 I 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:15 Is this a mistake on my part or a bug?

10:27 I'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:42 I also tried pushing up a null via (def foo-init [bar] [[nil] bar]) but it's still passing bar to the constructor.

10:42 The super-class constructor that is.

10:44 It seems I can only resolve this with a setter and a mutable state accepting no args to init.

10:48 Well, before I take that option I'll try using the :constructors paramter, I guess that's what I did wrong.

12:30 akkad: cider seems to cause a lot of hangs in emacs when I hit line return while defining a function

12:59 RedNifre: Hi.

12:59 Which of your languages did clojure replace, if any?

13:05 akkad: clojure have a (type or (type-of?

13:06 RedNifre: Common Lisp

13:06 ruby

13:06 RedNifre: yes, there is (type

13:06 akkad: k

13:07 thanks

13:07 RedNifre: Interesting, I also thought that, for me, clojure might a good replacement for ruby...

13:07 which other languages do you use?

13:07 akkad: concurrency, memory usage

13:07 python

13:07 RedNifre: so why doesn't clojure replace python for you?

13:08 akkad: different domain. config management through ansible.

13:08 we'll see if I can get jamvm to replace scripts

13:20 Trioxin: lol clojure replace PY

13:21 RedNifre: Trioxin ?

13:21 Trioxin: that 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:30 wink: then gain python is one of the easiest to learn

13:38 mungojelly: couldn't we just start a python as well as a jvm and have some sweet syntax for talking to it

13:40 timothyw: Question.

13:40 `reductions` returns a lazy sequence of intermediate stages of what `reduce` would have returned.

13:41 so `reductions` is like a lazy `reduce`, except it has all these intermmedite lists

13:41 i'd like to map over an infinite list, but in this case, I don't know how to take just the last value.

13:41 is there a trick to always getting the last value in that infinite sequnce... as if I were just dealing with 1 lazy sequence?

13:44 justin_smith: timothyw: an infinite list has no last value

13:45 perhaps you mean the last value you care about... or you don't really mean an infinite list?

13:50 timothyw: justin_smith: yes, the last value I care about

13:51 justin_smith: take-while or drop-while might help there

13:51 timothyw: I’d like 1 infinite sequence, without all the intermmediate stuff…

13:51 hmm, lemme try

13:52 justin_smith: (first (drop-while not-good-enough (reductions f coll)))

13:52 something of that general shape maybe?

13:53 akkad: you can (first any sequence.... that is soo damn nice

13:55 timothyw: justin_smith: it’d be nice to have (drop-while #(not (last? %))(reductions f coll))

13:55 except, there’s no last? function

13:56 justin_smith: timothyw: if you aren't finding the actual last item you need your own predicate

13:56 unless the sequence stops, in which case just do (reduce f coll) and be done with it

13:57 (that is, if coll is not infinite)

13:57 timothyw: akkad: I’d need the “last” thing of a `reductions` call - ie I need 1 lazy seq instead of the intermmediate values

13:57 justin_smith: timothyw: if you want the last thing reductions returns, just use reduce, I thought you said the result was infinite?

13:58 ,(reduce +' (range 10000000))

13:58 clojurebot: 49999995000000

13:58 timothyw: justin_smith: i need the state accumulation offered by `reductions`, but would like just 1 infinite seq at the end

13:58 so I’m between a rock and a hard place

13:59 justin_smith: then you need some function that decides if you are done yet

14:00 and if you can't write a function that makes that decision, your code is impossible to write

14:00 timothyw: well, I need i) the state accumulation and ii) i need for it to operate on a lazy seq

14:00 justin_smith: timothyw: lazy seq is different

14:00 timothyw: hmm, but reductions is doing its thing somehow…

14:01 it’s able to consume a lzy seq and produce a lazy seq

14:01 justin_smith: timothyw: reductions is lazy, it doesn't care how long its input coll is

14:01 so what's the problem?

14:01 timothyw: … I just don’t want the intermmediate values

14:01 justin_smith: exactly

14:01 justin_smith: which value do you want/

14:02 timothyw: justin_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:02 justin_smith: OK, which value isn't intermediate?

14:02 rhg135: reduce

14:02 justin_smith: rhg135: he said the input was infinite

14:02 rhg135: Oh

14:03 justin_smith: the thing he is asking for can't exist

14:03 rhg135: Is that possible?

14:03 akkad: are [ and ( interchangeable?

14:04 justin_smith: akkad: absolutely not

14:04 akkad: k

14:04 mungojelly: akkad: no, [ starts a vector and ( starts a list (which are evaluated)

14:04 akkad: gotcha

14:04 justin_smith: rhg135: infinite sequences definitely exist eg. (cycle [0]) or indefinite like range

14:05 timothyw: if I (take 10 (reductions f coll)), the last value is the accumulation of everything I’ve done so far

14:05 justin_smith: sure

14:05 but you wanted the "last value" and if your input is infinite, there is no such thing

14:05 so you need some criteria that decides you are done

14:05 timothyw: so, it would be nice to just get that tail value in a lazy fashion

14:06 justin_smith: that's what a lazy seq is, a lazy seq of tails

14:06 so just call reductions, and that's what you get

14:06 but 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:07 rhg135: Justin_smith, I meant an infinite reduce

14:07 timothyw: “last” value is a crude way of putting it

14:07 justin_smith: rhg135: sure, it just wouldn't return, just like a loop that always calls recur

14:07 timothyw: since the tail is the accumulation of all previous operations, I’d just like that

14:08 rhg135: A returning one

14:08 justin_smith: rhg135: as long as you don't create a messed up state, it will chug along until you kill it

14:08 rhg135: :-P

14:08 timothyw: … and I don’t want it to return. In fact, I need it to be lazy

14:08 justin_smith: timothyw: not returning and being lazy are different things

14:08 (loop [] (recur)) doesn't return, and is not lazy

14:09 (range) returns immediately, and is lazy

14:10 timothyw: Fair enough (cut the “return” statement) - I just need the result to be lazy (without giving me the intermmediate values)

14:10 justin_smith: timothyw: that's absurd

14:10 all values in a lazy-seq are intermediate

14:10 until the seq ends, and yours wont (or so you'

14:10 ve said)

14:11 timothyw: Ok, let me think about it some more.

14:11 Maybe I’ll just need to change my algorithm

14:13 justin_smith: timothyw: 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:13 triss: hey 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:14 i.e. after running the following `(parse (file (resource "test.xml")))`

14:14 timothyw: justin_smith: yes, passing different transformed lazy sequences around is what I’m doing

14:14 triss: why would i be seeing an UnknownHostException here?

14:15 timothyw: so map > filter > etc

14:15 triss: the file can be slurped just fine

14:15 justin_smith: triss: the xml has a bad url for some schema element?

14:16 timothyw: with that, we’re only getting a lazy seq of final values, or tails, or whatever… we’re not getting all the intermediate values

14:16 justin_smith: eg. a dtd that points at a bad host

14:16 triss: ah... so I need to have the schema somewhere if its referenced in the DOCTYPE?

14:16 ah that makes sense

14:17 justin_smith: triss: frankly xml confuses the fuck out of me, but yeah I think the schema URLs in dtds have to exist somewhere I think?

14:18 triss: justin_smith: yeah I've never really enjoyed it.

14:18 deleting the DOCTYPE's fixed everything anyway. thanks fore the hint

14:19 justin_smith: timothyw: 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:19 triss: haha, that's how I deal with xml too, if it's confusing, delete it :P

14:21 timothyw: justin_smith: I’m taking a look at `reduced` and `reduced?` to see if they can help

14:25 justin_smith: timothyw: reduced is just a way you can say "stop now, this is the end result"

14:25 it's basically early return from reduce, it gets called inside your reducing function, and makes it stop using more input

14:26 s/it gets called/you can call it if you like/

14:26 timothyw: justin_smith: it seems to be a flag that can be seen by `reduced?`

14:26 justin_smith: timothyw: no, it's a data type that causes reduce to return with your value

14:26 ,(reduced 10)

14:26 clojurebot: #object[clojure.lang.Reduced 0x1ade79f0 {:status :ready, :val 10}]

14:27 justin_smith: ,(reduce (fn [_ x] (if (= x 10) (reduced x)) (range))

14:27 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:27 justin_smith: ,(reduce (fn [_ x] (if (= x 10) (reduced x))) (range))

14:27 clojurebot: 10

14:27 justin_smith: note that the input to that reduce was indefinite, but it returns quickly

14:27 timothyw: right. understood

14:27 yep, I get that.

14:28 I’m just gonna play with it a bit… that with drop-while

14:30 justin_smith: timothyw: 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:33 timothyw: justin_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:34 and ii) i need it to consume a lazy seq

14:34 So I’m going to have a play and see how far I get

14:51 justin_smith: timothyw: reduce can do both of those things

14:51 timothyw: justin_smith: oh?! that’s interesting to me

14:52 justin_smith: ,(reduce (fn [[prev acc] i] (if (> i 10) acc [i (+ prev i)]) [0 0] (range))

14:52 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:52 justin_smith: ,(reduce (fn [[prev acc] i] (if (> i 10) acc [i (+ prev i)])) [0 0] (range))

14:52 clojurebot: #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:52 justin_smith: hmm...

14:52 ,(reduce (fn [[prev acc] i] (if (> i 10) (reduced acc) [i (+ prev i)])) [0 0] (range))

14:52 clojurebot: 19

14:53 justin_smith: timothyw: the above uses the previous return value at each step

14:53 and also the previous input value

14:55 timothyw: justin_smith: right, but the result isn’t lazy

14:55 and like you said, maybe it’s impossible to get all three

14:55 … all three conditions

14:56 but it doesn’t strike me as impossible that could get all the properties of `reductions`, with 1 flat result sequence

14:56 … or maybe it is

14:56 … or maybe it is impossible

15:22 mungojelly: (clojure.string/join (flatten (interpose "\n" (doall (partition-all 5 "string to be wrapped")))))

15:22 what's a better way to say that :/

15:25 rhg135: (clojure.string/join "\n" (partition-all 5 "stuff is awesome"))

15:26 mungojelly: "clojure.lang.LazySeq@80233d7\nclojure.lang.LazySeq@7b1487f\nclojure.lang.LazySeq@3a4674f\nclojure.lang.LazySeq@83ea932\nclojure.lang.LazySeq@106a"

15:26 rhg135: hmm

15:28 ,(clojure.string/join "\n" ["line1" "line2"])

15:28 clojurebot: "line1\nline2"

15:28 rhg135: weird

15:29 oddcully: ,(clojure.string/join "\n" (map (partial apply str) (partition-all 5 "string to be wrapped")))

15:29 clojurebot: "strin\ng to \nbe wr\napped"

15:29 rhg135: ah, I see

15:30 mungojelly: partition tears up its stringiness

15:30 oddcully: better? i don't know. but interpose and join in one line looks funny

15:30 mungojelly: so i'm not missing some wrap-string i should say? oh maybe there's a wrap method in the java

15:30 rhg135: strings think they are so special

15:32 ,(sequential? "string")

15:32 clojurebot: false

15:34 rhg135: ,(= "hi" [\h \i])

15:34 clojurebot: false

15:35 mungojelly: where's your EGAL now

15:39 rhg135: that may be equal in cljs

15:39 probably not though

16:21 justin_smith: mungojelly: btw

16:21 ~flatten

16:21 clojurebot: flatten 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:22 justin_smith: rhg135: in cljs it would be equivalent to (= "hi" ["h" "i"]) which I really hoped would not be true (and was not)

16:23 mungojelly: justin_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:23 justin_smith: rhg135: since in cljs (= \h "h")

16:23 mungojelly: yes, that was just an aside that I like to bring up whenever I see flatten

16:23 mungojelly: i have to play more with mapcat i don't get it

16:24 justin_smith: mungojelly: with mapcat for each input you return either a sequence or nil

16:24 mungojelly: nils are thrown away, sequences are concatenated

16:24 or, equivalently, nils are just empty seqs that disappear in the concatenation

16:25 rhg135: I later realize that

16:25 justin_smith: ,(mapcat identity [[1 2 3] nil [] [4 5] [[6]]])

16:25 clojurebot: (1 2 3 4 5 ...)

16:25 justin_smith: of course mapcat identity is just apply concat

16:26 mungojelly: but 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:27 justin_smith: it removes one level of inner nesting, yes

16:28 mungojelly: but compare these:

16:28 ,(flatten "hello")

16:28 clojurebot: ()

16:28 justin_smith: ,(apply concat "hello")

16:28 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>

16:28 justin_smith: heh, equally terrible

16:28 ,(flatten ["hello" "world"])

16:28 clojurebot: ("hello" "world")

16:29 justin_smith: ,(apply concat ["hello" "world"])

16:29 clojurebot: (\h \e \l \l \o ...)

16:29 justin_smith: man, that print limit

16:29 ,(apply str (apply concat ["hello" "world"]))

16:29 clojurebot: "helloworld"

16:35 triss: have any libraries been written fro manipulating xml-seq in a nice way?

16:36 I've just written a filter-tag and filter-attr method and bet any awful lot of other people have too

16:36 justin_smith: I bet you could use some stuff from hiccup or maybe enlive?

16:36 I'm not sure though

16:36 triss: I hear zippers combine nicely with xml-seq

16:37 triss: justin_smith: i don't really like the look of zippers.......

16:37 maybe im missing out though.... all that up down left right stuff

16:37 intresting to think about hiccup/enlive tho...

16:37 I'm gonna take a peek

16:43 justin_smith: triss: the thing with zippers is that they are a purely functional way to walk through a tree of data

16:43 triss: so up means "go to this node's parent" (for example) and returns a new zipper where you are at the parent node

16:43 triss: yup... it's just my tree is pretty shallow really

16:44 justin_smith: yeah, 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:44 triss: I'm parsing MusicXML... which is just sequences of notes in sequences of measures

16:44 justin_smith: oh, that seems straightforward, yeah

16:44 triss: yeah. i'd like a big tree to drive about in one day too!

16:45 justin_smith: I wonder if zippers are useful for driving around in big graphs - I have a bunch of those...

16:46 whaddyaknow https://github.com/jarohen/graph-zip

16:46 mungojelly: everyone's rewriting the same things here because there's no simple way to share and reuse a single function

16:46 justin_smith: mungojelly: eh, there's some really small libs out there

16:47 mungojelly: for example weavejester's env lib - hardly more than one function

16:47 mungojelly: the dependency architecture is so heavy that it's impractical to share under a certain size. hmm ok i'll check that one out!

16:47 justin_smith: mungojelly: 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:48 mungojelly: once you do it a couple of times, making a lib and putting it on clojars with lein is very light weight

16:48 mungojelly: but you should just be able to write a single function and publish it and then we can all work from there

16:49 justin_smith: who 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:49 mungojelly: like 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:50 justin_smith: mungojelly: 6 functions, one which you would ever use https://github.com/weavejester/environ/blob/master/environ/src/environ/core.clj

16:50 mungojelly: I'd rather use actual libs and dependencies and not some tooling built around our IRC bot

16:51 mungojelly: hmm 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:53 justin_smith: I'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:57 rhg135: I agree, using functions people write as a POC in production code is a very bad idea

16:59 mungojelly: what 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:59 rhg135: and broken code is a bigger "no thank you" sign

16:59 justin_smith: mungojelly: the barrier to publishing to clojars is extremely low

17:00 mungojelly: by 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:01 not 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:01 justin_smith: mungojelly: 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:01 rhg135: I understand

17:01 that doesn't exist yet

17:01 CHALLANGE ACCEPTED

17:02 it's not a good idea, but I'm bored

17:02 mungojelly: quil 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:02 justin_smith: mungojelly: 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:04 rhg135: he means without having to even package a jar

17:04 which I get. programmers are lazy bunch :P

17:04 justin_smith: rhg135: 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:04 "lein deploy clojars"

17:04 mungojelly: i'm working on something called stringplayground that'll accept submissions of functions that do simple fun things to strings

17:05 rhg135: what if I only have a vim buffer of code

17:05 justin_smith: rhg135: then use a gist or refheap?

17:05 rhg135: then I'd have to copy and paste

17:05 mungojelly: like 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:05 rhg135: laziness

17:06 justin_smith: rhg135: 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:06 mungojelly: there are sillier jars, I promise

17:06 rhg135: it takes far longer than that

17:06 justin_smith: mungojelly: and there's no reason not to put many examples in one jar

17:06 rhg135: but I would too

17:07 justin_smith: rhg135: more than 30 seconds for "lein deploy clojars" to run to completion?

17:07 maybe 10 is low, OK

17:07 haha

17:07 rhg135: for me to create a project, lookup my open my gpg keyring, then deploy

17:08 mungojelly: but 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:08 i 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:08 rhg135: I'll still do this, it'll be fun to see the chaos that ensues

17:11 bitraider: ,(prn "Hello")

17:11 clojurebot: "Hello"\n

17:11 bitraider: cool

17:14 rhg135: somethink feels off here, https://www.refheap.com/109993, but I can't place it

17:14 mungojelly: it'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:15 and 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:17 justin_smith: rhg135: if resolve-a-pending! got called in parallel, you could easily put objs on the same last-pending twice

17:17 rhg135: because you read from an atom and swap! it as separate ops

17:17 rhg135: Ah I see

17:17 thx

17:17 justin_smith: rhg135: so if you had [a b] as last-pending, you could write to b twice, and drop both a and b

17:17 I think

17:18 rhg135: yeah

17:18 justin_smith: rhg135: 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:18 rhg135: but how do I ensure the put! is only done once

17:19 justin_smith: because line 6 does something pretty weird as it is now that I look closer :)

17:19 rhg135: yeah, I saw that too

17:20 justin_smith: my calculations say it would get "wrong number of args (2) passed to: PersistentVector"

17:20 rhg135: I think so

17:21 akkad: does cider jump to a project based on what clj buffers you have open?

17:21 rlander: join #reaget

17:21 akkad: odd it finds the namespace but "no such var" on ns/function which is clearly in the required too-hot.core

17:21 rhg135: maybe using a PersistentQueue of pending puts!

17:24 justin_smith: akkad: do you have multiple projects open?

17:25 rhg135: 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:25 retries, everyone seems to forget retries

17:25 rhg135: not me, I am very aware

17:26 but, justin_smith, I don't understand what you mean?

17:27 justin_smith: to 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:27 or you could use a ref / transaction

17:28 rhg135: I get that, but if it is called concurrently, then one will retry the put

17:28 akkad: justin_smith: human error.

17:28 justin_smith: rhg135: yes, that is another concern

17:28 akkad: am I correct to assume clojars is the package repo for pulling down libraries? and that lein would facilitate dependencies automatically?

17:29 rhg135: and that may be ok

17:29 justin_smith: akkad: you need to manually specify top level deps in project.clj, and lein resolves the recursive deps

17:29 akkad: k

17:29 rhg135: I'll just have increasing numbers of parked go blocks

17:29 justin_smith: rhg135: yeah, when you need to alter a value and produce a visible side effect as a single action, things can get tricky

17:29 akkad: looking at testing a few with repl and was not sure if it required to edit/restart repl everytime

17:30 justin_smith: akkad: if you want to add deps without a repl restart, pallet/alembic is a lib that makes that easy

17:30 akkad: 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:31 akkad: excellent thank you

17:31 rhg135: I could make pending-ops a channel itself

17:31 justin_smith: alembic uses the same syntax as the deps vector in project.clj too, which is handy

17:31 rhg135: channels are for communicating accross go blocks is it not?

17:32 justin_smith: rhg135: yes, you shouldn't read and write the same channel in a single go block

17:32 rhg135: no, I pull a channel off a channel which I then write to and close

17:33 justin_smith: rhg135: I was agreeing, putting emphasis one the *across* part, not contradicting

17:33 rhg135: oh

17:33 yes that'd be very bad

17:36 how about this, https://www.refheap.com/109993

17:40 akkad: "for a leiningen based project" are there projects that are not lein based? or alternatives to lein? just curious

17:41 oddcully: boot

17:41 gradle

17:41 maven

17:41 akkad: oic, thanks

17:43 justin_smith: oddcully: 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:44 rhg135: that looks more reasonable, though what if the same connection-id is used twice? what would you expect to happen?

17:45 rhg135: akkad: plain clojure.jar

17:45 no deps

17:45 oddcully: justin_smith: if you see them doing it, shoot them

17:47 rhg135: justin_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:47 justin_smith: also, 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:47 clojurebot: In Ordnung

17:47 justin_smith: clojurebot: I wasn't talking to you

17:47 clojurebot: excusez-moi

17:47 justin_smith: ~also, a neat trick for a quick starting repl with known deps

17:47 clojurebot: also, 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:47 justin_smith: :P weirdo

17:49 akkad: justin_smith: so once you distill a package, do you require it by name for it to be available within the repl?

17:49 justin_smith: akkad: exactly, you use require like normal

17:49 you distill packages, you require namespaces (which are inside packages)

17:49 akkad: file not found

17:49 must be different name than the package

17:49 justin_smith: akkad: don't require the package name, require the namespace you want in that package

17:50 akkad: k. so api docs for a given package would be on clojars.org? or is there a more immediate interface via lein/repl?

17:51 justin_smith: akkad: 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:51 akkad: I'll rtfm, thanks this helps a lot

17:51 justin_smith: akkad: np, best of luck

17:51 akkad: this stuff is very well documented

17:54 kenrestivo: i'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:55 justin_smith: kenrestivo: do you mean assoc nil to some key the component provides? the component's key will still be in the system map

17:57 kenrestivo: yep. the key is there, but also so is the data i thought i'd overwritten with nil

17:57 justin_smith: kenrestivo: my typical stop method ends with (dissoc component :k :k2 :k3) to remove all the keys pointing to my own component's resources

17:57 kenrestivo: ooh good, i'll try dissoc

17:57 justin_smith: kenrestivo: I assume you are using the return value of stop?

17:58 it's still functional, it doesn't replace the old map directly

17:58 akkad: wow these libraries are documented and actually work

17:58 justin_smith: kenrestivo: the component is immutable, so you have to make sure you propagate the new value as needed

17:58 akkad: haha, nice

17:59 akkad: recovering from a year of CL dev

17:59 justin_smith: akkad: ovarall, deps in clojure have been a huge breath of fresh air compared to all the other things I have tried

17:59 kenrestivo: let's use ALL CAPS to make the transition easier

18:00 akkad: well having consistent (first '(any sequence))

18:01 "oh it's a vector of chars, use aref, it's a listp use nth/elt/" all with different syntax

18:01 justin_smith: yeah, protocols are very nice too

18:02 amalloy: "it's a list, use remove / it's a map, use dissoc / it's a set, use disj..."

18:02 justin_smith: amalloy: oh, wouldn't it be nice...

18:02 kenrestivo: it's a record... use dissoc and have it not go away!

18:02 justin_smith: kenrestivo: umm?

18:02 kenrestivo: which is precisely what just happened :/

18:03 justin_smith: ,(defrecord R [a])

18:03 kenrestivo: components are recordds

18:03 clojurebot: sandbox.R

18:03 justin_smith: ,(->R 1)

18:03 clojurebot: #sandbox.R{:a 1}

18:03 justin_smith: ,(dissoc (->R 1) :a)

18:03 clojurebot: {}

18:03 justin_smith: kenrestivo: I think your problem is elsewhere, because records definitely allow removal of keys

18:04 kenrestivo: yeah, so i did that (stop (dissoc this :thing-i-want-gone)) and it's still there

18:04 justin_smith: kenrestivo: and you are using the return value of stop?

18:04 or are you checking the original after calling stop (because checking the original will show the key still there, because records are immutable)

18:05 kenrestivo: i agree, this doesn't seem right. no, the stop function returns this. and it's supposed to go into the system map

18:06 https://www.refheap.com/109994

18:07 dur, sorry https://www.refheap.com/109995

18:07 clojurebot: I don't understand.

18:07 justin_smith: why do you call stop recursively?

18:07 rhg135: I've never had to manually call stop

18:07 kenrestivo: aha, it's a different stop.

18:08 rhg135: also dissocing a record's named keys yields a plain map

18:08 ah I see

18:08 kenrestivo: i have a stop function. name collision? i tried (assoc this :scheduler-internal nil)

18:08 rhg135: that's better

18:08 kenrestivo: it still doesn't make :scheduler-internal go awy tho :/

18:09 justin_smith: kenrestivo: 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:09 rhg135: don't make it a named field if you need to dissoc it

18:09 kenrestivo: i don't want to dissoc it, just to nil it.

18:09 i'll try renaming stop.

18:10 justin_smith: kenrestivo: and of course you have abranch on your if that does not do the dissoc

18:10 rhg135: justin_smith is probably right

18:10 justin_smith: kenrestivo: I assume you double checked that branch is not getting hit?

18:11 kenrestivo: yeah, i'm seeing the log, the correct branch is getting hit

18:12 this is where i'm at, still, same problem: https://www.refheap.com/109996

18:14 after doing that, the system map still does not have that key's data nil'ed out

18:15 i.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:16 justin_smith: and you are doing (swap! sys/system component/stop) or the equivalent with alter-var-root ?

18:17 sorry, I know that seems like a stupid question but the behavior you are describing makes no sense to me

18:24 kenrestivo: me neither

18:25 justin_smith: kenrestivo: what about adding another key (like ::stopped true) and seeing if that key shows up?

18:25 kenrestivo: because that would narrow down what kind of error you have

18:25 kenrestivo: (swap! sys/system assoc-in [:scheduler :scheduler-internal] nil) works, but that's not how components are supposed to work

18:25 justin_smith: no, not at all

18:26 kenrestivo: the stop method of the component/Lifecycle is supposed to return the component, so that's what i'm doing.

18:27 good 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.

18:46 * Ober looks for the best autocomplete solution for cider

19:51 generic_user: Hi anyone ever gotten a weird instaparse compiler error?

19:58 kenrestivo: pilot error. fixed: (swap! sys/system component/stop-system [:scheduler]) . i had been doing (-> @sys/system :scheduler component/stop). phew.

19:58 justin_smith: kenrestivo: HAHA I asked you precisely how you were doing that, at least twice!

19:59 I'm releived it was that simple

20:01 kenrestivo: yeah "i'm using component's stop function" was not sufficiently specific. i was using the wrong one, wrongly.

20:02 justin_smith: thanks for the sanity check though. made it clear to me it was pilot error here.

20:03 mungojelly: two 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:04 justin_smith: mungojelly: you can use with-out-str

20:04 or you can set *out* however you like, that will decide which writer gets your prints

20:05 and println everywhere is a sign of an immature lib or someone who hasn't commited on a logging library I guess?

20:19 xtrntr: if i have a function call (fill-rect surface [0 0 width height] [200 200 200])

20:19 can i do it in a let binding?

20:20 justin_smith: xtrntr: any valid function call is valid in a let binding

20:21 xtrntr: the hard part is making sure you use the return value in the right place and manner

20:21 xtrntr: can i name this function call?

20:21 im still used to doing things in an imperative manner..

20:21 justin_smith: xtrntr: if you mean bind the result, yes this is mandatory in let bindings

20:22 (let [rect (fill-rect surface ...)] (do-something rect))

20:22 xtrntr: the tricky part is whether fill-rect is functional - does it return a useful value?

20:22 xtrntr: if fill rect mutates its args, it might be useless to make a binding of the result

20:22 because it might return nil, I would need to know more about fill-rect

20:23 xtrntr: no.. it's just for me i guess

20:23 i like to name my function calls so its more readable

20:23 like the purpose of fill-rect is set-background-color

20:23 justin_smith: xtrntr: 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:35 mungojelly: i 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:37 i 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:57 gfredericks: mungojelly: [v# ~@body] → [v# (do ~@body)]

21:03 justin_smith: (inc gfredericks)

22:20 Ober: how can you access keys on a Persistent Array Map?

22:23 https://gist.github.com/7bc575c5e69574af27e9 cider makes emacs eat 100% cpu

22:30 hiredman: d

22:35 TEttinger: ,(get (array-map :a 1 :b 2) :a)

22:35 clojurebot: 1

22:35 TEttinger: ,((array-map :a 1 :b 2) :a)

22:35 clojurebot: 1

23:17 akkad: (count (:objects (s3/list-objects cred "cloudtrail-cs" [:max-keys 1000001]))) => 1000 even though the :max-keys returned says what I passed.

23:19 kavkaz: Has anybody here used Overtone with emacs?

23:30 tmtwd: no

23:31 akkad: briefly

23:31 Emacs is not meant for such things

23:31 tmtwd: lol

23:31 livemacs was designed by the overtone team

23:31 akkad: single threaded and not-evented

23:34 tmtwd: what is the carrot in this code? ^{:key (:id todo)}

23:34 can someone point me to the place that documents this?

23:34 for reagent

23:36 nvm

23:36 found it

23:51 amalloy: PS it's caret

23:56 TEttinger: circumflex.

Logging service provided by n01se.net