#clojure logs

2015-11-01

00:01pyonhttps://www.refheap.com/111251 -- what should I do in line 27 to make this work?
00:06TEttingerspradnyesh, sure
00:06TEttingerso = is reference equality for many types
00:07TEttinger,(let [a (identity 25.0) b (identity 25.0)] (= a b))
00:07clojurebottrue
00:07TEttingerwasn't sure aboutthat
00:07TEttinger,(let [a (identity 25.0) b (identity (float 25.0))] (= a b))
00:07clojurebottrue
00:07TEttingergah
00:08TEttinger,(let [a (identity (Double. 25.0)) b (identity (Float. 25.0))] (= a b))
00:08clojurebottrue
00:08TEttinger,(let [a (identity (Double. 95.2)) b (Float. 95.2)] (= a b))
00:08clojurebotfalse
00:08TEttingerah!
00:09TEttinger,(let [a (identity (Double. 95)) b (Float. 95)] (= a b))
00:09clojurebot#error {\n :cause "No matching ctor found for class java.lang.Double"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching ctor found for class java.lang.Double"\n :at [clojure.lang.Reflector invokeConstructor "Reflector.java" 183]}]\n :trace\n [[clojure.lang.Reflector invokeConstructor "Reflector.java" 183]\n [sandbox$eval121 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbo...
00:09TEttinger,(let [a (identity (Double. 95.0)) b (Float. 95.0)] (= a b))
00:09clojurebottrue
00:09TEttingerok
00:09TEttingerit's a floating point rounding thing
00:09TEttinger*precision
00:09spradnyeshohhh, i understand
00:10TEttinger,(let [a (* 100000 (Double. 95.2)) b (* 100000 (Float. 95.2))] (= a b))
00:10clojurebotfalse
00:10TEttinger,(let [a (* 100000 (Double. 95.2)) b (* 100000 (Float. 95.2))] [a b])
00:10clojurebot[9520000.0 9519999.694824219]
00:10TEttingerthere we go
00:10spradnyeshgot it! super thanks :)
00:11TEttinger.2 is a nasty one, since you'd expect it to be OK, it's only one place...
00:13spradnyeshissue is i was getting this from "lein autoexpect" and it gave me this failure:
00:13spradnyeshin expected, not actual: [{:close 94.2, :low 92.1, :open 93.6} {:close 95.2}]
00:13spradnyeshin actual, not expected: [{:open 93.6, :close 94.2, :low 92.1} {:close 95.2}
00:13spradnyeshand i couldn't make head or tail out of it (for almost 2 days). today i looked at the types
00:14spradnyeshTEttinger: and you helped me understand. thanks :)
00:14TEttingerno prob
01:01pyonWhen defining custom program entities (`deffoo`), is it normal practice in Clojure to equip them with metaobjects?
01:06rhg135what are metaobjects?
01:07rhg135we do attach metadata, yes
01:09bklebe"yo dawg I heard you liked objects so I put objects on your objects and called them metaobjects"
01:10bklebehttps://en.wikipedia.org/wiki/Metaobject
01:11WickedShellI have an application where I've been using a LRU chache with core.cache but I need to see when an object is evicted from the cache, as I need to track it elsewhere and the JVM wouldn't automatically free the object. amalloy suggested weak references but I don't really see how that helps? All I really need is a callback on evict that gets a copy of the evicted object, does anyone have a good approach for this?
01:35pyonhttps://www.refheap.com/111252 -- Is there any way to factor out the anonymous function in line 15?
01:36pyonI find inline anonymous functions unnecessarily hard to read. :-|
01:46tmtwdhow to use trig functions in clojure?
01:47WickedShelltmtwd, I've always done (Math/atan 1.0) etc
01:48tmtwdI get java.lang.ClassNotFoundException: Math.cos,
01:48WickedShellMath/cos
01:48WickedShellit's a static function
01:48tmtwdah okay
01:11diminishedprimeHello all. Have a quick question. I'm trying to use file-seq with filter to show all .wav files in a directory. The code is working on my mac, but not on my windows machine. With my mac I can pass "/Users/mjhamrick/Desktop/music" and it will find them. On windows, I've tried (every?) variation of C:\\path\\, C:\\path C:\path\, etc. Any ideas on how that should be formatted?
01:11diminishedprimeLooking up java's file constructor, it seems like C:\\path would be right, but that's not working for me.
01:32diminishedprimeI ended up solving this problem with seesaw.chooser/choose-file, but I'm still not sure why it didn't work before.
01:35WickedShelldiminishedprime, I'm getting away with relative paths like this on windows "icons/actions/expand.png" (and the same path on *nix)
01:41diminishedprimeWickedShell: hmm... thanks for the reply. I'll have to look into seeing if absolute paths follow the same structure.
01:42oddcullyalso afaik there is no need for backlashes on windows with java
01:42WickedShelldiminishedprime, It's also hard for me to say in that I've wrapped every path into (io/input-stream (io/resource foo))
01:42oddcullysame as you don't need : on osx
01:45TEttingeraaaaaaaaaaaaaaaaagh... maven is driving me insane
01:46TEttingerthere's a binary resource, saved with file extension bmp of all things, and for some reason maven is treating it as text, and freaking out midway through
03:29TEttingerI found a solution to the maven thing, for anyone who's reading backlog -- don't store binary streams as resources in jars that maven will mangle; if possible re-compute the data if it's small
03:32WickedShellTEttinger, why was maven mangling it? I have some local jar's that have tiny png's and haven't had a problem yet? (I'm sure its coming though)
03:33TEttingerpng doesn't ever get filtered
03:33TEttingerI was using a raw stream of bytes with no extension
03:34TEttingerI think it may do MIME type detection, I tried renaming to .bmp and it didn't help (maybe shade later on was causing the trouble by not respecting resource filters?)
03:35TEttingerthe trouble was it insisted my binary files were text
03:36TEttingerit would always cut out after a short in the short[] that was equal to 17239. then only 0 after that in the final stream
03:37TEttingerI suspect it's not a maven thing so much as a shade maven plugin thing
03:37TEttingerlein should get by without ever encountering this nicely
04:17pyonWhat data structure is internally used by Clojure's vectors?
04:42sobelIPersistentVector
04:50pyonYeah, that's probably the name of the class, but what's the data structure?
04:50sobelthat's the name of the interface actually
04:50pyonAh.
04:51lumajava arrays
04:52pyonAh...
04:52sobelsince no one seems to answer or be around on #clojurescript i'm trying here...
04:53sobeli read/implemented om/react tutorial 1, but there's a small bit i can't figure out yet. i want the edit button to set cursor focus on the editable field but can't figure out how to get its id for an onclick, or otherwise effect that change
04:57ahoegh_Can someone tell me how it is possible to return false from a liberator decision and merge a map with the context at the same time?
04:57ahoegh_I want to check if a request is unprocessable and merge a validation error with the context, so that I can use that validation error in the handle-unprocessable-entity handler.
04:59oddcullysobel: something like (.focus (js/document.getElementById "theeditfield")) ?
04:59sobeloddcully: sure, something like that. the trouble i have is how to get the id of the edit field
05:00ahoegh_I found the answer.. RTFM :)
05:00oddcullysobel: provide one?
05:01oddcullysobel: what i mean is: does your input field have one? and if not, why not provide one?
05:07sobeloddcully: it looks like data-reactid=".1.1.0" type ids are already generated
05:08sobeli'm generating these from a data structure, so customizing my own id is not preferable
05:15oddcullysobel: you need a simple id="xxx" attribute. .e.g [:input {:id "xxx"}]
05:16oddcullysobel: if you can not assign an id and thus be unable to get the dom element by it, you would have to find a way to navigate the dom to find it
05:19sobelwhen people render lists with controls on each element, do they usually also have to invent a serial numbering scheme or is there a standard/common way to do this?
05:25oddcullysobel: you e.g. get the parent [:li] of your button and use goog.dom.$$ to find your first input
05:26oddcullysobel: the harder it is to find your "sibling" input the more i'd look for stuff in goog or other libs to help
05:27oddcullysobel: this at least is the "html" way. i am not aware of any react shortcuts - but that does not mean much, since i don't use it much
05:29sobelok
05:29sobeli guess i was looking for a react shortcut
05:46sobelok, they designed this tutorial around a poor data structure so i'm not gonna bother to fix it but i think i figured out what i needed
05:46sobelthx oddcully
09:05sameerynhohow can I invoke a function dynamically by name in runtime ?
09:07oddcully,((resolve (symbol "+")) 5)
09:07clojurebot5
09:09sameerynhooddcully: http://dpaste.com/3FYEQSV
09:10sameerynhooddcully: if i pass "my_position" as command for call-command it can't find command-my-position function
09:11oddcullymy_ vs my- ?
09:12sameerynhosorry my-position
09:15luma*ns* is always bound to your current namespace, so it's not necessarily the same namespace where call-command is defined
09:15lumacould that cause the problem?
09:15sameerynhohmmm no ,
09:17oddcullyprn *ns* and command then for debugging?
09:21sameerynho#object[clojure.lang.Namespace 0x15c2a24a clojure.core]
09:21sameerynho#object[websocketclj_lab.core$command_my_position 0x61b84b5f websocketclj_lab.core$command_my_position@61b84b5f]
09:24oddcullydoesn't look like a simple string to me. are you sure, that (str "command-" command) there actually produces something sane?
09:26sameerynhooddcully: yeah
09:26sameerynhoI fetch the command name over network
09:27lumaif your *ns* is clojure.core (like the print suggests), then your function tries to resolve your command name in the namespace clojure.core
09:27lumaand obviously, your command is not in clojure.core
09:28sameerynholuma: good point
09:31sameerynholuma: you were right
09:31sameerynholuma: but shouldn't *ns* refer to my current ns ?
09:32lumayes
09:34sameerynhoweird
11:15kungiWhat java heap sizes are you using for a "default" ring application which writes a bit to database and "does not do much"
12:10jonathanjwhat's the easiest way to truncate a string to N characters?
12:10justin_smithjonathanj: (subs s 0 n)
12:11jonathanjoh, i was expecting to find something in clojure.string
12:11jonathanjmeh, n has to be in bounds?
12:12justin_smithyes, subs is pretty low level
12:12justin_smith#(subs % 0 (min (count %) %2))
12:24TEttinger,(apply str (take 10 "hello"))
12:24clojurebot"hello"
12:24TEttinger,(apply str (take 2 "hello"))
12:24clojurebot"he"
12:31justin_smiththat's easy I guess, but a terrible usage of resources
12:42TEttingerjustin_smith: could the same be said of using clojure instead of java in most cases?
13:42gfredericks2anybody else waiting out the clojars outage?
13:45TEttingergfredericks2: there's some weird outages all over
13:45TEttingercloudflare seems to be having trouble
13:46TEttingerpastebin was down, then shapeways...
13:46gfredericks2TEttinger: if they're all in the linode ATL datacenter, then that explains it
13:47TEttingeratlanta getting rained out?
13:50hiredmanannoyingly 'lein classpath' even tries to connect to clojars
13:51amalloyhiredman: there's an offline flag you can pass
13:51amalloylein -o classpath
13:52amalloyleindasho: when did core.logic come into this?
13:52lein-dash-ohow did dashes drop out of my name?
13:52lein-dash-oclojurebot: hello
13:52clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline lein-dash-o
13:52lein-dash-othey're still there
13:53lein-dash-ooh you removed them only for the joke; okay
13:53hiredmanamalloy: perfect
15:11gfredericks~clojars is back
15:11clojurebotA nod, you know, is as good as a wink to a blind horse.
15:21jonathanjhrm, i have some data that has some keys like :foo? :bar? :baz? whose values are all booleans, i'd like to turn those into strings like "foo" "bar" and "baz" but only if their values are true
15:21jonathanji'd prefer to avoid just turning a keyword into a name, to give me a bit of flexibility
15:21jonathanji'm not really sure how to spell this in Clojure though
15:23taylor_sandoclojure.walk/postwalk can perform transforms. There is also a library I have used for transforming map keywords https://github.com/jeremyheiler/wharf
15:26jonathanjpython has a function compress(data, selectors) that returns values from data when the corresponding selector is true
15:26jonathanjcompress(['a', 'b', 'c'], [True, False, True]) # => ['a', 'c']
15:27taylor_sandoAre you just looking for the keys with values that are true?
15:27jonathanjwell, not really keys
15:28jonathanji want to do something like: (compress ['Aye' 'Bee' 'Sea'] ((juxt :a? :b? :c?) data))
15:28jonathanjassuming the data is {:a? true :b? false :c? true} it would produce ["Aye" "Sea"]
15:35taylor_sando(defn is-predicate-keyword? [k]
15:35taylor_sando (= (last (name k)) (last "?") ))
15:35taylor_sando
15:35taylor_sando (reduce
15:35taylor_sando (fn [acc [k v]]
15:35taylor_sando (if (is-predicate-keyword? k)
15:35taylor_sando (if (true? v)
15:35taylor_sando (conj acc (apply str (butlast (name k))))
15:35taylor_sando acc)
15:35taylor_sando acc))
15:35taylor_sando []
15:35taylor_sando {:x :value
15:35taylor_sando :x? true
15:35taylor_sando :y? false
15:35taylor_sando :z true})
15:36Frozenlocktaylor_sando: I'd recommend to use refheap instead of flooding the channel :-/
15:36Frozenlockhttps://www.refheap.com/
15:36taylor_sandoFirst time using IRC, I was just going to make a gist
15:37TEttinger,(filter identity (map (fn [[k v]] (when v k)) {:foo? true :bar? false :baz? true}))
15:37clojurebot(:foo? :baz?)
15:38taylor_sandohttps://gist.github.com/taylorSando/1d12038fd77fa6f71bd9
15:38oddcully,(let [l1 ["a", "b", "c"] l2 [true false true]] (filter identity (map (fn [a b] (and b a)) l1 l2)))
15:38clojurebot("a" "c")
15:42jonathanj(filter identity) is basically just to filter the nils?
15:43lumahmm, was going to suggest keep instead of filter+map, but apparently there's no keep for multiple seqs
15:43jonathanjoh well false not not nil
15:44jonathanjluma: yes, (keep first [true false true] ["a" "b" "c"]) was what i first expected to work
15:45lumajonathanj, well, that wouldn't work since keep returns a seq of (f item), so in that case it would just return (true true)
15:45lumainstead of ("a" "c")
15:45jonathanjtrue, #(when %1 %2) or something
15:46jonathanjmaybe no need for the #()
15:46jonathanjanyway, it's unfortunate
15:46jonathanjoddcully: thanks
15:59RedNifreHey there. If I wrote a library in Clojure, would it be convenient to use in Java/Kotlin code? I mean, Clojure is functional with functions and data separate, while Java/Kotlin is more OOP... could the Clojure library expose objects so that the Java code could do `thing.doSomething(3)` instead of `ThingUtils.doSomething(thing, 3)`? And how does dynamic typing look from the Java side, does everything turn into Object or can I prevent tha
15:59RedNifret with typed clojure?
16:00RedNifre(I'm asking because I think Clojure might be a language worth checking out but when doing Android development, only Java and Kotlin are painless because the Android API is so Java-centric. So I wonder if I can do Android specific stuff in Java/Kotlin and algorithmic/business logic stuff in Clojure.)
16:01TEttingerRedNifre: if you're doing android in clojure, you won't be the only one. there's definitely work being done there
16:01TEttingerskummet is a tool to look into for that
16:02TEttingerhttp://clojure-android.info/skummet/
16:02RedNifreHey, it's you!
16:02amalloyRedNifre: everything is Object basically, and IFn.invoke instead of real methods. but you can write a java interface for your module, and then implement it in clojure; the user won't have to know it's implemented in clojure
16:02TEttingerhaha
16:02RedNifreYes, I'm aware that work is done on making Clojure viable for Android development but I'm not convinced it's there yet.
16:03TEttingerRedNifre, yeah, I like Clojure a ton, but None sorta targets a different niche that I'm also interested in
16:03RedNifreamalloy do you mean writing clojure code that builds Java-friendly objects or do you mean writing a bit of Java that does IFn.invoke a lot to build the Java-friendly objects?
16:03TEttingerclojure can call java effortlessly
16:04TEttingerthanks to macros in clojure, it can potentially be easier to call java from clojure than to call java from java
16:04TEttingercalling clojure from java is definitely do-able but not quite as easy.
16:04RedNifreRight, calling Java from Clojure looks fine. I wonder about the other direction though.
16:04TEttingerclojure generates stuff that's compatible with java and can be called by java without needing to use the IFn stuff necessarily
16:05TEttingergen-class is the main thing for that
16:06TEttingerif you want to call a clojure lib that expects clojure fn, map, keyword, etc. args, then it's going to be hard to consume from java, but possible
16:07RedNifreLet's consider a slightly different scenario: Say I don't care about Java and I write a library in idiomatic Clojure. Then one day I need to use it in Java code. How difficult would it be to write a Java wrapper that exposes an idiomatic Java API?
16:08RedNifreWhat exactly is "fn"? Is it a Java 8 lambda? Or is it more like a Function object with an apply()-method? Or is it some bytecode construct that can't be decompiled to valid Java code?
16:11TEttingera fn is not a Java 8 lambda (there's some compatibility stuff though), it's an object that implements IFn and has an implemented method that I think is called "call"
16:11TEttingernot sure about the name
16:12rhg135invoke
16:12RedNifreSay I have a clojure function that takes an Integer and a "fn" and now I want to write a Java 6 wrapper that takes an Integer and a Guava Function object... how would that look like? I imagine something like `void foo(Integer i, Function f) { ClojureLibrary.foo(i, new Clojure.Fn() { Something invoke() { return f.apply() } } ); }` ... is that how it works?
16:12rhg135,(.invoke + 1 2)
16:12clojurebot3
16:13TEttingerhttps://github.com/rschmitt/collider
16:14TEttingerthere is already a guava clojure wrapper
16:14TEttingerhm, no Function https://github.com/michalmarczyk/clojure-guava
16:17RedNifreStrange. But I guess using Function would really just be <F extends Function<A,B>> IFn wrap(final F func) { return new IFn() { B invoke(A a) { return func.apply(a); } } }...
16:19RedNifreBut that sounds good. If there is a wrapper for Guava and Collider for the basic data structures most things are covered. How do records look like in Java? Are they just method-less objects with public properties?
16:21TEttingerwell Collider, oddly enough, is just a wrapper around Clojure's standard lib of data structures to use them in a typesafe way I think from java. I have no idea if collider-made objects can be passed into clojure libs like clojure maps or sets etc.
16:21TEttingerrecords I think are mostly meant to be consumed by java, but I haven't really used them
16:29oddcullyRedNifre: records get the things they are defined with as fields and otherwise behave mostly like maps. they have methods since they implement several interfaces
17:15noncom|2whats the most idiomatic way to update only values in a {} whose keys match a certain critetia?
17:15noncom|2i am thinking of select-keys + redude/update + merge
17:16noncom|2ahahaha
17:16noncom|2*reduce
17:16noncom|2oh.. no, i am wrong. select-keys can only pick a known key, not filter keys on criteria
17:17noncom|2ah, wtf, just a plain reduce with a matcher will do..
17:18oddcullyalso reduce-kv
17:18noncom|2yeah!, right, that's one step closer
18:01irctcHi everyone.
18:01justin_smithhello
18:02irctcDoes anyone know how to call a clojure function from a clojurescript file? I tried importing the clojure file in the cljs namespace but that just throws an error: clojure.lang.ExceptionInfo: No such namespace:
18:02irctcHi justin_smith! :)
18:02justin_smithirctc: you can have a cljc file that works in both clojure and cljs, that's the closest reasonable thing
18:03rhg135you can't AFAIK. you need a macro
18:03irctcWhat's a cljc file?
18:03justin_smithyour clojure and cljs have different source-paths, but you can have some shared namespaces that work with both
18:03rhg135it compiles to both clj and cljs
18:03justin_smithirctc: it's a file using read conditionals to contain both valid clj and valid cljs code
18:03rhg135well in thory
18:04irctcOk, thanks. I'll look into that then. :)
18:04justin_smithirctc: so this solution would be defining the function in a cljc file, so both clojure and clojurescript could use it
18:05justin_smithbut it wouldn't help if the function uses clojure-specific code (eg. interop with the jvm) unless you modify it with read conditionals to have a cljs compatible version
18:06irctcThere's always a catch. lol :D
18:07irctcI just want to use cljs to create an asynchronous call to a clojure function and display its results on my page. Is there an easier solution than calling it in my cljs file?
18:07justin_smithirctc: umm, that wouldn't even work
18:07irctcWhy no?
18:07justin_smithirctc: what you need is to define a handler, then make an async call
18:07irctcnot*
18:08justin_smithbecause the cljs runtime in the browser doesn't have access to what the clojure has - it needs to communicate with the server somehow to do an async update like that
18:09justin_smithyour best options are AJAX with a handler on your server side serving JSON, or a websocket
18:09irctcI already have a handler that handles all my compojure requests for pages. Now I just want the cljs file to display a message Loading... while I make an async call to my clojure function and then when the results return display those results instead of the Loading... message.
18:09justin_smithright, to call something on the server side, you need to make a request
18:10justin_smithor use a websocket - you have to have some way of communicating with the server from the browser
18:10justin_smithunless this is something you can do without the server, in that case just do it in the cljs on the browser and ignore the server of course
18:11irctcWell I can't ignore the server, because the server makes an api call to another server. I can't do that from the client. On the other hand I don't know much about websockets.
18:11justin_smithwell, you can use AJAX
18:12justin_smithit's not as simple as just calling a clojure function, but it's not super hard either
18:13irctcSo I would use AJAX in my views.clj page to make the async call to my clojure function while I display my Loading... mesage?
18:15irctcAlthough shouldn't the AJAX call be in the cljs file, but then how do I call my clj function from a cljs file without going through the creation of a cljc file in which my functions can't have Java interop (which my clj functions do).
18:16justin_smithirctc: I don't think you need cljc for this at all - I thought you had some function that could work in either clj or cljs
18:16justin_smithbut it sounds like you need the results of some clj function from the cljs code, and that you would use ajax for
18:16justin_smiththe cljs would do the ajax call, and in views.clj you would have a function that takes the request and returns the result as json
18:17irctcYea, I need the result of my clj function in my cljs file (that's why I wanted to call my clj function from my cljs file) which I would then display after the results are done loading .
18:19irctcOk, but then that function in my views.clj file would call my cljs file which would take that request and then call my clj function with the given arguments so it could get back the result of executing that clj function.
18:20justin_smithwhat/
18:20justin_smithhow is views.clj calling your cljs file?
18:21irctcWell, I have a search box in which I type in an argument, that argument right now is passed directly to the function in my other clj file, which goes through an algorithm and then returns the result in a new page.
18:22irctcNow, in the new setup I would pass that same argument from the search box to my cljs function which would then call the clj function while displaying the text Loading... until the results come back from the clj function.
18:23justin_smithyeah, that sounds about right
18:23irctcOk, but then how do I call that clj function from my cljs file?
18:23justin_smithmake the clj function a handler for an http request
18:23justin_smithcall it via ajax
18:24noncom|2justin_smith: hi! so did you find out what was that big wait in your program?
18:25irctcOk, but I still need to use ajax in my cljs file, and if that file won't accept the clj file namespace that I'm trying to require it to use then how do I make the AJAX request?
18:27justin_smithnoncom|2: not yet
18:27noncom|2wow, looks like a big fish
18:27noncom|2just curious!
18:30jfntnAnyone knows the general approach for having optinal transitive dependencies in a library?
18:32noncom|2jfntn: you mean a way to know if a java class or a clojure ns is available?
18:33jfntnnoncom|2: yes, say I want to provide a core.async adapter in a separate file, but don't want the whole lib distribution to depend on core.async
18:33justin_smithyou can use resolve to find a var by its symbol, it returns nil if not found
18:33jfntnWould you be able to do that in the file's top-level?
18:34justin_smithjfntn: oh, for something like that I just don't declare a dep, but provide a namespace that works if that dep is available
18:34justin_smithjfntn: yes, resolve works at the top level of a file
18:34jfntnhmm ok this sounds a lot easier than I expected :p
18:35noncom|2justin_smith: will resolve also resolve vars from namespaces that are not yet required?
18:35justin_smithnoncom|2: nope, it will return nil
18:35justin_smithbut you can also use require with a try/catch followed by resolve I guess....
18:35noncom|2jfntn: justin_smith: probably a (require..) inside a try/catch can be useful then...
18:35noncom|2oh
18:36noncom|2yeah just remember that there's a (require) fn which does not have to go inside the (ns) declaration
18:36noncom|2and can be called anywhere
18:36noncom|2it will give a classpath error or something alike if it fails to load a ns
18:36justin_smithjfntn: but as I was saying, in practice for me it works out to just put things that require foo in one ns, and document that a user of my lib should provide foo if they want to use that ns
18:37jfntnjustin_smith: yeah that sounds good
18:37jfntnDo you just put the deps in your dev-profile and make sure to run this one in your repl?
18:37justin_smithjfntn: bonus if foo implements a protocol - then you can require the protocol and let the user supply something satisfying said protocol
18:38jfntnyeah that's the idea!
18:38justin_smithjfntn: or test profile, depending on the scope of the lib
18:38jfntnright, ok cool!
18:41jfntnAh, just pulled up some documentation on maven deps scopes, and the runtime flag says "indicates you expect the JDK or a container to provide the dependency at runtime" which sounds like what I want too
18:42justin_smithsounds like "provided" too
18:43jfntnyeah, not sure I'm getting the differences...
18:44irctcjustin_smith, thanks for your advice, I found some cool libraries. I'm gona look into cljs-ajax and sente and see what will be easier for me to implement.
18:44irctcI appreaciate the help. :)
18:46noncom|2jfntn: justin_smith: hey there's the difference in the doc: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
18:47justin_smithnoncom|2: cool, so the difference is that a runtime dep isn't even needed during compilation
18:48irctcBye everyone. Take care! :)
18:48noncom|2bye! :)
18:48jfntnthat sounds good, you'd also be able to provide version ranges if your code has specific api requirements wrt to the runtime lib
18:49noncom|2jfntn: is this a dependency management.. um.. paradise? :)
18:49jfntnhehe
18:49noncom|2so many features to just fit into all the cases you might need... :)
18:50jfntnjustin_smith: are you distributing anything publicly with the method you described?
18:50jfntn..if I may ask
18:56justin_smithjfntn: funny enough, not currently (had one in the past which now explicitly requires the dependency)
19:00JokerDoomWorkso many clojure peeps
19:00Malnormalulowell there's one fewer
19:02noncom|2so many-1 clojure peeps
19:04rhg135-2 now
19:05noncom|2so f(t) = N clojure peeps..
19:06rhg135It is time dependant, but I feel there are other variables
19:06MalnormaluloNonetheless it is a valid function of time alone
19:07rhg135That it is
19:08noncom|2been recently reading on binary lambda calculus... i must say a very interesting thing..
19:08noncom|2just sharing
19:08MalnormaluloI am very embarrassed to admit that I've never learned how lambda calculus works
19:10noncom|2Malnormalulo: then i simply must share this with you: http://palmstroem.blogspot.ru/2012/05/lambda-calculus-for-absolute-dummies.html
19:10JokerDoomWorkI tried reading about it once, but it seemed like really over my head at the time, I haven't tried in years
19:10JokerDoomWorkty
19:10noncom|2Malnormalulo: enjoyed the article very much, it has nice colorful pictures :)
19:10MalnormaluloAwesome, thanks!
19:12rhg135I once implemented it
19:12noncom|2to sum up, essentially, lambda calculus is just a replacer, if to oversimplify, then one can say it works same as (.replace "abc" "a" "z") but with hygiene for names and fancy writing
19:13rhg135It was nice but not as nice as the host language
19:13noncom|2rhg135: wow cool!
19:13noncom|2what was the host?
19:13rhg135Clojure
19:13noncom|2ah :)
19:14noncom|2well, lambda itself is cool, but what's especially fascinating is the binary form of it
19:14noncom|2this thing inspires me well: https://tromp.github.io/cl/cl.html there's a reference to the binary LC paper and a set of java classes
19:15noncom|2looks very geeky
19:16noncom|2rhg135: so you've implemented a small dsl for lambda in clojure?
19:16cloj_devis lazy evaluation commonly used in clojure?
19:16noncom|2cloj_dev: it is rather widespread and very encouraged
19:16MalnormaluloThe core range function is built on the concept
19:17cloj_devinteresting
19:17cloj_devbut its not so strict like in haskell
19:17rhg135Yeah, noncom|2, essentially a neutered fn.
19:17noncom|2cloj_dev: but it is not mandatory and not all funcs go with it
19:17noncom|2cloj_dev: define "so strict"
19:17cloj_devin haskell almost everything is lazily evaluated
19:17rhg135Then I tried to build new ideas on it and failed
19:18Malnormaluloclojure--
19:18noncom|2cloj_dev: yeah, in clojure most operations on sequences are lazy. not so for other ops, since that's JVM
19:18noncom|2rhg135: that's interesting... what did you try and what failed?
19:18rhg135Like I tried to get rid of the fn object
19:19rhg135Make it all a tree of semantic ops
19:19moralesIsn't clojure defined in a way where it can be implemnation agnostic though? couldn't an implementation that runs on the llvm be made?
19:19amalloythere's not really a clojure spec
19:20amalloythere's just, what does clojure-jvm do, what does cljs do...
19:20noncom|2morales: it could, theoretically, if you rewrite the core away from the JVM. it will differ a little
19:20noncom|2but i would LOVE to see clojure on LLVM, with all necessary changes it would require
19:20rhg135I'd be fun
19:20rhg135It'd *
19:21noncom|2rhg135: so you wanted to go away from clojures fn?
19:22noncom|2clojure does not have an implementation spec, but it has a very strong ideology which defines the choices you are to make when implementing it pretty clearly
19:22rhg135Yeah, from manually dealing with objects, just the semantics. Obviously this requires a compiler that I'm not smart enough to write
19:24cloj_dev(let [{one 2} [1 2 3 4]]
19:24cloj_dev [one])
19:24noncom|2rhg135: hmmm.. well, if you ever get interested, on this page (https://tromp.github.io/cl/cl.html) there's a the link, the latest one, which has a very tiny core implemented in java
19:24noncom|2it is SKI though, but that makes it even more interesting
19:25cloj_devwhen you do that, is one automatically cast to a keyword?
19:25noncom|2cloj_dev: no
19:25cloj_devor a symbol rather
19:26noncom|2well, it is a symbol from the beginning
19:26noncom|2nothing changes
19:26rhg135Think dynamic haskell without typeclasses on steroids
19:27noncom|2it is destructuring the {}, effectively just assigning the value to symbol "one"
19:28noncom|2the way it does the destructuring and assignment is the way this particular destruction form is implemented
19:29noncom|2rhg135: interesting, is it possible, or should i say, feasible, to write a lambda language interpreter in clojure that does not rely on fn...?
19:31noncom|2cloj_dev: you can find the implementation of all possible destructurings in clojure.core/destructure or something like that
19:31noncom|2and see what they do
19:32noncom|2or just read some manual, coz the core is sometimes too much
19:32cloj_devI have found destructing confusing for some reason
19:32cloj_devI'm getting used to it though
19:32cloj_devits used all over clojure, so you kind of need it
19:32noncom|2cloj_dev: destructuring is much like unification in logic
19:33cloj_devhaven't checked out logic programming yet
19:33noncom|2sometimes with syntactic sugar
19:34noncom|2cloj_dev: yeah, destructuring is vital! you can totally get away without it, but it is so conscise and clear..
19:34noncom|2saves much trouble
19:35cloj_devyeah
19:35cloj_devI'll get used to it eventually
19:35MalnormaluloI've tended not to like destructuring in other languages, but the operator-first syntax does make it seem more appealing
19:37rhg135noncom|2: I used fn in the interpreter, but I can't see a way around it
19:37noncom|2rhg135: i guess the way around fn is going though eval...
19:38noncom|2eval and quoting
19:38rhg135Oh yeah, but that'd be even harder
19:39MalnormaluloConsidering that the ability to declare functions is the main thing that makes Clojure Turing-complete, it isn't surprising that it's hard to implement a Turing-complete language without it
19:39noncom|2rhg135: do you have your implementation available to public?
19:40noncom|2Malnormalulo: rhg135: just while we're at it, i should mention this: http://klisp.org/
19:41noncom|2did not get into it fully myself, but it goes in deep about this kind of matter - evaluation of homoiconic data, if i may word it like that
19:42noncom|2and NEVER watch any klisp video on youtube...
19:42noncom|2don't say i did not warn you...
19:58rhg135Oh, implementing eval, fun D:
19:59rhg135noncom|2: no since it didn't actually work
20:00noncom|2eh, well ok, just wondered what could be built upon your solution...
20:03rhg135Wow, am I wrong to question klisp's practicality?
20:03noncom|2rhg135: um, are you asking that after rading some manuals since there're a lot of real-life useable things?
20:04noncom|2sure klisp is born from a fundamental research effort, but i am sure it is practical at least on some level
20:04rhg135No...
20:04noncom|2it is not a pure theoretical languagte
20:04rhg135Hmm, interesting
20:04MalnormaluloLISP started life as a pure theoretical language, and now look where we are
20:05noncom|2also true. well, things start that way.
20:05noncom|2i am sure that klisp explores yet a not well known territory of abstraction which, with high probability will find its use sooner or later
20:05noncom|2just like lamda calculus itself
20:06noncom|2it is just the concept is very fundamental and it changes too much to be easily estimated from now
20:08rhg135Hmm, the problem with these is mainly logistics
20:08noncom|2logistics?
20:08rhg135Aka actually using it, packing, etc
20:09Malnormaluloaside: am I right in interpreting `loop` as essentially just a `let` that you can recur to?
20:09noncom|2ah
20:09rhg135All the other stuff beside code
20:09noncom|2Malnormalulo: right. a let or a fn
20:10noncom|2rhg135: ah, yeah, the ecosystem
20:11noncom|2well as for klisp, i can say, it can be useable no less than, say, lua
20:11rhg135Yes, sorry my lexicon fails
20:11noncom|2sure there's no community around it :)
20:11rhg135That's good
20:11noncom|2it's too geek
20:11noncom|2yeah, i know you were referring to my previous phrase :)
20:12rhg135Yeah...
20:12noncom|2there are lots interesting languages like that..
20:12noncom|2their author and maybe some friends are the only community...
20:12MalnormaluloMost languages tend to start that way
20:13MalnormaluloExceptions being mostly corporate-sponsored ones
20:14noncom|2yeah. i just wish some authors had more luck with finding like-minded people capable of maintaining and developing a community
20:15noncom|2well, at least, we have access to these concepts
20:15noncom|2if we could really research them, probably we could harvest some very valuable information matter
20:15noncom|2bandicoot is another such language
20:16noncom|2and J (a direct modern descendant of APL)
20:16noncom|2to name a few..
20:16noncom|2i really glad that clojure managed to get that far actually
20:16noncom|2a true savior these days...
20:38cflemingIs anyone using a project that depends on a concrete snapshot version and could run a quick test for me?
20:43cflemingBy which I mean 0.1.5-20151023.100204-2 instead of 0.1.5-SNAPSHOT
21:32kenrestivoi'm reading about orientdb and clojure... it says that the client api (on the java side) is not thread-safe
21:33clojerI want to add a HTML area feature similar to what WordPress has for adding content. What's the best option? Would it be better done in JS/CLJS, perhaps?
21:33kenrestivowhich might explain why someone started (and abandoned) this https://github.com/eduardoejp/orientdb.clj
21:33clojerAdd to a web app, that is :)
21:56noncom|2kenrestivo: does not look like a big problem: http://orientdb.com/docs/2.1/Java-Multi-Threading.html
21:56noncom|2kenrestivo: also, you can employ clojure to handle concurrency before interfacing with the db
21:57noncom|2however that might seem not straightforward to do
21:58noncom|2kenrestivo: also: http://stackoverflow.com/questions/26598815/using-an-in-memory-orientdb-in-a-multithreaded-application
23:07jhni'm need to generate a haproxy config from clj and was wondering if https://github.com/yogthos/Selmer was a good choice for a templating engine that could help with this, or if there were other superior choices. basically all i want is to have a template of the haproxy config file with some 'fill in the blank' parameters which will be passed later.
23:07jhn*I
23:53rhg135jhn: selmer should work, you can also check how lein does it
23:53jhnrhg135: actually, comb looks like it fits my use case better. https://github.com/weavejester/comb
23:59rhg135Beside the 'side effects in templates' bit, that's a nice lib