#clojure logs

2015-12-26

00:02ben_vulpeswhat would be the expedient way to jam a whole bunch of repeating flags for a list of unknown length into a clojure.java.shell/sh command?
00:03justin_smithben_vulpes: like some kind of interleave of the list and the flags?
00:04devtrope(apply sh [the arg s])?
00:04ben_vulpespretty much. repeating (sh "the-call" (repeating "-flag" (item of list)))
00:04ben_vulpeshm
09:24irctcI have some java classes and I want to use from lein repl how to do it I am not sure how to tell repl about the classpath of the java classes
09:25justin_smithyou don't
09:25justin_smithlein sets up the classpath when it starts the repl
09:26justin_smithif the dep is in your project.clj, you are good to go
09:26irctcHow to include the classpath of my java classes in project.clj
09:27TimMcAre they in a jar that is published to the Central Repo or similar?
09:27justin_smithusually you would use maven to install the artifact to your local cache
09:27TimMcOr a standalone jar o your desktop?
09:27justin_smithor point at central
09:27justin_smithyeah
09:27TimMcOr random classfiles in a folder?
09:27irctcrandom class files in a folder
09:27TimMc(in ascending order of "this will suck")
09:28TimMcirctc: This is a good place to start: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj
09:29irctcI always have been hearing that you need jar to be published in a cental repo. Do I have any other choice with my only class files
09:30TimMcYou can use that to point your project at some classfiles, but they'll have to be in a directory structure matching their package names...
09:30justin_smithTimMc: did you intend to link to a specific line in the sample project.clj?
09:31TimMcnope
09:31justin_smithirctc: a jar is a convenient way to bundle class files. You can just add a specific folder to your classpath via project.clj
09:32TimMcHmm... I thought there was a way to add raw classpath entries.
09:32justin_smithyes, there is
09:32justin_smithTimMc: if nothing else, bot resource-paths and source-paths are just classpath entries
09:33TimMcah, right
09:33irctcNow how do I use or refer resource-paths and source-paths
09:33TimMcirctc: If this is something you want anyone else to ever use you'll need to get stuff bundled into jars, and probably into a repo.
09:33justin_smithirctc: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L281
09:34TimMc*a maven repo
09:34justin_smithdefinitely true
09:34irctcok thanks TimMC Justin I will try that
09:46beakyhello
09:46beakyhow do i receive mail with clojure
09:46beakyand connect to a database
09:55TimMcbeaky: You would use a Java IMAP or POP library to talk to a mail server, and you would (probably) use JDBC to talk to the DB.
09:57TimMcbeaky: This small, crappy program I wrote a while back demonstrates connecting to IMAP: https://github.com/timmc/hashflash
10:23beakywow thanks tim
13:33TimMcbeaky: That should get you started, but be warned -- that code is written to get one job done, and not well. It's very fragile, and is specific to Google Mail.
13:45devtropeI think you can add a .lein-classpath file with additional classpaths on it to escape "everything must maven" in Lein.
13:46devtropeI've done that to support plugins that exist only in the project itself.
13:49devtropeEvidence: https://github.com/technomancy/leiningen/blob/054a77af6c24dcf79bffd6348421631599c33a5c/bin/lein-pkg#L58-L62
13:51devtropeNot sure how that works in, say, uberjar situations, so perhaps it's a dead end. Works for plugin stuff anyway.
14:31beakyhello
15:24lokien_Can we write GUI as easy as C# guys?
15:32j-pblokien_: yeah with cljs ;P
15:33lokien_j-pb: darn, didn't think of that. I have to finally learn it
15:36lokien_Anyway, is there anyone using BSD/Windows for development?
15:37j-pbBSD/Windows
15:37j-pbbsd as in freebsd?
15:38lokien_Yeah
15:39j-pbi've seen people use it on it :)
15:39j-pbbut not myself
15:39lokien_I hate working on Windows, so I'm planning to dual boot something (or buying a cheap laptop)
15:42Seyleriuslokien_: You're not alone in hating Windows.
15:42j-pbhey, is there a recommended redis lib out there? I've seen carmine, but that is really off-putting because of all the macros and weird api it has :)
15:43lokien_Seylerius: But I hate running things in Wine, so it's a lose-lose for me
15:44lokien_j-pb: If I don't use any java functions, is my program cljs compilable?
15:44j-pblokien_: no
15:44j-pbgenerally not
15:45j-pbsomewhat
15:45j-pbbut generally not
15:45j-pblokien_: you can reuse 99% of all code, but sometimes abstractions leak through on the jvm and on js
15:46lokien_j-pb: it's a 160 line program
15:46j-pbcore protocols between clojure and cljs are somewhat different, because cljs was rewritten from scratch and has a lot of cool new stuff
15:46j-pblokien_: it might be, however it will have a completely different execution story right
15:46j-pba program is often more than pure buissnes logic
15:47lokien_Clojure is obsolete then? :o
15:47j-pbno because it runs on the jvm ^^
15:47j-pbhowever you can see the influence cljs has on clojure
15:47lokien_I've heard that jvm is an old pile of crap
15:47j-pbof that domain logic you can probably reuse 99% minus the few percent that are a result of js and java having different datastructures
15:47j-pbfor example js has no ints
15:48j-pbonly a unified number type which is basically a double
15:48j-pblokien_: yes and no. Is it a pile of crap and old yeah
15:48j-pbis it the fastes vm around, probably too
15:48lokien_And glorious Clojure guarantees no overflows, right? Right?..
15:48fantazojvm is crap. like the whole java story. expendable programmers for the win, that's the story about it.
15:49lokien_fantazo: so, you're using arcadia?
15:50devtropeDon't confuse corporate java-shop pop-culture with the underlying technology.
15:50j-pblokien_: actually clojure will throw an error I think when an int overflows
15:50j-pbbut I think that is a java error actually
15:50j-pbyou need to use bignums explicitly
15:50fantazoclojure is basically the try to get a decent programming language with some integration running on that mess so that people who aren't braindead can program in it through the mess of what some "managers" (other word for stupid people) created in the first place.
15:51j-pbnah
15:51j-pbit's not that bad
15:51j-pba lot of java is horrid, but I don't think you will see clojure in those shops
15:51lokien_I wish Clojure was compilable to binary though
15:51devtropeAlas, if you want a job these days, it seems like you end up having to support and extend bad decisions people made 10 years ago: and not complain.
15:52j-pb*cough* working clojure full time ;P
15:52lokien_Or make a startup in lisp!
15:52j-pblokien_: I don't :D, it's fast enough and binary has it's own problem
15:52devtropeThere are options, of course. ;)
15:52lokien_j-pb: But people are afraid of my jars :(
15:52fantazopeople will always do bad decisions the point is to make an environment were you fail often and recover from it.
15:53j-pbexactly
15:53devtropeSomehow java-shop culture and Scrum are made for each other. If you're in that situation, reading blogs about cool Clojure or Haskell will kill you. ;)
15:53j-pbwhich brings me back to: "why is carmine's api so bad?"
15:53fantazoI'm totally disillusioned from "just use" lisp bullshit. you get your stuff working with whatever shit you now use.
15:54lokien_Good luck writing a game in brainfuck then
15:54fantazoand then be haunted by your decisions. this is life, it's supposed to suck.
15:55fantazolokien_, that's a challenge some people could say that they accept that.
15:55devtropej-pb: Fork this one (https://github.com/mmcgrana/clj-redis) and update it? I bet using interop would work just as well.
15:55lokien_fantazo, why you so sad, I bet you're smart and beautiful
15:56j-pbdevtrope: actually considering it
15:56devtropej-pb: I forked quiescent, updated some stuff, removed some deprecated stuff: it was kinda freeing.
15:57j-pbdevtrope: quiscent is a 200 lib library that consists mostly of function
15:57j-pbs/lib/line
15:57fantazolokien_, oh nice of you.
15:57lokien_fantazo: <3
15:58devtropej-pb: Right. I wanted to use Sablono with it, which required and update to a newer React, etc, etc.
15:58devtropej-pb: My forks is mainly a hedge against a, uh, quiescent Quiescent. ;)
15:58j-pbdevtrope: oooooorrrr you could use reagent and live on the happy side of the fence :)
15:59devtropeI thought about it.
16:00j-pbdoit, do it naow
16:00j-pba re-frame style architecture is super awesome
16:01devtropeToo late for this app.
16:01j-pbit's never too late
16:01j-pbI'm currently porting 20000 lines of rather horrid om to reagent
16:01devtropeYeah, single atom, messages update state, view is re-computed: I've done that before Om and in all things after. It is great.
16:02devtropeI'm not scared of a port, I just need to do other things, like finish the app.
16:02j-pbwell, as we discovered you can actually put a reagent atom into an om cursor
16:02j-pbso you can rework everything component by component
16:03devtropeWith Quiescent, you have a single atom at the top, but all components re-render only if their first parameter changes, and that first parameter is a regular value.
16:04devtropeI'm not sure it translates well to either Om or Reagent.
16:04j-pbyeah I know, I've used it before reagent
16:04j-pbas long as it can render react it can render a reagent component
16:04devtropeAnd there's Brutha. ;)
16:06devtropeI'll have to dedicate an hour to parse through the witty re-frame doc.
16:07j-pbyeah but it's an eye opener
16:08devtropeIt just describes the basic model I've always used, I think. Even with Om.
16:08j-pbthe re-frame doc is more like a blog post describing a architecture
18:15kenrestivoaha! at last someone figured out the cause of that maddening bug i was wrestling with: http://yogthos.net/posts/2015-12-26-AOTGotchas.html
18:28justin_smithif he'd used a shim, instead of :aot, none of this would have happened
22:00kenrestivothat's a great idea. hmm...
22:07kenrestivoa java shim not a c one
22:07justin_smithright, right
22:07justin_smiththe C thing was a non sequitor actually
22:07kenrestivoi like writing c, for some things. embedded microcontrollers, device drivers
22:13hlollihi justin, mery christmas
22:16hlolliAs shamefully bad amatur in version contorling, git and releasing. I made an experiment on my library, it's at [org.clojars.hlolli/panaeolus "0.2.0-RELEASE"] I bumped into few obvious pitfalls. Which is global user settings, and relative resource paths, in the generated .jar files. But the latter later. Is it possible to have global constants in defproject that can be seen and used by other .clj files under the source file-tree?
22:18justin_smithhlolli: project.clj is for lein, and for dev/compilation, not for run time concerns
22:20hlolliok, where should I put user settings regarding audio card sample rate etc?
22:25justin_smithhave them put an edn file on the classpath, and have your own as a fallback in the jar that you can merge their settings into.
22:25justin_smithor perhaps they could specify the location of the edn file in the args
22:26justin_smithhlolli: also, you could check out environ, it allows loading settings from the environment or system properties, but I think it has a thing where it can load a settings file too
22:30hlolliok, two new concepts that I will look into. Good, my christmas holidays consist of staring at computer screen, more to learn the better.
22:32hlolli`ah fak, lost internet and reconnected
22:32hlolli`but I assume I missed on nothing.
22:39devtropehlolli`: I really like the "resources/config.edn" file plan justin_smith mentioned. Easy to slurp and edn/read-string in.
22:39devtropehlolli`: You can even use a prismatic schema to validate it.
22:57hlolli`yes, Im actually reading now http://www.compoundtheory.com/clojure-edn-walkthrough/ prismatic schema, noted for study.