#clojure logs

2012-10-05

00:17amalloyLSH: liquor-soaked heuristics?
01:27SgeoSuppose I have (def my-map (agent {:a 1 :b 2}))
01:27SgeoOne thread does (send my-map assoc :a 3)
01:27SgeoAnd another thread is (send my-map assoc :b 4)
01:28SgeoCan those run at the same time, or will there be waiting?
01:46amalloySgeo: can you imagine a universe in which it's possible for those to run at the same time?
01:47SgeoIf send, maps, and assoc conspired together in these circumstances?
01:47SgeoAlthough that's somewhat silly
01:48amalloysure, help yourself to as much secret conspiracy as you like
01:49SgeoSo maybe I should use a map that contains mutable entities that contain maps that ... etc
01:49SgeoSeems more difficult to work with though
01:50amalloywhat exactly are you trying to optimize here? it sounds like you don't yet have any idea what will be your bottleneck
01:52SgeoDifferent threads are likely to be changing different keys
01:59ivanSgeo: maybe you just want a ConcurrentHashMap?
02:00amalloythat's fine, but unless the operations on each key are terribly expensive it's not really worth introducing all this mutability
02:00amalloyyou 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
02:01SgeoNot so much that they're expensive, but there are a lot of them
02:05amalloybut then the main overhead is messing with the hashmap's keys, which clearly can't be parallelized
02:26kkspeedhello 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
02:26kkspeedseveral times, the buffer won't show up again. Hope anyone can help.
02:56Sgeohttps://github.com/drewr/postal
02:56SgeoUh, why does this thing use metadata in its API like that?
03:04ivan"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
03:05ivannope
03:17RaynesSgeo: Don't know, but that certainly isn't what it is for.
03:34wei_I'm having some trouble with the extensible reader in ClojureScript. How would I register a tag parser to parse this? #<ObjectId 506d76689fba06037a871458>
03:41kralnamaste
03:46wei_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?
03:48clgvwei_: I thought self-defined tags need a namespace
03:49wei_I don't believe so. on the ClojureScript side, you can define it with reader/register-tag-parser!
03:51wei_on the server side, I'm serializing with (pr-str data). I'm on Clojure 1.4. did the tag format change recently?
03:52clgvit was introduced with 1.4 afaik
08:17sundbphi. is this the wrong way to exclude clojure.core/future form a namespace? (ns foo (:refer-clojure :exclude [future]))
08:18sundbpit 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..."
08:19antares_sundbp: it's the right way but ns is also a macro
08:20antares_sundbp: you may need to use http://clojuredocs.org/clojure_core/clojure.core/refer-clojure directly above the ns macro
08:21sundbpantares_: hm. ok. i shall give it a go
08:27sundbp_antares_: turns out it was a weird sate my swank session got stuck in. a restart and my statement seems fine. thanks though
08:29abaloneif 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?
08:32wingyhow should this code look like in cljs? $.mobile.defaultPageTransition = 'none';
08:34gtrak`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
08:40gtrak`looks like CTMC and programming erlang are the only things that might cover it on Rich Hickey's clojure bookshelf
08:41pandeirowingy: (set! (.-defaultPageTransition js/$.mobile) "none")
08:41pandeiro(i think)
08:43clgvsundbp: that ns statement should be fine.
08:45clgvsundbp: maybe the clojure.core/future symbol is already referred to in the namespace in your repl. just restart it and check
08:45wingypandeiro: it was correct
08:45wingythx
08:45wingywhy the minus on .-defaultPageTransition ?
08:47pandeirowingy: property access
08:47wingyah
08:47pandeirob/c javascript is ambiguous about whether something is a prop or method
08:54bosiei am trying to get a handle on leiningen and midje but can't seem to get it running
08:55bosiei added the dependency to project.clj but i can't get Intellij to pick up the dependency
08:57wingypandeiro: i think they forgot that in the comparison site
08:58pandeiropretty sure it is on fogus' cheatsheat
08:58bosie"(ns foo.testme (:use midje.sweet))" results in FileNotFoundException
08:58pandeiroor on himera
08:58wingyyeah
08:58wingywished there was a cljs to js
08:58wingyfast mass editing
09:00pandeirowingy: you're using jquery mobile?
09:00wingypandeiro: yepp
09:00bosienow it works. hm
09:01wingythe best framework ever
09:01pandeirofor actual mobile development?
09:01wingymobile/tablet/desktop/laptop
09:01wingybad name actually .. nowadays it works for all envs
09:01pandeiroit might be pretty heavy to have jq+jqmobile+cljs for a small device
09:02pandeirojust a consideration before you convert your codebase
09:02wingyyeah
09:02wingyneed to use a framework for frontend though
09:02wingyit was okay when using regular js .. hope cljs wont change that much
09:03wingyin worst case scenario i have to use advanced mode
09:03pandeiroadds at least 100k
09:03pandeirothat is best case scenario
09:03gfrederickswingy: did you ask that "how do I translate this to cljs" just now?
09:03wingygfredericks: yeah
09:03wingybut pandeiro gave me an anwer
09:03gfredericksdid I answer it?
09:03wingyno
09:03wingy:)
09:03pandeirogfredericks: pass it over here?
09:04gfredericks:P
09:04pandeirowingy: just wrapping clojure lib and parts of gclosure = 100k in advanced compilation
09:05wingypandeiro: you mean 100k still in advanced compilation?
09:05wingyor 100k going away
09:05pandeiroyep, last i checked
09:05wingyok
09:05pandeiroplus whatever your code adds
09:05pandeiroplus jquery etc
09:05wingymm
09:05wingyhope they have upgraded their devices to iPhone 5 :)
09:05pandeiroi'm sure a galaxy s3 can slice through it with ease
09:06pandeiroyeah
09:06wingyneed to use cljs
09:06pandeirothe javascript, it burns
09:06bosieok, no error/exception now
09:06bosiebut no assertions either
09:06wingypandeiro: isn't cljs converted to js on server side?
09:07wingywhy is still a lot of code needed on client side?
09:07pandeirowingy: cljs is compiled and deployed as regular js
09:07pandeiroit has to include the entire clojure standard lib, parts of google closure, plus your code
09:07Hodapppandeiro: I have one here for work that has practically nothing on it. Want me to test anything?
09:07wingyi c
09:08wingyyeah it has a pretty big std lib
09:08pandeiroHodapp: thks i'm not devving anything but i envy you!
09:08wingybut advanced mode should remove that
09:08bosiehttps://gist.github.com/3839706
09:08wingypandeiro: what are you using on frontend?
09:08pandeirowingy: do a test and see, are you using lein-cljsbuild?
09:08wingyyes
09:08pandeirowingy: add an advanced compile target and see the size of the file
09:08Hodapppandeiro: 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.
09:09pandeiroHodapp: i dream about the S3 these days since my nexus died
09:09pandeiroi am sick
09:09Hodappawwww
09:09bosiepandeiro: may i ask what happened to your nexus? (which nexus?)
09:09pandeirowife threw it on the floor
09:10bosiepandeiro: sorry to hear. i can avoid that with my nexus; by having no wife
09:10bosie;)
09:10pandeirobosie: that works
09:10pandeiroit was a nexus one, already no functioning power button, battery was shot, but i loved it
09:10wingy707.81KB atm
09:11wingyalmost 1 MB jezz
09:11bosieanyone know what i did wrong with the midje setup that midje/clojure doesn't recognize the fact macro?
09:11HodappI have a Nexus 7, rather liking it
09:11pandeiroHodapp: damn you can you just shut up?
09:11pandeiro;)
09:11pandeiroi heard they are releasing one with 3G at the same price point before year end tho
09:12pandeiroand one w/o at $99
09:12bosiemy fault
09:12bosieit seems to run but a 'bug' reports the wrong stats
09:12duck1123bosie: so when you require midje.sweet it doesn't know about midje.sweet/fact ?
09:13bosieduck1123: it does now. but it reports "Ran 0 tests containing 0 assertions"
09:13wingyif I bring my iPhone to US .. how can I make internet working?
09:13wingynvm
09:13bosieduck1123: if i add a failing assertion, it still says 0/0 but also reports the test failed
09:14duck1123if you're using midje, you might want to check out lein-midje, it gives better reporting in that case
09:14wingyperhaps its not worth having cljs actually
09:14wingyim not doing much on client side
09:14wingybut i hate to write js
09:15wingyplus I might write more over time .. better with cljs cause it scales
09:16duck1123wingy: if you're using cljs you're more likely to say "this is awesome" and write a whole bunch more
09:16wingyyepp
09:16duck1123I have a project at work that I'm really regretting not picking cljs from the start
09:18bosieduck1123: wicked. just installed it. looks nice
09:18wingyduck1123: too much too convert?
09:18wingyto
09:19wingylein-cljsbuild is awesome .. rapid building
09:19wingy1.5 s
09:19duck1123wingy: 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
09:20pandeirowingy: my opinion after writing a good amount of cljs is that you still need to write js at times
09:20wingyduck1123: backend are you using?
09:20wingypandeiro: why?
09:20wingyduck1123: what backend are you using?
09:20pandeirojust doesn't make sense for something like mobile in most cases, unless the client-side is doing a lot of fancy data-munging
09:21pandeiroand adding the compile time and the added complexity of compilation... just doesn't make a good tradeoff imo
09:21pandeirootoh if developing a major app from scratch, yeah, sure
09:21pandeiroi will do the browser extension frontend of the app i'm working on in cljs, for sure
09:21duck1123wingy: The backend is a proprietary eldritch horror of a java app. I'm mostly doing the js interface.
09:22HodappDo folks use cljs to produce, for instance, Javascript Canvas or other more complex GUIs?
09:23gfredericksI've used it with raphael a decent bit
09:23gfredericksto create complex GUIs
09:23dnolenHodapp: 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.
09:24Hodappdnolen: Closure widgets? Those can target the web?
09:24wingypandeiro: are you using any framework for frontend?
09:25dnolenHodapp: that's all Closure is for - the web
09:25HodappIn other news, Closure != Clojure.
09:26pandeirowingy: i have written some wrappers for the native browser API, and since it will be an extension, that is enough
09:26Hodappyou now make more sense.
09:26wingyduring 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
09:26pandeirowingy: yeah if you need compatability can't go wrong with jquery
09:26antares_wingy: mootools mobile is pretty good from what I hear
09:26pandeiroyou could also consider wrapping zepto
09:27pandeirosmaller footprint
09:27wingyyeah
09:27wingyantares_: https://github.com/cpojer/mootools-mobile ?
09:28Hodappwell, 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
09:28pandeiroHodapp: easily doable but it involves a lot of mutable state
09:28pandeiroimo it's almost just as bad writing mutable cljs as writing js
09:28pandeiroor coffeescript or whatever
09:28Hodapppandeiro: sadly, so does Quil
09:29Hodappit just wraps a very stateful Java API
09:29pandeirono getting away from it i guess
09:29gfrederickspandeiro: at least you can do any pure-functional stuff in clearly pure functions
09:30wingya dream scenario for me is using only HTML to produce the frontend
09:30pandeirogfredericks: you can do that with disciplined js too though right?
09:30gfrederickspandeiro: yeah it just feels squishier
09:30pandeirowingy: check out angular.js
09:30gfredericksI appreciate the persistent data structures
09:30pandeirogfredericks: for sure
09:30gfredericksthe "things are values" aspect
09:30wingyjquery mobile is kinda like this but it requires a little configuration with js
09:30dnolenpandeiro: gfredericks: mutable state when drawing to a rendering surface is perfectly fine IMO. FP purists be damned.
09:31wingypandeiro: yeah i used it before jquery mobile .. was an excellent framework for architecturing
09:31cemerickdnolen: !! https://github.com/clojure/clojure/commit/6bbfd943766e11e52a3fe21b177d55536892d132
09:31wingybut no widget foundation .. and bootstrap was not good at all for mobile devices
09:31pandeirodnolen: yeah of course but all the (set! (.-barBaz js/foo) true) is boring
09:31gfredericksdnolen: I wasn't arguing against that; I was arguing for using cljs even in such projects :)
09:31pandeirocompared to foo.barBaz = true
09:31antares_wingy: that and also http://moobilejs.com
09:31dnolencemerick: haha yeah that landed yesterday.
09:32gfrederickspandeiro: swap!
09:32gfrederickspandeiro: atoms are more interesting than js variables because you get watchers
09:32dnolenpandeiro: when dealing w/ canvas you usually need to set multiple properties thos
09:32pandeirogfredericks: yeah but you need to manipulate the js directly with something like canvas
09:32dnolenpandeiro: in js that's ctxt.fooBar = ...; ctxt.fooBaz = ...; ctxt.fooWoz = ...;
09:32cemerickdnolen: Act as if ye have faith, and all that… ;-)
09:33cemerickI need to fix up a patch that now won't apply, but that's a small price to pay for having column meta.
09:33pandeirodnolen: still shorter than (set! ...), right?
09:33dnolenpandeiro: no depends on the length of mutating thing
09:33wingyantares_: looks cool
09:33dnolenpandeiro: writing a doto style macro is trivial.
09:34duck1123pandeiro: that's when you start to build abstractions on top of that to make it nicer
09:34pandeirodnolen: is there no doto in cljs?
09:34clgvcemerick: so what is the big advantage of column meta? better error reporting?
09:34pandeirohuh
09:34dnolenpandeiro: there is, but you still need to go through the properties
09:34cemerickclgv: lots of utility for tooling in general
09:34gfrederickscemerick: it's because you know for sure which sexp is being referenced?
09:35dnolenpandeiro: (setprops js/ctxt (-fillStyle "black") (-fillWidth ...)))
09:35clgvcemerick: you got a "killer feature" as example?
09:35pandeirodnolen: nice
09:35gfrederickspandeiro: yeah macros in general will always make cljs win over js I think
09:35cemerickgfredericks: essentially, yeah.
09:35pandeiroi am a macro novice i admit, still scared of them
09:36cemerickclgv: When stepping through Clojure code in a debugger, the expression in question can be highlighted, and not just the line. Theoretically.
09:36dnolenpandeiro: it's worth investing a little bit of time in them - CLJS gets a lot more compelling very quickly.
09:36cemerickThere's also stuff like source maps for cljs, etc.
09:36clgvcemerick: ah ok
09:36dnolencemerick: yes that landed yesterday.
09:36pandeirodnolen: yeah your example is a case in point, i will work at it
09:36dnolencemerick: pretty sweet!
09:37duck1123wait, source maps landed? or just column metadata?
09:37dnolenduck1123: column metadata
09:37gfrederickspandeiro: it basically gives you the freedom to remove arbitrary ceremony from your code; which compared to raw JS...
09:37duck1123ahh, still cool
09:38dnolenduck1123: but it means source maps will be considerably more useful.
09:38gfredericksfunction(...){return ...} is a lot of typing
09:38dnolen`fogus: excited about the new site!
09:38pandeirogfredericks: for sure
09:38`fogusthank you sir. it's ... needed (?)
09:38gfredericksdnolen: I enjoyed your cljs talk @SL -- the type hinting I did not know about and found fascinating
09:38pandeiroare the strangeloop videos up yet ?
09:39gfrederickspandeiro: don't think so; I saw puredanger talking about scheduling recently
09:39dnolengfredericks: thanks! that was actually a fairly simple patch in the end. but it helped out a lot.
09:43gfredericksdnolen: 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? :)
09:44gfredericksor could they not do that since they need to support sparse things and string keys and such?
09:44dnolengfredericks: http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L266, that's all there is to boolean inference.
09:44dnolengfredericks: we used fixed size arrays - js engines optimize those now.
09:45dnolengfredericks: so perhaps we get small boost over growing an JS array of unknown length.
09:46pandeirohow 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
09:46gfredericksah ha
09:46pandeiros/by/my
09:46wingyis there any way to make this cljs code shorter and more readable? https://www.refheap.com/paste/5533
09:46wingyso many ()
09:47wingyhttp://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway
09:47wingygood talk .. i hope namespacing will be fixed
09:48`fogusDoes anything prevent someone from "fixing" namespaces from user land?
09:49cemerickFiguring out what we all really want is probably step one.
09:49cemerick;-)
09:49`fogusGranted there would be a mssive uphill battle to get one's fix accepted and/or commonly used
09:50hyPiRionWell, it kind of depends on what part of namespaces you fix
09:50cemerickThe special-casing of ns is the biggest impediment to experimentation in this area. Secondarily, scads of tools that depend upon its particulars.
09:50`fogusThe reason I ask is because since nses are things, then presumably one could create a library to provide other ns capabilities
09:50hyPiRionIf you make requires transactional for instance, then I believe the transition will go smoothly.
09:52gfrederickswingy: check out ->
09:52cemerickA tagged literal is probably the simplest way to escape out into a custom ns implementation.
09:52cemericks/simplest/easiest :-P
09:53gfrederickscemerick: also a user.clj file?
09:53`fogus#badass/ns (do-the-right-stuff)
09:53cemerickyup
09:53cemerickgfredericks: shouldn't be necessary
09:53gfrederickscemerick: because user.clj is evil?
09:54cemerick`fogus: I think you have the name for your alternative namespace implementation :-D
09:54`fogusI would love to see a Racketesque #lang algol68 capability. :-O
09:54cemerickgfredericks: oh, hrm, data_readers.clj won't require the implementing namespaces automatically. You may be right. :-/
09:55cemerickthat is, the namespaces named in data_readers.clj aren't loaded automatically.
09:55gfrederickscemerick: yeah it always seemed like a chicken-and-egg problem to me
09:55dnolenwingy: not sure about shorter, but I'd do it like this http://www.refheap.com/paste/5534
09:56gfredericks(ns foo.bar (:require [badass.ns :refer [ns']])) (ns' ...) is obviously undesirable :)
09:56cemerickgfredericks: What, alternative namespaces, or tagged literals/data_readers.clj? Probably both. :-)
09:56gfrederickscemerick: the former
09:57gfredericksbecause you can write a good ns macro easily but can't use it from elsewhere without requiring it
09:57gfrederickswhich requires the ns macro......
09:57`fogusVORTEX!
09:58TimMcgfredericks: Clearly we just need a CLJ preprocessor.
09:58gfredericksso in the user.clj you define clojure.core/ns'
09:58gfrederickswhich stomps on all the ns' macros defined in all of your libraries for the same purpose
09:58gfredericksand clojure blows up
09:59wingydnolen: cool (missed ])
09:59wingyjust one question
09:59wingyare there equivalents:
09:59wingy(-> page (.find "input#username") .select)
09:59wingy(.select (.find page "input#username"))
09:59cemerickgfredericks: I don't think you'd want to stomp over anything.
09:59dnolenwingy: yes.
10:00dnolenwingy: w/ -> you just get less parens and left to right reading.
10:00TimMcfewer!
10:00TimMcSorry, Grammar Tourette's.
10:01dnolenTimMc: heh thx
10:01jsabeaudry(inc TimMc)
10:01lazybot⇒ 18
10:01wingyyeah i have used it some times .. now i get this example
10:01wingythx .. its much more cleaner
10:01wingyill probably should read the joy of clojure? these kind of examples are good
10:02gfrederickscemerick: 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:03gfredericksmaybe (ns ^#{:impl badass/ns-macro} foo.bar ...)
10:03elzibubwingy: you could do worse than flip through this: http://clojuredocs.org/quickref/shortdesc/Clojure%20Core
10:03gfredericksthat would be only mildly terrible I think
10:03dnolenhey there! http://github.com/clojure/tools.namespace
10:04wingyelzibub: yeah
10:04sundbp_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:04gfrederickssundbp_: sounds like reduce?
10:05cemerickgfredericks: Better to provide a complete alternative to `ns` and leave its semantics be.
10:05antares_ohpauleez: hey, you around?
10:05ohpauleezI'm here
10:06antares_ohpauleez: so I've ported CDS to docslate and writing How To Contribute documents and so on
10:06gfrederickscemerick: that's different from `fogus's approach of fixing it from userland somehow, right?
10:06sundbp_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:06ohpauleezantares_: Awesome!
10:06sundbp_gfredericks: ah, yes - i should have figured
10:06antares_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:06cemerickgfredericks: I think `fogus has much more ambitious things in mind, e.g. racket's #lang and all that
10:07gfredericksah ha
10:07`fogus#lang is, by comparison, a simpler change
10:07antares_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:07antares_ohpauleez: if not, I will wait for uvtc and figure something out
10:08cemerickFor more incremental changes, I think defining `ns'` or something is entirely reasonable.
10:08`fogusBut #lang is a HUGE change in the Clojure Way
10:08ohpauleezantares_: Why don't I just buy clojurecds.com right now
10:09antares_ohpauleez: that's an option but people involved in CDS already have many domains each
10:09`fogusIs clojurecds a service that mails you CDs with Clojure installers included?
10:09antares_ohpauleez: ok, I will look for a new domain. Thanks!
10:10ohpauleez`fogus: Exactly!
10:10ohpauleezWe're bringing install discs back
10:10clgvcemerick: 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:10ohpauleezWe'll have them at every McDonalds
10:10`fogusIt worked for AOL!
10:11ohpauleezhaha right?!?
10:11ohpauleezThat's what I'm saying
10:11ohpauleez - for real, I'm catching myself up on the `ns` discussion
10:12gfredericks#lang would give people all the reader macros they want, eh?
10:14`fogusgfredricks: 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:17gfredericksso some of the arguments against reader macros apply here, right? mostly the ones about code readability
10:18gfredericksnot that I think that means it shouldn't exist
10:19`fogusOh 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:19gfredericksha
10:20gfrederickscue the X-to-clojure transpilers
10:21cemerick"transpiler" gak :-P
10:21`fogushttps://gist.github.com/3840018
10:23cemerick`fogus: so is #lang clojure your first milestone? :-)
10:23`fogus#lang basic
10:23cemerickof course!
10:23ohpauleezperfect
10:23gfredericks#lang english
10:24`fogusIt's my grand plan for making the world a worse place through BASIC https://github.com/fogus/baysick
10:25TimMcohgod
10:25beberlei`fogus, haha this is great :)
10:26dnolen`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`fogusdnolen: Is tools.compiler a thing?!
10:27`fogusI would _love_ to see it
10:27ohpauleezthat is sounds pretty awesome - it would be nice to round it out with #xml as well
10:27dnolen`fogus: well it sounded like you wanted it to be thing :) and I agree
10:27`fogusI have a set of macros around here somewhere that puts a Prolog-esque skin on c.c.logic
10:30`fogusBut yes, I love if it were a thing
10:30`foguswould love that is
10:31dnolen`fogus: I could imagine an OMeta style approach - take a grammar and a lang file - emit Clojure ... VPRI ftw!
10:31`fogusWant to create a wiki page?
10:32dnolen`fogus: I'll happily contribute to a Clojure design page with ideas.
10:32TimMcStep 1: Find out if there are major things eople complain about with other #lang systems, and avoid that.
10:33dnolenbbiab
10:34cemerickTimMc: Dunno, the white-hot awesomeness makes it really hard to see anyone complaining about it… ;-)
10:35`fogus(inc cemerick)
10:35lazybot⇒ 11
10:35cemerickAlthough I was personally more intrigued by racket's process isolation in the strangeloop session.
10:39`fogusOh, BTW, chouser and I just started working on the 2nd edition!
10:39Bronsathat's awesome
10:41pandeirodakrone: you around?
10:48andrewmcveigSay I have the map: {:filename "test.png" :x 10 :y 0 :w 200 :h 200},
10:48andrewmcveigis there a single core function to transform it to: {:filename "test.png" :crop {:x 10 :y 0 :w 200 :h 200}}
10:48andrewmcveigor do I need to use assoc/dissoc?
10:49S11001001andrewmcveig: latter
10:49antares_andrewmcveig: there is no
10:51andrewmcveigantares_: S11001001: OK, thanks.
10:54clgvandrewmcveig: but there is: `select-keys` that'll help you
10:56andrewmcveigclgv: yeah, I've used that thanks :), just wondering if there was something built-in to do it.
10:58clgvandrewmcveig: like (wrap m [:x :y :w :h] :crop) ;)
11:01andrewmcveigclgv: yes, something like that...
11:04dakronepandeiro: I'm here
11:09stuarthallowayanyone 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:12chouserEmacs 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:12chousertechnomancy: any hints on what I could try?
11:13cemerickstuarthalloway: looks like they're not tokenizing v(ersion)
11:13Frozenlock(require 'hippie-expand) ?
11:13cemerickso, probably not
11:13stuarthallowaymeh :-)
11:14jamiiDoes anyone know of a pretty-printer for clojure code? Trying to debug the output of my compiler...
11:15cemerickjamii: clojure.pprint
11:16jamiicemerick: Ooops, I already looked at that and somehow didn't notice that it had clojure formattings predefined. Thanks
11:19chouserFrozenlock: (file-error "Cannot open load file" "hippie-expand")
11:20FrozenlockOk that's odd... I was under the impression that hippie-expand was always included in emacs o_O
11:22chouserstuarthalloway: g:"org.clojure" AND a:"clojure" AND v:1.5.0-alpha*
11:23cemerickchouser: gd quotes ;-)
11:23stuarthallowaychouser: wow, that seems to be killing search.maven.org. spin, spin, spin
11:23chouserDoes gd mean "frickin' awesome"?
11:24chouserstuarthalloway: 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:24stuarthallowayweird!
11:24clgvhmm almost monthly 1.5.0-alpha releases except in september - holidays? ;)
11:24stuarthallowaythat link worked fine
11:25cemerickchouser: exactly right!
11:25Frozenlockchouser: you could always check /usr/local/share/emacs/<version>/lisp/ to see if you have the file "hippie-exp"
11:26stuarthallowaychouser: sweet, and added to clojure.org. thanks!
11:27chouserstuarthalloway: ah, nice.
11:31chouserhm, maybe it's called hippie-exp now instead?
11:32chouserYeah, that seems to do it -- (require 'hippie-exp) before starter-kit.
11:32FrozenlockYeah, (require 'hippie-exp)
11:33chouserFrozenlock: thanks!
11:33FrozenlockSorry about that...
11:58pandeirodakrone: 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:58dakronepandeiro: what sort of issue?
12:00pandeirodoesn't fire the http request at all
12:00pandeirosorry for the ambiguity
12:00cemerickpandeiro: 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:00pandeiroi used clojure.tools.trace/trace-ns and i think somewhere in that threading macro wrap-request there is a nil being returned
12:00pandeirocemerick: i got it working with the vanilla clj-http.core/request
12:01pandeirothe problem is somewhere in the 'middleware' for the batteries-included clj-http.client/request
12:01dakronepandeiro: if you open an issue with reproducing info, I will definitely take a look at it
12:01cemerickoh, as opposed to http/put?
12:01pandeirobut i am having a hard time finding where without expanding it all
12:01pandeirocemerick: put will just use client/request under the covers, so that won't work
12:01dakronepandeiro: if I had to guess, probably wrap-input-coercion
12:02pandeirodakrone: would make sense, right, but trace doesn't even get there
12:02pandeiroplus when i implement what it does manually, it works fine
12:02pandeiro(InputStreamEntity. base64-stream -1) goes off, fine
12:02dakronestrange
12:03dakroneI have a meeting now, but open an issue and I'll take a look when it's over
12:03pandeirodakrone: cemerick: tested it against clj-http 0.4.1-SNAPSHOT (used by clutch) and latest stable (0.5.5), no difference
12:03pandeirodakrone: i'm stepping out too but i will, later
12:03pandeirothanks for your time
12:03pandeirocemerick: you too
12:03cemerickFWIW ;-)
12:04pandeiroreading through clutch is an education :)
12:04cemerickhrm, not sure how to take that ;-)
12:06pandeirocemerick: heh i meant it positively
12:06cemerick:-)
12:06cemerickIt's still a bit crufty, but it gets the job done.
12:06cemerickBeen around since pre-1.0 clojure, so…
12:06cemerickThe library, that is.
12:06pandeirothe defdbop especially is interesting
12:07pandeiroanyway i will file the issue later tonight and hopefully we can squash this one for good... tchau
12:22technomancychouser: are you following emacs trunk?
12:23chousersnapshots, so ... maybe?
12:29chouserubuntu ppa snapshots, to be clear
12:39nsxtgiven 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:41antares_nsxt: reduce + flatten or just reduce. You will probably need to do it recursively, too.
12:42gfredericks(fn datas [{:keys [data children]}] (cons data (map datas children)))
12:42raekflatten is recursive
12:44raeknsxt: I would make a recursive function
12:45nsxtyeah, i tried my hand at a loop/recur solution but was wondering if there was something more concise
12:46raek(defn my-tree-seq [tree] (lazy-seq (cons (:data treee) (map my-tree-seq (:children tree)))))
12:46gfredericksnsxt: ^ mine should work?
12:46raekoh, mine's the same as gfredericks'... :)
12:46gfredericksraek: and map is lazy so without lazy-seq it's still _pretty_ lazy :)
12:46raek(modulo laziness)
12:46raekyeah
12:47callendustingetz: 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:47raekI guess you could do it with something in clojure.walk too
12:49dustingetzcallen: wow, i'm flattered, thanks for the feedback!
12:49gfredericksraek: 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:49nsxtgfredericks: that sort of gets me there
12:50callendustingetz: 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:50dustingetz"monads… in languages not necessarily designed to do so" - be careful with that, haha. python is a nice teaching language
12:50nsxti was hoping for a collapsed sequence
12:50callendustingetz: 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:51gfredericksnsxt: it's not collapsed?
12:51nsxtgfredericks: one sec, editing
12:52dustingetzcallen: 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:52dustingetzits just nice to be able to talk about these concepts without people getting hung up on "OMG PARENS"
12:52nsxtgfredericks: https://www.refheap.com/paste/5539
12:53nsxt(yes, there are additional nodes in there, accidentally collected some while trying to prettyprint, haha)
12:53callendustingetz: 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:53dustingetzany of it open source?
12:54callendustingetz: 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:54gfredericksnsxt: so that's the output given my function?
12:54callendustingetz: hrm, not really, but I'm the CTO at this startup, so I can grab an extract if you want one.
12:54nsxtgfredericks: yeah
12:54gfredericksnsxt: on the data from the previous paste?
12:54ToBeReplacedcallen: the resentment for writing programs in a functional style in python is why i'm experimenting with clojure now!
12:55nsxtgfredericks: yeah, with the exception of those additional nodes collected from prettyprint and refheap itself
12:55callenToBeReplaced: you got tired of being scorned too? :P
12:55gfredericksnsxt: oh we need mapcat
12:55dustingetzcallen: *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:55dustingetzcallen: python is a nice fit for that
12:55gfredericksnsxt: change the map to mapcat and see how that goes
12:55ToBeReplacedcallen: tired of introducing intermediate variable names to write generator comprehensions instead of just map
12:55callendustingetz: you know, you'd think, but in practice, I end up writing everything anyway.
12:56dustingetzhaha
12:56callendustingetz: half-kidding, but yeah, most of our hires are for fairly highly specialized stuff like frontend+JS, or for data/ML
12:56callenor mobile
12:56thorbjornDXcallen: I made the python -> clojure jump in some of my code, mostly to avoid unnecessarily using OO programming
12:56callendustingetz: I write the backend, API, do the devops, manage the databases, etc.
12:56nsxtgfredericks: you are my hero :)
12:57nsxtgfredericks: i will stand by you... foooorreeeeever </inappropriate>
12:57callenlightly monadic/functional python is my compromise with the mindset that we might eventually hire someone to do one of the things I do.
12:57nsxtin any event, thanks again
12:57gfredericksnsxt: phew
12:57callenI think realistically any hire we brought on would be willing to learn Clojure if we were using it.
12:57gfredericksnsxt: no probalo
12:58mindbender1chouser: I damian cassou ppa seems very stable and he is hard at work with it
12:58thorbjornDXcallen: I wish I could say the same in my case :p
12:58callenthorbjornDX: we're a startup, you have to half-cocked to even talk to us anyway.
12:59thorbjornDXcallen: 80's SI hardware tech company here
12:59thorbjornDXcallen: one-off perl script shoppe
13:00nDuff /me is in a Java shop -- using Clojure to prototype, then rewriting things after they stabilize. :(
13:00callenthorbjornDX: fuckin' A.
13:00callennow I just need to find an explanation of category theory aimed at python programmers.
13:00callennDuff: :(
13:02callenone 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:03dustingetzthat's an interesting point
13:03dustingetzit feels to me
13:03dustingetzlike the monadic code, is sort of the ultimate, maximally separated factoring
13:03dustingetzbut in practice
13:03dustingetzi never, ever, ever have time to understand the problem that well
13:03chousermindbender1: I think that's the one I'm using
13:04callendustingetz: http://nutrivise.com/ <--- the code I'm talking about is the algorithm that drives the recommendation engine.
13:04dustingetzthis quote comes to mind
13:04dustingetzProgramming: 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:04mindbender1ok
13:04callendustingetz: It's really hard to de-uglify something that complicated into something that can be composed in terms of monads
13:04callenthe type signature for such a series of functions in Haskell would be horrifying.
13:04dustingetzwhich is why we're hanging out in #clojure
13:05thorbjornDX<3 #clojure
13:05fredyr^^
13:05callendustingetz: 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:05callenwhen 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:06calleninstead, I'm on IRC begging them to tell me why I need to use monad transformers in order to parse this XML
13:06dustingetzyou wrote it professionally?
13:06dustingetzhaskell, that is
13:06callendustingetz: 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:07callenmy day-to-day work is mostly Python.
13:07callenbut I have a lot of side projects.
13:07dustingetzunderstood
13:07callendustingetz: http://snappyweather.com/ here's one I did.
13:07dustingetzhaha, cute
13:08callenare 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:08dustingetzi just started in haskell
13:08dustingetzReal World Haskell arrived from amazon this morning
13:08callenI really like it, especially the fact that it's a clean-break from ecosystems like the JVM
13:08callenI just feel like I have a lot more to learn before I'd be productive in it.
13:08callenand given that I work for a startup, code output is paramount.
13:09dustingetzthe most appealing thing about haskell is that the people seem to "think" in haskell, like a mathematician thinks in math
13:09dustingetzyou get tweets of some one-liner incantation
13:09dustingetzand they'll ask for thoughts
13:09dustingetznot even clojure has that degree of expressiveness
13:09callendustingetz: 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:10dustingetzwould love to see how you structure them
13:10djanatynwriting code in clojure is really fun
13:10dustingetzgiven that there's no macros
13:10djanatynI just wrote an implementation of Conway's Game of Life for the very first time
13:10callendustingetz: *args of f(), map, etc.
13:10callendustingetz: it's pretty sundry.
13:10dustingetzgot it
13:10dustingetzi tried a couple ways, including that
13:11callendustingetz: example, I have a maybe_pipe that does a maybe chain of funcs against data.
13:11callendustingetz: 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:11thorbjornDXdjanatyn: 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:11dustingetzi settled on using polymorphism, implementing mpipe in a base class which dispatches polymorphically on unit and bind
13:11dustingetzbut its not exactly pretty
13:12airolsondustingetz: I quite liked your monad talk at strangeloop
13:12airolsondespite the python awkwardness
13:13dustingetzairolson: wow, thanks!
13:13dustingetzi 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:14airolsonhaha yeah, you were going quickly
13:14airolsonbut the extended Q&A was really good
13:14dustingetzthank you for the feedback!
13:16callendustingetz: this isn't me, but this is fairly indicative of the experience I had with Haskell: http://news.ycombinator.com/item?id=3065876
13:18callenit 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:18callenI really like the type system though.
13:19dustingetzoooh I remember that thread
13:19callenmuch blood was spilt.
13:20djanatynhttp://dpaste.org/gMM4S -- complete game of life implementation in 60 lines of clojure
13:21djanatynerrm, some stuff got moved around >_>
13:22djanatynhttp://dpaste.org/iyqXe
13:23dnolendjanatyn: nice, I recommend learning about get-in update-in
13:24wingy-> is a real saver
13:24SegFaultAX|workdjanatyn: Search for "Game of Life" or "Conway" - https://gist.github.com/3607101
13:24wingymakes it so simple to write OOP code in cljs
13:24djanatynI can't access gists since I'm on my school's wireless network, which blocks github gist for some reason
13:25djanatynunfortunately, 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:25SegFaultAX|workdjanatyn: That's just silly.
13:25SegFaultAX|workdjanatyn: How do they expect you to share code snippets?
13:26djanatynSegFaultAX|work: They don't expect me to share code :) it's just a high school, and the only language they teach is java
13:26thorbjornDXSegFaultAX|work: `write <user> pts/blah` ofc
13:26SegFaultAX|workthorbjornDX: Huh?
13:27nDuffSgeo: There are folks who do.
13:27thorbjornDXSegFaultAX|work: that was a response to the 'how to share code' question
13:27SegFaultAX|workthorbjornDX: Oh, :)
13:27SgeoAlthough, in all liklihood, we will just use an external service to deal with this
13:27SgeoPubNub is kind of addictive
13:27SgeoNo need to write server-side code for server-sidish things, just use someone else's server
13:29callenSgeo: probably wise. I wonder what PubNub is built in.
13:29wingya bad thing with http://clojuredocs.org/clojure_core/clojure.core/-%3E is that it doesnt tell that its a macro
13:29wingyoh it does
13:29SgeoFor what it's worth, we had previously looked at Pusher, and it doesn't meet our requirements
13:30wingybut not as clear as (doc ->)
13:30SgeoWould be nice if they said in glaring letters "DOES NOT SUPPORT THE STOCK ANDROID BROWSER"
13:30SgeoBut that would not be good for them from a marketing standpoint
13:31callenor they could just fix it.
13:33SgeoThat would require adding in another fallback
13:33SgeoAnd possibly adding server support, assuming that the way their Flash fallback works is by speaking WebSocket
13:35wingyhere 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:36wingyis it something i have to do?
13:36wingyi recall something to use #' for telling it to use the var instead of the value
13:36gfredericksyep
13:36gfredericks(def my-app #'my-actual-app) I think works
13:37gfredericksor (defn -main [] (start-jetty-whatever #'my-app))
13:37Sgeo,(let [f (var (fn [] (println "Hello")))] (f) (var-set f (fn [] (println "Goodbye World")) (f))
13:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
13:38Sgeo,(let [f (var (fn [] (println "Hello")))] (f) (var-set f (fn [] (println "Goodbye World"))) (f))
13:38clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)>
13:38Sgeobluh?
13:38gfredericksSgeo: (var (fn ...)) won't work
13:38gfredericksif you want a local var I think there is a with-local-vars macro
13:38gfredericksbut (var ...) just wants a symbol
13:39SgeoOh
13:39gfredericksthe var special form is specifically for looking up vars in namespaces
13:39Sgeo,(let [f (atom (fn [] (println "Hello")))] (f) (reset! f (fn [] (println "Goodbye World"))) (f))
13:39clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn>
13:39devnHow 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:39SgeoWorth a shot
13:39SgeoI don't entirely get why #'blah works as an fn
13:39SgeoWhen #'blah contains an fn
13:39callendustingetz: you got the bad end of the deal, your tweets are better than mine. :P
13:39Sgeo,(let [f (atom (fn [] (println "Hello")))] (@f) (reset! f (fn [] (println "Goodbye World"))) (@f))
13:40clojurebotHello
13:40chousergfredericks: you mean a special form instead of (resolve 'foo) ?
13:40clojurebotGoodbye World
13:40gfredericksSgeo: because the Var class has an invoke method that just invokes the contents
13:40dustingetzhahah
13:40raekSgeo: that's the way that clojure.lang.Var implements clojure.lang.IFn
13:40gfredericksSgeo: i.e., there is special support for it
13:40raekit invokes its current value
13:40devnsay 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:40devnany takers?
13:40gfrederickschouser: yeah, or an interop call to whatever RT does with var internally
13:40technomancydevn: at-at maybe?
13:41gfrederickschouser: is (resolve 'foo) equivalent?
13:41devntechnomancy: yeah, just not sure how to use it
13:41wingygfredericks: 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:41Sgeo,(with-local-vars [f (fn [] (println "Hello"))] (f) (var-set f (fn [] (println "Goodbye World"))) (f))
13:41clojurebotHello
13:41clojurebotGoodbye World
13:41wingynow im actually bullshitting .. i actually changed the code :/
13:41aperiodicdevn: 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:41wingyhiccup code
13:42SgeoSo, combining with-local-vars and transients is the ST monad?
13:42SgeoEffectively?
13:43dustingetztransients?
13:43clojurebottransients are not mutable data structures: http://technomancy.us/132 or at least as far as you're concerned.
13:44SgeoSo, how would I do the equvalent of a Haskell STArray in Clojure?
13:45devnaperiodic: grr, can't get it to do what im looking for
13:45dustingetzthis may or may not help you
13:45dustingetzhttps://github.com/dustingetz/dustingetz.github.com/blob/master/_posts/2012-10-03-reader-writer-state-monad-in-python.md
13:46aperiodicdevn: 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:46Sgeodustingetz, thanks for reminding me of the lack of macros in Python
13:46Sgeoeww
13:46dustingetzhaha
13:47dustingetztell me about it
13:47SgeoAnyways, ST != RWS
13:47dustingetzthere's supposed to be commas in the url :(
13:47SgeoHow far along are delimited continuations in Clojure?
13:48SgeoBecause 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:49Sgeodelimited 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:49jimdueydustingetz: I didn't see you at Strangeloop, but I thought you did a good job on your talk.
13:50aperiodicdevn: 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:50SgeoSince 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:50SgeoI think you can see where I'm going with this
13:50dustingetzjimduey: thanks! i was pretty nervous
13:50SgeoHi jimduey
13:50dustingetzSego: example of "delimited continuation syntax" ?
13:51Sgeohttp://en.wikipedia.org/wiki/Delimited_continuation#Examples
13:51SgeoAlso, I think do-> in Enlive might be acting a little like the Reader monad?
13:51dustingetzdnolen has already implemented this, have you seen his work?
13:51dustingetzsego ^
13:51wingyi 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:52djanatynI used quil to render my game of life simulation :)
13:52Sgeodustingetz, 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:52dustingetzyeah i don't really understand it either
13:53dnolendustingetz: well as a macro lib based off a Common Lisp implementation ... I make no promises about it's completeness.
13:53aperiodicdevn: ah, the live coding wiki page gives an example of using a metronome: https://github.com/overtone/overtone/wiki/Live-coding
13:54airolsondjanatyn: does Quil let you access the underlying OpenGL bits? can you muck about with shaders?
13:55aperiodicprocessing definitely does, so quil should too, but i don't know to what extent quil actively supports you doing that
13:56jimdueySgeo: howdy
13:57ohpauleezjimduey has an alert for whenever someone says "monad"
13:58ohpauleez:)
13:58aperiodicairolson: 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:58aperiodic*quil's API
13:59aperiodici have tons of processing sketches that do this; i should port one to quil
13:59jimdueyohpauleez: 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:59ohpauleezAhh gotcha
14:02SgeoI should set such an alert
14:02SgeoExcept I don't want it going off when I'm in #haskell
14:02Sgeojimduey, also, sorry for falsely thinking that your maybe stuff violated the monad laws
14:03Sgeo(They don't as long as users can't construct ::nothing, as far as I can tell)
14:04airolsonaperiodic: thanks, I'll take a deeper look at quil.
14:04wingyin 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:04wingywhere is this specified?
14:06wingyin :ring key
14:06wingyhttps://github.com/weavejester/lein-ring/issues/43
14:16wingyhow do i do $(this) in cljs?
14:17RoxxiHey, 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:17wingy(js/$ this) ?
14:17Frozenlockwingy: You must use the this-as macro
14:17jimdueySgeo: np :)
14:17Frozenlockwingy: You can see it used here http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/
14:18ChousukeRoxxi: protocol methods dispatch on the first argument so no.
14:18wingyok thx
14:19RoxxiHmm, I'll try that. Thanks Chousuke.
14:21SgeoRoxxi, if you want something more flexible, look into multimethods
14:21Sgeodefmulti and defmethod
14:22RoxxiWell, I want something like an interface so that as I introduce new datatypes, I can make new deftypes to deal with that...
14:23RoxxiOr is that the wrong paradigm?
14:25dnolenRoxxi: 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:26hiredmanif 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:27Roxxidnolen: Can you extend multimethods from other modules later on?
14:27dnolenRoxxi: yes
14:28Roxxidnolen: 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:28dnolenRoxxi: honestly the decision to use one or the other often boils down performance.
14:29Hodapphiredman: This sounds a bit like duck typing
14:29dnolenRoxxi: sure, but protocols should only require users to implement 1 or 2 fns usually.
14:29Roxxidnolen: sure none of the functions are particularly complicated, they're just specific to the role of an agent that implements this protocol.
14:30Roxxidnolen: In fact, they're all predicates, describing about how to reason about data structures.
14:30Roxxidnolen: since I have various implementations of datastructures, I need an agents that can answer the same fundamental questions for all of them.
14:30alex_baranoskydo you guys have a SQL schema migration library favorite?
14:31nsxtalex_baranosky: check out lobos
14:31technomancyalex_baranosky: I have a handful of functions I haven't bothered to spin off into a library yet since they're so simple
14:31technomancylobos struck me as way too much
14:31alex_baranoskyI see there is also ragtime and drift, right?
14:31dnolenRoxxi: 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:32alex_baranoskytechnomancy: that was my impression too
14:32technomancyhttps://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj <- all it takes is two functions: migrate + run-and-record
14:32nsxtalex_baranosky, technomancy: agreed, it is a bit overkill.
14:32hiredmanhttps://github.com/pjstadig/migratus is what we use at work, it works, I guess
14:33Roxxidnolen: 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:33dnolenRoxxi: gotcha, go for it then.
14:35alex_baranoskytechnomancy and hiredman: thanks for the suggestions, will take a look
14:39akhudekhadoop isn't the easiest thing to work with :-/
14:40Roxxidnolen: I guess this is the problem I'm having, in essence: https://www.refheap.com/paste/5544
14:41dnolenRoxxi: yeah that's not how protocols work.
14:42dnolenRoxxi: protocol fns take an extra arg - the instance
14:42Roxxidnolen: That was my first question :)
14:43Roxxidnolen: So I guess that answers that! Thanks!
14:44Roxxidnolen: 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:45dnolenRoxxi: much more so since they piggieback on the performance of Java interfaces when possibly.
14:45Roxxidnolen: That's what I figured. Thanks :)
14:45dnolenRoxxi: and when they don't there's some fancy perfect hashing + fast table lookup + caching
15:16wingysaw 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:17wingyDatomic through Heroku would make clojure visible to everyone
15:24`fogusProTip: Never name top-levels the same name as an aliased namespace in ClojureScript
15:25dnolen`fogus: heh that's actually fixed in master
15:25dnolen`fogus: Brandon Bloom has an even better patch for that I'm planning on reviewing over the weekend.
15:26`fogusI revise my ProTip to: "on any version of ClojureScript released in the wild"
15:26dnolen`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`fogusI 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:27dnolen`fogus: :-(
15:27pjstadigIt's Alpha™
15:28`fogusPatches Welcomed!©
15:29amalloy`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`fogusdnolen: Doesn't eat... or so I've read
15:29dnolenamalloy: it's true, I do like to review patches while eating breakfast
15:30dnolennom nom
15:30uvtcIt would take 10 bowls of your language's patches to equal the amount of bug fixes in just one bowl of dnolen flakes.
15:34uvtcso, I'm back and ... hey, who was typing goofball jokes into my irc client as me while I was away!
15:34zerokarmaleftuvtc: it's always the cat
15:40SgeoHow painful is ClojureCLR to work with? To get working in emacs etc?
15:55dnolengfredericks: are you on OS X?
15:55gfredericksdnolen: ubuntu 12.04
15:55gfredericksdownloaded spidermonkey and it doesn't seem straightforward to build
15:56dnolengfredericks: yeah don't build it, there's instructions on the CLJS wiki, on how to get prebuilt jsshell
15:56gfredericksoh nice I'll check that out
15:56dnolengfredericks: http://github.com/clojure/clojurescript/wiki/Running-the-tests
15:56gfredericksdnolen: shall I submit a patch for CLJS-383 since the other fellah hasn't yet?
15:57technomancygfredericks: spidermonkey is in apt
15:57dnolengfredericks: 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:57gfrederickstechnomancy: yeah but there's no js executable
16:00gfredericksjs-shell errors :(
16:02technomancyhuh; there used to be
16:02gfredericks`which js` and `find / -name js` both return nothing
16:34wingyhow do i check if a value is in a vector?
16:35gfredericks,(doc vector?)
16:35clojurebot"([x]); Return true if x implements IPersistentVector"
16:35wingyi mean
16:35uvtc,(doc some)
16:35clojurebot"([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:35gfredericks,(vector? (transient [1 2]))
16:35clojurebotfalse
16:35wingyif a value is IN a vector
16:35gfrederickswingy: pardon my readings
16:35pandeirowingy: (empty? (filter your-pred-here vec))
16:35SegFaultAX|workwingy: ,(some #{3} [1 2 3 4 5])
16:36SegFaultAX|work,(some #{3} [1 2 3 4 5])
16:36clojurebot3
16:36SegFaultAX|work,(some #{"foobar"} [1 2 3 4 5])
16:36clojurebotnil
16:37gfredericks,(some #{nil} [1 2 nil 3 4])
16:37clojurebotnil
16:37wingySegFaultAX|work: nice trick
16:39thorbjornDX,(some #{nil} [1 2 3 4])
16:39clojurebotnil
16:40uvtcthorbjornDX: You did it right; `nil` was not in that vector, so `some` returned `nil`.
16:40uvtcIt was a different nil. :) {snicker}
16:41thorbjornDXuvtc: maybe I should apply metadata to the nil that's in the collection or something
16:41chousernope
16:41chouserif you need to check for nil, you'll have to use something other than a simple #{nil} set
16:42SegFaultAX|work,(every? (complement nil?) [1 2 3 4 5])
16:42clojurebottrue
16:42SegFaultAX|work,(every? (complement nil?) [1 2 nil 4 5])
16:42clojurebotfalse
16:42thorbjornDXchouser: that'd be a use case for nil? ^
16:42thorbjornDXgotcha SegFaultAX|work
16:42gfredericks,(some #(= nil %) [1 2 nil 3 4])
16:42clojurebottrue
16:42chouserright
16:43SegFaultAX|workI liked mine better :D
16:43gfredericksclojure likes idioms that ignore exactly 2 edge cases
16:43thorbjornDXgfredericks: isn't (= nil sommat) bad somehow? I can't remember if that's the case for clojure
16:43hyPiRion,(not-any nil? [1 2 nil 4 5])
16:43clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: not-any in this context, compiling:(NO_SOURCE_PATH:0)>
16:43gfredericksthorbjornDX: I don't believe so
16:43hyPiRion,(not-any? nil? [1 2 nil 4 5])
16:43clojurebotfalse
16:43Sgeogfredericks, this makes me sad
16:43gfredericksSgeo: me too
16:46zmarilAre there tools for working with grammars of another language in clojure?
16:47jtoycan 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:48gfredericksjtoy: what's the issue?
16:48jtoygfredericks: 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:49jtoyI tried with input-stream, make-input-stream make-reader
16:49hiredmanjtoy: call input-stream
16:49hiredmanmake-* are internal helpers
16:50hiredmanjtoy: the error you got when you used input-stream would have been different an actually informative
16:50hiredmansomething like "cannot cast inputsream to reader" or something
16:50hiredmansince line-seq takes a reader
16:50jtoyhiredman: 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:50hiredmanso you can skip input-stream and call reader on the result of resource instead
16:51hiredmanjtoy: becuase resource is returning nil
16:51amalloychouser: 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:51jtoyyeah, i just saw that, doh
16:51hiredmanso you file isn't on the classpath, or isn't on the classpath where you think it is
16:51jtoythis is what I got now though: java.lang.ClassCastException: java.io.BufferedInputStream cannot be cast to java.io.BufferedReader (NO_SOURCE_FILE:0)
16:52hiredmanyeah, so call reader
16:52hiredmaninstead of input-stream
16:52technomancyamalloy: on the other hand: I've never put nil in a set on purpose
16:52jtoyyeah, reader worked,
16:52jtoyI'm not exactly sure what the difference between all those things are
16:52chouseramalloy: Doesn't sound crazy. But neither does having it act like maps, vectors, etc. and return the thing found.
16:53hiredmanjtoy: generally inputstreams for reading binary data, readers are for reading text data
16:53amalloychouser: 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:54amalloy(defn configured? [x] (some #{x} configs)) for example
16:54gfrederickstechnomancy: it's nice to not have a subprocess in your head that does edge-case checks whenever you see such things
16:54hiredman(doc contains?)
16:54clojurebot"([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:55gfrederickshiredman: but unfortunately (some #{x} ...) gets encouraged
16:55amalloyyes, 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:56chouseramalloy: 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:57hiredmangfredericks: some #{x} means you may want to switch datastructures
16:57chouserThere's so much bikeshedding potential in a language. Even Rich doesn't consistently apply his design standards to everything.
16:58hiredmanI was surprised to see the column thing land
16:58hiredmanand that it is 1 indexed
17:00gfrederickshiredman: were there previously arguments against it, or was it just not valued enough?
17:01hiredmangfredericks: I thought the previous reaction to columns was "meh"
17:03thorbjornDXI'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:03amalloyif you don't want nested collections as an output
17:04thorbjornDXamalloy: I generally destructure the sequences somehow, but in this case I'd rather just map a fn to a single sequence
17:05amalloyhow is that relevant?
17:05gfredericksthorbjornDX: depends on if you need your result to be nested or not
17:06callenit really bothers me how often builds/cabal fails
17:06callenlike, really really.
17:06thorbjornDXI guess I haven't gotten the hang of dealing with nested sequences :<
17:06callenthey 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:06callenlein, virtualenv+pip+requirements.txt, sbt are all more reliable.
17:07gfredericks,(let [nested-seq [[1 2 3] [:a :b :c] [] ["heh"]]] (for [seq nested-seq, x seq] x))
17:07clojurebot(1 2 3 :a :b ...)
17:08thorbjornDXgfredericks: ah, good example. Thanks
17:10ordnungswidrig(defn foo {:a 1}) is accepted but (foo) throws an NPE in Compiler.analyzeSeq
17:10ordnungswidrigthis is in 1.4.0
17:11ordnungswidrigsame with (defn foo)
17:16wingysorry for a noob question again .. why isn't this correct: (set! (.-defaultPageTransition js/$.mobile) "none")
17:16wingyi wanna set $.mobile.defaultPageTransition = "none"
17:17antares_wingy: it then should be without the -
17:17wingyantares_: someone told me that that is how you access a property
17:18antares_I only use JVM Clojure but you typically only use leading dashes in gen-class
17:18duck1123(set! (.-defaultPageTransition (.-mobile js/$)) "none")
17:20duck1123One 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:21aperiodicantares_: 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:22wingyduck1123: it worked
17:22wingyi did something like this instead though (set! (-> js/$ .-mobile .-defaultPageTransition) "none"))
17:22wingyeasier to read as usual with ->
17:22duck1123that works too
17:24gfrederickswingy: (-> js/$ .-mobile .-defaultPageTransition (set! "none")) :)
17:26duck1123so, perhaps we need a (set-in! [js/$ modile defaultPageTransition] "none") macro
17:27wingyduck1123: yeah that would rock
17:27wingylike get-in but for set
17:27wingygfredericks: yeah that works too :)
17:27wingyso many ways of doing it compared to js
17:28duck1123of course, set! is too dirty as it is, no need to make it easier
17:28duck1123stupid non-functional third party libs
17:28pandeiroduck1123: necessary evil with javascript apis
17:28wingyduck1123: but shouldnt it be more like: (set-in! js/$ [mobile defaultPageTransition] "none")
17:29wingyto resemble get-in
17:29pandeiroand technically those keys are strings in js but i guess the macro could abstract that away
17:30wingy (set-in! js/$ ["mobile" "defaultPageTransition"] "none")
17:30duck1123you could do that as a fn if you were willing to use aset
17:32duck1123although, doesn't aset mess with advanced compilation, or does Closure take care of that?
17:33pandeiroi would like something like (setobj! js/$ [[:mobile :defaultPageTransition] "none" [:otherProperty false]]) ;=> would return js/$
17:33pandeirooops nvm the brackets around :otherProperty false
17:36amalloy(doto js/$ (-> (.-mobile) (.-defaultPageTransition) (set! "none")) (-> (.-otherProperty) (set! false)))?
17:36amalloyi mean, wrap it up in a macro if you want, but it's not something you need as a language-level feature
17:38thorbjornDXamalloy, 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:38gfredericksthorbjornDX: ah right
17:38gfredericksyay :let
17:39gfredericksif only for allowed initial :lets we could get rid of let altogether
17:39thorbjornDXgfredericks: do you know if I can do (for [a blah b blah :let [cs a] c cs :let [d c]]) ?
17:39thorbjornDXgfredericks: multiple :lets I mean
17:40amalloythorbjornDX: i'm sure your repl knows
17:40thorbjornDXamalloy: good point :)
17:42gfredericksit'd probably be more complicated to write a for that didn't work that way
17:43thorbjornDXgfredericks: gotcha. amalloy: sorry for the silly questions, I appreciate your help.
17:46devnHm, I seem to have lost arglist hints in my command minibuffer in emacs
17:46devnany idea on how to get it back?
17:46devn(not sure what changed...)
17:48amalloyM-x eldoc-mode
17:48amalloyprobably
17:49SgeoHmm, I don't understand. Why is lein repl the wrong way to mess with a Compojure project?
17:50RaynesWho said it was?
17:50SgeoThe fact that I couldn't figure out what I was doing when I tried to do it
17:50weavejesterYeah, I don't see any problem with using the REPL
17:50SgeoWith a project made with lein new compojure
17:50pandeiroSgeo: you mean mocking the requests and whatnot?
17:50technomancyI always launch my compojure projects from a repl
17:50weavejesterYou just need to make sure that the adapter doesn't join with the current thread
17:51SgeoI mean to modify and test code from the REPL
17:51weavejesterModify code?
17:51weavejesterDo you mean reloading code?
17:52SgeoYes
17:53SgeoIf I save project.clj and am using lein ring server, will that be reloaded, or would I have to restart the server?
17:53weavejesterYou'd need to restart
17:53weavejesterSame if you use lein repl
17:57SgeoHow does the auto-restarting stuff work?
18:03weavejesterSgeo: It injects some Javascript into responses with a content-type of "text/html" and a <head> element
18:03weavejesterSgeo: (i.e. a well formed HTML page)
18:03weavejesterSgeo: It also adds a route that the Javascript polls for changes.
18:04gfredericksomg; in the clojurescript project I can make the advanced version of the tests crash by _removing_ a test.
18:04Sgeoweavejester, hmm, I might not be referring to that
18:04weavejesterSgeo: Do you mean the reloading?
18:04SgeoConsidering that this toy page that has HTML and a head element doesn't have any Javascript injected in it
18:04Sgeoweavejester, I might
18:05TimMcgfredericks: THat's because you should always have more tests! Working as designed, WONTFIX.
18:05gfrederickslol
18:05weavejesterSgeo: It watches for changes and then reloads any changed namespaces (and any dependent namespaces) using (require namespace :reload)
18:05Sgeogfredericks, uh, so a test is side-effecting? That's kind of scary
18:05gfredericksSgeo: no it's not
18:06gfredericksthis is much deeper-spookier
18:06gfredericksthe test is (let [f (fn ([]) ([a & more] more))]
18:06gfredericks (assert (nil? (f :foo))))
18:07gfredericksI mean technically assert is side effecting. But not in such a way that removing it would crash something.
18:07gfredericksespecially considering when the test is there everything runs fine (i.e., no assertion error thrown, so it doesn't actually side-effect)
18:08SgeoWait, what does (fn ([]) ...) mean?
18:08SgeoWith parens around the arg vector
18:08gfrederickscall with no args and it returns nil
18:08SgeoOh, that's for multiple arities?
18:08gfredericksyeah
18:08gfredericks,((fn ([])))
18:08weavejesterI was confused at first, but it's the same as (fn ([] nil) …)
18:08clojurebotnil
18:10gfredericks,((fn([]((fn([]((fn([]((fn([]))))))))))))
18:10clojurebotnil
18:10Bronsaw-woah
18:10gfredericksBronsa: that's how the pros do it.
18:11Bronsai seriously hope you used paredit
18:11gfrederickswell paren-matching
18:11pandeirowould that be considered a higher order function?
18:11thorbjornDXBronsa: I had to copy-paste that to get my rainbow-parens just to keep sane
18:11Bronsaheh
18:11Bronsai'm not even trying to parse that in my mind
18:12gfredericks((fn([]((fn([]((fn([]((fn([])))))))))))) ;; enterprise strength
18:12aperiodicBronsa: if you want to really blow your mind, check out TimMC's non-alphanumeric factorial: https://gist.github.com/3036120
18:13Bronsathat's
18:13aperiodic(inc TimMc)
18:13lazybot⇒ 19
18:13Bronsawtf.
18:13Bronsawhat is that.
18:13aperiodicdude is nuts
18:13thorbjornDX(inc TimMc)
18:13lazybot⇒ 20
18:13Bronsahehe
18:13Bronsa,(+ (*)(*)(*)(*)(*)(*)(*))
18:13clojurebot7
18:13Bronsathis is cheating
18:14Bronsainsanely awesome though
18:14Sgeoaperiodic, I was going to ask if that was based on lambda calculus
18:14SgeoBut it now looks more like a trick of (*) being 1
18:15Sgeo...not that I understand it at all
18:15gfredericksone of many tricks
18:15gert_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:16SgeoI'd like to see a version based off of lambda calculus
18:16SgeoBut then how to get it to print...
18:16SgeoAnd also, there's no nested lambdas in Clojure without fn :(
18:19technomancyclojurebot: factorial is not something you need alphanumeric characters for: https://gist.github.com/3036120
18:19clojurebotc'est bon!
18:20gfrederickswhat are the group/artifact IDs for clojurescript?
18:20technomancythat is a work of art indeed
18:20amalloySgeo: there's no nested lambdas without creating lambdas? that doesn't seem like a disadvantage
18:20gfredericksamalloy: thus no non-alphanumeric nested lambdas
18:20aperiodicfactorial?
18:20Sgeoamalloy, as in, with #() and % inside them
18:20clojurebotfactorial is not something you need alphanumeric characters for: https://gist.github.com/3036120
18:21arrdem`(re Bronsa's above) OMGWTFBBQ
18:30SgeoLamina's pipeline is the Reader monad.
18:30SgeoEnlive's do-> macro is related to the Reader monad
18:30SgeoThat's it, Clojure officially needs one idiom to support the Reader monad.
18:30SgeoEven if it's not easy and convenient generalized monads.
18:50TimMcBronsa: Cheating? You cast aspersions upon my character!
18:51Bronsahahah
18:51TimMcI would never cheat when writing horrifying code...
18:51TimMcWait, yes I would.
18:53TimMcBronsa: It's all gfredericks' fault anyhow.
18:53SgeoI wonder if there are any easier languages that compile into Malbolge
18:54BronsaTimMc: you can't blame others for your own code :P
18:55TimMcSgeo: I believe Malbolge has yet to be cracked.
18:55SgeoThere's a Hello world for Malbolge
18:56TimMcI think that was brute-forced, though.
18:56SgeoHmm
18:58TimMcBronsa: 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:59Bronsawell, im not sure i want to read that.
18:59TimMcThe top version just gets rid of the "if" and takes a slightly more principled approach to dispatch.
18:59Bronsai can imagine you're using vectors as functions
18:59Bronsaand storing lambdas in it
18:59TimMcA little bit.
18:59Bronsathen using that (*) trick to get the nth element
19:00TimMcMore importantly, I'm using a primitive (and hella easier to understand) version of the Y combinator to get recursion.
19:00Bronsaoh.
19:01Bronsayou're horrible code is awesome though.
19:01Bronsayour*
19:01Bronsabrain fart
19:16aperiodicah, so x TimMc y = y TimMc x. i'd suspected as much
19:29zmarilWhen using core.match, is there any easy way to keep variables from matching on nils?
19:29zmarilSo something like ([varname ([typeid index-name key value] :seq)] :seq)
19:29RoxxiHow 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:30zmarilWouldn't match [1 2] with key and value as nil
19:32wingyhow do i create a sequence out of multiple args
19:33eggsbywingy: list?
19:33wingyeg. (some-fn "string1" "string2")
19:33wingy=> ("string1" string2")
19:33eggsbyyou want (defn some-fn [& args])
19:33Roxxiwingy: (defn some-fn [& args] args)
19:34kovasbthere is also (list "a" "b")
19:34wingyim testing list
19:34wingyneed it for hiccup
19:35wingyusing (for) loop to generate multiple elements on each iteration
19:35wingyfor loop only takes one body so i need to do (for […] (list el1 el2))
19:35wingyworked great
19:35wingythx all
19:39TimMcaperiodic: Not anymore! I'm home now. :-)
19:40SgeoWhy not a vector?
19:40Sgeo,(for [i (range 3)] [(dec i) i (inc i)])
19:40clojurebot([-1 0 1] [0 1 2] [1 2 3])
19:41SgeoOh, probably because of the special meaning in hiccup?
19:41Sgeo,(for [i (range 3)] ((juxt dec identity inc) i))
19:41clojurebot([-1 0 1] [0 1 2] [1 2 3])
19:43Sgeo,(dec list*)
19:43clojurebot#<ClassCastException java.lang.ClassCastException: clojure.core$list_STAR_ cannot be cast to java.lang.Number>
19:43Sgeo,(doc list*)
19:43clojurebot"([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:43SgeoWriting (partial apply list) sounds silly
19:43Sgeo:/
19:47wingyceil is not a part of core .. is there another way to convert a number to the lower integer?
19:48SgeoHmm?
19:48wingyi meant floor when i said lower integer .. anyway
19:48SgeoAs in ##(Math/floor 1.6)?
19:48lazybot⇒ 1.0
19:48wingyyeah
19:48wingyoh Java :)
19:48SgeoI'd be tempted to write comp, but can't comp with Java methods :(
19:51dnolenwoot, found one big source of the core.logic tabling perf issue
19:54gfredericksdnolen: Thread/sleep?
19:58dnolengfredericks: ha!
19:58dnolengfredericks: list -> set
19:58gfredericksoh nice
19:58gfredericksI love that kind of speedup
19:58dnolengfredericks: minor change in the end.
19:59dnolengfredericks: could still do a lot better but that would require some hammock time.
20:16dnolengfredericks: fun
20:16hiredmanseems straight forward, you can treat it as a a sequence of strings/characters
20:17gfrederickshiredman: the question is if it would be efficient or not
20:18gert_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:28mindbender1dnolen: what's the idiomatic way to write components in clojurescript
20:29mindbender1like a tree panel
20:29mindbender1without resorting to 3rd party libs
20:33dnolenmindbender1: 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:33kovasbdnolen: u gonna be hacking this weekend?
20:35mindbender1dnolen: I don't mind writing something from scratch I'm tired of trying to interop with 3rd party libs
20:35mindbender1I'd rather build something on google closure. what do you think I need a little push
20:36dnolenkovasb: yeah I was hoping to wrap up some of this core.logic FD stuff
20:36dnolenmindbender1: well I'd be suprised if Closure doesn't have that widget already.
20:37kovasbdnolen: cool. interested in some co-hacking on saturday or sunday?
20:37dnolenmindbender1: just go for it
20:37hiredmanthe 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:37mindbender1dnolen: it doesn't I'm surprised my self.
20:37mindbender1dnolen: ok
20:37dnolenkovasb: sure! I'll be at my studio most of Sat, Sun is booked.
20:38mindbender1hiredman: that's true
20:39kovasbdnolen: sweet. DM me on the twitter tomorrow when ur kicking off, will swing by!
20:40dnolenkovasb: sounds good!
20:48wingycond was pretty good as a if else statement
20:53wingywhat is the easiest way to check if both "foo" and :mandatory is in ["foo" :mandatory]
20:53dnolenwingy: =
20:54wingyah!
20:54wingyno
20:54wingywhat if there is more than those elements
20:54wingyis my best bet nested (if) ?
20:55gfrederickswingy: you want to know if they both appear in any position in a vector?
20:55wingygfredericks: yeah
20:55dnolen(every? #(some #{%} some-sequential-thing) list-of-things-to-check-for)
20:56dnolen,(every? #(some #{%} ["foo" :mandatory]) ["foo" :mandatory])
20:56clojurebottrue
20:56dnolen,(every? #(some #{%} ["foo" :bar :mandatory]) ["foo" :mandatory])
20:56clojurebottrue
20:56dnolen,(every? #(some #{%} ["foo" :baz :mandatory]) ["foo" :mandatory])
20:56clojurebottrue
20:56dnolen,(every? #(some #{%} ["foo" :baz]) ["foo" :mandatory])
20:56clojurebotfalse
20:57gfredericks((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :baz])
20:57gfredericks,((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :baz])
20:57clojurebotfalse
20:57SgeoDon't use sets for containment checks like that :(
20:57gfredericks,((apply every-pred (map (comp (partial partial some) hash-set) ["foo" :mandatory])) ["foo" :mandatory])
20:57clojurebottrue
20:57wingywow
20:58dnolenSgeo: that makes no sense
20:58gfrederickswingy: don't use mine
20:58wingygfredericks: too hard to get :)
20:58gfredericksdnolen: we were discussing it earlier and grumping about the nil/false edge case
20:58wingytrying to get dnolen's
20:58dnolengfredericks: doesn't apply to set containment check
20:58Sgeo,(some #{nil} [1 2 nil 3])
20:58clojurebotnil
20:59gfredericksdnolen: ^ sure it does?
20:59dnolenSgeo: gfredericks: ...
20:59dnolenmaintain your invariants ... moving on
21:03dnolengfredericks: 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:04wingythis one checks for strings (some string? ["asd" :asd]) .. how do i check that it is only ONE string in the vector
21:05gfredericksdnolen: I agree that it doesn't apply to this case
21:05gfredericksI was mostly giving context to Sgeo's statement
21:05SgeoOh sorry >.>
21:06wingyi guess i could filter it to a seq
21:06wingyor a list
21:06wingythen just count the items
21:06wingy(count (filter string? ["asd" :asd]))
21:06wingywii
21:06gfredericks,((comp #{1} count (partial filter string?)) [1 4 "hehe" :okay])
21:06clojurebot1
21:07gfredericks,((comp #{1} count (partial filter string?)) [1 4 "hehe" :okay "WAT"])
21:07clojurebotnil
21:07wingy,(count (filter string? ["asd" :asd]))
21:07clojurebot1
21:07wingy,(count (filter string? ["asd" :asd "adsad"]))
21:07clojurebot2
21:07gfrederickswingy: or use mine and have unreadable code
21:07wingyyeah
21:12wingycan't set be used as a function without some ?
21:12dnolenwingy: yes
21:12wingy,(#{1} [1])
21:12clojurebotnil
21:13dnolenwingy: [1] does not exist in that set
21:13dnolen,(#{[1]} [1])
21:13clojurebot[1]
21:13wingyi c
21:53holohi
21:55holowhy is clojure.java.shell's "sh" function so slow? what is that function doing?
21:56hiredmanslow compared to what?
21:57holohiredman, compared to commands executed in a bash prompt, e.g.. it's impossible not to notice it
22:00holohiredman, the (sh ..) command sits there, doing something, for alot of seconds. even after returning the map with the return code, :in and :out
22:01hiredmanuh
22:01hiredmanthat is not the sh command then, if the function has returned, it has stopped running
22:01hiredmanmost likely it is however you are running your repl
22:02holohiredman, `lein exec -p ...` it is
22:07holohiredman, 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:14amalloyhiredman, holo: shutdown-agents
22:19wingycan i count on the ordering of keys in a map?
22:20wingyi think i better use a vector for ordering
22:22xeqiwingy: no, ordering of keys in a map is not guaranteed. https://github.com/flatland/ordered might help
22:22wingyokay
22:37holoamalloy, 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:46arrdemis there a vimclojure command to auto-format a file?
23:31wingyhow do i check if a value is boolean
23:33wingyseems to be no boolean?
23:37unlinkWhat do you mean by "is boolean"?
23:37unlinkIs one of the values true or false?
23:37wingyunlink: yeah i wanna check if its a boolean
23:38wingylike (number? val) but for boolean eg. (boolean? val)
23:39unlinkHow about (contains #{true false} val)?
23:40wingyi guess that will do
23:40wingysurprised that there is no boolean?
23:40wingythere is for all other types
23:40wingyinconsistent
23:41unlinkThere are a lot of types.
23:41wingybut Boolean is a core type
23:41unlinkso are byte, long, etc
23:42wingyperhaps i should check the type instead
23:43wingy(type)
23:43wingymuch better :)
23:46SgeoIs it just me, or do InputStreams look absolutely ugly to use in terms of Java?
23:54xeqi(doc bool)
23:54clojurebotIt's greek to me.