#clojure log - Oct 06 2015

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

1:21 hoppfull: I'm trying to figure out how to compile clojure to dll. Is there a special flag for clojure.compile? I'm using clojure clr

1:31 wmealing: i dont know how up to date clojure on .net is

1:31 i know thats not helpful..

1:32 TEttinger: wmealing, not that it matters, hoppfull left a minute before you said that and actually while I was typing a response too.

1:32 it is something I would like to know more about too

1:32 wmealing: oh man

1:33 Clojure.Compile.exe -include test.clj -include test2.clj -outputAssemblyName test.dll

1:33 apparently

1:33 (i dont have a windows machine to play with)

4:35 oOzzy`_: Is it considered good practice to comp functions and use a single map with that composed function or to chain multiple maps? As I understand it composition would have the benefit of not looping multiple times in situations where the input can be either vector or list.

4:36 amalloy: neither really maps multiple times because of laziness, but mapping multiple times does produce more intermediate garbage

4:36 er, loops multiple times

4:44 tgoossens: when I use clojure-csv to parse a CSV the column name of the first column always starts with: ��

4:44 I have no clue where this comes from

4:44 oOzzy`_: amalloy: Vectors aren't lazy though, are they?

4:44 amalloy: map is

4:44 oOzzy`_: amalloy: https://gist.github.com/ojung/78411bf3b8df0507057d

4:45 amalloy: the input data structure makes no difference, because the output is a lazy seq

4:45 oOzzy`_: Ah

4:45 I see

4:45 justin_smith: oOzzy`_: your difference there is that vectors are chunked

4:46 oOzzy`_: if you had a larger input, you would see that 32 items at a time were being processed

4:46 mavbozo: tgoossens, where do those csv comes from? it's possible that you encounter UTF_8 BOM

4:46 tgoossens: mavbozo, I just noticed that with 'slurp' it is already like that

4:47 oOzzy`_: justin_smith amalloy that explains things, thank you

4:47 tgoossens: mavbozo, apparantly it has to be UTF-16

4:47 never heard of that

4:48 oOzzy`_: Still, would you rather read code with chained map calls or one map call with a composed function?

4:48 mavbozo: tgoossens, java uses UTF-16

4:49 justin_smith: oOzzy`_: if you chained transducers via map with one arg only (the function), that would be another approach

4:50 ,(apply str (sequence (comp (map char) (map inc) (map int)) "hello"))

4:50 clojurebot: #error {\n :cause "java.lang.Character cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Character cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers inc "Numbers.java" 112]}]\n :trace\n [[clojure.lang.Numbers inc "Numbers.java" 112]\n [clojure.core$inc invokeStatic "core.clj" 895]\n [clojure.core$inc invoke "core.clj" -1]\n ...

4:50 mavbozo: tgoossens, I don't understand about this BOM machinery either, there's a recent discussion about this in clojure mailing list https://groups.google.com/forum/#!searchin/clojure/utf-8$20bom/clojure/Rk5JGhq-IJY/z_54tdaXENQJ

4:50 amalloy: oOzzy`_: depends on xontext and how you wrote it, probably

4:50 justin_smith: ,(apply str (sequence (comp (map int) (map inc) (map char)) "hello"))

4:50 clojurebot: "ifmmp"

4:51 amalloy: neither is unconditionally better. it's like in english: sometimes i use the first person, and sometimes one speaks in the third person

4:52 oOzzy`_: True. Doesn't really make a big difference anyway.

4:53 mungojelly: i like how here people talk about programming languages as language

4:53 justin_smith: with the transducer (single arg map) version, you can also intermix map with other operations like filter in a single step operation

4:54 mungojelly: i thought it might make sense to give my program a snappy CLI by having a python script talk to a daemon, is that ridiculous

4:55 oOzzy`_: justin_smith: how would that look like? Havn't used them yet, really :/

4:56 justin_smith: ,(apply str (sequence (comp (map int) (filter even?) (map inc) (map char)) "hello, this is gibberish from a transducer"))

4:56 clojurebot: "imm-!ui!!ccsi!gs!!usoes"

4:57 oOzzy`_: justin_smith: I would use the thread macro for those things

4:57 justin_smith: oOzzy`_: that's much less efficient

4:57 this is why those things exist

4:58 oOzzy`_: the thread version of the above would create 4 lazy-seqs, the transducer version shown creates 1

4:59 oOzzy`_: much less efficent? Pardon my ignorance, I have only watched the talk about transducers I fear.

5:00 justin_smith: oOzzy`_: it creates a bunch of lazy-seqs that are only used as intermediate steps, the point of transducers is not to have to pay for that overhead, by combining the operation into a single one with comp

5:01 amalloy: honestly though for most programs you dont' care about efficiency most of the time

5:02 justin_smith: sure, but the composed transducers also get something like the chained op syntax wise as well

5:02 with comp replacing ->>, and a small amount of extra wrapping

5:02 oOzzy`_: amalloy: doesn't look worse than -zz though

5:03 ->>

5:18 triss: whats the deal with type hints that look like this:

5:18 ^"[[Lclojure.lang.Atom;"

5:18 ^"[Lclojure.lang.IFn;"

5:18 justin_smith: triss: it's a java array of java arrays of clojure atoms

5:18 the second one is a java array of clojure functions

5:19 triss: ah thanks justin_smith. is that the only way to specify it? I'm working on some code with reflection warnings on an it's really ugly.

5:19 justin_smith: that's the name of the class, and yeah, it's ugly

5:20 triss: oh well... I wonder If I can refactor it away. thanks man

5:22 TEttinger: triss: you can refactor it to be even uglier. this is a valid type hint AND it breaks bracket matching in many editors: ^[[Lclojure.lang.Atom;

5:23 (not sure, but it may avoid a Class/byName call by not having it as a string. or it may not. you should still probably use the string)

5:23 amalloy: TEttinger: "valid" in the sense that it's not valid at all?

5:23 TEttinger: it was in earlier clojure versions

5:23 amalloy: no

5:23 it doesn't even get by the reader

5:25 TEttinger: ,(defn atom-arr [^[[Lclojure.lang.Atom atomz] @(aget ^[[Lclojure.lang.Atom atomz 0 0))

5:25 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

5:25 TEttinger: ,(defn atom-arr [^[[Lclojure.lang.Atom; atomz] @(aget ^[[Lclojure.lang.Atom; atomz 0 0))

5:25 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:25 TEttinger: I remember doing this in 1.4 or so

5:27 amalloy: no way. that can't have worked in any version of clojure since at least 1.2

5:27 TEttinger: it didn't have the semicolon, I know that much

5:28 amalloy: i wonder what would be the right way to search the git history to prove or disprove this claim

5:28 TEttinger: ,(defn floatarr [^[[F floatz] @(aget ^[[F floatz 0 0))

5:28 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

5:28 TEttinger: it was probably a bug if it did work...

5:29 oOzzy`_: justin_smith: how would sort and flatten work with transducers? they can't be part of the composition, can they?

5:29 TEttinger: I do remember profiling and seeinga ton of class/byname stuff

5:29 justin_smith: oOzzy`_: some functions have transducer versions, others don't

5:29 TEttinger: flatten's usually a bad idea

5:29 ~flatten

5:29 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

5:29 justin_smith: oOzzy`_: flatten doesn't have a transducer, but mapcat might

5:30 yeah, mapcat has a transducer, so you can do the saner alternative mentioned above

5:31 I don't think sort can be a transducer though...

5:32 oOzzy`_: Alright, cheers

6:15 clgv: Hello, is there an easy way to access the ChannelId associated to a channel of a stream when using aleph?

7:40 hoppfull: hello! I need help! I've compiled a clojure file into a .dll-file and now I am trying to call its methods from c#. Does someone have experience with this?

7:42 clgv: hoppfull: there is probably a simillar naming convention as in Clojure JVM

7:44 hoppfull: but the best way is to go through the official API which should exist for Clojure CLR as well

7:45 hoppfull: clgv: where can I find this official API?

7:45 clgv: I already know how to do this with JVM. The CLR is giving me difficulties.

7:46 clgv: hoppfull: there should be something similar as clojure.java.api.Clojure

7:46 hoppfull: https://github.com/clojure/clojure-clr/wiki/Using-ClojureCLR-in-a-C%23-project

7:47 hoppfull: clgv: yeah, I was looking into that

7:47 clgv: what is load.invoke("some.thing")?

7:47 clgv: hoppfull: just retrieve the variables you need via Clojure.var(...) and then invoke them as needed

7:48 hoppfull: e.g. IFn inc = Clojure.var("clojure.core", "inc"); inc.invoke(1);

7:49 <=> (clojure.core/inc 1)

7:51 hoppfull: clgv: I've got a file called hello.clj, with (defn f [x] (* x 2)). Would that be IFn f = Clojure.var("hello", "f"); f.invoke(5);?

7:51 clgv: yeah

7:52 hoppfull: clvg: mm. Another error. ArityException, wrong number of args(1)

7:52 clvg: this makes no sense

7:53 clgv: hoppfull: for `f`? then check its arity

7:54 hoppfull: It only takes a single argument.

7:56 This is a rather inelegant way of doing it. It should work seamlessly to compile it to DLL and just call members. The JVM-version works perfectly.

7:59 clgv: hoppfull: This is the official way to call your Clojure function from C#

8:00 hoppfull: I am not sure what your comparison scenario on the jvm is

8:01 Fender: Hi guys, I want an async web server in clojure (such as httpkit or ring-async), however, no single server is able to deal with an async channel for the complete response (only for the body). This means, I cannot set the HTTP status code of the response and I'll probably have to respond with 200 all the time. Is this usual, am I missing something or is there no fully async web server available right now?!

8:02 hoppfull: clgv: Compile hello.clj to hello.dll and hello.clj.dll, reference in c# like any other method.

8:02 troydm: what is the difference between (require 'test :reload) and (require 'test :reload :all) ?

8:02 what is the difference between (require 'test :reload) and (require 'test :reload :all) ?

8:02 what is the difference between (require 'test :reload) and (require 'test :reload :all) ?

8:02 clgv: hoppfull: This is not possible in Java neither

8:03 troydm: reloading the namespace only vs reloading all of its dependencies

8:03 hoppfull: clgv: Yes it is. I have an example right here that works wonderful.

8:04 troydm: clgv: does it removes all definitions from namespace when reloading it?

8:04 clgv: in both cases?

8:04 clgv: hoppfull: care to show that - so that I have an idea what you are trying to do

8:04 troydm: in none of them. that's why tools.namespace was written

8:05 troydm: clgv: ic, so I have to remove-ns

8:05 hoppfull: clgv: absolutely, let me write exactly what I do

8:05 clgv: give me a minute

8:05 clgv: troydm: or use tools.namespace ;)

8:07 troydm: clgv: ic, thx

8:07 hoppfull: clgv: here is hello.clj http://pastebin.com/YrqvVGzu

8:07 clgv: hoppfull: ah right, you are using gen-class

8:08 hoppfull: Then in repl I call (compile 'hello) which generates the class files

8:08 clgv: hoppfull: should be the same on the CLR

8:08 hoppfull: clgv: and visual studio recognizes the class and its member

8:09 clgv: and it recognizes the correct types and everything. But when I run it, it gives me errors.

8:10 clgv: hoppfull: you ruled out implementation or invocation errors?

8:11 xcv: What SQL generation libraries are recommended these days? I initially thought Korma was the go-to, but then I saw this https://twitter.com/ibdknox/status/557236505639665664 and this https://groups.google.com/forum/#!topic/clojure/rDyYHfC01RQ

8:12 Any opinions on honeysql or yesql?

8:12 tdammers: yesql is refreshingly simple

8:13 xcv: I'd lean more toward dynamic query generation like honeysql or Korma, but I'm open to new ways of doing things.

8:13 hoppfull: clgv: I surrounded it with try catch and analyzing the message, brb

8:13 tdammers: the downside is that if you have a lot of single-table CRUD stuff, you'll end up with a lot of repetitive query definitions

8:13 xcv: Yeah, that's what bothered me a bit. But of course, one can mix and match.

8:14 tdammers: also, if you need to construct queries dynamically, yesql is out

8:14 xcv: Yeah.

8:14 I guess yesql's sweet spot are complex, structurally static queries.

8:14 tdammers: yep

8:15 xcv: Building complex stuff with dynamic generators is a bit fiddly, but worth it if the dynamism is needed.

8:15 tdammers: if you can cover the complexity of your data with a relational model, and expose a statically-shaped interface at the query level, then yesql is gold

8:15 hoppfull: specified cast is not valied. I'm not casting anything. Is the int in c# not the same as int in clojure?

8:16 tdammers: c# may be casting implicitly, I think

8:17 clgv: hoppfull: what's your invocation look like?

8:17 hoppfull: clgv: I'm pasting my two files exactly

8:17 clgv: just a sec

8:21 http://pastebin.com/gzdFmkad, http://pastebin.com/NKpyRM94

8:22 clgv: hoppfull: you have defined `f` with arity 2 but call it with arity 1

8:22 freedon: Anyone have any pointers on resolving a FileNotFoundException Could not locate *__init.class error?

8:22 clgv: hoppfull: you probably want to remove the `this`

8:22 hoppfull: clgv: no, this has to be there. without it I get arity error. That I am assigning 2 with arrity 1.

8:23 oddcully: freedon: first shot in the dark: are you using a .cljc library with clojure 1.6 ?

8:24 clgv: hoppfull: I doubt that the `this` is correct there. That would explain the arity exception mentioned earlier

8:25 freedon: I'm not familiar with cljc unfortunately - I am using Clojure 1.7

8:25 clgv: hoppfull: hm, ok might be valid - I only use static main method so far...

8:25 oddcully: freedon: then maybe you could provide the exact error and your requires/project file in a gist/refheap/...?

8:26 hoppfull: clgv: the arity exception dissappears if I use this. Yes, if it's static, then no this.

8:27 clgv: I'm sure it's something simple.

8:28 tdammers: hmm, is there any documentation on kioo's emit-opts argument?

8:29 clgv: hoppfull: I am not quite sure which problem remains if the arity exception is already fixed

8:30 freedon: Thanks taking a look - much appreciated. http://pastebin.com/mHkteUkx

8:31 hoppfull: clgv: it says in the c# file. I get error message "specified cast is not valid."

8:33 oddcully: freedon: shouldn't that be imports then?

8:33 clgv: hoppfull: no idea, where that comes from. I have no c# availbe here atm

8:34 hoppfull: does c# use auto-boxing?

8:35 hoppfull: you could use a decompiler and look at the decompiled hello class

8:35 hoppfull: clgv: I solved it (almost)

8:36 clgv: don't know what auto-boxing is. The decompiler is new to me.

8:37 clgv: If I redefine the function type signature from (int -> int) to (double -> double) instead it works.

8:37 What kind of ints are there? int, short and byte, right?

8:37 clgv: probably "long" as well

8:38 and "long" to "int" conversion is usually not applied implicitely.

8:38 hoppfull: clgv: interesting. x is to 5 what 5.0 is to 5D.

8:38 tdammers: generally, C# is more lenient with widening casts than with narrowing ones

8:39 e.g., it'll complain about int -> byte, but not byte -> int

8:39 hoppfull: How do i specify a number as long?

8:39 freedon: oddcully: wow thanks big time. Think this is a classic case of trying to run before one can walk

8:39 hoppfull: 5L?

8:39 freedon: really appreciate your help.

8:40 luma: widening promotions (byte->short->int->long) can happen automatically, narrowing (long->int->short->byte) can't

8:40 hoppfull, in clojure, integers are by default Long

8:40 tdammers: although IIRC int -> double is considered widening

8:40 luma: ,(type 1)

8:40 clojurebot: java.lang.Long

8:41 luma: yes, integer type to float/double is widening as well

8:41 hoppfull: longs worked

8:42 troydm: how can I remove only one occurence of value from vector?

8:42 hoppfull: if I set type signature in hello.clj f::int->int, passing f(4) wont work. But setting f::long->long, passing f(4L) works, strange

8:43 Is there a way to specify that the 4 is an int the same way I specify that 4 is a long with 4L?

8:44 It seems trivial now but I'd like to figure this out.

8:48 clgv: hoppfull: you could assign 4 to an int variable

8:49 hoppfull: clgv: interesting

8:50 clgv: no, it doesn't work. I guess it doesn't really matters. Longs and doubles work. But it's annoying.

8:50 clgv: I hope bool works.

8:52 boolean wors

8:52 *works

9:02 troydm: what is the simplest way to check if vector contains any elements of another vector?

9:04 tdammers: convert both to sets, find intersection

9:06 ,(clojure.set/intersection (set [1 2 3]) (set [5 4 1]))

9:06 clojurebot: #error {\n :cause "clojure.set"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "clojure.set"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.net.URL...

9:06 m1dnight_: Is the dev of clj-slack here by any chance?

9:07 snowell: Looks like there's a julienXX here

9:07 That ^ should have pinged them

9:08 julienXX: hi :)

9:08 is there something I can do for you m1dnight_ ?

9:08 troydm: tdammers: I want to preserve the position of elements in first vector

9:08 fehrenbach: ,(type (int 1))

9:08 clojurebot: java.lang.Integer

9:08 m1dnight_: Yeah i was looking at your bot and i was wondering if you are actively maintaining it?

9:09 I would like to contribute.

9:09 E.g., a module system

9:09 tdammers: ,(filter #(contains? (set [3 4 5 1]) %) [1 2 3])

9:09 clojurebot: (1 3)

9:09 tdammers: something like this, then?

9:10 (or filterv if you want to keep it a vector)

9:10 julienXX: m1dnight_ hmm clj-slack isn't a bot, it a wrapper around Slack API but yes it's actively maintained and I accept PRs with pleasure

9:10 m1dnight_: I have written my own irc bot which has such a system. Maybe youd like it.

9:11 julienXX: sure we are talking about the same clj-slack (https://github.com/julienXX/clj-slack)?

9:13 m1dnight_: oh, it seems we are not! :)

9:13 oh wait. my bad. its clj-slackbot.

9:13 Sorry about the confusion!

9:13 snowell: Hey, I still brought people together :D

9:13 julienXX: np :D

9:14 m1dnight_: the user is verma. He doesn't seem to be here.

9:14 Oh well, Ill fork it and go my own way. I was hoping to work on it together with someone :p

9:14 snowell: It looks like verma has been receptive of PRs in the past

9:18 m1dnight_: hmm, the uberjar command doesnt seem to work and google fails me when I google the stacktrace. Can anyone give pointers? https://www.refheap.com/110321

9:19 `lein run` seems to work perfectly so I'm unsure what could be wrong.

9:21 vijaykiran: m1dnight_: possibly version conflicts

9:22 m1dnight_: try a lien deps tree and check

9:23 m1dnight_: lein deps tree doesnt give any output?

9:23 * m1dnight_ googles

9:23 m1dnight_: okay got it!

9:25 that is giving me some information but nothing concrete on jetty. Ill resolve these conflicts for now and then see.

9:27 vijaykiran: m1dnight_: looks similar - https://github.com/pedestal/app-tutorial/issues/42

9:41 m1dnight_: oddly enough I dont have a lein profile yet on this machine and its giving me the same issue. I have fixed all my dep confusions as well. still no fix.

9:42 vijaykiran: m1dnight_: is the project somewhere on Github ?

9:42 m1dnight_: right here: https://github.com/m1dnight/clj-slackbot

9:49 vijaykiran: m1dnight_: I suggest lein ancient - and update the versions

9:50 m1dnight_: it worked with this : https://gist.github.com/vijaykiran/9b5f8b9bc09c9b2641db

9:50 roelof: Hello, Is it normal in Windows 10 that I cannot install Lighttable in the directory downloads ?

9:50 vijaykiran: m1dnight_: comparing deps before and after is left as an exercise :P

9:51 m1dnight_: hahaha to the diff mobile

9:51 ,(inc vijaykiran)

9:51 clojurebot: #error {\n :cause "Unable to resolve symbol: vijaykiran in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: vijaykiran in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: vij...

9:51 m1dnight_: (inc vijaykiran)

9:51 vijaykiran: roelof: not sure what you mean by "install"

9:52 roelof: vijaykiran: I downloaded the zip file and I want to unpack it in Downloads. But I see then a message that I do not have the permissions to do so.

9:53 m1dnight_: wow the deps tree for clj-http has shrunken immensly.

9:53 (im not sure about my grammar there)

9:53 clgv: roelof: If it's on the C:\ drive that's the case since Win 7

9:53 roelof: you can adjust the permissions as admin

9:54 roelof: clgv: no it's a clean install of Win 10

9:54 vijaykiran: roelof: perhaps a stupid question, are you sure you "unpacked it" and not running from within the zip ?

9:54 roelof: vijaykiran: no. when I try that I see a message that iI first need to unpack it

9:55 vijaykiran: roelof: okay, just checking :) as clgv pointed out perhaps it has something to do with UAC stuff

9:55 * vijaykiran used windows long time ago

9:56 clgv: roelof: I meant they are enforcing those permission since win 7 and seem to continue in win 10

9:56 roelof: I now will try uppack in Documents

9:56 vijaykiran: Isn't Program Files\LightTable more apt ?

9:56 clgv: wait? you can download to "Downloads" but not unpack there? muhahaha

9:57 roelof: I never had this problems earlier. A week ago I could install it without any problems

9:57 Maybe IM going seek for a cloud enviroment for clojure. This sort of things are no fun in Windows

9:58 clgv: that is correct

9:59 clgv: roelof: you could install a linux on a usb flash drive and use that for clojure dev

9:59 xemdetia: or virtualbox

9:59 and have a real linux

10:00 roelof: I will look what I do

10:00 clgv: sure. if win 10 let's him ;)

10:00 roelof: thanks all

10:00 clgv: roelof: but you could just change the directory permission ^^

10:01 roelof: I will try

10:35 How can I make this script work at repl http://lpaste.net/142412

10:41 vijaykiran: roelof: just type it in

10:41 roelof: into the repl

10:41 roelof: So I cannot type it in a editor and then load it into repl ?

10:42 vijaykiran: roelof: depends on which editor you are using, you can also load a file into repl

10:43 roelof: I use the editor rom nitroius.io so I have to load it manually into repl

10:43 justin_smith: you can load from a file regardless of editor

10:43 vijaykiran: roelof: in the repl you can just use (load-file "filename")

10:45 roelof: (load "clore.clj") FileNotFoundException Could not locate fourclojure/clore.clj__init.class or fourclojure/clore.clj.clj on classpath. clojure.lang.RT.load (RT.java:449)

10:45 I do this in the root directory of my project

10:46 justin_smith: roelof: can you guess what to do about the fact that it looks for "fourclojure/clore.clj.clj"

10:46 vijaykiran: roelof: try (load-file "clore.clj") not (load "clore.clj")

10:47 http://webcache.googleusercontent.com/search?q=cache:ZDcY15uVus4J:https://clojuredocs.org/clojure.core/load-file

10:48 snowell: ,(doc load-file) ; vijaykiran: this is easier :)

10:48 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

10:48 vijaykiran: snowell: :) yup, I thought examples there were better

10:48 roelof: im giving up : fourclojure.core=> (load-file "clojure.clj") FileNotFoundException clojure.clj (No such file or directory) java.io.FileInputStream.open (FileInputStream.java:-2)

10:48 vijaykiran: roelof: what's your file name ?

10:49 roelof: also, looks like your repl is already in the core namespace of your project

10:49 roelof: the file name is core.clj

10:49 very wierd

10:50 justin_smith: roelof: why did you ask for "clojure.clj" when the file is named "core.clj"

10:50 vijaykiran: roelof: ah, then you are in the namespace, can you "call" the function in the repl ?

10:51 roelof: I was thinkig yes, but when I do ( -main) I see another error message

10:51 vijaykiran: roelof: there was no -main in your namespace from lpaste, so just type (palingdrome '(1,2,3)) and see what happens

10:52 roelof: im going crazy now (-main) works

10:54 is there a way to reload the file so the new contents is avaible ?

10:54 justin_smith: sure, the same way you load it the first time

10:55 if you used require you can add :reload

10:55 roelof: oke, rhanks all Its time for dinner now

11:29 troydm: how can I exclude definition from (:use (my.lib this that)) ?

11:29 in (ns clause

11:29 justin_smith: ,(doc use)

11:29 clojurebot: "([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."

11:29 justin_smith: troydm: :exclude

11:29 troydm: justin_smith: thx, I'll try

11:30 justin_smith: also, the general community consensus is require with :as is almost always better than use

11:30 pjstadig: or require with :refer

11:31 justin_smith: :refer has the same problem with reloads, but yeah

11:31 troydm: how do I use :exclude exactly?

11:32 I've tried (:use [[mylib :exclude funname] myotherlib])

11:32 but it seems it's not working

11:32 justin_smith: troydm: :exclude needs a vector

11:32 :exclude [funname]

11:32 also drop the output vector

11:33 (:use [mylib :exclude [funname]] myotherlib)

11:34 and don't use the (my.lib this that) shorthand

11:34 troydm: justin_smith: ahh, ic, thx

11:41 soleado: I'm calling a function in a library and it throws an exception if the argument isn't the expected type. Is there a more idiomatic way to handle this -- wrap the call in a try/catch or validate the type of type of the argument or anything else?

11:57 roelof: Is there a alternative for light table. I cannot unpack it and when I try to run I see a virus error message

12:04 oddcully: roelof: cursive

12:04 clgv: roelof: Counterclockwise. but you probably need to unpack all of those

12:08 roelof: thanks, I will look at both

12:11 oddcully: roelof: if you are by chance already familiar with emacs or vim you might be better off with those instead of learning new tools

12:15 soleado: sublime text 3

12:16 roelof: oddcully: nope iM not a vim or a emacs person. I like Lighttable but for some reason it wont install anymore

12:45 zexperiment: shame about light table, I'm using it with the vim bindings plugin

13:20 roelof: sveri: are you here ?

13:21 justin_smith: so I was trying to figure out why my core.async using function wasn't returning, turns out it's "async" http://i.imgur.com/05yKVcd.png

13:22 (the function that is, core.async is fine, I just have a bug that is, as can be seen in that thread trace, causing only one core.async thread at a time to be doing any work

13:22 cloj_dev: how can I update a map such that a nested vector is spliced?

13:23 so that there is no longer a nested vector

13:30 matthavener: (update-in mymap [:some-key] #(apply concat)) ?

13:32 er, with a % after concat

13:32 tsantos: When was the last time clojuredocs.org drew breath?

14:00 TimMc: Is that a fancy way of saying the site is down?

14:02 mavbozo: oh no! clojuredocs.org down

14:07 xemdetia: clojuredocs just needs some electrolytes

14:11 amalloy: oh, i thought it was a fancy way of saying it never gets updates

14:12 roelof: sveri: are you here ?

14:13 anyone else who has "installed " light table today ?

14:21 Nobody who can tell me if he zip from lighttable has a virus in it ?

14:33 ane: why would there be?

14:39 has anyone implemented some sort of Travis CI setup which pushes Codox docs to github pages?

14:40 can't seem to find anything

15:12 arrdem: clojuredocs looks fine right now...

15:23 zxc: Hello! What are the Clojure design patterns?

15:27 mavbozo: zxc, there's a talk about functional design patterns in clojure by stuartsierra http://www.infoq.com/presentations/Clojure-Design-Patterns

15:28 ane: arrdem: if you were replying to me, that's not at all what i was after

15:30 mavbozo: zxc, also there's a Clojure Applied book that helps me understand designing system with clojure

15:31 oddcully: and joy of clojure has a block about how to map OO patterns (if that was the question)

15:32 sandbags: any Cursive user know if there's a way to have it rename a .clj file to .cljc?

15:34 arrdem: cfleming: ping

15:35 sandbags: arrdem: thanks, I couldn't remember col's nick :)

15:35 arrdem: sure

15:35 sandbags: hrmm... from a github issue seems there isn't but may be in future

15:36 i do wish duckduckgo was a better SE

15:38 zxc: mavbozo: Tank you!

15:41 neoncontrails: Help, O sage ones. I've managed to quash all my dev server errors but one.

15:41 http://pastebin.com/8yn5Q9z6

15:42 Can anyone read a cause from this? I can't even find one of my src files referred to in the stack trace.

15:44 sandbags: neoncontrails: apologies in advance if this seems a dumb question but you haven't accidentally used a String for one of your namespace definitions?

15:45 just looking at the definition of Named and guessing where it might be relevant

15:46 neoncontrails: I suppose it's possible -- yeah, you're right that seems like a solid conclusion. Let's see

15:46 sandbags: it is a classic Clojure exception though :)

15:47 neoncontrails: (I seem to be limited to pico via sshfs right now for some reason. I miss my syntax highlighting!)

15:54 arry: Hi! I've got a few questions about Reagent/re-frame.

15:54 1. How to include HTML entities (eg "&bull;") in a Reagent component? If it's in a plain string, then it's html-escaped, not what I want.

15:55 dnolen: arry: you'll likely get a better answer in #clojurescript

15:55 arry: there's also an active Reagent channel in Slack these days

15:55 arry: thanks, I didn't realize there's a special channel for it

15:55 neoncontrails: Me either. That's good to know :)

15:59 sandbags: I undid a change I slipped in earlier that quoted the location of the handler location. This suppressed the error I was getting! And now "sudo lein ring server-headless" just idles and gives no output. Hmm...

16:01 cjlarose: Meetup Chris!

16:09 ucb: trying to get the clojure gradle plugin to work with a java project at work, but I keep getting errors since we have our own javadocs tasks

16:09 has anyone managed to get it to work with existing javadocs/test tasks?

18:01 {blake}: Given a board, b, and a position x and y, you can take a 3x3 area of that pretty neatly with: (map #(take 3 (drop (dec x) %)) (take 3 (drop (dec y) b))))

18:02 Except if the x and y are on the edges. And I can't think of a nice way to handle that. (Say, always return 3x3, but with nils if that would go off the board.)

18:02 gfredericks: if you used get-in with indexes I think you'd get nils

18:02 no I take that back

18:02 ,(get-in [2] 13)

18:02 clojurebot: #error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 535]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 535]\n [clojure.lang.RT seq "RT.java" 516]\n [clojure.core$seq__4116 invokeStatic "core.clj" 137]\n [clojure.co...

18:02 gfredericks: ,(get-in [2] [13])

18:02 clojurebot: nil

18:02 gfredericks: wait yes

18:02 it does give nils

18:09 cloj_dev: test

18:10 {blake}: gfredericks: Yeah, I had that...for some reason I wasn't liking it but now that I code it out, it's even cleaner.

18:10 justin_smith: ,(get-in [2] [13] :NUMBERWANG)

18:11 clojurebot: :NUMBERWANG

18:11 {blake}: Just: (for [x (range -1 2) y (range -1 2)](get-in b [x y]))

18:11 This is a family program. I can't use :NUMBERWANG.

18:12 justin_smith: {blake}: I'm guessing you haven't seen the skit

18:12 {blake}: I have not. I have seen many skits, involving dead parrots, bumblebees, head crushing, and what-not. But no numberwang.

18:51 cfleming: arrdem: ack

19:29 arrdem: cfleming: someone was asking about renaming a .clj to .cljc

19:30 wmealing: yeah, whats that about ?

19:30 clj vs cljc ?

19:30 cfleming: Oh right. Sadly not possible right now, although it sounds like sandbags found the relevant issue.

19:31 arrdem: on a personal note I owe you at least one drink for the intro to intellij.. saving my bacon right now as I'm playing with monojava repos

19:32 cfleming: Nice - will you be at the conj to pay up?

19:32 arrdem: nah conj is right in the middle of exams and this year is really hectic

19:32 not that I don't want to since Chas is making it out of the woods to appear

19:33 cfleming: Oh nice.

19:34 Bummer you won't be there, though.

19:34 I'll have to have the drink without you.

19:34 arrdem: I can't justify the time :/

19:34 cfleming: Although I'll be jetlagged up the wazoo

Logging service provided by n01se.net