#clojure log - Aug 17 2013

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

0:04 TimMc: I could just clone my own dotfiles for that matter.

0:04 However, my own .emacs.d is not... reproducible.

0:04 callen: ?_?

0:05 I've got all kinds of shit in my .emacs.d and it still 'just works' when I git clone

0:05 I just install 3 python libraries for my python config and then I'm done.

0:06 `cbp: Maybe its all absolute paths :D

0:07 callen: `cbp: don't say such hateful things. Also bulwark had its first release. I'm going to test it with somebody and move on to the next thing.

0:08 `cbp: any ideas on the Pomegranate "sync with project.clj" dilly?

0:09 technomancy: TimMc: whaaaaat

0:09 is marmalade down?

0:09 wfm: http://marmalade-repo.org/packages/clojure-mode

0:09 callen: isn't it an elisp backed web server?

0:10 ...jus' sayin'...

0:10 technomancy: callen: to our great shame, it's node

0:10 callen: TimMc: what did you originally need lein-otf for?

0:10 technomancy: THE FARK?!

0:10 technomancy: callen. I KNOW

0:10 callen: there's a rewrite in progress though

0:10 callen: I am horrified.

0:10 technomancy: http://marmalade-repo.ferrier.me.uk/ <- the elisp version

0:10 callen: technomancy: one of Ferrier's...yep.

0:11 I fucking knew it.

0:11 that man is deranged.

0:11 technomancy: true

0:11 callen: the original author got everyone to use it and then absconded

0:11 callen: better him than node users though.

0:11 technomancy: lol, like clojuredocs.

0:11 `cbp: callen: I'll look at it tomorrow :-)

0:11 callen: technomancy: which I'm still grumpy.

0:11 `cbp: I have a web project on the horizon if you want something less crunchy as well. Let me know how it goes!

0:12 still grumpy about*

0:14 `cbp: sure

0:15 callen: `cbp: how much do you like...wikis?

0:16 technomancy: just like clojuredocs =(

0:17 callen: I still don't know why people are negative about wikis. The community can maintain them themselves

0:17 unlike things like clojuredocs.

0:17 `cbp: callen: i'm neutral i guess? never really used or made one

0:17 adu: i wanna make a wiki

0:17 i'm an avid wikipedian

0:18 I've deleted the word penis from wikipedia around 1000 times

0:19 technomancy: does that include synonyms

0:19 adu: technomancy: yes

0:19 callen: fair warning, I'm anti-deletionism and not really happy with the way Wikipedia is managed.

0:19 adu: it's almost always out-of-context

0:21 callen: anyway, Clojure needs a wiki.

0:21 adu: like "Hillary Clinton met with Netanyahu AND WHIPPED OUT HER PENIS to discuss diplomatic ties …"

0:21 `cbp: yeah I think so too

0:21 callen: There are too many books coming out for Clojure that are basically collections of the sort of snippets/recipes/cookbooks you'd find on a wiki and they won't be kept up to date like a wiki would either.

0:21 Something like EmacsWiki would be glorious.

0:22 adu: callen: isn't EmacsWiki already glorious?

0:22 technomancy: people will still make blog posts with glaring inaccuracies that never get updated

0:22 this is the legacy of swank-clojure

0:23 callen: adu: that's my point, I want ClojureWiki to steal the same benefits :)

0:24 adu: now we just need a set of buffer manip libs to make Emaclo

0:25 callen: nothx.

0:25 Emacs and elisp is fine. I like them and what they do.

0:25 (require 'cl) exists, just leave it alone.

0:26 adu: or I suppose one could theoretically make Eclipse extensions in clojure

0:26 callen: but most of my work is services/server-side/web and Clojure fits the bill and I'd like the collective knowledge of the community not be scattered to the four winds of deleted tumblr blogs and abandoned portfolio sites.

0:27 adu: I really liked noir and joodo in how easy they made it

0:27 but now I hear that people just cherry-pick their web libs

0:30 both (noir and joodo) depend on ring/compojure/hiccup, and most people I've talked to recommend learning just compojure, and not the rest

0:31 callen: adu: Luminus rolls up some nice defaults if you want that.

0:32 adu: in addition to Luminus, my personal CMS is a test bed for libraries: https://github.com/bitemyapp/neubite/

0:32 http://www.luminusweb.net/

4:02 just had a wonderful time making my library simultaneously muggle and neckbeard compatible.

4:12 muhoo: heh neckbeard https://www.facebook.com/pages/The-Neckbeard-Boys/179687975453042

4:12 callen: muhoo: what I'm referring to, is the fn returned by my middleware tries to use private closed over data, but falls back to a global atom.

4:13 and the latter use-case isn't just for convenience/muggles, there's a fairly serious production-mode use-case for that.

4:13 annnnnnnd I really need a debug-repl that actually works.

4:14 only locals work in the current version of Jahad's debug-repl

4:18 supersym: whats a good, elegant/lean way of doing fulltext/keyword search in clojure? It doesn't have to be big data, at most about a few hundred records or so as part of a dictionary lookup

4:18 I was thinking just using maps at first, but its the full text-search I'm not too sure about, if there are easier/more viable solutions laying around :P

4:27 callen: supersym: so, the problem here is that usually when you need robust full text search, the presumption is that you wouldn't be using an embedded library.

4:28 supersym: you *might* be able to extract just the analysis stuff from Lucene via Clucy

4:28 supersym: desperately avoid implementing a full text search algo yourself if possible, but if you do write one, make it a micro-library and push it to github please.

4:30 ucb: supersym: what sort of capabilities are you after? you want wildcards or full word matches?

4:31 * ucb waves at callen

4:31 callen: ucb: hai o/

4:31 ucb: hai2u \o

4:32 supersym: callen: yeah feared that I'd have to go full blown...

4:33 callen: supersym: clucy has a nice API, the only problem is that to avoid creating a Lucene index you're going to reach into the guts and wrap the analysis stuff.

4:33 supersym: well,... tbh it can be just keyword wildcard matches

4:33 callen: I don't think it's a big deal to do so, myself.

4:33 supersym: yeah

4:33 callen: supersym: well that's not "true" full-text search

4:33 supersym: it doesnt have to be full-text per se

4:33 callen: full-text search handles stemming, fuzzy search, etc

4:34 ucb: I'd say that's debatable

4:34 the query language (fuzzy search, wildcards, etc.) is but one part of a search engine

4:35 supersym: its tempting...I had a go at Lucene earlier etc, but I might just wanna stick with familiar ground a bit (maps) and not get the extra lib in place

4:35 ucb: the most basic search is ala grep with full word matching

4:35 supersym: it would be for a lein-plugin like dictionary lookup of terms...

4:35 ucb: it also depends on whether you want any relevance ranking

4:35 or whether you're happy with just binary yes|no type of answers

4:35 callen: supersym: if you can do it more simply than full-text search, go for it.

4:36 supersym: if you need to perform some evil: https://github.com/noprompt/frak

4:36 supersym: lol .. thanks callen

4:36 ucb ;)

4:36 ucb: frak is neat

4:36 callen: evil is neat.

4:36 ucb: I was wondering if one could build the same type of lib that generated xpath selectors

4:36 or even css selectors

4:36 supersym: oh, frak is cute :)

4:37 ucb: I know one *could*, I was just pondering on the how

4:37 supersym: don't we have css with garden?

4:38 I even found a css, half-decent, parser in clojure once

4:38 oh,...nvm

4:38 generate >< goodmorning

4:38 yeah I was having the same idea earlier

4:39 callen: ucb: you mean like """<div id="blah"> <div class="woohoo"> <!-- PICK THIS --> </div></div>""" => ["div#blah div.woohoo" "#blah .woohoo"] ?

4:39 ucb: callen: yeah

4:39 callen: ...I wouldn't.

4:39 supersym: with backtick definitly, I was playing with (Racket) 'formlet' like structures earlier after yogthos pointed me to those

4:39 ucb: callen: have you seen open.dapper.net?

4:40 supersym: gensym can be used with backtick templates

4:40 ucb: that's the use case I had in mind

4:40 callen: ucb: I'm aware of it, but I don't really use tools like that.

4:40 I prefer to write my own plumbing generally.

4:40 I can see the appeal.

4:40 especially if it works consistently and lets you scrape/generate an assortment of data.

4:40 ucb: right, I was musing myself with building a dapper clone

4:41 supersym: callen: sure but there are jobs I have/will have to take that may be lower paying... I don't feel like doing my magic every time

4:41 a lot of stuff can, and should for that pay, be templated/boilerplated output I fear

4:41 callen: if you say so

4:41 supersym: web site building world changed quite a bit with companies offering off-shore india/china stuff :P

4:41 callen: I don't find myself doing repetitious work that often.

4:42 OTOH, I don't churn out websites for a living anymore.

4:42 supersym: :)

4:43 callen: I do do a fair chunk of web stuff at home and work though.

4:46 ucb: this is rather neat http://htwins.net/scale2/

4:48 supersym: ucb: sweet, thanks... I've read many many books about that stuff from my 22-28 years :)

4:48 ucb: :)

4:51 callen: okay, I am tired. Enough hacking today.

4:52 supersym: cya callen

4:53 ucb: enjoy

4:58 supersym: minimal search engine https://gist.github.com/ulises/6255940

4:58 supersym: it produces yes

4:58 erk

4:58 yes|no type matches for full tokens

4:58 (I'm sure it can be improved, etc.)

5:00 updated with an example of how to use it

5:47 supersym: ucb: thanks!

7:26 mark__: I there. I have a project I want to get back to. Unfortunately I can't access the uberjar my project creates. I now tried to make a new uberjar from a new project, but this fails too. What am I doing wrong? (Clojure 1.5.1, lein 2.3.1 on Java 1.6.0_51 mac ox x 10.8.4) The programm I run was: lein new app foobar; cd foobar; lein uberjar; java -jar target/foobar-0.1.0-SNAPSHOT-standalone.jar and the result I got was: Exception in thr

7:26 ead "main" java.lang.NoClassDefFoundError: foobar/core

7:49 with leiningen 2.2.0 everything works. I found an issue on gh (https://github.com/technomancy/leiningen/issues/1283) but this issue should be fixed in 2.3.1. can somebody reproduce what i encountered?

7:49 TEttinger: mark__, still here?

7:50 oh hi

7:50 mark__: yes

7:50 TEttinger: do you have any code in foobar?

7:50 to create an uberjar there are some requirements that may be different

7:50 mark__: i created a new leiningen project

7:51 TEttinger: yes

7:51 that creates a very small core.clj in foobar

7:51 it won't have a (:gen-class) in the ns

7:51 that might not be needed

7:51 mark__: it actually has (https://gist.github.com/mren/e1aaa05f4aabd113e6f1)

7:52 TEttinger: project.clj has the :main foobar.core

7:52 right?

7:53 mark__: right: here is the full output of project.clj and core.clj: https://gist.github.com/mren/e1aaa05f4aabd113e6f1

7:54 TEttinger: try lein compile

7:55 see what that outputs

7:55 ^ mark__

7:56 mark__: lein compile runs without problems, if i try to create a new uberjar after this, it wont find the class, though

7:56 what happens when you run lein new app foobar; cd foobar; lein uberjar; java -jar target/foobar-0.1.0-SNAPSHOT-standalone.jar on lein 2.3.1 ?

7:57 TEttinger: I'm reluctant to touch 2.3.1 after all the hassle people have been reporting

7:58 mark__: hehe

7:59 TEttinger: is there an easy way to install and uninstall 2.3.x?

7:59 mark__: i can switch versions with homebrew on a mac pretty easy

7:59 TEttinger: oh!

7:59 lein classpath

7:59 find if the classpath contains the wrong folder

8:00 if it's searching a wrong but close by directory for foobar/core, that could be a clue

8:01 mark__: looks good to me (src, target included) https://gist.github.com/mren/e1aaa05f4aabd113e6f1#file-gistfile2-txt

8:02 TEttinger: yeah...

8:02 geez could this be a :main true thing?

8:03 in :gen-class

8:03 I thought that wasn't needed

8:03 mark__: there is no core.class in the created jar

8:03 just the core.clj

8:03 TEttinger: so it isn't aot ing it

8:04 try adding :aot :all

8:04 to project.clj

8:04 callen: Who controls the content on clojure.org?

8:04 TEttinger: also, I'll bring this up in #leiningen

8:04 callen, aliens

8:04 made with alien technology

8:05 mark__: works! thanks

8:05 TEttinger: woah

8:06 :aot is now separate from :main then

8:06 cool, I remember hearing a discussion to do that in new lein

9:22 papyrus: hello ! . i am sorry my poor english. but i have a question. i want to make game using clojure on iphone. is it possible ? i know common lisp can do it but common lisp is not functional. i hate it.

9:30 kmicu: papyrus: http://keminglabs.com/blog/angular-cljs-weather-app/

9:36 papyrus: thanks kmicu. but clojure script will be converted to java script . i think it will be very slow. i want to make game.

9:37 chwals: anyone ever get a 'cannot open load file: dash-functional' when trying to nrepl-jack-in?

9:39 TimMc: technomancy: Sorry for alarming you re: clojure-mode; my emacs is just not seeing it.

9:48 pizzasauce: is anybody here?

9:49 kmicu: no

9:51 pizzasauce: kmicu: thanks. could i ask for some help regarding setting up slime and nrepl

9:52 kmicu: ~ask

9:52 clojurebot: The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.

9:53 pizzasauce: I was able to get repl working with slime, but there is no slime-instructor. Is this normal?

9:58 kmicu: a great alternative to the now deprecated combination of SLIME + swank-clojure.

9:59 nREPL is...

9:59 pizzasauce: and for nrepl, i could not 1) install the package using package.el even though it shows up on package-list. I get the same error all the time: error during dowload: not found. 2) install manually. I get this error: could not open load file, dash.

10:02 kmicu: pizzasauce: Are you fresh emacs user?

10:02 pizzasauce: kmicu: yes i am. emacs newbie.

10:03 kmicu: You should try https://github.com/overtone/emacs-live then.

10:03 Everything works OOTB.

10:03 chwals: pizzasauce: I just got the error 'could not open load file: dash functional'. fixed it by installing dash

10:03 even though nrepl was working for me yesterday :/

10:04 pizzasauce: chwals: oh, i need to install dash. thanks!

10:06 kmicu: I only have access to emacs23. but thanks anyway.

10:07 kmicu: pizzasauce: https://gist.github.com//robert-stuttaford/6255383 BTW

10:08 pizzasauce: strangely, i can't install dash via package either. i go the same error: not found.

10:12 kmicu: pizzasauce: http://melpa.milkbox.net/#installing

10:14 pizzasauce: kmicu: thanks. for some unknown reasons i am unable to use package to install both nrepl and dash. But cl-lib installed fine. fortunately, i was able to install nrepl and dash manually.

10:17 kmicu: pizzasauce: nrepl and dash are not availabe in ELPA http://elpa.gnu.org/packages/

10:22 pizzasauce: kmicu: I have melpa and marmalade included in my .emacs file. and nrepl shows up when I list packages. just won't install. but that's ok. manualy install was successful, thanks to the tip from chwals

10:25 kmicu: thanks for the link to robert stuttaford's page. very useful!

10:27 kmicu: Maybe this is related to the latest events https://twitter.com/melpa_emacs

10:29 Anyway happy clojure hacking.

10:34 pizzasauce: kmicu: that's probably it. thanks!

12:14 * stephenwyy

12:16 wolfes: Has anyone used html transformation/templating raynes/Lazer ? I'm on a spree of exploring how different clojure templating libraries work and was wondering if anyone wanted to comment on diff between Lazer and Enlive in their use cases

12:57 paulswilliamsesq: Hi - does anyone here use vim fireplace?

12:59 ambrosebs: ya

13:10 paulswilliamsesq: ambrosebs: are you familiar with this tutorial - http://clojure-doc.org/articles/tutorials/vim_fireplace.html ? Reason I ask is that I've followed it, and all works fine except for the cpR and ] Ctrl-D commands to reload-all and navigate to other functions.

13:12 ambrosebs: paulswilliamsesq: do you want to know something about fireplace?

13:13 paulswilliamsesq: ambrosebs: Just submitted a question - about the tutorial http://clojure-doc.org/articles/tutorials/vim_fireplace.html

13:14 ambrosebs: paulswilliamsesq: ok cool

13:15 paulswilliamsesq: ambrosebs: I understand that cpR is now deprecate, but I've tried alternatives to reloaded the file, and neit

13:16 ambrosebs: er seem to work correctly

13:25 lynaghk: bbloom: have you had any more thoughts on which parts of your asyncx library have turned out to be good/bad ideas?

13:26 I'm using core.async channels with an application and I really want to attach transforming functions at the read/write points. E.g., to be able to put a Clojure object into a channel and have it automatically be serialized as JSON.

13:27 bbloom: lynaghk: i never made any sense out of "hot" sources that push things & drop messages if nobody is ready to receive them

13:27 lynaghk: As far as I'm aware, the only way to do that right now is to spin up another goblock, but I can't imagine that's optimal w.r.t. perf (and it's definitely not optimal w.r.t. code clarity)

13:28 bbloom: lynaghk: push sequences, it seems to me, need some inherent buffering/memoization, which i didn't do

13:28 lynaghk: i'm still uncomfortable w/ the "close propegation" idea & there isn't any sensible error handling strategy

13:29 lynaghk: overall, it's pretty half baked & i'm not at all convinced that the Rx model from .NET makes sense for actual use cases

13:29 lynaghk: bbloom: yeah, error handling is the biggest issue with doing a mapping transformation via a separate goblock---I'd rather just have it throw where I call it.

13:30 bbloom: do you have any suggestions for my simple use case of making a channel that people can put Clojure objects onto that will be read from the channel as a JSON string?

13:30 bbloom: lynaghk: just make a loop that reads from one channel, translates to json, then writes to another channel

13:31 sventon: do you need to know java if you want to learn clojure?

13:31 paulswilliamsesq: Let's try another one ;) Does anyone use cucumber style tests for Clojure?

13:32 sventon: I have a ruby background

13:32 lynaghk: bbloom: ugh, that's what I've been doing but it feels gross.

13:32 bbloom: lynaghk: why?

13:32 how is that any different than `cat foo | translate | bar` ?

13:32 :-)

13:32 lynaghk: bbloom: because now I have an extra channel and goblock to deal with

13:33 bbloom: let the GC deal with the go block :-P

13:34 shdwprince: sventon: You can learn java when you learn clojure

13:34 lynaghk: bbloom: I'm not really that worried about the pref---mainly it's a semantic issue. I mean, just because we have go blocks now doesn't mean I want to use them everywhere I'd previously used functional composition

13:34 bbloom: my advice for people trying to develop sensibilities around CSP has been: use channels less frequently than you'd expect to need the, but use a few more actual channels than you'd expect to need per use

13:34 shdwprince: sventon: its not important where you'll understand java's threads, in java or in clojure, threads is one for both

13:35 sventon: sometime you'll have to learn some java to learn some parts of clojure

13:36 sventon: shdwprince: so what you are saying is that I only need to learn some parts of Java ?

13:37 Foxboron: sventon: You won't really need to learn any java to get into Clojure.

13:37 sventon: i have no java experience and i get along pretty well writing clojure

13:37 lynaghk: bbloom: the only alternative I can think of is a macro that expands (>json! c {:my object}) into (>! c (serialize... {:my object}))

13:37 bbloom: lynaghk: that would couple your serialization strategy to your call site :-P

13:37 lynaghk: bbloom: but that seems like a terrible idea, and doesn't actually hide it

13:37 yeah

13:38 bbloom: lynaghk: instead, let's get to the bottom of your fear of the extra go-loop & we can maybe recalibrate you & determine how to help calibrate others :-)

13:38 lynaghk: bbloom: alright, fine. I'll go crazy with the channels =P

13:39 sventon: Foxboron: I see

13:39 Foxboron: what languages did you work with before ?

13:39 ruby ?

13:39 shdwprince: sventon: its not important, all the same

13:39 lynaghk: bbloom: I don't know if fear is the right word---mostly I need to know where to put the line between function composition vs. explicit channels/flow

13:39 shdwprince: sventon: functional experience might be useful here

13:40 lynaghk: bbloom: so you'd recommend I just use your asyncx's map fn?

13:40 bbloom: lynaghk: so that's the other thing that tbaldridge & dnolen taught me when i was doing asyncx: the go-as macro is a bad idea b/c composition is accomplished not by function composition, but by channel injection

13:40 lynaghk: bbloom: I'd rather standardize on one library than reinvent some wheels.

13:41 sventon: I have some problems getting started and a tutorial for ruby developers should be helpful

13:41 like is a clojure symbol equal to symbols in ruby ?

13:41 bbloom: lynaghk: you compose two goroutines by giving them a shared channel

13:41 Foxboron: sventon: Python

13:41 bbloom: lynaghk: that's different than by function composition

13:42 shdwprince: sventon: shure its not

13:42 bbloom: lynaghk: i haven't quite figured out how to get the convenience of go-as without the overhead of manually creating extra arities with an extra channel slot

13:42 Foxboron: sventon: i'd recommend doing clojure-kaons, some stuff at 4clojure and buy a book

13:42 shdwprince: sventon: in general cases integer is integer and character is character, but data structures should be different

13:42 lynaghk: bbloom: what's the problem with go-as for my use case? Isn't that the only thing you can do?

13:42 bbloom: lynaghk: i think the answer might be to curry channel-processing functions & then have some kind of thread-a-new-channel-as-the-last-arg-to-each macro that does the typical thing

13:43 lynaghk: i'm referring to this macro: https://github.com/brandonbloom/asyncx/blob/master/src/asyncx/core.clj#L59-L65

13:44 lynaghk: bbloom: yeah, I'm looking at it. Isn't your implementation of map what you're suggesting I do? Create a new channel that contains the json-serialized objects from my original channel?

13:44 bbloom: (defn map [f in] (go-as out …)) vs (defn map ([f in] (map f in (chan))) ([f in out] ...))))

13:44 lynaghk: notice how the later has an arity w/o the out channel, so the user can supply their own, but there is a default arity for creating an unbuffered standard channel there

13:45 lynaghk: bbloom: ah, I see what you mean

13:45 bbloom: i think there needs to a sort of channel->> macro or something

13:45 sventon: I found an excellent video tutorial at codeschool but after that I don't know where to go

13:45 will give 4clojure a try

13:45 bbloom: the real issue is that all the asyncx functions return the output channel, but that doesn't really make sense

13:46 for one thing, it swallows the "process channel" which can be useful for monitoring to see when a process ends without fucking with other readers on the output channel

13:46 lynaghk: bbloom: I've been writing things like the second arity with a bang, because they're side effecting.

13:46 sventon: should be excellent if I found some ruby / python examples "translated" to clojure

13:46 bbloom: for another thing, it means that occasionally you have to do some extra copying b/c you want to get stuff on to a fan-in channel or something like that

13:46 lynaghk: the bang isn't for effects, it's for "unsafe in a transaction" :-)

13:47 sventon: do you consider clojure to be difficult to learn?

13:47 lynaghk: anything side effecting is unsafe in a transaction

13:47 bbloom: lynaghk: not if the effects are idempotent, communicative, undoable, etc

13:48 Foxboron: sventon: clojure itself isnt hard. The functional way of thinking is harder when you come from a imperative/OO thinking

13:48 lynaghk: bbloom: good point.

13:48 bbloom: lynaghk: this is way off topic, but a good example is counting. you can increment an atom, or you can conj an ID into a set & then later take the cardinality of the set

13:48 lynaghk: bbloom: and in this case, the second arity wouldn't be unsafe because you'd just have multiple go blocks doing the same thing?

13:49 sventon: Foxboron: I see, have it taken you long time as a python dev to get into the functional thinking / clojure ?

13:49 bbloom: lynaghk: without thinking about it too deeply, yeah. if you spun off a bunch of processes & nobody every listened to them, then let go of your handle to the channels, then they would all get GCed and that would just be benign wasted work

13:51 Foxboron: sventon: well, hard to compare as python was my first lang, so it did take a lot of work in the start, and that did help me learn clojure faster in one way. But i takes me no effort to code something up in Python. where in clojure it takes more thinking and planning as it is not that easy to just hack together something that just works instead of a solution that works and is also good.

13:52 lynaghk: bbloom: https://gist.github.com/lynaghk/6257920

13:52 bbloom: see any problems with these guys? I tried putting a try/catch in the first one but couldn't get it working with the go block.

13:52 shdwprince: sventon: in the begining its hard to start thinking functional, but with time you'll get used to it. recursion, for example, almost everywhere will replace iterating, and recursion is more tricky

13:53 bbloom: lynaghk: seems reasonable.

13:53 shdwprince: sventon: even after months of active programming in clojure sometimes I finding out intresting solutions in functional style

13:54 bbloom: lynaghk: appears that the convention is to have the "out" channel be last though, which i see why you didn't do w/ the "into" name and all

13:54 shdwprince: sventon: its like another world instead of imperative

13:54 sventon: more logical and well structed

13:54 bbloom: lynaghk: also, i think in/out are better names, since send/recv are verbs :-)

13:55 lynaghk: bbloom: I always get tripped up with in/out, since I'm never sure whos perspective it's supposed to be written in

13:55 bbloom: lynaghk: always the local perspective

13:55 lynaghk: bbloom: then your signatures are confusing as hell

13:56 bbloom: lynaghk: how so? if you have signature (map f in out), you use the local perspective of map

13:57 lynaghk: bbloom: hmm. I'll give the in/out and local perspective a shot

13:57 maybe update zmq-async and jetty7-websockets libraries too.

13:58 bbloom: read it as "map the function f over map's input channel and send the results to map's output channel"

13:58 lynaghk: bbloom: you have a blog, right? it'd be pretty rad if you wrote all of these conventions up so I could link to 'em

13:58 bbloom: think in terms of the process operating on the channels

13:58 lynaghk: there or in a gist. just sayin' =P

13:58 bbloom: i updated asyncx with a link to this irc chat lol

13:58 just now

13:58 :-)

13:58 mainly as a reminder to myself to maybe update asyncx or otherwise document this stuff

14:00 seangrove: I feel lucky to have watched the conversation

14:00 lynaghk: bbloom: well, I might take a stab at it myself later today

14:00 seangrove: Good stuff

14:00 lynaghk: seangrove: I spend most of my time on the Internet chasing smart people and being confused as hell near them until they dispense wisdoms.

14:00 well, in real life too.

14:01 shoky: bbloom: the link points to the wrong place i believe ;p

14:01 bbloom: d'oh. thanks shoky

14:01 used the wrong footnote number

14:03 sventon: thanks for your help!

14:03 will take a look at http://clojurekoans.com/

14:21 lynaghk: bbloom: Updated https://github.com/lynaghk/zmq-async with your in/out naming recommendations.

14:22 bbloom: ::thumbsup::

14:35 egghead: did you just core.async the network lynaghk

14:35 looks very neat

14:36 lynaghk: egghead: yeah, I've been kicking around some zeromq stuff and websocket stuff on core.async lately

14:36 egghead: we'll see how it turns out in practice---it's not a domain I have a ton of experience with (outside of clientside apps, anyway).

14:37 egghead: ya I built a little hacky websocket channel a while back over goog.websocket

14:38 it wass really interesting to use but I'm not sure how much of an impedence mismatch there was between it and core.asyncs message passing model

14:40 separating the network layer and async layer looks way cleaner than what I was doing: https://gist.github.com/eggsby/6102537

14:40 :p

14:51 lynaghk: bbloom: why have output channel in the last position? It contradict's clojure's sequence fns

14:51 *contradicts

14:52 bbloom: lynaghk: i'm not the authority on this by any means, but it seems like that's the pattern b/c of the other arity leaving the last arg off as optional

14:53 lynaghk: bbloom: ah, right.

14:54 bbloom: having a lot of functions that create unbounded channels on your behalf sounds like a recipe for trouble.

14:54 bbloom: they are unbuffered, not unbounded

14:54 which is like the opposite of unbounded :-)

14:54 but yeah, i'm not completely satisfied w/ that pattern either

14:54 hence the proposal for something like a channel->>

14:56 could have a higher order fn to do the same as the macro too, something like (call-out map f in) => returns out

14:56 then the functions could either only have the full arity, or be curried like ((map f in) out)

14:56 lynaghk: hmm

14:57 bbloom: I'm wondering if there's a connection with reducers here

14:58 bbloom: reducers do this w/ the curried args

14:59 it's sorta unfortuante that variable arity & currying don't really go well together, but more than that, function argument order is kinda inherently arbitrary

14:59 lynaghk: bbloom: yeah, the biggest change I made in zmq-async yesterday was dropping the 4-or-5ish arity for an opts map.

15:00 bbloom: lazy sequences are kinda like channels that always supply a single out themselves. reducers defer that out supply to the very end, when the expression is forced. channels can have multiple outs and multiple ins, so it makes less sense to force such an automatic supplied conduit through a pipeline

15:00 that's one of the few things i really miss from Python: * and **

15:01 clojure's handling of kwargs is kinda awkward for non-syntax-level use

15:01 what's that clojurebot prompt again?

15:02 ~mapply

15:02 clojurebot: You have to do something like (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))), which just goes to show why unrolled keyword args are a bad idea

15:02 bbloom: :-)

15:02 lynaghk: bbloom: yeah. I stopped using kwargs for a one-arg map

15:04 well, I'm going to try building some stuff with the pieces I have now and see where it hurts

15:04 and get back to you on nicer syntax idesa.

15:17 _zach: bbloom: I've been pairing with Kevin and doing some core.async stuff. I translated a few ideas from a recent post into core.async and came up with this: https://github.com/zachallaun/async-pipeline. Looking for someone to tear it apart (the idea, not the code).

15:18 The basic idea is to create a relatively robust process pipeline with automatic restart

15:26 bbloom: _zach: so the idea is that if you encounter an error, you return that from your loop & that is observed from some parent-level manager of sorts?

15:26 _zach: bbloom: Yeah, I was hoping to be able to handle errors that the processes identify and actual exceptions in the same way

15:27 (the go-try helper returns [:thrown EXCEPTION] in the event of an exception)

15:27 bbloom: i don't have time at this moment to deeply think about this, but in general, the erlang people are the ones to talk to about error recovery and robustness :-) but i think the overall idea is reasonable, considering hierarchies of supervisors and mutually-dependent observers are basically the only two valid strategies for concurrent/distributed error handling

15:28 _zach: cool, thanks for your thoughts :)

15:28 bbloom: and even the mutually recursive thing requires some sort of lowest common anscestor to coordinate that arrangement in the first place

15:29 tufflax: I did (eval (symbol "KeyInput/KEY_W")) in the repl and it worked, but then I tried the same thing in a function and I got: "No such namespace: KeyInput" even though I have imported the class. Why?

15:34 _zach: It sounds like an issue with the import

15:34 though you may want to question the need to eval

15:41 amalloy: tufflax: eval always happens in a null lexical context, and usually in the clojure.core namespace rather than in the namespace you call it from

15:42 you really want to use reflection to look up the field, not eval (assuming nothing better is available)

15:42 tufflax: _zach: yeah now all of a sudden it works hm. The reason I'm doing eval is that a user might specify a key as only "W", but I need KeyInput/KEY_W in that case. Do you have any suggestions?

15:42 amalloy: ok, well it just started working now, all i did was add (println KeyInput) on the line above

15:43 amalloy: I tried `resolve` but it didn't work. I guess it doesn't work with Java classes, or at least not the way I tried

15:47 amalloy: I'm doing this: (eval (symbol (str "KeyInput/KEY_" (.toUpperCase s)))) What should I be doing in this case? I don't really understand how I can use reflection to accomplish the same thing.

15:50 amalloy: tufflax: (-> (.getField KeyInput (str "KEY_" s)) (.get nil)), iirc

15:52 i don't know where KeyInput is defined, so i can't demonstrate that convincingly

15:54 tufflax: amalloy: ok thanks I'll try

15:58 supersym: nice, got a free book tip via prismatic: “Probably Approximately Correct: Nature’s Algorithms for Learning and Prospering in a Complex World ”http://goo.gl/5r9kT3 for any other AI enthousiasts

16:09 cjfrisz: ping dnolen

17:04 nifff: hello room :)

17:05 i want to make a parallel map,in a sequence containing 100-200 items,evaluate time differs greatly between them,and the whole time for the map is about 5 sec

17:06 how parallize that kind of sequences?

17:07 i tried reduces,pmap doesnt work if i am doing them right....

17:11 hyPiRion: Might want to use ExecutorServices there

17:53 reginton: hi

17:53 I'm wondering if anyone has any idea what clojure.lang.RT is all about? I've been looking at clojure.core and it keeps showing up...

17:54 pandeiro: anybody know how to view docstrings in lighttable? is there anything built in?

17:55 reginton: pandeiro: is lighttable useable yet?

17:57 well, I'll ask again later

17:57 pandeiro: reginton: that's the question

17:58 i am doing some complicated (for me) text parsing and decided to try to visualize things with lighttable

17:59 it has been useful but (with-out-str (clojure.repl/doc some-fn)) is killing me

17:59 reginton: oh

17:59 that was my only suggestion

17:59 :\

17:59 pandeiro: i thought i remembered docstrings being built in somehow... must have been an old version

18:00 reginton: actually, I was asking out of curiosity; last time I tried it, a few months ago, it was pretty impossible to use

18:00 pandeiro: reginton: this is my fourth or fifth serious try

18:00 i think it's getting close

18:00 and i am also realizing what it might be good for

18:00 it doesn't replace emacs or anything

18:01 i wish it were implemented as a webapp: then it could possibly replace codepen

18:04 nifff: i want to make a parallel map,in a sequence containing 100-200 items,evaluate time differs greatly between them,and the whole time for the map is about 5 sec

18:05 reginton: nifff: can you be more clear about what you mean by "parallel" and "in a sequence" and "them" and "time for the map"?

18:05 or not

18:07 nifff: s

18:08 pandeiro: ah ok so lighttable sends *out* to its console, 3 cheers for the faq

18:15 seangrove: The clojure syntax thread was already tiresome, but it's completely gone off the deep end now

18:15 I'm not even sure it's coherent anymore

18:15 cespare: seangrove: link?

18:18 seangrove: cespare: meh, I just muted the thread, but read through if you'd like https://groups.google.com/forum/#!msg/clojure/N0MKFKd1OXI/Pj_CsZyeQqUJ

18:27 bbloom: i did like the comment about a diabetic brain

19:06 Raynes: seangrove: Oh dear, more of that shit?

19:07 seangrove: Raynes: Way beyond previous levels

19:08 Raynes: alexbaranosky: You should look at Elixir's macros.

19:08 bbloom: or Julia's

19:09 i prefer sexprs too, but it's never been true that you needed them for homoiconicity

19:10 Raynes: Right, he didn't say that.

19:10 "IMO, macros without homoiconicity are unnecessarily complex"

19:10 I'm not sure I agree with that, having worked with Elixir for a while.

19:11 bbloom: similarly, i always found it pretty easy to work w/ expressions in mathematica despite the large amounts of syntactical sugar

19:15 lgs32a: where can I find Elixirs or Julias macros

19:15 Raynes: $google elixir macros

19:15 lazybot: [5 Macros - Elixir] http://elixir-lang.org/getting_started/5.html

19:15 bbloom: i'm sure that will work for julia too...

19:15 $google julia macros

19:16 lazybot: [Metaprogramming — Julia Language 0.2-dev documentation] http://docs.julialang.org/en/latest/manual/metaprogramming/

19:16 bbloom: (inc lazybot)

19:16 lazybot: ⇒ 19

19:16 bbloom: (inc google)

19:16 lazybot: ⇒ 1

19:16 Raynes: (inc bbloom)

19:16 lazybot: ⇒ 13

19:16 antares_: (inc Raynes)

19:16 lazybot: ⇒ 35

19:16 Raynes: :D

19:16 antares_: I thought it would be positive infinity

19:17 faust45: hi guys

19:17 need your help

19:17 lgs32a: shoot

19:17 faust45: i want doing something like this:

19:18 i have 2 lists of functions A and B

19:18 i want make:

19:20 [(B1 A1) (B1 A2) ] [(B2 A1) (B2 A2)] [(B3 A1) (B3 A2)]

19:21 amalloy: (for [b bs] (for [a as] (b a)))?

19:21 lgs32a: (for [ax A bx B] ['(ax bx)]) ?

19:23 the last vector really spoils the logic

19:23 why not [(B3 A2) (B3 A3)]

19:23 TEttinger: ,(for [b [dec dec dec dec]a [inc dec inc dec]] [(b 5) (a 5)])

19:23 clojurebot: ([4 6] [4 4] [4 6] [4 4] [4 6] ...)

19:24 TEttinger: not sure what I was hoping

19:24 ##(for [b [dec dec dec dec]a [inc dec inc dec]] [(b 5) (a 5)])

19:24 lazybot: ⇒ ([4 6] [4 4] [4 6] [4 4] [4 6] [4 4] [4 6] [4 4] [4 6] [4 4] [4 6] [4 4] [4 6] [4 4] [4 6] [4 4])

19:25 faust45: let me try

19:25 Chousuke: are you sure you know what you want? :P

19:25 TEttinger: err

19:25 lgs32a: ha i got it

19:25 TEttinger: problem with the for and 2 loops is it's flat

19:26 `cbp: what amalloy said was right

19:26 faust45: i try write dsl

19:26 `cbp: just add a vec in that second for I guess

19:26 faust45: describe chess figure

19:26 like this

19:26 (deff p (d1 d2) (front back) (attack 1))

19:26 `cbp: ,(for [b '(b1 b2 b3)] (vec (for [a '(a1 a2)] (list b a))))

19:26 clojurebot: ([(b1 a1) (b1 a2)] [(b2 a1) (b2 a2)] [(b3 a1) (b3 a2)])

19:26 faust45: describe pown

19:26 (deff p (d1 d2) (front back) (attack 1))

19:27 lgs32a: describe knight?

19:28 faust45: lgs32a: i, don't think about knight

19:28 lgs32a: any ideas ?

19:29 lgs32a: honestly i don't understand how you desribe pawn in the first place

19:29 faust45: (deff p (d1 d2) (front) (attack 1))

19:29 (d1 d2) diagonals

19:30 only front

19:30 and attack only first cell

19:30 on each diagonal

19:31 lgs32a: what data type is used for d1 d2

19:31 faust45: d1 is lazy seq

19:31 lgs32a: of what

19:31 faust45: of cells

19:32 (d1 [3 3]) ->

19:32 ([2 4] [1 5])

19:32 lgs32a: ah i see

19:32 and what is front and attack doing?

19:34 faust45: ((attack 1) (d1 [3 3])) -> ('attack [2 4])

19:35 (d1 (front [3 3])) and you can (d1 (back [3 3]))

19:35 by default (d1 [3 3]) same as (d1 (front [3 3]))

19:36 lgs32a: how can you apply a vector on a lazy-seq in (d1 [3 3])

19:36 ah no its a function i understand

19:36 faust45: d1 is partial

19:37 its waiting to xy

19:37 lgs32a: yes it returns a lazy-seq of diagonal chess fields

19:37 in one direction to the bottom left

19:37 faust45: yes

19:37 lgs32a: you play chess?

19:38 lgs32a: yes, can you explain deff?

19:38 john2x: is there a library for diffing 2 files (same result as git diff)? or should I use something else?

19:38 faust45: lgs32a: deff its a macros

19:38 which i try to write

19:38 lgs32a: tried clojure.data/diff on a line-seq?

19:39 TEttinger: faust45, you need to be able to describe jumps (like the knight), fixed movement (like the pawn), and ranging movement (like the rook and bishop) for chess. define functions in your DSL for each of those, maybe just have a map to vectors, like {:ranging [:nw :ne :sw :se]} for the bishop, {:jumping [:knight]} for the knight, because its movement is hard to try to describe...

19:40 you can totally do this with lazy seqs of cells, but that won't work for jumping as well, will it?

19:41 I'm thinking, with only 6 units in chess, it would be easier to code the movements in data rather than as a DSL

19:41 faust45: TEttinger: what you mean in data?

19:41 TEttinger: like just a vector of vector of booleans even

19:42 krlr: hey, i'm using def-map-type in potemkin, and it seems the assoc method does not get evaluated correctly, instead assoc just associates on the record

19:42 TEttinger: oh that works. hang on let me find it

19:42 krlr: how could i implement an object that responds specially to assoc?

19:43 TEttinger: faust45, like this: http://en.wikipedia.org/wiki/Tenjiku_shogi#Individual_pieces

19:44 tenjiku shogi actually needs a DSL-type thing to describe all the movement types

19:44 lgs32a: you may want to watch this chess implementation in haskell: http://www.youtube.com/watch?v=ScS8Q32lMxA

19:44 krlr: TEttinger: I like representing grids like in a game of chess as maps, {[0 3] :rook [4 2] :pawn} for example

19:44 TEttinger: but they describe it with just... a 2d vector of "ranging, jumping, fixed, no-move" pretty much for each cell

19:45 krlr good idea

19:45 krlr: then you get infinite board for free :)

19:47 faust45: i take a look at http://en.wikipedia.org/wiki/Tenjiku_shogi#Individual_pieces

19:47 TEttinger: faust45, see how it can describe almost any kind of movement given a few basic terms?

19:47 krlr: TEttinger: in chess you could just have a function for each piece-type that returns the possible moves for a given position

19:47 faust45: TEttinger: no

19:48 TEttinger: faust45, I am referring to the grids

19:48 krlr: don't think you need dsls here

19:48 TEttinger: the terms are the symbols in the grid, which are like what krlr is saying

19:48 possible moves from the place you are

19:49 faust45: TEttinger: yes, but i need calc possible moves for diff places

19:49 TEttinger: so?

19:49 it's relative

19:49 faust45: so i need transfer relative coords to obsolute

19:49 TEttinger: yeah, that's super easy

19:51 adammh: hey, core.async question... I just started playing with it a bit and I was wondering if there's an easy way to map values between channels

19:52 right now I end up with something like... (go (while true (let [v1 (<! chan1)] (>! chan2 (something v1)))))

19:52 which seems a bit bizarre

19:59 faust45: TEttinger: you mean like this?

19:59 https://gist.github.com/faust45/6259183

20:00 TEttinger: err kinda

20:00 dnolen: adammh: write a channel map

20:01 TEttinger: for chess you really only need a 5x5, and just center the grid on the moving piece.

20:01 let me try to make an example

20:01 adammh: dnolen: totally - I just didn't want to write it if it already existed

20:01 dnolen: adammh: not a part of core.async

20:02 adammh: cool, thanks!

20:07 TEttinger: faust45, you can do it like that, with numbers, and have the number mean how you get there (by jumping or sliding, for example) or have a :keyword that you check when you see what goes beyond that movement. https://gist.github.com/tommyettinger/6259191 there is a simpler way probably, and this type of thing has issues when you figure out what moves beyond the close squares, like from the corner to the other corner.

20:07 hm

20:08 yeah, honestly? it's simplest just to hard-code the unit movement for only 6 pieces.

20:08 knight is too hard to accomodate in a DSL

20:10 faust45: TEttinger: :range :range mean all possible in this direction on real board?

20:15 TEttinger: also need handle pown cases: when pown make first move it can move 2 cells if not first only 1 cell

20:17 amalloy: don't forget en passant!

20:17 adammh: TEttinger: also castling

20:20 TEttinger: yeah a DSL is not going to be able to describe all these special cases without having deep ties to all parts of the code, like has the rook moved yet, for castling

20:25 lgs32a: exit

20:26 faust45: TEttinger: and what kind of marks you think i can use :range what else?

20:27 TEttinger: faust45, I'm doubting this approach. there's a lot of special cases in chess this can't cover

20:27 like en passant and castling

20:29 faust45: TEttinger: doubting? but what you think can work better?

20:29 amalloy: faust45: functions

20:30 faust45: maybe any one want try pair programming on chess?

20:30 amalloy: (fn legal-pawn-moves [board pawn-coords] (filter identity [(forward 1 pawn-coords) (when (not-moved? board pawn-coords) (forward 2 pawn-coords)) ...]))

20:30 faust45: i feel i need a partner on this

20:42 nobody want ?

20:42 )

20:46 TEttinger: faust45, maybe take a look at that haskell video that lgs32a posted http://www.youtube.com/watch?v=ScS8Q32lMxA

21:21 seangrove: dnolen: Where does '("me")' get translated into "me".call(null)?

21:21 I'm specifically looking for how () => .call()

21:22 dnolen: seangrove: in the compiler that happens in the :invoke case, but it's the analyzer that generates :invoke AST nodes

21:25 seangrove: dnolen: Yeah, just looking through that, wondering where the ".call" text is output. Looks like there's a few different ways, depending on the condition

21:25 Just doing some really big hack-and-slash changes to see if I can get .call off of the String prototype and still have clojure run properly

21:25 dnolen: seangrove: it's the :invoke case in the compiler that generates .call

21:26 seangrove: Looks good, thanks

21:27 dnolen: seangrove: I would really love to get that off the String prototype, keywords as strings needs to die

21:29 seangrove: dnolen: I wouldn't mind (post source-maps) taking a swing at 'proper keywords', if it's written out somewhere

21:30 I'm looking at an email on the ml you wrote about it for people dealing with the same problem I am about the .call on the String prototype, but I'm doing it in a pretty hacky way

21:30 dnolen: seangrove: keywords, it's not written out somewhere but the idea is pretty simple, we just need to optimize constants (generate a lookup table), soon as we have that we can give .call on String the boot and clean up all the damn special cases around keywords & strings from the standard library

21:33 seangrove: dnolen: Wouldn't that break if I add a string as a key in a map at runtime?

21:33 e.g. (let [k (get-some-external-input) m {k 10}] ...)

21:34 dnolen: seangrove: break how? (we will probably need keyword-identical?)

21:37 seangrove: dnolen: Could you describe the process of optimizing constants/generating a lookup table, and whatever else it would take to get proper keywords? I don't think I know enough to do anything useful just off of that right now

21:38 dnolen: seangrove: we need a keyword deftype that looks more less similar to the symbol deftype

21:38 seangrove: then in the analyzer we want to keep a atom of all constants

21:39 seangrove: the compiler can use this to emit references to the constant table

21:40 seangrove: we already have logic for determining whether a literal is a constant or not, we just need record them somewhere

21:43 seangrove: Looking through the definitions now...

21:53 Where is -lookup defined? https://www.refheap.com/17725

21:56 amalloy: seangrove: in ILookup, surely?

21:56 or the cljs equivalent

21:57 seangrove: amalloy: I'm a little fuzzy on definitely of protocols and their implementations, so likely to ask some silly questions

22:01 So in the case of this Symbol deftype, the IFn implementation calls out to the -lookup function on the collection. The collection type has to satisfy the ILookup protocol, which is where the actual -lookup implementation happens.

22:03 amalloy: seangrove: indeed, just like in clj-jvm

22:04 seangrove: amalloy: Sorry, making my way into the clojure innards by way of the clojurescript compiler, so I'll likely continue making a lot of silly realizations

22:05 Clojure on the jvm pretty much does everything I've ever asked of it, so I haven't needed to look inside

22:09 amalloy: it's a good read all the same

22:11 holo: hi

22:15 in https://www.refheap.com/17726 can someone paste that def into the repl and check if it's consumed properly? i can't consume it in the repl, but tests against it work fine, so i'm suspecting there is some issue related to the repl

22:18 a test like this works just fine: (fact (first phonem-maps) => map?)

22:42 clj_newb_2345: one thing I find missing about Clojure compared to other lisps -- is getting a repl debugger when an exception happens. Now, I understand that this is unreasonable if the exception happens in Java code -- but is it possible to get thte repl debugger at "the top most Clojure function call" ?

22:42 Actual question: is there any project working on providing the above?

22:44 seangrove: clj_newb_2345: Isn't that a bit like ritz?

22:45 clj_newb_2345: seangrove: reading ritz presentation now

22:50 ysawej1: hi all

22:50 I was wondering if there is named capture in clojure?

22:51 http://www.regular-expressions.info/named.html

22:51 for regex

22:51 clj_newb_2345: what parts of light table are NOT open source?

22:55 ysawej1: is named capture for regex available in clojure? http://www.regular-expressions.info/named.html

22:57 looks like I got it guys... its here : https://github.com/rufoa/named-re

22:58 seangrove: clj_newb_2345: Everything for the time being, I believe

23:02 "Note well that mutable fields are extremely difficult to use correctly, and are present only to facilitate the building of higher level constructs, such as Clojure's reference types, in Clojure itself. They are for experts only - if the semantics and implications of :volatile-mutable or :unsynchronized-mutable are not immediately apparent to you, you should not be using them."

23:02 That's a lovely comment

23:05 muhoo: "reference types"?

Logging service provided by n01se.net