#clojure logs

2013-09-23

00:00tufflaxallenj12: yes, but you said in the comment "sum up all the distances in board, as well as the board itself"
00:00tufflaxwhat does that mean
00:00allenj12tufflax: o sorry my bad i just meant that the board should be passed into the manhatten distance function aswell
00:00allenj12tufflax: that was poor wording
00:00allenj12tufflax: sorry
00:00tufflaxallenj12: np :P
00:10allenj12tufflax: the addition of map got me answer of 14N :P still trying to get around it
00:11tufflaxallenj12: Is 14N not good? :P
00:11tufflaxI don't understand what you mean by "get around it"
00:12allenj12tufflax: 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
00:12coventryIs there a right way to say (ns foo (:require [x.core :only [foo] :rename {foo bar}]))?
00:13tufflaxallenj12: N means that it's a BigNumber, you can mostly ignore that. I don't know where it came from either
00:13tufflaxBut obviosly you have miscalculated or the code is wrong in some other way then
00:13tufflaxif it should be 21 or 19 :p
00:14allenj12tufflax: hmm kk yea ill double check my other code
00:14tufflaxOr maybe BigInteger, you can check with (class the-number)
00:15tufflax,(class 1N)
00:15clojurebotclojure.lang.BigInt
00:15tufflaxallenj12: there ^
00:16allenj12tufflax: ty im checking some numbers using manhatten distance manually it seems to be mostly right
00:17allenj12tufflax: some are off tho
00:17TEttingerdid somebody say manhattan distance?
00:18marcopoloso 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
00:18TEttingerah, you mentioned A* earlier
00:18TEttingerallenj12, is this open source?
00:18allenj12Tettinger: why yes we did apparently there is something wrong with our method of calculating it :P
00:18TEttingerI already have an open source implementation of dijkstra pathfinding, if you're interested
00:19TEttingerI could honestly use A* since it's faster when you have a ton of options
00:19allenj12Tettinger: just an intro to ai hw im picking up clojure while i do this which i smaking it a little harder :X
00:19TEttingeroh ok
00:19allenj12Tettinger: :D
00:20TEttingerwell I'd love to take a look when you're done, I'm not aware of an A* impl in Clojure yet
00:20TEttingerhm
00:20TEttingerapparently the only difference between A* and dijkstra is the heuristic
00:20hfaafbis there any semantic or mechanical difference between calling (:key foo) and (foo :key) where foo is a map?
00:21brehauthfaafb: 'object/record' maps vs 'associative' maps
00:21allenj12Tettinger
00:21TEttingeryes?
00:21clojurebotyes isn't commutative
00:22allenj12Tettinger: 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
00:22allenj12Tettinger: thats all i know tho
00:22allenj12Tettinger: as far as comparing between the 2
00:23brehauthfaafb: keyword first slightly indicates an objectish/record map, whereas keyword second slighly indicates an associative thing that happens to have keywords as keys.
00:23TEttingerok, sure, I'll pastebin up mine if you want it. that's just what someone mentioned in a gamedev channel
00:23brehauthfaafb: if you were using core.typed, the former would be HMaps, the latter (Map keyword any) (or whatever value)
00:24allenj12Tettinger: https://www.refheap.com/18908
00:24allenj12also if anyone has a new to to calculate manhatten distance on a eight puzzle using a list then that would be helpful XD
00:25TEttingereight puzzle?
00:25hfaafbthank you brehaut
00:26allenj12Tettinger: yea a common puzzle of tile you can slide around if you googlde it you should get an idea
00:27TEttingeroh yeah that
00:29TEttingerallenj12, 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...?
00:29allenj12Tettinger: usually in other functional languages i know it is standard so i thought i would try it it
00:30TEttingeryeah, I just mean... there's a few ways to do this
00:30TEttingeroh I get it
00:31TEttingeryeah I see the / and mod 3
00:33TEttingerfound it
00:33TEttinger(apply + (map #(manhatten-distance board %) board))
00:34TEttingerit's finding the distance of the board to itself, allenj12
00:34TEttingeragh nvm
00:34TEttingerdidn't see it was checking goal in the function
00:45TEttingerallenj12, it seems like it acts correctly, I'm not sure what's up
00:45TEttingerit might be the usage of floor?
00:46TEttingernvm, found the bug
00:46allenj12Tettinger: for my test case at the bottom (manhatten-distance testt 3) it should not be 0
00:47allenj12Tettinger: yea
00:52TEttingergot it
00:55TEttingerhttp://ideone.com/zix3tO allenj12, the issue was only one abs was used, you needed to abs both terms
00:58TEttingeruh crud, a bad version went to ideon
00:58allenj12Tettinger: omg lol ty
00:59allenj12Tettinger: hmm now im getting 22
00:59allenj12juki
00:59TEttingerhaha
01:07ddellacosta(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.
01:09ddellacostanever mind, I guess I'm confusing how condp and cond work. Making it simply "nil" did the trick.
01:28callenddellacosta: case didn't fit your problem?
01:34ddellacostacallen: 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.
01:38callensight unseen, hard to say. Seems reasonable at first blush.
01:52hfaafbi'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
01:55mtpi'm fairly new to reading clojure code but it looks like something i'd write if i were any good at chess
01:56TEttingerditto, mtp
01:56mtp(if i wrote it, i'd probably think it needs a bit more abstraction, too)
01:56TEttingerI have no idea what it does, but it seems clean
01:57mtpand i'd start by naming the (mapcat (partial x board) (filter blah)) pattern i keep seeing
01:58mtpand also by clarifying the part where it says ;;promotion check, perhaps by naming the edges of the board
02:01metellusyou could replace (enemy ...) with a map {:black :white :white :black}
02:01metellusalthough I don't know that you gain anything from that...
02:03Jardahmm
02:03hfaafbmetellus: that makes a lot of sense! thanks
02:04Jardaso 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
02:04Jardathen I guess it isn't a 'pure function'
02:05Jardaas the return value isn't necessarily the same even with the same argument value
02:05Jardabecause of introduction of state, I guess
02:06Jardais this a real problem and if so, how do we handle this?
02:06SeanCorfieldyup, databases are a big ol' pot of state
02:06SeanCorfieldbut you can isolate it to the edges of your program and keep the rest of it pure
02:06Apage43alternatively you could model it as a function of 2 args, an id, and a snapshot of a database
02:07SeanCorfieldthat's the Datomic approach - database as value
02:08Jardabtw 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
02:09SeanCorfieldregular 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
02:09SeanCorfieldJarda: fwiw, i use both mysql and mongodb with clojure
02:10SeanCorfieldall the sql DBs are "equal" in some respect, since you ultimately use clojure.java.jdbc to interact with any of them
02:10SeanCorfieldfor the noSQL DBs, you'll have a separate library for each... i'm only familiar with mongodb (and congomongo)
02:10Jardaok
02:11SeanCorfieldthere's not yet any standardization in the noSQL world...
02:11JardaApage43: with cluctch?
02:11SeanCorfieldbut then there are four distinct types of noSQL DB :)
02:11Apage43no, I mean, I've actually worked *on* CouchDB =P
02:11JardaApage43: oh :D
02:11SeanCorfieldclutch is supposed to be really good for couchbase
02:11Apage43When I use it from clojure I just use clj-http though
02:12Apage43Couchbase doesn't support the CouchDB api
02:12Apage43if we have anything that points to clutch, I need to get it removed
02:12Jardaclutch doesn't support couchbase AFAIK
02:12Apage43correct
02:13Apage43rather anything built for CouchDB doesn't.
02:13SeanCorfieldoh... i didn't realize they were so different?
02:13SeanCorfieldthat seems... misguided...
02:13Apage43Couchbase is Membase (clustered memcached thingy) with CouchDB's view engine
02:13SeanCorfieldhow confusing...
02:14Apage43so K/V is over memcached protocol
02:14JardaCouchbase is missing the HTTP API completely
02:14Jardathe HTTP API of Apache CouchDB that is
02:15SeanCorfieldCouchDB sounded interesting if you needed auto-versioning (which we didn't, which is why we went with MongoDB)
02:15Apage43at any rate, as the NoSQL things go, they're all pretty different in terms of what they provide
02:15Apage43CouchDB's revisions can't be used for version tracking anyway
02:15Apage43they're for conflict detection only
02:15JardaApage43: you can pretty much use them for versioning though
02:16Apage43It doesn't make any guarantee that they'll stick around though
02:16SeanCorfieldI've heard a lot of people push CouchDB for versioned content... but never dug deep myself
02:16Jarda(if you realize that the revisions might be lost at certain circumstances)
02:17Apage43Apache CouchDB has an attachments feature which kind of works well for archiving things hanging off a document
02:17Apage43but the actual "revisions" are for detecting whether updates are in conflict during replication
02:17JardaI'd like to try Neo4j, not that I'd need a graph database. Just to make myself familiar with it :)
02:18SeanCorfieldI had a play with it during a Neo4J preso at a Java UG... using the Clojure REPL... It's definitely an interesting approach
02:19Apage43they perform a similar job to vector clocks in Riak
02:21callenyou couldn't pay me to use CouchDB again.
02:22callenbad experience using it with analytics data. CouchBase I might consider.
02:22callenthat was years ago, so it might've gotten better. I have scars though.
02:22Apage43I haven't followed actual CouchDB for a couple years, so I couldn't speak to what's happened in the meantime
02:24Apage43I 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..
02:26rhg135Is there a simple way to get a resource in cljs+nodejs like clojure.java.io?
02:27callenrhg135: JS doesn't have resources.
02:27callenrhg135: use the node.js file APIs.
02:28rhg135Figured
02:28rhg135K
02:28TEttingerJarda, graph DBs are interesting. they seem to have a pretty limited group of people who actually use them though
02:30callenThey're not super-duper practical for common-case stuff.
02:30s4mueli am interested in their application to complex software systems rather than people. service dependencies, infrastructure, etc. looking at bitsy, an embedded graph db atm
02:30callenand in most cases where you're actually storing a graph, it's often faster to just use adjacency lists and caching.
02:31Apage43mhm. Graphs are hard.
02:32Apage43Especially big ones.
02:45allenj12can 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
02:47Ember-and your problem in it is?
02:48Ember-ah, comment
02:48allenj12Ember-: yea i thought it would be better to ask in there
02:48Ember-path finding stuff it seems
02:49Ember-so that "list of possible moves" should be the path found, right?
02:50Apage43allenj12:I think you might be looking for the frequencies function
02:50Apage43,(frequencies [:up :up :right :right :right])
02:50clojurebot{:up 2, :right 3}
02:51allenj12no i will have at most only one oeration as it lists only posibble moves no repeats
02:51Ember-so just the first step of the found path?
02:51Apage43ah, I've misinterpreted
02:52allenj12so options lists a set of possible moves.. i wanna score how well those moves do and map the score with that move
02:52allenj12so
02:52Ember-ah
02:52allenj12if :up makes a manhatten distance of 3 then i want (:up 3)
02:53Apage43ahh
02:53allenj12so the priority map can sort it by the value and i can apply the operation in the next function
02:53allenj12by getting the key somehow :P
02:54allenj12sry if it was not clear enough
02:56Apage43(into (priority-map) (for [move options] [move (manhattan-distance (move-tile move board) goal)]))
02:56Apage43pm/priority-map i guess in your case
02:56allenj12hmm ill give it a shot
02:56Apage43in general you can conj [k v] pairs into maps
02:56Apage43and into conj's a list of things into an existing structure
02:57Apage43,(into {} [[:a 1] [:b 2]])
02:57clojurebot{:a 1, :b 2}
03:13allenj12Apage43: getting close it seems but not quite there https://www.refheap.com/18910 havin some trouble
03:15allenj12Apage43: not sure what that error means at the bottom imma keep playing with it
03:15Apage43it means (find-index) got called with a number
03:16Apage43somehow, and it wasn't expecting to
03:16Apage43allenj12: It looks like you got your arg order mixed up on line 38
03:17Apage43or something
03:17Apage43but move-tile is calling (find-index) with a number for its "board" arg, which I think is wrong
03:21allenj12Apage43: kk ill snoop around
03:29allenj12Apage43: 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
03:30Apage43I'm just reading "space (find-index 0 board)" and "find-index [board tile]"
03:30Apage43which looks like that always gets called with 0 as board and board as tile
03:31Apage43which is also backwards from how its called in possible-move?
03:31Apage43compare lines 38 and 50 in your last refh
03:31Apage43https://www.refheap.com/18910#L-38
03:34allenj12Apage34: ah yes silly but now im getting a new error again ill keep looking but ill repost it too
03:35allenj12Apage34: https://www.refheap.com/18911
03:38Apage43allenj12: 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
03:38Apage43,([1 2 3 4] 0)
03:38clojurebot1
03:38Apage43,('(1 2 3 4) 0)
03:38clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
03:39allenj12Apage34: isnt there a nth function? would that work?
03:40Apage43That works in place of using it as a function, but you still won't be able to assoc onto it
03:40Apage43&(doc nth)
03:40lazybot⇒ "([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."
03:41allenj12Apage43: interesting
03:41Apage43but in general if you're doing random-access style stuff you should use vectors over lists
03:46Viestihmm, what's the idiomatic way to have a named constant? (don't like to use "magic numbers")
03:47allenj12Apage43: IT WORKS!
03:47Apage43aw yeah!
03:54s4muelViesti: (def ^:const planck 6.626...)
03:55callen(inc s4muel)
03:55lazybot⇒ 1
03:55callenjust for using planck.
03:56s4muelseemed natural
04:02allenj12Im off for tonight
04:02allenj12Apage43: thank you
04:09Viestis4muel: thanks
05:54allenj12hey does anyone know how to get a key from a map value? say if i took the first of a map
05:55hyPiRionuse `key`
05:55hyPiRion,(key (first {:a :b}))
05:55clojurebot:a
05:55allenj12ah k lol sry if that was silly
05:55hyPiRionah, no worries
07:19reprobHi! Is it possible to edn/read something containing a clojure regex? (Specifying a :default option didn't work.)
07:21carlosgaldinois it possible to destructure the args of a function that was passed as an argument to another function?
07:22carlosgaldinosmth like: (defn my-function [function [a & args]])
07:25augustlcarlosgaldino: the only place those args would be available is inside the function, so I can't think of any use case for doing that
07:26carlosgaldinoaugustl: 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
07:26Bronsareprob: no, the edn reader doesn't include the regex literal
07:26reprobBronsa: Ah ok, thanks. I'll use the Clojure reader with *read-eval* off then...
07:26carlosgaldinoaugustl: since I'm very new to clj I'm just like, really don't know what I'm doing. :)
07:28augustlcarlosgaldino: yeah, the args to a function passed to another function is not available to that other function
07:44carlosgaldinoaugustl: ok, thanks
08:09javeI'm trying to make a spring mvc controller in Clojure, more or less like this:
08:09javehttp://stevendick.github.io/blog/2013/08/13/write-a-spring-mvc-controller-in-clojure/
08:09javebut I cant get it to work
08:10javeIt doesnt seem like the mothod annotations get compiled into the class
08:11javeif 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
08:14schmiris there a leiningen plugin helps with building a distribution for end users? i.e. helps with building an uberjar, and a .bat/shell wrapper?
08:37doomlord_what are the chances of a native clojure implementation apearing
08:41AimHerehttps://github.com/takeoutweight/clojure-scheme <- seems to exist already
08:41AimHereAt least in some form
08:42AimHereClojure's parasiting on host systems is probably part of it's success though!
08:47mdrogaliscallen: Heh, yeah. More just meant for repl use.
09:26G0SUBdoomlord_, AimHere: There's also https://github.com/halgari/clojure-metal/
09:31doomlord_thats different , but still pretty interesting.
09:32doomlord_ah, it can go to llvm
09:37augustlG0SUB, doomlord_: I wonder if that's legal.. Perhaps Rich will sue everyone, just like Oracle sued Android over Java :P
09:37G0SUBaugustl: what's illegal here?
09:38TimMcThe name would need changing.
09:38augustlG0SUB: the Clojure trademark, and the interface of Clojure itself
09:38doomlord_it could only be good for the clojure ecosystem, right?
09:39augustldidn't Oracle sue Google for copying the "looks" (not sure what the correct term is..) of Java in Dalvik?
09:39G0SUBaugustl: there's nothing illegal here, FWIW it's created by Tim Baldridge, Cognitect employee & co-author of core.async
09:39G0SUBaugustl: he also wrote clojure-py
09:40G0SUBand that Oracle reference is a joke in poor taste, IMHO.
09:40G0SUBall of these use-cases fall under "Fair Use"
09:40doomlord_edn looks neat, i'd always wanted json to support keywords/symbols
09:40augustlG0SUB: I see
09:45G0SUBaugustl: Oracle was just plain stupid (and arrogant) to sue Google over API. That's why they lost.
10:10silasdavisIf I am in the namespace some-long-and-unwieldy-namspace, and I use the fully qualified keyword ::foo
10:10silasdavisfrom another namespec can I coveniently reference :some-long-and-unwieldy-namspace/foo?
10:11silasdavisI was hoping I could use a require on some-long-and-unwieldy-namspace
10:11justin_smithsilasdavis: (:require some-long-and-unweildy-namespace :as slaun) ... ::slaun/foo
10:12silasdavisah, thanks
10:12justin_smithnp
10:13justin_smithI 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:34mdrogalisNight Vision debugger lives! https://github.com/MichaelDrogalis/night-vision
10:43ToBeReplacedi'm still not grokking core.async -- am I able to open/close readers inside of a go block?
10:44mdrogalisToBeReplaced: You don't close readers, you close channels.
10:45mdrogalisToBeReplaced: Try not to overthink it. It's just a queue that can be consumed by lightweight threads.
10:45cmajor7simple macro question.. still have difficulties fully grasping them: https://www.refheap.com/18919
10:47ToBeReplacedmdrogalis: 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:48mdrogalisToBeReplaced: Oh, you meant readers in that sense. Sure, why not?
10:49ToBeReplacedmdrogalis: 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:50vijaykirancmajor7: I'm not sure how you can return two values from a macro
10:51justin_smiththe only way to return two things is to put them inside a structure
10:51justin_smithperiod, macro or function or special form
10:52vijaykirancmajor7: in your case, the m is always returns the let which will return the last form
10:52ToBeReplacedmdrogalis: in fact (go (let [rdr ...] ...)) succeeds where (go (with-open [rdr ...] ...)) fails -- so i'm thinking that i just don't understand something
10:52justin_smithyou can use ~@ to expand a structure inline inside a syntax quote though
10:53cmajor7justin_smith: use "~@" on what structure.. I feel "the truth" is somewhere, just can pinpoint it.. can you give me a simple example?
10:53justin_smith ,`(1 2 ~@[3 4] 5)
10:53clojurebot(1 2 3 4 5)
10:54justin_smithof course [3 4] did not have to be literal, it could have been a binding
10:55mdrogalisToBeReplaced: What do you mean it 'reflects'?
10:55mdrogalisAFAIK, with-open is just a macro that expands to close the reader at the bottom of try/finally
10:55ToBeReplacedreflection on .close
10:55ToBeReplacedthe type hint seems to go awry inside of the go block
10:55cmajor7justin_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:57mdrogalisToBeReplaced: Hm, weird.
10:57mdrogalisMaybe ask tbalridge whenever he turns up.
10:57justin_smithcmajor7: yes, that is what putting something by an open paren does
10:58justin_smiththe ~@ has to be where the args are used, not generated
10:58justin_smiththe macro problem: they make you need to use more macros
10:58ToBeReplacedmdrogalis: yeah i've been having weird reflection problems -- https://www.refheap.com/18905
10:59mdrogalisPerhaps file it on Jira.
10:59cmajor7justin_smith: not sure I understand :) how does it need to be changed to return two maps?
10:59justin_smithcmajor7: 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:00ToBeReplacedmdrogalis: no CA :(
11:01cmajor7justin_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:01justin_smithcmajor7: 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:01justin_smithcmajor7: the way to do it is a macro where you use the values, not where you return them
11:02cmajor7justin_smith: I see, so macros can do anything _as long_ as that anything is a single form?
11:02justin_smithor just a function that destructures them and calls the other function
11:02justin_smithcmajor7: yeah
11:03mdrogalisToBeReplaced: You don't need a CA to file a bug on Jira.
11:03mdrogalisYou do need one to fix/contribute code.
11:03cmajor7justin_smith: thx. "is a macro where you use the values, not where you return them", can you elaborate?
11:03ToBeReplacedah, didn't realize
11:03mdrogalis:)
11:05justin_smithcmajor7: (defmacro m [double a b c] `(do-something ~@double a b c))
11:05justin_smithwhere double ends up bein the two maps you generated elsewhere
11:05justin_smithforgot to unquote a b c but hopefully you get the gist
11:06justin_smithso the thing making the two maps can just be a function returning a vector or list of length 2
11:06justin_smiththe macro happens where you use them
11:07justin_smithbut you really don't need a macro here, you could as well do (let [[a1 a2] double] (do-something a1 a2 b c))
11:07justin_smithno macro needed, just destructuring
11:20cmajor7justin_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:26sm0keHello, in core.async how do i define a callback function, when channel has value?
11:28yedihas there been a write up on Aurora yet?
11:30mdrogalissm0ke: There are no callbacks.
11:30fredyrsm0ke: i think one of the ideas w/ core.async is to get away from callbacks
11:30mdrogalisJust write the code sequentially.
11:30fredyrsm0ke: and instead have blocking semantics
11:30fredyralso what mdrogalis said
11:30sm0kefredyr: i dont get it why async in first place than?
11:31scriptorbecause async isn't just about callbacks
11:31scriptorit's so you can write asynchronous code that *looks* blocking, but is actually non-blocking
11:31mdrogalissm0ke: The compiler inserts the callbacks for you.
11:31sm0kewhat!!!
11:32justin_smithsm0ke: core.async turns a series of blocking reads into async callbacks on the value returned by the thing writing
11:32sm0kereally? wow but i get writes on channel..i still dont get the reads.
11:33sm0kei mean i dont understand
11:33scriptorpastebin your code and we can take a look
11:33scriptorah
11:33sm0ke:P
11:33sm0kereally compiler inserts the callbacks...that the most awesome thing i head all day
11:34fredyri guess the best way to think of it is ordinary threads writing/reading on blocking channels
11:34justin_smithsm0ke: 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:34mercwithamouthslurping/barfing is freaking awesome =P
11:36scriptorsm0ke: Nolen's article helped me out http://swannodette.github.io/2013/07/12/communicating-sequential-processes/
11:36scriptorthe first example is pretty complex, but then he moves on to a simpler one
11:37sm0kescriptor: ok so what you are saying is..whenever clojure compiler sees a (go (<!..the outside form is turned into a callback?
11:38justin_smithsm0ke: it goes deeper than that, every <! is a callback
11:38justin_smithor is translated into one, within the go block
11:39justin_smithso your typical go block is a deep set of nested callbacks, that read like normal step by step blocking code
11:40sm0kewow i need some time and googling to digest all this
11:40bbloomjustin_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:40justin_smithbbloom: thanks
11:40scriptorhas anyone written up anything on the internals of core.async?
11:40bbloomscriptor: yes, 1 sec
11:40justin_smithsm0ke: this is actually simpler than callbacks to use, that is the whole point
11:40scriptorthe source for (go …) is a bit intimidating
11:40bbloomscriptor: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/
11:41justin_smithit is callbacks and all that mess that require the heavy mental lifting from a user of the api
11:41scriptorbbloom: nice, thanks!
11:41justin_smithccore.async makes it easier, much easier
11:42tim__scriptor: also, my Clojure/Conj talk in 2 months
11:43justin_smithbbloom: isn't a state machine semantically equivalent to nested callbacks?
11:43sm0kewow after learning about (compile.. this is the second biggest mindblowing thing i stumbled upon in clojure..
11:43sm0kealthough i guess this is borrowed from golang?
11:43bbloomjustin_smith: the point i was clarifying is that the callbacks aren't nested lexical closures
11:43tbaldridgejustin_smith: perhaps semantically, but not from a performance perspective. The state machine version is pretty much alloc free.
11:44justin_smithright, nice
11:44tbaldridgejustin_smith: or can be made so, it's kindof half-alloc free in core.async right now.
11:44justin_smithI am actually very interested in ways to make alloc-free versions of clojure functions
11:45scriptortbaldridge: looking forward to the slides/video then
11:45justin_smithin common lisp there was this concept of "cons free programming", how to write code for tight loops that does not churn garbage
11:45justin_smithare there instructional resources for doing the equivalent in clojure?
11:46justin_smithI mean I guess we could each suss out how to do it, but a set of tricks and best practices woudl be cool
11:46bbloomjustin_smith: if you need instructions on how to do that, you shouldn't be doing that
11:46tbaldridgejustin_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:46justin_smithbbloom: hey, I want to do DSP in clojure, fuck me right?
11:47bbloomjustin_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:47pyranyone using clojure.core.typed in anger ?
11:47justin_smithbbloom: 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:48bbloomjustin_smith: take a look at HipHipArray
11:48justin_smithcool, thanks
11:48tbaldridgejustin_smith: and a profiler, and a hammock
11:48bbloomhttps://github.com/prismatic/hiphip
11:48Sorellasm0ke: kinda. core.async is based on Hoare's (et al?) communicating sequential process work. Go is also based on that.
11:49tbaldridgesm0ke: 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:49justin_smithI 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:50Apage43It seems like you'd figure those out pretty quick
11:52justin_smithso 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:52tbaldridgejustin_smith: or perhaps bbloom just lacks tact. Every performance optimizing programmer has to start somewhere.
11:53tbaldridgejustin_smith: take a look at hiphop though, it was kindof designed for this sort of thing
11:56bbloomjustin_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:56tbaldridge(inc bbloom)
11:56lazybot⇒ 18
11:57tbaldridgejustin_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:57mtpthat's how it usually goes
11:57justin_smithtbaldridge: sure, yeah
11:57tbaldridgeyou can do it, it's going to take some work, creativity that's all.
11:58justin_smithright now I just do the DSP in a dsl (csound) and do the tricky logic in clojure
11:58bbloomjustin_smith: have you looked at java-based solutions that you can access via interop?
11:58tbaldridgejustin_smith: for instance, even writing your DSP code in JAVA and then wiring it up with Clojure
11:59justin_smithyeah, that would make sense
11:59Apage43this is the whole overtone thing
11:59Apage43it gives you DSLs over supercollider
11:59seangrov`(dec bbloom) ; gotta keep the ego in check
11:59lazybot⇒ 17
11:59bbloomdammit.
11:59justin_smithI 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:59arrdem(dec seangrove) ; use of dec is discouraged
11:59lazybot⇒ -2
12:00Bronsalol
12:00arrdem(dec arrdem) ; for fairness
12:00lazybotYou can't adjust your own karma.
12:00arrdem#winning
12:00bbloom(doseq [user (:users clojure)] (dec user))
12:01arrdemit'd be awesome if the bots did expose a user/nicks var
12:02seangrov`arrdem: Fair enough :)
12:02tbaldridge(set! tbaldridge (inc 9000))
12:02tbaldridgethat's what i'd do if it did.
12:03seangrov`&(println "alive?")
12:03lazybot⇒ alive? nil
12:03seangrov`Ah, probably can't get carma from lazy bot then
12:03seangrov`&(do (println "(inc seangrov`)") 1)
12:03lazybot⇒ (inc seangrov`) 1
12:05jonasenbbloom: 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:06bbloomjonasen: they docs were updated a month or so ago to be much clearer
12:06bbloomi still believe very strongly that their approach is the best out there in the js world & would port very nicely to clojure
12:07seangrov`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:07bbloomseangrov`: cool! I'm glad you enjoyed it :-)
12:07jonasenbbloom: I've tried to find the reconciliation algorithm in their code base on github but haven't been able to find it
12:07bbloomjonasen: i think the word to look for is "transaction"
12:07jonasenbbloom: ok
12:08bbloomjonasen: they are pretty helpful over in #reactjs too
12:10bbloomjonasen: 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:12jonasenbbloom: Yes, it's probably possible to build a wrapper of sorts.
12:12jonasenDon't know how well it would work with advanced compilation
12:13bbloomjonasen: i was hoping not to have to wrap at all, but rather parameterize their engine
12:22jonasenbbloom: 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:23bbloomjonasen: it took me a while to sort it all out. it's dense
12:26wei_what's a good way to write a logical xor? e.g. (xor true true) => false
12:27bbloomwei_: (defn xor [p q] (and (or p q) (not (and p q))))
12:27wei_i guess that's just not= ...
12:27bbloomwei_: heh, yeah but i was just gonna say that :-)
12:27wei_cool :) thanks bbloom
12:38silasdaviswhat's the best way to call a sequence of methods just for their side-effects?
12:39tbaldridgesilasdavis: dorun
12:39tbaldridge,(doc dorun)
12:39clojurebot"([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:39TimMcwei_: not= works only if you're dealing with "physical" booleans.
12:39tbaldridgesilasdavis: compare to:
12:39tbaldridge,(doc doall)
12:39clojurebot"([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:40wei_what are non-physical booleans?
12:40TimMcIf you have logical booleans, you'd need to call (boolean ...) on the args first.
12:40rasmustotbaldridge: oh, I think I found the memory issues in my code :O
12:40wei_ah, right
12:40TimMcwei_: Well, ##(if 1 "logical true" "logical false")
12:40lazybot⇒ "logical true"
12:40TimMc&(if nil "logical true" "logical false")
12:40lazybot⇒ "logical false"
12:41tbaldridgerasmusto: ?
12:44TimMcSo this should work: (defn xor2 [a b] (not= (boolean a) (boolean b)))
12:44dnolenpyr: it seems like people are starting to do that, check #typed-clojure
13:00rasmustotbaldridge: dorun vs doall
13:01rasmustoI have a (doall (pmap ...)) over a very large sequence, and I'm just using it for side effects
13:03silasdavistbaldridge, I would I use it to execute [fn1, fn2, ...]
13:03silasdavislike (do (fn1) (fn2) (fn3) ...)
13:05rasmusto,(doall (map #(%) [#(print 1) #(print 2) #(print 3)]))
13:05clojurebot123(nil nil nil)
13:05justin_smithis there a known workaround for the loss of println output into the ether when printing inside asynch processes in nrepl / emacs?
13:06justin_smithI guess I could start using a logging lib in my repl, but that somehow feels wrong
13:07clgvjustin_smith: you probably have an stdout buffer in emacs. the missing messages should show up there.
13:08justin_smithI am connecting to an nrepl in a terminal
13:08glosoliWhat about Emacs
13:08glosoli ?
13:08justin_smithit is not showing up in the terminal, the nrepl buffer, or the nrepl connection buffer
13:08glosolijustin_smith: C-x-b nrepl-server
13:08glosoliIt might be hidden, depending on the conf
13:09justin_smiththere is no such buffer, because I am connecting to a process in a terminal
13:09glosoliBut it shows up in buffer search :)
13:09glosolihmm
13:09glosolinever done that
13:10justin_smithI should see "pending: (this is a test)" instead I get "pending: (this is", or sometimes "pending: "
13:10justin_smithor sometimes nothing
13:10justin_smithseemingly random
13:10glosolijustin_smith: ah yes you are right hmm interesting
13:11justin_smithso you can reproduce it by printing in future calls maybe?
13:12mattywI've just suddenly started seeing SAXParseException when I try to evaluate using vim-fireplace. Has anyone else seen this?
13:12glosolijustin_smith: dunno man :) I am kinda of a newbie here, it's first time I heard of future calls :)
13:14silasdaviscan I write (dorun (for [f [#(println "foo") #(println "bar")]] (f))) more directly
13:15justin_smithglosoli: (dotimes [i 30] (future (println "hello" "there" "world:" i)))
13:15justin_smithnotice how few numbers are in that output
13:16glosolihttp://imgur.com/AGRtR8H
13:16glosoliyeah
13:16justin_smitheven better: (dotimes [i 30] (future (locking *out* (println "hello" "there" "world:" i))))
13:17justin_smithin a repl that loses almost all the printouts, in a naked repl you see them all
13:18justin_smithhmm, looks like you are getting most of the output, if not all, I am losing most of it
13:18justin_smithtry the locking version I just pasted
13:19glosolihttp://imgur.com/YBBbUeF
13:19glosoliSeems like I got all of them
13:19justin_smithsomething must be wrong with my setup
13:19glosolijustin_smith: maybe older version of nREPL ?
13:20justin_smithmine is pretty new, let me see if elpa has an update
13:20RaynesReddit has ruined me.
13:20RaynesI saw all those imgur links and was fully expecting to see cats.
13:20justin_smithheh
13:20RaynesWas utterly disappointed to find out otherwise.
13:20glosolicat pics lol, da best
13:21Raynesglosoli: http://i.imgur.com/b24K57j.gif
13:21glosoliaaah so these are the cat pictures everyone are crazy about lol
13:23silasdavisis (fn [f] (f)) a built-in function?
13:23xeqi&(apply (fn [] 3))
13:23lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$apply
13:24technomancymaybe force?
13:24xeqiblah, the ones I can think of don't have 0 arity
13:24technomancynope
13:24technomancydeliver is the 1-arity one
13:25justin_smith,(deliver 3)
13:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$deliver>
13:25technomancy,(deliver println :ohai)
13:25clojurebot:ohai\n
13:25silasdaviscontext is (dorun (map #(%) fns))
13:25xeqi&(.invoke (fn [] 3))
13:25lazybot⇒ 3
13:25technomancyuse doseq
13:26silasdavis(doseq [f fns] (f))?
13:26xeqiyep, that is better in that context
13:26silasdavisok cheers
13:30TimMcsilasdavis: Try trampoline. :-P
13:31bordatouecould anyone tell me which version is domain defined for core.logic
13:35justin_smithglosoli: updating my nrepl.el did the trick, it seems
13:36glosolijustin_smith: must have been some bug
13:36TimMc&(trampoline (-> f #(f)))
13:36lazybotjava.lang.StackOverflowError
13:37silasdavisTimMc, nice that works... provided the function doesn't return a function you don't want to run
13:37TimMcOh hmm, not quite.
13:37TimMcsilasdavis: :-)
13:37TimMc&(trampoline (fn f [] f))
13:37lazybotExecution Timed Out!
13:38silasdavisboing
13:40technomancynice
13:42TimMc&(recur) is the shortest infinite loop I can make, I think.
13:42lazybotExecution Timed Out!
13:46TimMcAnd ##((-> f #(f))) is my new personal best for stack overflow, beating out the previous record of (#(% %) #(% %))
13:46lazybotjava.lang.StackOverflowError
13:46Raynes&(range)
13:46lazybotjava.lang.OutOfMemoryError: Java heap space
13:46RaynesThat's technically an infinite loop.
13:47RaynesUnfortunately it also uses heap space :P
13:47TimMcRaynes: (dorun (range)) hasn't been an infinite loop since 1.3 came out.
13:48TimMcRIP auto-promoting +.
13:48rasmusto&(dorun (range))
13:48TimMc(Well, it's +' now, but whatever.)
13:48lazybotExecution Timed Out!
13:48TimMcrasmusto: That will take too long, you'll want to start not too far before Long/MAX_VALUE.
13:48silasdavisTimMc, what does ## do?
13:48TimMcsilasdavis: Inline bot trigger.
13:49silasdavisha
13:49silasdavisah
13:49`cbpHmm would a random error inside a compojure defroutes make it silently fail and cause the routes to not actually be added?
13:50rasmusto&(dorun (range (dec Long/MAX_VALUE) Long/MAX_VALUE))
13:50lazybot⇒ nil
13:52TimMc&(dorun (range (dec Long/MAX_VALUE) Double/POSITIVE_INFINITY))
13:52lazybotjava.lang.ArithmeticException: integer overflow
13:52shoerainSo uh... low hanging fruit question: I want to reload a project from inside `lein repl`. Can I do that?
13:52justin_smithshoerain: (require ... :reload-all)
13:52TimMcshoerain: clojure.tools.namespace apparently has a refresh fn as well.
13:52rasmustoshoerain: check out clojure.tools.namespace.repl/refresh[-all] also, it's pretty cool
13:52justin_smiththat doesn't help with for example async stuff still running
13:53shoerainwhoa, fast.
13:58shoerainTimMc, rasmusto thank you 2 for clojure.tools.namespace.repl/refresh
13:59callenmdrogalis: right. for exploring other peoples' code :)
14:00rasmustoshoerain: 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:01shoerainso 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:01justin_smithwould "aot" include macros and protocols? because those can be tricky too
14:01mdrogaliscallen: :)
14:01justin_smithshoerain: in emacs by default it is alt-tab or esc-tab
14:01rasmustojustin_smith: not in my case, I don't think i'm using non-standard macro stuff
14:01callenshoerain: why are you gen-class'ing?
14:02shoerainsince (overtone-tutorial.core/<TAB>)
14:02shoeraincallen: I couldn't tell you, since I don't know myself.
14:02justin_smithshoerain: yeah, tab is just indent by default, alt-tab or esc-tab (both map to M-tab internally)
14:02rasmustojustin_smith: I never understood that, doesn't alt-tab usually do something different? :P
14:03justin_smithrasmusto: only if your window managers steal it
14:03justin_smithemacs used it before "window managers" were a thing
14:03justin_smithiirc
14:03rasmustoah gotcha
14:04justin_smithgen-class is only really needed if java code needs to call your code
14:04justin_smithafaik
14:04justin_smithand it is one of those aot things that will make reloading messy
14:04technomancyit can make uberjars easier too, but yeah, not required
14:04shoerainshucks, but my .inputrc gets in the way of esc-tab (vim bindings here), and m-tab is taken by window manager. hm
14:05rasmustoshoerain: evil-mode steals my 'esc' :p
14:05justin_smithtechnomancy: is that because the user of the uberjar is a java program, or is there something else I am missing?
14:06technomancyjustin_smith: `java -jar myjar-standalone.jar` vs `java -cp myjar-standalone.jar clojure.main -m mymain.ns`
14:06justin_smithahh
14:06justin_smithyeah
14:06technomancythere is also lein-otf
14:06shoerainrasmusto, justin_smith: so I should look into customizing `lein repl` (presumably nrepl) for tab completion?
14:07justin_smithoh, is this not in emacs, just the repl?
14:07justin_smithI was confused
14:07technomancyand profile-scoped targets with limiting :aot to the uberjar profile
14:07rasmustohrm, c.t.n.r/refresh-all fails for me if I :aot [my.ns]... Says it can't find a namespace
14:07shoerainjustin_smith: yup just the repl
14:08rasmustoshoerain: are you an emacs user? or would you like to learn?
14:08justin_smithyeah, then tab should complete things if the namespaces are loaded
14:08shoeraini haven't hooked up editors and repls (so far in python and javascript)
14:09shoerainjustin_smith: it's a generic completion, I guess I want (clojure.tools.namespace.repl/<tab>) to return all possible inputs
14:09shoerainer, s/inputs/functions in that namespace/
14:09justin_smithI think you want editor integration for that kind of thing
14:10technomancyno, you should have completion in lein repl
14:11shoerainthere'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:11technomancy.inputrc might be confusing it
14:15shoerainthis is a record of what i'm doing: http://asciinema.org/a/5572
14:16rasmustoshoerain: i read that as "asciienema"
14:16mtpasciilemma
14:16shoerainwell
14:16shoerainit has some noise too (from supercollider and /usr/bin/java)
14:17justin_smithif you :use you don't have to type out the namespace, that is kind of the point of :use
14:17rasmustoshoerain: it looks like it's completing the whole "clojure.tools.namespace..." thing, it should complete the stuff from "clojure...." as well
14:17shoerainso :use is similar to (use 'namespace.core), but in the repl?
14:17shoerainif so, I was wondering why the syntax is differet
14:18rasmustoshoerain: :use is just inside of the (ns) macro
14:18rasmustobut he's saying that if you "use" something, you don't have to fully qualify it
14:18rasmustoor "require c.t.n.r :refer [refresh]"
14:19shoerainoh yeah sure. I just wanted to look at functions in that namespace though
14:19rasmustoshoerain: yeah, I'm not sure what the completion is doing
14:19shoerainif I just <tab> with nothing typed in, I get every possible function/keyword
14:20shoerainrasmusto: so completion should be working, but it's not working for me?
14:20rasmustoshoerain: if I do "clojure<tab>" I get all the completions from core and others
14:20technomancyshoerain: try moving .inputrc and re-running lein repl
14:20justin_smithtechnomancy: his term session he posted showed he had no .inputrc
14:20shoerainshould i output lein/clojure versions too? technomancy I did; there's a `cat ~/.inputrc` command that doesn't return anything
14:21technomancyoh oops
14:21shoerainanyway i'll check when i'm back later, thanks for the help
14:21shoerainmebbe i'll just install arch and be done with this ubuntu-ness... overtone was more of a pain to get started here
14:22supersymfun, I knew there had to be someone who tried that before :P (code by voice) https://www.youtube.com/watch?v=8SkdfdXWYaI
14:22rasmustoshoerain: are you running leiningen from apt?
14:27wei_is there a way to get :body-params from compojure's destructuring syntx?
14:29rasmustois 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:30xeqiwei_: (GET "/route" {:keys [body-params] :as request} ...)
14:30technomancyrasmusto: maybe :init in :repl-options?
14:31technomancyrasmusto: IMO that approach isn't great since it encourages you to stay in the user ns
14:31technomancymuch better to expose the functionality you want in your editor
14:31wei_thanks xeqi. so no way to get it with the compojure-specific destructuring e.g. (GET "/route/:id" [id] ...) ?
14:31technomancyhttps://github.com/technomancy/nrepl-discover
14:31silasdavisis there a built-in for (comp (partial into {}) concat) ?
14:32rasmustotechnomancy: okay. ~/.lein/profiles.clj + editor seems like a good approach
14:32silasdavishash-maps as args
14:32technomancysilasdavis: just into?
14:32rasmustoI guess the only issue is sharing tools w/ other ppl
14:32silasdavistechnomancy, madness
14:32technomancyor merge if you need many args
14:32silasdavisthanks
14:32technomancy=)
14:33technomancyrasmusto: I've been thinking about exposing ops from reply and nrepl.el as things like "~toggle-trace my.ns/some-var"
14:33technomancythings that you'd normally invoke via M-x nrepl-toggle-trace
14:33technomancymight sketch out an implementation in grench first
14:34rasmustohm, sounds interesting
14:34callentechnomancy: the Grenchmen are on the forefront of (social) engineering?
14:34technomancyslime is similar; you can enter ,commands which aren't interpreted as code input
14:34rasmustodo you have a recommended way to run clojure code in the nrepl.el repl with an emacs hotkey?
14:35technomancycallen: I wish someone would record a cover of some grenchmen songs like http://wondermark.com/more-littlest-butt/
14:35technomancyrasmusto: no, but that should be added to the docs
14:36callentechnomancy: o lawd.
14:36technomancyyou're welcome
14:37justin_smithrasmusto: C-M-x ?
14:37justin_smiththat will run the surrounding sexp in the default nrepl instance
14:37technomancyI think he means code that isn't under the point
14:37callenI, too, want the littlest butt ;_;
14:37rasmustojustin_smith: yeah, this would be code that I define in my init.el
14:38justin_smithoh
14:38rasmustostuff like (require '[clojure.pprint :refer [pprint]]) (assuming I'm in the nREPL mode)
14:39callenI use a macro for that.
14:39callenmy refresh macro in the REPL dumps (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]])
14:40callenI jam that and go back to what I was doing
14:40technomancyI don't think you should do it inside a session
14:40justin_smithcallen: so then you then run the macro manually, right?
14:40callenI do so because I don't really live in 'user
14:40technomancyI think "make this operation available everywhere" should be supported by tooling
14:40callenjustin_smith: I make a conscious decision to refresh my REPL, yes.
14:40technomancyreply does this to a degree
14:40callenjustin_smith: it's partly a hack around not having a universal injection faculty.
14:40callenpartly because I co-opted some of how Stuart Sierra works.
14:41callenmy test REPL does: (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (run-all-tests)
14:41callenI jam "up-arrow return-key" to run my tests, ^^
14:41rasmustocallen: I was looking at his dev/user.clj, and it works, but requires that you move deps from ~/.lein/profiles to the project
14:42callenrasmusto: nothx. I work on too many projects for that.
14:42technomancyuser.cjl doesn't compose
14:42callenthat too.
14:42rasmustocompose in what way?
14:43technomancyyou can only have one of them
14:43technomancyit's basically the anti-namespace
14:43technomancythe namespace which isn't namespaced
14:43rasmustomay as well be called 'global?
14:43technomancybasically
14:43rasmustookay, hmm
14:44rasmustogood thing user.clj is still just sitting in the index
14:44rasmustocallen: do you have a dotfiles repo I can look at for your emacs macro?
14:45callenI thought this channel was sick of me talking about my dotfiles repo.
14:45callenrasmusto: https://github.com/bitemyapp/dotfiles/blob/master/.emacs.d/clojure/clojure-config.el
14:45callenyou'll see my tracing machinery there too.
14:46rasmustoI'll talk dotfiles all day
14:47callenrasmusto: my dotfiles repo has ~420,000 LOC of elisp.
14:47technomancyyou monster
14:47callenrasmusto: you really don't want me to talk about my antediluvian Emacs.
14:47rasmustoi made this thing: https://github.com/rasmusto/vim-emacs-clojure-starter-kit and its bad
14:47technomancyanyone remember M-x clojure-install?
14:47callenentire monasteries of monks have gotten lost in my dotfiles.
14:48callenYou can find stories of their past generations scribbled on the stone of the labyrinth
14:48callenthe bones of friar john...
14:48technomancycallen: have you read http://www.amazon.com/Crazy-Hair-Neil-Gaiman/dp/0060579080 ?
14:48technomancy"Crazy Dotfiles" https://www.youtube.com/watch?v=7mx_l1bBrPk
14:49callentechnomancy: I have not read it.
14:50technomancy"Hunters send in expeditions; radio back there positions. Still, we've lost a dozen there. Lost inside my crazy hair."
14:50callenrasmusto: anyway yeah, alembic, c.t.t, c.t.n.r, and c.pp are the relevant parts of that file.
14:50technomancy*their
14:50technomancythis is how I imagine your dotfiles
14:50callenSeems accurate.
14:51callenaka, "Where we're going? We won't need package management where we're going."
14:51callencue demonic shrieks
14:51callenthis is what happens when your development environment started life as timestamped tarballs a decade and change prior.
14:52xeqihuey lewis?
14:52rasmustorasmusto: thanks :)
14:57shaungilchristis anyone tackling the lack of pprint for cljs?
14:58callenshaungilchrist: 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:59callenif there are attack dogs, plz report as much from your hospital bed.
15:00callentechnomancy: thanks for reminding me of my least favorite part of CL. I'd almost suppressed that memory.
15:00rasmustocallen: where do you load up clojure-config.el? (pardon my emacs ignorance)
15:00callennow i have to spend 2 hours in the bathtub scraping my skin
15:00callenrasmusto: oh so you want to follow this rabbit-hole?
15:00callenrasmusto: https://github.com/bitemyapp/dotfiles/ that's the top-level, look at .emacs
15:01callenrasmusto: I add everything in ~/.emacs.d/ to the elisp load path
15:01callenthen I require/load-library libraries and config files.
15:01callenat the bottom of my .emacs you will notice my extreme hatred of auto-fill-mode.
15:03gleagcallen: Shouldn't you be more afraid of the velociraptors? ;)
15:03rasmustocallen: ah, ok. seems familiar
15:03callengleag: 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:04callenincidentally, I was once an 11 year old kid that "knows Unix"
15:04callenso I'm in good company.
15:04callenrasmusto: the familiarity is a ruse.
15:04justin_smithwhat was that 3d sgi file system manager called again?
15:04callenrasmusto: I even use a custom color theme :)
15:04justin_smiththe one on the screen when she said that
15:05callenjustin_smith: http://en.wikipedia.org/wiki/Fsn
15:05callenjustin_smith: I googled what you said and clicked the first result.
15:05rasmustocallen: it would feel more familiar if it had escape key timeout hacks in it
15:05callenthis is how it works 99% of the time when somebody asks a question in here.
15:08TimMcIn this case, who cares?
15:08TimMcIt's not a Clojure question, it's off-topic conversation.
15:09TimMcIf 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:09technomancyor teach it to clojurebot
15:09TimMcOr that.
15:09callen~raptors
15:09clojurebotNo entiendo
15:09technomancywhat do we have bots around here for anyway if not as labour-saving devices
15:09technomancyclojurebot: earn those botsnacks, slacker
15:09clojurebotCool story bro.
15:10technomancydang it
15:10gfredericks"labor" saving
15:10technomancygfredericks: haven't you seen the jetsons
15:10gfredericksnot really
15:11technomancyoh
15:13gleagcallen: I actually had http://xkcd.com/292 in mind.
15:14callenI just wrote a "throws?" macro. I think I'm a bad person.
15:14callengleag: so did I.
15:15callengleag: he has a whole on-going theme with the velociraptors :)
15:16sverihi, 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:16gleagcallen: Just like Tolkien, Jackson, and Rowling with spiders. :)
15:17gleagI wonder if there are people with lispalienophobia out there.
15:21`cbpsveri: selmer has a function selmer.parser/cache-off!
15:22callensveri: it's not detecting the file timestamp changes for some reason, which is strange but easily rectified by what `cbp said.
15:24svericallen: `cbp: ok, thats nice, but where and how do i call that function?
15:25_scapegiven (["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:25sveriin the handler.clj in the init function?
15:25callensveri: sure.
15:25callensveri: give it a whirl.
15:29svericallen: 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:32rlbIt 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:34llasramrlb: I haven't used it yet myself, but might be worth checking out https://github.com/jnr/jnr-posix
15:34nDuffHrm.
15:34`cbp_scape: group-by does kind of what you want
15:34rlbllasram: OK, thanks.
15:35nDuffI 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:35shaungilchristcallen: 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`cbp,(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:35clojurebot{"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_scapethank you
15:36callenshaungilchrist: you can already pretty-print edn...
15:36callenshaungilchrist: ...because it's Clojure data...
15:37callenI am now going to stare at shaungilchrist in consternation
15:39dnolennDuff: worked for me at the REPL, did you make sure to clean your project after switching CLJS versions?
15:42shaungilchristcallen: in clojurescript?
15:42nDuffdnolen: "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:42mdrogalisdnolen: Coworker excitedly ran over to me. "Immutable JS objects". One word reply: "Mori" D:
15:42nDufferr, lein-cljsbuild
15:42nDuffdnolen: ...which build are you testing against?
15:42shaungilchristcallen: I am looking for run-time pprint of edn in cljs e.g. nice whitespace idiomatic indentation etc.
15:42dnolennDuff: master
15:43dnolennDuff: clojurescript.net doesn't track ClojureScript closely as far as I know, it's the CLJS-in-CLJS project
15:43dnolenmdrogalis: heh
15:45nDuffdnolen: hmm. I'm currently trying 0.0-1889, but if master works, maybe switching to a snapshot is the thing to do.
15:46dnolennDuff: should work in 1889 too there's reader support for #queue and there has been for a long time
15:46dnolennDuff: minimal project to recreate please
15:53dnolenbbloom: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf
15:54dnolentbaldridge: you might find this interesting too ^
15:54bbloom@dnolen: yup. tbaldridge & i were discussing that a week or two ago in here
15:54bbloomgood stuff
15:54tbaldridgednolen: ditto what bbloom said
15:55nDuffdnolen: https://gist.github.com/charles-dyfis-net/087d8be56804c9e9fae2
15:55dnolenbbloom: heh cool, I saw that Oleg & co were presenting it at Haskell Symposium
15:55bbloomawesome
15:55bbloomit's good stuff
15:55nDuffdnolen: ...there's a makefile in there to create the directory structure and run lein (since gist doesn't allow subdirectories).
15:55bbloomi think this extensible effects stuff is a BFD
15:56dnolennDuff: does the problem still occur if you use a ns form?
15:57nDuffShoot. I hadn't paid enough attention that it was a NPE here.
15:57nDuffNot the same error as the original non-minimal case.
15:57nDuffBack to try to figure out how to reproduce...
16:11hfaafbis it feasible to profile a short lived clojure jar in visualVM?
16:11hiredmanhfaafb: best to put the short lived code in a loop
16:11hiredmanif your short lived code exits before you have time to attach the profiler you cannot profile it
16:12hfaafbthanks
16:13justin_smithyou could also load up a repl, attach jvisualvm, and then run the main function manually
16:13justin_smithbut a loop will gather better data, likely
16:13nDuff...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:14nDuffI wonder if optimizing the spun-up case is actually fair in this kind of situation. :)
16:16nopromptdnolen: is there any gotcha with dynamic variables in clojurescript?
16:16noprompt*are there
16:16dnolennoprompt: like what?
16:17nopromptdnolen: 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:18nopromptdnolen: there's probably something subtle we're missing, but i thought i'd ask.
16:18dnolennoprompt: we don't really support bound-fn or similar things
16:20nopromptdnolen: ah ok, so binding is the problem.
16:20nopromptdnolen: wait, nm, my mistake.
16:20nopromptsorry i read that wrong.
16:21dnolennoprompt: binding if you're assuming that you can *capture* a set of bindings like you can with bound-fn in Clojure
16:22jmonettahi guys, any ideas why this doesn't work? :
16:22jmonetta(defmacro testmacro
16:22jmonetta ([a] (testmacro 5 a))
16:22jmonetta ([b a] `(+ ~a ~b)))
16:24nopromptdnolen: do you have a moment to glance at some code?
16:25callenjmonetta: I liked that you tried that.
16:25dnolennoprompt: only if it's a minimal case
16:25nopromptdnolen: yeah it's just the setup/application.
16:26dnolennoprompt: got a gist or link?
16:26nopromptdnolen: https://github.com/jeluard/garden/blob/cljs/src/cljx/garden/compiler.cljx#L48-L52 , #L62-L66, #L198
16:27nopromptdnolen: just the var decl, macro, and how it's used.
16:27jmonettacallen: sorry, didn't got that
16:27jmonettawhat am I doing wrong there?
16:27nopromptdnolen: the code works perfectly fine in clj, but in cljs it looks like *selector-context* is not getting bound.
16:28dnolennoprompt: yeah that's not what I'd call a minimal case :)
16:28dnolennoprompt: a stand alone project with a some code that doesn't work
16:28nopromptdnolen: oh :P
16:30nopromptdnolen: just to be clear though, binding [*some-var* some-val] should work fine in cljs though?
16:30noprompti haven't messed with dyn vars at all in cljs yet.
16:35dnolennoprompt: yes binding is supported
16:36nopromptdnolen: ok that's what i thought. guess i have some investigation to do. :)
16:37rlbllasram: 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:38rlbso perhaps back to thinking about jni...
16:39rlb(or seeing if jnr-posix might be interested in an extra method...)
16:40technomancyhuh; ocaml can have let-scoped "open" declarations (essentially :refers)
16:42technomancy(with-ns [(:require [clojure.java.io :as io])] (io/copy thingy target))
16:42technomancythat would be a fun exercise to implement
16:44rasmustotechnomancy: wouldn't that be easier with a more composable ns macro?
16:46Bronsatechnomancy: (defmacro with-ns [opts & body] `(let [ns# *ns*] (ns ~(gensym) ~@opts) ~@body (in-ns (ns-name ns#))))
16:46technomancyBronsa: mwahaha
16:46rasmustooshi
16:46technomancyrasmusto: I don't think so unless you mean moving refers and :as aliases to not be implemented in java
16:47technomancythe way it happens in alias/refer is inherently stateful
16:47rasmustomaybe, I'm not quite sure what I mean. But I think people have talked about wanting inheritable namespace templates and the like
16:48technomancyhuh; .removeAlias exists as a method on Namespace
16:48technomancyso you could just make the changes and roll them back
16:50callenMy new nickname for http://clojurescript.net/ is the "Un-muggle-ma-tron"
16:53mpenetHow 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:53justin_smithwhat law would it violate?
16:53mpenetthe readers untold laws
16:54technomancythere are some completely-ignored guidelines about what constitutes a "legal" identifier
16:54technomancy
16:54mpenetI think vars should start with an alpha char, but then again nothing is specified
16:55mpenetwell it is: http://clojure.org/reader
16:55mpenetMaybe I will comply then, or just go the heretic way, not sure yet
16:55rasmusto(defn myfn® [])
16:56mpenetactually "?" should be fine
16:57technomancyI wouldn't take those rules too seriously
16:57technomancyclojure breaks them
16:58mpenetYup, 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:00Bronsampenet: there's no way a macro called . is going to work
17:00mpenetI know, this was an example of macro naming used in core, not a name I planned to use
17:00Bronsaoh, ok
17:00Bronsa(. is not a macro btw)
17:00technomancyisn't . a special form though?
17:00mpenetah
17:00technomancyright
17:01Bronsathat's why I said it's never going to work
17:10lunk`source
17:10lunkis the code for clojurebot available somewhere?
17:10technomancyclojurebot: source
17:10clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
17:10lunkty
17:11technomancysure
17:15lunk`(let [x 5] x)
17:15lunkclojurebot: `(let [x 5] x)
17:15clojurebotGabh mo leithscéal?
17:16lunkclojurebot: (let [x 5] x)
17:16clojurebotIt's greek to me.
17:16lunktechnomancy: little help here
17:16lunk:)
17:16Bronsa,(let [x 5] x)
17:16clojurebot5
17:16lunkoh comma
17:16lunkty
17:16justin_smithwithout 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:17lunk,(for [x (range 1)] (* x x x x))
17:17clojurebot(0)
17:18nopromptjustin_smith: what would ? mean as far as a namespace name goes?
17:18justin_smith? as a namespace? dunno
17:18scriptorlunk: if you need a quick repl online, there's always http://tryclj.com/
17:18justin_smithI meant within one it at least has a context
17:19lunkdid someone filter our System calls from clojure bot? (java.lang.System/exit 0) for instance
17:19justin_smithyou can also /msg clojurebot
17:19nopromptjustin_smith: can you share an example?
17:19lunkscriptor: just thinking about the bot and sanitizing user inputs ;)
17:19jkj_http://pastie.org/8349900
17:19jkj_wtf
17:19scriptorah
17:19jkj_i have a very strange performace problem
17:19jkj_very very strange
17:20justin_smithnoprompt (speech-act/? "dog" "here")
17:20justin_smithgenerates a question
17:20lunkoh goody, security exception, worked better than expected
17:20jkj_my sort-by took too long.. then i presorted the stuff, but now the (first) to the sequence takes time :D
17:20nopromptjustin_smith: oh you were say a var named ? not a namespace named ?.
17:20noprompt*saying
17:20justin_smithyeah
17:20justin_smithhah
17:21justin_smiththough ? would make a good name for a namespace that defined a large number of boolean predicates
17:21gfredericksjkj_: I think this is lazy seqs
17:21jkj_gfredericks: true... filter probably does that
17:21gfredericksjkj_: without the first the lazy seq escapes the (time) call without doing any work
17:21nopromptjustin_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:21justin_smithI think it would depend on the ns, but sure
17:22jkj_gfredericks: funny that the repl shows so tiny times though the full sequence is shown
17:22jkj_gfredericks: maybe the time is just not calculated and the sequence is realized on repl's own time?
17:22jkj_...or something
17:23gfredericksjkj_: yes that's it
17:23nopromptjustin_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:23gfredericksif you wrapped the filter version with (time (doall ...)) you'd see it slow down
17:24nopromptjustin_smith: that being said, it may make perfect sense with regard to your lib.
17:24jkj_gfredericks: yes. i tried
17:25jkj_gfredericks: any ideas on finding the longest .startsWith string match fast?
17:26justin_smith,(apply str (map (comp char read-string (partial apply (partial str "2r"))) (partition 8 "011011000110111101101100")))
17:26clojurebot"lol"
17:26jkj_gfredericks: http://pastie.org/8349932
17:27rasmusto,(str "2r" "0100101")
17:27clojurebot"2r0100101"
17:27rasmustooh
17:27justin_smithread syntax for base 2 number
17:28justin_smith,"2r0100101
17:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
17:28gfredericksjkj_: if your question is just about performance, then you can probably add a type hint there
17:28justin_smithoops
17:28justin_smith,"2r0100101
17:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
17:28justin_smith,"2r0100101"
17:28clojurebot"2r0100101"
17:28rasmustoI always get a little sad when bits are represented as unicode characters
17:28justin_smith,2r0100101
17:28clojurebot37
17:28gfredericksjkj_: (.startsWith ^String call (:call %))
17:28jkj_gfredericks: thx
17:29gfredericksjkj_: that avoids reflection, which is super slow compared to a quick string operation
17:29jkj_gfredericks: wow. a huge difference
17:30justin_smithrasmusto: I had thrown that little snippet together to decode a string of bits I saw on the net
17:30rasmustojustin_smith: yeah, there are some 4clojure problems that involve looking at digits, seems like read-string is the cleanest way to do it
17:31jkj_gfredericks: problem solved.
17:31gfredericks,strangely I can't reproduce the timing difference:
17:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: strangely in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:31gfredericks,(time ((fn [s] (.startsWith s "foo")) "foo bar"))
17:31clojurebot"Elapsed time: 0.156546 msecs"\ntrue
17:31gfredericks,(time ((fn [s] (.startsWith ^String s "foo")) "foo bar"))
17:31clojurebot"Elapsed time: 0.132136 msecs"\ntrue
17:32gfredericksthat's a barely noticeable improvement
17:32gfredericksbut *warn-on-reflection* confirms that the first reflects while the second doesn't
17:32justin_smithrasmusto: with 4clojure I actually ended up doing a loop with quot and div
17:32justin_smithbut when you are starting with a string rather than number, that is a little different I think
17:33rasmustooh, hm. I think I've done both
17:33justin_smithI am noisesmith on 4clojure, if you are curious
17:33rasmustonumber -> string doesn't make much sense though, except for that palindrome one
17:34justin_smithI 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:34justin_smith*type char
17:34rasmustoall of my ram is in lazy-seqs usage, go figure
17:35lunkrasmusto: (get-a-job lazy-seqs)
17:36rasmustolunk: both my code and myself share that trait
17:36lunk:P
17:36rasmustothough I'm not religious
17:36mpenetjustin_smith: in my case it's used like that: (select :foo (where {:bar 1 :baz ?}))
17:37mpenetjustin_smith: even tho I agree in most case it's probably a bad idea, here it kind of make sense
17:37justin_smithmpenet: so why not :? if it is a placeholder?
17:37mpenetjustin_smith: keywords are encoded to strings, backward compatibility
17:38mpenetjustin_smith: and I know for a fact that some user use this, had a PR recently for namespaced kw support
17:38justin_smithinteresting
17:39mpenetjustin_smith: the lib in question FYI https://github.com/mpenet/hayt
17:44justin_smithmpenet: I assume '? and \? have the same issues?
17:44rasmusto,:\
17:44clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
17:45justin_smith,\?
17:45clojurebot\?
17:45jkj_gfredericks: (time (lookup "OH8GLV" (time/now))) ... "Elapsed time: 7.306 msecs" ... this does the operation thrise so time dropped from 42ms -> 7ms
17:45mpenetjustin_smith: these 2 both work as well actually and generate the same as ?
17:47mpenetjustin_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:48jkj_gfredericks: well.. still takes 3 days. maybe i have to rethink the problem. bruteforce filtering lists might not be best way
17:50gfredericksjkj_: if you wanna get really serious reducers might help
17:51gfredericksspecially if you have a big pile'o'cores
17:54rasmustoam I wasting my time building a command line interface with clojure.tools.cli? Should I just make a pretty repl instead?
17:54jkj_gfredericks: thanks for the hint.
17:55jkj_hmm.. cloud vendor wants to give me 16GB of mem with 8 cores
17:57TEttingerhow much/month, jkj_?
17:58TEttingerhttp://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&amp;hash=item589f814c63
17:58rasmustooh wow
17:58jkj_TEttinger: ~450 with 30 GB of mem
17:59jkj_eur
17:59TEttingeryep, ebay once again to the rescue
17:59jkj_ok 285,34 eur 8 cores and 16 GB
17:59TEttingera friend bought one with 72 GB RAM
18:00TEttingerI think it's working fine as an VM farm
18:00TEttingerhe paid more than that though, that one is an especially good deal
18:00jkj_i wonder how sun niagara processors go with clojure :P
18:00jkj_huge amounts of cores
18:00TEttingeroooh
18:01technomancyjkj_: http://www.tbray.org/ongoing/When/200x/2008/05/01/Wide-Finder-2
18:01technomancythough that task is IO-bound
18:02TEttingerholy 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&amp;hash=item5aeb3a5475
18:02TEttingerlook at that price
18:02gfrederickshardware is one of my top 1 least favorite things to own
18:02TEttingerthere is that
18:03TEttingerif something goes wrong you foot the bill
18:04gfredericksif I've got a bunch of CPU work to do, should I expect reducers to utilize the cores significantly more efficiently than pmap?
18:05technomancypmap won't get too far ahead of the slowest entry
18:05gfrederickshtop is telling me I'm only getting ~65% out of my 8 cores
18:05TEttingergfredericks, I've kinda assumed reducers were the better version of pmap
18:05technomancyterrible if you have wide variance in costs
18:05gfrederickstechnomancy: that's an interesting point, hadn't thought about variance
18:06gfredericksI'm not sure how varied my work is here. I made a `pmap-chunkily` that chunks into ~20 jobs first
18:06gfrederickswhich should lower the variance
18:06technomancyas long as there's an "extra-chunky" version I'm for it
18:06gfredericksI don't have java 7 on this machine though
18:06gfrederickstime to spelunk through apt I guess
18:09rasmustogfredericks: I have a similar pmap issue, I'm about to reorganize stuff so I can get bigger chunks
18:09gfredericksmight be hard to fit this problem to reducers well though
18:10gfredericksunless reducers are cooler than I thought
18:12gfredericksbasic structure is (->> ten-thousand-things (mapcat make-lots-more-things) (map slow-fn) (apply max-key f))
18:12gfredericksthe seq coming out the mapcat would be too big for memory
18:13jkj_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:14jkj_guess the map had some tree magic built in
18:14akurilinQuick 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:14dakroneakurilin: sounds reasonable
18:15jkj_then i just have to hammer the map by fetching OH8GLV, OH8GL, OH8G, OH8, OH, O to find the largest .startsWith
18:15akurilinSeems to work, but I've just never worked with java before so I'm wondering if I'm constructing too much stuff there :)
18:15akurilindakrone, great, thank you! Do you have a notification on the cheshire keyword? :)
18:15dakroneakurilin: I do :)
18:16akurilindakrone, not complaining, appreciate you supporting those really handy libraries.
18:16jkj_akurilin: http://pastie.org/8350035
18:16dakroneakurilin: no problem, glad they're working for you!
18:17lunkakurilin: 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:17jkj_not cheshire there, but prolly works the same
18:17akurilinjkj_, thanks, good to have for reference!
18:17jkj_(:import java.util.zip.GZIPInputStream)
18:18akurilinlunk, 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:18akurilinlunk, plus that will explain the class hierarchy I was looking at just now.
18:18lunkakurilin: 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:19lunkakurilin: ignore the class heirarchy for now, understand the concepts and you'll be golden
18:19akurilinlunk, that sounds really useful, I will!
18:20akurilinlunk, yeah it wasn't obvious what needed to wrap what in what order at a first glance, so that'll explain it hopefully.
18:21lunkakurilin: ultimately, it's just bits on a wire, you either read them or write them to the stream, the rest is gravy
18:32clj_newb_2345is there a way to do the following with clojurescript? http://emacsrocks.com/e11.html
18:32clj_newb_2345this is fucking insane
18:33clj_newb_2345so basicallyI need a way to connect to the clojurescript repl from emacs
18:37nDuffclj_newb_2345: see piggieback
18:40aaelonyhas anyone tried nrepl + emacs on Mint Linux? I'm getting an nrepl window but no repl...
18:41justin_smithaaelony: I fixed this by using the elpa nrepl, after purging all my compiled elisp
18:41justin_smithsame problem happened on latest ubuntu
18:41justin_smithI posted a so answer about how I fixed it, one moment
18:42justin_smithhttp://stackoverflow.com/questions/18208947/emacs-clojure-lein-and-nrepl-nrepl-buffer-shows-up-blank/18218870#18218870
18:42justin_smithaaelony: ^ that link describes the fix
18:42technomancyjustin_smith: using melpa before?
18:43justin_smithtechnomancy: no, I was actually using a git checkout of nrepl before
18:43technomancyhuh
18:43justin_smithsomething weird happened when I rsynched from my old debian machine to the new ubuntu one, and everything broke
18:44technomancyyeah, elisp bytecode is not backwards-compatible
18:44justin_smith*git checkout of nrepl.el
18:44technomancybetween versions of emacs
18:44justin_smithyeah, purging the elisp was probably the main thing
18:44technomancythe .elc files anyway
18:44justin_smithI am surprised it does not catch the incompatible elc versions and gripe or something
18:45technomancyyeah =\
18:45justin_smiththe 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:45justin_smithwhich leads to really weird hard to reproduce bugs
18:45technomancyfurther proof that AOT is the worst
18:45justin_smithyup
18:46rasmustotechnomancy: so you recommend ^:skip-aot then? :P
18:46aaelonyjustin_smith: thanks, that's super. Will check out your write up...
18:46justin_smithimagine 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:47technomancyrasmusto: there's an entry at the end of the FAQ explaining the way to go for uberjars
18:47technomancyprofile isolation
18:47justin_smithaaelony: I think the process I descibe there may be overkill, finding and eliminating all .elc files may be sufficient
18:47mtpjustin_smith: it did that during the 5-to-6 transition iirc :p
18:47justin_smithheh
18:47rasmustotechnomancy: okay, I'll give it a read. Thanks :)
18:47justin_smithwell never mind then
18:47technomancyrasmusto: should probably blog it or something to get the word out though
18:48rasmustotechnomancy: 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:48technomancyprotocols?
18:48clojurebothttp://whiley.org/2012/02/29/a-problem-of-decoupling/ describes a problem solvable by protocols
18:49technomancyshut up clojurebot
18:49rasmustono, nothing like that
18:49rasmustolein check gives me a few reflection warnings, but nothing looks that scary
18:51aaelonyjustin_smith: that worked!! many thanks :)
18:57justin_smithaaelony: 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:03jkj_gfredericks: http://pastie.org/8350155
19:04jkj_gfredericks: i guess i might have found the solution
19:12jkj_the calculation is just three hours now!
19:15doomlord_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:16technomancydoomlord_: static types just let you avoid runtime reflection, which is pretty rare in Clojure code
19:17justin_smithtechnomancy: doesn't it also allow for example aggressive unboxing?
19:17doomlord_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:17technomancystatic typing helps you catch errors but doesn't provide much of a speed boost except for pathological code
19:17doomlord_^^(on the one hand, having seen templates and HM type inference..)
19:17technomancyjustin_smith: yeah, but it already does a fair bit of inference there afaiu
19:18justin_smiththe jvm can unbox in jit you mean?
19:18technomancyI don't think it can do more without giving up on certain interop features, but I could be wrong
19:18technomancyno, the clojure compiler infers primitive local types in some cases I think
19:19justin_smiththat 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:19justin_smithalso immutability and unboxing are kind of mutually exclusive
19:20justin_smithI think
19:20mercwithamouthdo any of you guys work through Purely Functional Data Structures?? Is it appropriate for lisp?
19:20technomancytagged fixnums would get us a pretty significant perf boost for numerics
19:21technomancybut I don't think that's coming in any sort of reasonable timeframe
19:23allenj12Hey is there a way you can test if a optional argument is passed to a function? does check true work?
19:23technomancyallenj12: I think you'd have to provide a default value with :or to distinguish between nil and not provided.
19:24allenj12technomancy: hmm alright ty
19:31clj_newb_2345nDuff: piggieback looks awesome; thanks
19:39allenj12https://www.refheap.com/18930 can someone help me witht his? i asked the question in comments towards the bottom
19:40callenallenj12: lines 42-45 should just be a case.
19:40callenand don't have trailing tail parentheses. bad style.
19:42callenallenj12: 66-69 is another case
19:42allenj12callen: 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:50tufflaxallenj12: show the actual error message you get. Also, it looks like the paren at line 76 should not be there
19:51tufflaxAlso, def inside functions should be avoided
19:51tufflaxuse let instead
19:51allenj12tufflax: kk ill show error message and fix those after i repaste
19:52tufflaxallenj12: def creates a binding in the namespace, so using it inside functions have side effects
19:52tufflaxhas*
19:53callenallenj12: don't def in a function.
19:54allenj12callen: yea changing that now
19:55allenj12https://www.refheap.com/18930 here is the error
19:56allenj12ill fix the defs
19:57tufflaxallenj12: the error is not really hard to understand. prev-move does not exist in get-queue
19:58allenj12tufflax: wow my bad for some reason i thought it was because of something else
19:59tufflaxallenj12: also, why have you used & in the args list of a-star? You seem to want to only pass in 1 prev-move
20:00allenj12tufflax: 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:02tufflaxallenj12: 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:02tufflaxif something is the rest of the args (after &)
20:03allenj12tufflax: i thought & was optional arguments
20:03allenj12tufflax: does it do that through a sequence
20:03tufflaxallenj12: yes, the optional args are collected in a seq/list
20:03tufflaxeven if there is only 1
20:04allenj12tufflax: ahh k so to check if it was passed i can test if the sequence is empty right?
20:04tufflaxyes
20:04allenj12tuffkax: ah! kk cool
20:06tufflaxallenj12: you can also do something like this
20:06tufflax(defn special-sum ([] (+ 10 10)) ([x] (+ 10 x)) ([x y] (+ x y)))
20:07justin_smithcore.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:07justin_smithhttps://www.refheap.com/18932
20:07tufflaxAt the bottom of the following page, there is a "+ source", click the + for a good example http://clojuredocs.org/clojure_core/clojure.core/=
20:07tufflaxallenj12: ^
20:09allenj12tufflax: kk thanks gottt run machine learning grpup here ty
20:32justin_smithregarding 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:42brehauttalios: nice readme ;)
20:46taliosbrehaut: shoosh - I need to add one ok :)
20:47brehauttalios: longer version: what is frege?
20:48taliosbrehaut: http://www.frege-lang.org/ - haskell for the jvm
20:48brehautoh right. choice
20:48talioswell, 99% haskell, its not 100% identical
20:49brehautsure
20:49brehaut100% haskell is hard
20:52taliosand blammo - I hit a bug in my own plugin, gah :)
20:59amehtaclojure stable release is 1.5.1 according to clojure.org. what version of clojurescript should i be using?
21:01dnolenamehta: 1859 works pretty well, 1889 if you like living closer to the bleeding edge
21:01amehtathanks david
21:17_scapeso 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:18tufflax_scape: clojure.walk
21:18_scapemore importantly, there are other elements such as f and n, all are first in the vector
21:18_scapeok, let me check it out
21:18_scapethx
21:26dnolencore.match 0.2.0-rc7 going out, I think finally killed all remaining sources of AOT issues, likely last release candidate
21:31dnolener, I mean rc6
21:37arkhdnolen: any recommended beginner reading for someone who's never worked with (lazy) pattern matching?
21:37dnolenarkh: it's not really lazy pattern matching, that's just describing the algorithm
21:37dnolenarkh: it's pattern matching same as you find in SML, OCaml, Scala, Haskell - but more flexible like Racket
21:39arkhdnolen: 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:40dnolenarkh: it's like destructuring but you can use it for conditional logic
21:42brehautdnolen: im curious, does core.match allow the same sort of totality analysis that a static language like haskell etc can provide?
21:42brehaut(ie, it knows if you have cases for every value of the matched thing)
21:42dnolenbrehaut: not really because there's no restrictions about types
21:42dnolenbrehaut: however it throws if you miss a case
21:42brehautthats what i suspected
21:43brehautoh nice
21:43dnolenbrehaut: 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:44brehautits not like clojure is overly concerned with total functions anyway
21:44brehautdnolen: i guess that would be better supported with information from say core.typed and the analyzer ?
21:44dnolenbrehaut: however i bet you could overlay that restriction via core.typed
21:44dnolenbrehaut: heh, we had the same thought
21:45dnolenbrehaut: yes I think core.typed could do it's own type level analysis restriction what core.match is allowed to express
21:47brehautdnolen: it will be interesting to see how a the affordances of typed matcher compares to haskell etc
21:49brehautdnolen: from memory core.match doesnt depend need to upon concrete types as much as say haskell, right?
21:53taliosbrehaut: oh look - a readme! https://github.com/talios/frege-maven-plugin - and another new release, maybe I should do $work work tho :)
21:53brehauttalios: hah excellent
21:55dnolenbrehaut: for optimization?
21:55brehautdnolen: expressivity
21:56brehautdnolen: i havent used haskell in a while, but i recall it being difficult to match on non concrete types
21:56dnolenbrehaut: yes core.match is more expressive, Haskell doesn't really support matching on non-concrete types
21:56brehautdnolen: 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:57brehautdnolen: right, so with that expressivity, but as type safe via core.typed. *waves hands* that'd be great
22:19munderwoSo 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:20munderwoAm I missing something on how lein etc builds the class path? or is ring.util.response not in ring-core?
22:23munderwoI'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:38kurisumasumunderwo: (use 'ring.util.response)?
22:39munderwokurisumasu: 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:40kurisumasumunderwo: (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:41kurisumasumunderwo: 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:42kurisumasumunderwo: 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:42munderworight. 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:43kurisumasumunderwo: don't worry. Everyone starts as a beginner ;)
22:43munderwowhere as when I'm using (ns) its a list of things it needs to do...
22:44munderwoYeah 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:45kurisumasumunderwo: 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:46munderwoyeah, right that makes sense. So this is the problem I'm having https://www.refheap.com/9c4ee1bec6666980eee5cc71b
22:46kurisumasumunderwo: 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:48kurisumasumunderwo: 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:49kurisumasumunderwo: 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:50munderworight, 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:51munderwoso could I do (:require ring.util.response/response :as response)
22:52kurisumasumunderwo: 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:52akurilinWhat are people's thoughts on Liberator? Would love to hear the opinion of folks who have used it over the long term.
22:53munderwokurisumasu: 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:02allenj12Hey 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:04kurisumasumunderwo: for these ring things I'll usually just place them in the use section, so (:use ring.util.response)
23:05munderwook. cool. thanks!
23:06sinistersnareallenj12: lets denote scope using the parens
23:06sinistersnareso you need to wrap the whole scope of the let using the right paren
23:07sinistersnarewait you did that :p i think
23:07sinistersnareill shutup
23:07allenj12sinistersnare: lol i was about to say i was rly confused then
23:08allenj12sinistersnare: turns out i missed a parens but i put that back in and same problem
23:08sinistersnareoh :p sorry!
23:09allenj12sinistersnare: its ok lol any other possible problems
23:12allenj12yea the error im getting is "Dont know how to create ISeq from: clojure.lang.Symbol ? in general what does that mean?
23:12brehautallenj12: it means you probably have a symbol in your 'ns declaration where you should have a list or vector
23:13sinistersnareyeah, usually means some sort of missing thing!
23:14allenj12brehart: o shit no brackets fml lol
23:15brehautthe 'haut' is pronounced 'oh'; i blame the french
23:17talioswait, and here I was thinking you were hot.
23:17taliosI need to rethink my stalking.
23:17brehauthaha
23:18taliosI keep thinking Andrew Braveheart, hero of functional developers in the southern northern lands
23:18brehautwell this has gone to a weird place
23:19taliosand? :)
23:19brehautlol
23:21brehauttalios: he works with you ?
23:21taliosyup yup - javascript/coffeescript side of things
23:21brehauti did not realise
23:22taliossee the things you're learn if you came and worked for us?
23:23brehauttalios: coffeescript and java legacies?
23:24sinistersnarecan anyone figure out how to add local jars to my clojure project?
23:24talioscurrently - the sooner we can get some clojure in the better ( or scala, or frege ;p )
23:26sinistersnareis this what :resource-paths is for? to the sample project.clj!
23:26TEttingersinistersnare, I kinda hacked it by extracting into a directory and naming that directory with that, :resource-paths
23:26taliosthat would be resource files, you really want to put those jars into a local repository
23:26taliosi would think
23:26sinistersnareive tried a local repository, its such a pain though
23:26sinistersnarei was having the hardest time figuring out the maven commands =\
23:27allenj12my clojure writing style is horrible there parens everywhere!
23:27sinistersnarei hope lein adds a feature for this :)
23:27sinistersnarei hear there was one, but it was deprecated...
23:27kurisumasuallenj12: you can try Clochure, instead :)
23:27kurisumasuallenj12: it'll certainly reduce the amount of parenthesis, at least.
23:28allenj12kurisumasu: i just need practice :) ill look that up tho
23:28s4muel http://imgs.xkcd.com/comics/lisp_cycles.png
23:28allenj12kurisumasu: new to functional languages and clojure
23:29mgaareallenj12: (pst, it's important you realize that clochure is a joke)
23:29kurisumasuallenj12: ahaha. It was a joke :)
23:29allenj12LMAO
23:29allenj12just looked at it
23:30kurisumasuallenj12: 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:31kurisumasuThe only Lisp dialect I know of that features a different syntax is Dylan — no parenthesis there.
23:31allenj12kurisumasu: 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:31allenj12huh
23:31allenj12lol
23:32mgaarekurisumasu: I dunno, is {:this :that} and [:this :that] so vastly superior to (hash-map :this :that) and (vector :this :that)
23:32allenj12wait cant i check if an optional paramter is passed with empty?
23:33allenj12like (defn two [& too] (if empty? too) (println check))
23:34mgaareallenj12: yeah that should work (although only if you have defined check somewhere)
23:34kurisumasuallenj12: 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:34allenj12kurisumasu: can u give me an example
23:34tufflaxallenj12: you are using the wrong syntax
23:35tufflaxallenj12: just like with let before :P
23:35tufflaxmaybe you should look up some examples before trying :p
23:35kurisumasumgaare: 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:35allenj12tufflax: omg sry i did before my focus on school has been all scatterd so i prolly misremembered
23:36sinistersnarecan 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:36allenj12tufflax: wait whats wrong with my if statements?
23:37allenj12tufflax: im looking at examples
23:37s4muelmgaare: 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:37tufflaxallenj12: I think you meant (if (empty? too) (println check))
23:37mgaares4muel: yeah, destructuring is awesome
23:38tufflaxtufflax: the syntax was valid, but nonsensical :P
23:38allenj12tufflax: o yea sry i thought u ment in my code
23:38tufflaxhm no in your message :P
23:38mgaareallenj12: whoa that a-star function is making me dizzy ;)
23:39allenj12mgaare: me to i know its a mess
23:39allenj12mgaare: and ofcourse its not working properly
23:39mgaareallenj12: you know you can do more than one thing in a let at a time
23:39allenj12mgaare: what do u mean?
23:40tufflaxallenj12: start indenting your code properly. Also, nice trails of parens, looks like some sort of art
23:40kurisumasuallenj12: (let [a 1 b 2] (+ a b))
23:40kurisumasuallenj12: unlike other lisps, Clojure's `let` will resolve [a 1] first, then [b 2], so you can use `a` in the second expression.
23:41mgaarekurisumasu: other lisps don't do that?
23:41kurisumasumgaare: they have `let*` for that, but `let` doesn't guarantees ordering
23:41mgaaregood to know!
23:41allenj12kurisumasu: 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:41mgaareour beloved let is much like haskell's monadic do notation
23:42sinistersnareit says that it cannot find my main class cljdx.core
23:42sinistersnarewhich is the namespace for my file core.clj
23:43brehautmgaare: let is only do notation for the identity monad
23:43sinistersnarewell 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:43brehautmgaare: for and doseq is do notation for lazy and strict list respecitively
23:44mgaarebrehaut: they are aren't they... pretty cool
23:57yeoj___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:57yeoj___i have conflicts contstantly for things that i've already loaded
23:57tufflaxyeoj___: this might help https://github.com/clojure/tools.namespace