#clojure log - Mar 16 2016

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

0:11 rhg135: maybe deep down you knew

0:38 sdegutis: Perhaps.

0:38 Why is all the code I've ever written in my past terrible?

0:39 rhg135: has anyone else besides you said that? We're our worst critics.

0:39 sdegutis: It's almost as if (is-code-good? code) is implemented as (.before (:date-written code) (java.util.Date.))

0:39 Or perhaps (constantly false).

0:40 Hmm. Nobody has seen my code, so nobody can say that.

0:40 Oops that should be .after not .before

0:40 Also it's cleaner looking this way (. (:date-written code) after (java.util.Date.)) but I don't know if that's valid syntax.

0:40 ,(. (java.util.Date.) before (java.util.Date.))

0:41 rhg135: (constantly false) sounds right

0:41 clojurebot: false

0:42 rhg135: ,(. (java.util.Date.) (before (java.util.Date)))

0:42 clojurebot: #error {\n :cause "java.lang.Class cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Class cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval49 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval49 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval49 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 692...

0:42 rhg135: ,(.. (java.util.Date.) (before (java.util.Date))) ; yay

0:42 clojurebot: #error {\n :cause "java.lang.Class cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Class cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval73 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval73 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval73 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 692...

0:42 rhg135: aww

0:43 ,(.. (java.util.Date.) (before (java.util.Date.))) ; heh

0:43 clojurebot: false

0:44 rhg135: you just need to squint a bit at that exception

1:04 sdegutis: wait, what?

1:04 Oh, missing period.

1:04 Heh.

1:04 ,(. (java.util.Date.) (before (java.util.Date.)))

1:04 clojurebot: false

1:04 sdegutis: clojurebot: YOU SUCK

1:04 clojurebot: It's greek to me.

1:04 sdegutis: exactly.

1:06 rhg135: Don't be mean to her!

1:15 * rhg135 pets clojurebot

1:20 sdegutis: You.. you gave it a /name/ ???

1:23 Goodnight rhg135

1:24 rhg135: You must be in Europe

1:24 Those timezones

1:25 sdegutis: Haha.

1:26 ,(java.util.Date.)

1:26 clojurebot: #inst "2016-03-16T05:26:17.092-00:00"

1:26 sdegutis: Hmm, yeah that's about 5 hours off.

1:26 Good night.

4:59 zipper: How can I find out how to identify the library I want from clojars? For example all I know is that I want to use `Thread/sleep`

5:01 ben_vulpes: that'd be a java call, zipper

5:01 ,(.sleep Thread 50)

5:01 clojurebot: #error {\n :cause "No matching method found: sleep for class java.lang.Class"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching method found: sleep for class java.lang.Class"\n :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]}]\n :trace\n [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 53]\n [clojure.lang.Reflector invokeInstanceMe...

5:01 ben_vulpes: or something like that

5:02 ,(sleep Thread. 50)

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

5:02 zipper: ben_vulpes: Let me google how to make a java call from clojure

5:02 qsys: '(Thread/sleep 50)

5:02 ,(Thread/sleep 50)

5:02 clojurebot: nil

5:02 qsys: sleep is a static of class 'Thread'

5:03 so you call it with (Thread/sleep xx)

5:03 http://clojure.org/reference/java_interop

5:07 zipper: I get a null pointer exception on `((Thread/sleep 1000) (println "hi"))`

5:07 Even though it does delay and prints as expected.

5:07 Then the exception comes later.

5:08 qsys: Thread/sleep returns nil

5:09 luma: you're calling the return value of Thread/sleep as a function

5:09 qsys: so your expression evaluates, if I'm right, to (nil (println "hi"))

5:09 luma: it returns nil (and so does println), so you're actually calling (nil nil)

5:09 ,(nil nil)

5:09 clojurebot: #error {\n :cause "Can't call nil, form: (nil nil)"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Can't call nil, form: (nil nil), compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6875]}\n {:type java.lang.IllegalArgumentException\n :message "Can't call nil, form: (nil nil)"\n :at [clojure.la...

5:09 qsys: and than 'nil' is a 'function call'

5:09 thx luma :p

5:09 zipper: I see

5:10 i-blis: qsys: wrap in a do

5:10 luma: ,(do (Thread/sleep 1000) (println "hi"))

5:10 clojurebot: hi\n

5:10 i-blis: ,(do (Thread/sleep 3000) :value)

5:10 clojurebot: :value

5:41 zipper: Hey why would this require be failing on me https://www.refheap.com/4ecaf595303df887e0cad70e5

5:42 hiredman: there is no namespace core.async

5:43 ridcully_: is :gen-class a thing in cljs?

5:43 hiredman: nope

5:43 ridcully_: guessed so

5:44 zipper: I'm not using cljs

5:45 It seems that I am though. I am currently just simulating uploads.

5:45 ridcully_: but require-macro/include-macros is cljs only (right?)

5:45 zipper: Here's a better one then https://www.refheap.com/2bb002a66f61f1c2641410321

5:46 Improved and the error has reduced.

5:46 ridcully_: I am learning so much in parallel it's confusing.

5:47 FilenotFoundException hmmm maybe it hasn't downloaded the lib

5:52 How can I see the return values of `ret-num` in the repl?

5:54 AndreasO: Draw multiple objects on seesaw canvas, not knowing amount or places beforehand?

7:24 aurelian: hi there... I need to collect some data by doing some api calls, but now I have to add another data source, another service that will basically return same kind of data.

7:24 now, I've been trying to figure out what's the best way to do that, should I use defprotocol or definterface or just stick with simple fn and not overthink this thing?

8:31 adam2: Hi there !

8:34 I have a bit of a hard time finding good doc about macros in clojurescript

9:15 iMadper: Hi. I have following code to read logs into list from a file. (println "loading file done in: " (time (def lines (str/split-lines (slurp "log2"))))) However it runs extermely slow. (~3000ms) (compare to golang or Crystal-lang in 100ms) May I know what's the correct way? :-)

9:16 The log2 is about 300MB

9:18 oops, it should be read as "(~13000ms)"

9:20 opqdonut: you could write your own loop that uses BufferedReader.readLine

9:20 and you could also profile slurp and split-lines separately

9:20 dysfun: slurp is really meant for reading small files

9:21 iMadper: opqdonut: Thanks a lot. I will give it a try.

9:21 dysfun: and split-lines is probably not horrifically efficient

9:21 iMadper: opqdonut: slurp is slow as well..

9:21 opqdonut: it seems split-lines just calls java's String.split

9:21 dysfun: if you need high performance IO, the java reader stuff is worth looking into

9:21 opqdonut: but still, if you have lots of lines it doesn't make sese to read the file into a huge string and then split

9:22 iMadper: dysfun: Yeah you are right. Slurp is slow for a big file.

9:22 opqdonut: https://clojure.github.io/clojure/clojure.java.io-api.html lots of useful stuff here

9:22 dysfun: slurp is more a convenience for when you're in the repl and want to play with some data

9:22 iMadper: I see. Thanks you all.

9:22 opqdonut: e.g. (input-stream "filename") should give you something you can call .readLine on

9:22 iMadper: I'll try some other api. :-)

9:23 opqdonut: sorry, (reader "filename")

9:26 dysfun: bufferedreader is good because it will read in large chunks

9:27 so you're trying to parse a logfile?

9:27 iMadper: dysfun: yes.

9:27 dysfun: is it a widely used format?

9:27 iMadper: dysfun: No.

9:27 dysfun: ah

9:28 do you have to read a lot of them?

9:28 as in is performance a hard requirement here?

9:28 iMadper: dysfun: not a hard requirement. I just want to know why my program is so slow...

9:29 dysfun: ah right. well if you don't have strong performance requirements, you might find something like parse-ez quite helpful

9:29 but you'll have to google it because i don't have a browser installed yet on this machine :)

9:30 iMadper: dysfun: Yeah, I can google it even if I'm in China. lol

9:30 dysfun: oh is google forbidden at the minute?

9:30 iMadper: yes.

9:30 dysfun: and baidu has been serving malware in its ads

9:30 quality

9:31 iMadper: Sometimes you just won't get the correct answer by using Baidu...

9:32 dysfun: i remember at my college (a top 20 college in britain, thus very attractive for rich chinese parents to send their kids off to get educated)

9:33 we were having an 'everyone in the year' presentation sort of thing and the woman on the stage said "be sure to google tiananmen square while you're here"

9:33 iMadper: lol~

9:34 rks: lol

9:35 did anyone heard about shenlanguage

9:35 ?

9:35 i just visited their website

9:35 dysfun: no, what's their USP?

9:36 rks: you can visit their website http://shenlanguage.org/

9:37 wink: was that the one with the license kerfuffle?

9:37 rks: a lisp dialect that have types, pattermatching like prolog

9:37 dysfun: hrm, interesting

9:37 probably not interesting enough for me to bother learning, but interesting enough to look at

9:38 rks: it grew some interest on me

9:38 dysfun: i'm sceptical that lisps with type systems work terribly well

9:39 rks: i see

9:39 dysfun: i like haskell's type system, i like clojure, but the intersection of them is a bit weird

9:39 rks: in clojure in have schema / typeclojure

9:39 dysfun: and syntax for type annotations is universally awful

9:39 rks: *it

9:40 i agree

9:40 made in china :)

10:10 sdegutis: Is there some nifty way to replace nils with zero when adding?

10:10 fnil comes to mind, but I don't remember why it's there

10:11 ,(+ ((fnil + 0) nil))

10:11 clojurebot: 0

10:21 sdegutis: Never mind.

10:27 pyr: hola

10:38 faxmodem: que tal?

10:38 oracle123: I have some code as data in a file, but how to read it out as code?

10:38 (read-string (slurp "my.ini" :encoding "utf-8"))

10:39 I use that code, but it doesn't work

10:39 The content of the file is {:accounts 1 :bidding? false :start-webdriver? true}

10:39 But the result of read-string is empty

10:40 opqdonut: does the slurp work on its own?

10:40 because that does look correct

10:40 oracle123: it works for (slurp "my.ini" :encoding "utf-8")

10:40 opqdonut: what's the result of that?

10:40 oracle123: it should show the good result

10:41 wink: (:accounts (read-string (slurp "my.ini" :encoding "utf-8"))) -> 1

10:41 works for me

10:41 oracle123: If I println , then the result of slurp is {:accounts 1 :bidding? false :start-webdriver? true}

10:41

10:41 wink: maybe your file contents is different from what you pasted

10:41 oracle123: not sure whether the encoding is the problem

10:42 Original it works on my linux, but when I share it with my friend who are on windows, then it failed

10:42 So I save it in UTF-8 in notepad on windows and copy to linux

10:43 opqdonut: you could use (seq (slurp "my.ini" :encoding "utf-8")) to see what characters the file contains

10:43 in case there is something weird there

10:44 wink: maybe try a clojure.string/trim around slurp as well

10:46 oracle123: I tried trim, still doesn't work

10:46 opqdonut: what did seq give?

10:46 oracle123: if use seq, I could see \return \newline

10:47 is that the problem?

10:47 wink: should not if you use trim

10:47 opqdonut: that's not a problem anwyay

10:47 oracle123:

10:47 (println (seq (load-config "/home/oracle/clojure/lein/page_scan_controller/config_test_no_chinese.ini")))

10:47 opqdonut: ,(read-string "{:hello 1}\r\n")

10:47 clojurebot: {:hello 1}

10:47 oracle123: ( { : a c c o u n t s 1 : b i d d i n g ? f a l s e : s t a r t - w e b d r i v e r ? t r u e }

10:47

10:48 opqdonut: no don't println it

10:48 just run it and show what you see in the repl

10:48 or if you're not in a repl use prn

10:49 prn is what you should use when debugging, it doesn't hide stuff

10:49 oracle123: (\ \{ \: \a \c \c \o \u \n \t \s \space \1 \space \: \b \i \d \d \i \n \g \? \space \f \a \l \s \e \space \: \s \t \a \r \t \- \w \e \b \d \r \i \v \e \r \? \space \t \r \u \e \} \return \newline)

10:49

10:49 that's the prn

10:49 opqdonut: yeah that looks ok

10:50 oracle123: then why read-string return nothing?

10:51 opqdonut: are you certain it returns nothing? does nothing mean it returns nil?

10:52 prohobo: NOTHING

10:52 oracle123: in cider, it shows nothing, but when check it's type, it's clojure.lang.Symbol

10:53 opqdonut: hmm

10:53 oracle123: I can't see anything if run the read-string

10:53 but if use (type (read-string (load-config "/home/oracle/clojure/lein/page_scan_controller/config_test_no_chinese.ini")))

10:54 opqdonut: maybe the first empty character in that string is some sort of weird non-breaking whitespace

10:54 which gets read as a symbol

10:54 oracle123: ok, let me delete the leading invisible char

10:55 opqdonut: ,(read-string "\u00A0{:hello 1}")

10:55 clojurebot:  

10:55 opqdonut: something like that

10:55 my repl shows a ? character instead of an empty line

10:56 it might be the utf-8 byte order mark, created by notepad

10:56 ,(read-string "\uFEFF{:hello 1}")

10:56 clojurebot: 

10:56 opqdonut: no idea why it shows up as "\ " and not \uFEFF or something

10:57 oracle123: yes, must because of the notepad, since when I work on linux native file, it works well

10:58 but faield when work on the file coped from window notepad

10:58 any workaround?

10:59 In windows the repl show ?, in linux it show nothing

10:59 opqdonut: don't have BOMs in files

10:59 is the best solution

11:00 oracle123: so don't use notepad?

11:00 opqdonut: yeah

11:00 oracle123: then use what editor? the custome is not IT guys

11:00 and I need to give them a tool to edit the file

11:00 I have put the configuratoin in the file,

11:01 opqdonut: well you can ask them to save as ascii

11:01 or perhaps you can remove the BOM when reading

11:01 oracle123: But I have Chinese in the data

11:01 opqdonut: oh ok

11:01 oracle123: then how to remove BOM?

11:02 opqdonut: clojure.string/replace

11:02 for instance

11:02 ,(clojure.string/replace "\uFEFF{:hello 1}" #"\uFEFF" "")

11:02 clojurebot: "{:hello 1}"

11:02 oracle123: great, let me try :)

11:05 opqdonut: googling reveals lots of problems with BOMs in clojure, it's kinda dumb that the reader doesn't support it

11:08 oracle123: yeap, it works, thanks very much

11:08 dysfun: opqdonut: that should probably be anchored to the start of string. the string is otherwise invalid

11:08 opqdonut: I don't think the BOM can occur anywhere else

11:08 dysfun: not and be valid, yes

11:08 opqdonut: but sure, why not

11:09 oracle123: you can use #"^\uFEFF" as the replacement regex for added safety

11:09 dysfun: if you can't trust a tool not to put a BOM except at the beginning of the string, you can't trust it to spit out unicode, period

11:09 opqdonut: would also give performance in case the string is long

11:09 dysfun: that was the main reason i suggested it, yeah :)

11:09 opqdonut: "if you can't trust a programming language to hand BOM you can't trust it to handle unicode, period"?

11:09 *handle

11:10 dysfun: clojure handles utf-8 absolutely fine

11:10 oracle123: should it be a bug? of just as design?

11:10 dysfun: well, i do think it is a bug, but i don't know whether reporting it would result in it being fixed

11:10 opqdonut: I think it's a bug, but opinions may vary

11:11 dysfun: there is an argument that you should be decoding the string, for example

12:57 amalloy: the BOM should be handled when reading the file, not when processing the string

12:57 whatever file-reading mechanism load-config is using

12:58 it should already be gone by the time you call read-string

12:59 dysfun: it should, but also clojure should be quite capable of skipping over a BOM

13:46 adam1: Hey there, any expert to generously give me a hint about macros in clojurescript ?

13:48 rhg135: They have to be in. .clj files that you require-macros in

13:48 adam1: Yes, but i get a "Could not locate pro/macro__init.class or pro/macro.clj on classpath" error and I'm not sure why

13:49 I've got a macro.clj file in the same directory as my *.cljs file, have specified the right namespace...

13:50 rhg135: Does that file actually load? Look at the cause there

13:51 Squint at it

13:53 adam1: Hmmm

13:54 rhg135: You can probably get better information trying to require it in a clj repl. Keep in mind the expansions will not work

13:55 adam1: Not quite sure what you mean by "squint", my english is pretty decent nonetheless :p

13:57 But I can require the macro file from the repl

13:57 rhg135: I mean those traces sometimes require you to look at them differently

13:58 That's strange, maybe there's more people that actually use cljs

13:59 adam1: I'll try to figure it out, quite weird indeed

14:16 Well, kinda works now

14:19 justin_smith: ben_vulpes: do you want Thread/currentThread ?

14:19 ugh, n/m, scrollback, sorry

14:52 sdegutis: My muscle memory suddenly went blank, I can't remember how to jump to the definition of a symbol, or what that's even called in Cider. Anyone remember?

14:53 amalloy: M-.

14:53 sdegutis: Oh right, C-u M-.

14:53 Thanks amalloy.

14:54 amalloy: we may not see eye to eye on everything, but you're a swell chap and a mighty fine Clojurian at that

14:54 amalloy: C-u? what does it do without that prefix?

14:54 sdegutis: amalloy: I think it asks you to specify what symbol without the prefix.

14:54 amalloy: with the prefix, it just jumps to the symbol under your cursor.

14:54 amalloy: lame. it should be the opposite imo

14:54 sdegutis: For sure.

14:55 amalloy: it's the opposite in slime

14:55 sdegutis: Isn't that a predecessor of Cider? I vaguely remember that name.

14:56 Oh right, it's the CL thing.

14:56 Haha, "Common Lisp".

14:56 justin_smith: and alos a cider precessor

14:56 amalloy: "precessor": it was a cesspool before cider was?

14:56 sdegutis: Haha. "Cesspool."

14:56 justin_smith: oops, heh

14:57 amalloy: ps i don't feel that strongly about cider. just an opportune pun

14:57 justin_smith: amalloy: https://en.wiktionary.org/wiki/precessor

14:57 :P

14:57 amalloy: I read a novel from the 18th century recently, I think it did damage

14:57 sdegutis: Good day, gentlemen.

14:57 amalloy: "obsolete" in 1913. rip

14:57 justin_smith: like I said, it's all 18th century literature's fault

14:58 amalloy: almost as outdated as slime

15:01 sdegutis: Hmm, seems the chatter died down in here. Welp, back to being productive for me I guess.

15:38 rhg135: justin_smith: that's not a unfortunate thing. now we have things like anyways, ain't, and bad meaning good

15:39 RedNifre: Heya. I first installed Clojure from the Ubuntu repository and got an outdated version but I could start .clj files with "clojure bla.clj". I got rid of that version and used leiningen instead. Does the leiningen repl only work for projects or can I start a single file with it?

15:39 When I try "lein run somefile.clj" it looks for a namespace in a missing project file.

15:40 Also, is it possible to write a shebang and execute clj files like "./somefile.clj"?

15:40 rhg135: I want to say yes, but that will only help if you have no deps

15:40 justin_smith: RedNifre: on linux a jar file is executable, so you can do ./clojure-1.8.jar somefile.clj

15:40 rhg135: and yes to shebang

15:41 justin_smith: oh, yeah #!/path/to/clojure.jar on the first line of the file

15:41 hiredman: it is

15:42 how to do that is kind of complicated, because it turns out that how the shebang line is handled isn't entirely standard on different unix like systems

15:42 rhg135: if you have deps, just make a project

15:42 hiredman: osx is kind of the easiest to make work, linux takes more work

15:42 rhg135: or inlein I guess

15:42 justin_smith: there's that new thing hyPiRion did, is that inlein?

15:42 hiredman: osx is easy to make work because it handles multiple arguments to the program in the shebang line like you would expect

15:43 rhg135: yeah that thing

15:43 I've never used it, but it should work here

15:44 RedNifre: Hm, sounds like I couldn't just hand a .clj script to somebody else though. I guess making a jar is more reliable, huh?

15:44 rhg135: yeah

15:44 hiredman: yeah

15:44 rhg135: windows...

15:45 also, deps

15:46 hiredman: https://gist.github.com/hiredman/a8fb63ec64704ecb967f this style shebang works on osx

15:48 on linux I've done stuff like https://gist.github.com/hiredman/0ecf33119a470339c89e so the file ends up valid shell and valid clojure

15:48 rhg135: yay for hardwiring paths, but I didn't know linux didn't habdle arguments

15:48 hiredman: (with the actually clojure code following that)

15:50 you can actually avoid all that, by putting the java -jar clojure.jar bits in a shell script, and using that as the shebang line, but there is no standard way to do that

15:52 rhg135: maybe I only dreamt it worked

15:52 RedNifre: Hm, could I just put #!clojure at the beginning of the file and tell people to make sure they alias clojure="path/to/the/clojure.jar" ?

15:52 rhg135: I could have sworn I tried the former and it ran fine

15:52 justin_smith: I don't think a shebang will check aliases for the first line

15:52 hiredman: I am not sure aliases work for that, and you need the whole java bit, not just the clojure jar

15:52 RedNifre: jar it is then.

15:53 hiredman: the jar is easier to deal with dependencies too

15:53 rhg135: plus it's pretty easy to run still

15:54 java -jar ...

15:54 RedNifre: Different topic, I have a problem about namespaces. I think I might kinda understand namespaces, not sure. To learn clojure I thought it might be fun to write a tiny text adventure. What I have right now is a dictionary from commands to functions, i.e. { "look" (fn [gamestate] ...) "take" (fn [gamestate] ...)} etc. Would it be a good idea to somehow turn that into a command namespace and replace it with (defn look [gamestate] ...) (defn t

15:54 ake [gamestate] ...) etc.?

15:55 justin_smith: RedNifre: having an explicit map from string to action is a nice way to isolate your implementation from the text UI

15:56 rhg135: I think either would work, but being explicit is nice

15:56 justin_smith: rather than some scheme which ends up being essentially "take user input, automated transform, then eval", which is much messier

15:56 rhg135: my concern is the code that ends up mapping from the user input to the functions - if you don't have a hash-map with the mapping, you end up just giving the user a weird repl

15:57 which I mean hey, a repl is a UI too I guess, but might as well give them a real one if that's what it is

15:57 rhg135: not really if you limit it to just ns-resolve

15:58 RedNifre: But if I had the commands in a namespace I could have language based mappings so it would still be clean i.e. (def EN {"look" look}) (def DE {"schau" look}) etc. Or would that be (def EN {"look" command/look})? Hm.

15:58 justin_smith: ,(ns-resolve *ns* 'eval) rhg135: nope

15:58 clojurebot: #'clojure.core/eval

15:58 justin_smith: it's jut a weird repl, even with ns-resolve

15:59 rhg135: you could tag your vars, but it is messy as you say

15:59 RedNifre: Okay, so I'll keep the {"string" (fn..)} thing. What would be a good use for namespaces then?

15:59 justin_smith: now you could make an explicit hash-map lookup in the definitions of that ns alone, but the real hash-map in the file has the advantage of being more explicit

15:59 rhg135: look it up in ns-publics too

16:00 indeed

16:01 justin_smith: RedNifre: namespaces are for making collections of functions that combine to provide some kind of domain of functionality, where your project is easier to understand, maintain, and use if the functions are grouped in that way

16:01 functions plus a few constant values too I guess

16:01 RedNifre: But doesn't that sound EXACTLY like "bunch of game commands"?

16:01 justin_smith: RedNifre: absolutely not

16:02 RedNifre: I would make that hash map from command names to functions in one ns, and define the individual functions in namespaces separated by theme or type of action

16:02 start with oen or two, split them as they become messy

16:03 RedNifre: Alright, I'll keep it as is and see where I'll end up.

16:03 Thanks for the feedback.

16:48 ben_vulpes: anyone ever get "NoClassDefFoundError org/apache/http/conn/ManagedHttpClientConnection com.amazonaws.http.protocol.SdkHttpRequestExecutor.doSendRequest " when using amazonica?

16:49 amalloy: probably a dependency-version conflict

16:49 hiredman: ^-

17:03 ben_vulpes: exciting!

17:05 amalloy: shall i just start snipping libs out until i find the conflicting one?

17:06 amalloy: see what `lein deps :tree` thinks

17:06 it'll point out conflicts

17:06 (you probably have a lot of conflicts that are just lurking, and then this one that's actually doing damage)

17:09 ben_vulpes: amalloy: good grief

17:09 been doing this long? :P

17:09 * ben_vulpes goes to exclude the world

17:09 amalloy: doing what long?

17:11 ben_vulpes: working with clojure, answering questions in irc

17:13 amalloy: yes

17:14 ben_vulpes: it shows

17:14 (thank you)

18:18 kellytk: Is there a channel for lisp web dev? I found noone in #om

18:19 rhg135: I don't think there is any I know of

18:20 kellytk: Oh, thank you rhg135

18:21 rhg135: here is usually pretty useful

18:21 TEttinger: yep

18:25 rhg135: #clojurescript can be nice too, but dnolen is also here ;)

19:34 gfredericks: is there a clojure-flavored lisp somewhere that aims at purity & simplicity and a formal spec?

19:35 amalloy: dang gfredericks, you are complecting '&' and 'and'

19:35 rhg135: purity? as in haskell with ()

19:35 amalloy: you are forbidden from participating in this simple lisp

19:35 rhg135: what does () have to do with it?

19:36 rhg135: it doesn't really

19:36 you can have lists without ()

19:36 gfredericks: oh I also forgot to say that I was imagining not a full general-purpose language

19:36 so IO not strictly necessary

19:37 amalloy: gfredericks: lambda calculus

19:37 gfredericks: you could say what I'm imagining is more of an edn-processing subset of clojure

19:38 but that isn't afraid to break compatibility to eradicate edge cases

19:38 or to simplify things

19:38 e.g., only one integer type

19:39 no vars

19:39 hiredman: have you heard of klambda?

19:39 rhg135: lambda calculus has only one type

19:39 gfredericks: nope

19:41 something to do with shen?

19:41 hiredman: it is the langauge for bootstrapping shen, I guess

19:41 gfredericks: aah

19:42 hiredman: I tend to think of those sorts of things as urlisps

19:43 they are sort of like ir languages in compilers, or bytecodes in runtimes

19:43 gfredericks: I think I keep imagining it as a language that could be used to describe business logic in a sterile and easy-to-analyze environment

19:43 and especially could be implemented in any clojure dialect fairly easily, following a spec so as to give identical behavior

19:43 hiredman: clojure without '.'

19:44 gfredericks: '.' meaning interop?

19:44 hiredman: yeah

19:44 gfredericks: yeah that'd be a big part of it

19:44 gilch: Maybe implement edn in Scheme?

19:44 rhg135: specs, pfft. C has done fine so far without those

19:45 hiredman: there is so overlap with this with sandboxing

19:45 gfredericks: yes absolutely

19:45 hiredman: which I have spent time thinking about re clojurebot

19:45 gfredericks: executing untrusted code is another use case

19:46 AWS lambda etc

19:46 gilch: WISP is Clojure-like.

19:47 gfredericks: looks JS oriented?

19:47 hiredman: for sandboxing at various times I have looked at adding hooks to the compiler so you could take control over how it compiles special forms and writing an interpreter for clojure

19:49 but it sounds like the difference is, while for sandboxing I largely wanted clojure semantics, with some extra control points

19:50 gfredericks: yeah definitely

19:50 hiredman: while you want a total subset of clojure

19:50 gfredericks: except the parts I don't like :)

19:50 I figured a first pass impl could either be an interpreter or naive compile to clojure forms

19:51 hiredman: you would like to be able to specify transforms over datastructures

19:51 gfredericks: for the spec part you mean?

19:51 or the compiler?

19:52 hiredman: I am restating what I think your goal is, so you can tell me I am wrong

19:52 :)

19:53 gfredericks: oh you mean the purpose of the language then?

19:53 hiredman: yeah

19:54 gfredericks: yeah that's totally fair

19:54 another use case would be implementing something like jq but for edn

19:54 on that note if I took this seriously I might have to fork edn

19:54 hiredman: have you seen specter?

19:54 gfredericks: the marz thing?

19:54 hiredman: I haven't used it, but it seems like that

19:54 yeah

19:54 gfredericks: not in detail

19:54 presumably I'll see it a month from now

19:54 gilch: pixie is also Clojure-like

19:54 hiredman: indeed

19:55 gfredericks: if I could get away with a subset of edn I could name it ed

19:58 TEttinger: then someone forks that, ned

19:58 nicely extensible data

19:59 rhg135: then someon forks that, yay oss

19:59 hiredman: so specter has you specify a path (sort of like update-in, but more powerful) then you can either select out whatever is there or transform whatever is there

19:59 so sort of like a more powerful version of get-in or update-in

20:00 the transform of course can be an arbitrary clojure function, which may not be what you want

20:00 but I dunno, I am not sure some restricted form of clojure is the best way to express a restricted set of changes

20:01 gfredericks: portability and exactness and simplicity are a big motivation for me

20:01 hiredman: there are lots of dsls for this kind of (jq, xslt, sql, etc)

20:02 gfredericks: sure

20:02 hiredman: (specter)

20:03 there are, I think, regexes style libraries for clojure datastructures, that you could use to build some kind of sed for clojure data structures

20:04 also hello haskell and lens and prisms and traversals oh my

20:07 given lenses, I think you can model something like jq as pushing and popping lenses on a stack, which is actually kind of similar to zippers

20:09 https://gist.github.com/hiredman/acf9d25ec013d694e2bb

20:09 very zipper like

20:12 gfredericks: I'm still fixated on something that smells like a general purpose language

20:12 hiredman: well, so clojure is a general purpose language, why not use that?

20:14 (this is like the fourth or fifth macro I've written named flense that does something relective on a class, but the end result is entirely different)

20:14 gfredericks: because I also want something a lot less messy than clojure

20:15 both w.r.t. platform stuff, other weird edge cases, and impurity

20:16 hiredman: is this subset going to ship with its own std library?

20:18 gfredericks: hiredman: yeah, though maybe heavily backed by clojure where appropriate; I'd want it to be logically untied to clojure

20:21 hiredman: so you are thinking a real language, that you would write a program in (as opposed to a fragment of a program I guess?) where you would define functions that could be reused in other parts of the program?

20:23 gfredericks: hiredman: yeah I think that and the related question of libs are the biggest thing I'm not sure about

20:24 and probably like 20 other thorny issues I haven't even thought of yet

20:26 hiredman: there is a design space between clojure and more declarative data dsls (like sql, specter, etc), but I have a heard time imagining something in that design space being particular useful

20:26 gfredericks: yeah :/

20:28 rhg135: specter itself leans on clojure to actually manipulate data

20:33 gfredericks: I've just got this soft spot for perfect ideal abstractions without messy host/perf-based edge cases

20:35 ugh and I'd have to have opinions about exception handling too, this would be the biggest yak...

20:36 amalloy: just declare your language unexceptional

20:36 gfredericks: nothing can crash

20:37 you could take the haskell approach and say you can throw errors but not catch them

20:37 oh geez and what about laziness I hate everything

20:38 amalloy: you can catch them in haskell though

20:38 it's just discouraged

20:38 gfredericks: only in IO right?

20:38 amalloy: well, in the monad that your errors live in. so you can catch IO exceptions in IO, or Either exceptions in Either...

20:39 gfredericks: I was talking about (head []) in particular

20:40 rhg135: division by zero too

20:40 gfredericks: right

20:43 amalloy: right, those are IO exceptions

20:44 gfredericks: and the others don't apply because gfrlang doesn't have monads

20:44 rhg135: I guess technically moving electrons qualifies as io

Logging service provided by n01se.net