#clojure logs

2014-01-02

00:00marcopolo`http://bit.ly/1a2uY0C is the class I'm working with
00:00marcopolo`Like a factory, but for itself
00:01marcopolo`The method I'm talking about is getSocketFactory()
00:02marcopolo`Could I make a wrapper class that has a constructor which calls that method?
00:02marcopolo`Is there a way to subclass in clojure?
00:02TEttingerhttp://grepcode.com/file/repo1.maven.org/maven2/org.apache.httpcomponents/httpclient/4.1/org/apache/http/conn/ssl/SSLSocketFactory.java#SSLSocketFactory.%3Cinit%3E%28java.lang.String%2Cjava.security.KeyStore%2Cjava.lang.String%2Cjava.security.KeyStore%2Cjava.security.SecureRandom%2Corg.apache.http.conn.ssl.X509HostnameVerifier%29
00:02TEttingerit appears to have public constructors
00:02gtrakproxy can do it, genclass can do it.
00:02TEttingerjust not no-arg constructors
00:03TEttingermarcopolo`, yeah, subclassing is definitely possible with proxy and genclass, maybe reify
00:04gtrakreify no
00:04gtrakreify just handles clojure protocols and java interfaces
00:04marcopolo`TEttinger: ideally, I'd like to use to no-arg constructor.
00:05marcopolo`I can override the constructor with gen-class/proxy?
00:08TEttingerhttp://clojuredocs.org/clojure_core/clojure.core/gen-class yes with gen-class
00:08TEttingerthere's a :constructor section in there
00:11marcopolo`Thanks :)
00:19danlentzdevn: y by namespace is ok so im past that hurdle. no i am strugling to get lein-autodoc to work
00:20danlentzcmdline java-jar is fine
00:20danlentzlein autodoc -> Exception in thread "main" java.lang.NoClassDefFoundError: lancet/core$WsdlToDotnet (wrong name: lancet/core$wsdltodotnet)
00:20danlentzwhat the hell is a lancet?!
00:21mullrlancet |ˈlansit|
00:21mullrnoun
00:21mullr1 a small, broad, two-edged surgical knife or blade with a sharp point.
00:21mullr2 a lancet arch or window.
00:21mullr• [ as modifier ] shaped like a lancet arch: a lancet clock.
00:21danlentzand why does autodoc need it?
00:21danlentzit is certainly drawing blood :)
00:21mullrmy dictionary doesn't know the answer to that
00:22danlentzah hold on. lein autodoc is probably looking in ~/.m2
00:22danlentzfor the jar
00:22danlentzah.
00:22danlentztks sometimes it helps to just gripe and things become clear
00:22danlentz:)
02:00hydromethello, I'm a clojure newbie (and having a lot of fun getting to know it, using Light Table, and just recently purchased the O'Reilly book by Chas et al)
02:00TEttingerhy hydromet
02:01TEttinger*hi
02:01arrdemTEttinger: hipster
02:01hydrometI was listening yesterday to a presentation Rich gave several years ago to an audience of Java programmers and at one point Rich was describing macros
02:01hydromethello TEttinger!
02:02TEttingerarrdem: I did have a neckbeard before it was hip.
02:02arrdemTEttinger: I'm so sorry.
02:02hydrometRich at one point said that one of the beautiful things about macros is that they can be used to extend the language of Clojure itself, giving programmers the same power as Rich himself (since Rich created Clojure)
02:03hydrometHe also said this is a much better approach than having to beg and wait for Sun (this was before Sun was acquired by Oracle) to make changes to Java if someone wanted to extend Java
02:03bbloomarrdem: i also hate that, so annoying
02:03hydrometSo here's what I don't understand ...
02:03hydrometSince Clojure in and of itself is open source (Eclipse License), what would prevent someone from modifying Clojure regardless of using macros or otherwise?
02:04arrdemhydromet: modifying clojure to achieve what...
02:04TEttingerit's modifying in your code, rather than changing the compiler/reader
02:04arrdemhydromet: rebind a clojure.core symbol like +?
02:04arrdemhydromet: add a Haskell typechecker? gotta give us more to work with here
02:04hydrometwell Rich's point was that the power of macros is to syntactically change the language (I thought)
02:05arrdemeeeeh
02:05TEttingerhttps://github.com/technomancy/leiningen/blob/stable/project.clj#L4 here's an example. defproject isn't part of the language
02:05arrdemsince we don't have reader macros I would disagree. macros add syntactic sugar, they can't alter the syntax of the language.
02:05TEttingerit was added by the leiningen code, but otherwise acts like defn
02:05hydrometI just didn't quite understand why he, in the context of talking about macros, said something about having to beg and wait for Sun (Oracle) to make changes to Java
02:05arrdemhydromet: link to the talk?
02:06hydrometarrdem: sure, one moment, let me find it
02:06TEttingerhydromet, well if you change java, your changes won't be usable by end users
02:06TEttingeror rather, if you change the JVM
02:07hydrometarrdem: http://www.youtube.com/watch?v=P76Vbsk_3J0
02:07TEttingerwhich is what apparently would be needed to, say, add lambdas to java
02:08hydrometTEttinger: but if you use a macro to change itself in Clojure, that doesn't mean your macro becomes available to end users does it? Do you mean end users who run the program (using JRE only, no JDK etc.)?
02:08hydrometTEttinger: or do you mean available to the rest of the programming community?
02:09hydrometarrdem: I'll try to find the point in that video where he says that, one moment please
02:10hydrometarrdem: 1:13:00
02:10TEttingerno no, I mean, you could try to add defproject as a keyword to java, but it would take a change to the parser to have the java definition of defproject not try to evaluate the names inside. in clojure you can control what gets evaluated, like how if doesn't execute the branch that the condition doesn't lead to
02:10hydromet"what's beautiful about Clojure and Lisps ..."
02:11arrdemhydromet: mmkay hang on
02:11TEttingerhydromet, does that makes sense?
02:12TEttingerjava's ability to control what gets evaluated/compiled is limited
02:12TEttingerclojure has pretty much full control
02:13hydrometarrdem: Rich says at about 1:13:00 "What's beautiful about Clojure and Lisps, you at the same power that I have to write macros"
02:13hydrometarrdem: "You don't have to wait for me, I'm not Sun"
02:13hydrometbingo! Why does Rich say this "I'm not Sun"?
02:14arrdemhydromet: so... do you understand how macros interact with the compiler?
02:14TEttingerwhen people wanted changes to core java features, they needed to wait for sun/oracle to make changes
02:14hydrometI don't write Java and don't understand enough about Sun / Oracle. I thought they had some weird not fully transparent licensing issues which is why Larry Ellison and Google ended up in a big court battle over Android's Dalvik "clean room" Java systems etc. (ugh)
02:15arrdemTEttinger: choose. [1,3] or [4,6]
02:15Ember-Sun Microsystems was aquired by Oracle few years back
02:15Ember-there is no Sun Microsystems anymore
02:15arrdemEmber-: not helping...
02:15TEttingerarrdem: [[LInteger
02:15arrdem1d2
02:15clojurebot2
02:15arrdemokay.
02:16arrdemTEttinger: he's yours.
02:16hydrometarrdem: so clearly I have a gap in my newbie understanding of how Clojure macros work and what if anything this has to do with open source licensing (comparing to Sun/Oracle Larry Ellison et al)
02:16TEttingerheh
02:16TEttingerhydromet, it has to do with this
02:16Ember-hydromet: opensource licensing and clojure macros have absolutely nothing to do with each other
02:16arrdemhydromet: you are taking Rich too literally when he talks about extending the language.
02:16hydrometEmber: thanks
02:16hydrometarrdem: ah!
02:16Cr8better phrasing
02:16Ember-macros are a language feature
02:17TEttingerjava is written in a lower-level language, I think mostly C++. you can't extend the compiler in java.
02:17Cr8you are able to *add functionality* that would *normally* require a change to the language
02:17TEttingerclojure is mostly written in clojure
02:17Cr8without actually *having* to change the language
02:17arrdemhydromet: macros are a compiler structure which allow a programmer to express some operation in terms of compile time code generation not built into the language core
02:17Ember-clojure macros are comparable to C macros but they are way more powerful
02:17TEttingernot all, some parts are java or javascript (for cljs)
02:17hydrometTEttinger: that makes sense (not being able to extend the Java compiler, itself written in C++)
02:17TEttingerright, but macros go one step further
02:18Ember-the main difference between clojure macros and other clojure code is that clojure macros are executed on compile time
02:18TEttingerthey expose the ability to change the compiler to code
02:18Ember-that results the macro code being replaced by the outcome of that macro code being executed and spitting clojure code out
02:18Ember-thus the final clojure source code "file" which is compiled to .class files is different than what is sitting on your hard drive
02:18TEttingeryep
02:19Ember-this allows you to do stuff not otherwise possible
02:19hydrometEmber: I thought I heard Rich say (in that same presentation that I gave the link to) that Clojure macros should not be confused with simple C macros
02:19Ember-hydromet: indeed they shouldn't
02:19TEttingerthey should not.
02:19arrdemhydromet: yes you did hear that, and they should not be
02:19Ember-clojure macros are way way more powerful
02:19arrdemhydromet: C macros are simple textual replace operations
02:19hydrometC macros are essentially about text substitution at compile time, no?
02:19Cr8yep
02:20Cr8where as lispy macros are structural
02:20arrdemhydromet: Clojure and Lisp macros are full blown code execution for code generation
02:20Ember-with clojure macros you can modify clojure code on fly
02:20arrdemno no no you _WRITE_ code _WITH_ code
02:20hydrometClojure macros are programs that ask the compiler to transform itself (something like that)?
02:20Ember-in clojure code is data and data is code
02:21Ember-hydromet: macros are compile time execution rules
02:21hydrometEmber: this is definitely a foreign concept for me so I have to get my brain wrapped around it (I will definitely do so)
02:21Ember-clojure compiler works in two phases, first it executes the macros and then it compiles the resulting code into .class files
02:21arrdemOkay. Example?
02:21TEttingerhydromet, I wouldn't worry too much about macros at the new-user stage. 2 years in and I still haven't written (or needed to write) a defmacro. I anticipate I may soon.
02:21hydrometarrdem: I thought you were going to sleep? ;-)
02:22seriously_randomquestion about cons: http://pastebin.com/vriyG8ps
02:22Cr8,(clojure.walk/macroexpand-all '(-> 6 inc (/ 2)))
02:22clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
02:22arrdemhydromet: SOMEONE IS WRONG ON THE INTERNET
02:22Cr8aw
02:22Ember-and yesh, the first rule of the macro club is: you do not write macros
02:22Cr8&(clojure.walk/macroexpand-all '(-> 6 inc (/ 2)))
02:22Ember-:)
02:22lazybot⇒ (/ (inc 6) 2)
02:22Cr8no that guy is not here
02:22hydrometarrdem: huh?
02:22Cr8oh yes he is
02:22logic_progin clojurescript, how do I encode HTML encode strings? i.e. "<->" into a literal "<->", rather than be interpreted as a tag
02:22Ember-the main reason for this is the fact that macros get really confusing really fast if not used properly
02:23Ember-and most of the time just plain functions are a better solution
02:23oakwisednolen: am I wrong that om/build-all with a transforming :fn will always update all of the items because identity is changing? E.g. I've got a large list of titles that I want to live filter using a search input. The :fn does `(assoc item :hidden true)` when item is filtered out, which causes all hidden items to be updated at every update to the search input. Am I doing it wrong? Does the hidden attribute have to be part of the item's sta
02:23oakwisefor this to work correctly?
02:23hydrometTEttinger: Indeed, your suggestion of not needing to tackle macros as a newbie sounds wise, and in that video I think Rich mentioned that its probably not apt for a newcomer
02:23Ember-but when you really need macros then oh boy you're happy you are using clojure
02:23TEttingeryeah. to start with, hydromet, I'd recommend learning the core functional programming parts of the library: apply, map, reduce, filter.
02:23Ember-hydromet: I've so far written like 10 macros in total. Most of them just to fiddle around
02:23clojurebotIt's greek to me.
02:24Ember-one or two are actually in real production code
02:24TEttingeralso, 4clojure is excellent
02:24Ember-and at the same time I've written thousands of clojure functions
02:24Ember-just to give some perspective here
02:24hydrometEmber: and TEttinger: thanks so very much for helping to clear this up ... I guess I got kind of hung up on the part about macros and Rich saying he's not Sun (in the comparison with Java)
02:24TEttingerheh
02:25Ember-hydromet: no problem, that's the reason #clojure exists :)
02:25hydrometMy more recent programming has been in Ruby and I only briefly looked at Java in the late 1990s (before that it was Objective-C on NeXT machines)
02:25Ember-to help out fellow clojure programmers or those who want to become one
02:25TEttingerit's easy to get stuck on these talks, I have found myself confused by seemingly weird parts in a talk and I just can't think about the rest for a bit...
02:25hydrometThe Clojure community rocks!
02:26marcopolo`)
02:26hydrometThis is the most fun I've had learning a new program in a long time!
02:26TEttingeryep
02:26Ember-glad to have helped you out
02:26Ember-now I need more coffee
02:26TEttingerit's a very expressive language.
02:26hydrometThe first language I learned at the univ. was Fortran believe it or not (my background being geophysical sciences)
02:26TEttingerfortran 77?
02:26TEttingerI know there was a long gap without a new version
02:26hydrometSo to see Clojure has roots to Lisp and Lisp roots to McCarthy and McCarthy was around when Fortran was created, is all quite cool!
02:26arrdemthe only thing on earth faster than C....
02:27TEttingeris optimized C?
02:27marcopolo`is there a way to recompile classes within the repl?
02:27alewIt's very liberating to have macros. Sometimes you run into these code structure patterns that you can't really put into a function but feel like they could be abstracted away. That's usually when macros become really useful
02:27arrdemTEttinger: is F77
02:27TEttinger(doc compile)
02:27clojurebot"([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."
02:27hydrometTEttinger: I can't recall if it was Fortran 77 or not (forgot already!)
02:27arrdemhydromet: good. you don't want to be writing that stuff
02:28hydrometarrdem: believe it or not, a lot of hydrology and meteorology to this day in the year 2014 is still written and maintained in Fortran (like weather models)!
02:28marcopolo`thanks
02:28arrdemhydromet: I'm in the HPC community at $UNIVERSITY. Believe me I know how relivant f77 still is.
02:29arrdemhydromet: I just never want to have to write/debug it :P
02:29hydrometarrdem: very cool that you're in HPC
02:30hydrometarrdem: is there any chance traditional / legacy HPC stuff might be migrated away from F77 to Clojure? Imagine running a climate model on the JVM via Clojure!
02:31arrdemugh......
02:31arrdemthe performance slowdown...
02:31arrdemthe pain...
02:31TEttingerhydromet, I think more likely is something like X10
02:31TEttingerit has IBM's backing and is really very close to HPC Scala
02:31TEttingerbut no not for a long time
02:32arrdemhydromet: the issue with HPC codes is the development cycle on them
02:32hydrometarrdem: although for dynamical models (resolving at grid points, using finite differencing etc.) I suppose its hard to beat F77
02:32arrdemhydromet: your average HPC code has been handed down through four or five generations of grad students and is a total hairball
02:32hydrometTEttinger: interesting, I haven't heard of X10 and didn't realize there was is "HPC Scala"
02:32arrdemhydromet: F77 can write good code as can Perl the issue is that the users don't write good code
02:33TEttingerno, I mean
02:33TEttingerit's an HPC kind of language, but it's similar to Scala in features
02:33hydrometarrdem: hairball is a good description! I imagine there are similar issues in gov organizations with F77 code like NOAA
02:34TEttingerso it has stuff for locality when distributing code, but also some medium-strength functional programming features
02:34hydrometTEttinger: good point, its not always about the language itself but about who is writing the code!
02:34arrdemhydromet: that's me being polite in good company :P I'm on UT Austin's Student Cluster Competition team so I'm involved in building and running some of the gnarliest codes out there
02:34arrdemhydromet: I've seen some shit man....
02:34alewchoice of programming languages is more of a social one and legacy one than a technological one it seems
02:34hydrometTEttinger: can Clojure process large arrays of data fairly speedily? (like grids of data points)?
02:35nonesis quil no longer developed?
02:35arrdemalew: mostly agreed... but F77 and C have Java numeric performance totally beat.
02:35TEttingerit's how prismatic works. take a look at hiphip, hydromet
02:35arrdemalew: when you really really do need to go fast you need different tools
02:35marcopolo`hydromet: it can be just as fast as java
02:35arrdemI do hope that changes, but it's the status quo
02:35TEttingerhttps://github.com/Prismatic/hiphip
02:35alewarrdem: yeah, but those situations are sooo sooo infrequent
02:36hydrometarrdem: Good grief, it sounds like you've got your hands full with that competition! Good luck!
02:36arrdemhydromet: we just won for the 2nd year in a row :D
02:36hydrometTEttinger: thanks, I wil take a look at both prismatic and hiphip
02:36arrdemhydromet: my hands are empty for eight more glorious months
02:36hydrometarrdem: congrats!
02:37hydrometarrdem: so is your next project going to be clustering a boat load of the new Mac Pro towers and running some Clojure with OpenCL on those graphics cards (just kidding)
02:37seriously_randomnoob question: fn[...] in reduce can have more than two variables beside accumulator and element in a sequence, e.g. fn [acc x]?
02:37TEttingerhydromet, it only makes sense if you already know the equivalents in clojure's collections functions to what hiphip does to arrays
02:37hydrometmacropolo`: do you run a lot of numerical stuff on Clojure?
02:38arrdemhydromet: if that's what you're up to let me know how you do it.. Clojure doesn't have a very well developed multi host parallelism toolkit that I know of
02:38TEttingerI would not recommend doing heavy math in clojure... yet. heavy, complex data transformations, oh god yes.
02:38arrdem(inc TEttinger)
02:38lazybot⇒ 10
02:38marcopolo`hydromet: I have. bits and pieces of data analysis at work
02:39hydrometTEttinger: in the Python community apparently NumPy (Numerical Python) has been well received by some, is there anything like NumPy for Clojure?
02:39TEttingerthat said, I do quite a bit of simple math in clojure for a non-really-real-time game. and it has needed some optimizing, but it runs quite well now.
02:39marcopolo`There's Incanter
02:39TEttingernumpy is a binding over BLAS right?
02:39arrdemseriously_random: not that I know of. The usual pattern is to use an accumulator map which contains multiple meaningful keys
02:39marcopolo`core.matrix, if you need to do things with matrices
02:40arrdemTEttinger: and appropriage python C extension hooks yes
02:40marcopolo`and if you really need to get performant with math, you can use https://github.com/ztellman/primitive-math
02:40TEttingeryeah, vectorz or the LAPACK binding for core.matrix would work
02:40hydrometmarcopolo`: ah yes! I think had seen something a few weeks agoa bout core.matrix ... I should give it a try
02:40marcopolo`which makes sure to keep math as primitive types to make as fast as possible
02:40marcopolo`honestly you should be able to get faster speeds in clojure than in python
02:41arrdemlol yes
02:41hydrometTEttinger: good question about NumPy, I'm not sure if its binding over BLAS but that could very well be the case
02:41alewalways blows my mind that python is older than java
02:41arrdemmarcopolo`: that's not saying much tho...
02:41TEttingerseriously_random, there are some good examples on the clojuredocs thing for reduce
02:41logic_proghttps://gist.github.com/anonymous/8216063 <-- is there a more efficient way or writing this?
02:41marcopolo`hydromet: just remember mmul is to multiply matrices, that tripped me up for a while
02:42arrdemlogic_prog: you don't need that or...
02:42marcopolo`arrdem: :) let me change that to faster runtime & faster dev time; that's a bit more impressive
02:42arrdem#(get symbol_map %1 %1)
02:42logic_progarrdem: whoa, cool, default value ftw
02:42arrdemlogic_prog: otherwise looks good
02:43hydrometmarcopolo`: thank you for the heads up! A friend of mine (who is new to programming) and I are both learning Clojure together. He is an undergrad majoring both math and finance. His classmates learned Matlab but he's totally game to learn Clojure (but he also wants to do math-y stuff like matrix operations)
02:43logic_progarrdem: that's disappointing -- there's no better way to do this?
02:43arrdemlogic_prog: that's exactly how I'd do it at least...
02:43marcopolo`hydromet: where are you going to school?
02:43marcopolo`logic_prog: hash-maps also work as fns
02:44marcopolo`,({:foo 3} :bar 4)
02:44arrdemlogic_prog: you may be able to do an (into "") rather than (apply str) but the basic approach I think is not gonna change
02:44hydrometmarcopolo`: Univ. of Hawaii (I'm not in school but my friend is ... I just do some guest lecturing)
02:44clojurebot4
02:45hydrometmarcopolo`: are you in school too? or do you teach?
02:45alex_batsuevHi, could someone help me with ring-json and peridot?
02:45alex_batsuevtrying to parse response from request
02:45alex_batsuevhttps://gist.github.com/batsuev/d8d1b28910f09e62a9dd
02:45alex_batsuevand got null :(
02:46logic_progmarcopolo` , arrdem: noted, thanks
02:46marcopolo`hydromet: nice! get them hooked on Clojure!
02:47seriously_randomTEttinger, what if I want to change the rest of sequence at each loop? Is reduce not meant for this? http://pastebin.com/5nBdVja4
02:47TEttingersure, you can do it. let me take a look
02:48hydrometmarcopolo`: I really enjoyed watching one of Rich Hickey's presentations from a few years ago "The Value of Values" where he talks about the "PLOP" model being outdated!
02:49marcopolo`Is there something special I have to do to override a class's methods in gen-class?
02:49marcopolo`hydromet: Yeah those are always great! there's a list here of his talks http://thechangelog.com/rich-hickeys-greatest-hits/
02:51hydrometDoes anyone know when and where Clojure Conj 2014 will be held?
02:52hydrometI didn't find anything about 2014 dates / places on the web
02:52marcopolo`hydromet: a bit too early to know for sure
02:52TEttingerit's 2014 already whaaaaa
02:52hydrometheh
02:52marcopolo`did you go to the last one?
02:53hydrometno, I've never attended a Clojure Conj but I want to attend the next one
02:53arrdemhydromet: word on the street is SF
02:53arrdemhydromet: but there's nothing official at this point
02:53hydrometarrdem: that would be fun
02:54marcopolo`wouldn't that conflict with clojure/west?
02:55hydrometIs Clojurescript gaining some momentum lately, now that we've entered the Gregorian calendar year 2014?
02:59marcopolo`Does it look like I'm doing anything wrong w/ gen-class? https://www.refheap.com/22377
02:59marcopolo`I'm adding socks proxy support to clj-http, but the ssl support is being really annoying
03:00TEttingermarcopolo`, a little
03:00TEttingerthe java object is already mutable where you declare one *dynamic*
03:00TEttinger(InetSocketAddress. "localhost" 8118) is already a mutable object
03:02marcopolo`I'm planning on doing a binding for that so you can make per request based proxies
03:04marcopolo`It doesn't seem like it's overridding the methods
03:04marcopolo`It is definetely extending the class, but my methods like toString or the nil'ed connectSocket don't appear
03:19marcopolo`From the docs: "SSLSocketFactory is deprecated, use SSLConnectionSocketFactory"
03:19marcopolo`...
04:11sm0ke,java.util.Date.
04:11clojurebot#<CompilerException java.lang.ClassNotFoundException: java.util.Date., compiling:(NO_SOURCE_PATH:0:0)>
04:11sm0ke,(java.util.Date.)
04:11clojurebot#inst "2014-01-02T09:09:45.869-00:00"
04:12nonesis anyone use Nightcode?
04:12sm0ke,(1000 / 10)
04:12clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
04:12sm0keheh
04:12sm0ke,(/ 100 10)
04:12clojurebot10
04:17TEttingernones, I looked at it.
04:17TEttingerI may have installed it
04:21nonesTEttinger: I can't to build it from master
04:21TEttingerI didn't try, I'm not sure what it really does
04:21TEttingerthat light table doesn't
04:24nonesit can't load main java class
04:25TEttingerare you running the jar with -jar
04:25nonesI running by `lein run`
04:25nonesfrom source code
04:26TEttingerok... check the project.clj , is there a :main ns and the same ns listed under :aot
04:27nones :aot [clojure.main nightcode.core nightcode.leinv]
04:27nones :main ^:skip-aot nightcode.Main
04:28TEttingerI went to their page, will download and try
04:28nonesfrom jar it works, but from source code it don't want starting
04:32rolandsusp
04:32TEttingerect
04:34TEttingernones, try "lein javac" first
04:34TEttingerit has 5 java source files to compile
04:35TEttingerI didn't have any trouble
04:35TEttingerlein deps ; lein javac ; lein run
04:37sm0kehow do i set an atom to different value
04:37sm0keis there a set! ?
04:38nonessm0ke: use reset!
04:38arcatan(reset! foo-atom nev-value)
04:39sm0keah!
04:39sm0kenones: thanks
04:39sm0ke,@(reset! (atom true) false)
04:39clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.concurrent.Future>
04:39sm0ke,(reset! (atom true) false)
04:39clojurebotfalse
04:40sm0keweird that there is no mention of reset! on this page http://clojure.org/atoms
04:41TEttingerwoah sm0ke, that is weird
04:45sm0kewell its weird for me
04:45sm0keymmv
04:51Cr8,(let [a (atom true)] (reset! a false) @a)
04:51clojurebotfalse
04:52TEttingersm0ke, what's weird about it is most of the pages on the site have a listing of relevant fns. that has no listing
04:55nonesTEttinger: thanks, it works now
04:56TEttingerhooray
05:52sm0kedoes core.async works in android?
05:57Cr8no reason to think it shouldn't. Uses java.util.concurrent but android has an impl of that stuff
06:36sm0kei have a let form in my namespace when i put that namepace in aot it is getting executed!
06:36sm0keat compile time!
06:37sm0keand it is obviously throwing stupid errors
06:53jowagsm0ke: all top level forms are evaluated when compiling
06:58jowagsm0ke: you should not perform I/O or any stateful stuff in top level forms, 'cause you'll never anticipate all cases where the namespace gets evaluated.
07:03jowagsm0ke: you should not perform I/O or any stateful stuff in top level forms, 'cause you'll never anticipate all cases where the namespace gets evaluated.
07:05alex_batsuevHi, could you please tell me what am I doing wrong? :) trying to make simple json server with test using peridot and ring-json, but don't understand how to check response: https://gist.github.com/batsuev/d8d1b28910f09e62a9dd Thanks.
07:07seriously_randomquick way to create a list of (1) n times? e.g. 3 times: ((1) (1) (1))
07:07TEttinger(repeat 3 '(1))
07:08TEttinger,(repeat 3 '(1))
07:08clojurebot((1) (1) (1))
07:24seriously_randomTEttinger, I ended up rewriting the whole reduce thing. One problem remains with cons, stuff gets nested in the wrong way: http://pastebin.com/9vz7JXs1
07:26sm0kehey guys anyone work with neko for android?
07:26sm0kehow the fk do i getApplicationCOntext?
07:27TEttingerneko?
07:27TEttingerlike the haxe thing?
07:27sm0keumm its helper lib for lein-droid
07:27sm0keno
07:27TEttingerno, haven't heard of it
07:27sm0keits wrapper around android api
07:27sm0kehmm ok
07:28xeqiAlDev: compojure makes sure the response is a string. You'll need to clojure.edn/read it before you can use it as a map
07:28xeqior json read it
07:30AlDev(prn (:response res)) - #<json$wrap_json_response$fn__976 ring.middleware.json$wrap_json_response$fn__976@59b59452>
07:31TEttingerseriously_random, I need to get to bed, sorry I can't be of more help
07:32seriously_randomTEttinger, np
07:32jowagseriously_random: if you want to append at the end, use vector instead of cons. If creating vector is too expensive, use concat which returns a lazy sequence
07:33AlDevit's not a string in peridot
07:37xeqiAlDev: you don't pass request to the (-> app-routes ...) chain
07:37xeqiso its just returning the handler generated by the middleware
07:38seriously_randomjowag, vector gives me nested lists, doesn't it? e.g. [[[...]...]...] Here is almost what I want: http://pastebin.com/rnBKVa5i
07:38AlDevhmm, what I need to change?
07:38AlDev(def res (-> (session app)
07:38AlDev (request "/test"
07:38AlDev :request-method :post
07:38AlDev :content-type "application/json"
07:38AlDev :body (.getBytes "{'user': 'Vasya'}" "UTF-8"))))
07:38AlDevapp is (defn app [request] (-> app-routes wrap-json-params wrap-json-response))
07:38xeqiwell, its not good to create a def inside the deftest. so first use a `let` there instead
07:39AlDevooh, thx. just started to learn clojure
07:39xeqibut then change the definition of app to (def app (-> app-routes wrap-json-params wrap-json-response))
07:40xeqithis will define app to be the resulting handler function, which already takes a request as a param
07:41jowag,(map vector [1 2 3] [1 2 3] [1 2 3])
07:41clojurebot([1 1 1] [2 2 2] [3 3 3])
07:41xeqialso you can remove the (use 'ring.middleware.json) line by changing the ns declaration, and having (:require [ring.middleware.json :refer :all)). Similar to the compojure line
07:41jowagseriously_random: you want to be able to do that ^^ ?
07:41xeqiAlDev: you probably also want wrap-json-body instead of wrap-json-params since you are sending the json in the :body
07:43seriously_randomjowag, yes
07:43jowagseriously_random: without using 'map' function?
07:43jowagseriously_random: or what is your goal :)
07:44seriously_randomjowag, I did it. "(concat acc (conj '() (apply f (nth-of-all-re x seqs))))" but I am not happy with using conj '(). Getting tired of it
07:45jowagseriously_random: Well you have to realize what kind of data structures there are and which function creates which data structure
07:46AlDevThanks, it works!
07:47jowagseriously_random: cons creates Cons data structure, into which you can only prepend, not append. conj works with many data structures and it 'adds' new item into the data structure. Somethimes it appends, sometimes it prepends, it depends on the data structure you are conj-oining to.
07:49jowagseriously_random: '() creates a PersistentList data structure, which is similar to Cons but not the same. But as with Cons, you can only prepend to the List, with conj function.
07:53jowagseriously_random: and concat creates a LazySeq data structure which behaves as if it was a concatenation of two collections. But the flexibility comes with the price, you cannot conj-oin to the LazySeq.
08:21xificurChow can I change a function's ToString representation?
08:27AlDevxificurC: http://stackoverflow.com/questions/5306015/equivilent-of-javas-tostring-for-clojure-functions
08:27xificurCAlDev: just found it too, thanks a lot
08:37xificurCAlDev: I see I misinterpreted the problem. I'm trying to solve http://www.4clojure.com/problem/113
08:40xificurCso I guess its not about the function's tostring representation but about its results string representation
08:53xificurChttps://www.refheap.com/22385
08:55Ember-woah, reify with clojure.lang.IFn ?
08:55Ember-why?
08:55clojurebothttp://clojure.org/rationale
08:55Ember-ah, got it
08:55Ember-:)
08:55Ember-but seriously, what's wrong with plain ol' fn?
08:56Ember-and considering your original question, you cannot get a proper seq out of string without somehow parsing it
08:58Cr8xificurC: implement Seqable?
08:58Cr8has a method seq() which returns a seq
08:59Cr8clojure.lang.Seqable (seq [this] res)
08:59xificurCCr8: thanks
09:00xificurCEmber-: i dont understand reify or any java interop too much yet so I really dont know what I'm doing
09:00xificurCjust trying to make things work and then understand why
09:00Cr8,(seq (reify clojure.lang.Seqable (seq [this] (seq [1 2 3]))))
09:00clojurebot(1 2 3)
09:00Ember-no need for java interop there
09:03xificurCwell I dont understand reify either
09:03xificurCthis worked https://www.refheap.com/22389
09:04Cr8reify is for making a single instance of an object that extends some interfaces or protocols
09:04Cr8(reify SomeInterface (method-on-someinterface [this
09:05Cr8(reify SomeInterface (method-on-someinterface [this arg1 arg2] body) (another-method-on-someinterface [this] body) OtherInterface (method-on-otherinterface [this] body))
09:05Cr8so it's multiple sets of InterfaceName and method body
09:05xificurCso here we created a function that extends the Seqable interface?
09:05Cr8and you can additionally extend the methods of java.lang.Object anywhere, which is why toString works everywhere
09:05Cr8or you can do that explicility
09:06Cr8xificurC: not a function, just a 'thing'. a JVM object.
09:06Cr8,(str (reify Object (toString [_] "foo")))
09:06clojurebot"foo"
09:07xificurCCr8: so the function returns an object which has the Seqable interface extended?
09:08Cr8yep
09:08Cr8well, reify is probably more reasonably considered a special form than a function
09:08xificurCits hard to understand this stuff when I dont understand interfaces or protocols i guess
09:09Ember-anyway, saying reify clojure.lang.IFn is just a hard way to say fn
09:09Ember-:P
09:09xificurCthanks I again understand a bit more than yesterday
09:10Cr8right, a function is an object that implements the IFn interface
09:10Cr8which is how maps can be functions as well
09:10Cr8,({:a 1 :b 2} :a)
09:10clojurebot1
09:11Ember-,((reify clojure.lang.IFn (toString [_] "foo")))
09:11clojurebot#<AbstractMethodError java.lang.AbstractMethodError: sandbox$eval49$reify__50.invoke()Ljava/lang/Object;>
09:11Cr8,(map {:a 1 :b 2} [:a :a :b :a :a])
09:11clojurebot(1 1 2 1 1)
09:11Ember-heh
09:11Ember-I fail
09:11Cr8Ember-: actually need to define invoke()
09:11Ember-yeah, I understood after I wrote that
09:12Cr8,((reify clojure.lang.IFn (invoke [_] :foo)))
09:12clojurebot:foo
09:12Ember-,((fn [] :foo))
09:12clojurebot:foo
09:12Ember-like I said, a hard way to define fn :)
09:12Cr8yep
09:12xificurCheh
09:13xificurCtheres a lot to grasp in clojure
09:14xificurCespecially if you havent coded much before
09:14Ember-if you haven't done functional programming before, then definetly
09:14xificurCI coded a bit in a few languages but never really touched any concepts, be it functional or OO
09:24lsdafjklsdxificurC: clojure has been one of the most difficult, but eye opening languages I have ever tackled. But my background isn't imperative java, I went from ruby/rails -> javascript
09:27xificurClsdafjklsd: my road is roughly (starting from school) pascal -> c++ -> matlab/mathematica/R -> VBA -> clojure -> python -> Common Lisp -> elisp -> clojure; you can count roughly half a year on each of the languages except VBA which I still (unfortunately) have to use at work
09:30lsdafjklsdxificurC: hehe, good stuff!
09:31xificurClsdafjklsd: well the bad thing is I never stay with any language long enough to learn it decently
09:31xificurCor the concepts of oo or functional programming
09:34pyrtsaAny idea why neither definterface nor defprotocol expose the possibility to extend existing Java interfaces (or Clojure protocols)?
09:42pyrtsaOr in other words, why do I need to jump through hoops to define a protocol of my own so that the protocol also extends an existing interface, say, clojure.lang.IFn?
09:43mdrogalispyrtsa: I think you need interface injection or something crazy to do that.
09:44pyrtsaInternally, both defprotocol and definterface use gen-interface, which allows to pass a list of extended interfaces (gen-interface ... :extends [interface ...]). But neither of them exposes this option.
09:45pyrtsaThat given, it doesn't seem like something crazy to me. It sounds like it was just -- intentionally or not -- left out. And I'd like to know why.
09:45mdrogalisCan't say I'm sure, pyrtsa.
09:45mdrogalisAsk Clojure-dev?
09:45Ember-that is indeed a limitation and I see no reason for it
09:47Ember-probably just something no one thought back when those were made
09:47pyrtsaI guess so
09:48ToBeReplacedwhat is the use case? I think the preferred method would be create a new protocol -- they really shouldn't be much bigger than one function most of the time anyway
09:52pyrtsaToBeReplaced: Obviously, I'm doing Java interop here. Say, I create a function returning a Clojure object that happens to implement multiple Java interfaces in addition to some protocol(s) of my own. If my protocol implemented those interfaces, I could just type hint the return value as my type and the compiler could figure out the rest, I suppose.
09:52pyrtsaAnother reason: It feels somewhat silly I have to list all the interfaces separately wherever I do a reify.
09:53pyrtsaBut I might be just overlooking something obvious here.
09:55Cr8i think the thing is partially that types can be extended to protocols *after* those types are defined
09:56Cr8so there isn't actually a way to make all the things that satisfy the protocol satisfy that interface
09:56ToBeReplacedpyrtsa: what are you type hinting the return value of? i don't see why that wouldn't work, but i haven't mix-and-matched interfaces and protocols before
09:57pyrtsaCr8: I'm missing your point. I'm talking about interfaces here. Obviously, I'm defining an interface that includes the methods of an existing 3rd party interface. So any type implementing mine will (need to) implement them too.
09:57ToBeReplacedpyrtsa: i take it back, i see the problem... interesting
09:57pyrtsaToBeReplaced: Internally, protocols are interfaces. That's what I mean.
09:58gfredericksprotocols are partially interfaces
09:58pyrtsaOr that. ^
09:58gfrederickswhich is the difference Cr8 was talking about
09:58Cr8pyrtsa: right, but the *fact* that a type implements a protocol is defined outside of that type
09:58pyrtsaBetter said this way: protocols *have* interfaces. :)
09:58Cr8so even though it has to implement the methods
09:58Cr8you still can't actually use things of that type in places you can use things implementing that interface
09:59pyrtsaCr8: Ah, that's a good point.
09:59pyrtsaThat said, my question is still open for definterface. :)
10:00pyrtsaCr8's point excludes protocols from this discussion. My mistake. But definterface should still provide the extends feature in my opinion.
10:05Cr8https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L20-L36 is pretty short, you could lift-and-modify [assuming you're ok being infected with the EPL license]
10:06pyrtsaYeah, that's what I'm planning to do. The source macro is one of my favorite tools. ;)
10:10tarantulee,(print clojure.core/*clojure-version*)
10:10clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier master}
10:11pyrtsaCr8: Heh, the comment above "(defmacro definterface ..." reads "for now, built on gen-interface". Guess it wasn't done with a hammock. :)
10:12UltimateEyePatchDoes apply ever give you TCO?
10:13UltimateEyePatchOr well, tail recursion I should say
10:16gfredericksUltimateEyePatch: tail calls are always via recur
10:17gfredericksso I don't know for sure what the context of your question is but the answer is almost certainly no
10:41jonasenBronsa: Is there an easy way to know (in tools.analyzer) if a :fn-method is a loop target? Or do I need to search for the loop-id among the children?
10:43Bronsajonasen: the latter; note that you don't have to walk all the children -- only the ones in :return position
10:43jonasenBronsa: ok, I'll try that
10:48TEttingerbitemyapp: just had double-brewed aeropress coffee. one scoop to make coffee, mixed coffee with hot water, pressed through another one-scoop press. both were not labor-intensive or upper-body-intensive, and the coffee was strong but not bitter.
11:00seuberti paid $5 for a cortado this morning :V
11:02jballancok, so I obviously have not been paying enough attention to core.logic...what happened to defrel?
11:18tarantuleeis there an equivalent to cond-> where the expr is threaded through both the test and the form?
11:20jballanctarantulee: no, but you can combine as-> and cond-> to that effect
11:20jballanc(not great, I know)
11:20tarantuleecool, cheers
11:44justin_smith,(apply str (map (comp char dec int) "Hppe!Npsojoh!$dmpkvsf"))
11:44clojurebot"Good Morning #clojure"
11:47mdrogalisMorning :P
11:47grzmI remember hearing somewhere that there were some good examples of CSP patterns in some of the golang documentation. Anyone know off the top of their heads which (part of) the documentation in particular?
11:48gdev,(apply str (map (comp char dec int) "qdcqtO"))
11:48clojurebot"pcbpsN"
11:49gdevdoesn't work on my box
11:49justin_smithgdev: slightly more readable if inc'd
11:50stuartsierragrzm: try https://code.google.com/p/go-wiki/w/list
11:50justin_smithgdev: should that O have been a Q
11:50justin_smith?
11:50stuartsierraThere are HTTP examples, timeouts, rate limiting, etc.
11:50gdev,(apply str (map (comp char dec inc) "qdcqtO"))
11:50clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number>
11:50grzmstuartsierra: cheers
11:50justin_smithgdev: you need the int cast
11:51stuartsierragrzm: There are also some videos of presentations, something like "Intro to Concurrency in Go"
11:51stuartsierraOr "Concurrency Patterns in Go"
11:52grzmvery nice. thanks!
11:52stuartsierraYou're welcome.
11:52gdevjustin_smith, I'll just take the bot to private chat until I work it out. My coffee kicked in me guess
11:53justin_smith,,(apply str (map (comp char inc int) "qdcqtL"))
11:53clojurebot"redruM"
11:56gdevjustin_smith, doing ROT-1 by hand is hard apparently
11:56justin_smithI am sure it just takes practice
11:57justin_smithmore shift than rot, anyway (rot would be much more verbose)
12:04justin_smithgdev: upping the game a bit https://www.refheap.com/22397
12:06justin_smithfunny, the raw html source actually has the same control characters that were in my emacs buffer, but of course they do not display properly in the browser at all
12:07Cr8hm
12:07Cr8,(let [charset (map char (range 97 123)) rot (concat (drop 13 charset) (take 13 charset)) rmap (zipmap charset rot) rotate (fn [c] (or (rmap c) c))] (apply str (map rotate "guvf vf ebg13")))
12:07clojurebot"this is rot13"
12:07justin_smithnot bad!
12:08justin_smithrotate could be #(rmap % %) without too much loss of legibility
12:08Cr8oh yeah
12:09Cr8forgot maps take a default
12:11jowagpalindrome time!
12:12jowag,(let [let - tel let - tel] tel)
12:12clojurebot#<core$_ clojure.core$_@5d1f>
12:14justin_smith,((let [let * tel let * tel] tel))
12:14clojurebot1
12:14justin_smithnow can we do proper math in palindromes?
12:14ddimathe hell is this? ;)
12:14justin_smithddima: stupid clojure tricks, of course
12:15ddimaah, didnt know (*) returns 1
12:15justin_smiththe multiplicative identity, of course
12:15ddimayeah, for some reason would have expected arity-exception
12:16ddimabut makes more sense of course
12:16justin_smith,(< Double/NaN)
12:16clojurebottrue
12:16justin_smithit makes no sense at all, but is very practical
12:16ddimajustin_smith: well, implementation-wise it makes sense ;)
12:16justin_smithexactly
12:18andyfjustin_smith: Next version of Eastwood Clojure lint tool will warn about single-arg predicates like < > etc.
12:19justin_smithcool
12:19justin_smith,((every-pred < > =) Double/NaN)
12:19clojurebottrue
12:19jowag,(fn nf [fn nf] fn nf)
12:19clojurebot#<sandbox$eval49$nf__50 sandbox$eval49$nf__50@110e291>
12:20Cr8here's a fun one to run at home
12:20Cr8 (pprint (filter #(<= 4 (count %)) (vals (group-by frequencies (clojure.string/split-lines (slurp "/usr/share/dict/words"))))))
12:21justin_smithjowag: I think (do .... od) could open up the potential of what a clojure palindrome could do a lot
12:27bitemyapphttp://awelonblue.wordpress.com/2012/10/21/local-state-is-poison/
12:31bbloombitemyapp: yup.
12:31bbloombitemyapp: the idea that "new" was a side effect equal to gensym was MIND BLOWING to me
12:34bitemyappbbloom: also lobste.rs is several orders of magnitude better than HN
12:34bitemyappI've been watching it for awhile, it has grown nicely.
12:34bitemyappit used to be soooo quiet.
12:35bbloomgot an invite for me?
12:35bitemyappbbloom: sadly no, I would if I had one. I don't have an account yet.
12:35bitemyappbbloom: but aphyr and ztellman have accounts.
12:35bitemyappI haven't bothered to ask anybody for one yet.
12:35bbloomi'm in no rush to have a new distraction
12:36bitemyappwell, I'm not looking to get distracted, there are things I'd like to post to the site.
12:36bbloombut if anybody wants to bestow an invite upon me, i'll receive it willingly
12:36bitemyappkeep the content flowing.
12:36jonasenI think invite only is probably a good idea in the long run
12:37bbloomseems like they do something with the public invite tree
12:37bbloomi'd like to see a full trust network graph at some point :-)
12:38jonasenbbloom: well, you can't create lots of troll accounts if the tree is public
12:38bbloomyeah, for sure, helps with that
12:38bitemyappbbloom: the tags and filtering are really nice too.
12:40bbloomi just wish i had some way to keep track of people i trust & people i trust to trust other people :-P
12:40bitemyappbbloom: web-of-trust based filtering could be really interesting.
12:40bitemyappbbloom: "show me content from this person and anybody within 3 removes of them, with nothing that has these tags..."
12:40bitemyappsounds like an excuse for graph nuts to have a ball.
12:41justin_smith(inc bitemyapp)
12:41gdevbbloom, lol that's what I was trying to get my team to make during clojure cup, but it is a hard problem to solve in 48 hours
12:41lazybot⇒ 15
12:42justin_smithbitemyapp: that article was great, thanks
12:42bbloomat this point, i think we need an RFC for a distributed social graph + arbitrary annotation data protocol
12:42bitemyappjustin_smith: np.
12:42justin_smithreally thought provoking
12:42bitemyappjustin_smith: matches a lot of the thoughts I had as I was shifting out of thinking in terms of Common Lisp and Python and into Clojure and Haskell.
12:42ddimabitemyapp: thanks for the lobste.rs reminder
12:43bitemyappunnecessary state you can't track or control is a bigger problem than state itself ever was.
12:43bbloombitemyapp: yeah i was just discussing dmbarbour w/ dnolen. i think dmbarbour is like a mad scientist. love the stuff he's working on, but i basically treat him as an upper bound on my crazy thoughts
12:43bitemyappMy complaint with globals (dumb defs at the top-level) is that they create unnecessary singletons, not the "global state"
12:43bitemyappif we defaulted to directories/trees so as to avoid the singleton problem I would bitch a lot less.
12:44hiredmanbbloom: foaf it up
12:44bitemyappbut until people wise up to that pattern, I'll keep being cranky about configuration via (def config (atom {}))
12:44justin_smithbitemyapp: we need parameterized and versioned namespaces
12:44bbloombitemyapp: i was stoked to see that his byte code & object language were concatenative: http://awelonblue.wordpress.com/2013/12/25/awelon-project-progress-report/
12:44bitemyappjustin_smith: well, there's always ML functors and typeclasses, but the best we can do is approximate them.
12:44bbloomhiredman: http://www.foaf-project.org/ this?
12:45hiredmanyes, that is the foaf to which I was refering
12:45justin_smithbitemyapp: we can get pretty far with versioned defstructs and protocols I think?
12:46justin_smithsorry s/defstruct/defrecord
12:46justin_smithI keep doing that
12:47bitemyappjustin_smith: you can get pretty far with defrecords but they can still turn into local state run amok sometimes if you don't have some kind of handle to the app.
12:47bitemyappjustin_smith: that's why I keep a short-circuit switch available globally to all my app instances and infrastructure.
12:47bitemyappjustin_smith: if the global state behaved more like a log it wouldn't be as big of a deal, then you could see app init, state thereof, and shutdown as a history.
12:48bitemyappsritchie needs to stop bothering with twitter and just DM me.
12:49lsdafjklsdbitemyapp: what's your twitter handle?
12:49bitemyapplsdafjklsd: you get two guesses.
12:49lsdafjklsdbitemyapp: lol, got it
12:50justin_smithbitemyapp: there is also (def config (atom [])) (def get-config #(pop @config)) (defn push-config [conf] (swap! config conj conf)) boom, history
12:51bitemyappjustin_smith: hum, I don't mean for config necessarily
12:51bitemyappjustin_smith: I mean for app instances declaring their existence and providing handles for killing them off or fiddling with their behavior.
12:51bitemyappconfig should be part of, and attached to, an app instance
12:51justin_smithbitemyapp: that was re your above mention of your config atom gripe
12:51bitemyappconfig shouldn't exist as a singleton or a log apart from the app, tho it could be logged *inside* of an instance.
12:52justin_smithahh, I think I am starting to see that distinction
12:52bitemyappjustin_smith: well yes but the hard part isn't really the push/pop, it's getting people to rethink how their app components work.
12:52justin_smithright, it is the design that surrounds the config
12:53bitemyappjustin_smith: an app is made up of components, components are made up of namespaces with functions whose behavior can be configured by some kind of state.
12:53bitemyappjustin_smith: ideally, instead of firing off threads into the clear blue, you should have some kind of global vision into everybody that's "up" or has been "up" in the past.
12:53bitemyappand that would ideally be more than just a kill-switch.
12:53Cr8prismatic is an interesting mix of crap that folks i follow on twitter tweeted about and stuff "nearby", but its not as picky as I'd like
12:54bitemyappjustin_smith: imagine procfs but in your application.
12:54bitemyappjustin_smith: imagine how cool that would be.
12:54bitemyappprocfs is just a "tree" of pids and various levels of state introspectable globally.
12:54bitemyappwhy can't instances of your app and their state be part of a tree with logged history?
12:55bitemyappcould make hot-patching a lot safer, for example.
12:55Cr8or: erlang is great until someone uses ets
12:56ddimabitemyapp: probably not exactly what you are discussing, but I like how storm uses zookeeper for that
12:56ddimathough not in the form of a log iirc
12:56mdrogalisDire 0.5.2 is out with run-time removal of handlers. Shout at me angerily if you see problems.
12:57bitemyappmdrogalis: noice. Thanks!
12:57Cr8or maybe i'm thinking of the process dictionary
12:57Cr8yeah, that thing
12:57mdrogalisbitemyapp: Welcome. :)
12:57bitemyappI don't like Erlang much but it has an outsized influence on how I structure my networked backend applications.
12:58justin_smithRaynes: refheap does weirdness if I paste a region from emacs that has control characters in it - I think there may be a way to scrub the paste on the elisp side
13:01Cr8incidentally I found out about `col` the other week
13:02justin_smithCr8: not coll?
13:02Cr8not coll
13:02Cr8col the unix utility
13:02justin_smithahh
13:02justin_smithI meant coll?, the clojure function with a ? in the name
13:02justin_smithbut now I get it
13:11bitemyappI need to wake up in the morning more often. This is awesome.
13:16zanesI'm getting a UnsupportedClassVersionError when I try to reify an interface from an imported library and I'm a little confused as to how to debug it. I thought Leiningen was handling all the compilation, so how is it possible that I'd have a class compiled for a different version?
13:17hiredmanzanes: that library you are using most likely has classes compiled for a later version of java than you are using
13:18zaneshiredman: So the thing to do is to target a later Java version, myself?
13:18hiredmanzanes: sure
13:18zanesWhat's the best way to do that with Leiningen? I poked around a bit and it wasn't obvious to me.
13:19hiredmanzanes: upgrade your installed java
13:19hiredmanlein version will tell you what version of java lein is using
13:20seangrovednolen: We're working with om and ran into a pretty difficult-to-debug case where we were pulling out an IndexedSeq instead of a vector from a MapCursor. We expected to get back another cursor, but we got the plain cljs data structure instead. Looking at the code, it looks like IndexedSeq failed here https://github.com/swannodette/om/blob/master/src/om/core.cljs#L264
13:21bitemyappyum. runtime type safety.
13:21dnolenseangrove: yes fix coming for this now, related to how simple leaf node values like numbers and strings should be handled
13:32gvickersI have a java object that I am using in a doto, what would be the most idiomatic way to call an instance method on each member of a vector?
13:33justin_smith(doseq [object object-list] (.method object))
13:33justin_smithprobably
13:34gvickersjustin_smith: thanks, i'll g ive that a try
13:34justin_smithif you want the same method called on every one, and don't need the resulting values that is
13:34zerokarmaleftprovided the instance method has side-effects
13:35justin_smithright :)
13:35justin_smithmake the doseq a for if you only want the return values, a (doall (for ...)) if you want side effects and return values
13:36oakwisednolen: any hints on how to do an efficient live search of a big list of items with om/build-all? :fn with conditional `(assoc item :hidden true)` seems like it will trigger update for *all* hidden items rather than just those that changed, right? (sorry for the double ping…not sure if you were online late last night when I asked a similar question)
13:36seangrovednolen: Heh, that and issue #37 were basically the head scratchers for most of yesterday and this morning
13:37justin_smith,(for [s ["hello" "world"]] (.length s))
13:37clojurebot(5 5)
13:39dnolenseangrove: so master exposes some more knobs, you can implement IToCursor to handle types beyonds maps and vectors.
13:40seangrovednolen: Brilliant, thank you
13:43dnolenseangrove: but you won't need to handle IndexedSeq yourself.
13:43dnolenseangrove: I'm relaxing vector to indexed
13:44seangrovednolen: Sounds good, we experimented with something similar briefly, before just converting our IndexedSeqs into vectors
13:45dnolenoakwise: that would be true in React too
13:45dnolenoakwise: efficient search of a truly huge list of items needs to use a some type of clever windowing.
13:46pcnclever windowing... there should be a library for that
13:46pcneven simple windowing...
13:46dnolenoakwise: as pcn said, you could probably provide a generic windowing components that can compose the actual view components
13:47dnolenoakwise: would be generally useful.
13:48coventryIn om, why does to-cursor fail over to returning the object as is? It lead to some confusing behavior on an IndexedSeq.
13:49coventryAh, I see dnolen and seangrove discussed this. :-) Still, would it make sense for to-cursor to give a warning in the default case?
13:50dnolenseangrove: default to-cursor implementation for all IIndexed instead of IVector
13:51dnolencoventry: because you want to be able to get at the values easily
13:51dnolencoventry: the problem is trying to build a component from a simple value
13:51dnolencoventry: that's a hard error now
13:51dnolencoventry: but I've exposed the knobs so you can still do that if you like.
13:52seangrovednolen: Looks great
13:52bitemyappawww yiss got followed by joey hess!
13:53oakwisednolen: Thanks. Interesting. Right now I'm just trying to show/hide ~200 <li>s, each with about 5-10 dom elements per <li>.
13:53dnolenoakwise: yeah I don't think that will be all that slow
13:54coventrydnolen: Oh, throwing an error earlier in the process sounds good, too. Thanks. Om is a beautiful design, BTW.
13:54dnolenoakwise: we're already rendering on requestAnimationFrame
13:54dnolenoakwise: if it turns out to be a problem let me know
13:55dnolencoventry: it's getting there, it's a tradeoff, but I think you get a lot of value missing in other systems
13:55oakwisednolen: roger thanks
14:01zaneshiredman: That did the trick. Thanks!
14:12Clome_Does anyone know if you can use Datomic Free in comercial applications?
14:13mdrogalisCorrect me if I'm wrong anyone, but I believe you can.
14:14bitemyappClome_: you can use it in the backend of an application
14:14bitemyappClome_: you cannot redistribute it.
14:14stuartsierraClome_: Datomic Free is both free (as in beer) and redistributable
14:14bitemyappoh I didn't know it was redistributable.
14:15bitemyappstuartsierra: is Pro Starter?
14:15mdrogalisYeah, the Pro Starter can't be redistributed IIRC.
14:15bitemyappClome_: I would advise against using Datomic Free in a commerical application though, Pro Starter is a better idea from a technical standpoint.
14:15stuartsierraNo, Pro Starter cannot be redistributed.
14:15bitemyappClome_: what kind of application are we talking about here?
14:16stuartsierraBut commercial OEM licenses for Datomic Pro are available on request.
14:16dnolenhuh wow craziness I guess now that CLJS has ICloneable
14:16dnolenyou can implement protocols on JS Values
14:17dnolenso metadata for String & Number
14:17Clome_bitemyapp: none yet. I am just asking if it is possible, otherwise I wont waste time learning it.
14:18stuartsierraClome_: For Datomic licensing questions, you're best off going to the source: #datomic or the Datomic mailing list.
14:18bitemyappClome_: Datomic Free and Pro Starter are perfectly suitable for learning and experimentation. I have a hard time countenancing a viewpoint that categorizes learning as "wasteful" though.
14:19bitemyappClome_: I've done a fair bit of work with Datomic and I would have no problem using Pro Starter in a commercial application.
14:19bitemyapparrdem: what's toothpick?
14:20Clome_Well there is nothing new to learn. I would just waste time learning the api. I am looking for a lifghtweight clientside database. And datomic is perfect since it is coljure idiomatic and it uses logic programming. If it is not free I will go with JavaDB
14:20Bronsadnolen: you mean (let [m (atom {})] (specify 1 IMeta (meta [_] @m) ..)) or something else?
14:20arrdembitemyapp: http://github.com/arrdem/toothpick
14:20gfredericksdnolen: wat on earth
14:20bitemyapparrdem: totes with you on the anamanaguchi.
14:21arrdembitemyapp: iknowrite
14:21dnolenBronsa: yes that could work
14:21mdrogalis";; TODO write a badass demo" lolol
14:22gfredericksBronsa: I have no idea what that code does
14:22arrdemmdrogalis: hey what do you want from me?
14:22mdrogalisarrdem: Hah
14:22gfrederickswhat does specify do?
14:22dnolengfredericks: (let [m {}] (specify 1 IMeta (meta [_] m))) is enough
14:22gfredericksdnolen: is that effective for all 1's everywhere?
14:23dnolengfredericks: no, only that particular instance
14:23arrdemmdrogalis: I now have a working and tested simulator which toothpick can kick out bytecode for, so now I _can_ write a demo :D
14:23gfredericksdnolen: is this some JS feature I don't know about?
14:23dnolengfredericks: well a clone of it anyway
14:23gfredericksI don't know of anything in JS that would enable that
14:23dnolennew Number(n), new String(s) is all you need for the ICloneable implementations
14:24gfredericksnew Number(n) gives you a first-class-object-number?
14:24dnolengfredericks: yes
14:25mdrogalisarrdem: More entertaining to just leave that TODO in :P
14:25arrdemmdrogalis: I figure I'm pushing it with the song quote at the top...
14:25mdrogalisarrdem: Haha.
14:26arrdemmdrogalis: http://www.prometheus-music.com/audio/eternalflame.mp3
14:26mdrogalisarrdem: Who wouldn't love that?
14:26arrdemmdrogalis: idk man... it still gets me every time
14:27bbloomdnolen: seems like ICloneable is trivially the same for all deftypes....
14:28dnolenbbloom: yes, though I left seqs out of it for now and obviously no way for transients
14:28bbloomdnolen: i'm not sure how i feel about ICloneable....
14:29dnolenbbloom: it's required for specify, no other way for it to work
14:29bbloomdnolen: on one hand, it's a clear solution for achieving specify sanely & capitalizing on the platform's features, which is very clojure-y
14:29mdrogalisNada and William's Conj talk just broke my brain.
14:29bbloomdnolen: but on the other hand, it's such a weird thing to clone an immutable structure :-P
14:29bbloomdnolen: even if it's a shallow clone
14:30dnolenbbloom: I don't think it's weird at all.
14:31gfredericksbbloom: clojure does it all the time for handling metadata
14:31gfredericks(clj-jvm I mean)
14:32bbloomyeah, so what's really happening is that there is a hidden field: the type/prototype pointer
14:32bbloomin java, that field is immutable. in javascript, it's mutable if you change the prototype on a single object, right?
14:33bbloomlike a ruby metaclass injection thing
14:33dnolenbbloom: yeah that's how JS works.
14:34zerokarmaleftmdrogalis: indeed, nada live-coding like a boss
14:34bbloomzerokarmaleft: her live coding was pretty damn impressive
14:34bbloomdnolen: what things are you using specify for?
14:34mdrogaliszerokarmaleft: After a certain point, I had no idea what was going on. :P It's over my head.
14:35zerokarmaleftmdrogalis: they lost me after the typechecker...I'll have to revisit it at some point
14:35mdrogalisThat's pretty far!
14:36bbloomdon't worry about it if they lost you
14:36bbloomthey lost lots of smart folks :-P
14:36dnolenbbloom: I think it'll be useful when you want some value to satisfy some API w/o changing equality, it's kind of like become in OO systems
14:36mdrogalisbbloom: :)
14:36bbloomthey are so far down their academic rabbit hole, that they set out to give a talk about how to understand academic stuff & then just went nuts
14:36bbloomwas enjoyable, but they failed at their stated goal
14:36zerokarmaleftmdrogalis: I loved the bit (paraphrased): "If you're Daniel you start by reading the axioms, if you're Oleg you start by reading the LaTeX." :D
14:36bbloomwhich is true of so much of academia ;-)
14:37mdrogaliszerokarmaleft: I lol'ed at work, everyone gave me a ??? look
14:37dnolenbbloom: it also avoids the need for wrappers for that use case which is big benefit in my opinion.
14:37bbloomdnolen: yeah, i know when it's useful & what it does & how it works. i'm asking what in particular you/others are planning to use it for
14:37zerokarmaleftmdrogalis: btw, I'm loving dire...thanks for that
14:37dnolenbbloom: as the universe of protocols expands, I'm sure people come up with lots of rocking ideas
14:37bbloomdnolen: i'm not anti-wrapper. in fact, i quite like wrappers in theory, if only we had a delegation system
14:38dnolenbbloom: I'm not anti-wrapper either - they're just a bear in Clojure(Script)
14:38bbloomdnolen: yes.
14:38bbloomdnolen: factor's generic words, protocols, & delegation systems are worth studying
14:39mdrogaliszerokarmaleft: Anytime :) Just released 0.5.2
14:39bbloomdnolen: http://docs.factorcode.org/content/article-generic.html + http://docs.factorcode.org/content/article-delegate.html
14:48bitemyapphmmm, yes.
14:48bitemyapptime to write my own edn parser.
14:48bitemyappI've had enough.
14:50dnolenyep specify works a charm on JS numbers - https://gist.github.com/swannodette/8225403
14:51stuartsierradnolen: How desirable is it to have metadata on host types in ClojureScript when Clojure does not / cannot support the same?
14:53dnolenstuartsierra: it was something Rich proposed and put on the todo list, probably because it solves a wart in Clojure.
14:53gfredericksthere are other things CLJS can do that jvm-clj cannot, e.g. because core protocols are proper protocols
14:53stuartsierradnolen: OK. Interesting.
14:53gfredericksextend IFn to regexes or numbers
14:54dnolenstuartsierra: we're not going into features here not proposed by the BDFL and are unlikely ever to :)
14:54justin_smithwould a number as an IFn be (partial * this) or something?
14:55gfredericksjustin_smith: whatever you want
14:55stuartsierradnolen: OK. It was just a passing thought. I wouldn't want to see CLJS diverge too far from JVM Clojure.
14:55gfredericksjustin_smith: maybe (partial repeat this)
14:58mikerodthere *has* to be a way to get similar metadata behavior in JVM clj
15:00dnolenmikerod: I think the issue is not whether it can be done but whether it can be done efficiently. obviously JS engine have been optimizing this type of thing for well over a decade now. Not true for JVM.
15:00dnolenmikerod: perhaps invokeDynamic will change that story eventually
15:02mikeroddnolen: that makes sense
15:02bbloomdnolen: i think that specify could also be implemented in terms of wrappers/delegation & JVMs should be able to optimize that quite well. decorator objects are quite common in java apps
15:03bbloomdnolen: clj already relies on double virtual-call elimination for ever top-level var used as a function :-)
15:03khaledhi, all, is using gradle and pallet make sense?
15:04dnolenbbloom: yeah, I suspect that rhickey is not really a fan of delegation, probably because people tend to abuse it.
15:04dnolenbbloom: which is why there's so little support for it
15:05bbloomdnolen: i'd be quite curious to hear his thoughts on it. wouldn't want to make guesses/assumptions about his perspective
15:06dnolenbbloom: yeah just guessing over here. I think recall Stuart Halloway saying to avoid delegation / wrappers at some point.
15:07dnolenbbloom: but to be honest I don't mind, I'm glad I don't have to read code w/ wrappers and delegation that often in Clojure
15:07dnolenit's a convenience to often misused
15:13arrdemclojurebot: ping
15:13clojurebotPONG!
15:20koalallamaclojurebot: source
15:20clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
15:22gvickers`I asked this before but am still having trouble conceptually, I have a vector of objects, and in a "doto" I want to call the same instance method on each of the objects in the vector. Any idea how to do that? I tried using a map but it fails silently, but adding each element "first, last" works as expected.
15:23arrdemgvickers`: refheap paste? map should do what you want so long as you don't mind lazyness...
15:25koalallamagvickers`: doseq?
15:28gvickers`https://www.refheap.com/22403
15:28koalallamagvickers`: whatever you're working on, I want a piece of :)
15:28gvickers`Maybe there's something im missing, I understand clojure collections can mess with the type of java objects they contain, but i dont know if thats my problem
15:29trptcolingvickers`: map is lazy. you want doseq, like koalallama says
15:29gvickers`snmp4j lib wrapper, thanks!
15:29justin_smithgvickers`: map does not fail silently, it is just lazy
15:29gvickers`thanks all, i'll give it a try
15:29justin_smithgvickers`: remember I recommended doseq, or (doall (for ...))
15:30koalallamagvickers`: cool, if open source, send me link. I use a lot of snmp4j, but mostly in Java so far
15:30arrdemgvickers`: yeah you definitely want doseq here.
15:30gvickers`yea I thought I had done a bad job asking the question, but now I understand what you mean
15:34gvickers`I will be reducing the library down a lot, not a huge fan of the way SNMP4J does things. Right now v1 and v2c traps can be captured pretty easily, you just supply a map with a callback function, usually I just give it a function that dumps the traps onto a channel, then you can easily use core.async for processing the stream of data. I am very new to clojure, and this library is only a couple days old.
15:34gvickers`https://github.com/gardnervickers/claptrap
15:37gvickers`justin_smith: thanks that worked beautifully! clojure's lazyness gets me once again...
15:40koalallamagreat, good luck
15:53hiredmanwin 19
16:02joegallowin 20
16:04dnolenk first awesome thing about specify, tree stuff with host values at the leaves where you want them to satisfy a protocol
16:10jballancdnolen: hey, am I right in surmizing that pldb has completely supplanted defrel in core.logic?
16:11dnolenjballanc: that is correct
16:11jballanccool
16:11jballancsome of the docs/wiki pages are still referencing defrel...had me confused a bit
16:12dnolenjballanc: yes should be cleaned up, would love for somebody to help if they feel inclined
16:12jballancheh...well, let's see what my boss thinks of this idea I have for core.logic...might be able to swing a few pull requests your way
16:13jballancI'm toying with the notion of using titan for storing/retrieving relations for use with core.logic
16:13jballancso, along the way I'm looking at that code anyway
16:13dnolenjballanc: sounds cool
16:14jballancyeah, specifically titan's integration with elastic search for full-text indexing means the possibility of full-text goals
16:14jballanccould be...interesting...
16:55oakwisednolen: looks like that ~200 item list is taking ~500ms to update on every state change even with should-update on the item component always returning false, and it seems to grow/shrink with the number of pseudo-dom components in the item's render func (even though the render func isn't getting called)
16:58dnolenoakwise: sounds unlikely if the items are not re-rendering.
17:02dnolenspecify to make the bits of a JS 32bit integer accessible / seqable sounds funs.
17:05trptcolinwhat is a JS integer? ;) </trolololo>
17:06bitemyapptrptcolin: 1.2 | 0;
17:11gfredericksa JS integer is a special integer with gradual overflow
17:11gfredericksthey can get quite big but they just start acting a little funny at some point
17:13arrdembitemyapp: damnit man now I want to know how the JS sign bit behaves...
17:13justin_smithyou can get integers via various html5 extensions like three.js
17:13justin_smithlike actual hardware integers that is
17:14bitemyapptwitter continues to be the best way to get software support.
17:14bitemyapp(inc twitter_support)
17:14lazybot⇒ 1
17:14gfredericksa hardware integer is a line of laptops each of which is either open (1) or closed(0)
17:14bitemyapparrdem: read the spec and be horrified.
17:14l1xis there a way to fetch values belong to a string key from a hashmap the same way you can do it with a symbol? (-> {:test 1} :test) vs. (-> {"test" 1} ??)
17:14justin_smithgfredericks: lol
17:14arrdemjs> -1 | 1<<31 => -1
17:14arrdem
17:14arrdemWAT
17:14arrdemWAI
17:15justin_smithl1x: get-in
17:15justin_smith,(get-in {"test" 1} ["test"])
17:15clojurebot1
17:15justin_smithit does nesting like you can do with ->
17:15justin_smith,(get-in {"test" {"one" 2}} ["test" "one"])
17:15clojurebot2
17:16TimMcarrdem: Try `-1 | "hello"`
17:17TimMc(This is not the operator you are looking for.)
17:17arrdemTimMc: I had a lurking suspicion that was the case...
17:18arrdemTimMc: ... no that's what I wanted...
17:18arrdemTimMc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
17:19TimMcUgh, right, I'm thinking of ||
17:19TimMc"foo" | "bar" ;= 0
17:19TimMcWat 2: Return of the Wat
17:20arrdem(dec javascript)
17:20lazybot⇒ -2
17:21arrdemI see I'm not the first person with this idea
17:21justin_smithwat boogaloo strikes back, the wat-ening
17:21bitemyapp(dec javascript)
17:21lazybot⇒ -3
17:22TimMcHmm, isn't two's complement for -1 all ones?
17:22TimMcThat would always OR to -1.
17:22TimMcFinal Wat XI
17:23oakwisednolen: yeah seems weird… I'll try and put together a minimal example later today. But unless I'm doing something crazy, render on the item component (correctly) doesn't get called, but the more components within it still increase the whole app update time. Here's a quick flame graph: http://i.imgur.com/sK4X0Wh.png
17:23arrdemTimMc: yes. ~0 == -1
17:23arrdem,(bit-xor (bit-not 0) -1)
17:23clojurebot0
17:23arrdem:D
17:24arrdem,(bit-xor (bit-not 0) -2)
17:24clojurebot1
17:24arrdem:P
17:24arrdemno need to multiply with -1, just xor with ~0 :D
17:24arrdemand add 1...
17:26gfrederickstoos compliment
17:27TimMcWat resolved.
17:27radsdnolen: I was taking a look at the counters example that uses om/join. the join thing seems like a bad idea to me because it means the component has to know about the structure of the entire app state
17:28radsdnolen: I made a small fork to show an alternative example where you just add the extra cursor to an existing cursor: https://github.com/rads/om/compare/counters
17:28justin_smith,(apply str (first (last (take 32 (iterate (fn [[bits left]] [(conj bits (bit-and left 1)) (bit-shift-right left 1)]) [() -1])))))
17:28clojurebot"1111111111111111111111111111111"
17:28justin_smithin retrospect "remaining" is a better name than left, in context
17:30radsdnolen: the (allow-reads (not= ...)) thing might not be the best implementation, but the advantage of doing it this way is that it's straightforward to pass in the parts of the app state that you need, and each component only has to know about a flat map of cursors that get passed in
17:30arrdemjustin_smith: what is this sorcery
17:31justin_smitharrdem: showing the bits in a long, of course
17:31justin_smithwell, 32 of them
17:31arrdemjustin_smith: &&(clojure.pprint/cl-format nil "~b" 5)
17:31arrdem~botsmack
17:31clojurebotOwww!
17:32hyPiRion##'&
17:32lazybot⇒ &
17:32arrdem,&&(clojure.pprint/cl-format nil "~b" 5)
17:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: && in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:32arrdemgerd dermert
17:32arrdem,(clojure.pprint/cl-format nil "~b" 5)
17:32clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>
17:32hyPiRionheh
17:32hyPiRion,(require 'clojure.pprint)
17:32clojurebotnil
17:32hyPiRiontry now
17:33arrdem,(clojure.pprint/cl-format nil "~b" 5)
17:33clojurebot"101"
17:33arrdem(inc hyPiRion)
17:33lazybot⇒ 27
17:33TimMc,(clojure.pprint/cl-format nil "~b" -1)
17:33clojurebot"-1"
17:33marissagrove,(+ 6 7)
17:33clojurebot13
17:33arrdemTimMc: yeah it does that. kinda silly.
17:34hyPiRionTimMc: it's a nice little cheating guy
17:34arrdemTimMc: the issue is that the JVM doesn't really have a sign bit...
17:34TimMcarrdem: Nah, that behavior of cl-format seems fine.
17:34hyPiRionThat's more about the cl format spec
17:34hyPiRionHei igjen,
17:34arrdem,(bit-and (int -1) (int (bit-shift-left 1 31)))
17:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 2147483648>
17:34arrdemhyPiRion: explain that then.
17:34justin_smithso I am vindicated!
17:35hyPiRionOh dang, wrong window
17:35hyPiRionarrdem: I meant "~b" -> -1 is according to the cl format spec
17:35arrdemhyPiRion: ah. ok. I didn't see that when I read the hyperspec last night then.
17:35justin_smithI mean there is probably an easier version than what I did, but at least mine works :P
17:37seangrovebitemyapp: What problems have you run into re: datomic from python?
17:37seangroveSpecifically, what could be so bad you'd write your own edn parser? :P
17:37bitemyappseangrove: I am somewhere in atomic rage territory on this subject.
17:37bitemyappseangrove: let me find the gif that perfectly illustrates my current status.
17:39bitemyappseangrove: http://i.imgur.com/tKu6wrM.gif
17:39bitemyappboom. Perfect.
17:39octagonis it possible to write a function #'eval-in-ns such that (eval-in-ns 'foo '(prn *ns*)) => #<Namespace foo>? Assume the 'foo namespace exists and has clojure.core refer'd in.
17:39seangroveI find myself reciting that exact mantra from time to time
17:39bitemyappoctagon: yes.
17:39seangrovebitemyapp: Isn't there a clojure meetup tonight?
17:40bitemyappseangrove: news to me. Maybe I can cry salty tears into a beer while listening to people talk about writing Clojure whilst I'm writing a parser in Python of all things.
17:40hiredmanoctagon: it is, but I find the desire for such a thing tends to result from misunderstanding the nature of clojure's namespaces
17:40bitemyappseangrove: so there is!
17:40octagonbitemyapp: i am having a hard time understanding how eval and namespaces interact. i saw the #'with-ns macro in contrib, but it resolves things at compile time
17:40bitemyappoctagon: http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols
17:40bitemyapp~contrib
17:41clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
17:41octagonhiredman: i want to be able to eval expressions entered by the user in a separate namespace at runtime
17:41bitemyappoctagon: Contrib is dead yo. ^^
17:41octagonbitemyapp: i know :/ i just found the macro there and was trying to understand it
17:41hiredmanoctagon: `(do (in-ns ...) user-expression)
17:41bitemyappoctagon: watch the presentation I linked.
17:41bitemyappAndera's explanation is among the best I've ever seen.
17:41radsdnolen: I just realized you can also just use (to-cursor) to create a new cursor from a map of existing cursors. with the change to componentShouldUpdate I linked to in my fork, these on-the-fly cursors will not update unless their child cursors change, which seems like a nice advantage over the existing implementation
17:41octagonbitemyapp: ok thank yo
17:42octagon*you
17:42bitemyappseangrove: mmmm pushdown automata
17:42bitemyappthis makes me feel like me, but 10 years ago.
17:43bitemyappcrunchy and primitive. like a hippie drinking raw milk. I can feel the botulism now.
17:43hiredmanthe easiest thing to do is just ignore it and call eval, let your users writing clojure use ns or in-ns to pick what namespace they want
17:44bitemyappoctagon: ^^ take the easy way out :P
17:44bitemyappreifying namespaces to separate data probably isn't worth it unless you're doing something incredibly sophisticated and bad.
17:44octagonbitemyapp: i will write a file and then #'load-file if i need to :)
17:45bitemyappoctagon: do whatever your nihilistic heart desires my friend.
17:45octagonbitemyapp: i kid, i kid
17:45octagonbut seriously i might
17:45bitemyapparrdem: it's a dynamically typed Lisp. Being morally deficient comes with the territory, all bets are off here.
17:46octagonmy application uses clojure as a scripting language basically, which means i need to eval the user code separately to avoid confusion with things that exist in the evaluator namespace
17:46arrdem$google clojure sandbox
17:46lazybot[How can I sandbox Clojure? - Stack Overflow] http://stackoverflow.com/questions/5258038/how-can-i-sandbox-clojure
17:46bitemyapp$google clojail
17:46lazybot[flatland/clojail · GitHub] https://github.com/flatland/clojail
17:47arrdemyeah. that one.
17:47bitemyapp$google Linux jail
17:47lazybot[chroot - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Chroot
17:47bitemyapp$google application isolation
17:47lazybot[Application Isolation: Basics and Directions | Symantec Connect ...] http://www.symantec.com/connect/articles/application-isolation-basics-and-directions
17:47bitemyapp...wut
17:47bitemyappfucking corporate SEO.
17:47hiredmanoctagon: but namespaces doesn't work like that
17:47arrdembitemyapp: one of my Plan 9 friends has this awesome proposal where mount becomes a devfile not a program
17:47bitemyapparrdem: <3
17:48arrdembitemyapp: if you chroot /dev/mount out, you've totally sandboxed yourself, because you can't mess with the FS anymore!
17:48hiredmanif you define a function F in the namespace N, the value of *ns* when F is called may or may not be N
17:48octagonhiredman: it's especially confusing for me because some things work in the repl but not in the application
17:48hiredmanout side of the repl the value of *ns* is alsomost always clojure.core
17:48hiredmannamespaces are a compilation environment
17:49hiredmanalmost
17:50octagonhiredman: but they are also dynamic, in that you can add names to them at runtime, right?
17:50justin_smithoctagon: I think it is likely more that you don't understand what the repl or application is doing. Inside a namespace or in a repl, the clojure compiler behaves the same way with very few exceptions.
17:51octagoni guess my confusion may be conflating adding names to namespaces and evaluation of forms
17:51bitemyappoctagon: perhaps it would help if you watched Andera's presentation?
17:51octagonbitemyapp: yes, i will do that. i'm tethering on my phone at the moment, but thanks i will
17:52hiredmanoctagon: sure but adding names, namespaces are basically a map that is consulted to look up vars during compilation
17:52hiredmanyou can looking values from the them in a more dynamic way, but that is how clojure uses them
17:52hiredmanthey are a compilation environment
17:53hiredmannot a runtime environment (although they do exist at runtime and can be fiddled with because this is lisp and the difference between runtime and compilation time can be rather small in the repl)
17:55octagonhiredman: perhaps i could do what the repl is doing in my application
17:56TimMcarrdem: In JS: ~~1<<35 == 8
17:56hiredmanthe repl doesn't do much in fact, I think it initial sets the namespace to user, and after that it is hands off, and it is user code that changes the value of *ns* afterwards via in-ns or ns
17:56justin_smithoctagon: if you are tempted to define something in one ns from another, that makes me think you have a poorly resolved dependency loop
17:57llasramjustin_smith: I think they're just writing a REPL/equivalent
17:58octagonthanks everyone, bitemyapp, hiredman i think i know how to proceed now
17:59bitemyapp^^ confidence I wish I had.
18:08andyf_Bronsa: ping
18:08Bronsaandyf_: pong
18:08bitemyappandyf_: dong
18:09celwellwhat's wrong? (fn [n] ((let [arr nil])
18:09celwell (dotimes [i n]
18:09celwell (conj arr i))
18:09celwell arr))
18:10bars0Hi all. I am on linux. Where leiningen puts downloaded jars?
18:10amalloycelwell: everything there is wrong. values are not mutable, and you have too many open-parens before that let
18:10andyf_Bronsa: Your recent tools.analyzer.jvm "better error messages" changes removed the :ast key from the ex-data of exceptions thrown due to bad tags. Was that data considered unreliable, or difficult to provide longer-term? It might be useful in error messages in Eastwood.
18:10bitemyappcelwell: that's not how Clojure works.
18:10amalloythat's just (range n)
18:10hyPiRionbars0: in the ~/.m2/ directory
18:11bitemyappcelwell: conj'ing a vector in Clojure returns a new vector with the value provided added to the vector, it does not mutate the original vector.
18:11bars0hyPiRion: thanks
18:11bitemyapp,(let [x [:a] y (conj x :b)] (println x y))
18:11clojurebot[:a] [:a :b]\n
18:11bitemyappcelwell: ^^
18:11bitemyappcelwell: did x change?
18:11bitemyappcelwell: what is y?
18:12celwellI'm very new to clojure. Trying to do this: "Create an array of N integers, where N is specified as input. "
18:13justin_smith,(repeat 4 42)
18:13clojurebot(42 42 42 42)
18:14justin_smithcelwell: one of the most important things about clojure is the basic types are immutible, conj does not change the input, it returns a copy that is added to
18:14CaptainLexcelwell: It would be harder to specify N than simply enter all N integers. Are they random integers or user-supplied?
18:14celwellN is just a numebr that says the length of the created array
18:15celwellthe contents of each element is ignored
18:15CaptainLexcelwell: In that case, justin_smith's example is definitely adequate
18:15Bronsaandyf_: mostly because the ast at that point is not guaranteed to be valid so I prefered to remove it, but if it's actually needed I'm sorry, I can bring it back.
18:15CaptainLexcelwell: What are you getting this problem from?
18:16andyf_Bronsa: I wouldn't go so far as to say "needed", but it is convenient, and provides some context information that isn't available in the :form key
18:16andyf_Bronsa: Let me experiment with a one-liner change to see if it brings back everything desired by Eastwood, and I can submit a patch if it works
18:16celwellhackerrank.com
18:16justin_smithcelwell: taking a closer look, it seems you were trying to write range
18:16octagon,(loop [x 0, xs []] (if (< x 10) (recur (inc x) (conj xs x)) xs))
18:16clojurebot[0 1 2 3 4 ...]
18:16justin_smith,(range 4)
18:16clojurebot(0 1 2 3)
18:17octagon^^ looping to construct an array
18:17Bronsaandyf_: fair enough -- in case, don't attach the ast directly but `(prewalk ast cleanup)` so we don't end up printing :namespaces
18:18andyf_Bronsa: Thanks for the tip. I was already working around their huge size by explicitly avoiding printing them out, but better to be surgical about it.
18:19justin_smith,(first (last (take 5 (iterate (fn [[arr n]] [(conj arr n) (inc n)]) [[] 0])))); also doable as iterate
18:19clojurebot[0 1 2 3]
18:19celwelllegitimate question: why is it so complicated to something that should seem to be simple?
18:20bitemyappcelwell: you don't know what you're doing.
18:20justin_smith,(range 5) ; celwell: it is simple
18:20clojurebot(0 1 2 3 4)
18:20octagoncelwell: it's sort of a loaded question, because you'd never do that. you'd do (range n)
18:21octagoncelwell: but there are many ways to construct sequences of things, and they're very powerful.
18:22celwellok, what's the threshold I should hold out for for seeing the benefits of clojure? (coming from php (sorry) and js/coffee)
18:22celwellso far, everything seems overly confusing to me...
18:22octagon,(take 5 (map #(* 4 %) (range)))
18:22clojurebot(0 4 8 12 16)
18:22celwellmaybe I should stick with it for a week, or what?
18:22CaptainLexcelwell: Coming from PHP to clojure is definitely going to be jerring
18:23bitemyappcelwell: if your ROI time-horizon is limited to a week, you should quit programming.
18:23CaptainLexcelwell: It will seem pretty confusing at first
18:23octagoncelwell: ^^ that maybe illustrates better how clojure can help you
18:23justin_smithcelwell: it will take much longer than that to get fp, but it is worth it
18:23CaptainLexbut hopefully, when you've stuck with it a bit, PHP will seem confusing when you go back ;)
18:23bitemyappcelwell: learning a functional language will pay off huge over the long run but you're not going to unlearn the garbage PHP and JS taught you in a single week.
18:25celwellok, these are things I'm hearing (especially with the trend of clojure this year). but, concretely, what is the single most important benefit in functional programming (over PHP e.g.)?
18:25bitemyappcelwell: there is no single most important benefit.
18:25bitemyappcelwell: taken as a whole, functional programming means working faster, thinking faster, and fewer bugs.
18:25hyPiRioncelwell: You'll be a better programmer :)
18:25CaptainLexcelwell: The single most important benefit is in how you think about the software you write
18:26bitemyappcelwell: the foundation of it is in referential transparency, functions that are like mathematical functions and return consistent results for the same arguments.
18:26andyf_celwell: I'd give it at least a week of hobby time, if you can spare it. I'd also recommend getting a book on Clojure, if the cost isn't prohibitive for you, e.g. the O'Reilly book on Clojure. Functional style programming can feel somewhat foreign to you at first (and sometimes even after a while, but less so)
18:26bitemyappcelwell: FP makes you a better programmer but until you are that better programmer you're not going to understand waht you're missing.
18:26seangrovecelwell: The second most important concrete benefit is that bitemyapp will love you and give you lots of hugs.
18:26bitemyappcelwell: http://www.paulgraham.com/avg.html
18:26bitemyappcelwell: seangrove is only half right. Instead of hugs, you Haskell lessons and free beer.
18:27bitemyappcelwell: by "hugs" he meant the Haskell repl.
18:27bitemyappyou get*
18:27octagoncelwell: i also used to do PHP. i find that it is extremely difficult for even a real pro PHP programmer to write robust large programs. but clojure is very well designed so you don't have to be such a pro to create programs that are at least maintainable
18:27seangroveHaha, well played
18:28celwelli'll stick with it, thanks
18:29octagoncelwell: my company moved from php/js to clojure/clojurescript
18:30celwellinteresting, was it hard to find devs?
18:30octagoncelwell: we have like 120K lines of PHP, so it's a difficult process to disentangle ourselves
18:30octagonbut everyone can learn it, all of the php guys are learning it and they love it
18:31bitemyappPython people at my company have had zero trouble learning Clojure, despite getting their lessons from a total prick.
18:31octagonand the clojure code is orders of magnitude more maintainable and understandable
18:32justin_smithoh man my iterate example above was so silly
18:32justin_smith,(take 5 (iterate inc 0))
18:32clojurebot(0 1 2 3 4)
18:32justin_smith*that* is how to do it with iterate
18:32bitemyappI was going to say.
18:32justin_smithyou should have!
18:32bitemyappI didn't know if you were being weird on purpose or not.
18:32bitemyappit's hard to tell sometimes.
18:32justin_smithfair enough :P
18:32CaptainLexDoes anyone have any experience with shoreleave?
18:32celwellis there a recommended subset of the core I should memorize to get started (i find myself not knowing enough functions to get anywhere in my learning)
18:33octagoncelwell: with PHP there is a lot of knowledge you need to have just to not shoot yourself in the foot when you are building a complex application, so the programmer needs years of experience and skill
18:33bitemyappcelwell: don't memorize...learn.
18:33bitemyappit's not a quiz. just read and code.
18:33octagoncelwell: clojure does not have the quirks and pitfalls of PHP, which is a huge productivity boost right off the bat
18:33CaptainLexcelwell: A lot of the core fniness of clojure is abstracted away when you right practical applications
18:34CaptainLexcelwell: So instead of taking a standardized tutorial, maybe work on some small app in the a domain you're used to
18:34celwelli agree, but still... maybe I should I look some good simple code examples
18:34CaptainLexuse Google to find libs to help
18:34celwellany suggestions on github
18:34CaptainLexs/right/write
18:34CaptainLexSomeone has a clojure koans repo, right?
18:34bitemyappthey exist.
18:34justin_smithyeah, clojure koans isn't bad for starters
18:35CaptainLexThis is a popular place to start: https://github.com/functional-koans/clojure-koans
18:35andyf_celwell: Some people have found the cheatsheet helpful: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html
18:35octagonalso maybe SICP? that really helped me when i first discovered lisp
18:35celwelli've seen koans, any real world example though?
18:35celwellthat you would suggest
18:35CaptainLexHmmm
18:35CaptainLexHow real world? Do you mean
18:35CaptainLexinteresting math, or a web server?
18:35celwellnot math
18:36celwella simple game or web app
18:36bitemyappcelwell: have you done the koans?
18:36CaptainLexSo probably not a 99 problems repo, then. Hmmm
18:36bitemyapplooking at Ring isn't going to do a lot for you.
18:36celwellno : koans
18:36bitemyappcelwell: do the koans.
18:36bitemyappcelwell: don't be lazy.
18:36bitemyappyou can be lazy after you know what you're doing.
18:36celwellill try it
18:37CaptainLexcelwell: Honestly, my recommendation for getting into functional programming is to start with the Structure and Interpretation of Computer Programs
18:37bitemyappcelwell: don't try, just do the koans.
18:37bitemyappCaptainLex: no. stop.
18:37bitemyappcelwell: don't do SICP. Just do the Clojure Koans.
18:37CaptainLex:'(
18:37bitemyappCaptainLex: I'm tapping you out. Take a break.
18:37bitemyappcelwell: if you get stuck, take a break, then get back to it.
18:37celwellI started watch mit video lectues of sicp from the 80's
18:37bitemyappcelwell: do not stop until you complete the Clojure Koans.
18:37CaptainLexbitemyapp: I wouldn't recommend the whole thing, just the first chapter. Nonetheless, I'll poke around over here
18:38bitemyappcelwell: I watched Sesame Street in the 80s.
18:38Cr8I was dead in the 80s
18:38octagonSICP was really fun for me when i was starting
18:38bitemyappinteresting definition of dead.
18:38Cr8well
18:38Cr8not alive
18:38bitemyappoctagon: Clojure Koans were really fun for me when I was starting.
18:38radscelwell: I think the best way to learn anything is to figure out something you think would be fun to make, and start making it one step at a time
18:39bitemyappcelwell: do that, but do the koans first.
18:39celwellrads: i agree, but i find myself too stuck to do that
18:39bitemyappcelwell: that's because you don't know what you were doing. You know what helps with that?
18:39bitemyappcelwell: I give you two guesses.
18:39octagonbitemyapp: different strokes, right?
18:39bitemyappoctagon: different strokes is too often used as a cover for laziness.
18:39octagonbitemyapp: you got me there. i'm the laziest dude ever
18:40celwellbitemyapp: koans?
18:40bitemyappoctagon: I've taught too many people programming in many languages to really believe it makes a damn difference. You have to do some kind of exercises.
18:40bitemyappcelwell: correctamunde. Hop to it.
18:40bitemyappoctagon: they can be bad koans, they can be good koans, but you have to interactively hammer in how things work or it'll never stick.
18:40bitemyappoctagon: blindly groping around a 'practical' project before you know what's going on takes longer than just doing koans.
18:41bitemyappit's also less profound and more subject to cargo culting.
18:41octagonbitemyapp: i didn't get into clojure until like a year after reading and rereading SICP. i was just enjoying thinking about it, cause the idea of lisp was new to me
18:41octagoni didn't even do much scheming really, just thinking about it
18:42octagonmy day job was not computing at the time
18:42celwellone more question: are there any habits I should avoid as I start to develop my clojure 'technique'?
18:42bitemyappcelwell: don't cargo cult.
18:42bitemyappcelwell: if you think X is true, don't just minimally prove X is true - try to break the assumption with code that you think would demonstrate the opposite.
18:42bitemyappcelwell: use the REPL, interactively poke around
18:43bitemyappcelwell: the biggest thing that will prevent you from learning Clojure is being in IRC asking questions instead of doing koans.
18:43bitemyappcelwell: that leads to 90%++ of failures to actually learn Clojure.
18:43CaptainLexHahahaha
18:43Cr8get a REPL
18:43Cr8*play*
18:43bitemyappCr8: the koans will take care of that.
18:43bitemyappor should, anyway.
18:43bitemyappI would hope. :|
18:44celwellthanks for the advice, ciao
18:44justin_smithwell the koan interface isn't directly a repl though, it is a good reminder to also play in the repl as you go
18:45CaptainLexGood luck celwell!
18:45akhudekhmm, I guess core.matrix has no support for float matrices
18:45bitemyappeggscellent. The empire spreads!
18:46hiredmanakhudek: what do you mean by that?
18:46bitemyappakhudek: does it matter if you have a 64-bit machine?
18:46bitemyappI think that's why nobody bothers.
18:46akhudekhiredman: e.g. versus double, mostly for memory saving reasons
18:46akhudekexclusively for memory saving reasons
18:46bitemyappoh, so it's not for throughput.
18:47bitemyappweird use-case.
18:47hiredmanakhudek: sure, but what do you mean by no support?
18:47akhudekhiredman: all the implementations only support double data type
18:47justin_smithakhudek: clojure uses 64 bit numerics by preference, but you should be able to put floats in a vector and use that with core.matrix
18:48bitemyapp(inc justin_smith)
18:48lazybot⇒ 25
18:48akhudekjustin_smith: I might try that, thanks.
18:49hiredmanjustin_smith: clojure vectors box, so you if the intent is to avoid memory pressure by using 32bit numbers I doubt you want boxing
18:50akhudekhiredman: good point. I should have remembered that I ran into that at one point.
18:51hiredmanthere are primitive vectors (that can hold primitive values) but they are not often used, and I imagine most code that just assumes clojure's regular vectors will break / convert the specialized vectors to regular vectors
18:51bitemyappmust be irish if they box so prolifically.
18:51justin_smithhiredman: true, but can't the libs use floats? or are they typehinted everywhere for doubles only?
18:51hiredmanjustin_smith: I don't know
18:52hiredmanjustin_smith: I imagine they are just going with clojure's flow
18:52bitemyappjustin_smith: I think it's pretty hard to keep Clojure from messing with 'em.
18:52hiredmanthe 64bit types are just better supported
18:53bitemyappakhudek: probably cost less to buy RAM.
18:53thirdyis there a channel for lighttable?
18:54thirdy#lighttable?
18:54akhudekbitemyapp: debatable with our hosting provider :-)
18:54akhudekI can probably make do with 64-bit for now though
18:54akhudekwe'll see
18:55mullrvectorz-clj, one of the core.matrix backends, doesn't appear to use boxed primitives. (fwiw)
18:56justin_smithmullr: yeah, but can it use unboxed floats? I would assume all the core.matrix libs would at least have the option of unboxed doubles
18:56akhudekvectorz is double only
18:56mullralasa
18:56mullr* alas
18:57akhudekthe core.matrix code mentioned an ndarray-float implementation, but it claimed it was missing when I tried to access it
18:57justin_smithakhudek: how much of core.matrix do you need? maybe you could get by with hiphip?
18:58akhudekjustin_smith: I'm not doing much at this point, I may just write some custom routines to use a float array
18:58justin_smithakhudek: well, hiphip does low level unboxed arrays of arbitrary types, and would likely be a head start with something like that
18:59justin_smithhttps://github.com/prismatic/hiphip
19:00akhudekhiphip is worth a try too
19:00bitemyappabara
19:00bitemyappdammit
19:00justin_smithbitemyapp: wow, hiphip does "parameterized modules" by defining a type variable followed by load-file
19:01justin_smithlol
19:04bitemyappjustin_smith: looking at it now. That's hilarious.
19:04justin_smithfor the lack of functors!
19:07akurilinseancorfield: just saw your reply from a month ago about using straight sql for migrations. Glad to find out I'm not the only one not to use a clj library to handle that.
19:07akurilinactually using ruby's standalone_migrations, worked fine for the past half year.
19:09seancorfieldakurilin: well, we started off with plain SQL migrations and a non-Clojure process for running them (via Ant!)
19:09bitemyappjustin_smith: if you want to go down the rabbit-hole: http://donsbot.wordpress.com/2009/10/11/self-optimizing-data-structures-using-types-to-make-lists-faster/ http://lpaste.net/71651
19:09bitemyappakurilin: I use a clj library, but it's processing .sql files.
19:09seancorfieldSo moving to a Clojure process to run the same SQL migrations was just a logical step for us.
19:09philedjustin_smith: Sorry if this is naive --- I haven't read the code --- but why would you need functors in a dynamically typed language? Just use functions from dictionaries or something?
19:10justin_smithphiled: the code uses type declarations to create unboxed collections
19:10bitemyappphiled: it's not about need, it's about scaling up your programming when you need to and abstracting away details.
19:10akurilinseancorfield, bitemyapp so essentially no DSL, just something running SQL against your target DB,right?
19:10justin_smithit redefines the type to declare, then redefines everything in a new ns
19:10bitemyappfor functors in general.
19:10bitemyappakurilin: in my case, yes.
19:10philedjustin_smith: Ah, it's typed.
19:10seancorfieldakurilin: correct.
19:11akurilinbitemyapp: in your case, does clj just manage sql table with migration ids in it, or something of that sort?
19:11akurilin*a sql table
19:11bitemyappakurilin: just look at Migratus.
19:12seancorfieldakurilin: we have a table with a "db level" in it and that selects which migrations need to run (and then we update it)
19:12bitemyappakurilin: be aware, I stopped using SQL databases for the most part.
19:12bitemyappakurilin: you don't want a single monotonic db level if you can avoid it - Migratus lets you avoid that and not implement anything yourself.
19:12justin_smithphiled: also, functors are an alternative to what we do with protocols / multimethods, which are less about defining classes and more about using functional composition to create new implementations of operations on existing types
19:13bitemyappphiled: in particular, functors are part of a much larger family of algebraic constructs that can be used to abstract your programs.
19:13bitemyappphiled: functors, applicative functors, monoids, monads, foldables, traversables, arrows, etc...
19:13akurilinbitemyapp, seancorfield interesting, I've never dealt with this issue. So you have a tree-like migration path of sorts rather than one line?
19:13bitemyappakurilin: look at Migratus.
19:13philedOh, you mean functors as in Haskell, not Ocaml.
19:14bitemyappakurilin: there's no point in my saying anything that Migratus' documentation would more accurately explain.
19:14bitemyappor source.
19:14akurilinbitemyapp: fine fine :P
19:14bitemyappakurilin: I stopped using SQL databases. when I last used one, I used Migratus.
19:14bitemyappakurilin: there's a reason I haven't touched Korma in awhile.
19:14bitemyappphiled: what distinction do you suppose you're making here?
19:16philedbitemyapp: Parameterised modules versus endofunctors on your type system.
19:16bitemyappphiled: do you think functors in OCaml are somehow not endofunctors?
19:16alew besides parametization, what's wrong with clojure namespaces?
19:17bitemyappphiled: what do you think is more likely? That there is a schism in PLT and category theory, or that two different languages are using a VERY general category theoretic construct in two different ways?
19:17bitemyappphiled: a functor is a functor.
19:17philedbitemyapp: I could be persuaded :) But no, I tend to think of functors as functions of modules, and modules not being Ocaml types.
19:18akurilinbitemyapp: that's fair.
19:18bitemyappphiled: this is partly why I recommend people learn Haskell instead of OCaml, it lets to them believing fewe things that are silly.
19:18hiredmanthe load-string hiphop does is kind of gross, I would have used a macro
19:19bitemyappphiled: Functors in OCaml are about abstracting types. Functors in Haskell are about abstracting types.
19:19bitemyapphiredman: sounds like a micro-library waiting to happen.
19:20philedbitemyapp: Abstracting types?
19:20bitemyappphiled: http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01-refman.html#sec20 what does the first line say there?
19:20bitemyappphiled: it's the same exact thing in Haskell, they're just being reified to the compiler and used in a weird way in OCaml.
19:20philedFunctors are functions from structures to structures. In other words, parameterised modules, as I said.
19:21bitemyappphiled: that the structure they're parameterizing is a reified module thingy is an implementation detail.
19:21bitemyappphiled: it doesn't make them not-Functors.
19:21philedThey have totally different use-cases.
19:21bitemyappphiled: really?
19:22bitemyappbecause AFAICT, the Haskell community uses them in the same way, just in a more general way that isn't reified to the compiler for the module system.
19:23hiredmanhttps://gist.github.com/8230036
19:23philedI'm happy to compare Ocaml functor with Haskell type-classes, since those are often used in the same way. But I wouldn't compare Ocaml functors to the Haskell type-class Functor.
19:23bitemyappit doesn't become "not a functor" just because you're narrowing down the scope of how it's used to a single one-off use-case
19:24philedI'd write an Ocaml functor to implement the equivalent of Haskell's Functor type-class.
19:24bitemyappphiled: hum, that's getting closer to protocols and the like, yeah.
19:24bitemyappphiled: but the functor isn't why you get to do that.
19:24bitemyappphiled: it's the parameterized module.
19:24bitemyappthat they're functors is a bit of a "gimme"
19:25philedI'm not sure what you're saying.
19:25bitemyappit's like saying, "but our product is built by programmers that suck air!"
19:25bitemyappwell yeah, sure, but that's a bit of a facile and meaningless point to make about a product.
19:25bitemyappfunctors are so general that a lot of programmatic patterns can be modeled as one.
19:25philedIf you want to talk about formal translations between the two concepts, I'm all ears.
19:25bitemyappphiled: SPJ has thoroughly covered that territory IIRC.
19:26bitemyappphiled: he's been soliciting feedback on a similar module system for Haskell.
19:27philedbitemyapp: In the Isabelle theorem prover, you have type-classes and an ML style module system. They play nicely together, but they have different uses.
19:27bitemyappbut seriously, think about it. (a -> b) -> f a -> f b could be virtually anything.
19:27bitemyappphiled: I stay in Haskell land, so if I did anything with proofs it'd be in Agda or Idris.
19:27philedOtherwise, they wouldn't have bothered adding in the type-classes.
19:27philedIsabelle has Haskabelle!
19:28bitemyappphiled: yeah uh, after seeing Coq's "Haskell" support, I'll pass.
19:28philedIt's pretty good at verifying Haskell programs, though it isn't going for Curry Howard.
19:28bitemyappphiled: I think you misunderstood what I was saying.
19:29noncomi use the lein "checkouts" feature and there is a problem. if the project i am in does not enlist all the dependencies of the project i am referring to, it fails to find them. I assume, it must take it from the referred project but it does not. Is this the intended behavior?
19:29bitemyappIt wasn't an assertion of complete equivalence at the practical level.
19:29bitemyappphiled: I was addressing a question that was originally about functors in the abstract.
19:29bitemyappphiled: you dove into something that you seem to have misconstrued as being specifically about particular programming languages.
19:30noncomtechnomancy: ping
19:31philedbitemyapp: Not sure. justin_smith was referring to parameterized modules when he used the term "functor." That sounds quite specifically like the Ocaml sense of functor.
19:34alewWhat's the best intro to category theory?
19:34philedalew: Depends on your background.
19:34philedIt's a classic bootstrapping problem.
19:36bbloombitemyapp: justin_smith: dammit! i missed a modules/functors discussion :-P
19:36bbloomi've felt the need for those myself a few times
19:36philedI've found that most cat theory texts start out by saying: hey, to understand monads, just think about homotopy theory! And I go: what the f**k is homotopy theory?
19:36bblooma protocol just doesn't cut it
19:37philedbbloom: I'll bite! Why do you want modules/functors?
19:37alewphiled: what backgrounds matter?
19:39noncomwhat's wrong with monads definition here? https://en.wikipedia.org/wiki/Monad_(functional_programming)
19:40bbloomphiled: i was just trying to explain, but realized i'd need to explain one of the projects i ran in to the problem with, etc
19:40bbloomphiled: the hiphip use case is an obvious one for dealing with unboxed values, but there are other times too
19:40bitemyappbbloom: look at hiredman's paste and the prismatic/hiphip code.
19:40bitemyappoh, you've seen it then.
19:41bitemyappnoncom: seems okay.
19:41philedbbloom: Are there any cases where you're not dealing with type annotations (as I assume you are talking about unboxed values)?
19:41technomancynoncom: hi
19:42bbloomphiled: yeah, so there are a number of OOP patterns that are better served by modules
19:42bitemyappphiled: cat theory and homotopy theory are complementary, IMO.
19:42noncomtechnomancy: hi! please read above ^^
19:42technomancythe behaviour you describe is intentional
19:42noncomso i just have to include all deps in the present project, right?
19:42bbloomphiled: the difference is subtle... it's kinda like ruby style metaprogramming vs macros
19:42bitemyappbbloom: or functors. or monoids. or monads. or applicatives, etc etc etc
19:42technomancynoncom: yes, :dependencies must be complete
19:43bbloombitemyapp: i'm talking specifically about ML style parameterized modules. not any category notion of functors
19:43KeithPMGood day all. I would like someone to review a function I wrote for creating permutations. I am having an issue of inability to convert a java.lang.Long to Object[]. https://www.refheap.com/22414 (Warning) I may have transgressed by creating a function to append an item to the end of a sequence :) Bear with me, it's an academic exercise in recursion at this point
19:43bitemyappbbloom: my point was about ditching OOP for more principled concepts.
19:43noncomtechnomancy: i see, thanks!
19:43bitemyappbbloom: but yeah, parameterized modules are nice.
19:43bbloomh ok
19:43bbloomah* ok
19:43bitemyappbbloom: but a more general notion of how to model algebraic concepts and their associated laws in your language is better.
19:44justin_smithwe should be able to make these work in clojure right? I have wanted them for a while
19:44bbloomphiled: anywhere you'd do heavyweight dependency injection in java land, is a case a module might make more sense
19:44bitemyappPimp Thy Compiler is not exactly principled.
19:45arrdembitemyapp: hey now... unprincipled sure but durn effective
19:45noncomKeithPM: could you update the reafheap with instructions on how you cal the functons, so we could call them too, like you do?
19:46KeithPM:noncom OK will do...
19:46bbloomphiled: for example, i had an interpreter-like-thing and then wanted to create a compiler-like-thing, but wanted to be able to have the interpreter around still to test with. unfortunately i had to either A) have two *separate* code bases B) create lots of protocols or C) do what hiphip did and cheat with something like load-string
19:46bitemyapparrdem: sorta? OCaml isn't really playing with a full deck.
19:46philedbitemyapp: Ah, I think modules are great for that. Haskell style type-classes force you to choose a canonical model, and other models be damned.
19:46bitemyapparrdem: if by durn effective you mean, "ghetto with one and only one thing anybody wants to steal from it"
19:46hiredmanwe have macros, load-string is gross!!!
19:47bitemyappphiled: that is a pretty poor mischaracterization of the differences.
19:47arrdemevery time I see eval() in another language... the rage...
19:47justin_smithhiredman: they mention in the hiphip comments "it's either this one load or a huge pile of macros"
19:47philedbbloom: You want protocols to allow you to write generic code?
19:47bbloomhiredman: i put your macro in the same category as C
19:47bbloomphiled: no, i don't. but that's what you need to do in java, for example
19:47bbloomwe have macros, so we can do static metaprogramming
19:47hiredmanjustin_smith: I doubt they are doing what I am thinking of
19:48hiredmanif you see by last gist, it is one macro
19:48bitemyappphiled: how much Haskell have you done exactly and is your name Robert Harper?
19:48bbloombitemyapp: i disagree with so much shit robert harper says :-P
19:48hiredmanthinking about it would be best to add something that pushed the namespaces in to loaded-libs
19:48philedbitemyapp: I do love Robert Harper. But I've done plenty of Haskell and Ocaml.
19:49justin_smithhiredman: ahh, I missed that, much nicer
19:49bbloombitemyapp: either that, or he's just unable to communicate with mortals & i perceive disagreement
19:49bitemyappphiled: You should drink a little less Harper kool-aid.
19:49KeithPMOK updated https://www.refheap.com/22414
19:49philedWhat makes you think I've drunk any?
19:49bitemyappbbloom: he's an authority on PLT and TT, but he's such an extremist that if his interests had been in politics, he'd have been a terrorist.
19:50bbloomheh
19:50bitemyappbbloom: a violent one.
19:50KeithPM:noncom I have updated https://www.refheap.com/22414
19:50bitemyappbbloom: he has a hard time imagining that there might be countervailing concerns in PL design.
19:50bitemyappand he has a hard time understanding why others might have their priorities configured differently.
19:52bitemyappphiled: the components of what people use ML functors for are, in Clojure parlance, more "decomplected" in Haskell.
19:52bitemyappphiled: you cannot obsess over comparing ML functors to typeclasses alone and get the whole picture.
19:52philedbbloom: Ack. I'm not sure what to make of what you've said. You've got compiler-like thing and interpret-like thing. What do you want in terms of modules?
19:52bitemyappphiled: the power-to-weight ratio that results is better.
19:52bitemyappand easier to understand in isolation.
19:52philedbitemyapp: Not sure what you're talking about.
19:53bbloomphiled: i'm saying that i had two implementations of some library that had a common interface, but that interface did not all have a nice friendly THE-SYSTEM as the first argument to dispatch on
19:53bitemyappphiled: ML functors aren't that great and there are better ways to solve the constellation of problems it tries to address all at once.
19:53bbloomso if i were to use protocols to make it polymorphic, i'd have to a factory protocol & then various protocols for all the dispatched args in that interface
19:53bbloomand then thread through a factory pointer everywhere
19:53bbloomit woulda just been java
19:53bbloomlol
19:53bitemyappI'm starting to see why Sierra's approach makes people mad.
19:54philedbitemyapp: I'm not enamored by ML functors.
19:54bbloomthere are two interesting papers on functors & type classes
19:54bitemyappbbloom: do tell.
19:54bbloomone that creates two transformations, one in each direction
19:54bbloomand another that talks about adding "implict" to modules to approximate type classes
19:55bbloomlet me dig them up
19:55philedbitemyapp: I've got an Ocaml monad library in OPAM, and I found the syntax of ML modules so horrendous, that I suspect they'd never have been discovered in ML.
19:55bbloomhttp://lambda-the-ultimate.org/node/1558
19:55bbloomwww.mpi-sws.org/~dreyer/papers/mtc/main-long.pdf‎
19:55bitemyappphiled: at least Async shows one way to make reasonably sensible use of monads.
19:56bitemyappbbloom: thanks, now I have something to read during the Clojure meetup.
19:56noncomKeithPM: hmmmm...
19:56bbloombitemyapp: async uses monads only b/c i got to tim too late to convince him to use a concatenative DSL in place of his state monad :-P
19:57philedbbloom: I'm just not sure how parameterised modules would help. This might sound naive, but if you want parameterised modules in Clojure, just turn modules to dictionaries and have those dictionaries as the first argument to functions representing functors. The syntax will only be as horrible as ML.
19:57bbloomphiled: that's a dynamic technique, i want a static one
19:57arrdemBronsa: do you have docs somewhere of the AST format that tools.analyzer(.*) emits?
19:57bbloomsee also http://docs.racket-lang.org/reference/mzlib_unit.html
19:57KeithPMnoncom: Headache?
19:57bitemyappphiled: I'm with bbloom, I'd want a static one.
19:57bbloomwhich is a modules-like construct in a scheme
19:58bbloomguide is a better doc page for this: http://docs.racket-lang.org/guide/units.html
19:58bitemyappbbloom: I don't like arbitrary DSLs. They don't compose like monads.
19:58noncom,(vec 3)
19:58clojurebot#<RuntimeException java.lang.RuntimeException: Unable to convert: class java.lang.Long to Object[]>
19:58noncomsee
19:58KeithPMnoncom: OK...
19:58bbloom"A unit resembles a procedure in that both are first-class values that are used for abstraction. While procedures abstract over values in expressions, units abstract over names in collections of definitions."
19:58noncomyou do (map vec a-seq)
19:58noncomwhich maps (vec) over longs
19:58bbloomunit==module, but racket already fucked up & called it's namespaces modules :-P
19:58bitemyappbbloom: nutty.
19:58KeithPMYes.. I was worried about that, but I was 'hoping' that I would always receive a sequence... OK... I will double check
19:59philedbitemyapp: You mean async in Ocaml?
19:59noncom,(vec [3])
19:59clojurebot[3]
19:59philedI've only ever played with lwt.
19:59noncom,(vec (seq 3))
19:59clojurebot#<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Long {:instance 3}>
19:59bbloombitemyapp: you wouldn't have recognized it as DSL
19:59KeithPMnoncom: Thanks... Will fix it :)
19:59noncomyeah
19:59bbloombitemyapp: it would basically just be a reduce over a lazy seq of "instructions"
19:59bbloomlike Fipp is :-)
20:00bitemyappbbloom: there is a reason people are moving towards monadic GLL parser combinators :|
20:00hyPiRionuh eh, not sure how parameterized modules in Clojure would make nasty syntax
20:02philedhyPiRion: If you want to write generic code in Ocaml, you end up having to wrap all your code in a parameterised module that has arguments for all the modules that are defining your interfaces. It's pretty horrible. OO is more lightweight, and makes sense with multiple dispatch.
20:03bbloomOO & dispatch don't make any kind of sense at all :-P
20:03philedYou still lose if you want to write functions that return generic values.
20:04bitemyappwhich Haskell accomplishes just fine.
20:04bitemyappHaving generic functions that participate in parameterized typeclasses, that is.
20:05hyPiRionphiled: yeah, but that's not necessarily how it needs to be done in Clojure
20:05noncomKeithPM: idk if you've fixed it, but using "vector" instead of "vec" does it
20:05hyPiRionYou could probably make it like Erlang's parameterized modules, granted with a slight performance penalty
20:06KeithPMnoncom: OK... I was trying to convert sequence but I will use try vector instead
20:17bitemyappphiled: bbloom - http://www.haskell.org/haskellwiki/Polymorphism#Ad-hoc_polymorphism this bit is important.
20:17bitemyappto me, anyway.
20:17audaxioncan anyone point me to a good podcast for learning clojure?
20:19pdurbinaudaxion: http://feeds.feedburner.com/thinkrelevance/podcast
20:19audaxionpdurbin, thanks
20:20bitemyappit really worries me that Bing is faster to use to get directions than Google Maps these days.
20:22bbloombitemyapp: agreed. was literally just talking w/ dnolen about delegation earlier, which is basically the dynamic version of newtype + auto deriving
20:23bitemyappbbloom: you can't do generalized newtype deriving in a sound way.
20:23bitemyappbbloom: you can make it work in cases that'll make a demo go smoothly, but you can't rely on it.
20:23bbloombitemyapp: good thing i could care less about soundness :-P
20:23bitemyappcouldn't*
20:24bbloomi couldn't care less what the correct expression is
20:24bitemyappbbloom: I have varying degrees of "give a fuck"-ness about soundness, but I'm serious, you can make incorrect programs from generalized newtype derivation.
20:24bitemyappthere are times with violating soundness does and does not matter. This isn't one of those cases I'd happily ignore.
20:24bitemyapptimes when*
20:24Bronsaarrdem: not yet, sorry, that's something that I need to do :/
20:25arrdemBronsa: nbd. I'm just hacking together the IR for an assembler suite and I'd like it's representation to match yours for obvious reasons.
20:25bitemyappbbloom: if your program isn't correct, you can't get very far with the fancy toys at your disposable - and worse - if you use pimp things out too much you won't even know which bad idea is responsible for the fuckery.
20:25bbloombitemyapp: sure, but the point is that newtype == a wrapper in a dynamic context, which we can trivially create with (deftype Wrapper [wrapped]) but then you have the new problem of how to make it 90% like the wrapped thing, since that's what you usually want
20:26bbloombitemyapp: yeah, but most folks can't be trusted w/ deftype and defrecord right now anyway, so it's just an extension of that problem :-P
20:26bitemyappIt's more than that.
20:26bitemyappGNTD can fuck anybody, not just clueless people.
20:27bbloom*shrug* i haven't fully internalized the benefits & pitfalls yet, just starting to think more about this stuff
20:28bitemyappbbloom: hacking Haskell is a good way to get a direct handle on it.
20:28bbloombitemyapp: i know enough haskell to know that i disagree w/ a few fundamental things that have a major impact down the line on these things too. we've talked about some of that stuff before
20:29bbloomeg i think return type polymorphism is a bad idea :-P
20:29bitemyappbbloom: there's a way to make GND sound and safe.
20:30bitemyappbut you have to go further down the types rabbit-hole.
20:30bbloombitemyapp: i have some ideas about going further down the dynamic rabbit-hole :-P
20:30peregrin_anyone have good/bad experiences using korma?
20:31bbloombitemyapp: in short, i think that staging is better than typing
20:31bitemyappbbloom: sigh, there's nothing unique or special about "dynamic", you're going to have to learn how to do it right from a type-theoretic point of view.
20:32bitemyappbbloom: you're being foolish, you're better than that. Look here for the current state of making GND safe: https://ghc.haskell.org/trac/ghc/wiki/Roles
20:32bbloombitemyapp: you're assuming you understand my entire perspective from two sentences in IRC, note that you expect i'm better than that, then still call me foolish?
20:33bitemyappbecause it's not about ego.
20:33bitemyappbbloom: you're going to have to drop the uni-type fetishism if you want to at least reach parity with the current body of understanding on PLT - such as how to attack problems like GND.
20:34KeithPMnoncom: I think I actually need vec. Vector doesn't convert the inner sequences to vector, it just wraps a vector around the sequence. I will probably have to ensure that I don't get to an integer... Stop at singleton or something... I'll take a look. Thanks
20:34dnolenbitemyapp: "current body of understanding on PLT" eye roll
20:34bbloombitemyapp: i'll drop the uni-type fetish when the PLT community drops the uni-type-system fetish
20:34bitemyappdnolen: http://ro-che.info/ccc/17
20:35bbloombitemyapp: i won't claim to be a professional with type theory, but i certainly know it a whole hell of a lot better than most dynamic typing proponents. i'm firmly in that red/green spot
20:36bitemyapptype theory in uni-typed languages is like removing the clutch from a vehicle and marvelling at how "fast" your car goes when you rev it to 9,000 RPM
20:36akhudekperegrin_: not my preferred sql lib. Feel it bundles too much and doesn't have clean escape hatches to raw jdbc.
20:37bbloombitemyapp: "uni-typed" is rhetoric. it's not a useful descriptor of anything
20:37bbloombitemyapp: it's clearly a good idea to design a language that is highly amenable to static analysis, especially formal analysis, such as by modern type systems
20:38bbloombitemyapp: but to call such a language uni-typed b/c it enforces types at runtime is just plain silly
20:38bitemyappperegrin_: if you want the opinion of a Korma maintainer, you might be better off with HoneySQL unless you're interested in working on a Korma refactor.
20:38peregrin_akhudek Honey will have to be it, korma seems to be dead or dying :/
20:39bitemyappperegrin_: it's not dead, we're just waiting for somebody to give enough of a fuck to actually do something about it.
20:39bitemyappone of the maintainers doesn't use SQL databases much anymore and doesn't have time to dump into a library nobody else will contribute to.
20:39bbloombitemyapp: since we were linking to dmbarbour's mad scientist ravings earlier: http://awelonblue.wordpress.com/2013/09/04/staging-is-simpler-than-type-checking/
20:39peregrin_bitemyapp sounds like the definition of death to me..
20:40akhudekbitemyapp: what would you want beyond what honeysql gives?
20:40peregrin_akhudek bitemyapp not everyone is in love with manually writing yet another insert/update/parse results function
20:41bitemyappakhudek: schema-awareness.
20:41bitemyappakhudek: honeySQL is pretty spare. It's really just a SQL generator.
20:41peregrin_extremely spare
20:41peregrin_just a SLIGHTLY better way to write sql in clojure
20:42bitemyappbbloom: you might be misconstruing what he's talking about here.
20:42bbloombitemyapp: i am not
20:42akhudekbitemyapp: I mocked up the start of a schema aware lib the other day, though not sure where to go with it. Found that I could easily pull a schema from an sql database into clojure and then use it for some light sql generation + checks for things like column name typos.
20:42bitemyappbbloom: preference for statically verified type systems does not mean the disinclusion of libraries with uni-typed APIs/objects.
20:43bitemyappbbloom: preference for uni-typed languages almost always means you cannot and will not design a sane or safe type system for verifying your programs.
20:43peregrin_akhudek thats what ruby/sequel does. it works pretty great
20:44bbloombitemyapp: uni-typed is already an insufficiently defined phrase, you're making an insufficiently substantiated generalization, and then attributing that position to me
20:46akhudekperegrin_: the main problem I see in many sql generating libraries is that they try to be the sole interface to the database + completely hide it under some abstraction layer.
20:46akhudekI see the value in generating sql for common use case patterns though
20:47peregrin_akhudek look at Sequel for ruby, it does a really good job of abstracting SQL into ruby syntax but then giving you super simple prepared statements that returns hashes.
20:49peregrin_i mean you can go super deal and use it like active record. or you can use it like honeysql. or you can use it just to make pstatements. I seen absolutely nothing like this in clojure...
20:49peregrin_deal/deep i/i've
20:50bbloombitemyapp: i think it is perfectly reasonable/acceptable to design a language that has provably safe runtime behavior, but programs in that language can not be proven free of certain common classes of errors, as long as approximate reasoning is generally free of common classes of errors
20:50bbloombitemyapp: see also http://www.cse.chalmers.se/~nad/publications/danielsson-et-al-popl2006.html
20:52bbloomapproximate reasoning == it's A-OK to create a logical system that abstracts over some details and fails to validate some subset of useful programs or fails to detect some subset of erroneous programs
20:52seangrovebbloom: I've very much come around to the idea that programs should be amenable to static analysis, whatever that means. I think types are a good idea, but maybe not the only one.
20:52akhudekperegrin_: interesting, thanks for the link
20:53seangroveperegrin_: https://twitter.com/peregrine ?
20:53peregrin_seangrove yes :) how you doing man?
20:53bbloomseangrove: agreed. hence my stance on optional type systems
20:53bbloomand my lack of caring for soundness
20:53bbloom:-P
20:54seangroveperegrin_: Doing well, cool to see you hacking with clojure!
20:54peregrin_akhudek it makes me life really hard whenever I'm like "clojure looks cool I know I'll write my next api in it"
20:54peregrin_seangrove been wanting to forever. Backing off elixir cause its pretty green
20:55seangroveWell, the om/react, core.async. core.typed, cljs ecosystem is pretty lovely
20:55seangrovePossibly throw in datomic there as well, but I haven't had a chance to properly play with it
20:56peregrin_seangrove yea cljs is a ton more exciting than clojure proper to me :) I wish they would decide to actually launch it
20:56seangrovebbloom: I guess I missed your stance on optional typing systems - they're not worth it, or they're an amenable approach?
20:56peregrin_seangrove I mean how long has it been "alpha"?
20:57seangroveperegrin_: Well, hack on it. We have two apps in production (well, one in production, one in alpha), and it's easy to get patches in
20:57seangroveAnd it's fun to hack on anyway
20:57bbloomseangrove: my firm and clear stance is that your language's observable semantics should not depend on your type system
20:57peregrin_seangrove yea, hard to sell to a client "going to use this alpha software" gotta use it on my own projects
20:57bbloomseangrove: however, my design criteria for a new language, should i design one, would include co-development of a modern type system, as to ensure the language is highly amenable to such reasoning
20:58seangroveperegrin_: I don't know exactly what the hold up is, I think dnolen has a few things he wants to get done before a 1.0
20:58UltimateEyePatchbbloom, are you an expert on clojure?
20:58seangroveUltimateEyePatch: If anyone is....
20:58UltimateEyePatchExcellent
20:58UltimateEyePatchbbloom, you can't combine recur with apply can you?
20:59arrdemUltimateEyePatch: correct. recur is a special form not a function.
20:59bbloomseangrove: aw, thanks :-P
20:59peregrin_seangrove yea it seems easy enough to use with cljsbuild and I ran into zero front end bugs using it
20:59bbloomUltimateEyePatch: you can address the whole room with that question
20:59seangrovebbloom: It's an interesting problem designing a language meant to be consumed by tools with enough metadata to soundly reason about it
20:59peregrin_with a demo app*
20:59UltimateEyePatcharrdem, is there any way to recur variadically?
20:59UltimateEyePatchbbloom, but I'd rather address you...
20:59UltimateEyePatchYou re my special favourite
20:59arrdemUltimateEyePatch: how would a vardic return make any sense?
21:00UltimateEyePatcharrdem, well ehh
21:00UltimateEyePatchlike, reduce in clojure
21:00UltimateEyePatchfold-left
21:00UltimateEyePatchIs not variadic, or is it?
21:00bbloomseangrove: tools already deal with this sort of thing. most transformations IntelliJ does, for example, have reaaaaallly esoteric edge cases. turns out that they just cover the majority of realistic things that realistic programs do & then have check-as-you-go UI plus some log output with warnings, if a non-provably-correct refactoring occurs
21:00arrdemUltimateEyePatch: nope. fold left isn't.
21:00UltimateEyePatchCan it be made variadic and still be tail recursive?
21:01UltimateEyePatchMaybe some kind of double reduce?
21:01arrdemUltimateEyePatch: not really...
21:02seangrovebbloom: Yeah, but it's quite a lot of effort in java to provide enough meta-information for tools to ready - repeated types, public/private, etc.
21:02UltimateEyePatchSo you have to make reduce, reduce2, reduce3, reduce4 etc for allt he cases yu might need?
21:02UltimateEyePatchOr grow stack space
21:02bbloomseangrove: oh yeah, for sure, better language design w/ toolability in mind is a big deal. agreed. my point was just that approximate reasoning is OK :-)
21:02seangrovebbloom: Ah, I see. I'm hesitant, but it's probably true.
21:03arrdemUltimateEyePatch: what you propose is silly. What problem are you trying to adress here? refheap preferred.
21:03bbloomseangrove: like LINQ choosign to use `from x select y` instead of `select y from x` so that you can autocomplete when you type y
21:03seangrovebbloom: Ah, you mean as a language design?
21:04seangrove(of LINQ)
21:04UltimateEyePatcharrdem, well, sometimes you need to fold/reduce 2 lists at once.
21:04UltimateEyePatchSo, you can then just define a reduce2 function for that and no problem
21:04UltimateEyePatchSometimes 3, so you make reduce3 and so fourth
21:04bbloomseangrove: yeah, linq was carefully designed to be familiar to people who know SQL, but much more friendly to Visual Studio users :-)
21:04arrdemUltimateEyePatch: stock reduce provides that behavior unless I miss my mark..
21:04UltimateEyePatchIt'd just be cleaner if these were all one function
21:04UltimateEyePatcharrdem, I've just been told that reduce can only reduce 1 list
21:05arrdem,(doc reduce)
21:05clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
21:05bbloomUltimateEyePatch: arrdem: reduce over a (map vector ...)
21:05seangroveClever
21:05arrdemUltimateEyePatch: yep that's the pattern.
21:05bbloom(reduce (fn [acc [x y]] ...) (map vector xs ys))
21:06bitemyappbbloom: No thanks.
21:06bitemyappbbloom: I'm okay with allowing some possibly invalid programs, but soundly typed programs are a sensible default.
21:06bitemyappbbloom: static analysis is good for many things, type checking is only one of them.
21:06arrdemUltimateEyePatch: you could define a macro or wrapper fns, but you'd just be wrapping that pattern.
21:07bbloombitemyapp: um, that's what i've been saying
21:07bitemyappbbloom: but what I'm saying is that you should start with a static/strong/functional/non-strict language and only step outside of that paradigm strictly when necessary on a case-by-case basis.
21:07UltimateEyePatchWait, (vector list) returns a vector with all of the elements of list right?
21:07UltimateEyePatchIt doesn't return a vector which only contains list and stuff
21:08bitemyapp,(vector '(1 2 3))
21:08clojurebot[(1 2 3)]
21:08bitemyapp,(vec '(1 2 3))
21:08clojurebot[1 2 3]
21:08UltimateEyePatchAhhh
21:08bitemyappbbloom: ^^ these things are easier to understand if you had a type signature for vector and vec.
21:08bitemyappalas. :|
21:08UltimateEyePatchWell, then then I don't it, then (map vector xs xys) basically contains a list of 2-size vectors right?
21:09seangrovebitemyapp: Yeah, I had to check that earlier today too
21:09bitemyapptype-checking could've told him they were using the wrong function.
21:09UltimateEyePatchdon't get it*
21:09bitemyappUltimateEyePatch: basically a zipper.
21:09bitemyapper, sorry, zip.
21:09bitemyappnot a zipper as such.
21:09bitemyappUltimateEyePatch: map can take multiple iterables.
21:09bbloombitemyapp: i'm not sure why we're arguing, since you seem to agree with my point of view lol
21:09bitemyappUltimateEyePatch: it walks them in sequential lock-step, ending on the shortest one.
21:09bitemyappbbloom: then *why* are you using Clojure?
21:10UltimateEyePatchYeah, so the function will then just use that vector as argument?
21:10UltimateEyePatchTHat makes kind of sense I guess
21:10seangroveperegrin_: Let me know if you'd like to hack on any side projects in Clojure from time to time. I often work on small things with people for fun a few hours a week.
21:10arrdembitemyapp: says the pot to the kettle...
21:10bitemyappUltimateEyePatch: vector is the function applied to the results.
21:10peregrin_nice
21:10peregrin_seangrove sounds good man. I'll let you know
21:10bitemyapparrdem: how much Clojure do you think I've written outside of the day job in the last couple months?
21:11bitemyapparrdem: or even six months?
21:11bitemyapparrdem: Brambling was during my 9-5.
21:11arrdembitemyapp: I don't care. you still lurk here.
21:11bitemyapparrdem: that's because cool people like you reside.
21:11bbloombitemyapp: i don't know why i try to exchange perspectives with you, you always get so combative
21:11arrdembitemyapp: lol. my point stands.
21:11bitemyapp#python has no such dilemma for me.
21:11bitemyappbbloom: I didn't *feel* combative.
21:12bitemyappbbloom: I just resolve incompatible models of the universe aggressively.
21:12bbloombitemyapp: arrdem's pot/kettle comment suggests to me that i'm not the only one who perceived combativeness :-P
21:12bitemyappbbloom: I feel happy we had that conversation. :)
21:12t3soroHey guys, I am trying to use extend-type, but it's not making sense to me
21:12bitemyapp80% of why I use Clojure has to do with Datomic. If not more.
21:12bitemyappI don't exactly have a choice.
21:12t3soroHere is a minimized example, if anyone can see what's going wrong? http://pastebin.com/EL010ryZ
21:13arrdembbloom: just pick your battles and tune the rest out :P
21:14bitemyapparrdem: but we agreed?
21:14arrdembitemyapp: just because I agree with you doesn't require that I pay attention when you start :P
21:15bitemyapparrdem: mayhaps.
21:15bitemyapparrdem: I'm at a Clojure meetup. I don't think there's a planned talk. Considering using it as an opportunity to teach some Haskell.
21:15arrdembitemyapp: haha go for it. I need to put together a lightning talk on core.typed ... :/
21:16bitemyappOuch.
21:16bitemyapparrdem: do what I do. Step 1: Know what you're talking about (kinda) Step 2: Wing it.
21:16ryanft3soro: I believe you want (hello "world"), not (.hello "world")
21:17ryanfI could be wrong though
21:17t3sorohey thanks ryanf i actually just tried that, and you're right, that works.
21:19arrdembitemyapp: yep. I suspect it's gonna come down to a "here's c.c.t, here's the semantics of a signature, here's the workflow, here are some failure modes I've encountered."
21:19t3soroI was under the impression that all protocol methods had to be called with .
21:19arrdemt3soro: nope!
21:20t3sorotime to clean that out of a dozen namespaces now lol
21:23Denommuswhat version of leiningen should I install?
21:24peregrin_latest?
21:24clojurebotlatest is forget latest
21:24peregrin_thanks clojurebot
21:25saclarkClojure noob here. My repl complains that it cannot resolve `seqable?` but everywhere I look online says that should be in core. Do I have require something to use it?
21:28peregrin_,(doc seqable?)
21:28clojurebotPardon?
21:28peregrin_could try seq?
21:29peregrin_oh looks like seqable is in clojure.contrib.core but maybe seq? would work the same?
21:29peregrin_,(doc seq?)
21:29clojurebot"([x]); Return true if x implements ISeq"
21:30bbloomperegrin_: nope, that's seq? not can-be-made-in-to-a-seq
21:30bbloomsaclark: try coll? which is close enough
21:32Denommusclojurescript looks complicate to setup
21:32peregrin_Denommus this should help a ton https://github.com/emezeske/lein-cljsbuild
21:36radsDenommus: http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/
21:36saclarkThanks guys, I think I'll just use `seq?` it should be good enough in my case
21:36DenommusI was thinking about using ClojureScript in a Qt HTML5 application
21:40Denommusbut I could just... implement it in ClojureScript and then put the generated sources in Qt later :-)
21:54bitemyapparrdem: yeah, going to give a talk on Haskell.
21:54bitemyappWhat is good in life? Trolling Clojure meetups with Haskell.
21:54bitemyapparrdem: the failures part of your talk could be particularly interesting.
21:55bitemyapparrdem: tell them an angry tribal deity strikes them with a lightning bolt if the type of their function is Any * -> Any *
21:56arrdembitemyapp: angry tribal deities aren't the only ones who wage war with lightning bolts...
21:57bitemyapparrdem: "I'm your god too!"
21:59rovarwriteup on DayZ on Hackernews
22:00indigoTrolololo types
22:00arrdemrovar: oh god why
22:01rovarit is relevant to their interests?
22:01indigoHN is a major circlejerk
22:01rovarhttps://news.ycombinator.com/item?id=7003821
22:01indigoI feel like the more I read it the less productive I am :|
22:02rovarI recommend reading it not more than once a day, purely for productivity reasons
22:02rovarironically, the only highly popular forum that isn't a circlejerk is /r/circlejerk
22:02indigorovar: I believe there was that one HN by email service
22:03indigoIt would send you the top articles from HN over a week by email
22:03rovarsounds like an RMS-esque solution
22:03indigoHaha
22:03indigoWho knows
22:04indigoRMS is probably more productive than all of us because he spends less time reading "how I built 30 apps last year"
22:05rovarperhaps he should be a little less productive.
22:05rovarhttps://www.youtube.com/watch?v=9sJUDx7iEJw
22:05rovarthat's all I have to say on that topic
22:06tarantuleeSomeone get the link for him eating some stuff off his foot
22:06arrdemah RMS....
22:06indigoHeh
22:06indigorovar: I thought you'd be linking the foot video
22:06indigoHe is definitely an eccentric
22:06rovarsomehow I think that this one is more tragic than eating foot particles
22:07rovarits slow and hard to watch, but just keeps going.. not unlike a train wrock
22:07rovarwreck
22:07arrdemrovar: I love the comparison
22:08rovarman I hate being sick and having way too much stuff to do.
22:33bbloomcommon lisp has attribute lists on symbols... but other than that... does any other well known language have something akin to clojure's metadata?
22:33arrdembbloom: runtime symbol metadata?
22:33arrdem /value metadata
22:33arrdemnot that I know of.
22:33bbloomeither, both, whatever :-P
22:34arrdemusually you'd make the metadata explicitly part of the data...
22:34arrdemwhich is why Clojure has seperate metadata :D
22:34bbloomi assume that rich's inspiration was lisp's symbol attributes, but was wondering if there was something else to study too
22:39bbloomhttp://reference.wolfram.com/mathematica/ref/Annotation.html :-)
22:42bbloomseems like Annotation[5, "foo"] prints as just 5, but + isn't overloaded for annotations sadly :-P
23:26seangroveInteresting, haven't heard much about pigpen http://techblog.netflix.com/2014/01/introducing-pigpen-map-reduce-for.html
23:26seangroveI would have expected a bit more noise on twitter, at least
23:31bbloomneat
23:40Denommusso Clojure's ~ is like Common Lisp's ,
23:41bbloomDenommus: yes, and ~@ is like ,@
23:41bbloomDenommus: commas are whitespace in clojure
23:42Denommusbbloom: clojure is hygienic, right?
23:43arrdemDenommus: no. macros can leak symbols and refer to symbols which are not bound in the macro or macro definition environment.
23:43bbloomDenommus: clojure encourages hygiene with automatic symbol qualification and gensym unification, but clojure allows you to be easily defeat those mechanisms with ~'
23:44arrdem,(macoexpand `(~'foo))
23:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macoexpand in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:44arrdem,(macroexpand `(~'foo))
23:44clojurebot(foo)
23:44technomancyit's easy to be unhygenic but difficult to do it by accident
23:44DenommusI expected it, somehow
23:49thirdyFrom the book Programming Clojure: true? tests whether a value is actually true, not whether the value evaluates to true in a boolean context. The only thing that is true? is true itself
23:49thirdyconfusing
23:49technomancyclojure.core/true? is not a useful function
23:50bbloomtechnomancy: i've used it :-P
23:50thirdy(true? (= 1 1)) evalues to true
23:50Denommus(def a true) (true? a) evaluates to true, too
23:50thirdywhat does it my mean by 'in a boolean context'?
23:51bbloom,(map (juxt identity true? false? boolean) [0 5 {} [] "foo" :bar 'baz true false nil])
23:51clojurebot([0 false false true] [5 false false true] [{} false false true] [[] false false true] ["foo" false false true] ...)
23:51arrdem(inc bbloom)
23:51thirdyfrom my understanding: it's telling me that true? will only work with the literal true e.g. (true? true), nothing more
23:52bbloomthirdy: a boolean context is anywhere an object is coerced to a boolean, which is basically only in 'if or things built out of 'if
23:52Denommusthirdy: for example, (if "a" "b" "c") evaluates to "b", but (if (true? "a") "b" "c") evaluates to "c"
23:53bbloomthirdy: try that (map (juxt ...)) expression i entered in your local repl & think on it for a bit :-)
23:53Denommusthirdy: that is, (true? a) is mostly the same thing as (= true a)
23:53bbloom,(map (juxt identity true? false? boolean #(if % :then :else)) [0 5 {} [] "foo" :bar 'baz true false nil])
23:53clojurebot([0 false false true :then] [5 false false true :then] [{} false false true :then] [[] false false true :then] ["foo" false false true :then] ...)
23:54DenommusI need to sleep
23:55arrdem,(defn sleep? [& m0ar] true)
23:55clojurebot#'sandbox/sleep?
23:55bbloom,(sleep?)
23:55clojurebottrue
23:56bbloomyou can def things in clojurebot? wut?
23:56bbloom(def wtf "!?")
23:56bbloom,(def wtf "!?")
23:56clojurebot#'sandbox/wtf
23:56bbloom,wtf?
23:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: wtf? in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:56bbloom,wtf
23:56clojurebot"!?"
23:56arrdemlol
23:56arrdembbloom: I think they get undef'd after some time window but yes we can now use def.
23:56bbloom,(def inc dec)
23:56clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
23:56arrdemhahahaha
23:57bbloom,(defn inc [x] (dec x))
23:57clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
23:57marcopolo`,(def foo 1)
23:57clojurebot#'sandbox/foo
23:59hiredmanclojurebot: oh clojurebot, wait have you done?
23:59clojurebotHuh?
23:59thirdy,(= true a)
23:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>