#clojure log - Sep 23 2013

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

0:00 tufflax: allenj12: yes, but you said in the comment "sum up all the distances in board, as well as the board itself"

0:00 what does that mean

0:00 allenj12: tufflax: o sorry my bad i just meant that the board should be passed into the manhatten distance function aswell

0:00 tufflax: that was poor wording

0:00 tufflax: sorry

0:00 tufflax: allenj12: np :P

0:10 allenj12: tufflax: the addition of map got me answer of 14N :P still trying to get around it

0:11 tufflax: allenj12: Is 14N not good? :P

0:11 I don't understand what you mean by "get around it"

0:12 allenj12: tufflax: well i worked it out the answer should 21 (or 19 my partners work :P) and idk where the N came from lol :P :P

0:12 coventry: Is there a right way to say (ns foo (:require [x.core :only [foo] :rename {foo bar}]))?

0:13 tufflax: allenj12: N means that it's a BigNumber, you can mostly ignore that. I don't know where it came from either

0:13 But obviosly you have miscalculated or the code is wrong in some other way then

0:13 if it should be 21 or 19 :p

0:14 allenj12: tufflax: hmm kk yea ill double check my other code

0:14 tufflax: Or maybe BigInteger, you can check with (class the-number)

0:15 ,(class 1N)

0:15 clojurebot: clojure.lang.BigInt

0:15 tufflax: allenj12: there ^

0:16 allenj12: tufflax: ty im checking some numbers using manhatten distance manually it seems to be mostly right

0:17 tufflax: some are off tho

0:17 TEttinger: did somebody say manhattan distance?

0:18 marcopolo: so http://sprunge.us/VaBV doesn't appear to work with the master branch of cljs, let me try running nolen's core.async tests on it

0:18 TEttinger: ah, you mentioned A* earlier

0:18 allenj12, is this open source?

0:18 allenj12: Tettinger: why yes we did apparently there is something wrong with our method of calculating it :P

0:18 TEttinger: I already have an open source implementation of dijkstra pathfinding, if you're interested

0:19 I could honestly use A* since it's faster when you have a ton of options

0:19 allenj12: Tettinger: just an intro to ai hw im picking up clojure while i do this which i smaking it a little harder :X

0:19 TEttinger: oh ok

0:19 allenj12: Tettinger: :D

0:20 TEttinger: well I'd love to take a look when you're done, I'm not aware of an A* impl in Clojure yet

0:20 hm

0:20 apparently the only difference between A* and dijkstra is the heuristic

0:20 hfaafb: is there any semantic or mechanical difference between calling (:key foo) and (foo :key) where foo is a map?

0:21 brehaut: hfaafb: 'object/record' maps vs 'associative' maps

0:21 allenj12: Tettinger

0:21 TEttinger: yes?

0:21 clojurebot: yes isn't commutative

0:22 allenj12: Tettinger: apparenlty our method of man dis is wrong.. ill show you what i got so far tho for A* the search is optimal if you have an admissable heuristic

0:22 Tettinger: thats all i know tho

0:22 Tettinger: as far as comparing between the 2

0:23 brehaut: hfaafb: keyword first slightly indicates an objectish/record map, whereas keyword second slighly indicates an associative thing that happens to have keywords as keys.

0:23 TEttinger: ok, sure, I'll pastebin up mine if you want it. that's just what someone mentioned in a gamedev channel

0:23 brehaut: hfaafb: if you were using core.typed, the former would be HMaps, the latter (Map keyword any) (or whatever value)

0:24 allenj12: Tettinger: https://www.refheap.com/18908

0:24 also if anyone has a new to to calculate manhatten distance on a eight puzzle using a list then that would be helpful XD

0:25 TEttinger: eight puzzle?

0:25 hfaafb: thank you brehaut

0:26 allenj12: Tettinger: yea a common puzzle of tile you can slide around if you googlde it you should get an idea

0:27 TEttinger: oh yeah that

0:29 allenj12, Manhattan distance is for 2D planes, right? I'm not sure what the list represents, being 1D. is it the standard 1d collection representing multiple dimensions thing, where indices 0-2 are the first row, 3-5 are the second row...?

0:29 allenj12: Tettinger: usually in other functional languages i know it is standard so i thought i would try it it

0:30 TEttinger: yeah, I just mean... there's a few ways to do this

0:30 oh I get it

0:31 yeah I see the / and mod 3

0:33 found it

0:33 (apply + (map #(manhatten-distance board %) board))

0:34 it's finding the distance of the board to itself, allenj12

0:34 agh nvm

0:34 didn't see it was checking goal in the function

0:45 allenj12, it seems like it acts correctly, I'm not sure what's up

0:45 it might be the usage of floor?

0:46 nvm, found the bug

0:46 allenj12: Tettinger: for my test case at the bottom (manhatten-distance testt 3) it should not be 0

0:47 Tettinger: yea

0:52 TEttinger: got it

0:55 http://ideone.com/zix3tO allenj12, the issue was only one abs was used, you needed to abs both terms

0:58 uh crud, a bad version went to ideon

0:58 allenj12: Tettinger: omg lol ty

0:59 Tettinger: hmm now im getting 22

0:59 juki

0:59 TEttinger: haha

1:07 ddellacosta: (in cljs, if it makes a difference:) why do I get an error with the message "no matching clause…" in a condp if I have ":else nil" at the end? The whole point is that I don't care what happens if I haven't matched my previous conditions.

1:09 never mind, I guess I'm confusing how condp and cond work. Making it simply "nil" did the trick.

1:28 callen: ddellacosta: case didn't fit your problem?

1:34 ddellacosta: callen: well, I had a predicate expression I was applying values to, so condp seemed to fit here. But not sure it was the best choice.

1:38 callen: sight unseen, hard to say. Seems reasonable at first blush.

1:52 hfaafb: i'm a fairly new clojure programmer and would like to put my toes in the water, if anyone has any comments on some code i wrote i would appreciate it :) https://github.com/samuelcferrell/chjess/blob/master/src/chjess/core.clj

1:55 mtp: i'm fairly new to reading clojure code but it looks like something i'd write if i were any good at chess

1:56 TEttinger: ditto, mtp

1:56 mtp: (if i wrote it, i'd probably think it needs a bit more abstraction, too)

1:56 TEttinger: I have no idea what it does, but it seems clean

1:57 mtp: and i'd start by naming the (mapcat (partial x board) (filter blah)) pattern i keep seeing

1:58 and also by clarifying the part where it says ;;promotion check, perhaps by naming the edges of the board

2:01 metellus: you could replace (enemy ...) with a map {:black :white :white :black}

2:01 although I don't know that you gain anything from that...

2:03 Jarda: hmm

2:03 hfaafb: metellus: that makes a lot of sense! thanks

2:04 Jarda: so if I have a function name 'author-name' and it takes an id as argument, uses a db to fetch the author name and returns it

2:04 then I guess it isn't a 'pure function'

2:05 as the return value isn't necessarily the same even with the same argument value

2:05 because of introduction of state, I guess

2:06 is this a real problem and if so, how do we handle this?

2:06 SeanCorfield: yup, databases are a big ol' pot of state

2:06 but you can isolate it to the edges of your program and keep the rest of it pure

2:06 Apage43: alternatively you could model it as a function of 2 args, an id, and a snapshot of a database

2:07 SeanCorfield: that's the Datomic approach - database as value

2:08 Jarda: btw which database would you recommend? I'm used to couchdb and postgresql and this current project I'm learning clojure for can be described woth with relations or without

2:09 SeanCorfield: regular sql db stuff is a bit messy tho'... you can reason about it as a set of transformations on data that are snapshotted to disk in between times, if that helps isolate state changes from pure functions

2:09 Jarda: fwiw, i use both mysql and mongodb with clojure

2:10 all the sql DBs are "equal" in some respect, since you ultimately use clojure.java.jdbc to interact with any of them

2:10 for the noSQL DBs, you'll have a separate library for each... i'm only familiar with mongodb (and congomongo)

2:10 Jarda: ok

2:11 * Apage43 has worked on CouchDB

2:11 SeanCorfield: there's not yet any standardization in the noSQL world...

2:11 Jarda: Apage43: with cluctch?

2:11 SeanCorfield: but then there are four distinct types of noSQL DB :)

2:11 Apage43: no, I mean, I've actually worked *on* CouchDB =P

2:11 Jarda: Apage43: oh :D

2:11 SeanCorfield: clutch is supposed to be really good for couchbase

2:11 Apage43: When I use it from clojure I just use clj-http though

2:12 Couchbase doesn't support the CouchDB api

2:12 if we have anything that points to clutch, I need to get it removed

2:12 Jarda: clutch doesn't support couchbase AFAIK

2:12 Apage43: correct

2:13 rather anything built for CouchDB doesn't.

2:13 SeanCorfield: oh... i didn't realize they were so different?

2:13 that seems... misguided...

2:13 Apage43: Couchbase is Membase (clustered memcached thingy) with CouchDB's view engine

2:13 SeanCorfield: how confusing...

2:14 Apage43: so K/V is over memcached protocol

2:14 Jarda: Couchbase is missing the HTTP API completely

2:14 the HTTP API of Apache CouchDB that is

2:15 SeanCorfield: CouchDB sounded interesting if you needed auto-versioning (which we didn't, which is why we went with MongoDB)

2:15 Apage43: at any rate, as the NoSQL things go, they're all pretty different in terms of what they provide

2:15 CouchDB's revisions can't be used for version tracking anyway

2:15 they're for conflict detection only

2:15 Jarda: Apage43: you can pretty much use them for versioning though

2:16 Apage43: It doesn't make any guarantee that they'll stick around though

2:16 SeanCorfield: I've heard a lot of people push CouchDB for versioned content... but never dug deep myself

2:16 Jarda: (if you realize that the revisions might be lost at certain circumstances)

2:17 Apage43: Apache CouchDB has an attachments feature which kind of works well for archiving things hanging off a document

2:17 but the actual "revisions" are for detecting whether updates are in conflict during replication

2:17 Jarda: I'd like to try Neo4j, not that I'd need a graph database. Just to make myself familiar with it :)

2:18 SeanCorfield: I had a play with it during a Neo4J preso at a Java UG... using the Clojure REPL... It's definitely an interesting approach

2:19 Apage43: they perform a similar job to vector clocks in Riak

2:21 callen: you couldn't pay me to use CouchDB again.

2:22 bad experience using it with analytics data. CouchBase I might consider.

2:22 that was years ago, so it might've gotten better. I have scars though.

2:22 Apage43: I haven't followed actual CouchDB for a couple years, so I couldn't speak to what's happened in the meantime

2:24 I think the most interesting thing in that space to me are the CouchDB-compatible mini implementations, like PouchDB and TouchDB (now called Couchbase Lite, but actually *is* a CouchDB API compatible thing.. which is confusing..

2:26 rhg135: Is there a simple way to get a resource in cljs+nodejs like clojure.java.io?

2:27 callen: rhg135: JS doesn't have resources.

2:27 rhg135: use the node.js file APIs.

2:28 rhg135: Figured

2:28 K

2:28 TEttinger: Jarda, graph DBs are interesting. they seem to have a pretty limited group of people who actually use them though

2:30 callen: They're not super-duper practical for common-case stuff.

2:30 s4muel: i am interested in their application to complex software systems rather than people. service dependencies, infrastructure, etc. looking at bitsy, an embedded graph db atm

2:30 callen: and in most cases where you're actually storing a graph, it's often faster to just use adjacency lists and caching.

2:31 Apage43: mhm. Graphs are hard.

2:32 Especially big ones.

2:45 allenj12: can someone help me with this now? https://www.refheap.com/18909 i posted the question commented in my code it has to do with priority-maps

2:47 Ember-: and your problem in it is?

2:48 ah, comment

2:48 allenj12: Ember-: yea i thought it would be better to ask in there

2:48 Ember-: path finding stuff it seems

2:49 so that "list of possible moves" should be the path found, right?

2:50 Apage43: allenj12:I think you might be looking for the frequencies function

2:50 ,(frequencies [:up :up :right :right :right])

2:50 clojurebot: {:up 2, :right 3}

2:51 allenj12: no i will have at most only one oeration as it lists only posibble moves no repeats

2:51 Ember-: so just the first step of the found path?

2:51 Apage43: ah, I've misinterpreted

2:52 allenj12: so options lists a set of possible moves.. i wanna score how well those moves do and map the score with that move

2:52 so

2:52 Ember-: ah

2:52 allenj12: if :up makes a manhatten distance of 3 then i want (:up 3)

2:53 Apage43: ahh

2:53 allenj12: so the priority map can sort it by the value and i can apply the operation in the next function

2:53 by getting the key somehow :P

2:54 sry if it was not clear enough

2:56 Apage43: (into (priority-map) (for [move options] [move (manhattan-distance (move-tile move board) goal)]))

2:56 pm/priority-map i guess in your case

2:56 allenj12: hmm ill give it a shot

2:56 Apage43: in general you can conj [k v] pairs into maps

2:56 and into conj's a list of things into an existing structure

2:57 ,(into {} [[:a 1] [:b 2]])

2:57 clojurebot: {:a 1, :b 2}

3:13 allenj12: Apage43: getting close it seems but not quite there https://www.refheap.com/18910 havin some trouble

3:15 Apage43: not sure what that error means at the bottom imma keep playing with it

3:15 Apage43: it means (find-index) got called with a number

3:16 somehow, and it wasn't expecting to

3:16 allenj12: It looks like you got your arg order mixed up on line 38

3:17 or something

3:17 but move-tile is calling (find-index) with a number for its "board" arg, which I think is wrong

3:21 allenj12: Apage43: kk ill snoop around

3:29 Apage43: very weird im using light table and it seems everything is going where it needs to be as i call move-tile with board first and move-tile has board first

3:30 Apage43: I'm just reading "space (find-index 0 board)" and "find-index [board tile]"

3:30 which looks like that always gets called with 0 as board and board as tile

3:31 which is also backwards from how its called in possible-move?

3:31 compare lines 38 and 50 in your last refh

3:31 https://www.refheap.com/18910#L-38

3:34 allenj12: Apage34: ah yes silly but now im getting a new error again ill keep looking but ill repost it too

3:35 Apage34: https://www.refheap.com/18911

3:38 Apage43: allenj12: if you use assoc with indices on board, or use board as a function, it is important that board is a vector not a list

3:38 ,([1 2 3 4] 0)

3:38 clojurebot: 1

3:38 Apage43: ,('(1 2 3 4) 0)

3:38 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>

3:39 allenj12: Apage34: isnt there a nth function? would that work?

3:40 Apage43: That works in place of using it as a function, but you still won't be able to assoc onto it

3:40 &(doc nth)

3:40 lazybot: ⇒ "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

3:41 allenj12: Apage43: interesting

3:41 Apage43: but in general if you're doing random-access style stuff you should use vectors over lists

3:46 Viesti: hmm, what's the idiomatic way to have a named constant? (don't like to use "magic numbers")

3:47 allenj12: Apage43: IT WORKS!

3:47 Apage43: aw yeah!

3:54 s4muel: Viesti: (def ^:const planck 6.626...)

3:55 callen: (inc s4muel)

3:55 lazybot: ⇒ 1

3:55 callen: just for using planck.

3:56 s4muel: seemed natural

4:02 allenj12: Im off for tonight

4:02 Apage43: thank you

4:09 Viesti: s4muel: thanks

5:54 allenj12: hey does anyone know how to get a key from a map value? say if i took the first of a map

5:55 hyPiRion: use `key`

5:55 ,(key (first {:a :b}))

5:55 clojurebot: :a

5:55 allenj12: ah k lol sry if that was silly

5:55 hyPiRion: ah, no worries

7:19 reprob: Hi! Is it possible to edn/read something containing a clojure regex? (Specifying a :default option didn't work.)

7:21 carlosgaldino: is it possible to destructure the args of a function that was passed as an argument to another function?

7:22 smth like: (defn my-function [function [a & args]])

7:25 augustl: carlosgaldino: the only place those args would be available is inside the function, so I can't think of any use case for doing that

7:26 carlosgaldino: augustl: it's just an exercise. I was trying to implement `curry` but it's not working and I wanted to make sure that I was getting the arguments the right way

7:26 Bronsa: reprob: no, the edn reader doesn't include the regex literal

7:26 reprob: Bronsa: Ah ok, thanks. I'll use the Clojure reader with *read-eval* off then...

7:26 carlosgaldino: augustl: since I'm very new to clj I'm just like, really don't know what I'm doing. :)

7:28 augustl: carlosgaldino: yeah, the args to a function passed to another function is not available to that other function

7:44 carlosgaldino: augustl: ok, thanks

8:09 jave: I'm trying to make a spring mvc controller in Clojure, more or less like this:

8:09 http://stevendick.github.io/blog/2013/08/13/write-a-spring-mvc-controller-in-clojure/

8:09 but I cant get it to work

8:10 It doesnt seem like the mothod annotations get compiled into the class

8:11 if I look at another java based controller I can find the requestmapping annotation argument inside the class. I cant find it in my clojure based controller class

8:14 schmir: is there a leiningen plugin helps with building a distribution for end users? i.e. helps with building an uberjar, and a .bat/shell wrapper?

8:37 doomlord_: what are the chances of a native clojure implementation apearing

8:41 AimHere: https://github.com/takeoutweight/clojure-scheme <- seems to exist already

8:41 At least in some form

8:42 Clojure's parasiting on host systems is probably part of it's success though!

8:47 mdrogalis: callen: Heh, yeah. More just meant for repl use.

9:26 G0SUB: doomlord_, AimHere: There's also https://github.com/halgari/clojure-metal/

9:31 doomlord_: thats different , but still pretty interesting.

9:32 ah, it can go to llvm

9:37 augustl: G0SUB, doomlord_: I wonder if that's legal.. Perhaps Rich will sue everyone, just like Oracle sued Android over Java :P

9:37 G0SUB: augustl: what's illegal here?

9:38 TimMc: The name would need changing.

9:38 augustl: G0SUB: the Clojure trademark, and the interface of Clojure itself

9:38 doomlord_: it could only be good for the clojure ecosystem, right?

9:39 augustl: didn't Oracle sue Google for copying the "looks" (not sure what the correct term is..) of Java in Dalvik?

9:39 G0SUB: augustl: there's nothing illegal here, FWIW it's created by Tim Baldridge, Cognitect employee & co-author of core.async

9:39 augustl: he also wrote clojure-py

9:40 and that Oracle reference is a joke in poor taste, IMHO.

9:40 all of these use-cases fall under "Fair Use"

9:40 doomlord_: edn looks neat, i'd always wanted json to support keywords/symbols

9:40 augustl: G0SUB: I see

9:45 G0SUB: augustl: Oracle was just plain stupid (and arrogant) to sue Google over API. That's why they lost.

10:10 silasdavis: If I am in the namespace some-long-and-unwieldy-namspace, and I use the fully qualified keyword ::foo

10:10 from another namespec can I coveniently reference :some-long-and-unwieldy-namspace/foo?

10:11 I was hoping I could use a require on some-long-and-unwieldy-namspace

10:11 justin_smith: silasdavis: (:require some-long-and-unweildy-namespace :as slaun) ... ::slaun/foo

10:12 silasdavis: ah, thanks

10:12 justin_smith: np

10:13 I think :: brings in the same resolution rules as for vars, no prefix means current namespace by default, and then a prefix gets looked up as an alias

10:34 mdrogalis: Night Vision debugger lives! https://github.com/MichaelDrogalis/night-vision

10:43 ToBeReplaced: i'm still not grokking core.async -- am I able to open/close readers inside of a go block?

10:44 mdrogalis: ToBeReplaced: You don't close readers, you close channels.

10:45 ToBeReplaced: Try not to overthink it. It's just a queue that can be consumed by lightweight threads.

10:45 cmajor7: simple macro question.. still have difficulties fully grasping them: https://www.refheap.com/18919

10:47 ToBeReplaced: mdrogalis: if i have a file, and i want to write its lines onto a channel, how would i do that? i would have done (go (with-open [... ] ...))

10:48 mdrogalis: ToBeReplaced: Oh, you meant readers in that sense. Sure, why not?

10:49 ToBeReplaced: mdrogalis: with-open reflects inside of go blocks, and i'm having issues trying to do it directly with try/finally -- it seems to close from the finally block early

10:50 vijaykiran: cmajor7: I'm not sure how you can return two values from a macro

10:51 justin_smith: the only way to return two things is to put them inside a structure

10:51 period, macro or function or special form

10:52 vijaykiran: cmajor7: in your case, the m is always returns the let which will return the last form

10:52 ToBeReplaced: mdrogalis: in fact (go (let [rdr ...] ...)) succeeds where (go (with-open [rdr ...] ...)) fails -- so i'm thinking that i just don't understand something

10:52 justin_smith: you can use ~@ to expand a structure inline inside a syntax quote though

10:53 cmajor7: justin_smith: use "~@" on what structure.. I feel "the truth" is somewhere, just can pinpoint it.. can you give me a simple example?

10:53 justin_smith: ,`(1 2 ~@[3 4] 5)

10:53 clojurebot: (1 2 3 4 5)

10:54 justin_smith: of course [3 4] did not have to be literal, it could have been a binding

10:55 mdrogalis: ToBeReplaced: What do you mean it 'reflects'?

10:55 AFAIK, with-open is just a macro that expands to close the reader at the bottom of try/finally

10:55 ToBeReplaced: reflection on .close

10:55 the type hint seems to go awry inside of the go block

10:55 cmajor7: justin_smith: trying… (defmacro m [n] `(~@[{:a 42} {:a 42 :b (+ 1 n)}])) but it seems to evaluate.. e.g. it treats {: a 42} as a funtion

10:57 mdrogalis: ToBeReplaced: Hm, weird.

10:57 Maybe ask tbalridge whenever he turns up.

10:57 justin_smith: cmajor7: yes, that is what putting something by an open paren does

10:58 the ~@ has to be where the args are used, not generated

10:58 the macro problem: they make you need to use more macros

10:58 ToBeReplaced: mdrogalis: yeah i've been having weird reflection problems -- https://www.refheap.com/18905

10:59 mdrogalis: Perhaps file it on Jira.

10:59 cmajor7: justin_smith: not sure I understand :) how does it need to be changed to return two maps?

10:59 justin_smith: cmajor7: the ~@ flattens out a structure into a list, but it cannot flatten the return value into multiple values because there is literally no way to return multiple values that are not in a structure

11:00 ToBeReplaced: mdrogalis: no CA :(

11:01 cmajor7: justin_smith: ok. the way I was thinking about it is to substitute two maps at the compile time, hence thought of macros, is there a different way to do it? and/or this cannot be done with macro?

11:01 justin_smith: cmajor7: in order to return multiple values you would need to port scheme's multiple return value feature or something, it would be a pain, and would not be that useful in my experience

11:01 cmajor7: the way to do it is a macro where you use the values, not where you return them

11:02 cmajor7: justin_smith: I see, so macros can do anything _as long_ as that anything is a single form?

11:02 justin_smith: or just a function that destructures them and calls the other function

11:02 cmajor7: yeah

11:03 mdrogalis: ToBeReplaced: You don't need a CA to file a bug on Jira.

11:03 You do need one to fix/contribute code.

11:03 cmajor7: justin_smith: thx. "is a macro where you use the values, not where you return them", can you elaborate?

11:03 ToBeReplaced: ah, didn't realize

11:03 mdrogalis: :)

11:05 justin_smith: cmajor7: (defmacro m [double a b c] `(do-something ~@double a b c))

11:05 where double ends up bein the two maps you generated elsewhere

11:05 forgot to unquote a b c but hopefully you get the gist

11:06 so the thing making the two maps can just be a function returning a vector or list of length 2

11:06 the macro happens where you use them

11:07 but you really don't need a macro here, you could as well do (let [[a1 a2] double] (do-something a1 a2 b c))

11:07 no macro needed, just destructuring

11:20 cmajor7: justin_smith: right. the things is there are other maps coming from other sources, so these two maps is just an example.. I can always just return [m1 m2] and flatten them later, since they still come in as an ArraySeq.. I'd just need to get over a fact that a macro can be evaluated to a single form only

11:26 sm0ke: Hello, in core.async how do i define a callback function, when channel has value?

11:28 yedi: has there been a write up on Aurora yet?

11:30 mdrogalis: sm0ke: There are no callbacks.

11:30 fredyr: sm0ke: i think one of the ideas w/ core.async is to get away from callbacks

11:30 mdrogalis: Just write the code sequentially.

11:30 fredyr: sm0ke: and instead have blocking semantics

11:30 also what mdrogalis said

11:30 sm0ke: fredyr: i dont get it why async in first place than?

11:31 scriptor: because async isn't just about callbacks

11:31 it's so you can write asynchronous code that *looks* blocking, but is actually non-blocking

11:31 mdrogalis: sm0ke: The compiler inserts the callbacks for you.

11:31 sm0ke: what!!!

11:32 justin_smith: sm0ke: core.async turns a series of blocking reads into async callbacks on the value returned by the thing writing

11:32 sm0ke: really? wow but i get writes on channel..i still dont get the reads.

11:33 i mean i dont understand

11:33 scriptor: pastebin your code and we can take a look

11:33 ah

11:33 sm0ke: :P

11:33 really compiler inserts the callbacks...that the most awesome thing i head all day

11:34 fredyr: i guess the best way to think of it is ordinary threads writing/reading on blocking channels

11:34 justin_smith: sm0ke: the "reads" are translated into a callback that does everything you use the value for in a callback. But you don't have to write a callback any more than you write gotos to implement a function.

11:34 mercwithamouth: slurping/barfing is freaking awesome =P

11:36 scriptor: sm0ke: Nolen's article helped me out http://swannodette.github.io/2013/07/12/communicating-sequential-processes/

11:36 the first example is pretty complex, but then he moves on to a simpler one

11:37 sm0ke: scriptor: ok so what you are saying is..whenever clojure compiler sees a (go (<!..the outside form is turned into a callback?

11:38 justin_smith: sm0ke: it goes deeper than that, every <! is a callback

11:38 or is translated into one, within the go block

11:39 so your typical go block is a deep set of nested callbacks, that read like normal step by step blocking code

11:40 sm0ke: wow i need some time and googling to digest all this

11:40 bbloom: justin_smith: should point out: their execution is nested, but the callbacks themselves are not: they are a state machine built out of a switch statement

11:40 justin_smith: bbloom: thanks

11:40 scriptor: has anyone written up anything on the internals of core.async?

11:40 bbloom: scriptor: yes, 1 sec

11:40 justin_smith: sm0ke: this is actually simpler than callbacks to use, that is the whole point

11:40 scriptor: the source for (go …) is a bit intimidating

11:40 bbloom: scriptor: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/

11:41 justin_smith: it is callbacks and all that mess that require the heavy mental lifting from a user of the api

11:41 scriptor: bbloom: nice, thanks!

11:41 justin_smith: ccore.async makes it easier, much easier

11:42 tim__: scriptor: also, my Clojure/Conj talk in 2 months

11:43 justin_smith: bbloom: isn't a state machine semantically equivalent to nested callbacks?

11:43 sm0ke: wow after learning about (compile.. this is the second biggest mindblowing thing i stumbled upon in clojure..

11:43 although i guess this is borrowed from golang?

11:43 bbloom: justin_smith: the point i was clarifying is that the callbacks aren't nested lexical closures

11:43 tbaldridge: justin_smith: perhaps semantically, but not from a performance perspective. The state machine version is pretty much alloc free.

11:44 justin_smith: right, nice

11:44 tbaldridge: justin_smith: or can be made so, it's kindof half-alloc free in core.async right now.

11:44 justin_smith: I am actually very interested in ways to make alloc-free versions of clojure functions

11:45 scriptor: tbaldridge: looking forward to the slides/video then

11:45 justin_smith: in common lisp there was this concept of "cons free programming", how to write code for tight loops that does not churn garbage

11:45 are there instructional resources for doing the equivalent in clojure?

11:46 I mean I guess we could each suss out how to do it, but a set of tricks and best practices woudl be cool

11:46 bbloom: justin_smith: if you need instructions on how to do that, you shouldn't be doing that

11:46 tbaldridge: justin_smith: pretty much any doc on Clojure performance tuning will talk about type-hinting (that removes boxing), trying to lift closures to outer loops, etc.

11:46 justin_smith: bbloom: hey, I want to do DSP in clojure, fuck me right?

11:47 bbloom: justin_smith: you don't need to optimize that much unless you've measured & know what you're doing. at which point, it will be obvious how to experiment w/ transients, arrays, mutation, etc

11:47 pyr: anyone using clojure.core.typed in anger ?

11:47 justin_smith: bbloom: when I have the same loop called N times a second, with the same code path every time, hints on how to do idiomatic clojure things without churning the heap would be nice

11:48 bbloom: justin_smith: take a look at HipHipArray

11:48 justin_smith: cool, thanks

11:48 tbaldridge: justin_smith: and a profiler, and a hammock

11:48 bbloom: https://github.com/prismatic/hiphip

11:48 Sorella: sm0ke: kinda. core.async is based on Hoare's (et al?) communicating sequential process work. Go is also based on that.

11:49 tbaldridge: sm0ke: that being said, Rich has very few issues with Go's implementation with CSP, mostly around syntax. In his core.async podcast Rich basically said "Go did it right, we're copying them, we're not ashamed of it"

11:49 justin_smith: I have done dsp in other languages, and the things I tended to find useful was looking at other people's dsp code, and the rules of thumb for successful dsp (never print or allocate memory in your processing thread, etc.)

11:50 Apage43: It seems like you'd figure those out pretty quick

11:52 justin_smith: so we've determined that the resource I am asking about does not exist because I am simply too stupid to figure it out on my own, and only people who can invent these things from scratch should be doing this sort of thing. OK.

11:52 tbaldridge: justin_smith: or perhaps bbloom just lacks tact. Every performance optimizing programmer has to start somewhere.

11:53 justin_smith: take a look at hiphop though, it was kindof designed for this sort of thing

11:56 bbloom: justin_smith: tbaldridge: my apologies, didn't mean to be insulting. just was trying to make the point that it's the sort of thing that you should avoid doing in clojure unless you have to and then the solutions in clojure are roughly the same as they are across the JVM ecosystem and beyond: use arrays, mutation, etc

11:56 tbaldridge: (inc bbloom)

11:56 lazybot: ⇒ 18

11:57 * bbloom went from lacky tact to gaining karma. w00t

11:57 tbaldridge: justin_smith: don't forget, you're asking how to do dsp in a dynamic language. That's a tad like asking how to do NASCAR racing with a F150.

11:57 mtp: that's how it usually goes

11:57 justin_smith: tbaldridge: sure, yeah

11:57 tbaldridge: you can do it, it's going to take some work, creativity that's all.

11:58 justin_smith: right now I just do the DSP in a dsl (csound) and do the tricky logic in clojure

11:58 bbloom: justin_smith: have you looked at java-based solutions that you can access via interop?

11:58 tbaldridge: justin_smith: for instance, even writing your DSP code in JAVA and then wiring it up with Clojure

11:59 justin_smith: yeah, that would make sense

11:59 Apage43: this is the whole overtone thing

11:59 it gives you DSLs over supercollider

11:59 seangrov`: (dec bbloom) ; gotta keep the ego in check

11:59 lazybot: ⇒ 17

11:59 bbloom: dammit.

11:59 justin_smith: I don't like overtone because definstrument looks like clojure code but isn't, it ends up being a bigger cognative overhead than just using csound code is

11:59 arrdem: (dec seangrove) ; use of dec is discouraged

11:59 lazybot: ⇒ -2

12:00 Bronsa: lol

12:00 arrdem: (dec arrdem) ; for fairness

12:00 lazybot: You can't adjust your own karma.

12:00 arrdem: #winning

12:00 bbloom: (doseq [user (:users clojure)] (dec user))

12:01 arrdem: it'd be awesome if the bots did expose a user/nicks var

12:02 seangrov`: arrdem: Fair enough :)

12:02 tbaldridge: (set! tbaldridge (inc 9000))

12:02 that's what i'd do if it did.

12:03 seangrov`: &(println "alive?")

12:03 lazybot: ⇒ alive? nil

12:03 seangrov`: Ah, probably can't get carma from lazy bot then

12:03 &(do (println "(inc seangrov`)") 1)

12:03 lazybot: ⇒ (inc seangrov`) 1

12:04 * seangrov` glowers at Raynes, "well done sir, well done"

12:05 jonasen: bbloom: I vaguely remember you being interested in facebooks React.js. Do you know of any good resources (except the github repo) to learn how it works and how it's designed? It'd be an awesome match for clojurescript/hiccup I think and I'd be interested in building (a proof of concept) port. If it's not too complicated that is :)

12:06 bbloom: jonasen: they docs were updated a month or so ago to be much clearer

12:06 i still believe very strongly that their approach is the best out there in the js world & would port very nicely to clojure

12:07 seangrov`: bbloom: Wanted to say thanks for the talk that unexpected surfaced here in #clojure on concatenative clojure, I really enjoyed it, and it opened my mind a bit towards stack-based languages

12:07 bbloom: seangrov`: cool! I'm glad you enjoyed it :-)

12:07 jonasen: bbloom: I've tried to find the reconciliation algorithm in their code base on github but haven't been able to find it

12:07 bbloom: jonasen: i think the word to look for is "transaction"

12:07 jonasen: bbloom: ok

12:08 bbloom: jonasen: they are pretty helpful over in #reactjs too

12:10 jonasen: i was wondering if it would be possible to modify react's core to be reusable with different data structures. i think they already do dependency injection everywhere for testing, so i bet one could swap in hiccup-style data, but there are some other complications such as the component "classes"

12:12 jonasen: bbloom: Yes, it's probably possible to build a wrapper of sorts.

12:12 Don't know how well it would work with advanced compilation

12:13 bbloom: jonasen: i was hoping not to have to wrap at all, but rather parameterize their engine

12:22 jonasen: bbloom: I think I found the key classes: ReactCompositeComponent and ReactNativeComponent. I will try to dig deeper and see if I'm able to make sense of the implementation

12:23 bbloom: jonasen: it took me a while to sort it all out. it's dense

12:26 wei_: what's a good way to write a logical xor? e.g. (xor true true) => false

12:27 bbloom: wei_: (defn xor [p q] (and (or p q) (not (and p q))))

12:27 wei_: i guess that's just not= ...

12:27 bbloom: wei_: heh, yeah but i was just gonna say that :-)

12:27 wei_: cool :) thanks bbloom

12:38 silasdavis: what's the best way to call a sequence of methods just for their side-effects?

12:39 tbaldridge: silasdavis: dorun

12:39 ,(doc dorun)

12:39 clojurebot: "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."

12:39 TimMc: wei_: not= works only if you're dealing with "physical" booleans.

12:39 tbaldridge: silasdavis: compare to:

12:39 ,(doc doall)

12:39 clojurebot: "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."

12:40 wei_: what are non-physical booleans?

12:40 TimMc: If you have logical booleans, you'd need to call (boolean ...) on the args first.

12:40 rasmusto: tbaldridge: oh, I think I found the memory issues in my code :O

12:40 wei_: ah, right

12:40 TimMc: wei_: Well, ##(if 1 "logical true" "logical false")

12:40 lazybot: ⇒ "logical true"

12:40 TimMc: &(if nil "logical true" "logical false")

12:40 lazybot: ⇒ "logical false"

12:41 tbaldridge: rasmusto: ?

12:44 TimMc: So this should work: (defn xor2 [a b] (not= (boolean a) (boolean b)))

12:44 dnolen: pyr: it seems like people are starting to do that, check #typed-clojure

13:00 rasmusto: tbaldridge: dorun vs doall

13:01 I have a (doall (pmap ...)) over a very large sequence, and I'm just using it for side effects

13:03 silasdavis: tbaldridge, I would I use it to execute [fn1, fn2, ...]

13:03 like (do (fn1) (fn2) (fn3) ...)

13:05 rasmusto: ,(doall (map #(%) [#(print 1) #(print 2) #(print 3)]))

13:05 clojurebot: 123(nil nil nil)

13:05 justin_smith: is there a known workaround for the loss of println output into the ether when printing inside asynch processes in nrepl / emacs?

13:06 I guess I could start using a logging lib in my repl, but that somehow feels wrong

13:07 clgv: justin_smith: you probably have an stdout buffer in emacs. the missing messages should show up there.

13:08 justin_smith: I am connecting to an nrepl in a terminal

13:08 glosoli: What about Emacs

13:08 ?

13:08 justin_smith: it is not showing up in the terminal, the nrepl buffer, or the nrepl connection buffer

13:08 glosoli: justin_smith: C-x-b nrepl-server

13:08 It might be hidden, depending on the conf

13:09 justin_smith: there is no such buffer, because I am connecting to a process in a terminal

13:09 glosoli: But it shows up in buffer search :)

13:09 hmm

13:09 never done that

13:10 justin_smith: I should see "pending: (this is a test)" instead I get "pending: (this is", or sometimes "pending: "

13:10 or sometimes nothing

13:10 seemingly random

13:10 glosoli: justin_smith: ah yes you are right hmm interesting

13:11 justin_smith: so you can reproduce it by printing in future calls maybe?

13:12 mattyw: I've just suddenly started seeing SAXParseException when I try to evaluate using vim-fireplace. Has anyone else seen this?

13:12 glosoli: justin_smith: dunno man :) I am kinda of a newbie here, it's first time I heard of future calls :)

13:14 silasdavis: can I write (dorun (for [f [#(println "foo") #(println "bar")]] (f))) more directly

13:15 justin_smith: glosoli: (dotimes [i 30] (future (println "hello" "there" "world:" i)))

13:15 notice how few numbers are in that output

13:16 glosoli: http://imgur.com/AGRtR8H

13:16 yeah

13:16 justin_smith: even better: (dotimes [i 30] (future (locking *out* (println "hello" "there" "world:" i))))

13:17 in a repl that loses almost all the printouts, in a naked repl you see them all

13:18 hmm, looks like you are getting most of the output, if not all, I am losing most of it

13:18 try the locking version I just pasted

13:19 glosoli: http://imgur.com/YBBbUeF

13:19 Seems like I got all of them

13:19 justin_smith: something must be wrong with my setup

13:19 glosoli: justin_smith: maybe older version of nREPL ?

13:20 justin_smith: mine is pretty new, let me see if elpa has an update

13:20 Raynes: Reddit has ruined me.

13:20 * glosoli never used reddit for real

13:20 Raynes: I saw all those imgur links and was fully expecting to see cats.

13:20 justin_smith: heh

13:20 Raynes: Was utterly disappointed to find out otherwise.

13:20 glosoli: cat pics lol, da best

13:21 Raynes: glosoli: http://i.imgur.com/b24K57j.gif

13:21 glosoli: aaah so these are the cat pictures everyone are crazy about lol

13:23 silasdavis: is (fn [f] (f)) a built-in function?

13:23 xeqi: &(apply (fn [] 3))

13:23 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$apply

13:24 technomancy: maybe force?

13:24 xeqi: blah, the ones I can think of don't have 0 arity

13:24 technomancy: nope

13:24 deliver is the 1-arity one

13:25 justin_smith: ,(deliver 3)

13:25 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$deliver>

13:25 technomancy: ,(deliver println :ohai)

13:25 clojurebot: :ohai\n

13:25 silasdavis: context is (dorun (map #(%) fns))

13:25 xeqi: &(.invoke (fn [] 3))

13:25 lazybot: ⇒ 3

13:25 technomancy: use doseq

13:26 silasdavis: (doseq [f fns] (f))?

13:26 xeqi: yep, that is better in that context

13:26 silasdavis: ok cheers

13:30 TimMc: silasdavis: Try trampoline. :-P

13:31 bordatoue: could anyone tell me which version is domain defined for core.logic

13:35 justin_smith: glosoli: updating my nrepl.el did the trick, it seems

13:36 glosoli: justin_smith: must have been some bug

13:36 TimMc: &(trampoline (-> f #(f)))

13:36 lazybot: java.lang.StackOverflowError

13:37 silasdavis: TimMc, nice that works... provided the function doesn't return a function you don't want to run

13:37 TimMc: Oh hmm, not quite.

13:37 silasdavis: :-)

13:37 &(trampoline (fn f [] f))

13:37 lazybot: Execution Timed Out!

13:38 silasdavis: boing

13:40 technomancy: nice

13:42 TimMc: &(recur) is the shortest infinite loop I can make, I think.

13:42 lazybot: Execution Timed Out!

13:46 TimMc: And ##((-> f #(f))) is my new personal best for stack overflow, beating out the previous record of (#(% %) #(% %))

13:46 lazybot: java.lang.StackOverflowError

13:46 Raynes: &(range)

13:46 lazybot: java.lang.OutOfMemoryError: Java heap space

13:46 Raynes: That's technically an infinite loop.

13:47 Unfortunately it also uses heap space :P

13:47 TimMc: Raynes: (dorun (range)) hasn't been an infinite loop since 1.3 came out.

13:48 RIP auto-promoting +.

13:48 rasmusto: &(dorun (range))

13:48 TimMc: (Well, it's +' now, but whatever.)

13:48 lazybot: Execution Timed Out!

13:48 TimMc: rasmusto: That will take too long, you'll want to start not too far before Long/MAX_VALUE.

13:48 silasdavis: TimMc, what does ## do?

13:48 TimMc: silasdavis: Inline bot trigger.

13:49 silasdavis: ha

13:49 ah

13:49 `cbp: Hmm would a random error inside a compojure defroutes make it silently fail and cause the routes to not actually be added?

13:50 rasmusto: &(dorun (range (dec Long/MAX_VALUE) Long/MAX_VALUE))

13:50 lazybot: ⇒ nil

13:52 TimMc: &(dorun (range (dec Long/MAX_VALUE) Double/POSITIVE_INFINITY))

13:52 lazybot: java.lang.ArithmeticException: integer overflow

13:52 shoerain: So uh... low hanging fruit question: I want to reload a project from inside `lein repl`. Can I do that?

13:52 justin_smith: shoerain: (require ... :reload-all)

13:52 TimMc: shoerain: clojure.tools.namespace apparently has a refresh fn as well.

13:52 rasmusto: shoerain: check out clojure.tools.namespace.repl/refresh[-all] also, it's pretty cool

13:52 justin_smith: that doesn't help with for example async stuff still running

13:53 shoerain: whoa, fast.

13:55 * TimMc blows smoke from his fingertips

13:55 * indigo puts TimMc out

13:58 shoerain: TimMc, rasmusto thank you 2 for clojure.tools.namespace.repl/refresh

13:59 callen: mdrogalis: right. for exploring other peoples' code :)

14:00 rasmusto: shoerain: no problem. I just got it set up last week and it works well for the most part. I'm still having issues with some AOT stuff though...

14:01 shoerain: so is there tab-completion for functions in a namespace? I have (ns overtone-tutorial.core (:gen-class)), can I do (overtone-tutorial.core/<TAB-character>)?

14:01 justin_smith: would "aot" include macros and protocols? because those can be tricky too

14:01 mdrogalis: callen: :)

14:01 justin_smith: shoerain: in emacs by default it is alt-tab or esc-tab

14:01 rasmusto: justin_smith: not in my case, I don't think i'm using non-standard macro stuff

14:01 callen: shoerain: why are you gen-class'ing?

14:02 shoerain: since (overtone-tutorial.core/<TAB>)

14:02 callen: I couldn't tell you, since I don't know myself.

14:02 justin_smith: shoerain: yeah, tab is just indent by default, alt-tab or esc-tab (both map to M-tab internally)

14:02 rasmusto: justin_smith: I never understood that, doesn't alt-tab usually do something different? :P

14:03 justin_smith: rasmusto: only if your window managers steal it

14:03 emacs used it before "window managers" were a thing

14:03 iirc

14:03 rasmusto: ah gotcha

14:04 justin_smith: gen-class is only really needed if java code needs to call your code

14:04 afaik

14:04 and it is one of those aot things that will make reloading messy

14:04 technomancy: it can make uberjars easier too, but yeah, not required

14:04 shoerain: shucks, but my .inputrc gets in the way of esc-tab (vim bindings here), and m-tab is taken by window manager. hm

14:05 rasmusto: shoerain: evil-mode steals my 'esc' :p

14:05 justin_smith: technomancy: is that because the user of the uberjar is a java program, or is there something else I am missing?

14:06 technomancy: justin_smith: `java -jar myjar-standalone.jar` vs `java -cp myjar-standalone.jar clojure.main -m mymain.ns`

14:06 justin_smith: ahh

14:06 yeah

14:06 technomancy: there is also lein-otf

14:06 shoerain: rasmusto, justin_smith: so I should look into customizing `lein repl` (presumably nrepl) for tab completion?

14:07 justin_smith: oh, is this not in emacs, just the repl?

14:07 I was confused

14:07 technomancy: and profile-scoped targets with limiting :aot to the uberjar profile

14:07 rasmusto: hrm, c.t.n.r/refresh-all fails for me if I :aot [my.ns]... Says it can't find a namespace

14:07 shoerain: justin_smith: yup just the repl

14:08 rasmusto: shoerain: are you an emacs user? or would you like to learn?

14:08 justin_smith: yeah, then tab should complete things if the namespaces are loaded

14:08 shoerain: i haven't hooked up editors and repls (so far in python and javascript)

14:09 justin_smith: it's a generic completion, I guess I want (clojure.tools.namespace.repl/<tab>) to return all possible inputs

14:09 er, s/inputs/functions in that namespace/

14:09 justin_smith: I think you want editor integration for that kind of thing

14:10 technomancy: no, you should have completion in lein repl

14:11 shoerain: there's some form of static completion... if I call c.t.n.r/foo, then I get 'foo' completed when I call it again. Even if 'foo' doesn't exist

14:11 technomancy: .inputrc might be confusing it

14:15 shoerain: this is a record of what i'm doing: http://asciinema.org/a/5572

14:16 rasmusto: shoerain: i read that as "asciienema"

14:16 mtp: asciilemma

14:16 shoerain: well

14:16 it has some noise too (from supercollider and /usr/bin/java)

14:17 justin_smith: if you :use you don't have to type out the namespace, that is kind of the point of :use

14:17 rasmusto: shoerain: it looks like it's completing the whole "clojure.tools.namespace..." thing, it should complete the stuff from "clojure...." as well

14:17 shoerain: so :use is similar to (use 'namespace.core), but in the repl?

14:17 if so, I was wondering why the syntax is differet

14:18 rasmusto: shoerain: :use is just inside of the (ns) macro

14:18 but he's saying that if you "use" something, you don't have to fully qualify it

14:18 or "require c.t.n.r :refer [refresh]"

14:19 shoerain: oh yeah sure. I just wanted to look at functions in that namespace though

14:19 rasmusto: shoerain: yeah, I'm not sure what the completion is doing

14:19 shoerain: if I just <tab> with nothing typed in, I get every possible function/keyword

14:20 rasmusto: so completion should be working, but it's not working for me?

14:20 rasmusto: shoerain: if I do "clojure<tab>" I get all the completions from core and others

14:20 technomancy: shoerain: try moving .inputrc and re-running lein repl

14:20 justin_smith: technomancy: his term session he posted showed he had no .inputrc

14:20 shoerain: should i output lein/clojure versions too? technomancy I did; there's a `cat ~/.inputrc` command that doesn't return anything

14:21 technomancy: oh oops

14:21 shoerain: anyway i'll check when i'm back later, thanks for the help

14:21 mebbe i'll just install arch and be done with this ubuntu-ness... overtone was more of a pain to get started here

14:22 supersym: fun, I knew there had to be someone who tried that before :P (code by voice) https://www.youtube.com/watch?v=8SkdfdXWYaI

14:22 rasmusto: shoerain: are you running leiningen from apt?

14:27 wei_: is there a way to get :body-params from compojure's destructuring syntx?

14:29 rasmusto: is there a way to auto-require ~/.lein/profiles.clj dependencies in the user namespace for projects? I've looked at making a :dev profile per-project with a user.clj, but I'd like something that works for multiple projects and doesn't clutter project dependencies

14:30 xeqi: wei_: (GET "/route" {:keys [body-params] :as request} ...)

14:30 technomancy: rasmusto: maybe :init in :repl-options?

14:31 rasmusto: IMO that approach isn't great since it encourages you to stay in the user ns

14:31 much better to expose the functionality you want in your editor

14:31 wei_: thanks xeqi. so no way to get it with the compojure-specific destructuring e.g. (GET "/route/:id" [id] ...) ?

14:31 technomancy: https://github.com/technomancy/nrepl-discover

14:31 silasdavis: is there a built-in for (comp (partial into {}) concat) ?

14:32 rasmusto: technomancy: okay. ~/.lein/profiles.clj + editor seems like a good approach

14:32 silasdavis: hash-maps as args

14:32 technomancy: silasdavis: just into?

14:32 rasmusto: I guess the only issue is sharing tools w/ other ppl

14:32 silasdavis: technomancy, madness

14:32 technomancy: or merge if you need many args

14:32 silasdavis: thanks

14:32 technomancy: =)

14:33 rasmusto: I've been thinking about exposing ops from reply and nrepl.el as things like "~toggle-trace my.ns/some-var"

14:33 things that you'd normally invoke via M-x nrepl-toggle-trace

14:33 might sketch out an implementation in grench first

14:34 rasmusto: hm, sounds interesting

14:34 callen: technomancy: the Grenchmen are on the forefront of (social) engineering?

14:34 technomancy: slime is similar; you can enter ,commands which aren't interpreted as code input

14:34 rasmusto: do you have a recommended way to run clojure code in the nrepl.el repl with an emacs hotkey?

14:35 technomancy: callen: I wish someone would record a cover of some grenchmen songs like http://wondermark.com/more-littlest-butt/

14:35 rasmusto: no, but that should be added to the docs

14:36 callen: technomancy: o lawd.

14:36 technomancy: you're welcome

14:37 justin_smith: rasmusto: C-M-x ?

14:37 that will run the surrounding sexp in the default nrepl instance

14:37 technomancy: I think he means code that isn't under the point

14:37 callen: I, too, want the littlest butt ;_;

14:37 rasmusto: justin_smith: yeah, this would be code that I define in my init.el

14:38 justin_smith: oh

14:38 rasmusto: stuff like (require '[clojure.pprint :refer [pprint]]) (assuming I'm in the nREPL mode)

14:39 callen: I use a macro for that.

14:39 my refresh macro in the REPL dumps (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]])

14:40 I jam that and go back to what I was doing

14:40 technomancy: I don't think you should do it inside a session

14:40 justin_smith: callen: so then you then run the macro manually, right?

14:40 callen: I do so because I don't really live in 'user

14:40 technomancy: I think "make this operation available everywhere" should be supported by tooling

14:40 callen: justin_smith: I make a conscious decision to refresh my REPL, yes.

14:40 technomancy: reply does this to a degree

14:40 callen: justin_smith: it's partly a hack around not having a universal injection faculty.

14:40 partly because I co-opted some of how Stuart Sierra works.

14:41 my test REPL does: (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (run-all-tests)

14:41 I jam "up-arrow return-key" to run my tests, ^^

14:41 rasmusto: callen: I was looking at his dev/user.clj, and it works, but requires that you move deps from ~/.lein/profiles to the project

14:42 callen: rasmusto: nothx. I work on too many projects for that.

14:42 technomancy: user.cjl doesn't compose

14:42 callen: that too.

14:42 rasmusto: compose in what way?

14:43 technomancy: you can only have one of them

14:43 it's basically the anti-namespace

14:43 the namespace which isn't namespaced

14:43 rasmusto: may as well be called 'global?

14:43 technomancy: basically

14:43 rasmusto: okay, hmm

14:44 good thing user.clj is still just sitting in the index

14:44 callen: do you have a dotfiles repo I can look at for your emacs macro?

14:45 callen: I thought this channel was sick of me talking about my dotfiles repo.

14:45 rasmusto: https://github.com/bitemyapp/dotfiles/blob/master/.emacs.d/clojure/clojure-config.el

14:45 you'll see my tracing machinery there too.

14:46 rasmusto: I'll talk dotfiles all day

14:47 callen: rasmusto: my dotfiles repo has ~420,000 LOC of elisp.

14:47 technomancy: you monster

14:47 callen: rasmusto: you really don't want me to talk about my antediluvian Emacs.

14:47 rasmusto: i made this thing: https://github.com/rasmusto/vim-emacs-clojure-starter-kit and its bad

14:47 technomancy: anyone remember M-x clojure-install?

14:47 callen: entire monasteries of monks have gotten lost in my dotfiles.

14:48 You can find stories of their past generations scribbled on the stone of the labyrinth

14:48 the bones of friar john...

14:48 technomancy: callen: have you read http://www.amazon.com/Crazy-Hair-Neil-Gaiman/dp/0060579080 ?

14:48 "Crazy Dotfiles" https://www.youtube.com/watch?v=7mx_l1bBrPk

14:49 callen: technomancy: I have not read it.

14:50 technomancy: "Hunters send in expeditions; radio back there positions. Still, we've lost a dozen there. Lost inside my crazy hair."

14:50 callen: rasmusto: anyway yeah, alembic, c.t.t, c.t.n.r, and c.pp are the relevant parts of that file.

14:50 technomancy: *their

14:50 this is how I imagine your dotfiles

14:50 callen: Seems accurate.

14:51 aka, "Where we're going? We won't need package management where we're going."

14:51 cue demonic shrieks

14:51 this is what happens when your development environment started life as timestamped tarballs a decade and change prior.

14:52 xeqi: huey lewis?

14:52 rasmusto: rasmusto: thanks :)

14:57 shaungilchrist: is anyone tackling the lack of pprint for cljs?

14:58 callen: shaungilchrist: no, but I'm pretty sure there aren't attack dogs that'll kill the first person that tries, so you should give it a whack.

14:59 if there are attack dogs, plz report as much from your hospital bed.

14:59 * technomancy assumes "attack dogs" is a euphemism for cl-format

15:00 callen: technomancy: thanks for reminding me of my least favorite part of CL. I'd almost suppressed that memory.

15:00 rasmusto: callen: where do you load up clojure-config.el? (pardon my emacs ignorance)

15:00 callen: now i have to spend 2 hours in the bathtub scraping my skin

15:00 rasmusto: oh so you want to follow this rabbit-hole?

15:00 rasmusto: https://github.com/bitemyapp/dotfiles/ that's the top-level, look at .emacs

15:00 * rasmusto takes the red pill

15:01 callen: rasmusto: I add everything in ~/.emacs.d/ to the elisp load path

15:01 then I require/load-library libraries and config files.

15:01 at the bottom of my .emacs you will notice my extreme hatred of auto-fill-mode.

15:03 gleag: callen: Shouldn't you be more afraid of the velociraptors? ;)

15:03 rasmusto: callen: ah, ok. seems familiar

15:03 callen: gleag: if a 11 year old kid that "knows Unix" can gymnast-kick a velociraptor in the face, then I trust Katya to protect me.

15:04 incidentally, I was once an 11 year old kid that "knows Unix"

15:04 so I'm in good company.

15:04 rasmusto: the familiarity is a ruse.

15:04 justin_smith: what was that 3d sgi file system manager called again?

15:04 callen: rasmusto: I even use a custom color theme :)

15:04 justin_smith: the one on the screen when she said that

15:05 callen: justin_smith: http://en.wikipedia.org/wiki/Fsn

15:05 justin_smith: I googled what you said and clicked the first result.

15:05 rasmusto: callen: it would feel more familiar if it had escape key timeout hacks in it

15:05 callen: this is how it works 99% of the time when somebody asks a question in here.

15:08 TimMc: In this case, who cares?

15:08 It's not a Clojure question, it's off-topic conversation.

15:09 If you're getting burn-out from the number of times someone asks a Jurassic Park-related question, you should seriously consider the amount of time you spend on the internet. :-P

15:09 technomancy: or teach it to clojurebot

15:09 TimMc: Or that.

15:09 callen: ~raptors

15:09 clojurebot: No entiendo

15:09 technomancy: what do we have bots around here for anyway if not as labour-saving devices

15:09 clojurebot: earn those botsnacks, slacker

15:09 clojurebot: Cool story bro.

15:10 technomancy: dang it

15:10 gfredericks: "labor" saving

15:10 technomancy: gfredericks: haven't you seen the jetsons

15:10 gfredericks: not really

15:11 technomancy: oh

15:13 gleag: callen: I actually had http://xkcd.com/292 in mind.

15:14 callen: I just wrote a "throws?" macro. I think I'm a bad person.

15:14 gleag: so did I.

15:15 gleag: he has a whole on-going theme with the velociraptors :)

15:16 sveri: hi, i am currently trying luminus with http-kit, now, in the docs it is said that i should start the server with lein run -dev, this works basically, but when i change my templates they dont get reloaded, is there a way to achieve that?

15:16 gleag: callen: Just like Tolkien, Jackson, and Rowling with spiders. :)

15:17 I wonder if there are people with lispalienophobia out there.

15:21 `cbp: sveri: selmer has a function selmer.parser/cache-off!

15:22 callen: sveri: it's not detecting the file timestamp changes for some reason, which is strange but easily rectified by what `cbp said.

15:24 sveri: callen: `cbp: ok, thats nice, but where and how do i call that function?

15:25 _scape: given (["v" "0.032977" "0.716507" "0.166762"] ["v" "0.033133" "0.716507" "0.165748"] ["n" "0.033133" "0.781325" "0.165748"] ["n" "0.017057" "0.716507" "0.145737"]) how would I filter this to be (["v"] [[ "0.032977" "0.716507" "0.166762"] ["0.033133" "0.716507" "0.165748"]]) etc. Basically I want to pull that first element and list the rest, grouping them together

15:25 sveri: in the handler.clj in the init function?

15:25 callen: sveri: sure.

15:25 sveri: give it a whirl.

15:29 sveri: callen: well, it works, somehow, i changed the navigation entry text and it works when i open the "/" url, but opening other urls it is not actualized

15:32 rlb: It looks like java still can't do full-resolution filesystem timestamps. If so, then I suspect that leaves me with jni/jna, and if I decided to go the jni route, should the jni bits just be a separate project, or integrate with leiningen somehow?

15:34 llasram: rlb: I haven't used it yet myself, but might be worth checking out https://github.com/jnr/jnr-posix

15:34 nDuff: Hrm.

15:34 `cbp: _scape: group-by does kind of what you want

15:34 rlb: llasram: OK, thanks.

15:35 nDuff: I have some quite old cljs code which includes: (def error-queue (atom #queue [])) -- building this against a modern compiler, I'm getting "No reader function for tag queue".

15:35 shaungilchrist: callen: I think instead of trying to make pprint work in its entirety I will scratch my immediate itch which is pretty printing edn

15:35 `cbp: _scape: you would have to write a group-by that removes the first item when grouping

15:35 ,(group-by first '(["v" "0.032977" "0.716507" "0.166762"] ["v" "0.033133" "0.716507" "0.165748"] ["n" "0.033133" "0.781325" "0.165748"] ["n" "0.017057" "0.716507" "0.145737"]))

15:35 clojurebot: {"v" [["v" "0.032977" "0.716507" "0.166762"] ["v" "0.033133" "0.716507" "0.165748"]], "n" [["n" "0.033133" "0.781325" "0.165748"] ["n" "0.017057" "0.716507" "0.145737"]]}

15:36 * rlb wonders why nio added FileTime, which has support for nanosecond resolution, but (openjdk on linux) still truncates the value at seconds...

15:36 _scape: thank you

15:36 callen: shaungilchrist: you can already pretty-print edn...

15:36 shaungilchrist: ...because it's Clojure data...

15:37 I am now going to stare at shaungilchrist in consternation

15:37 * callen stares hard at shaungilchrist

15:39 dnolen: nDuff: worked for me at the REPL, did you make sure to clean your project after switching CLJS versions?

15:42 shaungilchrist: callen: in clojurescript?

15:42 nDuff: dnolen: "lein clean", definitely, and lein-clrjsbuild says that it's cleaning up after itself. I notice that clojurescript.net doesn't recognize #queue [] as valid either.

15:42 mdrogalis: dnolen: Coworker excitedly ran over to me. "Immutable JS objects". One word reply: "Mori" D:

15:42 nDuff: err, lein-cljsbuild

15:42 dnolen: ...which build are you testing against?

15:42 shaungilchrist: callen: I am looking for run-time pprint of edn in cljs e.g. nice whitespace idiomatic indentation etc.

15:42 dnolen: nDuff: master

15:43 nDuff: clojurescript.net doesn't track ClojureScript closely as far as I know, it's the CLJS-in-CLJS project

15:43 mdrogalis: heh

15:45 nDuff: dnolen: hmm. I'm currently trying 0.0-1889, but if master works, maybe switching to a snapshot is the thing to do.

15:46 dnolen: nDuff: should work in 1889 too there's reader support for #queue and there has been for a long time

15:46 nDuff: minimal project to recreate please

15:53 bbloom: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf

15:54 tbaldridge: you might find this interesting too ^

15:54 bbloom: @dnolen: yup. tbaldridge & i were discussing that a week or two ago in here

15:54 good stuff

15:54 tbaldridge: dnolen: ditto what bbloom said

15:55 nDuff: dnolen: https://gist.github.com/charles-dyfis-net/087d8be56804c9e9fae2

15:55 dnolen: bbloom: heh cool, I saw that Oleg & co were presenting it at Haskell Symposium

15:55 bbloom: awesome

15:55 it's good stuff

15:55 nDuff: dnolen: ...there's a makefile in there to create the directory structure and run lein (since gist doesn't allow subdirectories).

15:55 bbloom: i think this extensible effects stuff is a BFD

15:56 dnolen: nDuff: does the problem still occur if you use a ns form?

15:57 nDuff: Shoot. I hadn't paid enough attention that it was a NPE here.

15:57 Not the same error as the original non-minimal case.

15:57 Back to try to figure out how to reproduce...

16:11 hfaafb: is it feasible to profile a short lived clojure jar in visualVM?

16:11 hiredman: hfaafb: best to put the short lived code in a loop

16:11 if your short lived code exits before you have time to attach the profiler you cannot profile it

16:12 hfaafb: thanks

16:13 justin_smith: you could also load up a repl, attach jvisualvm, and then run the main function manually

16:13 but a loop will gather better data, likely

16:13 nDuff: ...if it's short-lived enough that the JVM has never had time to optimize it, it's going to be pretty slow in production.

16:14 I wonder if optimizing the spun-up case is actually fair in this kind of situation. :)

16:16 noprompt: dnolen: is there any gotcha with dynamic variables in clojurescript?

16:16 *are there

16:16 dnolen: noprompt: like what?

16:17 noprompt: dnolen: i'm not sure. someone has been working on making my CSS library compatible with clojurescript and the code that uses dynamic variables isn't working. :-/

16:18 dnolen: there's probably something subtle we're missing, but i thought i'd ask.

16:18 dnolen: noprompt: we don't really support bound-fn or similar things

16:20 noprompt: dnolen: ah ok, so binding is the problem.

16:20 dnolen: wait, nm, my mistake.

16:20 sorry i read that wrong.

16:21 dnolen: noprompt: binding if you're assuming that you can *capture* a set of bindings like you can with bound-fn in Clojure

16:22 jmonetta: hi guys, any ideas why this doesn't work? :

16:22 (defmacro testmacro

16:22 ([a] (testmacro 5 a))

16:22 ([b a] `(+ ~a ~b)))

16:24 noprompt: dnolen: do you have a moment to glance at some code?

16:25 callen: jmonetta: I liked that you tried that.

16:25 dnolen: noprompt: only if it's a minimal case

16:25 noprompt: dnolen: yeah it's just the setup/application.

16:26 dnolen: noprompt: got a gist or link?

16:26 noprompt: dnolen: https://github.com/jeluard/garden/blob/cljs/src/cljx/garden/compiler.cljx#L48-L52 , #L62-L66, #L198

16:27 dnolen: just the var decl, macro, and how it's used.

16:27 jmonetta: callen: sorry, didn't got that

16:27 what am I doing wrong there?

16:27 noprompt: dnolen: the code works perfectly fine in clj, but in cljs it looks like *selector-context* is not getting bound.

16:28 dnolen: noprompt: yeah that's not what I'd call a minimal case :)

16:28 noprompt: a stand alone project with a some code that doesn't work

16:28 noprompt: dnolen: oh :P

16:30 dnolen: just to be clear though, binding [*some-var* some-val] should work fine in cljs though?

16:30 i haven't messed with dyn vars at all in cljs yet.

16:35 dnolen: noprompt: yes binding is supported

16:36 noprompt: dnolen: ok that's what i thought. guess i have some investigation to do. :)

16:37 rlb: llasram: amusingly, it looks like jnr-posix does save the fractional seconds for the file timestamps, but provides no way to acces them (i.e. only private/final) -- mtime() only returns the at_mtime value, etc.

16:38 so perhaps back to thinking about jni...

16:39 (or seeing if jnr-posix might be interested in an extra method...)

16:40 technomancy: huh; ocaml can have let-scoped "open" declarations (essentially :refers)

16:42 (with-ns [(:require [clojure.java.io :as io])] (io/copy thingy target))

16:42 that would be a fun exercise to implement

16:44 rasmusto: technomancy: wouldn't that be easier with a more composable ns macro?

16:46 Bronsa: technomancy: (defmacro with-ns [opts & body] `(let [ns# *ns*] (ns ~(gensym) ~@opts) ~@body (in-ns (ns-name ns#))))

16:46 technomancy: Bronsa: mwahaha

16:46 rasmusto: oshi

16:46 technomancy: rasmusto: I don't think so unless you mean moving refers and :as aliases to not be implemented in java

16:47 the way it happens in alias/refer is inherently stateful

16:47 rasmusto: maybe, I'm not quite sure what I mean. But I think people have talked about wanting inheritable namespace templates and the like

16:48 technomancy: huh; .removeAlias exists as a method on Namespace

16:48 so you could just make the changes and roll them back

16:50 callen: My new nickname for http://clojurescript.net/ is the "Un-muggle-ma-tron"

16:53 mpenet: How bad is it having (def ? ...) in ones library, it syntatically nice on a sql like dsl but I am sure this violates a few laws

16:53 justin_smith: what law would it violate?

16:53 mpenet: the readers untold laws

16:54 technomancy: there are some completely-ignored guidelines about what constitutes a "legal" identifier


16:54 mpenet: I think vars should start with an alpha char, but then again nothing is specified

16:55 well it is: http://clojure.org/reader

16:55 Maybe I will comply then, or just go the heretic way, not sure yet

16:55 rasmusto: (defn myfn® [])

16:56 mpenet: actually "?" should be fine

16:57 technomancy: I wouldn't take those rules too seriously

16:57 clojure breaks them

16:58 mpenet: Yup, and we have a macro called . another called .. . I guess "?" is fine, as long as you dont start with a num this follows the "rules" I think.

17:00 Bronsa: mpenet: there's no way a macro called . is going to work

17:00 mpenet: I know, this was an example of macro naming used in core, not a name I planned to use

17:00 Bronsa: oh, ok

17:00 (. is not a macro btw)

17:00 technomancy: isn't . a special form though?

17:00 mpenet: ah

17:00 technomancy: right

17:01 Bronsa: that's why I said it's never going to work

17:10 lunk: `source

17:10 is the code for clojurebot available somewhere?

17:10 technomancy: clojurebot: source

17:10 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

17:10 lunk: ty

17:11 technomancy: sure

17:15 lunk: `(let [x 5] x)

17:15 clojurebot: `(let [x 5] x)

17:15 clojurebot: Gabh mo leithscéal?

17:16 lunk: clojurebot: (let [x 5] x)

17:16 clojurebot: It's greek to me.

17:16 lunk: technomancy: little help here

17:16 :)

17:16 Bronsa: ,(let [x 5] x)

17:16 clojurebot: 5

17:16 lunk: oh comma

17:16 ty

17:16 justin_smith: without the presence of namespaces, or if people were expected to 'use' your namespace, ? would be a bad name. With namespaces it is just fine, the namespace name makes it make sense

17:17 lunk: ,(for [x (range 1)] (* x x x x))

17:17 clojurebot: (0)

17:18 noprompt: justin_smith: what would ? mean as far as a namespace name goes?

17:18 justin_smith: ? as a namespace? dunno

17:18 scriptor: lunk: if you need a quick repl online, there's always http://tryclj.com/

17:18 justin_smith: I meant within one it at least has a context

17:19 lunk: did someone filter our System calls from clojure bot? (java.lang.System/exit 0) for instance

17:19 justin_smith: you can also /msg clojurebot

17:19 noprompt: justin_smith: can you share an example?

17:19 lunk: scriptor: just thinking about the bot and sanitizing user inputs ;)

17:19 jkj_: http://pastie.org/8349900

17:19 wtf

17:19 scriptor: ah

17:19 jkj_: i have a very strange performace problem

17:19 very very strange

17:20 justin_smith: noprompt (speech-act/? "dog" "here")

17:20 generates a question

17:20 lunk: oh goody, security exception, worked better than expected

17:20 jkj_: my sort-by took too long.. then i presorted the stuff, but now the (first) to the sequence takes time :D

17:20 noprompt: justin_smith: oh you were say a var named ? not a namespace named ?.

17:20 *saying

17:20 justin_smith: yeah

17:20 hah

17:21 though ? would make a good name for a namespace that defined a large number of boolean predicates

17:21 gfredericks: jkj_: I think this is lazy seqs

17:21 jkj_: gfredericks: true... filter probably does that

17:21 gfredericks: jkj_: without the first the lazy seq escapes the (time) call without doing any work

17:21 noprompt: justin_smith: personally, i don't like vars that are just called ? because it's really unclear what that function does until you look at the source/docs.

17:21 justin_smith: I think it would depend on the ns, but sure

17:22 jkj_: gfredericks: funny that the repl shows so tiny times though the full sequence is shown

17:22 gfredericks: maybe the time is just not calculated and the sequence is realized on repl's own time?

17:22 ...or something

17:23 gfredericks: jkj_: yes that's it

17:23 noprompt: justin_smith: typically i err on the side of clarity with regard to var names. the fact you're asking if it's a good name suggests to me that it's probably not since there's some doubt there.

17:23 gfredericks: if you wrapped the filter version with (time (doall ...)) you'd see it slow down

17:24 noprompt: justin_smith: that being said, it may make perfect sense with regard to your lib.

17:24 jkj_: gfredericks: yes. i tried

17:25 gfredericks: any ideas on finding the longest .startsWith string match fast?

17:26 justin_smith: ,(apply str (map (comp char read-string (partial apply (partial str "2r"))) (partition 8 "011011000110111101101100")))

17:26 clojurebot: "lol"

17:26 jkj_: gfredericks: http://pastie.org/8349932

17:27 rasmusto: ,(str "2r" "0100101")

17:27 clojurebot: "2r0100101"

17:27 rasmusto: oh

17:27 justin_smith: read syntax for base 2 number

17:28 ,"2r0100101

17:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

17:28 gfredericks: jkj_: if your question is just about performance, then you can probably add a type hint there

17:28 justin_smith: oops

17:28 ,"2r0100101

17:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

17:28 justin_smith: ,"2r0100101"

17:28 clojurebot: "2r0100101"

17:28 rasmusto: I always get a little sad when bits are represented as unicode characters

17:28 justin_smith: ,2r0100101

17:28 clojurebot: 37

17:28 gfredericks: jkj_: (.startsWith ^String call (:call %))

17:28 jkj_: gfredericks: thx

17:29 gfredericks: jkj_: that avoids reflection, which is super slow compared to a quick string operation

17:29 jkj_: gfredericks: wow. a huge difference

17:30 justin_smith: rasmusto: I had thrown that little snippet together to decode a string of bits I saw on the net

17:30 rasmusto: justin_smith: yeah, there are some 4clojure problems that involve looking at digits, seems like read-string is the cleanest way to do it

17:31 jkj_: gfredericks: problem solved.

17:31 gfredericks: ,strangely I can't reproduce the timing difference:

17:31 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: strangely in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:31 gfredericks: ,(time ((fn [s] (.startsWith s "foo")) "foo bar"))

17:31 clojurebot: "Elapsed time: 0.156546 msecs"\ntrue

17:31 gfredericks: ,(time ((fn [s] (.startsWith ^String s "foo")) "foo bar"))

17:31 clojurebot: "Elapsed time: 0.132136 msecs"\ntrue

17:32 gfredericks: that's a barely noticeable improvement

17:32 but *warn-on-reflection* confirms that the first reflects while the second doesn't

17:32 justin_smith: rasmusto: with 4clojure I actually ended up doing a loop with quot and div

17:32 but when you are starting with a string rather than number, that is a little different I think

17:33 rasmusto: oh, hm. I think I've done both

17:33 justin_smith: I am noisesmith on 4clojure, if you are curious

17:33 rasmusto: number -> string doesn't make much sense though, except for that palindrome one

17:34 justin_smith: I was amazed when I used jvisualvm and saw how much of my production app's ram was being used by objects of type string

17:34 *type char

17:34 rasmusto: all of my ram is in lazy-seqs usage, go figure

17:35 lunk: rasmusto: (get-a-job lazy-seqs)

17:36 rasmusto: lunk: both my code and myself share that trait

17:36 lunk: :P

17:36 rasmusto: though I'm not religious

17:36 mpenet: justin_smith: in my case it's used like that: (select :foo (where {:bar 1 :baz ?}))

17:37 justin_smith: even tho I agree in most case it's probably a bad idea, here it kind of make sense

17:37 justin_smith: mpenet: so why not :? if it is a placeholder?

17:37 mpenet: justin_smith: keywords are encoded to strings, backward compatibility

17:38 justin_smith: and I know for a fact that some user use this, had a PR recently for namespaced kw support

17:38 justin_smith: interesting

17:39 mpenet: justin_smith: the lib in question FYI https://github.com/mpenet/hayt

17:44 justin_smith: mpenet: I assume '? and \? have the same issues?

17:44 rasmusto: ,:\

17:44 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :>

17:45 justin_smith: ,\?

17:45 clojurebot: \?

17:45 jkj_: gfredericks: (time (lookup "OH8GLV" (time/now))) ... "Elapsed time: 7.306 msecs" ... this does the operation thrise so time dropped from 42ms -> 7ms

17:45 mpenet: justin_smith: these 2 both work as well actually and generate the same as ?

17:47 justin_smith: but it's not really intended to use like this (and has some potentialy suprising outcomes when used with one of the compilation modes)

17:48 jkj_: gfredericks: well.. still takes 3 days. maybe i have to rethink the problem. bruteforce filtering lists might not be best way

17:50 gfredericks: jkj_: if you wanna get really serious reducers might help

17:51 specially if you have a big pile'o'cores

17:54 rasmusto: am I wasting my time building a command line interface with clojure.tools.cli? Should I just make a pretty repl instead?

17:54 jkj_: gfredericks: thanks for the hint.

17:55 hmm.. cloud vendor wants to give me 16GB of mem with 8 cores

17:57 TEttinger: how much/month, jkj_?

17:58 http://www.ebay.com/itm/DELL-POWEREDGE-C1100-1U-2x-XEON-L5520-2-26GHZ-QUAD-CORE-CPUS-48GB-MEM-4x-160GB-/380633173091?pt=COMP_EN_Servers&hash=item589f814c63

17:58 rasmusto: oh wow

17:58 jkj_: TEttinger: ~450 with 30 GB of mem

17:59 eur

17:59 TEttinger: yep, ebay once again to the rescue

17:59 jkj_: ok 285,34 eur 8 cores and 16 GB

17:59 TEttinger: a friend bought one with 72 GB RAM

18:00 I think it's working fine as an VM farm

18:00 he paid more than that though, that one is an especially good deal

18:00 jkj_: i wonder how sun niagara processors go with clojure :P

18:00 huge amounts of cores

18:00 TEttinger: oooh

18:01 technomancy: jkj_: http://www.tbray.org/ongoing/When/200x/2008/05/01/Wide-Finder-2

18:01 though that task is IO-bound

18:02 TEttinger: holy wow http://www.ebay.com/itm/Sun-SPARC-T4-1-Base-1x8-Core-2-85GHz-32GB-and-6X300-GB-Disks-1x-Dual-8GB-FC-/390493525109?pt=COMP_EN_Servers&hash=item5aeb3a5475

18:02 look at that price

18:02 gfredericks: hardware is one of my top 1 least favorite things to own

18:02 TEttinger: there is that

18:03 if something goes wrong you foot the bill

18:04 gfredericks: if I've got a bunch of CPU work to do, should I expect reducers to utilize the cores significantly more efficiently than pmap?

18:05 technomancy: pmap won't get too far ahead of the slowest entry

18:05 gfredericks: htop is telling me I'm only getting ~65% out of my 8 cores

18:05 TEttinger: gfredericks, I've kinda assumed reducers were the better version of pmap

18:05 technomancy: terrible if you have wide variance in costs

18:05 gfredericks: technomancy: that's an interesting point, hadn't thought about variance

18:06 I'm not sure how varied my work is here. I made a `pmap-chunkily` that chunks into ~20 jobs first

18:06 which should lower the variance

18:06 technomancy: as long as there's an "extra-chunky" version I'm for it

18:06 gfredericks: I don't have java 7 on this machine though

18:06 time to spelunk through apt I guess

18:09 rasmusto: gfredericks: I have a similar pmap issue, I'm about to reorganize stuff so I can get bigger chunks

18:09 gfredericks: might be hard to fit this problem to reducers well though

18:10 unless reducers are cooler than I thought

18:12 basic structure is (->> ten-thousand-things (mapcat make-lots-more-things) (map slow-fn) (apply max-key f))

18:12 the seq coming out the mapcat would be too big for memory

18:13 jkj_: gfredericks: there is ofcourse the possibility to try to be smart and just organize the data so that the lookup is faster... look up only map keys?

18:14 guess the map had some tree magic built in

18:14 akurilin: Quick sanity check: if I want to idiomatically get a gzipped json and parse it into a clojure map, is this flow reasonable: input stream of URL -> GZIPInputStream -> BufferedReader -> cheshire's parse-stream ?

18:14 dakrone: akurilin: sounds reasonable

18:15 jkj_: then i just have to hammer the map by fetching OH8GLV, OH8GL, OH8G, OH8, OH, O to find the largest .startsWith

18:15 akurilin: Seems to work, but I've just never worked with java before so I'm wondering if I'm constructing too much stuff there :)

18:15 dakrone, great, thank you! Do you have a notification on the cheshire keyword? :)

18:15 dakrone: akurilin: I do :)

18:16 akurilin: dakrone, not complaining, appreciate you supporting those really handy libraries.

18:16 jkj_: akurilin: http://pastie.org/8350035

18:16 dakrone: akurilin: no problem, glad they're working for you!

18:17 lunk: akurilin: not just a rtfm comment, but the java tutorials on streams are extremely valuable to read through *multiple* times, http://docs.oracle.com/javase/tutorial/essential/io/

18:17 jkj_: not cheshire there, but prolly works the same

18:17 akurilin: jkj_, thanks, good to have for reference!

18:17 jkj_: (:import java.util.zip.GZIPInputStream)

18:18 akurilin: lunk, appreciate that. I've managed to avoid delving into java too much so far, but it'd be fun to find out what all the different tools out there are.

18:18 lunk, plus that will explain the class hierarchy I was looking at just now.

18:18 lunk: akurilin: in this case, even if you don't consume a stream in a 'tight-buffered-loop', that doc set is very useful for understanding how to properly think about data streams in the jvm ecosystem

18:19 akurilin: ignore the class heirarchy for now, understand the concepts and you'll be golden

18:19 akurilin: lunk, that sounds really useful, I will!

18:20 lunk, yeah it wasn't obvious what needed to wrap what in what order at a first glance, so that'll explain it hopefully.

18:21 lunk: akurilin: ultimately, it's just bits on a wire, you either read them or write them to the stream, the rest is gravy

18:32 clj_newb_2345: is there a way to do the following with clojurescript? http://emacsrocks.com/e11.html

18:32 this is fucking insane

18:33 so basicallyI need a way to connect to the clojurescript repl from emacs

18:37 nDuff: clj_newb_2345: see piggieback

18:40 aaelony: has anyone tried nrepl + emacs on Mint Linux? I'm getting an nrepl window but no repl...

18:41 justin_smith: aaelony: I fixed this by using the elpa nrepl, after purging all my compiled elisp

18:41 same problem happened on latest ubuntu

18:41 I posted a so answer about how I fixed it, one moment

18:42 http://stackoverflow.com/questions/18208947/emacs-clojure-lein-and-nrepl-nrepl-buffer-shows-up-blank/18218870#18218870

18:42 aaelony: ^ that link describes the fix

18:42 technomancy: justin_smith: using melpa before?

18:43 justin_smith: technomancy: no, I was actually using a git checkout of nrepl before

18:43 technomancy: huh

18:43 justin_smith: something weird happened when I rsynched from my old debian machine to the new ubuntu one, and everything broke

18:44 technomancy: yeah, elisp bytecode is not backwards-compatible

18:44 justin_smith: *git checkout of nrepl.el

18:44 technomancy: between versions of emacs

18:44 justin_smith: yeah, purging the elisp was probably the main thing

18:44 technomancy: the .elc files anyway

18:44 justin_smith: I am surprised it does not catch the incompatible elc versions and gripe or something

18:45 technomancy: yeah =\

18:45 justin_smith: the pernicious thing is that if you have elc files loaded that were from a previous emacs, and you compile things with the new emacs, the breakage propagates

18:45 which leads to really weird hard to reproduce bugs

18:45 technomancy: further proof that AOT is the worst

18:45 justin_smith: yup

18:46 rasmusto: technomancy: so you recommend ^:skip-aot then? :P

18:46 aaelony: justin_smith: thanks, that's super. Will check out your write up...

18:46 justin_smith: imagine if gcc let you use libs from the wrong glibc, and generated output that would not run with the old glibc, or the new one, without complaining at any point

18:47 technomancy: rasmusto: there's an entry at the end of the FAQ explaining the way to go for uberjars

18:47 profile isolation

18:47 justin_smith: aaelony: I think the process I descibe there may be overkill, finding and eliminating all .elc files may be sufficient

18:47 mtp: justin_smith: it did that during the 5-to-6 transition iirc :p

18:47 justin_smith: heh

18:47 rasmusto: technomancy: okay, I'll give it a read. Thanks :)

18:47 justin_smith: well never mind then

18:47 technomancy: rasmusto: should probably blog it or something to get the word out though

18:48 rasmusto: technomancy: I noticed it from the 3.0.0 deprecation warning, and when c.t.n.r/refresh-all would break after a `lein clean`

18:48 technomancy: protocols?

18:48 clojurebot: http://whiley.org/2012/02/29/a-problem-of-decoupling/ describes a problem solvable by protocols

18:49 technomancy: shut up clojurebot

18:49 rasmusto: no, nothing like that

18:49 lein check gives me a few reflection warnings, but nothing looks that scary

18:51 aaelony: justin_smith: that worked!! many thanks :)

18:57 justin_smith: aaelony: NP; that bug hounded me for ages, once I found a fix I wanted to put it up somewhere where others would find it

19:03 jkj_: gfredericks: http://pastie.org/8350155

19:04 gfredericks: i guess i might have found the solution

19:12 the calculation is just three hours now!

19:15 doomlord_: can jit/inference techniques make a dynamically typed language like clojure match a statically typed language, or is that going to be a permanent issue with performance

19:16 technomancy: doomlord_: static types just let you avoid runtime reflection, which is pretty rare in Clojure code

19:17 justin_smith: technomancy: doesn't it also allow for example aggressive unboxing?

19:17 doomlord_: on the one hand what with templates and HM type inference, i can imagine some sort of compiler/runtime producing performant code.. but is this a practical reality

19:17 technomancy: static typing helps you catch errors but doesn't provide much of a speed boost except for pathological code

19:17 doomlord_: ^^(on the one hand, having seen templates and HM type inference..)

19:17 technomancy: justin_smith: yeah, but it already does a fair bit of inference there afaiu

19:18 justin_smith: the jvm can unbox in jit you mean?

19:18 technomancy: I don't think it can do more without giving up on certain interop features, but I could be wrong

19:18 no, the clojure compiler infers primitive local types in some cases I think

19:19 justin_smith: that makes a lot of sense, java is pretty pathological in its level of boxing to start with, so you would want a different target vm before the unboxing had a point to it I guess

19:19 also immutability and unboxing are kind of mutually exclusive

19:20 I think

19:20 mercwithamouth: do any of you guys work through Purely Functional Data Structures?? Is it appropriate for lisp?

19:20 technomancy: tagged fixnums would get us a pretty significant perf boost for numerics

19:21 but I don't think that's coming in any sort of reasonable timeframe

19:23 allenj12: Hey is there a way you can test if a optional argument is passed to a function? does check true work?

19:23 technomancy: allenj12: I think you'd have to provide a default value with :or to distinguish between nil and not provided.

19:24 allenj12: technomancy: hmm alright ty

19:31 clj_newb_2345: nDuff: piggieback looks awesome; thanks

19:39 allenj12: https://www.refheap.com/18930 can someone help me witht his? i asked the question in comments towards the bottom

19:40 callen: allenj12: lines 42-45 should just be a case.

19:40 and don't have trailing tail parentheses. bad style.

19:42 allenj12: 66-69 is another case

19:42 allenj12: callen: a k ill fix that but is that causing the problem? i think its complaining about the main/a-star functions with prev-move

19:50 tufflax: allenj12: show the actual error message you get. Also, it looks like the paren at line 76 should not be there

19:51 Also, def inside functions should be avoided

19:51 use let instead

19:51 allenj12: tufflax: kk ill show error message and fix those after i repaste

19:52 tufflax: allenj12: def creates a binding in the namespace, so using it inside functions have side effects

19:52 has*

19:53 callen: allenj12: don't def in a function.

19:54 allenj12: callen: yea changing that now

19:55 https://www.refheap.com/18930 here is the error

19:56 ill fix the defs

19:57 tufflax: allenj12: the error is not really hard to understand. prev-move does not exist in get-queue

19:58 allenj12: tufflax: wow my bad for some reason i thought it was because of something else

19:59 tufflax: allenj12: also, why have you used & in the args list of a-star? You seem to want to only pass in 1 prev-move

20:00 allenj12: tufflax: that was there originally cause when i first call a-star there would be no prev-move however i decided to just make a keyword to fill it in and see if that worked

20:02 tufflax: allenj12: the arg after & becomes a list (or seq, whatever) that collects the additional args, but you don't treat it that way. You can use (seq something) to check if it has items in it

20:02 if something is the rest of the args (after &)

20:03 allenj12: tufflax: i thought & was optional arguments

20:03 tufflax: does it do that through a sequence

20:03 tufflax: allenj12: yes, the optional args are collected in a seq/list

20:03 even if there is only 1

20:04 allenj12: tufflax: ahh k so to check if it was passed i can test if the sequence is empty right?

20:04 tufflax: yes

20:04 allenj12: tuffkax: ah! kk cool

20:06 tufflax: allenj12: you can also do something like this

20:06 (defn special-sum ([] (+ 10 10)) ([x] (+ 10 x)) ([x y] (+ x y)))

20:07 justin_smith: core.async question: any tips on why each instance of pool-block in this code serves exactly one request, and dies right before printing the "wrapping up" line?

20:07 https://www.refheap.com/18932

20:07 tufflax: At the bottom of the following page, there is a "+ source", click the + for a good example http://clojuredocs.org/clojure_core/clojure.core/=

20:07 allenj12: ^

20:09 allenj12: tufflax: kk thanks gottt run machine learning grpup here ty

20:32 justin_smith: regarding my question above, it seems it was because I was not reading from the channels passed in, and a temporary workaround was to create the channels with a buffer so the go blocks could continue on after writing to each channel

20:37 * talios releases a new version of the frege-maven-plugin, along with a public version of the frege compiler. w00t.

20:42 brehaut: talios: nice readme ;)

20:46 talios: brehaut: shoosh - I need to add one ok :)

20:47 brehaut: talios: longer version: what is frege?

20:48 talios: brehaut: http://www.frege-lang.org/ - haskell for the jvm

20:48 brehaut: oh right. choice

20:48 talios: well, 99% haskell, its not 100% identical

20:49 brehaut: sure

20:49 100% haskell is hard

20:52 talios: and blammo - I hit a bug in my own plugin, gah :)

20:59 amehta: clojure stable release is 1.5.1 according to clojure.org. what version of clojurescript should i be using?

21:01 dnolen: amehta: 1859 works pretty well, 1889 if you like living closer to the bleeding edge

21:01 amehta: thanks david

21:17 _scape: so I have something like this: ({"bearing_Cylinder.001" {"v" [["v" "0.032977" "0.716507" "0.166762"] ["v" "0.033133" "0.716507" "0.165748"] ... ]}}) and I want to remove the "v" element on the vectors, I am doing all of these for loops with first and rest functions and basically getting no where. any hints?

21:18 tufflax: _scape: clojure.walk

21:18 _scape: more importantly, there are other elements such as f and n, all are first in the vector

21:18 ok, let me check it out

21:18 thx

21:26 dnolen: core.match 0.2.0-rc7 going out, I think finally killed all remaining sources of AOT issues, likely last release candidate

21:31 er, I mean rc6

21:37 arkh: dnolen: any recommended beginner reading for someone who's never worked with (lazy) pattern matching?

21:37 dnolen: arkh: it's not really lazy pattern matching, that's just describing the algorithm

21:37 arkh: it's pattern matching same as you find in SML, OCaml, Scala, Haskell - but more flexible like Racket

21:39 arkh: dnolen: I haven't worked with any of those but I'll google it up. From what I've read on your repo it looks like something I could use though - thanks!

21:40 dnolen: arkh: it's like destructuring but you can use it for conditional logic

21:42 brehaut: dnolen: im curious, does core.match allow the same sort of totality analysis that a static language like haskell etc can provide?

21:42 (ie, it knows if you have cases for every value of the matched thing)

21:42 dnolen: brehaut: not really because there's no restrictions about types

21:42 brehaut: however it throws if you miss a case

21:42 brehaut: thats what i suspected

21:43 oh nice

21:43 dnolen: brehaut: we could actually detect certain kinds of mistakes but it was experimental and I ripped it out when I overhauled core.match a couple months ago.

21:44 brehaut: its not like clojure is overly concerned with total functions anyway

21:44 dnolen: i guess that would be better supported with information from say core.typed and the analyzer ?

21:44 dnolen: brehaut: however i bet you could overlay that restriction via core.typed

21:44 brehaut: heh, we had the same thought

21:45 brehaut: yes I think core.typed could do it's own type level analysis restriction what core.match is allowed to express

21:47 brehaut: dnolen: it will be interesting to see how a the affordances of typed matcher compares to haskell etc

21:49 dnolen: from memory core.match doesnt depend need to upon concrete types as much as say haskell, right?

21:53 talios: brehaut: oh look - a readme! https://github.com/talios/frege-maven-plugin - and another new release, maybe I should do $work work tho :)

21:53 brehaut: talios: hah excellent

21:55 dnolen: brehaut: for optimization?

21:55 brehaut: dnolen: expressivity

21:56 dnolen: i havent used haskell in a while, but i recall it being difficult to match on non concrete types

21:56 dnolen: brehaut: yes core.match is more expressive, Haskell doesn't really support matching on non-concrete types

21:56 brehaut: dnolen: F# has its active patterns to allow some dynamism in its matches; being more dynamic is of course something clojure generally has over these langs

21:57 dnolen: right, so with that expressivity, but as type safe via core.typed. *waves hands* that'd be great

22:19 munderwo: So I have composure installed via lien. and the ring/ring-core is in my lein deps :tree list. But when from my repl I do (:use ring.util.response) or (:require ring.util.response) its says that CompilerException java.lang.ClassNotFoundException: ring.util.response, compiling:(NO_SOURCE_PATH:1:1)

22:20 Am I missing something on how lein etc builds the class path? or is ring.util.response not in ring-core?

22:23 I've also just installed [ring "1.2.0"] just to make sure I've got it all, and its still giving the same error.

22:38 kurisumasu: munderwo: (use 'ring.util.response)?

22:39 munderwo: kurisumasu: yeah, i've worked out that I can do that syntax in the repl, and that in my module it gets converted to (:use ring.util.response). Im still not sure what the ' is there for

22:40 kurisumasu: munderwo: (use & args) is a function. So when you call it as `(use ring.util.response)` it'll first try to resolve what "ring.util.response" means before giving it to the `use` function.

22:41 munderwo: when you use the apostrophe you're quoting it, which basically means telling Clojure "hey, don't try to resolve this. Give it literally to the `use` function and they'll know how to resolve this name, ya?"

22:42 munderwo: some things in Clojure are functions (like use), and they resolve their arguments before passing them to the function. Some are macros, where the macro gets to decide how they want to handle any argument, like the "(ns (:use x))" one.

22:42 munderwo: right. I'm a totally n00b at this point. just trying to work out how everything is working. Ahhhh, right. and thats what you have to do in the repl because ring.util.response isn't a symbol that can be resolved to something?

22:43 kurisumasu: munderwo: don't worry. Everyone starts as a beginner ;)

22:43 munderwo: where as when I'm using (ns) its a list of things it needs to do...

22:44 Yeah I'm in that phase where everything is confusing, so I just need to work through that until I start getting whats going on :)

22:45 kurisumasu: munderwo: in the repl, `ring.util.response` is a symbol itself. But when you call the use function passing it as argument, Clojure will try to find what that symbol means, and it will fail because ring.util.response hasn't been loaded yet.

22:46 munderwo: yeah, right that makes sense. So this is the problem I'm having https://www.refheap.com/9c4ee1bec6666980eee5cc71b

22:46 kurisumasu: munderwo: the (ns) macro will eventually call the `use` function. In fact, you could do so in your module. The macro is just there to make your life easier, and make things more declarative :)

22:48 munderwo: so, when you say `(:require x :as y)` you're telling Clojure that `x` and `y` are the same thing. But those things are namespaces (collections of functions and values), not a function per se. You have to use `y/name-of-the-function` to refer to the function itself.

22:49 munderwo: in this case, you can use (:use ring.util.response), and it'll make anything in the `ring.util.response` namespace available in your module directly.

22:50 munderwo: right, which is what I had before, but somebody on the irc was like, its bad form to use 'use'. so Im just trying to get it working with :require. and I can understand why you would use use. (way to many uses of the work use in that last sentence :)

22:51 so could I do (:require ring.util.response/response :as response)

22:52 kurisumasu: munderwo: you'd usually want to minimise the number of (use x) you have because you basically get all of that inside your current namespace. But you can use (:use x :only (y z)) to grab only `y` and `z` out of `x`.

22:52 akurilin: What are people's thoughts on Liberator? Would love to hear the opinion of folks who have used it over the long term.

22:53 munderwo: kurisumasu: so if you were to import this ring function how would you do it? I tried (:require ring.util/response :as response) and also (:require ring.util.response/response)

23:02 allenj12: Hey so i changed some Defs to lets in my functions and now im getting some errors https://www.refheap.com/18935 i explained more in comments

23:04 kurisumasu: munderwo: for these ring things I'll usually just place them in the use section, so (:use ring.util.response)

23:05 munderwo: ok. cool. thanks!

23:06 sinistersnare: allenj12: lets denote scope using the parens

23:06 so you need to wrap the whole scope of the let using the right paren

23:07 wait you did that :p i think

23:07 ill shutup

23:07 allenj12: sinistersnare: lol i was about to say i was rly confused then

23:08 sinistersnare: turns out i missed a parens but i put that back in and same problem

23:08 sinistersnare: oh :p sorry!

23:09 allenj12: sinistersnare: its ok lol any other possible problems

23:12 yea the error im getting is "Dont know how to create ISeq from: clojure.lang.Symbol ? in general what does that mean?

23:12 brehaut: allenj12: it means you probably have a symbol in your 'ns declaration where you should have a list or vector

23:13 sinistersnare: yeah, usually means some sort of missing thing!

23:14 allenj12: brehart: o shit no brackets fml lol

23:15 brehaut: the 'haut' is pronounced 'oh'; i blame the french

23:17 talios: wait, and here I was thinking you were hot.

23:17 I need to rethink my stalking.

23:17 brehaut: haha

23:18 talios: I keep thinking Andrew Braveheart, hero of functional developers in the southern northern lands

23:18 brehaut: well this has gone to a weird place

23:19 talios: and? :)

23:19 brehaut: lol

23:20 * talios wonders if arbscht is idle at home, or idle over the partition?

23:21 brehaut: talios: he works with you ?

23:21 talios: yup yup - javascript/coffeescript side of things

23:21 brehaut: i did not realise

23:22 talios: see the things you're learn if you came and worked for us?

23:23 brehaut: talios: coffeescript and java legacies?

23:24 sinistersnare: can anyone figure out how to add local jars to my clojure project?

23:24 talios: currently - the sooner we can get some clojure in the better ( or scala, or frege ;p )

23:26 sinistersnare: is this what :resource-paths is for? to the sample project.clj!

23:26 TEttinger: sinistersnare, I kinda hacked it by extracting into a directory and naming that directory with that, :resource-paths

23:26 talios: that would be resource files, you really want to put those jars into a local repository

23:26 i would think

23:26 sinistersnare: ive tried a local repository, its such a pain though

23:26 i was having the hardest time figuring out the maven commands =\

23:27 allenj12: my clojure writing style is horrible there parens everywhere!

23:27 sinistersnare: i hope lein adds a feature for this :)

23:27 i hear there was one, but it was deprecated...

23:27 kurisumasu: allenj12: you can try Clochure, instead :)

23:27 allenj12: it'll certainly reduce the amount of parenthesis, at least.

23:28 allenj12: kurisumasu: i just need practice :) ill look that up tho

23:28 s4muel: http://imgs.xkcd.com/comics/lisp_cycles.png

23:28 allenj12: kurisumasu: new to functional languages and clojure

23:29 mgaare: allenj12: (pst, it's important you realize that clochure is a joke)

23:29 kurisumasu: allenj12: ahaha. It was a joke :)

23:29 allenj12: LMAO

23:29 just looked at it

23:30 kurisumasu: allenj12: Most Lisp dialects really do have problems with parenthesis, actually, because the syntax isn't rich enough like Smalltalk and such languages. Clojure is at least a little bit better in that it uses different symbols for maps/vectors.

23:31 The only Lisp dialect I know of that features a different syntax is Dylan — no parenthesis there.

23:31 allenj12: kurisumasu: yea i need to get use to it i think i might clean up my a-star function by making it two functions https://www.refheap.com/18937

23:31 huh

23:31 lol

23:32 mgaare: kurisumasu: I dunno, is {:this :that} and [:this :that] so vastly superior to (hash-map :this :that) and (vector :this :that)

23:32 allenj12: wait cant i check if an optional paramter is passed with empty?

23:33 like (defn two [& too] (if empty? too) (println check))

23:34 mgaare: allenj12: yeah that should work (although only if you have defined check somewhere)

23:34 kurisumasu: allenj12: oh, we usually place the closing parenthesis in the same line as the last expression in a form, rather than leaving them on a line of their own. Just a stylistic thing.

23:34 allenj12: kurisumasu: can u give me an example

23:34 tufflax: allenj12: you are using the wrong syntax

23:35 allenj12: just like with let before :P

23:35 maybe you should look up some examples before trying :p

23:35 kurisumasu: mgaare: perhaps. I feel like they help identifying patterns quicker though, but the only other major Lisp I play with is Emacs Lisp, which is a little...

23:35 allenj12: tufflax: omg sry i did before my focus on school has been all scatterd so i prolly misremembered

23:36 sinistersnare: can anyone see if anything is wrong with my project.clj for lein? https://gist.github.com/sinistersnare/6665526 i think i did :main correclty...

23:36 allenj12: tufflax: wait whats wrong with my if statements?

23:37 tufflax: im looking at examples

23:37 s4muel: mgaare: consider (let [{:keys [one two]} m]) . That syntax would be nasty with all parentheses, i think. You'd have to call some special function to destructure.

23:37 tufflax: allenj12: I think you meant (if (empty? too) (println check))

23:37 mgaare: s4muel: yeah, destructuring is awesome

23:38 tufflax: tufflax: the syntax was valid, but nonsensical :P

23:38 allenj12: tufflax: o yea sry i thought u ment in my code

23:38 tufflax: hm no in your message :P

23:38 mgaare: allenj12: whoa that a-star function is making me dizzy ;)

23:39 allenj12: mgaare: me to i know its a mess

23:39 mgaare: and ofcourse its not working properly

23:39 mgaare: allenj12: you know you can do more than one thing in a let at a time

23:39 allenj12: mgaare: what do u mean?

23:40 tufflax: allenj12: start indenting your code properly. Also, nice trails of parens, looks like some sort of art

23:40 kurisumasu: allenj12: (let [a 1 b 2] (+ a b))

23:40 allenj12: unlike other lisps, Clojure's `let` will resolve [a 1] first, then [b 2], so you can use `a` in the second expression.

23:41 mgaare: kurisumasu: other lisps don't do that?

23:41 kurisumasu: mgaare: they have `let*` for that, but `let` doesn't guarantees ordering

23:41 mgaare: good to know!

23:41 allenj12: kurisumasu: interesting ill change that but first i wanna see why when i run this its not working proprly it keep making a back move

23:41 mgaare: our beloved let is much like haskell's monadic do notation

23:42 sinistersnare: it says that it cannot find my main class cljdx.core

23:42 which is the namespace for my file core.clj

23:43 brehaut: mgaare: let is only do notation for the identity monad

23:43 sinistersnare: well thats when i make a standalone jar out of it, when i run it, it gives me some error about not finding jars, but i think thats because it needs to be packaged into a jar

23:43 brehaut: mgaare: for and doseq is do notation for lazy and strict list respecitively

23:44 mgaare: brehaut: they are aren't they... pretty cool

23:57 yeoj___: i'm a beginner, and i find i do a lot of work lately getting my namespaces correct. Is there a way to clear all namespace information in emacs without stopping/starting the nrepl again?

23:57 i have conflicts contstantly for things that i've already loaded

23:57 tufflax: yeoj___: this might help https://github.com/clojure/tools.namespace

Logging service provided by n01se.net