#clojure logs

2015-03-10

00:11the_dankoyo yo
00:11the_dankoso where is the idiomatic place to put java source files in a default lein project?
00:11the_dankoin the directory structure
00:15amalloythe_danko: lein will look in src/java if you don't say otherwise
00:16the_dankoamalloy so i have src/clojureproject and src/java
00:16the_dankoamalloy and that is good form?
00:16the_dankoamalloy it works for me.
00:16amalloywell, it's kinda tacky to have src/java and not have src/clj
00:17the_dankook, got it
00:17the_dankoso then i have to change some lein settings
00:19amalloydo you? i guess you do
00:48seubertI'm having issues loading a shared object file
00:49seuberthm maybe this is better asked in #leiningen
01:39Mercwithamouthany ragtime users here?
01:39nsjphyes but limited
01:40Mercwithamouthwhen doing migrations i noticed they name them with the year,month,date...then there are some additional #s afterwards. can those be random or is there any logic to naming your migrations?
01:40nsjphi know in my recent experience
01:40Mercwithamouthor does ragtime have a migration generator built in i'm not aware of?
01:40nsjphi had YYYYMMDDXX
01:40nsjphi had YYYYMMDDXX-description.[up|down].sql
01:41nsjphwhere XX was if i had multiple migrations for a particular day
01:41nsjphie, 01, 02, 03
01:41Mercwithamouthahh! gotcha. that works for me. makes perfect sense =P
01:41nsjphnp
01:41Mercwithamouthok, thanks. now i can jump in
01:41nsjphi ran into that as well
01:42creeseIs it possible to build an uberjar that reads from a config file?
01:42nsjphyes
01:42nsjphwait, when do you expect it to read from a config file
01:42Mercwithamouthyeah in the examples they use a lot of extra digits..seemed random
01:42creeseSeems like I have to rebuild when I change the config
01:42creesewhen I change the file
01:42nsjphwhich config are you referring to?
01:42creeseI don't want to rebuild
01:42nsjphproject.clj?
01:43creeseI have a config file in resources/
01:43creeseit's an edn
01:43nsjphyep
01:44nsjphif you edit your config in your resources, then your previous uberjar would no longer match what a new uberjar would produce
01:45nsjphwhat i have done in that case, is to have a 'defaults.edn' in resources/, and on first launch of the uberjar, it creates a ~/.myapp/config.edn from resources/defaults.edn
01:45nsjphi also throw in a pretty-print step so it's not too messy when saved to disk
01:46nsjph(spit config-path (with-out-str (pprint @config))) (where @config is from slurping io/resource "defaults.edn")
01:47nsjphthat way i can just edit the ~/.myapp/config.edn without rebuilding uberjar
03:18wei_what’s the idiomatic way to package node.js modules written in cljs?
04:04paulswilliamsesqMorning all
04:04SagiCZmorning Sir
04:39alvin`Are the sources/namespaces in the env folder in a leiningen project reachable through the lein repl?
04:54owl-v-i'm having trouble using lein
04:55owl-v-i'm trying to use https://github.com/mikera/core.matrix
04:55lazylambdaguys, is it possible to flatten a seq in clojure using only for comprehensions? I found that you can do this in python l = [[x, x+1] for x in range(10)], then flatten it using [e for x in l for e in x]
04:55lazylambdawhat's the equivalent in clojure?
05:00SagiCZlazylambda: well i guess you could write some sort of macro.. but whats wrong with nested fors?
05:01SagiCZi honestly dont find that python construct readible and similar constructs that are widely used in python are a reason why i stay clear of the language all toghether
05:01lazylambdaSagiCZ: nothing wrong with nested fors, but I couldn't get the right output
05:02SagiCZwell thats another problem.. so what the input and whats the output you want?
05:02lazylambdaI tried (for [i l] (for [e i] e)), but obviously that's wrong
05:02SagiCZwhat does the input structure look like?
05:03lazylambda(def l (for [i (range 10)] [i (inc i)])
05:03lazylambdaso l = [[0 1] [1 2] [2 3] [3 4] [4 5] ... [9 10]]
05:03SagiCZ,(for [i (range 10)] [i (inc i)])
05:03clojurebot([0 1] [1 2] [2 3] [3 4] [4 5] ...)
05:04lazylambdaI want [0 1 1 2 2 3 3 4 4 5 5 ..]
05:04SagiCZ,(apply concat (for [i (range 10)] [i (inc i)]))
05:04clojurebot(0 1 1 2 2 ...)
05:04lazylambdathat's what I thought
05:05lazylambdaI was wondering if it's possible to using only fors and not concating
05:05SagiCZit might be but i dont know how
05:06lazylambdaI am not sure if it's possible, but thanks anyway
05:06SagiCZnp
05:06lazylambdastill, the clojure version is much readable
05:06SagiCZthats what i am thinking.. i honestly dont understand the pyhton statement at all
05:07lazylambdaI am not a fan of python myself, but I just wondered if it was possible to flatten a nested seq in clojure using only fors
05:08SagiCZmaybe if you ask this again in couple hours, some experienced users might help you
05:08TEttinger,(for [i (range 10) n [0 1]] (+ i n))
05:08clojurebot(0 1 1 2 2 ...)
05:09TEttingeronly usable in this narrow case but hey
05:09TEttingerlazylambda: ^
05:09SagiCZTEttinger: i dont like it
05:09TEttingerapply concat is a better solution but this is one for
05:09SagiCZyeah i understand
05:14lazylambdaTEttinger: thanks, but that only generates the result, it doesn't flatten a given nested seq
05:14TEttingerright, so you want a second for loop to flatten an existing one?
05:14lazylambdayep
05:15lazylambdaso if I have ,(for [i (range 10)] [i (inc i)])
05:15lazylambdaI was trying to flatten that using only fors
05:15jaenHmm am I doing something wrong here that I get "unable to resolve symbol a" - https://gist.github.com/jaen/a1b025093642e1df691b - or do :or and :as not compose in core.match?
05:16TEttinger&(let [thing ([0 1] [1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9] [9 10])] (for [i thing idx [0 1]] (nth i idx)))
05:16lazybotclojure.lang.ArityException: Wrong number of args (9) passed to: PersistentVector
05:17TEttinger&(let [thing [[0 1] [1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9] [9 10]]] (for [i thing idx [0 1]] (nth i idx)))
05:17lazybot⇒ (0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10)
05:18TEttinger&(let [thing [[0 1] [1 2 3 4 5] [2 3 4] [3 4] [4 5] [5 6] [6 7 8] [7 8] [8 9] [9 10]]] (for [i thing idx (range (count i))] (nth i idx)))
05:18lazybot⇒ (0 1 1 2 3 4 5 2 3 4 3 4 4 5 5 6 6 7 8 7 8 8 9 9 10)
05:18TEttingerso with that it will handle an arbitray sequence of sequences
05:18TEttingerinstead of just pairs
05:30lazylambdaTEttinger: cool, thanks
05:31TEttingerlazylambda, it won't handle nesting deeper than one level, or nesting with non-indexed sequences like maos
05:31AtarianDumb question: If I were to implement MVC, Would you seperate it into seperate files with seperate namespaces and then (:require) them in the controller (-main)?
05:31lazylambdaCrap, what I was looking for was very simple
05:31lazylambda(for [x l i x] i)
05:31TEttingeroh haha
05:32lazylambdayep, I hadn't had any breakfast or coffee yet
05:32AtarianOoh coffee, that sounds like a good idea
05:32Atarianbrb
05:35AtarianDammit, coffee pot all furry :(
05:36alvin`asking again about the lein thing... A change in a template I used moved files from src to env. And I'm not exactly sure how to reach those namespaces anymore.
05:46kris__Is a keyword in Clojure literally a function or does it just act like a function? I'm thinking of (:a { :a 'a' :b 'b' })
05:46Empperikris__: it is a function
05:47kris__@Empperi Thanks :)
05:47Empperikris__: see https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/clojure/lang/Keyword.java
05:47Empperipublic class Keyword implements IFn, Comparable, Named, Serializable, IHashEq {
05:48EmpperiKeyword class implements IFn, thus it is a function in clojure
05:48kris__I know when passed a hash-map it looks itself up in the hash, I wasn't sure if this was a reader/compiler trick.
05:49Empperimaps, sets etc are also functions in clojure
05:49Empperi,({:foo 1} :foo)
05:49clojurebot1
05:49SagiCZkris__: no you can do anything with keyword you would do with a function.. like map it.. juxtapose it.. etc
05:50kris__nice, I'm new to functional. So in the case of ({:foo 1} :foo) the hash is a function which takes the argument :foo and looks it up?
05:51SagiCZyes it looks it up in itself
05:51kris__Thanks, I will keep reading!
05:53zotany ss/component users out there — is there a standard idiom for re-starting 1 service from a depending service, and properly updating the root service map?
05:55zotfor example, i've got a message stream that needs to be rewound, which requires interrupting the existing message stream (since it doesn't support live rewind), and restarting. i could also wrap the stream in a core.async channel and control this myself, but wondered if i can cleanly update the config, and restart the service, without any nasty side effects
06:09m00nlightCan anyone tell me the reason why I get "Generate tmp file failed exit code 132 reason : nil" , it works well under ubuntu, while has the probelm on a centos server
06:42nsjphi'd try using strace <your command> to see what is happening just before that failure
07:41AtarianI made a 10x10 2D array of Character/TYPE, but when I use (aset myarray 5 5 "*") I get argument type mismatch. aset-char doesn't appear to like 2d arrays either. What am I doing wrong?
07:43BronsaAtarian: "*" is a String not a char
07:44AtarianI think I just got it using \A
07:44Atarianis that right? (aset myarray 5 5 \A)
07:44BronsaAtarian: yes
07:44AtarianBriiliant thanks Bronsa
08:39noncomwhodidthis: hi! got any answer on your prolog question yet?
08:52svericfleming: ping
09:51justin_smithm00nlight: is this running in an app container?
09:59AeroNotixI have a clojure uberjar with gen-interface calls, when I load that jar into intellij it doesn't see the classes
09:59AeroNotixstrange thing is, it *used* to see them, not sure what may have changed.
09:59AeroNotixAny ideas?
09:59AeroNotixthe ns which has the gen-interface calls is in the :aot vector of the project
10:00justin_smithAeroNotix: if you open the uberjar, do you see the relevant class files?
10:00AeroNotixjustin_smith: jar tf foo.jar lists the classes, yeah
10:01justin_smithso for some reason the classes are in the jar, but are not being found when the jar runs?
10:01AeroNotixsounds like it right?
10:03justin_smiththis sounds like it could be an intellij issue, unless the class files are not in the right place in the jar or some weirdness like that
10:03AeroNotixjustin_smith: weird thing is, it finds one class from the same package
10:03AeroNotixbut not the others
10:14AeroNotixjustin_smith: any ideas?
10:15justin_smithfrankly, no. other than like checking for typos for the class or package name, stuff like that
10:15justin_smithconverting - to _ in the package, etc.
10:17AeroNotixjustin_smith: I'm looking at the jar contents in intellij and it finds com.foo.package
10:17AeroNotixbut only has one java package from there but it needs three
10:25justin_smithwait, you expect more packages, or more classes?
10:25AeroNotixclasses
10:25justin_smiththat's what I thought
10:26AeroNotixso lets say I generate com.foo.bar.IFooBar
10:26AeroNotixand com.foo.bar.FooBar
10:26AeroNotixand some other
10:26justin_smithright
10:26AeroNotixI can only see one of these classes for some reason
10:26AeroNotixbut they are all inside the jar
10:26justin_smithis it specifically the interfaces that intellij is not seeing?
10:26justin_smithmaybe it shows interfaces differently?
10:26AeroNotixno, just some random class it can see
10:26justin_smithhmm
10:26AeroNotix(seemingly random class)
10:29AeroNotixjustin_smith: i've had this working before but I deleted the target directory and rebuilt the uberjar and now nothing
10:29justin_smiththat's really weird
10:30justin_smithmaybe someone like Bronsa or puredanger who knows more about the compiler / bytecode output would be more help
10:30AeroNotixawesome, I'll stick around
10:30justin_smithas a lark, you could try using a different clojure.core version, couldn't hurt to try
10:30justin_smithmaybe you hit an obscure bug
10:30AeroNotixok sec
10:30puredangerwhat version are you using?
10:30puredangersome of this stuff changed in the 1.7 alphas
10:31AeroNotix[org.clojure/clojure "1.6.0"]
10:31puredangerwell, you could try 1.7.0-alpha5 - there were changes with gen-interface and classloading
10:31AeroNotixoke doke
10:36AeroNotixdoes intellij cache jar files?
10:36AeroNotixpuredanger: justin_smith http://i.imgur.com/QKTaALg.png
10:36AeroNotixI changed the classname and now it still uses the old name
10:37justin_smithsounds like intellij is being dummj
10:37AeroNotixhaha
10:38arrdempuredanger: get any interest in that documentation format project?
10:40puredangerarrdem: yes, couple
10:40arrdemgood
10:41puredangerAeroNotix: ¯\_(ツ)_/¯
10:41AeroNotixpuredanger: sup? :(
10:42puredangerjust no clue why you're seeing that
10:42AeroNotixsadness
10:42arrdempuredanger: still taking project ideas? we could really use a pygments style formatter in clojure for clojure :P
10:42`fogus@arrdem: "documentation format project" ???
10:42lazybot`fogus: Oh, absolutely.
10:42AeroNotixit looks like intellij is using some old version of the jar or something but searching my disk for other jars turns up nothing
10:43`fogusarrdem: "documentation format project" ???
10:43lazybot`fogus: Oh, absolutely.
10:43puredangerAeroNotix: I think cfleming would have some clue, but I don't
10:43AeroNotixok, thanks
10:43justin_smithAeroNotix: you could try temporarily moving your intellij config, IDEs can be weird sometimes
10:43justin_smithlazybot: are you a goofball??
10:43lazybotjustin_smith: Uh, no. Why would you even ask?
10:43AeroNotixjustin_smith: I don't usually use one but I'm writing something for people who do use one to use my library, so I want to test.
10:44puredanger`fogus: see http://dev.clojure.org/display/community/Project+Ideas
10:44`fogusthanks!
10:44justin_smithAeroNotix: in that case, maybe just delete your intellij config then :P
10:45puredanger`fogus: in the time-honored tradition of having too many things I want to do, I am trying to have someone else do them for me :)
10:45AeroNotixjustin_smith: looking where it is now :)
10:45`fogusI subscribe to this philosophy
10:46justin_smith`fogus: nice to see you around here btw, thanks for the cool books and blog posts and stuff, I learned a lot from you
10:46`fogusjustin_smith: I'd love to be around more, but the real-world keeps getting in the way... as it does.
10:47`fogusjustin_smith: and thank you. :)
10:49lazylambdafogus: I bought your joy of clojure a few months ago. The book is super tits.
10:50puredangerlazylambda: I don't think that language is appropriate here
10:51lazylambdapuredanger: oops, my apologies. Sometimes I forget I am not social media.
10:55delaneyhi, is there a way to disable repl support at the distribution/uberjar build step?
10:56justin_smithdelaney: as in, not launching an nrepl listener, or as in making it impossible to run a repl from the uberjar?
10:56justin_smiththe latter, probably not, because clojure.main is a repl
10:57delaneyyeah, bascially i don't see a way to make a 'secure' jar where it 'just runs'
10:57delaneynot allowing modification
10:58justin_smithdelaney: the jvm doesn't even make such a thing possible, some other program can always load your jar and use the classes as it likes
10:58justin_smithdelaney: and in the clojure case, clojure does not have a way to run without the compiler present
10:59justin_smithdelaney: if you switch to clojurescript, it will compile to js that does not include the compiler
10:59justin_smithbut it's not like js is a "secure runtime" or anything
10:59delaneywell i thought maybe it could munges the namespace/names and then only see from inside the package
11:00justin_smiththere are tools like that for java source, but munging can always be reverse engineered
11:00justin_smithbecause all it does is hide names
11:01delaneyjustin_smith: you i know, just trying to answer a few questions at work. perceptions of 'secure'
11:01justin_smithdelaney: there are bytecode obfuscators, and you could try to aot your whole project and use one, but I have no idea how well they would work for clojure
11:01justin_smithdelaney: fair enough
11:01justin_smithdelaney: yeah, I lost a client because they started up a "static analysis" policy and I couldn't offer anything like that for clojure
11:02justin_smithso I know where you're coming from
11:03agarmanjustin_smith: what kind of static analysis policy?
11:03justin_smithdelaney: the problem with using a bytecode obfuscator with clojure is anything that tries to work at runtime would need to know about the obfuscated names, or would break
11:03justin_smithagarman: they required static analysis of all code for security issues
11:04nsjphyou need to decrypt it to run it
11:04justin_smithnsjph: well, if the obfuscator is obfuscating a full java program that does not use reflection, it can make sure nothing breaks, but clojure does weird stuff at runtime that normal java code would not
11:05nsjphare languages that are garbage-collector-backed suitable for runtime obfuscation?
11:05agarmanjustin_smith: I've yet to see a production Java application that doesn't use reflection
11:06justin_smithnsjph: sure, as long as it's a whole-program transform that keeps everything consistent
11:06delaneygiven the 'code as data' paradims probably could have a public key encryption of your code, decrypting/run at startup
11:06justin_smithhaha
11:06justin_smiththat likely is an option
11:07justin_smithreplace require with require-encrypted
11:07justin_smiththe rest of the language can stay as is I guess?
11:07delaneycoming from C# clojure is a very odd duck. i have most everything clojure has, but seems like clojure forces better behavior
11:08delaneyjustin_smith: yeah, (require-ecc "pass" 'foo.bar)
11:08tbaldridgedelaney: a lot of it is about defaults as well. F# and C# are almost the same except F# defaults to immutability, C# to mutability, same sort of stuff for C# vs Clojure
11:09agarmanF# has records
11:09agarmanobject expressions
11:09justin_smithI think a lot of language design is what you make easy, and what you make difficult
11:09delaneyyeah, i mean the core concepts of functional style make sense, but the persistent defaults make way more sense in use. cause functional style in C# does lead to tons of memory usage if you use the defaults
11:09justin_smithor you have some languages (perl) that try to make *everything* easy, and some (fill in the blank) that want everything to be hard
11:10tbaldridgedelaney: "tons of memory usage", moreso that Clojure or F#?
11:10delaneywell clojure's syntax is easy, its 'real' syntax though is in how you call things like list comprehsions, which is not super clear (compared to python for example)
11:10tbaldridge*more so than
11:11agarmandelaney: using functional style objects doesn't increase memory usage, it just increases GC churn
11:11delaneyyeah, from my work i've seen java is faster, but C# usings like half the memory for same problems. well i meant larger footprints, more copying, more GC
11:12agarmandelaney: functional collections usually reduce memory size because it eliminates need for defensive copying
11:12delaneynot long term memory
11:12delaneyin game dev you tend to have more component/entity based systems so the need for defensive copies goes down
11:12delaneyits like a mini-actor system
11:13delaneybut again, the languages don't make you go down that route
11:14justin_smithdelaney: nothing stops you from using arrays and java.util.HashMap for everything in clojure, it's just a lot less convenient :)
11:15delaneyjustin_smith: well yeah i see that
11:15AeroNotixthe fact that you can use unbounded mutability when necessary is a huge win imho
11:15AeroNotixa lot of functional languages don't allow for this
11:16delaneyyeah, its one reason clojure seems worth learning
11:17delaneyone thing i wish it had out of the box is a way to serialize say 2 maps to edn. load back and do a diff/merge so they share the same memory again.
11:18delaneylike a way to serialize the actual backing stores of map/list/etc
11:18justin_smithwell, a list doesn't really have a backing store, it's a naive linked list
11:18justin_smithvector, on the other hand
11:21delaneycause for games, the undo/reverse time stuff works great, but if you want to store that to disk... it becomes huge and loading back loses the persitent connections
11:22AeroNotixjustin_smith: after deleting my intellij config, I couldn't start intellij (lol) and so I tried to re-install, wouldn't start. Then I tried to downgrade and now it doesn't find Java itself, but now it finds my new classes!
11:22AeroNotixphew-- is using IDEs really this painful?
11:22justin_smithAeroNotix: rofl
11:23delaneyi couldn't get cursive to work with intelij 14, got frustrated and tried CC, worked great.
11:23clojurebotGabh mo leithscéal?
11:29eric_normanddelaney: Im not positive, but could a custom fressian optimizer work?
11:33zotis there a way in midje to declare a test that *doesn't* run by default, but can be enabled with one of the lein midje pattern expressions?
11:36justin_smitheric_normand: yeah, that's probably a good lead
11:38justin_smithdelaney: eric_normand: yeah, this looks like it addresses your concern https://github.com/Datomic/fressian/wiki/Caching
11:38justin_smithif it works as advertised
11:38eric_normandIt seems like an important piece of the "tree in an atom" approach
11:44AeroNotixlooks like intellij stupidly caches some jars you set somewhere
11:44AeroNotixbut I can't find where
11:47AeroNotixah found it
12:27creeseI want to load config from the classpath for an uberjar. Can someone tell me what is wrong with this?
12:27creesejava -cp /etc/myapp -jar /opt/myapp/target/uberjar/myapp-0.1.0-SNAPSHOT-standalone.jar
12:28justin_smithcreese: I don't typically use -cp and -jar in one invocation, though it may in fact work
12:28creesehow would you do it?
12:28creeseI want it to look in /etc/myapp for a file called "config.edn"
12:29justin_smithjava -cp /etc/myapp:/opt/myapp/target/uberjar/myapp-0.1.0-SNAPSHOT-standalone.jar clojure.main -m my.ns
12:29creesewhat is the mean of the last part of that invocation?
12:29creesemeaning
12:29justin_smithyou specify clojure.main as the class to run (clojure.main/-main)
12:30justin_smiththen "-m" "my.ns" are the args that clojure.main gets
12:30justin_smithand clojure knows it should load that ns, and invoke it's -main
12:30creeseif you put thin your project.clj, can you leave it off?
12:30creesethat
12:31justin_smithif you aot compiled your main class, you may be able to specify that instead of clojure.main
12:31justin_smithbut the clojure.main approach is more flexible
12:31hiredmanyou cannot use -cp and -jar together
12:31justin_smiththat's what I though
12:31justin_smitht
12:31hiredmanif you set one jave ignores the other
12:31hiredman(and doesn't complain)
13:11AeroNotixgrr, my project compiles on archlinux with "Leiningen 2.5.0 on Java 1.7.0_75 OpenJDK 64-Bit Server VM" but not Ubuntu with the same
13:12AeroNotixcomplains that some gen-class'd classes aren't available
13:12AeroNotixbut then I look into the target directory and they are
13:21AeroNotixeverything is the same it seems in my project, lein, java{,c} version both match. Anything else that it could be?
13:28gfredericks,(Object.)
13:28clojurebot#<Object java.lang.Object@3ce754f3>
13:28justin_smith(Overruled.)
13:31creesejustin_smith: thanks for earlier, it's working now
13:31AeroNotixdoing it with `lein repl` works and I can import the classes
13:32justin_smithcreese: cool
13:33AeroNotixbut on this ubuntu box (and some of my other colleagues mac boxes) it complains it can't find a class which is clearly already compiled and in the tree
13:43hiredman,(Object.)
13:43clojurebot#object[java.lang.Object "java.lang.Object@5bd76887"]
13:43hiredmanobject object object
13:45justin_smith,(read-string (str (Object.)))
13:45clojurebotjava.lang.Object
13:45justin_smithinteresting...
13:46justin_smith,(str (Object.))
13:46clojurebot"java.lang.Object@cd35cb2"
13:46justin_smith,(read-string (pr-str (Object.)))
13:46clojurebot#error{:cause "No reader function for tag object", :via [{:type java.lang.RuntimeException, :message "No reader function for tag object", :at [clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180]}], :trace [[clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180] [clojure.lang.LispReader$CtorReader invoke "LispReader.java" 1164] [clojure.lang.LispReader$DispatchReade...
13:48hiredmandelightful
13:48aneis there a shorter way to do fn [m f] (f a)
13:49justin_smithane: #(%2 a)
13:49aneoh, oops, (f m)
13:49aneso #(%2 51)
13:49ane%1
13:49justin_smithyeah
13:50anei'm folding over a list of functions
13:50justin_smith((apply comp fns) initial)
13:50justin_smitherr, maybe you want to reverse fns first though :)
13:51anewell, order doesn't matter, as they are essentially updating a map, but each on a different key
13:51anei guess i could just map fn map and then merge everything
13:51justin_smithyeah, in that case apply comp may be more straightforward than reduce with #(%2 %1)
13:52justin_smithapply comp is simpler than a map + merge too (as well as being less work done to generate the result)
13:55aneyeah, it would look silly. thanks
14:03gfredericks,(str (Object.))
14:03clojurebot"java.lang.Object@506cff4b"
14:03gfredericksoooh right
14:03gfredericksso is it easier/harder for a repl user to distinguish a thrown exception from a returned one?
14:04gfredericksrich's commit didn't seem to touch the repl so I'm not sure, especially since I don't really know how you currently do that
14:05hiredmangfredericks: the repl since a few releases back just prints the classname and the message of exceptions
14:05hiredmanit doesn't prn them, or print a stackstrace
14:06hiredmanclojurebot does pr the exception
14:06gfredericksokay so you distinguish because thrown exceptions give unreadable output
14:06gfrederickswhile returned exceptions give you the #error {...}
14:06hiredman(not printing the stacktrace in the repl is terrible)
14:07gfredericksyeah I've seen that confuse so many people
14:07hiredman(you all did this with your complaining about clojure stacktraces)
14:07gfrederickspretty much anything you do with exceptions will make somebody mad
14:07hiredman(I will never forgive you)
14:07gfredericksyou all |did| this with your complaining about clojure stacktraces
14:07gfredericks~you all |did| this with your complaining about clojure stacktraces
14:07clojurebotc'est bon!
14:07gfredericks~I |will never forgive| you
14:08clojurebotAck. Ack.
14:09hiredmanztellman and cemerick were tweeting about fsm and ztellman's automat library yesterday, and now I really want to rewrite clojurebot to run a little core.async machine per user
14:10hiredmaneach user would effectively have their own possibly stateful session
14:10gfredericksdoes "user" include channels?
14:10hiredmanno
14:10hiredmanevery user in a channel
14:12hiredmanso if you and I were evaluating stuff, it would likely be evaluated in the same sandbox, but if there was some complicated stateful factoid command stuff like, that would be independent
14:13hiredmanI am thinking commands for editing factoids, or just walking through a listing or whatever
14:31sverijustin_smith: don't know if you remember my problem from last weekend, I had some time today to do it right, this is the recursive part now: (reduce (fn [a b] (conj a (create-single-node b (create-list-of-converted-nodes (:children b))))) [:ul] fs) much much easier than I thought it would be, thanks for hinting me to do it right :-)
14:32justin_smithsveri: np, glad you figured out the right way to do it
14:38AeroNotixanyone got any ideas why I can't compile on ubuntu when the versions are the exact same as my archlinux box?
14:38AeroNotixscroll back has more details.
14:38RaynesI can't scroll back that far
14:38justin_smithAeroNotix: did you use lein install for any of your deps? Just a random thought.
14:39AeroNotixhmm, don't think so
14:39RaynesI'd blow away the local maven repo anyways.
14:39RaynesJust for giggles
14:39AeroNotix:(
14:39AeroNotixok
14:39justin_smithinstead of blow-away you can just temporarily move it
14:39RaynesIt'll be okay, man.
14:39justin_smithand then put it back later if you sort things out
14:39RaynesI suppose
14:39RaynesThere isn't a ton of risk in blowing it away though
14:40RaynesIf you can't get back the way you were before automatically, probably best you realize now.
14:43AeroNotixsame difference
14:43AeroNotixit's complaining it cannot find a class which is part of gen-class/gen-interface
14:43AeroNotixon one box, this works from a clean .m2/repository and blown target
14:44AeroNotixthe other it does not and complains about one of the generated classes being missing
14:44AeroNotixall versions match 1:1
15:02daniel___compojure started serving a load of random nonsense at / https://gist.githubusercontent.com/danielstockton/cbd13a38308f2cf6eb88/raw/d9c6c1f2ed97078d8a0e3433371a1a1e4888576a/gistfile1.txt
15:02daniel___i have no idea where this html is coming from
15:03{blake}Clojurescript?
15:03daniel___anyone had similar problems? i have a (route/resources "/") route and later a (GET "/*" (page)) catch-all to serve an index.html under resources/
15:03daniel___if i visit /dfasdsads (for example), it serves the real index.html page
15:04daniel___{blake}: yes, trying to serve a cljs app
15:04daniel___something is generating this html and i have no idea what
15:04{blake}daniel___: Those look like includes needed for Clojurescript, is all.
15:04{blake}Did it start suddenly?
15:05daniel___yep, seemingly randomly
15:05{blake}Did you possibly upgrade your Clojurescript?
15:05daniel___i can't pinpoint a particular change, i didnt upgrade at the moment it switched but i was playing with lein clean and clean-targets
15:06daniel___so it may have removed some old files
15:06daniel___im thinking if it was a cljs upgrade, someone else would have had the same issue
15:06{blake}daniel___: Yeah, probably. I'm just noticing all that "random nonsense" are includes for google closure files.
15:07{blake}daniel___: So it seems to me that something in your toolchain thinks you need those on your pages.
15:07daniel___{blake}: if i had to guess, i'd say it was something figwheel related
15:07{blake}Oh! Did you try running without figwheel, then?
15:12daniel___i tried to skip it, didnt seem to make a difference, im not sure if i removed everything necessary
15:12daniel___anyway, don't worry, i'll work it out eventually
15:12daniel___just thought it might be familiar to someone
15:13{blake}daniel___: Good luck. Nah, it just looks like some of the stuff that cljs auto-loads to me.
15:15dnolendaniel___: this is how Google Closure has always worked, it writes script tags to the document on demand when in dev mode. Including a browser REPL would cause all those deps to get loaded onto the page.
15:15dnolendaniel___: if you haven't gone through the new ClojureScript quick start now is a good time.
15:17daniel___dnolen: trouble is, i don't know where this html is coming from, seems to be something in my toolchain
15:17daniel___its not the index.html im trying to serve
15:17dnolendaniel___: are you saying that's the actual response from the server?
15:18dnolenif so I don't really see how that's possible
15:18dnolenbut if you inspecting the DOM and it looks like that, then someone is loading browser REPL
15:19daniel___no but this is https://gist.github.com/danielstockton/cbd13a38308f2cf6eb88
15:19daniel___i've tried grepping my project for secretary.js, it's nowhere
15:20daniel___all the other closure stuff seems to be loaded by the goog.require secretary.core
15:20dnolendaniel___: but what are you using? Chestnut?
15:20dnoleni.e. something that implicitly loads secretary
15:20daniel___yeah, tried to copy it
15:20daniel___it does?
15:21AeroNotixdaniel___: show project.clj
15:21daniel___its an older project, generated from chestnut a long time ago
15:21daniel___and i've tried to keep it up to date
15:21dnolendaniel___: maybe, I don't know I haven't tried Chestnut in a long while
15:22daniel___added my project.clj AeroNotix https://gist.github.com/danielstockton/cbd13a38308f2cf6eb88
15:23AeroNotixdaniel___: secretary is in the dependencies
15:24daniel___yep, im using it in my client side app
15:24AeroNotixso you're using it..
15:24daniel___but before it was just doing a goog.require("app")
15:24daniel___i don't know where the secretary stuff crept into the server response
15:25daniel___i strongly suspect figwheel or something else is loading its own routes somewhere
15:26daniel___ill study the latest chestnut output and see if anything seems off
15:34daniel___i noticed there was a mismatch in figwheel and figwheel-sidecar versions
15:34daniel___made them the same, now i get this curious error on lein run https://gist.github.com/danielstockton/dff66055ed47f955e451
15:35daniel___anyway, more and more convinced figwheel is the problem
15:36daniel___oh well, my fault for using versions so close to the edge
15:39dnolendaniel___: I didn't any in figwheel related to secretary but I may have missed it
15:39dnolens/any/see anything
15:46om``is there a way to change the type hint of a dynamic var from another ns with bindings/redefs?
15:48daniel___not to worry dnolen, thanks
15:48om``i am trying to rebind clojure.data.generators/*rnd* to org.apache.commons.math3.random.MersenneTwister
15:48daniel___its pretty strange but ill work it out
15:54AeroNotixom: why do you need to change the type hint?
15:54AeroNotixom: if you really need you could subclass it
15:55gfredericksom: yeah I don't think there should be any need to change the typehint for that kind of use case
15:56omAeroNotix: because if I do a binding on gen/*rnd* I get a cannot be cast to java.util.Random
15:56gfredericksif MersenneTwister is not a Random you probably can't use it at all; type hinting won't help
15:57gfredericksI don't know the details of data.generators enough to say for sure
15:57AeroNotixom: subclass it then
15:57gfredericksom: are you having issues with the default RNG that prompted you to try this?
15:58omgfredericks: I see what you mean, but the point is that org.apache.commons.math3.random.RandomGenerator copies the java.util.Random interface
15:58omall methods invocation are the same
15:58AeroNotixom: the same interface but this is not expressed in code
15:58AeroNotixit doesn't subclass or implement any java interfaces
15:58AeroNotixso in the type system, it isn't a java.util.Random
15:59gfredericksom: you'd have to recompile data.generators to take advantage of coincidental names
15:59omAeroNotix: sure it doesn't ; but the methods are identical .nextInt, .nextDouble etc
15:59AeroNotixom: doesn't matter
15:59gfredericksand would have to modify any other ^Random type hints throughout the data.generators code
15:59AeroNotixthose are just names
16:00gfrederickson the jvm a method name includes the type it's defined on
16:00justin_smithom: the jvm does not do duck typing
16:00AeroNotixom: first: why do you need this different randomness source?
16:00omso in fact, at the moment, I simply rewrote most of data.generators, with just no ^Random type hint in front of *rnd* and it works
16:00justin_smithom: why not reify Random with calls to youre preferred generator?
16:01gfredericksthat can work if there is no ^Random anywhere else in that code
16:01omjustin_smith: oh, good idea
16:01AeroNotixthis is what I meant with subclass :(
16:01omgfrederiks: exactly
16:01gfredericksjustin_smith: om: I think you have to use proxy instead of reify
16:01gfredericksRandom is a class, not an interface
16:01justin_smithAeroNotix: I thought I was defending your point :)
16:01AeroNotixjustin_smith: I know I know
16:02omAeroNotix: I missed that point of yours, sorry
16:02AeroNotixI should've just made it clearer with proper pointers to reify/proxy
16:02omso it was welcome to say it twice :)
16:02omcool
16:02justin_smithgfredericks: weird, so random what is or isn't an interface, huh :)
16:02gfredericksom: I'm still interested in what prompted you to switch RNGs
16:03omand the reason why I need it, are the other methods in commons.math3.random
16:03gfredericksjustin_smith: OOP across the generations
16:03justin_smithgfredericks: with random mutations
16:03justin_smithrandom
16:03AeroNotixthe type hint on there seems a bit weird
16:04gfredericksom: what sort of methods?
16:04gfredericksjustin_smith: looks like commons just copypasta'd it into an interface: https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/random/RandomGenerator.html
16:04omgfredericks: distribution related
16:04omno need to reimplement
16:04gfredericksom: btw have you tried test.check?
16:05omgfredericks: exactly
16:05gfrederickshuh?
16:05gfredericksoh the earlier thing
16:05omgfredericks: I do use it; but what do you mean?
16:06gfredericksoh wait
16:06gfredericksdata.generators is not test.generative
16:06gfredericksom: is this for testing or something else?
16:06om:)
16:06omno this is for statistical modelling
16:06gfredericksoh okay neverminds then
16:08omI will try with reify (seems more a fit than proxying in this case, isn't it?)
16:08omthanks
16:09gfredericksom: no if you use the builtin data.generators you need proxy
16:10gfredericksbecause you have to subclass, since java.util.Random is a class rather than an interface
16:10gfredericksif you use a modified data.generators with the commons interface then reify is fine
16:11gfredericksokay everybodies here's a good library question
16:11gfredericksI wrote this testing helper function in a client library for stubbing the client
16:12gfredericks(with-stubbed-foo data-to-stub-with & body)
16:12gfredericksthen a user accidentally calls it without the first arg: (with-stubbed-foo (do stuff))
16:12omgfredericks: oh, right, I see your point, thanks
16:12gfrederickssince the macro is variadic it doesn't notice, and tries to eval (do stuff) in order to setup the stubbing function
16:13gfredericksconsequently running the body in an entirely unstubbed environment; confusion ensues
16:13justin_smithgfredericks: what about checking if the first arg is associative?
16:13gfredericksjustin_smith: well it might not be a literal
16:13gfredericksand then you still have to eval it to check
16:13justin_smithahh, and the macro can't check that
16:13justin_smithright
16:13gfredericksso should the lib guard against this mistake? and is the best way by doing a pre-stub to a throwing function?
16:15justin_smithgfredericks: an ugly way would be (defmacro with-stubbed-foo [data first-element-of-body & other-elements-of-body] ...)
16:15gfredericksdoesn't catch mistakes with longer bodies
16:15justin_smithright
16:38AeroNotixgah i still can't figure this compilation issue out
16:38AeroNotixI wonder what is different about the environments..
16:40AeroNotixmaybe hiredman would know.
16:40bhurlowHi Clojure people
16:42bhurlowHey everyone, I have a question about how to handle work queues. What tools are you guys using to deal with large "piles" of work that needs to be done concurrently?
16:43AeroNotixbhurlow: kind of a big and broad question
16:43AeroNotixwhat kinds of work?
16:44bhurlowto be more specific, I have an incoming stream of urls that need to be scraped, associated with images, etc. We want to do as much work as possible in a given time but maintain some sort of concurrency limit so our program doesn't explode
16:45AeroNotixbhurlow: can you drop work or do you want to make sure you complete all work?
16:45bhurlowwork must be completed
16:45bhurlowcan't drop jobs
16:45AeroNotixbhurlow: make a channel with a max size and spawn N workers to read off that queue
16:46bhurlow@AeroNotix how does that differ from pmap?
16:46AeroNotixbhurlow: can you set the number of concurrent works with pmap?
16:47AeroNotixworkers*
16:47puredangerno
16:47AeroNotixso there you go
16:47AeroNotixthat's why
16:47danneuthink youre socrates dude?
16:48bhurlow<AeroNotix> interesting thanks. how would go about "spawning" works in different threads?
16:48bhurlowdoes core.async spawn those for you?
16:48AeroNotixbhurlow: depends if you want to use threads or go blocks
16:48AeroNotixdanneu: wut
16:48AeroNotixgo blocks shouldn't do io
16:49puredangerfor chunky work, pmap works in some cases
16:49puredangerbut otherwise, you can drop down to Java ExecutorService stuff
16:50puredangeror there are a few libraries out there that wrap that up in a Clojure way if you like
16:50bhurlowthis is mostly io stuff. shelling out work to image cutting processes etc
16:50puredangerso you might also look at the pipeline-* fns in core.async for that
16:50bhurlow<puredanger> what are some of those wrapping libs?
16:51puredangerI think claypoole is one
16:51puredangerhttps://github.com/TheClimateCorporation/claypoole
16:52puredangerI think there are others, but can't recall them off the top of my head
16:53bhurlowmany thanks!
16:54puredangerwhole chapter on this in the I-wish-it-was-out-now Clojure Applied https://pragprog.com/book/vmclojeco/clojure-applied (+ reducers and some other stuff)
16:58gfredericksoh hey om:
16:58gfredericksdid you see https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/random/RandomAdaptor.html
16:58gfredericksso that you don't have to do your own proxy
17:56{blake}OK, [B to something clojure.data.csv can parse... I'm turning it into a string with "(apply str (map char my-data))". It could get rather big, though.
17:56AeroNotix{blake}: (String. byte-array)
17:58{blake}(inc AeroNotix)
17:58lazybot⇒ 9
17:58{blake}AeroNotix: Thank ye.
17:58AeroNotixnw
17:59justin_smith,(String. (.getBytes (String. (.getBytes "hello"))))
17:59clojurebot"hello"
19:04cflemingAeroNotix: did you get that problem sorted out?
19:13AeroNotixcfleming: no, I posted to the mailing list
19:14AeroNotixcfleming: basically now my problem is that my code will compile on one machine, but not on another which has the same versions of everything relevant.
19:14amalloy(defn id::String->String [s] (String. (.getBytes s)))
19:15gfrederickswhazzat amalloy?
19:16amalloygfredericks: justin_smith was doing it by hand, i thought he could use a function definition to reuse
19:16gfredericksdoing what by hand?
19:17amalloygfredericks: (String. (.getBytes (String. (.getBytes "hello"))))
19:17amalloythe code cries out to be DRYed
19:18gfredericksI see I was hoping id::String->String was a new static typing lib you had just conceived of
19:18amalloygfredericks: i was just going to call it identity, but it's not really because it's specialized for String
19:18aperiodicamalloy: bah, let the compiler DRY it out
19:19amalloyso i figured it would be dishonest to use that name, and therefore the only honest name would include a type declaration
19:19cflemingAeroNotix: Interesting - so is this related to the problem that IntelliJ couldn't see your classes? Sorry, I haven't had time to read all the chat history
19:21AeroNotixcfleming: no that was earlier in the day
19:21AeroNotixI fixed that by just removing config for intellij
19:21AeroNotixseems that it likes to cache jars/libraries
19:21AeroNotixdunno why
19:22cflemingAeroNotix: Hmm, that's strange. What can happen is that its indexes get in a funky state from time to time.
19:22cflemingAeroNotix: The first thing to try to rule that out is File->Invalidate Caches and Restart which will rebuild them
19:28AeroNotixcfleming: yupp, since learned this option
19:28AeroNotixthanks
20:11justin_smithhaha
21:18gfredericksjust made a lein task for benchmarking a lein task https://github.com/gfredericks/corncob-cigar#benchmark-task
21:23xemdetiaso how well does itself fare against itself
21:37gfredericksum
21:39gfrederickshttps://www.refheap.com/98291
21:53bjarnhi - possibly a silly question here. is it possible to destructure a ratio into its quotient and remainder?
21:53gfredericksnope
21:54bjarndidn't think so
21:54bjarnone can dream
21:54gfredericksone can
21:54bjarnthanks
21:54gfredericksnp
21:54justin_smithhmm, what about methods to get the quotient and remainder?
21:54justin_smith,(bean (/ 7 5))
21:54bjarnyeah - i will use those
21:54clojurebot{:class clojure.lang.Ratio}
21:55bjarni was thinking more like: (let [[q r] (/ 43870 3600)] (dostuff...))
21:55justin_smith(.numerator (/ 7 5))
21:55justin_smith,(.numerator (/ 14 10))
21:55clojurebot7
21:56justin_smith,(.denominator (/ 14 10))
21:56clojurebot5
21:56justin_smithcool beans
21:56gfredericks,(let [[q r] ((juxt quot rem) 43870 3600)] (prn [q r]))
21:56clojurebot[12 670]\n
21:56justin_smiththat could be simplified though
21:57bjarn...awesome
21:58gfredericks,(def jqr (juxt quot rem))
21:58clojurebot#'sandbox/jqr
21:58gfredericks,(let [[q r] (jqr 43870 3600)] [q r])
21:58clojurebot[12 670]
21:58amalloyif only ISeqable were a protocol, we could do such disastrous things
21:59justin_smith,(def jnd #(vector (.numerator %) (.denominator %)))
21:59clojurebot#'sandbox/jnd
21:59amalloy(extend-protocol ISeqable clojure.lang.Ratio (seq [this] (seq ((numerator denominator) this))))
22:00justin_smith,(let [[q r] (jnd 43870 3600)] (prn [q r]))
22:00clojurebot#error{:cause "Wrong number of args (2) passed to: sandbox/jnd", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: sandbox/jnd", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval194 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java"...
22:00justin_smitherp
22:00justin_smith,(let [[q r] (jnd (/ 43870 3600))] (prn [q r]))
22:00clojurebot[4387 360]\n
22:00amalloyoh my. #error must be new in 1.7 as well
22:00justin_smithyeah
22:03cflemingamalloy: Yeah, #object and #error are new
22:03justin_smith,(Object.)
22:03clojurebot#object[java.lang.Object "java.lang.Object@76c6415a"]
22:04amalloyi heard about #object
22:04amalloybut i don't follow the mailing list anymore, so i only hear about stuff when it shows up in clojurebot
22:04cflemingIs clojurebot built from head? I didn't think these changes had made it into a release yet.
22:04amalloyyes, clojurebot is updated early and often
22:04amalloywell. clojurebot itself runs on a quite old version of clojure last i checked
22:05amalloybut the sandbox he uses to run user code is bleeding edge
22:05cflemingAh, I see
22:10gfredericksbleeedge
22:11gfredericksso this means that pr-str on arbitrary anything will pretty much always give you something entirely readable
22:12justin_smith,(read-string (pr-str (Object.)))
22:12clojurebot#error{:cause "No reader function for tag object", :via [{:type java.lang.RuntimeException, :message "No reader function for tag object", :at [clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180]}], :trace [[clojure.lang.LispReader$CtorReader readTagged "LispReader.java" 1180] [clojure.lang.LispReader$CtorReader invoke "LispReader.java" 1164] [clojure.lang.LispReader$DispatchReade...
22:12gfredericksactually that sort of solves a problem I've had with json serialization from libs
22:12justin_smith,(read-string (str (Object.)))
22:12clojurebotjava.lang.Object
22:12justin_smithgfredericks: it's the opposite
22:12justin_smithpr-str of it can't be read, str of it can
22:12justin_smithwhich I think is odd
22:12gfredericksjustin_smith: you know what I mean
22:12justin_smithdo I?
22:12gfredericks&(str (Object.))
22:12lazybot⇒ "java.lang.Object@52bdc73e"
22:12gfredericks^ that's readable by accident
22:13justin_smithI was actually confused
22:13justin_smithOK
22:13gfredericksI'm not saying it's readable by default
22:13gfredericksbut if you set up your data readers like a boss
22:13justin_smithahh, right, that could be done
22:13gfrederickssee my issue is in a logging lib I want to serialize arbitrary objects to json
22:14gfredericksand I don't want to accomplish this by globally extending the json lib
22:14gfredericksoh wait
22:14gfredericks,+
22:14clojurebot#object[clojure.core$_PLUS_ "clojure.core$_PLUS_@40a6d7d4"]
22:14gfredericksoh hey look at that
22:15justin_smithso it's just like the new syntax for unreadable things then?
22:15gfredericksyeah
22:15gfredericksbut now what I can do in the logging lib
22:15gfredericksis round-trip the thing through edn
22:15gfredericksand read #object into a special type
22:16gfredericksthis might still be terrible
22:16gfredericksbut it's an option
22:16justin_smith~gfredericks
22:16clojurebotgfredericks is a menace to bots everywhere
22:16alvin`;q
22:17alvin`oops, disregard
22:17justin_smithI thought maybe that was a "licking my nose" emoticon. Not that I know what that would mean.
22:18gfredericksin any case I feel like this opens up new options for tooling
22:18gfredericksyou could do this yourself before by doing print-method on Object and Throwable but libs can't really do that
22:22cflemingYeah, this is intended in conjunction with the new network REPL
22:23justin_smithnew network repl?
22:23cflemingSo that I guess pretty much everything will be readable, you just won't get back what you put in
22:23gfrederickscfleming: are the two changes orthogonal?
22:23gfredericksdoes the network repl need readability for some reason?
22:24gfredericksjustin_smith: geez man don't you sit around waiting for clojure-dev emails like the rest of us?
22:24TEttingerheh, I'm not sure what this network repl is either
22:24justin_smithgfredericks: it appears I am outside of that loop
22:24justin_smithhaha
22:25gfredericksthis is big man; rhickey himself even came into irc just to ping cfleming
22:25cfleminghttps://groups.google.com/d/topic/clojure-dev/Dl3Stw5iRVA/discussion
22:25gfredericksthings that haven't been seen since the days of what was the last big change he came in here to talk about
22:25justin_smithgfredericks: oh, I did not see that
22:25gfredericks$seen rhickey
22:25lazybotrhickey was last seen quittingQuit: rhickey 1 day and 2 hours ago.
22:26justin_smithI was here, I guess I did not read that part of my scrollback closely
22:26gfrederickscfleming: I thought his point about a separate RPC socket was interesting
22:27gfredericksI wonder if that's any more palatable to nrepl-haters
22:28gfrederickssuch a thing would probably just be nrepl-lite eh?
22:29cflemingYeah, I think so
22:30cflemingI'm not sure if by doing that you just get the worst of both worlds
22:30gfrederickswhich really just means removing middleware
22:30cflemingYup
22:30gfrederickswhich in a sense you can do with nrepl already
22:30gfredericksby using minimal middleware
22:30gfredericks(since everything is middleware)
22:30cflemingI'd be interested to know what the load-file problems people have are, but I've never had enough detail to figure that out
22:31cflemingThe separate RPC socket is an interesting one, but you still have to be really careful that nothing you call ever writes to out or err, otherwise reading gets screwed up
22:31cflemingYou still need something like interruptible-eval
22:32cflemingI suspect that most people, if they use this at all, will end up re-inventing something like that
22:33cfleminggfredericks:
22:33cflemingOops
22:33cflemingFat finger
22:33cfleminggfredericks: To answer your earlier question, I think they're mostly orthogonal, but the new reader part makes the RPC REPL connection much easier
22:34gfredericksthe 2-socket thing?
22:34cflemingWell, in general, layering an RPC over a straight REPL socket
22:35vermaholy shit I feel dumb reading that exchange
22:35cflemingIt would be the same for a machine-to-machine connection
22:35cflemingAnything where you have to be able to eval a form, and read the result back reliably
22:36gfredericksit's always a string at a lower level though, right?
22:36cflemingRight.
22:36gfredericksI'm not seeing what functionality is missing if you pretend everything returns a string, like nrepl does
22:37cflemingWell, in Cursive people like to have their REPL output syntax highlighted. If they return a data structure containing some unreadable form, things blow up when I try to read it so that I can pretty-print it.
22:38cflemingCurrently, I deal with that by using Cursive's lexer rather than (read), and the lexer handles #<> forms
22:38cflemingThat step wouldn't be required with the new functionality
22:39gfredericksokay gotcha
22:39cflemingSo what gets sent back is a string, but for a lot of things you want to be able to read it on the client side
22:39gfredericksI wonder if there are a few stray print-methods that still use #<>
22:39gfredericks,(future)
22:39clojurebot#error{:cause "no threads please", :via [{:type java.lang.SecurityException, :message "no threads please", :at [clojurebot.sandbox$enable_security_manager$fn__857 invoke "sandbox.clj" 94]}], :trace [[clojurebot.sandbox$enable_security_manager$fn__857 invoke "sandbox.clj" 94] [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkAccess nil -1] [java.lang.ThreadGroup checkAccess "Th...
22:39cflemingHaha
22:39cflemingUmmm
22:39gfredericks,(atom)
22:39clojurebot#error{:cause "Wrong number of args (0) passed to: core/atom", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (0) passed to: core/atom", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.RestFn invoke "RestFn.java" 399] [sandbox$eval51 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.jav...
22:39mfikescfleming: The only odd things I ran into for Ambly I/O was async printing (instead of REPL, RPPEPPLPP), and a desire to read a little bit from the user at the very beginning of the REPL life to get input from the user to configure the REPL (which is arguably very odd).
22:39gfredericks,(atom 3)
22:39clojurebot#<Atom@51bb91c2: 3>
22:39cfleming,(uuid)
22:40clojurebot#error{:cause "Unable to resolve symbol: uuid in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: uuid in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: uuid in this context", :at [clojur...
22:40gfredericks^ see the atom up there :)
22:40gfredericks,(java.util.UUID/randomUUID)
22:40clojurebot#uuid "a9011b33-fa03-4924-b894-de715a1e31d7"
22:40gfredericks^ no reason for that to do anything different
22:41cflemingmfikes: Yeah - if you try to separate the exchange into RPC and I/O, you get all sorts of interleaving issues
22:41cflemingmfikes: I definitely want to fix the need-input thing, but it's tricky from a UI perspective and the bang for the buck has been low since no-one seems to use it
22:41mfikescfleming: Yeah, I read the Group thread. It rasied a lot of interesting ideas IMHO.
22:42cfleminggfredericks: Right, duh, UUID was a bad example :)
22:43cflemingmfikes: Definitely. It's a hard problem. I don't think there's one perfect solution, the problem is gracefully supporting a sliding scale from full streaming to full RPC depending on need.
22:43gfredericks,(with-local-vars [x 12] x)
22:43clojurebot#<Var: --unnamed-->
22:43mfikescfleming: The only place Ambly needs to read input is the "Choice: 1" line in the example at https://github.com/omcljs/ambly (arguably very strange for a REPL to be doing stuff like that)
22:44mfikescfleming: By example, I mean this section: https://github.com/omcljs/ambly#repl
22:44cflemingmfikes: Yeah, I see
22:45mfikescfleming: IMHO, that is so weird, it shuldn't drive design. But, it _is_ an example, where I wanted to read. In Cursive, you could see that even popping up graphical UI instead. Dunno.
22:45cflemingmfikes: It's hard to support in Cursive because IntelliJ editors are "strongly typed". So to get the good functionality when it's being used in the 99.99% case the REPL editor is a Clojure editor. The best solution is probably a popup, right.
22:46cflemingmfikes: Or I might be able to swap out the Swing component briefly and replace it with a text one, but that might be very confusing.
22:46cflemingmfikes: The problem with the popup is that it'll be really annoying if someone ever does implement a text adventure in a REPL
22:46mfikescfleming: I have a workaround. I just configure the REPL to choose the first device. https://github.com/omcljs/ambly/wiki/REPL-in-Cursive
22:47cflemingmfikes: I see, nice.
22:47cflemingmfikes: Well, a little ugly, but a nice workaround - sorry about the need for that :)
22:47mfikescfleming: I'm not really asking you to consider popping up graphics for a REPL. That would be even stranger. :) Ambly could perhaps pop up some funky swing dialog of its own if it really needed to.
22:48cflemingmfikes: Well, I'm going to have to do something sooner or later, I just haven't figured out what yet
22:48mfikescfleming: All of that stuff isn't "well baked" anyway. It is just an example where I hit a wall where I wanted to read and found that I couldn't when in Cursive.
22:50mfikescfleming: For a simple example, start up `lein repl` and then evaluate (read-line). Type some text. If you do the same in Cursive, it illustrates the thing I ran into.
22:54mfikescfleming: FWIW, I really like the Cursive REPL in that you can edit your form in the little editor at the bottom before sending it for evaluation. It is more complex than "R" in "REPL", but it is nice IMHO.
22:56cflemingmfikes: Yeah, it's easy to provoke the problem, but I'm actually surprised how few people that's a problem for.
22:57cflemingmfikes: Yeah, I like it too. A few people used to a more traditional REPL find it strange, and it has this sort of limitation, but it's nice for editing Clojure which is what you mostly want to do.
22:57cflemingmfikes: I would say it's an 80/20 win but in practice it's more like a 99.99/0.01 win
22:57mfikescfleming: I even find `rlwrap` unsatisfying :)
22:58cflemingmfikes: Hehe, no doubt
22:58cflemingmfikes: I'm actually working right now on REPL refactoring, so hopefully I'll be working on CLJS REPLs within a week or so
22:59mfikescfleming: Cool :) I am now in a position to at least not be speaking utter nonsense on the subject :)
22:59cflemingmfikes: I suspect that's been the case for a while :)
22:59cflemingmfikes: Are you planning on going to Clojure/West?
23:00mfikescfleming: It was only half a year ago when you pointed me to Weasel I think :)
23:00mfikescfleming: No... I should have made it to the one here in D.C. when I had the chance :( ... son's birthday was then.
23:01cflemingmfikes: Yeah, I remember you said. Next time perhaps!
23:01mfikescfleming: Like REPLs, conjs loop too :)
23:01crazydiamondHi. What's format is preferable to store huge pieces of data, (that Clojure programs must read) — EDN or JSON, or...?
23:02crazydiamondI have 83Mb of EDN, and (load-file...) doesn't seem to be able to read it
23:02cflemingmfikes: Unfortunately the latency from NZ is high - the Washington trip was quite a beating. Not sure I'll do that one again.
23:02crazydiamondgot "CompilerException java.lang.OutOfMemoryError: Java heap space"
23:04mfikescfleming: I'll come down to NZ :)
23:04gfrederickscrazydiamond: have you increased your jvm's heap size?
23:05crazydiamondno... what I'm doing just "smells like" wrong way
23:05cflemingmfikes: That sounds like an excellent plan. Or you could organise a vacation to coincide with EuroClojure :)
23:05amalloy83MB probably expands into a fairly large object
23:06crazydiamondmay be JSON is better?
23:06crazydiamondor XML?
23:06amalloythe notation doesn't matter; it's the object you're expandning it into that i speculate could be large
23:07crazydiamondyep... so it's wrong way
23:07crazydiamondi.e. I shouldn't store it like this
23:07vermacfleming: +1 for all the awesome cursive work, I've never really used IDEs before but Cursive has been a real treat so far :)
23:07crazydiamondbut I don't know how I should
23:07cflemingcrazydiamond: Depending on how you need to process it, XML or JSON would give you better options to treat the data in a streaming way if you can
23:08cflemingcrazydiamond: If you need all your data in memory, amalloy is right, it doesn't matter how you store it.
23:08cflemingverma: Thanks! Glad you're enjoying it!
23:08crazydiamondyep, my data is like collection, i.e. it's natural language dictionary (stream of about 30000 articles)
23:09crazydiamondso I need to select few random ones now
23:10vermacfleming: very much so :) .. I was a little worried about the CLJS support, but it seems to be no problem at all, looking forward to your CLJS work :)
23:10vermaCLJS repl*
23:10cflemingverma: Yeah, I'm hoping that will be soon (couple of weeks)
23:10crazydiamondwell thanks for answering all, I probably need just database
23:11vermacfleming: nice!
23:11cflemingcrazydiamond: Do you need to have all your data in memory?
23:12cflemingcrazydiamond: Or can you process items one by one?
23:15crazydiamondcfleming, one by one - for now, and in next stages - don't know yet. Items are relatively loosely connected with each other
23:17cflemingcrazydiamond: Check out https://github.com/FasterXML/jackson, which will allow you to perform streaming processing on JSON documents. I don't know if any of the Clojure JSON libs expose that functionality, but you could always use interop.
23:17cflemingcrazydiamond: Any of the standard Java streaming XML technologies (STAX, for example) will allow you to do the same.
23:18crazydiamondcfleming, thanks!
23:19crazydiamondIn the future I'll probably move to Datomic with proper indexing setup
23:19cflemingcrazydiamond: That's probably your best solution, yeah