#clojure log - Oct 05 2012

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

0:17 amalloy: LSH: liquor-soaked heuristics?

1:27 Sgeo: Suppose I have (def my-map (agent {:a 1 :b 2}))

1:27 One thread does (send my-map assoc :a 3)

1:27 And another thread is (send my-map assoc :b 4)

1:28 Can those run at the same time, or will there be waiting?

1:46 amalloy: Sgeo: can you imagine a universe in which it's possible for those to run at the same time?

1:47 Sgeo: If send, maps, and assoc conspired together in these circumstances?

1:47 Although that's somewhat silly

1:48 amalloy: sure, help yourself to as much secret conspiracy as you like

1:49 Sgeo: So maybe I should use a map that contains mutable entities that contain maps that ... etc

1:49 Seems more difficult to work with though

1:50 amalloy: what exactly are you trying to optimize here? it sounds like you don't yet have any idea what will be your bottleneck

1:52 Sgeo: Different threads are likely to be changing different keys

1:59 ivan: Sgeo: maybe you just want a ConcurrentHashMap?

2:00 amalloy: that's fine, but unless the operations on each key are terribly expensive it's not really worth introducing all this mutability

2:00 you could look up cgrand's megaref if you want to go down that wild and crazy road, though i can't personally vouch for whether it's any good or not

2:01 Sgeo: Not so much that they're expensive, but there are a lot of them

2:05 amalloy: but then the main overhead is messing with the hashmap's keys, which clearly can't be parallelized

2:26 kkspeed: hello everyone. I'm currently trying ritz with emacs and slime. I'm a little confused in figuring out when the SLDB buffer pops up. It seems that after turning on slime-break-on-exception, sometimes the SLDB buffer will work but sometimes not. A very simple repoduction is when you type some junk string(say "asdf") into slime repl, you can see the SLDB buffer with nice stack trace. However, when you continue to type "asdf" into repl for

2:26 several times, the buffer won't show up again. Hope anyone can help.

2:56 Sgeo: https://github.com/drewr/postal

2:56 Uh, why does this thing use metadata in its API like that?

3:04 ivan: "The server info is ancillary to the content of the message, so meta seems like a logical place." https://github.com/drewr/postal/issues/22

3:05 nope

3:17 Raynes: Sgeo: Don't know, but that certainly isn't what it is for.

3:34 wei_: I'm having some trouble with the extensible reader in ClojureScript. How would I register a tag parser to parse this? #<ObjectId 506d76689fba06037a871458>

3:41 kral: namaste

3:46 wei_: ah, looks like the ClojureScript reader expects a custom tag to be in the form #ObjectId 506d76689fba06037a871458. why does Clojure pr-str output it with the < > then?

3:48 clgv: wei_: I thought self-defined tags need a namespace

3:49 wei_: I don't believe so. on the ClojureScript side, you can define it with reader/register-tag-parser!

3:51 on the server side, I'm serializing with (pr-str data). I'm on Clojure 1.4. did the tag format change recently?

3:52 clgv: it was introduced with 1.4 afaik

8:17 sundbp: hi. is this the wrong way to exclude clojure.core/future form a namespace? (ns foo (:refer-clojure :exclude [future]))

8:18 it seems to have no effect and trying to use future as a symbol results in "Can't take value of a macro: #'clojure.com/future..."

8:19 antares_: sundbp: it's the right way but ns is also a macro

8:20 sundbp: you may need to use http://clojuredocs.org/clojure_core/clojure.core/refer-clojure directly above the ns macro

8:21 sundbp: antares_: hm. ok. i shall give it a go

8:27 sundbp_: antares_: turns out it was a weird sate my swank session got stuck in. a restart and my statement seems fine. thanks though

8:29 abalone: if i use an uglifyjs minified version of codemirror and a google closure compiler minified version of my cljs together, does that set me up for naming conflicts?

8:32 wingy: how should this code look like in cljs? $.mobile.defaultPageTransition = 'none';

8:34 gtrak`: you guys know any good books on async programming? I'm considering: http://www.amazon.com/exec/obidos/ASIN/0471606952/ref=sim_books/104-8763183-5315916

8:40 looks like CTMC and programming erlang are the only things that might cover it on Rich Hickey's clojure bookshelf

8:41 pandeiro: wingy: (set! (.-defaultPageTransition js/$.mobile) "none")

8:41 (i think)

8:43 clgv: sundbp: that ns statement should be fine.

8:45 sundbp: maybe the clojure.core/future symbol is already referred to in the namespace in your repl. just restart it and check

8:45 wingy: pandeiro: it was correct

8:45 thx

8:45 why the minus on .-defaultPageTransition ?

8:47 pandeiro: wingy: property access

8:47 wingy: ah

8:47 pandeiro: b/c javascript is ambiguous about whether something is a prop or method

8:54 bosie: i am trying to get a handle on leiningen and midje but can't seem to get it running

8:55 i added the dependency to project.clj but i can't get Intellij to pick up the dependency

8:57 wingy: pandeiro: i think they forgot that in the comparison site

8:58 pandeiro: pretty sure it is on fogus' cheatsheat

8:58 bosie: "(ns foo.testme (:use midje.sweet))" results in FileNotFoundException

8:58 pandeiro: or on himera

8:58 wingy: yeah

8:58 wished there was a cljs to js

8:58 fast mass editing

9:00 pandeiro: wingy: you're using jquery mobile?

9:00 wingy: pandeiro: yepp

9:00 bosie: now it works. hm

9:01 wingy: the best framework ever

9:01 pandeiro: for actual mobile development?

9:01 wingy: mobile/tablet/desktop/laptop

9:01 bad name actually .. nowadays it works for all envs

9:01 pandeiro: it might be pretty heavy to have jq+jqmobile+cljs for a small device

9:02 just a consideration before you convert your codebase

9:02 wingy: yeah

9:02 need to use a framework for frontend though

9:02 it was okay when using regular js .. hope cljs wont change that much

9:03 in worst case scenario i have to use advanced mode

9:03 pandeiro: adds at least 100k

9:03 that is best case scenario

9:03 gfredericks: wingy: did you ask that "how do I translate this to cljs" just now?

9:03 wingy: gfredericks: yeah

9:03 * gfredericks saw it with a 10pm timestamp

9:03 wingy: but pandeiro gave me an anwer

9:03 gfredericks: did I answer it?

9:03 * gfredericks is so confused

9:03 wingy: no

9:03 :)

9:03 pandeiro: gfredericks: pass it over here?

9:04 gfredericks: :P

9:04 * gfredericks just woke up

9:04 pandeiro: wingy: just wrapping clojure lib and parts of gclosure = 100k in advanced compilation

9:05 wingy: pandeiro: you mean 100k still in advanced compilation?

9:05 or 100k going away

9:05 pandeiro: yep, last i checked

9:05 wingy: ok

9:05 pandeiro: plus whatever your code adds

9:05 plus jquery etc

9:05 wingy: mm

9:05 hope they have upgraded their devices to iPhone 5 :)

9:05 pandeiro: i'm sure a galaxy s3 can slice through it with ease

9:06 yeah

9:06 wingy: need to use cljs

9:06 pandeiro: the javascript, it burns

9:06 bosie: ok, no error/exception now

9:06 but no assertions either

9:06 wingy: pandeiro: isn't cljs converted to js on server side?

9:07 why is still a lot of code needed on client side?

9:07 pandeiro: wingy: cljs is compiled and deployed as regular js

9:07 it has to include the entire clojure standard lib, parts of google closure, plus your code

9:07 Hodapp: pandeiro: I have one here for work that has practically nothing on it. Want me to test anything?

9:07 wingy: i c

9:08 yeah it has a pretty big std lib

9:08 pandeiro: Hodapp: thks i'm not devving anything but i envy you!

9:08 wingy: but advanced mode should remove that

9:08 bosie: https://gist.github.com/3839706

9:08 wingy: pandeiro: what are you using on frontend?

9:08 pandeiro: wingy: do a test and see, are you using lein-cljsbuild?

9:08 wingy: yes

9:08 pandeiro: wingy: add an advanced compile target and see the size of the file

9:08 Hodapp: pandeiro: it's mildly silly... I have a Galaxy S3, a TF101, and a Nikon Coolpix S800c (runs Android 2.3) to develop on here, though our main application is a bigass enterprise C++ mess.

9:09 pandeiro: Hodapp: i dream about the S3 these days since my nexus died

9:09 i am sick

9:09 Hodapp: awwww

9:09 bosie: pandeiro: may i ask what happened to your nexus? (which nexus?)

9:09 pandeiro: wife threw it on the floor

9:10 bosie: pandeiro: sorry to hear. i can avoid that with my nexus; by having no wife

9:10 ;)

9:10 pandeiro: bosie: that works

9:10 it was a nexus one, already no functioning power button, battery was shot, but i loved it

9:10 wingy: 707.81KB atm

9:11 almost 1 MB jezz

9:11 bosie: anyone know what i did wrong with the midje setup that midje/clojure doesn't recognize the fact macro?

9:11 Hodapp: I have a Nexus 7, rather liking it

9:11 pandeiro: Hodapp: damn you can you just shut up?

9:11 ;)

9:11 i heard they are releasing one with 3G at the same price point before year end tho

9:12 and one w/o at $99

9:12 bosie: my fault

9:12 it seems to run but a 'bug' reports the wrong stats

9:12 duck1123: bosie: so when you require midje.sweet it doesn't know about midje.sweet/fact ?

9:13 bosie: duck1123: it does now. but it reports "Ran 0 tests containing 0 assertions"

9:13 wingy: if I bring my iPhone to US .. how can I make internet working?

9:13 nvm

9:13 bosie: duck1123: if i add a failing assertion, it still says 0/0 but also reports the test failed

9:14 duck1123: if you're using midje, you might want to check out lein-midje, it gives better reporting in that case

9:14 wingy: perhaps its not worth having cljs actually

9:14 im not doing much on client side

9:14 but i hate to write js

9:15 plus I might write more over time .. better with cljs cause it scales

9:16 duck1123: wingy: if you're using cljs you're more likely to say "this is awesome" and write a whole bunch more

9:16 wingy: yepp

9:16 duck1123: I have a project at work that I'm really regretting not picking cljs from the start

9:18 bosie: duck1123: wicked. just installed it. looks nice

9:18 wingy: duck1123: too much too convert?

9:18 to

9:19 lein-cljsbuild is awesome .. rapid building

9:19 1.5 s

9:19 duck1123: wingy: It probably wouldn't be too hard, but I'd have a hard time justifying the hours AND my decision to use Clojure at this point

9:20 pandeiro: wingy: my opinion after writing a good amount of cljs is that you still need to write js at times

9:20 wingy: duck1123: backend are you using?

9:20 pandeiro: why?

9:20 duck1123: what backend are you using?

9:20 pandeiro: just doesn't make sense for something like mobile in most cases, unless the client-side is doing a lot of fancy data-munging

9:21 and adding the compile time and the added complexity of compilation... just doesn't make a good tradeoff imo

9:21 otoh if developing a major app from scratch, yeah, sure

9:21 i will do the browser extension frontend of the app i'm working on in cljs, for sure

9:21 duck1123: wingy: The backend is a proprietary eldritch horror of a java app. I'm mostly doing the js interface.

9:22 Hodapp: Do folks use cljs to produce, for instance, Javascript Canvas or other more complex GUIs?

9:23 gfredericks: I've used it with raphael a decent bit

9:23 to create complex GUIs

9:23 dnolen: Hodapp: for HTML Canvas I'd just use it directly. Depends on what you mean by more "complex" GUIs - Closure widgets might work for you - I often just do things from scratch.

9:24 Hodapp: dnolen: Closure widgets? Those can target the web?

9:24 wingy: pandeiro: are you using any framework for frontend?

9:25 dnolen: Hodapp: that's all Closure is for - the web

9:25 Hodapp: In other news, Closure != Clojure.

9:26 pandeiro: wingy: i have written some wrappers for the native browser API, and since it will be an extension, that is enough

9:26 Hodapp: you now make more sense.

9:26 wingy: during my frontend development i have noticed that i actually want something that always work on all devices (touch/mouse) .. jquery mobile is probably the only one for this

9:26 pandeiro: wingy: yeah if you need compatability can't go wrong with jquery

9:26 antares_: wingy: mootools mobile is pretty good from what I hear

9:26 pandeiro: you could also consider wrapping zepto

9:27 smaller footprint

9:27 wingy: yeah

9:27 antares_: https://github.com/cpojer/mootools-mobile ?

9:28 Hodapp: well, I was looking at something that was going to target multiple backends (Processing via quil, OpenGL, SVG) and perhaps trying to do a cljs version that generated Canvas

9:28 pandeiro: Hodapp: easily doable but it involves a lot of mutable state

9:28 imo it's almost just as bad writing mutable cljs as writing js

9:28 or coffeescript or whatever

9:28 Hodapp: pandeiro: sadly, so does Quil

9:29 it just wraps a very stateful Java API

9:29 pandeiro: no getting away from it i guess

9:29 gfredericks: pandeiro: at least you can do any pure-functional stuff in clearly pure functions

9:30 wingy: a dream scenario for me is using only HTML to produce the frontend

9:30 pandeiro: gfredericks: you can do that with disciplined js too though right?

9:30 gfredericks: pandeiro: yeah it just feels squishier

9:30 pandeiro: wingy: check out angular.js

9:30 gfredericks: I appreciate the persistent data structures

9:30 pandeiro: gfredericks: for sure

9:30 gfredericks: the "things are values" aspect

9:30 wingy: jquery mobile is kinda like this but it requires a little configuration with js

9:30 dnolen: pandeiro: gfredericks: mutable state when drawing to a rendering surface is perfectly fine IMO. FP purists be damned.

9:31 wingy: pandeiro: yeah i used it before jquery mobile .. was an excellent framework for architecturing

9:31 cemerick: dnolen: !! https://github.com/clojure/clojure/commit/6bbfd943766e11e52a3fe21b177d55536892d132

9:31 wingy: but no widget foundation .. and bootstrap was not good at all for mobile devices

9:31 pandeiro: dnolen: yeah of course but all the (set! (.-barBaz js/foo) true) is boring

9:31 gfredericks: dnolen: I wasn't arguing against that; I was arguing for using cljs even in such projects :)

9:31 pandeiro: compared to foo.barBaz = true

9:31 antares_: wingy: that and also http://moobilejs.com

9:31 dnolen: cemerick: haha yeah that landed yesterday.

9:32 gfredericks: pandeiro: swap!

9:32 pandeiro: atoms are more interesting than js variables because you get watchers

9:32 dnolen: pandeiro: when dealing w/ canvas you usually need to set multiple properties thos

9:32 pandeiro: gfredericks: yeah but you need to manipulate the js directly with something like canvas

9:32 dnolen: pandeiro: in js that's ctxt.fooBar = ...; ctxt.fooBaz = ...; ctxt.fooWoz = ...;

9:32 cemerick: dnolen: Act as if ye have faith, and all that… ;-)

9:33 I need to fix up a patch that now won't apply, but that's a small price to pay for having column meta.

9:33 pandeiro: dnolen: still shorter than (set! ...), right?

9:33 dnolen: pandeiro: no depends on the length of mutating thing

9:33 wingy: antares_: looks cool

9:33 dnolen: pandeiro: writing a doto style macro is trivial.

9:34 duck1123: pandeiro: that's when you start to build abstractions on top of that to make it nicer

9:34 pandeiro: dnolen: is there no doto in cljs?

9:34 clgv: cemerick: so what is the big advantage of column meta? better error reporting?

9:34 pandeiro: huh

9:34 dnolen: pandeiro: there is, but you still need to go through the properties

9:34 cemerick: clgv: lots of utility for tooling in general

9:34 gfredericks: cemerick: it's because you know for sure which sexp is being referenced?

9:35 dnolen: pandeiro: (setprops js/ctxt (-fillStyle "black") (-fillWidth ...)))

9:35 clgv: cemerick: you got a "killer feature" as example?

9:35 pandeiro: dnolen: nice

9:35 gfredericks: pandeiro: yeah macros in general will always make cljs win over js I think

9:35 cemerick: gfredericks: essentially, yeah.

9:35 pandeiro: i am a macro novice i admit, still scared of them

9:36 cemerick: clgv: When stepping through Clojure code in a debugger, the expression in question can be highlighted, and not just the line. Theoretically.

9:36 dnolen: pandeiro: it's worth investing a little bit of time in them - CLJS gets a lot more compelling very quickly.

9:36 cemerick: There's also stuff like source maps for cljs, etc.

9:36 clgv: cemerick: ah ok

9:36 dnolen: cemerick: yes that landed yesterday.

9:36 pandeiro: dnolen: yeah your example is a case in point, i will work at it

9:36 dnolen: cemerick: pretty sweet!

9:37 duck1123: wait, source maps landed? or just column metadata?

9:37 dnolen: duck1123: column metadata

9:37 gfredericks: pandeiro: it basically gives you the freedom to remove arbitrary ceremony from your code; which compared to raw JS...

9:37 duck1123: ahh, still cool

9:38 dnolen: duck1123: but it means source maps will be considerably more useful.

9:38 gfredericks: function(...){return ...} is a lot of typing

9:38 dnolen: `fogus: excited about the new site!

9:38 pandeiro: gfredericks: for sure

9:38 `fogus: thank you sir. it's ... needed (?)

9:38 gfredericks: dnolen: I enjoyed your cljs talk @SL -- the type hinting I did not know about and found fascinating

9:38 pandeiro: are the strangeloop videos up yet ?

9:39 gfredericks: pandeiro: don't think so; I saw puredanger talking about scheduling recently

9:39 dnolen: gfredericks: thanks! that was actually a fairly simple patch in the end. but it helped out a lot.

9:43 gfredericks: dnolen: I was also interested in the speculation about why transients were faster than arrays -- do you think it is specific to the type of test you're doing? Otherwise could JS impls speed up their arrays by implementing them as transient vectors instead? :)

9:44 or could they not do that since they need to support sparse things and string keys and such?

9:44 dnolen: gfredericks: http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L266, that's all there is to boolean inference.

9:44 gfredericks: we used fixed size arrays - js engines optimize those now.

9:45 gfredericks: so perhaps we get small boost over growing an JS array of unknown length.

9:46 pandeiro: how can i figure out why clj-http cannot handle by BASE64DecoderStream? i am trying to use clojure.tools.trace on the clj-http.client ns, as well as :debug true in the request map, but i cannot see where the process breaks down... it just doesn't send the request at all from what i can tell

9:46 gfredericks: ah ha

9:46 pandeiro: s/by/my

9:46 wingy: is there any way to make this cljs code shorter and more readable? https://www.refheap.com/paste/5533

9:46 so many ()

9:47 http://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway

9:47 good talk .. i hope namespacing will be fixed

9:48 `fogus: Does anything prevent someone from "fixing" namespaces from user land?

9:49 cemerick: Figuring out what we all really want is probably step one.

9:49 ;-)

9:49 `fogus: Granted there would be a mssive uphill battle to get one's fix accepted and/or commonly used

9:50 hyPiRion: Well, it kind of depends on what part of namespaces you fix

9:50 cemerick: The special-casing of ns is the biggest impediment to experimentation in this area. Secondarily, scads of tools that depend upon its particulars.

9:50 `fogus: The reason I ask is because since nses are things, then presumably one could create a library to provide other ns capabilities

9:50 hyPiRion: If you make requires transactional for instance, then I believe the transition will go smoothly.

9:52 gfredericks: wingy: check out ->

9:52 cemerick: A tagged literal is probably the simplest way to escape out into a custom ns implementation.

9:52 s/simplest/easiest :-P

9:53 gfredericks: cemerick: also a user.clj file?

9:53 `fogus: #badass/ns (do-the-right-stuff)

9:53 cemerick: yup

9:53 gfredericks: shouldn't be necessary

9:53 gfredericks: cemerick: because user.clj is evil?

9:54 cemerick: `fogus: I think you have the name for your alternative namespace implementation :-D

9:54 `fogus: I would love to see a Racketesque #lang algol68 capability. :-O

9:54 cemerick: gfredericks: oh, hrm, data_readers.clj won't require the implementing namespaces automatically. You may be right. :-/

9:55 that is, the namespaces named in data_readers.clj aren't loaded automatically.

9:55 gfredericks: cemerick: yeah it always seemed like a chicken-and-egg problem to me

9:55 dnolen: wingy: not sure about shorter, but I'd do it like this http://www.refheap.com/paste/5534

9:56 gfredericks: (ns foo.bar (:require [badass.ns :refer [ns']])) (ns' ...) is obviously undesirable :)

9:56 cemerick: gfredericks: What, alternative namespaces, or tagged literals/data_readers.clj? Probably both. :-)

9:56 gfredericks: cemerick: the former

9:57 because you can write a good ns macro easily but can't use it from elsewhere without requiring it

9:57 which requires the ns macro......

9:57 `fogus: VORTEX!

9:58 TimMc: gfredericks: Clearly we just need a CLJ preprocessor.

9:58 gfredericks: so in the user.clj you define clojure.core/ns'

9:58 which stomps on all the ns' macros defined in all of your libraries for the same purpose

9:58 and clojure blows up

9:59 wingy: dnolen: cool (missed ])

9:59 just one question

9:59 are there equivalents:

9:59 (-> page (.find "input#username") .select)

9:59 (.select (.find page "input#username"))

9:59 cemerick: gfredericks: I don't think you'd want to stomp over anything.

9:59 dnolen: wingy: yes.

10:00 wingy: w/ -> you just get less parens and left to right reading.

10:00 TimMc: fewer!

10:00 Sorry, Grammar Tourette's.

10:01 dnolen: TimMc: heh thx

10:01 jsabeaudry: (inc TimMc)

10:01 lazybot: ⇒ 18

10:01 wingy: yeah i have used it some times .. now i get this example

10:01 thx .. its much more cleaner

10:01 ill probably should read the joy of clojure? these kind of examples are good

10:02 gfredericks: cemerick: so how could ns be changed to have its current functionality but be sufficiently extensible that we don't have to worry about stomping?

10:03 maybe (ns ^#{:impl badass/ns-macro} foo.bar ...)

10:03 elzibub: wingy: you could do worse than flip through this: http://clojuredocs.org/quickref/shortdesc/Clojure%20Core

10:03 gfredericks: that would be only mildly terrible I think

10:03 dnolen: hey there! http://github.com/clojure/tools.namespace

10:04 wingy: elzibub: yeah

10:04 sundbp_: i'm a newbie in FP. I'm doing this: I have the skeleton of a map and an args map (from ]&more]). I want to check a property of each key in more and then add it in the right place in the skeleton. can see how it do that via a recursive function. are there other alternatives?

10:04 gfredericks: sundbp_: sounds like reduce?

10:05 cemerick: gfredericks: Better to provide a complete alternative to `ns` and leave its semantics be.

10:05 antares_: ohpauleez: hey, you around?

10:05 ohpauleez: I'm here

10:06 antares_: ohpauleez: so I've ported CDS to docslate and writing How To Contribute documents and so on

10:06 gfredericks: cemerick: that's different from `fogus's approach of fixing it from userland somehow, right?

10:06 sundbp_: in my head i'm building up a map step by step, one key at a time and i need a predicate to check where to stick the key

10:06 ohpauleez: antares_: Awesome!

10:06 sundbp_: gfredericks: ah, yes - i should have figured

10:06 antares_: we need to deploy it somewhere. I can do everything but not sure everybody will be happy with me using cds.clojurewerkz.org fori t.

10:06 cemerick: gfredericks: I think `fogus has much more ambitious things in mind, e.g. racket's #lang and all that

10:07 gfredericks: ah ha

10:07 * gfredericks isn't very ambitious

10:07 `fogus: #lang is, by comparison, a simpler change

10:07 antares_: ohpauleez: so, my question is, would it be difficult to get cds.clojure.org for now? All I need is DNS to point to a particular IP. It won't be official or anything.

10:07 ohpauleez: if not, I will wait for uvtc and figure something out

10:08 cemerick: For more incremental changes, I think defining `ns'` or something is entirely reasonable.

10:08 `fogus: But #lang is a HUGE change in the Clojure Way

10:08 ohpauleez: antares_: Why don't I just buy clojurecds.com right now

10:09 antares_: ohpauleez: that's an option but people involved in CDS already have many domains each

10:09 `fogus: Is clojurecds a service that mails you CDs with Clojure installers included?

10:09 antares_: ohpauleez: ok, I will look for a new domain. Thanks!

10:10 ohpauleez: `fogus: Exactly!

10:10 We're bringing install discs back

10:10 clgv: cemerick: I stumbled on the `ns` issue when I wanted to have custom ns-like statement for config files which automatically has :use clauses for the namespaces with the config word definitions

10:10 ohpauleez: We'll have them at every McDonalds

10:10 `fogus: It worked for AOL!

10:11 ohpauleez: haha right?!?

10:11 That's what I'm saying

10:11 - for real, I'm catching myself up on the `ns` discussion

10:12 gfredericks: #lang would give people all the reader macros they want, eh?

10:14 `fogus: gfredricks: Basically, #lang would tell the compiler that for a given file use the mapped stream processor to parse a file and really-compile whatever it returns

10:17 gfredericks: so some of the arguments against reader macros apply here, right? mostly the ones about code readability

10:18 not that I think that means it shouldn't exist

10:18 * gfredericks doesn't find positions on 'simple vs easy' easy to anticipate

10:19 `fogus: Oh it'll let you fix the readability problem by writing a parser for a "real" language with brackets and parens in the right place. :p

10:19 gfredericks: ha

10:20 cue the X-to-clojure transpilers

10:21 cemerick: "transpiler" gak :-P

10:21 `fogus: https://gist.github.com/3840018

10:23 cemerick: `fogus: so is #lang clojure your first milestone? :-)

10:23 `fogus: #lang basic

10:23 cemerick: of course!

10:23 ohpauleez: perfect

10:23 gfredericks: #lang english

10:24 `fogus: It's my grand plan for making the world a worse place through BASIC https://github.com/fogus/baysick

10:25 TimMc: ohgod

10:25 beberlei: `fogus, haha this is great :)

10:26 dnolen: `fogus: tools.compiler seems like a useful contrib? would love to support #prolog by compiling to core.logic - #datalog sounds really useful too. #html would also be interesting convert html to hiccup.

10:26 `fogus: dnolen: Is tools.compiler a thing?!

10:27 I would _love_ to see it

10:27 ohpauleez: that is sounds pretty awesome - it would be nice to round it out with #xml as well

10:27 dnolen: `fogus: well it sounded like you wanted it to be thing :) and I agree

10:27 `fogus: I have a set of macros around here somewhere that puts a Prolog-esque skin on c.c.logic

10:30 But yes, I love if it were a thing

10:30 would love that is

10:31 dnolen: `fogus: I could imagine an OMeta style approach - take a grammar and a lang file - emit Clojure ... VPRI ftw!

10:31 `fogus: Want to create a wiki page?

10:32 dnolen: `fogus: I'll happily contribute to a Clojure design page with ideas.

10:32 TimMc: Step 1: Find out if there are major things eople complain about with other #lang systems, and avoid that.

10:33 dnolen: bbiab

10:34 cemerick: TimMc: Dunno, the white-hot awesomeness makes it really hard to see anyone complaining about it… ;-)

10:35 `fogus: (inc cemerick)

10:35 lazybot: ⇒ 11

10:35 cemerick: Although I was personally more intrigued by racket's process isolation in the strangeloop session.

10:39 `fogus: Oh, BTW, chouser and I just started working on the 2nd edition!

10:39 Bronsa: that's awesome

10:41 pandeiro: dakrone: you around?

10:48 andrewmcveig: Say I have the map: {:filename "test.png" :x 10 :y 0 :w 200 :h 200},

10:48 is there a single core function to transform it to: {:filename "test.png" :crop {:x 10 :y 0 :w 200 :h 200}}

10:48 or do I need to use assoc/dissoc?

10:49 S11001001: andrewmcveig: latter

10:49 antares_: andrewmcveig: there is no

10:51 andrewmcveig: antares_: S11001001: OK, thanks.

10:54 clgv: andrewmcveig: but there is: `select-keys` that'll help you

10:56 andrewmcveig: clgv: yeah, I've used that thanks :), just wondering if there was something built-in to do it.

10:58 clgv: andrewmcveig: like (wrap m [:x :y :w :h] :crop) ;)

11:01 andrewmcveig: clgv: yes, something like that...

11:04 dakrone: pandeiro: I'm here

11:09 stuarthalloway: anyone know how to construct a fuzzy search on search.maven.org that will return a page with all the Clojure 1.5 alphas, but nothing else?

11:12 chouser: Emacs just went sideways on me. I don't know what I changed, but now starter-kit is giving me: Symbol's value as variable is void: hippie-expand-try-functions-list

11:12 technomancy: any hints on what I could try?

11:13 cemerick: stuarthalloway: looks like they're not tokenizing v(ersion)

11:13 Frozenlock: (require 'hippie-expand) ?

11:13 cemerick: so, probably not

11:13 stuarthalloway: meh :-)

11:14 jamii: Does anyone know of a pretty-printer for clojure code? Trying to debug the output of my compiler...

11:15 cemerick: jamii: clojure.pprint

11:16 jamii: cemerick: Ooops, I already looked at that and somehow didn't notice that it had clojure formattings predefined. Thanks

11:19 chouser: Frozenlock: (file-error "Cannot open load file" "hippie-expand")

11:20 Frozenlock: Ok that's odd... I was under the impression that hippie-expand was always included in emacs o_O

11:22 chouser: stuarthalloway: g:"org.clojure" AND a:"clojure" AND v:1.5.0-alpha*

11:23 cemerick: chouser: gd quotes ;-)

11:23 stuarthalloway: chouser: wow, that seems to be killing search.maven.org. spin, spin, spin

11:23 chouser: Does gd mean "frickin' awesome"?

11:24 stuarthalloway: what? works repeatably here: http://search.maven.org/#search|ga|1|g%3A%22org.clojure%22%20AND%20a%3A%22clojure%22%20AND%20v%3A1.5.0-alpha*

11:24 stuarthalloway: weird!

11:24 clgv: hmm almost monthly 1.5.0-alpha releases except in september - holidays? ;)

11:24 stuarthalloway: that link worked fine

11:25 cemerick: chouser: exactly right!

11:25 Frozenlock: chouser: you could always check /usr/local/share/emacs/<version>/lisp/ to see if you have the file "hippie-exp"

11:26 stuarthalloway: chouser: sweet, and added to clojure.org. thanks!

11:27 chouser: stuarthalloway: ah, nice.

11:31 hm, maybe it's called hippie-exp now instead?

11:32 * Frozenlock shoots himself in the head

11:32 chouser: Yeah, that seems to do it -- (require 'hippie-exp) before starter-kit.

11:32 Frozenlock: Yeah, (require 'hippie-exp)

11:33 chouser: Frozenlock: thanks!

11:33 Frozenlock: Sorry about that...

11:58 pandeiro: dakrone: i'm having an issue with clj-http.client/request when using a com.sun.mail.util.BASE64Decoder as :body... problem is resolved when i manually convert to InputStreamEntity and pass to clj-http.core/request instead

11:58 dakrone: pandeiro: what sort of issue?

12:00 pandeiro: doesn't fire the http request at all

12:00 sorry for the ambiguity

12:00 cemerick: pandeiro: I saw your clutch ML post, but there's not a lot I can offer; seems there's clearly something wonky about that particular InputStream impl

12:00 pandeiro: i used clojure.tools.trace/trace-ns and i think somewhere in that threading macro wrap-request there is a nil being returned

12:00 cemerick: i got it working with the vanilla clj-http.core/request

12:01 the problem is somewhere in the 'middleware' for the batteries-included clj-http.client/request

12:01 dakrone: pandeiro: if you open an issue with reproducing info, I will definitely take a look at it

12:01 cemerick: oh, as opposed to http/put?

12:01 pandeiro: but i am having a hard time finding where without expanding it all

12:01 cemerick: put will just use client/request under the covers, so that won't work

12:01 dakrone: pandeiro: if I had to guess, probably wrap-input-coercion

12:02 pandeiro: dakrone: would make sense, right, but trace doesn't even get there

12:02 plus when i implement what it does manually, it works fine

12:02 (InputStreamEntity. base64-stream -1) goes off, fine

12:02 dakrone: strange

12:03 I have a meeting now, but open an issue and I'll take a look when it's over

12:03 pandeiro: dakrone: cemerick: tested it against clj-http 0.4.1-SNAPSHOT (used by clutch) and latest stable (0.5.5), no difference

12:03 dakrone: i'm stepping out too but i will, later

12:03 thanks for your time

12:03 cemerick: you too

12:03 cemerick: FWIW ;-)

12:04 pandeiro: reading through clutch is an education :)

12:04 cemerick: hrm, not sure how to take that ;-)

12:06 pandeiro: cemerick: heh i meant it positively

12:06 cemerick: :-)

12:06 It's still a bit crufty, but it gets the job done.

12:06 Been around since pre-1.0 clojure, so…

12:06 The library, that is.

12:06 pandeiro: the defdbop especially is interesting

12:07 anyway i will file the issue later tonight and hopefully we can squash this one for good... tchau

12:22 technomancy: chouser: are you following emacs trunk?

12:23 chouser: snapshots, so ... maybe?

12:24 * technomancy should get back into the habit

12:29 chouser: ubuntu ppa snapshots, to be clear

12:39 nsxt: given the following structure (never mind that it's json, for the sake of example we can assume that the keys are clojure keywords), https://www.refheap.com/paste/5538 is there any way to create a collapsed sequence of all of the data maps?

12:41 antares_: nsxt: reduce + flatten or just reduce. You will probably need to do it recursively, too.

12:42 gfredericks: (fn datas [{:keys [data children]}] (cons data (map datas children)))

12:42 raek: flatten is recursive

12:44 nsxt: I would make a recursive function

12:45 nsxt: yeah, i tried my hand at a loop/recur solution but was wondering if there was something more concise

12:46 raek: (defn my-tree-seq [tree] (lazy-seq (cons (:data treee) (map my-tree-seq (:children tree)))))

12:46 gfredericks: nsxt: ^ mine should work?

12:46 raek: oh, mine's the same as gfredericks'... :)

12:46 gfredericks: raek: and map is lazy so without lazy-seq it's still _pretty_ lazy :)

12:46 raek: (modulo laziness)

12:46 yeah

12:47 callen: dustingetz: loved "Monads for normal people" btw. most instructive and elucidating rundown I've seen on the subjects, especially wrt selling the benefits of them even in languages not necessarily designed to do so. I've actually done some Haskell hacking and never really saw them as anything other than plumbing I was forced to grapple with.

12:47 raek: I guess you could do it with something in clojure.walk too

12:49 dustingetz: callen: wow, i'm flattered, thanks for the feedback!

12:49 gfredericks: raek: that'd be difficulter than ours, assuming his structure is as regular as it looks. with walk you'd have to be testing what kind of node you're looking at...

12:49 nsxt: gfredericks: that sort of gets me there

12:50 callen: dustingetz: most other treatments of the subject fail on a few fronts: selling the benefits, disentangling it from a language they don't know (Haskell, Clean, Agda), making the specific nature of it known in terms of code rather than category theory. You hit the high notes. Thank you. I'll be linking your site if somebody asks me about a pattern in my code.

12:50 dustingetz: "monads… in languages not necessarily designed to do so" - be careful with that, haha. python is a nice teaching language

12:50 nsxt: i was hoping for a collapsed sequence

12:50 callen: dustingetz: I'm a full-time Python hacker, I embrace the more functional parts but I have no illusions about the fact that GvR resents me for it.

12:51 gfredericks: nsxt: it's not collapsed?

12:51 nsxt: gfredericks: one sec, editing

12:52 dustingetz: callen: i totally understand. writing a pure functional interpreter with monads in python, to be honest, pushed the language way out of its idioms, and kind of sucked, actually.

12:52 its just nice to be able to talk about these concepts without people getting hung up on "OMG PARENS"

12:52 nsxt: gfredericks: https://www.refheap.com/paste/5539

12:53 (yes, there are additional nodes in there, accidentally collected some while trying to prettyprint, haha)

12:53 callen: dustingetz: I make light use of monads in my code, mostly for chaining and tuple value/error handling so that I don't have to write a million if checks. It's a very minimal and simple usage of monads, but I vastly prefer it to the alternatives. I sometimes find myself having to explain why my code is littering map, lambda, and bind() though.

12:53 dustingetz: any of it open source?

12:54 callen: dustingetz: I don't take it too far for reasons you've apparently come to grips with. I feel like Python is shedding a lot of users either to less powerful languages like Go, or more powerful ones like Clojure, Haskell, etc.

12:54 gfredericks: nsxt: so that's the output given my function?

12:54 callen: dustingetz: hrm, not really, but I'm the CTO at this startup, so I can grab an extract if you want one.

12:54 nsxt: gfredericks: yeah

12:54 gfredericks: nsxt: on the data from the previous paste?

12:54 ToBeReplaced: callen: the resentment for writing programs in a functional style in python is why i'm experimenting with clojure now!

12:55 nsxt: gfredericks: yeah, with the exception of those additional nodes collected from prettyprint and refheap itself

12:55 callen: ToBeReplaced: you got tired of being scorned too? :P

12:55 gfredericks: nsxt: oh we need mapcat

12:55 dustingetz: callen: *shrug* for some set of problems, perhaps less technical startups, you want to be able to hire fast and be productive during early product iteration cycles with your new hires

12:55 callen: python is a nice fit for that

12:55 gfredericks: nsxt: change the map to mapcat and see how that goes

12:55 ToBeReplaced: callen: tired of introducing intermediate variable names to write generator comprehensions instead of just map

12:55 callen: dustingetz: you know, you'd think, but in practice, I end up writing everything anyway.

12:56 dustingetz: haha

12:56 callen: dustingetz: half-kidding, but yeah, most of our hires are for fairly highly specialized stuff like frontend+JS, or for data/ML

12:56 or mobile

12:56 thorbjornDX: callen: I made the python -> clojure jump in some of my code, mostly to avoid unnecessarily using OO programming

12:56 callen: dustingetz: I write the backend, API, do the devops, manage the databases, etc.

12:56 nsxt: gfredericks: you are my hero :)

12:56 * gfredericks can kiss away the pain

12:57 nsxt: gfredericks: i will stand by you... foooorreeeeever </inappropriate>

12:57 callen: lightly monadic/functional python is my compromise with the mindset that we might eventually hire someone to do one of the things I do.

12:57 nsxt: in any event, thanks again

12:57 gfredericks: nsxt: phew

12:57 callen: I think realistically any hire we brought on would be willing to learn Clojure if we were using it.

12:57 gfredericks: nsxt: no probalo

12:58 mindbender1: chouser: I damian cassou ppa seems very stable and he is hard at work with it

12:58 thorbjornDX: callen: I wish I could say the same in my case :p

12:58 callen: thorbjornDX: we're a startup, you have to half-cocked to even talk to us anyway.

12:59 thorbjornDX: callen: 80's SI hardware tech company here

12:59 callen: one-off perl script shoppe

13:00 nDuff: /me is in a Java shop -- using Clojure to prototype, then rewriting things after they stabilize. :(

13:00 callen: thorbjornDX: fuckin' A.

13:00 now I just need to find an explanation of category theory aimed at python programmers.

13:00 nDuff: :(

13:02 one of the main problems I have utilizing monads in Python code, and I realize this is really my own fault, is that where I need them most is where it's hardest to integrate them. Namely some of the larger more complicated functions where some spooky-action-at-a-distance is occurring. A good indicator that there's a problem is that the functions I'm calling will have like 2-3 mandatory arguments and 20-something keyword args.

13:03 dustingetz: that's an interesting point

13:03 it feels to me

13:03 like the monadic code, is sort of the ultimate, maximally separated factoring

13:03 but in practice

13:03 i never, ever, ever have time to understand the problem that well

13:03 chouser: mindbender1: I think that's the one I'm using

13:04 callen: dustingetz: http://nutrivise.com/ <--- the code I'm talking about is the algorithm that drives the recommendation engine.

13:04 dustingetz: this quote comes to mind

13:04 Programming: find working solution in problem domain that you don't fully understand and don't have time to understand http://prog21.dadgum.com/154.html

13:04 mindbender1: ok

13:04 callen: dustingetz: It's really hard to de-uglify something that complicated into something that can be composed in terms of monads

13:04 the type signature for such a series of functions in Haskell would be horrifying.

13:04 dustingetz: which is why we're hanging out in #clojure

13:05 thorbjornDX: <3 #clojure

13:05 fredyr: ^^

13:05 callen: dustingetz: I found Haskell to be instructive, but the community and libraries are impenetrable. That combined with my Common Lisp heritage makes me prefer Clj.

13:05 when I was writing Haskell, I almost never encountered a problem, found a library for that problem, and solved the problem. (such as in Python)

13:06 instead, I'm on IRC begging them to tell me why I need to use monad transformers in order to parse this XML

13:06 dustingetz: you wrote it professionally?

13:06 haskell, that is

13:06 callen: dustingetz: nothing I do is professional, I work at a startup. We're all clowns. But more seriously, not really no. I used Haskell for a semi-serious side project after a year or two of tinkering and had to abandon it.

13:07 my day-to-day work is mostly Python.

13:07 but I have a lot of side projects.

13:07 dustingetz: understood

13:07 callen: dustingetz: http://snappyweather.com/ here's one I did.

13:07 dustingetz: haha, cute

13:08 callen: are you familiar with the problem I had with the obtuseness of the Haskell community though? Nice people, but it seems to take a LOT of work to get to the point where you're comfortable with using any given library.

13:08 dustingetz: i just started in haskell

13:08 Real World Haskell arrived from amazon this morning

13:08 callen: I really like it, especially the fact that it's a clean-break from ecosystems like the JVM

13:08 I just feel like I have a lot more to learn before I'd be productive in it.

13:08 and given that I work for a startup, code output is paramount.

13:09 dustingetz: the most appealing thing about haskell is that the people seem to "think" in haskell, like a mathematician thinks in math

13:09 you get tweets of some one-liner incantation

13:09 and they'll ask for thoughts

13:09 not even clojure has that degree of expressiveness

13:09 callen: dustingetz: haskell is why I started using monads in python. I learned some Clojure and hacked in Common Lisp for years prior to that never really understanding or embracing monads but Haskell made them more apparent for me.

13:10 dustingetz: would love to see how you structure them

13:10 djanatyn: writing code in clojure is really fun

13:10 dustingetz: given that there's no macros

13:10 djanatyn: I just wrote an implementation of Conway's Game of Life for the very first time

13:10 callen: dustingetz: *args of f(), map, etc.

13:10 dustingetz: it's pretty sundry.

13:10 dustingetz: got it

13:10 i tried a couple ways, including that

13:11 callen: dustingetz: example, I have a maybe_pipe that does a maybe chain of funcs against data.

13:11 dustingetz: it works well for the simpler code, but as I stated earlier, I've had a harder time integrating it into the uglier code.

13:11 thorbjornDX: djanatyn: the first time I heard about CGoL was in a CUDA programming class, that wasn't the best way to learn about it :p

13:11 dustingetz: i settled on using polymorphism, implementing mpipe in a base class which dispatches polymorphically on unit and bind

13:11 but its not exactly pretty

13:12 airolson: dustingetz: I quite liked your monad talk at strangeloop

13:12 despite the python awkwardness

13:13 dustingetz: airolson: wow, thanks!

13:13 i thought the slides came out well, but i got pretty nervous on the stage and my brain sort of shut off, so i wasn't sure how lucid my verbal explanations were

13:14 airolson: haha yeah, you were going quickly

13:14 but the extended Q&A was really good

13:14 dustingetz: thank you for the feedback!

13:16 callen: dustingetz: this isn't me, but this is fairly indicative of the experience I had with Haskell: http://news.ycombinator.com/item?id=3065876

13:18 it just seemed sisyphean and the moment I reapproached from a more familiar programming language it was like a steam-valve had been let off.

13:18 I really like the type system though.

13:19 dustingetz: oooh I remember that thread

13:19 callen: much blood was spilt.

13:20 djanatyn: http://dpaste.org/gMM4S -- complete game of life implementation in 60 lines of clojure

13:21 errm, some stuff got moved around >_>

13:22 http://dpaste.org/iyqXe

13:23 dnolen: djanatyn: nice, I recommend learning about get-in update-in

13:24 wingy: -> is a real saver

13:24 SegFaultAX|work: djanatyn: Search for "Game of Life" or "Conway" - https://gist.github.com/3607101

13:24 wingy: makes it so simple to write OOP code in cljs

13:24 djanatyn: I can't access gists since I'm on my school's wireless network, which blocks github gist for some reason

13:25 unfortunately, since I write most of my clojure code at school, that means it mostly sits on my hard drive :P I have uploading several projects to github on my todo list today

13:25 SegFaultAX|work: djanatyn: That's just silly.

13:25 djanatyn: How do they expect you to share code snippets?

13:26 djanatyn: SegFaultAX|work: They don't expect me to share code :) it's just a high school, and the only language they teach is java

13:26 thorbjornDX: SegFaultAX|work: `write <user> pts/blah` ofc

13:26 SegFaultAX|work: thorbjornDX: Huh?

13:26 * Sgeo wonders about the practicality of using ClojureScript for node.js

13:27 nDuff: Sgeo: There are folks who do.

13:27 thorbjornDX: SegFaultAX|work: that was a response to the 'how to share code' question

13:27 SegFaultAX|work: thorbjornDX: Oh, :)

13:27 Sgeo: Although, in all liklihood, we will just use an external service to deal with this

13:27 PubNub is kind of addictive

13:27 No need to write server-side code for server-sidish things, just use someone else's server

13:29 callen: Sgeo: probably wise. I wonder what PubNub is built in.

13:29 wingy: a bad thing with http://clojuredocs.org/clojure_core/clojure.core/-%3E is that it doesnt tell that its a macro

13:29 oh it does

13:29 Sgeo: For what it's worth, we had previously looked at Pusher, and it doesn't meet our requirements

13:30 wingy: but not as clear as (doc ->)

13:30 Sgeo: Would be nice if they said in glaring letters "DOES NOT SUPPORT THE STOCK ANDROID BROWSER"

13:30 But that would not be good for them from a marketing standpoint

13:31 callen: or they could just fix it.

13:33 Sgeo: That would require adding in another fallback

13:33 And possibly adding server support, assuming that the way their Flash fallback works is by speaking WebSocket

13:35 wingy: here is my ring handler https://www.refheap.com/paste/5540 .. i dont know why my server doesn't refresh the code when i reload the browser

13:36 is it something i have to do?

13:36 i recall something to use #' for telling it to use the var instead of the value

13:36 gfredericks: yep

13:36 (def my-app #'my-actual-app) I think works

13:37 or (defn -main [] (start-jetty-whatever #'my-app))

13:37 * gfredericks didn't actually look at the code

13:37 Sgeo: ,(let [f (var (fn [] (println "Hello")))] (f) (var-set f (fn [] (println "Goodbye World")) (f))

13:37 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

13:38 Sgeo: ,(let [f (var (fn [] (println "Hello")))] (f) (var-set f (fn [] (println "Goodbye World"))) (f))

13:38 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)>

13:38 Sgeo: bluh?

13:38 gfredericks: Sgeo: (var (fn ...)) won't work

13:38 if you want a local var I think there is a with-local-vars macro

13:38 but (var ...) just wants a symbol

13:39 Sgeo: Oh

13:39 gfredericks: the var special form is specifically for looking up vars in namespaces

13:39 * gfredericks isn't sure why that has to be a special form

13:39 Sgeo: ,(let [f (atom (fn [] (println "Hello")))] (f) (reset! f (fn [] (println "Goodbye World"))) (f))

13:39 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn>

13:39 devn: How do I play a scale in overtone? I can't seem to figure out apply-at and/or at to make it do my bidding.

13:39 Sgeo: Worth a shot

13:39 I don't entirely get why #'blah works as an fn

13:39 When #'blah contains an fn

13:39 callen: dustingetz: you got the bad end of the deal, your tweets are better than mine. :P

13:39 Sgeo: ,(let [f (atom (fn [] (println "Hello")))] (@f) (reset! f (fn [] (println "Goodbye World"))) (@f))

13:40 clojurebot: Hello

13:40 chouser: gfredericks: you mean a special form instead of (resolve 'foo) ?

13:40 clojurebot: Goodbye World

13:40 gfredericks: Sgeo: because the Var class has an invoke method that just invokes the contents

13:40 dustingetz: hahah

13:40 raek: Sgeo: that's the way that clojure.lang.Var implements clojure.lang.IFn

13:40 gfredericks: Sgeo: i.e., there is special support for it

13:40 raek: it invokes its current value

13:40 devn: say i have a seq of notes: (64 68 72), how do I distribute those notes over time without using something ugly like Thread/sleep?

13:40 any takers?

13:40 gfredericks: chouser: yeah, or an interop call to whatever RT does with var internally

13:40 technomancy: devn: at-at maybe?

13:41 gfredericks: chouser: is (resolve 'foo) equivalent?

13:41 devn: technomancy: yeah, just not sure how to use it

13:41 wingy: gfredericks: i think lein-ring is doing it automatically .. i noticed that i changed some static JS files and thought it would reload the file

13:41 Sgeo: ,(with-local-vars [f (fn [] (println "Hello"))] (f) (var-set f (fn [] (println "Goodbye World"))) (f))

13:41 clojurebot: Hello

13:41 Goodbye World

13:41 wingy: now im actually bullshitting .. i actually changed the code :/

13:41 aperiodic: devn: there's stuff built into overtone for doing things periodically. you can make a metronome and attach a fn that makes noise to it

13:41 wingy: hiccup code

13:42 Sgeo: So, combining with-local-vars and transients is the ST monad?

13:42 Effectively?

13:43 dustingetz: transients?

13:43 clojurebot: transients are not mutable data structures: http://technomancy.us/132 or at least as far as you're concerned.

13:44 Sgeo: So, how would I do the equvalent of a Haskell STArray in Clojure?

13:45 devn: aperiodic: grr, can't get it to do what im looking for

13:45 dustingetz: this may or may not help you

13:45 https://github.com/dustingetz/dustingetz.github.com/blob/master/_posts/2012-10-03-reader-writer-state-monad-in-python.md

13:46 aperiodic: devn: well, maybe that attach a fn bit is a lie, but you can make a metronome, and that gives a beat, which is a timestamp, and then you pass that timestamp... somewhere

13:46 Sgeo: dustingetz, thanks for reminding me of the lack of macros in Python

13:46 eww

13:46 dustingetz: haha

13:47 tell me about it

13:47 Sgeo: Anyways, ST != RWS

13:47 dustingetz: there's supposed to be commas in the url :(

13:47 Sgeo: How far along are delimited continuations in Clojure?

13:48 Because I'm starting to wonder about the possibility of building a monad library that uses that, instead of an equivalent of do syntax, as an easy way to use monads

13:49 delimited continuations and monads are related somehow (I'm still sketchy on the details), and I think there's the possibility of a far more natural syntax for using monads, sort of an auto-lift-ish thing

13:49 jimduey: dustingetz: I didn't see you at Strangeloop, but I thought you did a good job on your talk.

13:50 aperiodic: devn: this is over my head at this point (i've really only played around with overtone for a few hours at clojure/west). i'd recommend watching some of the getting started vids linked in the readme, since overtone is pretty lacking in documentation for noobs.

13:50 Sgeo: Since delimited continuations is a monad, and delimited continuations admit a syntax more natural than do syntax, and I've heard that delimited continuations is the mother of all monads...

13:50 I think you can see where I'm going with this

13:50 dustingetz: jimduey: thanks! i was pretty nervous

13:50 Sgeo: Hi jimduey

13:50 dustingetz: Sego: example of "delimited continuation syntax" ?

13:51 Sgeo: http://en.wikipedia.org/wiki/Delimited_continuation#Examples

13:51 Also, I think do-> in Enlive might be acting a little like the Reader monad?

13:51 dustingetz: dnolen has already implemented this, have you seen his work?

13:51 sego ^

13:51 wingy: i cant get live reload to work .. could anyone have a look at https://www.refheap.com/paste/5540 and tell me how to make it work?

13:52 djanatyn: I used quil to render my game of life simulation :)

13:52 Sgeo: dustingetz, read about it a bit, don't understand it, don't know if it's complete. If it is complete, I could [struggle] to build monad stuff on top of it

13:52 dustingetz: yeah i don't really understand it either

13:53 dnolen: dustingetz: well as a macro lib based off a Common Lisp implementation ... I make no promises about it's completeness.

13:53 aperiodic: devn: ah, the live coding wiki page gives an example of using a metronome: https://github.com/overtone/overtone/wiki/Live-coding

13:54 airolson: djanatyn: does Quil let you access the underlying OpenGL bits? can you muck about with shaders?

13:55 aperiodic: processing definitely does, so quil should too, but i don't know to what extent quil actively supports you doing that

13:56 jimduey: Sgeo: howdy

13:57 ohpauleez: jimduey has an alert for whenever someone says "monad"

13:58 :)

13:58 aperiodic: airolson: you can always fall back to just using JOGL directly and loading up your shaders through that, though that will probably require some mucking about behind quil's to get ahold of the JOGL object

13:58 *quil's API

13:59 i have tons of processing sketches that do this; i should port one to quil

13:59 jimduey: ohpauleez: Actually I do. :) Except it's not plugged into to growl, so I have to look at my IRC window to see the alerts.

13:59 ohpauleez: Ahh gotcha

14:02 Sgeo: I should set such an alert

14:02 Except I don't want it going off when I'm in #haskell

14:02 jimduey, also, sorry for falsely thinking that your maybe stuff violated the monad laws

14:03 (They don't as long as users can't construct ::nothing, as far as I can tell)

14:04 * gfredericks is relieved he won't have monad-arrest jimduey

14:04 airolson: aperiodic: thanks, I'll take a deeper look at quil.

14:04 wingy: in https://github.com/weavejester/lein-ring it says ":auto-reload? - If true, automatically reload modified source files. Defaults to true in development mode, false in production."

14:04 where is this specified?

14:04 * Sgeo is going to watch some Red vs. Blue now

14:06 wingy: in :ring key

14:06 https://github.com/weavejester/lein-ring/issues/43

14:16 how do i do $(this) in cljs?

14:17 Roxxi: Hey, I have a question about protocols- is it a matter of convention to have the first parameter of method to be an instance of an extending type/record?

14:17 wingy: (js/$ this) ?

14:17 Frozenlock: wingy: You must use the this-as macro

14:17 jimduey: Sgeo: np :)

14:17 Frozenlock: wingy: You can see it used here http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/

14:18 Chousuke: Roxxi: protocol methods dispatch on the first argument so no.

14:18 wingy: ok thx

14:19 Roxxi: Hmm, I'll try that. Thanks Chousuke.

14:21 Sgeo: Roxxi, if you want something more flexible, look into multimethods

14:21 defmulti and defmethod

14:22 Roxxi: Well, I want something like an interface so that as I introduce new datatypes, I can make new deftypes to deal with that...

14:23 Or is that the wrong paradigm?

14:25 dnolen: Roxxi: you can do that w/ protocols yes. But you can also do that with multimethods - but there you often don't need to bother w/ introducing new deftypes since the dispatch fn can be whatever you want.

14:26 hiredman: if you have a protocol P and a function F and F only operates on it's arguments via P, then F can operate on any object that satisfies P

14:27 Roxxi: dnolen: Can you extend multimethods from other modules later on?

14:27 dnolen: Roxxi: yes

14:28 Roxxi: dnolen: Hmm, well, it feels like multimethods are the wrong cut. I really want to keep the protocol so that as I implement new types the requirement of what needs to be implemented is clear.

14:28 dnolen: Roxxi: honestly the decision to use one or the other often boils down performance.

14:29 Hodapp: hiredman: This sounds a bit like duck typing

14:29 dnolen: Roxxi: sure, but protocols should only require users to implement 1 or 2 fns usually.

14:29 Roxxi: dnolen: sure none of the functions are particularly complicated, they're just specific to the role of an agent that implements this protocol.

14:30 dnolen: In fact, they're all predicates, describing about how to reason about data structures.

14:30 dnolen: since I have various implementations of datastructures, I need an agents that can answer the same fundamental questions for all of them.

14:30 alex_baranosky: do you guys have a SQL schema migration library favorite?

14:31 nsxt: alex_baranosky: check out lobos

14:31 technomancy: alex_baranosky: I have a handful of functions I haven't bothered to spin off into a library yet since they're so simple

14:31 lobos struck me as way too much

14:31 alex_baranosky: I see there is also ragtime and drift, right?

14:31 dnolen: Roxxi: without diving into more details - you still haven't said anything that makes it clear that multimethods or protocols are better. if you haven't used both - it might be worth prototyping in both styles - I can't imagine it being much code to do so. This is Clojure after all.

14:32 alex_baranosky: technomancy: that was my impression too

14:32 technomancy: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj <- all it takes is two functions: migrate + run-and-record

14:32 nsxt: alex_baranosky, technomancy: agreed, it is a bit overkill.

14:32 hiredman: https://github.com/pjstadig/migratus is what we use at work, it works, I guess

14:33 Roxxi: dnolen: I don't disagree with you there. I've done exercises with multimethods, this, in fact is my exercise with protocols- and, as such, I'm trying to wrap my head around them.

14:33 dnolen: Roxxi: gotcha, go for it then.

14:35 alex_baranosky: technomancy and hiredman: thanks for the suggestions, will take a look

14:39 akhudek: hadoop isn't the easiest thing to work with :-/

14:40 Roxxi: dnolen: I guess this is the problem I'm having, in essence: https://www.refheap.com/paste/5544

14:41 dnolen: Roxxi: yeah that's not how protocols work.

14:42 Roxxi: protocol fns take an extra arg - the instance

14:42 Roxxi: dnolen: That was my first question :)

14:43 dnolen: So I guess that answers that! Thanks!

14:44 dnolen: Oh, since you did mention it- you said it was a question of performance... I would guess protocols are "more performant" that multimethods- would that be right?

14:45 dnolen: Roxxi: much more so since they piggieback on the performance of Java interfaces when possibly.

14:45 Roxxi: dnolen: That's what I figured. Thanks :)

14:45 dnolen: Roxxi: and when they don't there's some fancy perfect hashing + fast table lookup + caching

15:16 wingy: saw a presentation about how to make clj stronger for long term survival .. a good shot would be promoting clojure/clojurescript/datomic/lighttable together so companies know they have all fronts covered with the best technonology

15:17 Datomic through Heroku would make clojure visible to everyone

15:24 `fogus: ProTip: Never name top-levels the same name as an aliased namespace in ClojureScript

15:25 dnolen: `fogus: heh that's actually fixed in master

15:25 `fogus: Brandon Bloom has an even better patch for that I'm planning on reviewing over the weekend.

15:26 `fogus: I revise my ProTip to: "on any version of ClojureScript released in the wild"

15:26 dnolen: `fogus: it's is/was a particularly bad bug - since the source of the error is pretty hard to determine if you're not looking for it.

15:27 `fogus: I hit this before too, but the failure mode depends on whatever the name happens to clash with. I'll never get the last 2 hours back :-(

15:27 dnolen: `fogus: :-(

15:27 pjstadig: It's Alpha™

15:28 `fogus: Patches Welcomed!©

15:29 amalloy: `fogus: sometimes it seems like dnolen must eat patches for breakfast. there's no other explanation for how quickly they get through jira

15:29 `fogus: dnolen: Doesn't eat... or so I've read

15:29 dnolen: amalloy: it's true, I do like to review patches while eating breakfast

15:30 nom nom

15:30 uvtc: It would take 10 bowls of your language's patches to equal the amount of bug fixes in just one bowl of dnolen flakes.

15:33 * Hodapp rolls eyes at uvtc

15:34 uvtc: so, I'm back and ... hey, who was typing goofball jokes into my irc client as me while I was away!

15:34 zerokarmaleft: uvtc: it's always the cat

15:40 Sgeo: How painful is ClojureCLR to work with? To get working in emacs etc?

15:54 * gfredericks is having trouble figuring out the easiest way to install a JS vm on which to run the cljs tests

15:55 dnolen: gfredericks: are you on OS X?

15:55 gfredericks: dnolen: ubuntu 12.04

15:55 downloaded spidermonkey and it doesn't seem straightforward to build

15:56 dnolen: gfredericks: yeah don't build it, there's instructions on the CLJS wiki, on how to get prebuilt jsshell

15:56 gfredericks: oh nice I'll check that out

15:56 dnolen: gfredericks: http://github.com/clojure/clojurescript/wiki/Running-the-tests

15:56 gfredericks: dnolen: shall I submit a patch for CLJS-383 since the other fellah hasn't yet?

15:57 technomancy: gfredericks: spidermonkey is in apt

15:57 dnolen: gfredericks: you do need to build v8, but you shouldn't have to build js-shell. getting JavaScriptCore working on Ubuntu will probably be annoying, but please add notes if you figure it out.

15:57 gfredericks: technomancy: yeah but there's no js executable

16:00 js-shell errors :(

16:00 * gfredericks tries building v8 instead

16:02 technomancy: huh; there used to be

16:02 gfredericks: `which js` and `find / -name js` both return nothing

16:04 * gfredericks processes triggers for man-db

16:34 wingy: how do i check if a value is in a vector?

16:35 gfredericks: ,(doc vector?)

16:35 clojurebot: "([x]); Return true if x implements IPersistentVector"

16:35 wingy: i mean

16:35 uvtc: ,(doc some)

16:35 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

16:35 gfredericks: ,(vector? (transient [1 2]))

16:35 clojurebot: false

16:35 wingy: if a value is IN a vector

16:35 gfredericks: wingy: pardon my readings

16:35 pandeiro: wingy: (empty? (filter your-pred-here vec))

16:35 SegFaultAX|work: wingy: ,(some #{3} [1 2 3 4 5])

16:36 ,(some #{3} [1 2 3 4 5])

16:36 clojurebot: 3

16:36 SegFaultAX|work: ,(some #{"foobar"} [1 2 3 4 5])

16:36 clojurebot: nil

16:37 gfredericks: ,(some #{nil} [1 2 nil 3 4])

16:37 clojurebot: nil

16:37 wingy: SegFaultAX|work: nice trick

16:39 thorbjornDX: ,(some #{nil} [1 2 3 4])

16:39 clojurebot: nil

16:39 * thorbjornDX dies

16:40 uvtc: thorbjornDX: You did it right; `nil` was not in that vector, so `some` returned `nil`.

16:40 It was a different nil. :) {snicker}

16:41 thorbjornDX: uvtc: maybe I should apply metadata to the nil that's in the collection or something

16:41 chouser: nope

16:41 if you need to check for nil, you'll have to use something other than a simple #{nil} set

16:42 SegFaultAX|work: ,(every? (complement nil?) [1 2 3 4 5])

16:42 clojurebot: true

16:42 SegFaultAX|work: ,(every? (complement nil?) [1 2 nil 4 5])

16:42 clojurebot: false

16:42 thorbjornDX: chouser: that'd be a use case for nil? ^

16:42 gotcha SegFaultAX|work

16:42 gfredericks: ,(some #(= nil %) [1 2 nil 3 4])

16:42 clojurebot: true

16:42 chouser: right

16:43 SegFaultAX|work: I liked mine better :D

16:43 gfredericks: clojure likes idioms that ignore exactly 2 edge cases

16:43 thorbjornDX: gfredericks: isn't (= nil sommat) bad somehow? I can't remember if that's the case for clojure

16:43 hyPiRion: ,(not-any nil? [1 2 nil 4 5])

16:43 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: not-any in this context, compiling:(NO_SOURCE_PATH:0)>

16:43 gfredericks: thorbjornDX: I don't believe so

16:43 hyPiRion: ,(not-any? nil? [1 2 nil 4 5])

16:43 clojurebot: false

16:43 Sgeo: gfredericks, this makes me sad

16:43 gfredericks: Sgeo: me too

16:43 * gfredericks has been learning haskell

16:46 zmaril: Are there tools for working with grammars of another language in clojure?

16:47 jtoy: can someone help me with this newb clojure issue: https://gist.github.com/625d3b1666a949bb1baf I'm trying to convert a function to use clojure.java.io/resource

16:48 gfredericks: jtoy: what's the issue?

16:48 jtoy: gfredericks: I get errors such as java.lang.IllegalArgumentException: No single method: make_input_stream of interface: clojure.java.io.IOFactory found for function: make-input-stream of protocol: IOFactory (sentiment.clj:28)

16:49 I tried with input-stream, make-input-stream make-reader

16:49 hiredman: jtoy: call input-stream

16:49 make-* are internal helpers

16:50 jtoy: the error you got when you used input-stream would have been different an actually informative

16:50 something like "cannot cast inputsream to reader" or something

16:50 since line-seq takes a reader

16:50 jtoy: hiredman: I get a different error: java.lang.IllegalArgumentException: No implementation of method: :make-input-stream of protocol: #'clojure.java.io/IOFactory found for class: nil (NO_SOURCE_FILE:0)

16:50 hiredman: so you can skip input-stream and call reader on the result of resource instead

16:51 jtoy: becuase resource is returning nil

16:51 amalloy: chouser: am i crazy for wanting (#{x} y) to return true/false rather than y/nil? i can count on one finger the number of times i've cared about anything but the truthiness of calling a set as a function

16:51 jtoy: yeah, i just saw that, doh

16:51 hiredman: so you file isn't on the classpath, or isn't on the classpath where you think it is

16:51 jtoy: this is what I got now though: java.lang.ClassCastException: java.io.BufferedInputStream cannot be cast to java.io.BufferedReader (NO_SOURCE_FILE:0)

16:52 hiredman: yeah, so call reader

16:52 instead of input-stream

16:52 technomancy: amalloy: on the other hand: I've never put nil in a set on purpose

16:52 jtoy: yeah, reader worked,

16:52 I'm not exactly sure what the difference between all those things are

16:52 chouser: amalloy: Doesn't sound crazy. But neither does having it act like maps, vectors, etc. and return the thing found.

16:53 hiredman: jtoy: generally inputstreams for reading binary data, readers are for reading text data

16:53 amalloy: chouser: i argue that that is crazy, because then you can't use sets as predicates in any general-purpose code, just in case there's a nil or false

16:54 (defn configured? [x] (some #{x} configs)) for example

16:54 gfredericks: technomancy: it's nice to not have a subprocess in your head that does edge-case checks whenever you see such things

16:54 hiredman: (doc contains?)

16:54 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

16:55 * hiredman uses contains? a lot

16:55 gfredericks: hiredman: but unfortunately (some #{x} ...) gets encouraged

16:55 amalloy: yes, obviously contains? is necessary to write correct code. but it would be nice if calling a set as a function did something useful instead

16:56 chouser: amalloy: you can't use get or map-as-fn to test for existence either, in those cases. contains? and find both do well, regardless of whether you're dealing with sets or maps

16:57 hiredman: gfredericks: some #{x} means you may want to switch datastructures

16:57 chouser: There's so much bikeshedding potential in a language. Even Rich doesn't consistently apply his design standards to everything.

16:58 hiredman: I was surprised to see the column thing land

16:58 and that it is 1 indexed

17:00 gfredericks: hiredman: were there previously arguments against it, or was it just not valued enough?

17:01 hiredman: gfredericks: I thought the previous reaction to columns was "meh"

17:03 thorbjornDX: I'm having trouble with list comprehensions in that mine end up becoming nested. Should I make an effort to put all of my for bindings in the top loop?

17:03 amalloy: if you don't want nested collections as an output

17:04 thorbjornDX: amalloy: I generally destructure the sequences somehow, but in this case I'd rather just map a fn to a single sequence

17:05 amalloy: how is that relevant?

17:05 gfredericks: thorbjornDX: depends on if you need your result to be nested or not

17:06 callen: it really bothers me how often builds/cabal fails

17:06 like, really really.

17:06 thorbjornDX: I guess I haven't gotten the hang of dealing with nested sequences :<

17:06 callen: they go through all this hassle to make such a rigorous language, informative type system, the works, and they can't replace a well-constructed Makefile.

17:06 lein, virtualenv+pip+requirements.txt, sbt are all more reliable.

17:07 gfredericks: ,(let [nested-seq [[1 2 3] [:a :b :c] [] ["heh"]]] (for [seq nested-seq, x seq] x))

17:07 clojurebot: (1 2 3 :a :b ...)

17:08 thorbjornDX: gfredericks: ah, good example. Thanks

17:10 ordnungswidrig: (defn foo {:a 1}) is accepted but (foo) throws an NPE in Compiler.analyzeSeq

17:10 this is in 1.4.0

17:11 same with (defn foo)

17:16 wingy: sorry for a noob question again .. why isn't this correct: (set! (.-defaultPageTransition js/$.mobile) "none")

17:16 i wanna set $.mobile.defaultPageTransition = "none"

17:17 antares_: wingy: it then should be without the -

17:17 wingy: antares_: someone told me that that is how you access a property

17:18 antares_: I only use JVM Clojure but you typically only use leading dashes in gen-class

17:18 duck1123: (set! (.-defaultPageTransition (.-mobile js/$)) "none")

17:20 One of the tricks I've been using is if I have a lot of props like that, I put (def mobile (.-mobile js/$)) in a ns that I require with an alias, then I can refer to it as jquery/mobile

17:21 aperiodic: antares_: in jvm clojure, it's only necessary to use .- to access a property if there's also a zero-arg method of the same name, but i think they only added it in 1.4

17:22 wingy: duck1123: it worked

17:22 i did something like this instead though (set! (-> js/$ .-mobile .-defaultPageTransition) "none"))

17:22 easier to read as usual with ->

17:22 duck1123: that works too

17:24 gfredericks: wingy: (-> js/$ .-mobile .-defaultPageTransition (set! "none")) :)

17:26 duck1123: so, perhaps we need a (set-in! [js/$ modile defaultPageTransition] "none") macro

17:27 wingy: duck1123: yeah that would rock

17:27 like get-in but for set

17:27 gfredericks: yeah that works too :)

17:27 so many ways of doing it compared to js

17:28 duck1123: of course, set! is too dirty as it is, no need to make it easier

17:28 stupid non-functional third party libs

17:28 pandeiro: duck1123: necessary evil with javascript apis

17:28 wingy: duck1123: but shouldnt it be more like: (set-in! js/$ [mobile defaultPageTransition] "none")

17:29 to resemble get-in

17:29 pandeiro: and technically those keys are strings in js but i guess the macro could abstract that away

17:30 wingy: (set-in! js/$ ["mobile" "defaultPageTransition"] "none")

17:30 duck1123: you could do that as a fn if you were willing to use aset

17:32 although, doesn't aset mess with advanced compilation, or does Closure take care of that?

17:33 pandeiro: i would like something like (setobj! js/$ [[:mobile :defaultPageTransition] "none" [:otherProperty false]]) ;=> would return js/$

17:33 oops nvm the brackets around :otherProperty false

17:36 amalloy: (doto js/$ (-> (.-mobile) (.-defaultPageTransition) (set! "none")) (-> (.-otherProperty) (set! false)))?

17:36 i mean, wrap it up in a macro if you want, but it's not something you need as a language-level feature

17:38 thorbjornDX: amalloy, gfredericks: I was able to figure out my seq-of-seq issues. I used :let in the middle of my for bindings to do it in one list comprehension

17:38 gfredericks: thorbjornDX: ah right

17:38 yay :let

17:39 if only for allowed initial :lets we could get rid of let altogether

17:39 thorbjornDX: gfredericks: do you know if I can do (for [a blah b blah :let [cs a] c cs :let [d c]]) ?

17:39 gfredericks: multiple :lets I mean

17:40 amalloy: thorbjornDX: i'm sure your repl knows

17:40 thorbjornDX: amalloy: good point :)

17:42 gfredericks: it'd probably be more complicated to write a for that didn't work that way

17:43 thorbjornDX: gfredericks: gotcha. amalloy: sorry for the silly questions, I appreciate your help.

17:45 * gfredericks has usually asked no less than three repl-answerable questions in #clojure by breakfast

17:46 devn: Hm, I seem to have lost arglist hints in my command minibuffer in emacs

17:46 any idea on how to get it back?

17:46 (not sure what changed...)

17:48 amalloy: M-x eldoc-mode

17:48 probably

17:49 Sgeo: Hmm, I don't understand. Why is lein repl the wrong way to mess with a Compojure project?

17:50 Raynes: Who said it was?

17:50 Sgeo: The fact that I couldn't figure out what I was doing when I tried to do it

17:50 weavejester: Yeah, I don't see any problem with using the REPL

17:50 Sgeo: With a project made with lein new compojure

17:50 pandeiro: Sgeo: you mean mocking the requests and whatnot?

17:50 technomancy: I always launch my compojure projects from a repl

17:50 weavejester: You just need to make sure that the adapter doesn't join with the current thread

17:51 Sgeo: I mean to modify and test code from the REPL

17:51 weavejester: Modify code?

17:51 Do you mean reloading code?

17:52 Sgeo: Yes

17:53 If I save project.clj and am using lein ring server, will that be reloaded, or would I have to restart the server?

17:53 weavejester: You'd need to restart

17:53 Same if you use lein repl

17:57 Sgeo: How does the auto-restarting stuff work?

18:03 weavejester: Sgeo: It injects some Javascript into responses with a content-type of "text/html" and a <head> element

18:03 Sgeo: (i.e. a well formed HTML page)

18:03 Sgeo: It also adds a route that the Javascript polls for changes.

18:04 gfredericks: omg; in the clojurescript project I can make the advanced version of the tests crash by _removing_ a test.

18:04 Sgeo: weavejester, hmm, I might not be referring to that

18:04 weavejester: Sgeo: Do you mean the reloading?

18:04 Sgeo: Considering that this toy page that has HTML and a head element doesn't have any Javascript injected in it

18:04 weavejester, I might

18:05 TimMc: gfredericks: THat's because you should always have more tests! Working as designed, WONTFIX.

18:05 gfredericks: lol

18:05 weavejester: Sgeo: It watches for changes and then reloads any changed namespaces (and any dependent namespaces) using (require namespace :reload)

18:05 Sgeo: gfredericks, uh, so a test is side-effecting? That's kind of scary

18:05 gfredericks: Sgeo: no it's not

18:06 this is much deeper-spookier

18:06 the test is (let [f (fn ([]) ([a & more] more))]

18:06 (assert (nil? (f :foo))))

18:07 I mean technically assert is side effecting. But not in such a way that removing it would crash something.

18:07 especially considering when the test is there everything runs fine (i.e., no assertion error thrown, so it doesn't actually side-effect)

18:08 Sgeo: Wait, what does (fn ([]) ...) mean?

18:08 With parens around the arg vector

18:08 gfredericks: call with no args and it returns nil

18:08 Sgeo: Oh, that's for multiple arities?

18:08 gfredericks: yeah

18:08 ,((fn ([])))

18:08 weavejester: I was confused at first, but it's the same as (fn ([] nil) …)

18:08 clojurebot: nil

18:10 gfredericks: ,((fn([]((fn([]((fn([]((fn([]))))))))))))

18:10 clojurebot: nil

18:10 Bronsa: w-woah

18:10 gfredericks: Bronsa: that's how the pros do it.

18:11 Bronsa: i seriously hope you used paredit

18:11 gfredericks: well paren-matching

18:11 pandeiro: would that be considered a higher order function?

18:11 thorbjornDX: Bronsa: I had to copy-paste that to get my rainbow-parens just to keep sane

18:11 Bronsa: heh

18:11 i'm not even trying to parse that in my mind

18:12 gfredericks: ((fn([]((fn([]((fn([]((fn([])))))))))))) ;; enterprise strength

18:12 aperiodic: Bronsa: if you want to really blow your mind, check out TimMC's non-alphanumeric factorial: https://gist.github.com/3036120

18:13 Bronsa: that's

18:13 aperiodic: (inc TimMc)

18:13 lazybot: ⇒ 19

18:13 Bronsa: wtf.

18:13 what is that.

18:13 aperiodic: dude is nuts

18:13 thorbjornDX: (inc TimMc)

18:13 lazybot: ⇒ 20

18:13 Bronsa: hehe

18:13 ,(+ (*)(*)(*)(*)(*)(*)(*))

18:13 clojurebot: 7

18:13 Bronsa: this is cheating

18:14 insanely awesome though

18:14 Sgeo: aperiodic, I was going to ask if that was based on lambda calculus

18:14 But it now looks more like a trick of (*) being 1

18:15 ...not that I understand it at all

18:15 gfredericks: one of many tricks

18:15 gert_: I have a form that includes :line meta data - is there a way to eval the form that gives me line number information in a stack trace when there is an error?

18:16 Sgeo: I'd like to see a version based off of lambda calculus

18:16 But then how to get it to print...

18:16 And also, there's no nested lambdas in Clojure without fn :(

18:19 technomancy: clojurebot: factorial is not something you need alphanumeric characters for: https://gist.github.com/3036120

18:19 clojurebot: c'est bon!

18:20 gfredericks: what are the group/artifact IDs for clojurescript?

18:20 technomancy: that is a work of art indeed

18:20 amalloy: Sgeo: there's no nested lambdas without creating lambdas? that doesn't seem like a disadvantage

18:20 gfredericks: amalloy: thus no non-alphanumeric nested lambdas

18:20 aperiodic: factorial?

18:20 Sgeo: amalloy, as in, with #() and % inside them

18:20 clojurebot: factorial is not something you need alphanumeric characters for: https://gist.github.com/3036120

18:21 arrdem: `(re Bronsa's above) OMGWTFBBQ

18:30 Sgeo: Lamina's pipeline is the Reader monad.

18:30 Enlive's do-> macro is related to the Reader monad

18:30 That's it, Clojure officially needs one idiom to support the Reader monad.

18:30 Even if it's not easy and convenient generalized monads.

18:50 TimMc: Bronsa: Cheating? You cast aspersions upon my character!

18:51 Bronsa: hahah

18:51 TimMc: I would never cheat when writing horrifying code...

18:51 Wait, yes I would.

18:53 Bronsa: It's all gfredericks' fault anyhow.

18:53 Sgeo: I wonder if there are any easier languages that compile into Malbolge

18:54 Bronsa: TimMc: you can't blame others for your own code :P

18:55 TimMc: Sgeo: I believe Malbolge has yet to be cracked.

18:55 Sgeo: There's a Hello world for Malbolge

18:56 TimMc: I think that was brute-forced, though.

18:56 Sgeo: Hmm

18:58 TimMc: Bronsa: I can pretty much guarantee you'll learn some things if you grok that factorial code. Start with the version at the bottom (cheats by using "if") and replace all number-generating forms with numeric literals.

18:59 Bronsa: well, im not sure i want to read that.

18:59 TimMc: The top version just gets rid of the "if" and takes a slightly more principled approach to dispatch.

18:59 Bronsa: i can imagine you're using vectors as functions

18:59 and storing lambdas in it

18:59 TimMc: A little bit.

18:59 Bronsa: then using that (*) trick to get the nth element

19:00 TimMc: More importantly, I'm using a primitive (and hella easier to understand) version of the Y combinator to get recursion.

19:00 Bronsa: oh.

19:00 * TimMc commutes

19:01 Bronsa: you're horrible code is awesome though.

19:01 your*

19:01 brain fart

19:16 aperiodic: ah, so x TimMc y = y TimMc x. i'd suspected as much

19:29 zmaril: When using core.match, is there any easy way to keep variables from matching on nils?

19:29 So something like ([varname ([typeid index-name key value] :seq)] :seq)

19:29 Roxxi: How do you define a macro so that you can have some sugar that doesn't get evaluated- so that you could make a form like (foo x y => z) and it boils down to (bar x y z)

19:30 zmaril: Wouldn't match [1 2] with key and value as nil

19:32 wingy: how do i create a sequence out of multiple args

19:33 eggsby: wingy: list?

19:33 wingy: eg. (some-fn "string1" "string2")

19:33 => ("string1" string2")

19:33 eggsby: you want (defn some-fn [& args])

19:33 Roxxi: wingy: (defn some-fn [& args] args)

19:34 kovasb: there is also (list "a" "b")

19:34 wingy: im testing list

19:34 need it for hiccup

19:35 using (for) loop to generate multiple elements on each iteration

19:35 for loop only takes one body so i need to do (for […] (list el1 el2))

19:35 worked great

19:35 thx all

19:39 TimMc: aperiodic: Not anymore! I'm home now. :-)

19:40 Sgeo: Why not a vector?

19:40 ,(for [i (range 3)] [(dec i) i (inc i)])

19:40 clojurebot: ([-1 0 1] [0 1 2] [1 2 3])

19:41 Sgeo: Oh, probably because of the special meaning in hiccup?

19:41 ,(for [i (range 3)] ((juxt dec identity inc) i))

19:41 clojurebot: ([-1 0 1] [0 1 2] [1 2 3])

19:43 Sgeo: ,(dec list*)

19:43 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core$list_STAR_ cannot be cast to java.lang.Number>

19:43 Sgeo: ,(doc list*)

19:43 clojurebot: "([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."

19:43 Sgeo: Writing (partial apply list) sounds silly

19:43 :/

19:47 wingy: ceil is not a part of core .. is there another way to convert a number to the lower integer?

19:48 Sgeo: Hmm?

19:48 wingy: i meant floor when i said lower integer .. anyway

19:48 Sgeo: As in ##(Math/floor 1.6)?

19:48 lazybot: ⇒ 1.0

19:48 wingy: yeah

19:48 oh Java :)

19:48 Sgeo: I'd be tempted to write comp, but can't comp with Java methods :(

19:51 dnolen: woot, found one big source of the core.logic tabling perf issue

19:54 gfredericks: dnolen: Thread/sleep?

19:58 dnolen: gfredericks: ha!

19:58 gfredericks: list -> set

19:58 gfredericks: oh nice

19:58 I love that kind of speedup

19:58 dnolen: gfredericks: minor change in the end.

19:59 gfredericks: could still do a lot better but that would require some hammock time.

20:14 * gfredericks wants to write a core.logic program for http://projecteuler.net/problem=185

20:16 dnolen: gfredericks: fun

20:16 hiredman: seems straight forward, you can treat it as a a sequence of strings/characters

20:17 gfredericks: hiredman: the question is if it would be efficient or not

20:18 gert_: I'm building a fairly complex DSL, where I use clojure.lang.LispReader/read and a LineNumberingPushbackReader to preserve line number information. I am trying to use this line number information, e.g. after catching a clojure.lang.LispReader$ReaderException, but I don't know how. any ideas?

20:28 mindbender1: dnolen: what's the idiomatic way to write components in clojurescript

20:29 like a tree panel

20:29 without resorting to 3rd party libs

20:33 dnolen: mindbender1: that's not really a simple question, but I would probably try to do it similarly to how I would do it in JS.

20:33 kovasb: dnolen: u gonna be hacking this weekend?

20:35 mindbender1: dnolen: I don't mind writing something from scratch I'm tired of trying to interop with 3rd party libs

20:35 I'd rather build something on google closure. what do you think I need a little push

20:36 dnolen: kovasb: yeah I was hoping to wrap up some of this core.logic FD stuff

20:36 mindbender1: well I'd be suprised if Closure doesn't have that widget already.

20:37 kovasb: dnolen: cool. interested in some co-hacking on saturday or sunday?

20:37 dnolen: mindbender1: just go for it

20:37 hiredman: the closure widgets are tricky, the js stuff tends to be documented, but the css stuff that goes along with them (in the few I have looked at) is not documented, and you have to look at the examples

20:37 mindbender1: dnolen: it doesn't I'm surprised my self.

20:37 dnolen: ok

20:37 dnolen: kovasb: sure! I'll be at my studio most of Sat, Sun is booked.

20:38 mindbender1: hiredman: that's true

20:39 kovasb: dnolen: sweet. DM me on the twitter tomorrow when ur kicking off, will swing by!

20:40 dnolen: kovasb: sounds good!

20:48 wingy: cond was pretty good as a if else statement

20:53 what is the easiest way to check if both "foo" and :mandatory is in ["foo" :mandatory]

20:53 dnolen: wingy: =

20:54 wingy: ah!

20:54 no

20:54 what if there is more than those elements

20:54 is my best bet nested (if) ?

20:55 gfredericks: wingy: you want to know if they both appear in any position in a vector?

20:55 wingy: gfredericks: yeah

20:55 dnolen: (every? #(some #{%} some-sequential-thing) list-of-things-to-check-for)

20:56 ,(every? #(some #{%} ["foo" :mandatory]) ["foo" :mandatory])

20:56 clojurebot: true

20:56 dnolen: ,(every? #(some #{%} ["foo" :bar :mandatory]) ["foo" :mandatory])

20:56 clojurebot: true

20:56 dnolen: ,(every? #(some #{%} ["foo" :baz :mandatory]) ["foo" :mandatory])

20:56 clojurebot: true

20:56 dnolen: ,(every? #(some #{%} ["foo" :baz]) ["foo" :mandatory])

20:56 clojurebot: false

20:57 gfredericks: ((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :baz])

20:57 ,((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :baz])

20:57 clojurebot: false

20:57 Sgeo: Don't use sets for containment checks like that :(

20:57 gfredericks: ,((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :mandatory])

20:57 clojurebot: true

20:57 wingy: wow

20:58 dnolen: Sgeo: that makes no sense

20:58 gfredericks: wingy: don't use mine

20:58 wingy: gfredericks: too hard to get :)

20:58 gfredericks: dnolen: we were discussing it earlier and grumping about the nil/false edge case

20:58 wingy: trying to get dnolen's

20:58 dnolen: gfredericks: doesn't apply to set containment check

20:58 Sgeo: ,(some #{nil} [1 2 nil 3])

20:58 clojurebot: nil

20:59 gfredericks: dnolen: ^ sure it does?

20:59 dnolen: Sgeo: gfredericks: ...

20:59 maintain your invariants ... moving on

21:00 * gfredericks feels like communication has failed somehow

21:03 dnolen: gfredericks: I'm just saying that if you have a list of literals and you know that you're never checking for false-y values, there's nothing wrong with the set containment approach. I see no point in advising against it is all.

21:04 wingy: this one checks for strings (some string? ["asd" :asd]) .. how do i check that it is only ONE string in the vector

21:05 gfredericks: dnolen: I agree that it doesn't apply to this case

21:05 I was mostly giving context to Sgeo's statement

21:05 Sgeo: Oh sorry >.>

21:06 wingy: i guess i could filter it to a seq

21:06 or a list

21:06 then just count the items

21:06 (count (filter string? ["asd" :asd]))

21:06 wii

21:06 gfredericks: ,((comp #{1} count (partial filter string?)) [1 4 "hehe" :okay])

21:06 clojurebot: 1

21:07 gfredericks: ,((comp #{1} count (partial filter string?)) [1 4 "hehe" :okay "WAT"])

21:07 clojurebot: nil

21:07 wingy: ,(count (filter string? ["asd" :asd]))

21:07 clojurebot: 1

21:07 wingy: ,(count (filter string? ["asd" :asd "adsad"]))

21:07 clojurebot: 2

21:07 gfredericks: wingy: or use mine and have unreadable code

21:07 wingy: yeah

21:12 can't set be used as a function without some ?

21:12 dnolen: wingy: yes

21:12 wingy: ,(#{1} [1])

21:12 clojurebot: nil

21:13 dnolen: wingy: [1] does not exist in that set

21:13 ,(#{[1]} [1])

21:13 clojurebot: [1]

21:13 wingy: i c

21:53 holo: hi

21:55 why is clojure.java.shell's "sh" function so slow? what is that function doing?

21:56 hiredman: slow compared to what?

21:57 holo: hiredman, compared to commands executed in a bash prompt, e.g.. it's impossible not to notice it

22:00 hiredman, the (sh ..) command sits there, doing something, for alot of seconds. even after returning the map with the return code, :in and :out

22:01 hiredman: uh

22:01 that is not the sh command then, if the function has returned, it has stopped running

22:01 most likely it is however you are running your repl

22:02 holo: hiredman, `lein exec -p ...` it is

22:07 hiredman, it's not critical at this time to fix this. it's working with enough performance, even if it takes more than 1 minute to load a prompt. i think from what you say, this problem may be obscure to solve

22:14 amalloy: hiredman, holo: shutdown-agents

22:19 wingy: can i count on the ordering of keys in a map?

22:20 i think i better use a vector for ordering

22:22 xeqi: wingy: no, ordering of keys in a map is not guaranteed. https://github.com/flatland/ordered might help

22:22 wingy: okay

22:37 holo: amalloy, thanks. it's even referenced in the docs: http://clojuredocs.org/clojure_core/clojure.java.shell/sh " for discussion of an undesirable 1-minute wait that can occur before. your standalone Clojure program exits if you do not use shutdown-agents."

22:46 arrdem: is there a vimclojure command to auto-format a file?

23:31 wingy: how do i check if a value is boolean

23:33 seems to be no boolean?

23:37 unlink: What do you mean by "is boolean"?

23:37 Is one of the values true or false?

23:37 wingy: unlink: yeah i wanna check if its a boolean

23:38 like (number? val) but for boolean eg. (boolean? val)

23:39 unlink: How about (contains #{true false} val)?

23:40 wingy: i guess that will do

23:40 surprised that there is no boolean?

23:40 there is for all other types

23:40 inconsistent

23:41 unlink: There are a lot of types.

23:41 wingy: but Boolean is a core type

23:41 unlink: so are byte, long, etc

23:42 wingy: perhaps i should check the type instead

23:43 (type)

23:43 much better :)

23:46 Sgeo: Is it just me, or do InputStreams look absolutely ugly to use in terms of Java?

23:54 xeqi: (doc bool)

23:54 clojurebot: It's greek to me.

Logging service provided by n01se.net