#clojure log - Nov 01 2015

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

0:01 pyon: https://www.refheap.com/111251 -- what should I do in line 27 to make this work?

0:06 TEttinger: spradnyesh, sure

0:06 so = is reference equality for many types

0:07 ,(let [a (identity 25.0) b (identity 25.0)] (= a b))

0:07 clojurebot: true

0:07 TEttinger: wasn't sure aboutthat

0:07 ,(let [a (identity 25.0) b (identity (float 25.0))] (= a b))

0:07 clojurebot: true

0:07 TEttinger: gah

0:08 ,(let [a (identity (Double. 25.0)) b (identity (Float. 25.0))] (= a b))

0:08 clojurebot: true

0:08 TEttinger: ,(let [a (identity (Double. 95.2)) b (Float. 95.2)] (= a b))

0:08 clojurebot: false

0:08 TEttinger: ah!

0:09 ,(let [a (identity (Double. 95)) b (Float. 95)] (= a b))

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

0:09 TEttinger: ,(let [a (identity (Double. 95.0)) b (Float. 95.0)] (= a b))

0:09 clojurebot: true

0:09 TEttinger: ok

0:09 it's a floating point rounding thing

0:09 *precision

0:09 spradnyesh: ohhh, i understand

0:10 TEttinger: ,(let [a (* 100000 (Double. 95.2)) b (* 100000 (Float. 95.2))] (= a b))

0:10 clojurebot: false

0:10 TEttinger: ,(let [a (* 100000 (Double. 95.2)) b (* 100000 (Float. 95.2))] [a b])

0:10 clojurebot: [9520000.0 9519999.694824219]

0:10 TEttinger: there we go

0:10 spradnyesh: got it! super thanks :)

0:11 TEttinger: .2 is a nasty one, since you'd expect it to be OK, it's only one place...

0:13 spradnyesh: issue is i was getting this from "lein autoexpect" and it gave me this failure:

0:13 in expected, not actual: [{:close 94.2, :low 92.1, :open 93.6} {:close 95.2}]

0:13 in actual, not expected: [{:open 93.6, :close 94.2, :low 92.1} {:close 95.2}

0:13 and i couldn't make head or tail out of it (for almost 2 days). today i looked at the types

0:14 TEttinger: and you helped me understand. thanks :)

0:14 TEttinger: no prob

1:01 pyon: When defining custom program entities (`deffoo`), is it normal practice in Clojure to equip them with metaobjects?

1:06 rhg135: what are metaobjects?

1:07 we do attach metadata, yes

1:09 bklebe: "yo dawg I heard you liked objects so I put objects on your objects and called them metaobjects"

1:10 https://en.wikipedia.org/wiki/Metaobject

1:11 WickedShell: I 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?

1:35 pyon: https://www.refheap.com/111252 -- Is there any way to factor out the anonymous function in line 15?

1:36 I find inline anonymous functions unnecessarily hard to read. :-|

1:46 tmtwd: how to use trig functions in clojure?

1:47 WickedShell: tmtwd, I've always done (Math/atan 1.0) etc

1:48 tmtwd: I get java.lang.ClassNotFoundException: Math.cos,

1:48 WickedShell: Math/cos

1:48 it's a static function

1:48 tmtwd: ah okay

1:11 diminishedprime: Hello 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?

1:11 Looking up java's file constructor, it seems like C:\\path would be right, but that's not working for me.

1:32 I ended up solving this problem with seesaw.chooser/choose-file, but I'm still not sure why it didn't work before.

1:35 WickedShell: diminishedprime, I'm getting away with relative paths like this on windows "icons/actions/expand.png" (and the same path on *nix)

1:41 diminishedprime: WickedShell: hmm... thanks for the reply. I'll have to look into seeing if absolute paths follow the same structure.

1:42 oddcully: also afaik there is no need for backlashes on windows with java

1:42 WickedShell: diminishedprime, It's also hard for me to say in that I've wrapped every path into (io/input-stream (io/resource foo))

1:42 oddcully: same as you don't need : on osx

1:45 TEttinger: aaaaaaaaaaaaaaaaagh... maven is driving me insane

1:46 there'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

3:29 I 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

3:32 WickedShell: TEttinger, 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)

3:33 TEttinger: png doesn't ever get filtered

3:33 I was using a raw stream of bytes with no extension

3:34 I 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?)

3:35 the trouble was it insisted my binary files were text

3:36 it would always cut out after a short in the short[] that was equal to 17239. then only 0 after that in the final stream

3:37 I suspect it's not a maven thing so much as a shade maven plugin thing

3:37 lein should get by without ever encountering this nicely

4:17 pyon: What data structure is internally used by Clojure's vectors?

4:42 sobel: IPersistentVector

4:50 pyon: Yeah, that's probably the name of the class, but what's the data structure?

4:50 sobel: that's the name of the interface actually

4:50 pyon: Ah.

4:51 luma: java arrays

4:52 pyon: Ah...

4:52 sobel: since no one seems to answer or be around on #clojurescript i'm trying here...

4:53 i 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

4:57 ahoegh_: 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?

4:57 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.

4:59 oddcully: sobel: something like (.focus (js/document.getElementById "theeditfield")) ?

4:59 sobel: oddcully: sure, something like that. the trouble i have is how to get the id of the edit field

5:00 ahoegh_: I found the answer.. RTFM :)

5:00 oddcully: sobel: provide one?

5:01 sobel: what i mean is: does your input field have one? and if not, why not provide one?

5:07 sobel: oddcully: it looks like data-reactid=".1.1.0" type ids are already generated

5:08 i'm generating these from a data structure, so customizing my own id is not preferable

5:15 oddcully: sobel: you need a simple id="xxx" attribute. .e.g [:input {:id "xxx"}]

5:16 sobel: 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

5:19 sobel: when 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?

5:25 oddcully: sobel: you e.g. get the parent [:li] of your button and use goog.dom.$$ to find your first input

5:26 sobel: the harder it is to find your "sibling" input the more i'd look for stuff in goog or other libs to help

5:27 sobel: 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

5:29 sobel: ok

5:29 i guess i was looking for a react shortcut

5:46 ok, 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

5:46 thx oddcully

9:05 sameerynho: how can I invoke a function dynamically by name in runtime ?

9:07 oddcully: ,((resolve (symbol "+")) 5)

9:07 clojurebot: 5

9:09 sameerynho: oddcully: http://dpaste.com/3FYEQSV

9:10 oddcully: if i pass "my_position" as command for call-command it can't find command-my-position function

9:11 oddcully: my_ vs my- ?

9:12 sameerynho: sorry my-position

9:15 luma: *ns* is always bound to your current namespace, so it's not necessarily the same namespace where call-command is defined

9:15 could that cause the problem?

9:15 sameerynho: hmmm no ,

9:17 oddcully: prn *ns* and command then for debugging?

9:21 sameerynho: #object[clojure.lang.Namespace 0x15c2a24a clojure.core]

9:21 #object[websocketclj_lab.core$command_my_position 0x61b84b5f websocketclj_lab.core$command_my_position@61b84b5f]

9:24 oddcully: doesn't look like a simple string to me. are you sure, that (str "command-" command) there actually produces something sane?

9:26 sameerynho: oddcully: yeah

9:26 I fetch the command name over network

9:27 luma: if your *ns* is clojure.core (like the print suggests), then your function tries to resolve your command name in the namespace clojure.core

9:27 and obviously, your command is not in clojure.core

9:28 sameerynho: luma: good point

9:31 luma: you were right

9:31 luma: but shouldn't *ns* refer to my current ns ?

9:32 luma: yes

9:34 sameerynho: weird

11:15 kungi: What java heap sizes are you using for a "default" ring application which writes a bit to database and "does not do much"

12:10 jonathanj: what's the easiest way to truncate a string to N characters?

12:10 justin_smith: jonathanj: (subs s 0 n)

12:11 jonathanj: oh, i was expecting to find something in clojure.string

12:11 meh, n has to be in bounds?

12:12 justin_smith: yes, subs is pretty low level

12:12 #(subs % 0 (min (count %) %2))

12:24 TEttinger: ,(apply str (take 10 "hello"))

12:24 clojurebot: "hello"

12:24 TEttinger: ,(apply str (take 2 "hello"))

12:24 clojurebot: "he"

12:31 justin_smith: that's easy I guess, but a terrible usage of resources

12:42 TEttinger: justin_smith: could the same be said of using clojure instead of java in most cases?

13:42 gfredericks2: anybody else waiting out the clojars outage?

13:45 TEttinger: gfredericks2: there's some weird outages all over

13:45 cloudflare seems to be having trouble

13:46 pastebin was down, then shapeways...

13:46 gfredericks2: TEttinger: if they're all in the linode ATL datacenter, then that explains it

13:47 TEttinger: atlanta getting rained out?

13:47 * gfredericks2 has no idea

13:50 hiredman: annoyingly 'lein classpath' even tries to connect to clojars

13:51 amalloy: hiredman: there's an offline flag you can pass

13:51 lein -o classpath

13:52 leindasho: when did core.logic come into this?

13:52 lein-dash-o: how did dashes drop out of my name?

13:52 clojurebot: hello

13:52 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline lein-dash-o

13:52 lein-dash-o: they're still there

13:53 oh you removed them only for the joke; okay

13:53 hiredman: amalloy: perfect

15:11 gfredericks: ~clojars is back

15:11 clojurebot: A nod, you know, is as good as a wink to a blind horse.

15:21 jonathanj: hrm, 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:21 i'd prefer to avoid just turning a keyword into a name, to give me a bit of flexibility

15:21 i'm not really sure how to spell this in Clojure though

15:23 taylor_sando: clojure.walk/postwalk can perform transforms. There is also a library I have used for transforming map keywords https://github.com/jeremyheiler/wharf

15:26 jonathanj: python has a function compress(data, selectors) that returns values from data when the corresponding selector is true

15:26 compress(['a', 'b', 'c'], [True, False, True]) # => ['a', 'c']

15:27 taylor_sando: Are you just looking for the keys with values that are true?

15:27 jonathanj: well, not really keys

15:28 i want to do something like: (compress ['Aye' 'Bee' 'Sea'] ((juxt :a? :b? :c?) data))

15:28 assuming the data is {:a? true :b? false :c? true} it would produce ["Aye" "Sea"]

15:35 taylor_sando: (defn is-predicate-keyword? [k]

15:35 (= (last (name k)) (last "?") ))


15:35 (reduce

15:35 (fn [acc [k v]]

15:35 (if (is-predicate-keyword? k)

15:35 (if (true? v)

15:35 (conj acc (apply str (butlast (name k))))

15:35 acc)

15:35 acc))

15:35 []

15:35 {:x :value

15:35 :x? true

15:35 :y? false

15:35 :z true})

15:36 Frozenlock: taylor_sando: I'd recommend to use refheap instead of flooding the channel :-/

15:36 https://www.refheap.com/

15:36 taylor_sando: First time using IRC, I was just going to make a gist

15:37 TEttinger: ,(filter identity (map (fn [[k v]] (when v k)) {:foo? true :bar? false :baz? true}))

15:37 clojurebot: (:foo? :baz?)

15:38 taylor_sando: https://gist.github.com/taylorSando/1d12038fd77fa6f71bd9

15:38 oddcully: ,(let [l1 ["a", "b", "c"] l2 [true false true]] (filter identity (map (fn [a b] (and b a)) l1 l2)))

15:38 clojurebot: ("a" "c")

15:42 jonathanj: (filter identity) is basically just to filter the nils?

15:43 luma: hmm, was going to suggest keep instead of filter+map, but apparently there's no keep for multiple seqs

15:43 jonathanj: oh well false not not nil

15:44 luma: yes, (keep first [true false true] ["a" "b" "c"]) was what i first expected to work

15:45 luma: jonathanj, well, that wouldn't work since keep returns a seq of (f item), so in that case it would just return (true true)

15:45 instead of ("a" "c")

15:45 jonathanj: true, #(when %1 %2) or something

15:46 maybe no need for the #()

15:46 anyway, it's unfortunate

15:46 oddcully: thanks

15:59 RedNifre: Hey 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:59 t with typed clojure?

16:00 (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:01 TEttinger: RedNifre: if you're doing android in clojure, you won't be the only one. there's definitely work being done there

16:01 skummet is a tool to look into for that

16:02 http://clojure-android.info/skummet/

16:02 RedNifre: Hey, it's you!

16:02 amalloy: RedNifre: 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:02 TEttinger: haha

16:02 RedNifre: Yes, I'm aware that work is done on making Clojure viable for Android development but I'm not convinced it's there yet.

16:03 TEttinger: RedNifre, yeah, I like Clojure a ton, but None sorta targets a different niche that I'm also interested in

16:03 RedNifre: amalloy 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:03 TEttinger: clojure can call java effortlessly

16:04 thanks to macros in clojure, it can potentially be easier to call java from clojure than to call java from java

16:04 calling clojure from java is definitely do-able but not quite as easy.

16:04 RedNifre: Right, calling Java from Clojure looks fine. I wonder about the other direction though.

16:04 TEttinger: clojure generates stuff that's compatible with java and can be called by java without needing to use the IFn stuff necessarily

16:05 gen-class is the main thing for that

16:06 if 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:07 RedNifre: Let'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:08 What 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:11 TEttinger: a 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:11 not sure about the name

16:12 rhg135: invoke

16:12 RedNifre: Say 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:12 rhg135: ,(.invoke + 1 2)

16:12 clojurebot: 3

16:13 TEttinger: https://github.com/rschmitt/collider

16:14 there is already a guava clojure wrapper

16:14 hm, no Function https://github.com/michalmarczyk/clojure-guava

16:17 RedNifre: Strange. 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:19 But 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:21 TEttinger: well 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:21 records I think are mostly meant to be consumed by java, but I haven't really used them

16:29 oddcully: RedNifre: 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:15 noncom|2: whats the most idiomatic way to update only values in a {} whose keys match a certain critetia?

17:15 i am thinking of select-keys + redude/update + merge

17:16 ahahaha

17:16 *reduce

17:16 oh.. no, i am wrong. select-keys can only pick a known key, not filter keys on criteria

17:17 ah, wtf, just a plain reduce with a matcher will do..

17:18 oddcully: also reduce-kv

17:18 noncom|2: yeah!, right, that's one step closer

18:01 irctc: Hi everyone.

18:01 justin_smith: hello

18:02 irctc: Does 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:02 Hi justin_smith! :)

18:02 justin_smith: irctc: you can have a cljc file that works in both clojure and cljs, that's the closest reasonable thing

18:03 rhg135: you can't AFAIK. you need a macro

18:03 irctc: What's a cljc file?

18:03 justin_smith: your clojure and cljs have different source-paths, but you can have some shared namespaces that work with both

18:03 rhg135: it compiles to both clj and cljs

18:03 justin_smith: irctc: it's a file using read conditionals to contain both valid clj and valid cljs code

18:03 rhg135: well in thory

18:04 irctc: Ok, thanks. I'll look into that then. :)

18:04 justin_smith: irctc: so this solution would be defining the function in a cljc file, so both clojure and clojurescript could use it

18:05 but 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:06 irctc: There's always a catch. lol :D

18:07 I 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:07 justin_smith: irctc: umm, that wouldn't even work

18:07 irctc: Why no?

18:07 justin_smith: irctc: what you need is to define a handler, then make an async call

18:07 irctc: not*

18:08 justin_smith: because 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:09 your best options are AJAX with a handler on your server side serving JSON, or a websocket

18:09 irctc: I 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:09 justin_smith: right, to call something on the server side, you need to make a request

18:10 or use a websocket - you have to have some way of communicating with the server from the browser

18:10 unless 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:11 irctc: Well 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:11 justin_smith: well, you can use AJAX

18:12 it's not as simple as just calling a clojure function, but it's not super hard either

18:13 irctc: So 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:15 Although 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:16 justin_smith: irctc: 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:16 but it sounds like you need the results of some clj function from the cljs code, and that you would use ajax for

18:16 the 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:17 irctc: Yea, 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:19 Ok, 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:20 justin_smith: what/

18:20 how is views.clj calling your cljs file?

18:21 irctc: Well, 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:22 Now, 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:23 justin_smith: yeah, that sounds about right

18:23 irctc: Ok, but then how do I call that clj function from my cljs file?

18:23 justin_smith: make the clj function a handler for an http request

18:23 call it via ajax

18:24 noncom|2: justin_smith: hi! so did you find out what was that big wait in your program?

18:25 irctc: Ok, 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:27 justin_smith: noncom|2: not yet

18:27 noncom|2: wow, looks like a big fish

18:27 just curious!

18:30 jfntn: Anyone knows the general approach for having optinal transitive dependencies in a library?

18:32 noncom|2: jfntn: you mean a way to know if a java class or a clojure ns is available?

18:33 jfntn: noncom|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:33 justin_smith: you can use resolve to find a var by its symbol, it returns nil if not found

18:33 jfntn: Would you be able to do that in the file's top-level?

18:34 justin_smith: jfntn: oh, for something like that I just don't declare a dep, but provide a namespace that works if that dep is available

18:34 jfntn: yes, resolve works at the top level of a file

18:34 jfntn: hmm ok this sounds a lot easier than I expected :p

18:35 noncom|2: justin_smith: will resolve also resolve vars from namespaces that are not yet required?

18:35 justin_smith: noncom|2: nope, it will return nil

18:35 but you can also use require with a try/catch followed by resolve I guess....

18:35 noncom|2: jfntn: justin_smith: probably a (require..) inside a try/catch can be useful then...

18:35 oh

18:36 yeah just remember that there's a (require) fn which does not have to go inside the (ns) declaration

18:36 and can be called anywhere

18:36 it will give a classpath error or something alike if it fails to load a ns

18:36 justin_smith: jfntn: 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:37 jfntn: justin_smith: yeah that sounds good

18:37 Do you just put the deps in your dev-profile and make sure to run this one in your repl?

18:37 justin_smith: jfntn: bonus if foo implements a protocol - then you can require the protocol and let the user supply something satisfying said protocol

18:38 jfntn: yeah that's the idea!

18:38 justin_smith: jfntn: or test profile, depending on the scope of the lib

18:38 jfntn: right, ok cool!

18:41 Ah, 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:42 justin_smith: sounds like "provided" too

18:43 jfntn: yeah, not sure I'm getting the differences...

18:44 irctc: justin_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:44 I appreaciate the help. :)

18:46 noncom|2: jfntn: justin_smith: hey there's the difference in the doc: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

18:47 justin_smith: noncom|2: cool, so the difference is that a runtime dep isn't even needed during compilation

18:48 irctc: Bye everyone. Take care! :)

18:48 noncom|2: bye! :)

18:48 jfntn: that sounds good, you'd also be able to provide version ranges if your code has specific api requirements wrt to the runtime lib

18:49 noncom|2: jfntn: is this a dependency management.. um.. paradise? :)

18:49 jfntn: hehe

18:49 noncom|2: so many features to just fit into all the cases you might need... :)

18:50 jfntn: justin_smith: are you distributing anything publicly with the method you described?

18:50 ..if I may ask

18:56 justin_smith: jfntn: funny enough, not currently (had one in the past which now explicitly requires the dependency)

19:00 JokerDoomWork: so many clojure peeps

19:00 Malnormalulo: well there's one fewer

19:02 noncom|2: so many-1 clojure peeps

19:04 rhg135: -2 now

19:05 noncom|2: so f(t) = N clojure peeps..

19:06 rhg135: It is time dependant, but I feel there are other variables

19:06 Malnormalulo: Nonetheless it is a valid function of time alone

19:07 rhg135: That it is

19:08 noncom|2: been recently reading on binary lambda calculus... i must say a very interesting thing..

19:08 just sharing

19:08 Malnormalulo: I am very embarrassed to admit that I've never learned how lambda calculus works

19:10 noncom|2: Malnormalulo: then i simply must share this with you: http://palmstroem.blogspot.ru/2012/05/lambda-calculus-for-absolute-dummies.html

19:10 JokerDoomWork: I tried reading about it once, but it seemed like really over my head at the time, I haven't tried in years

19:10 ty

19:10 noncom|2: Malnormalulo: enjoyed the article very much, it has nice colorful pictures :)

19:10 Malnormalulo: Awesome, thanks!

19:12 rhg135: I once implemented it

19:12 noncom|2: to 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:13 rhg135: It was nice but not as nice as the host language

19:13 noncom|2: rhg135: wow cool!

19:13 what was the host?

19:13 rhg135: Clojure

19:13 noncom|2: ah :)

19:14 well, lambda itself is cool, but what's especially fascinating is the binary form of it

19:14 this 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:15 looks very geeky

19:16 rhg135: so you've implemented a small dsl for lambda in clojure?

19:16 cloj_dev: is lazy evaluation commonly used in clojure?

19:16 noncom|2: cloj_dev: it is rather widespread and very encouraged

19:16 Malnormalulo: The core range function is built on the concept

19:17 cloj_dev: interesting

19:17 but its not so strict like in haskell

19:17 rhg135: Yeah, noncom|2, essentially a neutered fn.

19:17 noncom|2: cloj_dev: but it is not mandatory and not all funcs go with it

19:17 cloj_dev: define "so strict"

19:17 cloj_dev: in haskell almost everything is lazily evaluated

19:17 rhg135: Then I tried to build new ideas on it and failed

19:18 Malnormalulo: clojure--

19:18 noncom|2: cloj_dev: yeah, in clojure most operations on sequences are lazy. not so for other ops, since that's JVM

19:18 rhg135: that's interesting... what did you try and what failed?

19:18 rhg135: Like I tried to get rid of the fn object

19:19 Make it all a tree of semantic ops

19:19 morales: Isn'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:19 amalloy: there's not really a clojure spec

19:20 there's just, what does clojure-jvm do, what does cljs do...

19:20 noncom|2: morales: it could, theoretically, if you rewrite the core away from the JVM. it will differ a little

19:20 but i would LOVE to see clojure on LLVM, with all necessary changes it would require

19:20 rhg135: I'd be fun

19:20 It'd *

19:21 noncom|2: rhg135: so you wanted to go away from clojures fn?

19:22 clojure 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:22 rhg135: Yeah, from manually dealing with objects, just the semantics. Obviously this requires a compiler that I'm not smart enough to write

19:24 cloj_dev: (let [{one 2} [1 2 3 4]]

19:24 [one])

19:24 noncom|2: rhg135: 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:24 it is SKI though, but that makes it even more interesting

19:25 cloj_dev: when you do that, is one automatically cast to a keyword?

19:25 noncom|2: cloj_dev: no

19:25 cloj_dev: or a symbol rather

19:26 noncom|2: well, it is a symbol from the beginning

19:26 nothing changes

19:26 rhg135: Think dynamic haskell without typeclasses on steroids

19:27 noncom|2: it is destructuring the {}, effectively just assigning the value to symbol "one"

19:28 the way it does the destructuring and assignment is the way this particular destruction form is implemented

19:29 rhg135: interesting, is it possible, or should i say, feasible, to write a lambda language interpreter in clojure that does not rely on fn...?

19:31 cloj_dev: you can find the implementation of all possible destructurings in clojure.core/destructure or something like that

19:31 and see what they do

19:32 or just read some manual, coz the core is sometimes too much

19:32 cloj_dev: I have found destructing confusing for some reason

19:32 I'm getting used to it though

19:32 its used all over clojure, so you kind of need it

19:32 noncom|2: cloj_dev: destructuring is much like unification in logic

19:33 cloj_dev: haven't checked out logic programming yet

19:33 noncom|2: sometimes with syntactic sugar

19:34 cloj_dev: yeah, destructuring is vital! you can totally get away without it, but it is so conscise and clear..

19:34 saves much trouble

19:35 cloj_dev: yeah

19:35 I'll get used to it eventually

19:35 Malnormalulo: I've tended not to like destructuring in other languages, but the operator-first syntax does make it seem more appealing

19:37 rhg135: noncom|2: I used fn in the interpreter, but I can't see a way around it

19:37 noncom|2: rhg135: i guess the way around fn is going though eval...

19:38 eval and quoting

19:38 rhg135: Oh yeah, but that'd be even harder

19:39 Malnormalulo: Considering 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:39 noncom|2: rhg135: do you have your implementation available to public?

19:40 Malnormalulo: rhg135: just while we're at it, i should mention this: http://klisp.org/

19:41 did 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:42 and NEVER watch any klisp video on youtube...

19:42 don't say i did not warn you...

19:58 rhg135: Oh, implementing eval, fun D:

19:59 noncom|2: no since it didn't actually work

20:00 noncom|2: eh, well ok, just wondered what could be built upon your solution...

20:03 rhg135: Wow, am I wrong to question klisp's practicality?

20:03 noncom|2: rhg135: um, are you asking that after rading some manuals since there're a lot of real-life useable things?

20:04 sure klisp is born from a fundamental research effort, but i am sure it is practical at least on some level

20:04 rhg135: No...

20:04 noncom|2: it is not a pure theoretical languagte

20:04 rhg135: Hmm, interesting

20:04 Malnormalulo: LISP started life as a pure theoretical language, and now look where we are

20:05 noncom|2: also true. well, things start that way.

20:05 i 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:05 just like lamda calculus itself

20:06 it is just the concept is very fundamental and it changes too much to be easily estimated from now

20:08 rhg135: Hmm, the problem with these is mainly logistics

20:08 noncom|2: logistics?

20:08 rhg135: Aka actually using it, packing, etc

20:09 Malnormalulo: aside: am I right in interpreting `loop` as essentially just a `let` that you can recur to?

20:09 noncom|2: ah

20:09 rhg135: All the other stuff beside code

20:09 noncom|2: Malnormalulo: right. a let or a fn

20:10 rhg135: ah, yeah, the ecosystem

20:11 well as for klisp, i can say, it can be useable no less than, say, lua

20:11 rhg135: Yes, sorry my lexicon fails

20:11 noncom|2: sure there's no community around it :)

20:11 rhg135: That's good

20:11 noncom|2: it's too geek

20:11 yeah, i know you were referring to my previous phrase :)

20:12 rhg135: Yeah...

20:12 noncom|2: there are lots interesting languages like that..

20:12 their author and maybe some friends are the only community...

20:12 Malnormalulo: Most languages tend to start that way

20:13 Exceptions being mostly corporate-sponsored ones

20:14 noncom|2: yeah. i just wish some authors had more luck with finding like-minded people capable of maintaining and developing a community

20:15 well, at least, we have access to these concepts

20:15 if we could really research them, probably we could harvest some very valuable information matter

20:15 bandicoot is another such language

20:16 and J (a direct modern descendant of APL)

20:16 to name a few..

20:16 i really glad that clojure managed to get that far actually

20:16 a true savior these days...

20:38 cfleming: Is anyone using a project that depends on a concrete snapshot version and could run a quick test for me?

20:43 By which I mean 0.1.5-20151023.100204-2 instead of 0.1.5-SNAPSHOT

21:32 kenrestivo: i'm reading about orientdb and clojure... it says that the client api (on the java side) is not thread-safe

21:33 clojer: I 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:33 kenrestivo: which might explain why someone started (and abandoned) this https://github.com/eduardoejp/orientdb.clj

21:33 clojer: Add to a web app, that is :)

21:56 noncom|2: kenrestivo: does not look like a big problem: http://orientdb.com/docs/2.1/Java-Multi-Threading.html

21:56 kenrestivo: also, you can employ clojure to handle concurrency before interfacing with the db

21:57 however that might seem not straightforward to do

21:58 kenrestivo: also: http://stackoverflow.com/questions/26598815/using-an-in-memory-orientdb-in-a-multithreaded-application

23:07 jhn: i'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:07 *I

23:53 rhg135: jhn: selmer should work, you can also check how lein does it

23:53 jhn: rhg135: actually, comb looks like it fits my use case better. https://github.com/weavejester/comb

23:59 rhg135: Beside the 'side effects in templates' bit, that's a nice lib

Logging service provided by n01se.net