#clojure logs

2013-02-04

00:01Frozenlockdurka42: Not pro, but I did use it. Question?
00:16FrozenlockI'm tempted to use a reader literal for an application... is there some thing I should be careful with?
00:19durka42Frozenlock: I think I'm all set
00:20durka42I wanted the cholcov() function from matlab
00:20durka42but I realized I can just look at the matlab source and port it
00:20Frozenlockalright
00:21FrozenlockBtw, if you want an alternative to matlab, https://www.gnu.org/software/octave/
00:21durka42oh I know :p
00:21durka42but I hate the matlab language also
00:21durka42so I'm trying to use clojure as my alternative
00:38zerokarmaleftdurka42: julia might be worth looking into as well, and its perf is impressive
00:38durka42true
00:53sshackOther than emacs, what's the editor de jour for Clojure on OSX these days?
00:58JanxSpiritif I run a 'lein repl' in my project directory, the repl should load with the project dependencies on the classpath correct?
01:00durka42sshack: I'm using macvim with vim-clojure-static and foreplay
01:01sshackdurka42: I should have remembered about vim.
01:02durka42oh, and RainbowParentheses :)
01:03xeqiJanxSpirit: yes
01:03xeqithough you start in the user namespace, and might need to change or (require ..) them
01:04sshackdurka42: So you've recreated a scene from "Hackers" then?
01:04JanxSpiritxeqi: so I have added the monger dependency, but when I try to require it, clojure can't find it
01:04durka42sshack: don't think I've seen that one
01:04JanxSpiritsorry - I'm new to lein/clojure - just trying to figure out what I have wrong
01:05durka42but, probably :)
01:05sshackdurka42: It's an absolute classic.
01:06sshackA gritty, real life look at the hacker scene in the 90's.;
01:06durka42okay, I'll put it on the list of "absolute classics I have to get to sometime"
01:06xeqiJanxSpirit: did you start the repl after adding monger to the :dependencies in project.clj?
01:07JanxSpiritI did
01:07sshackdurka42: http://www.youtube.com/watch?v=Ql1uLyuWra8
01:07JanxSpiritand lein classpath shows the jar on the path
01:07sshackGood soundtrack too.
01:11xeqiJanxSpirit: https://www.refheap.com/paste/9390 ; what are you trying to require?
01:14lynaghkdnolen: if we change to `fnc` do you think we should also change `defc` to `defnc` to be consistent?
01:17dnolenlynaghk: yeah that's probably a good idea - I don't think many people are relying yet on `defc` and it's an easy change to account for.
01:18JanxSpiritxeqi: I had everything except the '
01:18JanxSpiritxeqi: (:require [monger.core :as mg])
01:18JanxSpiritxeqi: thanks - what does the ' mean?
01:19xeqiJanxSpirit: if you (:require ..) is used in (ns ...). (require '...) is used outside the (ns ..) declaration
01:19xeqis/if you//
01:19JanxSpiritah gotcha
01:19xeqi' makes it a symbol
01:19JanxSpiritthanks!
01:19lynaghkdnolen: cool, pushed.
01:21dnolenlynaghk: I'm kinda leaning towards something that looks like this http://gist.github.com/4705272
01:21dnolenlynaghk: would mean putting the unifier in it's own namespace, and changing the api somewhat
01:21lynaghkdnolen: not sure what goes in the dots. Why a special let keyword?
01:22dnolenlynaghk: it's annoying that you can't name subforms
01:22dnolenlynaghk: :let would allow you to do that
01:24dnolenlynaghk: gist updated
01:25lynaghkdnolen: whoaaa this is confusing. Same as (unifier '((?y ?z) ?a) '(?b [1 2 3])) ?
01:26lynaghkthat can't be right. in that example you're not using ?x twice
01:26dnolenlynaghk: pretty much, the point of :let is that we don't have anything like :as like when you destructuring
01:26dnolensorry, the example is a bit silly
01:28dnolenlynaghk: updated the gist again
01:29lynaghk?y and ?z would be bound to "foo" and 9? the unifier doesn't respect the concrete types, right?
01:29dnolenlynaghk: updated yet again w/ comment
01:29lynaghkah, I see.
01:29dnolenlynaghk: yes, sorry the point is to get some of the flexibity of destructuring
01:30dnolenyou want to name ?y ?z and also the list that contains them.
01:30lynaghkdnolen: Yeah, sure---presumably this would be useful when you want to twiddle the inside of some form but pass that entire form to a constraint
01:30dnolenlynaghk: yeah
01:31dnolenperhaps let is bad
01:31dnolenhere
01:31dnolenchanging to as
01:31dnolenlynaghk: updated
01:31lynaghkdnolen: I think as is better. I'm surprised to see "let" and then a map instead of a binding vector.
01:31dnolenlynaghk: agreed
01:32lynaghkdnolen: do you remember what syntax we agreed on for constraints of multiple lvars?
01:33dnolenlynaghk: I think options as map is better - I'm not sure what else we'll want to add, and keywords args stink unless you're really certain about the api
01:33dnolenlynaghk: a set / vector
01:33lynaghkdnolen: a vector as the key, with the constraint having the realized values in the same order?
01:34lynaghkwe can't do a set because of the ordering.
01:34dnolenlynaghk: so we can do both!
01:34dnolenlynaghk: set if you don't care, vector if you do.
01:34lynaghkdnolen: options map is fine with me. I won't be able to say much until I try expressing the grammar of graphics rewrites in this system
01:34dnolenlynaghk: but maybe I'm forgetting precisely what you want to do?
01:35dnolenas far as constraints on multiple vars
01:35lynaghkdnolen: here's the old wishlist: https://gist.github.com/4004131
01:35dnolenlynaghk: oh I remember
01:35dnolena constraint relationship between two vars
01:35lynaghkdnolen: yeah
01:37lynaghkdnolen: the simplest being a predicate taking [dataset, dimension] to see if, say, that dimension has string values or numeric values.
01:37dnolengist updated
01:37lynaghkdnolen: yeah, looks great.
01:38lynaghkthe quoting lvars is annoying, but not sure if there's a nice way to get around that without too much hackery/surprise
01:39dnolenlynaghk: yeah I don't really see what we can do about that at all
01:40lynaghkdnolen: do you need me to submit the fnc stuff via JIRA, or is the github fork okay?
01:41dnolenlynaghk: if you like we could just get you push rights to core.logic :)
01:42lynaghkdnolen: dude, I can't handle that! I haven't read any of the miniKanren papers yet!
01:43dnolenlynaghk: :P
01:43dnolenlynaghk: I'm sure you can handle it
01:43dnolenlynaghk: go ahead add a patch to JIRA and I'll ping clojure-dev so that things are easier in the future.
01:44dnolenlynaghk: as far as the defc -> defnc - did you grep for that in the whole project
01:44lynaghkokay, sounds good.
01:44lynaghkyeah
01:44dnolenit's used in a couple places I think
01:44dnolenok cool
01:53lynaghkdnolen: okay, after going through JIRA and getting git to spit out a patch I changed my mind and am happy to have commit rights on github =)
03:52borkdudea while ago there was this library on twitter about doing OO in Clojure - I know it sounds evil, but what was this library?
03:52p_lborkdude: ummm, clojure is pretty fine with OO...
03:52p_ljust maybe not with Java-ish COP
03:53borkdudep_l I mean the more Java-ish OO then
04:07broquaintWas it this, borkdude - https://github.com/bodil/pylon
04:16borkdudebroquaint tnx
06:26bosiehow common is it to write tests immediately in the function?
06:27babilenbosie: Are you referring to something like doctests in Python?
06:28bosiebabilen: yes. and i saw the same happening in clojure
06:29babilenOh, I haven't. /me waits for an answer too
06:35bosiebabilen: are you using vim for clj?
06:35babilenyes, I am
06:36bosiebabilen: vimclojure?
06:36bosiebabilen: i am trying to find a way to re-indent code
06:36babilenI used to, but I switched to foreplay and lein's nrepl ever since Meikel endorsed it
06:36bosieok
06:37babilenbosie: Select the code you want to re-indent (visual mode) and run "="
06:37bosieyea that doesn't work
06:37bosietrying foreplay now
06:37qzbabilen: are you using paredit?
06:38babilenbosie: It does! I am using it every single day :)
06:38babilenqz: No, I can't stand it (i.e. "Have not yet grown accustomed to it")
06:39qzbabilen: i'm very new to lisp syntax and editing files without it is such a pain..
06:45BodilOops... prebooka speakers for DevoxxFR er annonsert. http://www.devoxx.com/display/FR13/Devoxxians
06:45BodilDarth Odersky, we meet at last...
06:46Bodilwhoa, wrong channel :)
06:46BodilToo early in the morning for internets.
07:46hyPiRionHow dare you fill up #clojure with old norse
07:49vagmi\q
08:06pablo__Hi
08:07pablo__I have a little interop question.
08:08pablo__I'm doing some Java interop, and I'm trying to access an entry in a Clojure map, but the keys are keywords (like :my-key). Is there a way to create a Keyword object from Java or should I convert all my keys to string before handing them over to Java?
08:18Sgeo,(class :foo)
08:18clojurebotclojure.lang.Keyword
08:18Sgeohttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java
08:19SgeoHmm
08:19Sgeo,(clojure.lang.Keyword/intern "foo")
08:19clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
08:20Sgeohttp://ideone.com/Exsxb3
08:20SgeoSo I guess it's clojure.lang.Keyword("foo") to get :foo
08:20Sgeoerm, oops
08:20Sgeoclojure.lang.Keyword.intern("foo")
08:21Sgeopablo__, ^
08:23pablo__Sgeo: thanks
08:23SgeoYou're welcome
08:25pablo__Sgeo: hum, looks like the String param of intern() is the nsname...
08:25pablo__Sgeo: I think I found another solution in the end: clojure.walk/stringify-keys
08:26Sgeohttp://ideone.com/hGnsfA
08:26Sgeo(= :foo (clojure.lang.Keyword/intern "foo")) gave me true
08:27SgeoHmm, are you sure you want to do it like that? That will also affect nested maps
08:27Sgeo,(require 'clojure.walk)
08:27clojurebotnil
08:27Sgeo,(clojure.walk/stringify-keys {:foo {:bar :baz}})
08:27clojurebot{"foo" {"bar" :baz}}
08:28pablo__I have to read a map from Java, so either I create Keywords in Java or I convert all the Keywords to Strings...
08:29Sgeo,(= "foo" "foo)
08:29clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>
08:29Sgeo,(= "foo" "foo")
08:29clojurebottrue
08:29Sgeo,(identical? "foo" "foo")
08:29clojurebottrue
08:30SgeoAh, ok, immutable
08:30Sgeogood
08:30piskettiyes, unlike anything else
08:42joegallo_,(identical? "foo" (String. "foo"))
08:42clojurebotfalse
08:43joegallo_not all strings are interned, though, so you shouldn't necessarily assume that equivalent strings are identical
09:14pjstadig,(identical? "foo" (.intern (String. "foo")))
09:14clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
09:14pjstadiginteresting
09:15pjstadignormally that would be true, except for clojurebot's security
09:17alexnixonand for fun: &| [(identical? 42 42) (identical? 142 142)] |&
09:17lazybot⇒ [true false]
09:18cemerickalexnixon: only integers < 128 are fixnums
09:18cemerickthat's a jvm thing
09:18cemerickI guess they're all jvm things :-P
09:18p_l... dafuq. Can't you use the 4byte ones?
09:19alexnixonwell I think /technically/ it's a Java thing (i.e. it's the implementation of Integer.valueOf, rather than some JVM magic)
09:20alexnixonand I've used up my week's pedantry quota in one sentence
09:20cemerickquite right
09:20p_lwell, internally, there are bytes <-127,127>, shorts (16bit signed), integers (32bit signed) and I think longs were also "native" (64bit signed)
09:20p_lisnt' it?
09:20cemerickalexnixon: you use up a budget; you meet a quota.
09:21cemerickFight pedantry with pedantry, amirite?
09:21cemerick;-)
09:21alexnixon-.-
09:21p_lit's hitting the infamous integer cache?
09:21p_lthe one that let's you make 2+2 equal 6?
09:22p_land otherwise returns freshly-allocated object wrappers and does EQ check on them?
09:24alexnixonyeah it's the cache, though I'm not sure I've seen the 2+2=6 example
09:27p_lalexnixon: there's a "logic bomb" posted somewhere which slowly corrupts the cache
09:31jcrossley3llasram: awesome damballa sponsorship of atl-clj!
10:04a|iwhen interoping with java, which way is the most used one?: (Classname. args*) or (new Classname args*)
10:04Ember-(Classname. args*) imho
10:10biff_tannenhow can i make lein re-generate my README file based on changes in my project.clj ?
10:11joegallo_like what changes?
10:11joegallo_https://github.com/technomancy/leiningen/blob/master/resources/leiningen/new/default/README.md
10:11joegallo_looking at the template itself, i'm not sure it would do anything differently.
10:11hyPiRionbiff_tannen: Sounds like something a plugin could do, but leiningen isn't sentient yet :)
10:11biff_tannenwell, i dont mean automatically
10:12biff_tannenjust a command that will re-write the readme ..
10:12biff_tannenright now my readme has all the default 'FIXME' stuff in it
10:12hyPiRionbiff_tannen: Yeah, I get that, but i just wonder what you'd like to have in it.
10:12joegallo_right. that's for you to correct with an editor.
10:13biff_tannenoh ... so that wasn't generated? that was an assumption on my part
10:13joegallo_it is generated. it says "FIXME", and if you regenerated it (somehow), it would still say "FIXME". that part of the template isn't parameterized.
10:13joegallo_see link above.
10:13biff_tannenok i understand
10:14harriganin Datomic, is it possible to create a query that will return all entities with a :db.type/bytes attribute having a given value?
10:17llasramjcrossley3: Thanks! If we're going to be the ~1 Atlanta-based company using Clojure in production, it seemed like a good idea :-)
10:18jcrossley3llasram: :)
10:23a|iwat's the equivalent of javascript (var foo = foo || bar) in clojure?
10:24llasrama|i: (let [foo (or foo bar)] ...), although it isn't an especially common idiom in Clojure
10:25a|illasram: I want to fetch a big xml only once in repl, in next evaluations I want to re0use that fetched string. what's a better way than the above?
10:26llasrama|i: Why not just (def xml-glob (fetch-xml-glob))
10:26llasramYou can use `defonce` instead of `def` it appears where it will be repeated evaluated
10:27nDuff...if it weren't in a repl but an actual program, I'd consider a delay -- (def xml-glob (delay (fetch-xml-glob))); that way, it won't try to be fetched during compilation
10:27llasramOr even (defonce ... (delay ...)) :-)
10:30a|iwhy not defonce with a fn to avoid fetching during compilation?
10:35llasrama|i: Then your semantics conflict. A delay is essentially a zero-argument fn with memoized result.
10:35llasrama|i: If you just defonce a fn, you're storing the fn itself, and thus not caching the result
10:36a|illasram: ah I was looking for a way to have a 0 arg memoizer :)
10:36llasramWell there you go then :-)
10:37llasram(inc nDuff)
10:37lazybot⇒ 3
10:40llasramGood point... It is rather surprising that (inc nickname) doesn't return the same value every time :-)
10:41a|illasram: does delay require a special treatment in repl?
10:41a|ijust trying the example in repl doesn't work: http://clojuredocs.org/clojure_core/clojure.core/delay
10:41a|igiving @my-delay to repl gives me back: @my-delay
10:42nDuffa|i: I can't reproduce that.
10:42S11001001,(let [del (delay 100)] [(type del) (type @del) del @del])
10:42Anderkenta|i: can't reproduce
10:42clojurebot[clojure.lang.Delay java.lang.Long #<Delay@4cbe83ae: 100> 100]
10:42S11001001a|i: looks right
10:43hyPiRiona|i: What repl do you use? lein repl or clojure?
10:43a|ihyPiRion: I use sublimerepl, which I think uses lein.
10:43nDuffThat's a Mac-only thing, no? Can't test here.
10:44hyPiRiona|i: Check if there's an issue with sublimerepl. It may be that sublimerepl treats @ differently.
10:44a|iit worked after I started a fresh repl.
10:44hyPiRionHmm, funny.
10:44a|iI think I don' understand repl oriented development.
10:44a|iwhen I keep evaluating my clojure files into the repl,.. things get built up.
10:44a|iso previous definitions can have a side effect.
10:45a|iis evaluating the file into the repl repeatedly the right way?
10:45Anderkentwell, you don't want your namespaces to side-effect on being loaded, most of the time
10:45Anderkentand some things like deftype really don't take well to being reloaded (which is kinda dissapointing, really)
10:46Anderkentbut in general you should be able to just reevaluate or require :reload your ns
10:46nDuffa|i: In nrepl.el, there are key combinations to recompile your current file as a whole, so it's not _just_ building things up.
10:46nDuffa|i: ...couldn't speak to whatever they've got for sublime.
10:59ToBeReplacedHow do you configure clojurescript-mode with lein-cljsbuild? Is that the preferred way to develop cljs now with emacs?
11:01ToBeReplacedI think i'm confused because I'm not sure whether i should be checking out the clojurescript repos and setting the environment variable myself or whether lein-cljsbuild is meant to take care of that for you
11:12the-kennyToBeReplaced: I'm not familiar with clojurescript-mode, but with lein-cljsbuild, you don't need to clone the repo or similar to build your cljs-project
11:13the-kennyMy workflow usually consists in running lein cljsbuild auto and working with clojure-mode on my cljs-files. No repl, though
11:22hyPiRionHrrm, anyone familiar with Erlang here?
11:22hyPiRionJust wondering if there's any persistent map equivalent.
11:23hyPiRionWhich can be used for destructuring.
11:25S11001001I bet reiddraper's pretty familiar with it :)
11:26S11001001hyPiRion: based on my limited knowledge of erlang, I doubt very much you'll find such a thing though
11:27hyPiRionS11001001: yeah, looks like there's no keyword arguments either
11:27hyPiRionOh well, I just have to remember the order then.
11:27S11001001hyPiRion: yeah, erlang style seems to prefer tuples for that sort of thing over maps
11:30hyPiRionboo
11:39hyPiRionClojure has spoiled me. Why aren't these goodies available in every language I use? :(
11:40DaReaper5Hi, does anyone know a good robust lib for working with excel data?
11:40DaReaper5If not clojure lib then java lib is acceptable
11:41hyPiRionDaReaper5: http://liebke.github.com/incanter/excel-api.html
11:41nDuffThought I'd seen a Clojure wrapper around the dominant Java library
11:41DaReaper5(What I need to do is work with an uploaded excel file (possibly has errors) and mass import the data to my DB)
11:42DaReaper5Ya i saw excel-api. Just thought I would ask you guys anyways ;)
11:42nDuff...ahh; https://github.com/mebaran/clj-excel is what I had in mind.
11:42hyPiRionIncanter is the dominant data analysis library, though I don't know if it's good for excel data.
11:43hyPiRionI would suppose so.
11:43nDuffanyhow, Apache POI (which they wrap) is definitely robust and well-
11:43nDuff...-supported
11:43TimMcDaReaper5: https://poi.apache.org/
11:43TimMcSpecifically https://poi.apache.org/spreadsheet/index.html
11:43TimMc"HSSF" stands for "Horrible SpreadSheet Format"
11:44DaReaper5I briefly looked at incanter. It looks like it does not work well with formulas
11:44DaReaper5as in it wont take the value or formula it would just leave it blank
11:44hyPiRionThat sounds like a useless library then.
11:44nDuffPOI proper supports formula evaluation -- see https://poi.apache.org/spreadsheet/eval.html
11:44DaReaper5ya
11:45DaReaper5http://data-sorcery.org/2010/05/31/xls-files/
11:47hyPiRionHumm, I've noticed I'm probably doing "Let over Lambda" (not read the book), where I define functions taking initial values, prepare some values and returns a function utilizing those prepared values plus some input. Is that a common pattern? Bad/good?
11:48nDuffhyPiRion: Using closures is not considered a bad thing.
11:49SgeoHow do people live without closures, exactly/
11:49Sgeo?
11:49ohpauleezSgeo: I don't know, and I don't ever want to know
11:50nDuffSgeo: Badly.
11:50durka421well, they're just denied closure...
11:50durka421(i'll show myself out)
11:50ohpauleezbut for real, they use objects or globals
11:50hyPiRionnDuff: Nono, I just wonder if the (defn prepare-fn [p] (let [p* (prepare p)] (fn [v] ...))) is idiomatic, or if it's kind of premature optimization
11:51gtrakhyPiRion: you could implement let with just function args, mit-scheme has 'instantaneous evaluation' of all let bindings, which is a similar semantics to a function call. If you want it sequential like we have it, you could keep building up functions with 1-arg, 2 args, etc..
11:51hyPiRiongtrak: Yeah, I know. I've read SICP ;)
11:51gtrak:-)
11:52gtrakso let and partial and closures are not so different
11:53hyPiRionHmm, making it multiarg seems smart, maybe that's the solution.
11:54hyPiRionMaybe I'm a Haskeller at heart, sans the type system.
11:56DaReaper5Does anyone here use incanter with excel?
11:57Sgeonot written any Haskell in his life >>= \hyPiRion ->
12:00hyPiRionSgeo: I know some of those characters, but not in that combination
12:01AnderkenthyPiRion: it's a trick, because he implied a `do` statement wrapping your message
12:13gfredericks<- doesn't normally mean anything without do, does it?
12:15Anderkentindeed, though I don't know if it can be overriden
12:19bawryou could, but that way lies madness
12:19bawrmadness, I say!
12:20Anderkentbut... but... emoticon code! \ -> . <- /
12:32gfredericksdid somebody say that a #bytes default data reader would be added eventually?
12:32gfredericksor more directly, is that the case?
12:32TimMcYes, in version 3.12 "Querulous Quinoa".
12:33hiredmangfredericks: someone (I think stu) mentioned something about maybe adding something like that
12:33hiredmanI imagine it would be #base64 "..."
12:33gfredericks#base65 for those who want the extra power
12:34hiredmanpeople have asked about it for datomic, so I imagine it has some change of happening
12:34llasramI'd like a default #byte-string or such which turned strings with "\\xHH" into byte-arrays
12:35llasramAlso, a pony!
12:35gfredericks#pony {:name "Buttercups"}
12:36llasramheh
12:42biff_tannenany tuts on clojurescript ? i am able to deploy a running web-server with clojure using ring and clojure, but with implementing clojurescript , i can use some help ...
12:44dnolenbiff_tannen: http://github.com/magomimmo/modern-cljs
12:45biff_tannenawesome thx dnolen
12:48lancepantzdnolen: i'm sure you get bugged about this all the time, do do you know what the status of source mapping is in clojurescript?
12:48gfrederickswaiting on tools.reader and 1.5 was the last thing I heard
12:49lancepantzi've been out of the loop for a bit
12:50lancepantzgfredericks: is tools.reader a todo? or just waiting for a merge?
12:50gfredericksI have no idea :( I didn't even know the project formally existed already
12:51lancepantzk
12:51gfrederickswoah I didn't know namespace prefixes could have .'s
12:51gfredericksI apparently don't know anything about clojure
12:53dnolenlancepantz: I do get bugged about it a lot :)
12:54lancepantzdnolen: i have permission to spend time on it, if there's anything i can do
12:54dnolenlancepantz: there's a source map branch that relies on 1.5.0, when 1.5.0 goes out the door I want to merge it in
12:54dnolenlancepantz: as soon as that happens it'll be easier for people to contribute and I'm happy to explain how it works
12:55lancepantzdnolen: k, just let me know, you know how to reach me :)
12:55dnolenlancepantz: once in - we should look at making sure tools.reader gives us column information for symbols - then switch to tools.reader away from the Clojure reader
12:56dnolenlancepantz: I'd like all symbol emission to go through emit :var, right now emission of symbols is very unprincipled
12:57dnolenlancepantz: that's sweet you've got permission to work on it - could definitely use more help! :)
12:57lancepantzdnolen: so right now, cljs uses the same reader as clojure?
12:57dnolenlancepantz: it does
12:57lancepantzi would expect that to cause problems with interop
12:58dnolenlancepantz: which means that any reader changes have to go through Rich which is understandably slow
12:58lancepantzright
12:59dnolenlancepantz: which is why I was excited about blind -> tools.reader
12:59lancepantzdnolen: right right
12:59dnolenlancepantz: you can poke around the source-map branch feel free to ask me any questions
13:01dnolenlancepantz: http://github.com/clojure/clojurescript/compare/source-map
13:01dnolenI just brought it in sync w/ master
13:02lancepantzdnolen: alright, will do, this is the first i've touched of clojurescript, so i have some catching up to do first
13:03lancepantzdnolen: but we are going to start using it, we've been working with ztellman on an open source metrics system based on aleph, figured we might as well do the ui in cljs
13:03dnolenlancepantz: cool!
13:04lancepantzit's a neat project, essentially a statsd/graphite replacement
13:06lancepantzstill way early, although we have ran some trials of it in production: https://github.com/flatland/telemetry
13:07durka42lancepantz: you win the award for vague README.md :)
13:07lancepantzdurka42: let me rephrase, still waaaaaaay early
13:07lancepantzdefinitely don't want anyone using it!
13:07durka42fair enough
13:12pbostromIs there a consensus on :require :refer vs :use :only? I had thought that :require :refer was strongly preferred, but I could be making that up
13:14Frozenlockpbostrom: I had a weird mindset where I used :use and :only... now I regret it. Really better to use :require. (And not refer, just required). IMO it keeps everything cleaner. Also easier if you want to swap libraries or something of this kind.
13:14rasmustopbostrom: from what I know, :use/:only turns into :require/:refer in a macro, so you should just use :require/:refer in the first place
13:14technomancypbostrom: :require :refer was introduced specifically to replace :use :only
13:14Frozenlock:require library :as lib ----> lib/some-fn
13:17pbostromok, that's what I thought, I was skimming through "ClojureScript: Up and Running", and saw :use :only with no mention of :require :refer, perhaps it was an oversight
13:25reiddraperhyPiRion: late reply, but there is no equivalent of map destructuring in erlang, unfortunately
13:27reiddraperhyPiRion: you _can_ do that with records though, which are basically just macros around tuples
13:32magnarslein midje --lazytest works fine. lein midje (with no --lazytest) does not, but fails with this error: Could not locate bultitude/core__init.class or bultitude/core.clj on classpath http://pastie.org/6045137 --- any ideas?
13:33magnarsnever mind me, turns out I was using a really old midje version *blush*
13:35magnarsack, that wasn't it either :P still same error
13:35technomancymagnars: I heard that was fixed in the latest midje RC or something
13:35magnarstechnomancy: excellent, thanks
13:37magnarsyes, that did resolve the issue, thanks - I'm still getting seemingly random hangs from leiningen tho - its task is done, but I have to sigint it to stop.
13:38technomancyprobably the task is leaving a thread pool open
13:38magnarsmakes sense
13:38bosiehow would you solve querying states for a user? like "if the user has a store and is older than 3month and is XXX then do ABC; else if the user has a store and is older than 1month and is XYZ then do BBC; else....."
13:39bosiealmost thinking of doing this with core.logic somehow
13:40goraciohi can it be simplier ? (vec (map str (vec "world")))
13:40hiredman,(mapv str "world")
13:40clojurebot["w" "o" "r" "l" "d"]
13:40goraciogreat thanks
13:41jcromartiemust… save… sanity… must… write… Lisp…
13:41winkyay, more zombie coders!
13:42goraciowhy split returns this btw ?
13:42goracio,(clojure.string/split "world")
13:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: string$split>
13:42goracio,(clojure.string/split "world" #"")
13:42clojurebot["" "w" "o" "r" "l" ...]
13:42hiredmanread the docs for split?
13:42jcromartiegoracio: that' san empty regex
13:43jcromartiegoracio: empty regex matches nothing (i.e. anything)
13:43bosiejcromartie: why would it return "" though?
13:43TimMc,(clojure.string/split "" #"")
13:43clojurebot[""]
13:43TimMc,(clojure.string/split "1" #"")
13:43clojurebot["" "1"]
13:43TimMcSeems legit. :-)
13:43bosieTimMc: right
13:44bosiebut why would it do that?
13:44jcromartieit's an odd case for sure
13:44goraciocan split return vector without "" ?
13:44bosie,(clojure.string/split nil #"")
13:44clojurebot#<NullPointerException java.lang.NullPointerException>
13:44jcromartiebut the empty regex in this case actually matches the nothingness before and after the 1
13:45TimMcbosie: Can you come up with an argument for a different answer?
13:45bosieTimMc: ["" "1" ""]
13:45jcromartiethat might make more sense
13:45jcromartie,(re-seq #"" " ")
13:45clojurebot("" "")
13:45goraciomay be pattern should be of some kind ?
13:46jcromartiegoracio: what are you trying to do?
13:46bosiegoracio: you could use (filter...) to remove the empty strings
13:46goraciojcromartie: i mean we cann't make split to return it without "" ?
13:47jcromartiegoracio: are you looking for the sequence of single-character strings that make up the string?
13:47jcromartie,(re-seq #"." "hello world")
13:47clojurebot("h" "e" "l" "l" "o" ...)
13:47gerunddev,(rest (clojure.string/split nil #""))
13:47clojurebot#<NullPointerException java.lang.NullPointerException>
13:47jcromartiesplit is for dividing a string on boundaries
13:47gerunddev,(rest (clojure.string/split "" #""))
13:47clojurebot()
13:47goracioexactly
13:48jcromartiean empty regex is pretty much never the answer ;)
13:48goraciook thanks have to experiment more on this stuff )
13:50jcromartieexperimenting is good
13:56TimMc,(map str "hello")
13:56clojurebot("h" "e" "l" "l" "o")
13:56TimMcgoracio: ^ even simpler
13:56goracioTimMc: it will return seq
13:56goracioi need vector _
13:56goracio)
13:57ro_st,(vec (map str "try this"))
13:57clojurebot["t" "r" "y" " " "t" ...]
13:57goracio,(mapv str "hello")
13:57clojurebot["h" "e" "l" "l" "o"]
13:57goraciothat's fine
13:57ro_stor use mapv :-)
13:57ro_st-learns something new-
13:57Frozenlockjcromartie: What about an empty string? If I want to remove something in a string, I usually use the replace function with an empty replacement. Is there a better way?
13:58FrozenlockOh wow mapv... could be used at so many places instead of (into [] (map....
13:59Frozenlock#clojure is amazing, it's as if I was learning by osmosis.
14:00bawrFrozenlock: aye, good language channels work like that. :)
14:00babilenFrozenlock: https://github.com/jonase/kibit/ catches things like this (not sure about this particular one though)
14:00jcromartieyeah, mapv is handy
14:02Frozenlockbabilen: I'm somehow afraid it will scream at me :p
14:03babilenFrozenlock: That's ok -- It tells you how to silence it :)
14:10mmitchelldakrone
14:11dnolenfor people who have been burned by the CLJS Closure third-party dependency issues - please try this out - http://dev.clojure.org/jira/browse/CLJS-418
14:15ToBeReplacedi can't even get the browser repl running following the instructions from: https://github.com/clojure/clojurescript/tree/ad0e4af1b20fe829ea3a7feb1b7067250309b1cc/samples/repl ... i just get "Page not found" :(
14:18jro_in (source +), what is reduce1: ([x y & more] (reduce1 + (+ x y) more)))
14:19Bronsabecause + is defined before reduce
14:19ro_stdnolen: thanks, will give it a go
14:20tbaldridgejro_: it's a simpler form of reduce that lacks the features of the normal version, but can be defined before all the stuff reduce needs has been created.
14:20tbaldridgejro_: it's only really used in core.clj
14:24ToBeReplacedAny suggestions for how to get the CLJS browser repl server to accept a connection? if i connect via firefox i just get shipped back "Page not found".
14:29FrozenlockToBeReplaced: What works and what doesn't? Did you specify a repl-listen-port in your cljsbuild config? What does your html file looks like?
14:31ToBeReplacedFrozenlock: I am running directly from clojurescript/script/repl... no leiningen, no lein-cljsbuild, no html file
14:31FrozenlockOh... never tried that :(
14:40warzS11001001, yesterday we were talking about reify. i've been reading up about it and messing around with it in the repl and stuff. how would you do the equivalent of a Java Annotation on a class member method, though?
14:41S11001001hehe, no annotations last I checked
14:41warzdang! heh ok.
14:41warzyea i mean, i did look around for how to do so, but didn't come up with anything.
14:42warzi wonder if i should just use java for these darn plugins.
14:43S11001001warz: I'd suggest considering scala instead, in concert with https://github.com/joshcough/MinecraftPluginsScalaExample
14:43S11001001warz: Alternatively, any non-annotation-based approach will work.
14:45warzwell ive got it working entirely using the gen-class approach, in clojure. im pretty sure i could eventually figure out my original question yesterday as well, which was just creating my own class constructor so that i could pass in and store a reference to the main plugin object.
14:46S11001001warz: what I mean is, consider java last
14:46warzbut yea, the server im using, called Bukkit, requires these Annotations.
14:46dnolenI thought Clojure had annotation support
14:46S11001001dnolen: I have no idea really
14:46warzah yea, only reason im even messing around with the JVM, any Bukkit at all, is because i want to learn Clojure
14:46hiredmandnolen: in some places for somethings
14:47warzyea, based on my readings of the docs and stuff, gen-class seems to support the most of these features
14:47hiredmanhttp://dev.clojure.org/jira/browse/CLJ-948 made it in to 1.5
14:47SgeoSomeone did make a mod or something for Minecraft in Clojure
14:48FrozenlockSgeo: I think it was to make `bots'
14:48Sgeohttp://metaphysicaldeveloper.wordpress.com/2012/04/20/conjcraft-a-minecraft-mod-implemented-in-clojure/
14:49warzi was only tangentially interested in minecraft server mods because i knew it was java, and thought itd be something fun to keep my interest while learning clojure. haha.
14:49Frozenlockhttps://www.youtube.com/watch?v=cV7zbzH37Qo clojurecraft
14:49warzit has turned out that java interop can get hairy kinda quick, though.
14:49warzso probably not the best way to learn.
14:50SgeoJava interop gets impure from a Clojure perspective
14:50Sgeo,(map inc [1 2 3])
14:50clojurebot(2 3 4)
14:50warzi did manage to make one server mod that logs in-game events to mixpanel analytics: https://github.com/ryancole/com.rycole.bukkit.mixpanel
14:50Sgeo,(map .toString [1 2 3])
14:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .toString in this context, compiling:(NO_SOURCE_PATH:0)>
14:50S11001001warz: true.
14:50Sgeo,(map #(% .toString) [1 2 3])
14:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .toString in this context, compiling:(NO_SOURCE_PATH:0)>
14:50Sgeo,(map #(.toString %) [1 2 3])
14:50clojurebot("1" "2" "3")
14:50warzyea thats pretty simple stuff, though
14:50Sgeo.toString is not a Clojure function
14:51S11001001warz: definitely you're missing out on the clojure experience if using gen-class, because gen-class is tedious, and not at all in the spirit of true clojurian development
14:52SgeoWrite a macro to abstract out the gen-class usage as needed?
14:52warzyea i get that feeling. i just need to think of something cool to make.
15:02sveduboisHow I can translate this java code to clojure? https://www.refheap.com/paste/9408
15:04ToBeReplaceddnolen: my cljs problem was caused by this: http://dev.clojure.org/jira/browse/CLJS-418 ... was really hard for me to figure that out trying to set this up for the first time since it breaks the script/repl. this thread had my exact issue and fix https://groups.google.com/forum/?fromgroups=#!searchin/clojure/brent/clojure/DmnPwrVvfW8/qgnp6MTVWusJ ... thanks for the PSA
15:06amalloysvedubois: what have you tried?
15:06dnolen ToBeReplaced: no problem, sooner people confirm the fix the sooner we get a new release that doesn't have the issue
15:13sveduboisI have tried something like this https://www.refheap.com/paste/9409
15:15hiredmanI would start off reading the docs for for
15:15dnolensvedubois: I suggest taking a step back and getting a book on Clojure designed for people coming from Java and other imperative languages - I hear the O'Reilly book is good.
15:20jcromartieThat's not a bad first try
15:20jcromartiesvedubois:
15:21cemericksvedubois: maybe https://www.refheap.com/paste/9410
15:21jcromartiebut I'm a little bit wary of this RealSum class...
15:21cemericksvedubois: and perhaps check out http://clojurebook.com
15:21cemerick"numerical instabilities"
15:22jcromartieyeah
15:22cemericksounds like the IEEE floating point spec
15:22jcromartieis this an image library?
15:23jcromartieI'd guess http://code.imagej.net/trac/imglib/browser/imglib2/core/src/main/java/net/imglib2/util/RealSum.java?rev=a340a39990fbea0e061121c884a128e698341cf0
15:25pbostromcemerick: iterator-seq might not be necessary since input implements Iterable
15:25cemerickpbostrom: oh, right, I misread that as 'Iterator'
15:27sveduboiscemerick: It works well, thanks
15:43olliverahi, .. I am parsing a csv file and I would like to sum all the values of the key "sc-bytes". http://pastebin.com/TPahzhRx
15:44nDuffollivera: If you're privileged enough to be using an adblocker and thus not see them -- pastebin.com is full of annoying, animated ads. Perhaps you might consider refheap.com (which, being written in Clojure, would also be dogfooding), or gist, or otherwise something different?
15:44hyPiRionreiddraper: But {foo, A, bar, B} != {bar, B, foo, A}, right? So the ordering is still important (though it fails if you give it the arguments in the wrong order, which is something at least)
15:44hyPiRion(late reply for me as well)
15:46olliveranDuff, https://www.refheap.com/paste/9412
15:46olliveraokay, nice! :)
15:48dnolen_man, another paren thread on the mailing list
15:50devlolhello jcromartie
15:50rboydollivera: maybe something like this? (reduce #(+ %1 (Integer. (get %2 "sc-bytes"))) 0 rows)
15:50rboydollivera: where rows is a seq of your csv rows (maps)
15:50nDuffHeh. What I was coming up with was thus: (reduce + (map #(Integer/parseInt (get % "sc-bytes")) data))
15:51nDuffcould also make that (apply + ...)
15:51olliveraHum, thanks, I will try
15:51FrozenlockNot really clojure related, but this makes me really happy http://blog.chromium.org/2013/02/hello-firefox-this-is-chrome-calling.html
15:51amalloydnolen_: newcomers begging to remove parens is the Other Lisp Curse
15:54tbaldridgednolen: don't they know the first rule of Lisp fight club? (you don't talk about the parens)
15:57hyPiRiontbaldridge: What parentheses?
15:59ohpauleezamalloy: haha
16:00ohpauleezI think we should just reply, "Remember the first time you tried beer - it was bitter, you hated it, you didn't understand why people drank it. Then you stuck with it, and you realized how beautiful it was."
16:01rasmustohow about we replace )))))) with #] or something?
16:02ohpauleezrasmusto: I rarely pay attention to a long list of closing parens
16:02amalloyrasmusto: :(((((((((((((((((
16:02rasmustoamalloy: #]
16:02ohpauleezovertime, your eyes gloss over it, and with paren highlighting in your editor, it's easy to place them when you need to
16:02amalloy#] or an equivalent is a disaster: it serves no purpose, and makes code harder to edit
16:03ohpauleezyeah, it's totally break paredit
16:03ohpauleezit'd**
16:03amalloyohpauleez: it's worse than that, because it's no longer possible to just wrap some expression with parens
16:03amalloyeven manually
16:03clojurebotIt's greek to me.
16:03ohpauleezfor sure
16:04rasmustoamalloy: wasn't it in a lisp of olde at some point? (btw, I'm 100% joking about putting it in)
16:04amalloyrasmusto: i think some schemes have had it
16:14rasmustotechnomancy: someone else brought it up :#]
16:14technomancywe should maintain a list of every time it's been discussed
16:16hyPiRionThe qsort example made me wonder how I could implement it with juxt.
16:17hyPiRionMust be some way.
16:20TimMcjuxt-sort
16:23S110010011
16:24Bronsadnolen_: just added line/column metadata on symbols FYI
16:24amalloyhyPiRion: (interpose [pivot] ((juxt filter remove) smaller xs))?
16:26hyPiRionamalloy: I was thinking of (juxt > == <) somehow.
16:43seangroveHas anyone thought about a paren-free dialect of clojure?
16:43dnolen_Bronsa: sweet!
16:44tbaldridgeseangrove: thought about? yes.
16:44hiredmanseangrove: no, no one ever has, please bring your great wisdom down from the mount
16:45seangroveWell, it could be a good way of spending time debating its merits...
16:45seangrove:P
16:45seangroveI'm curious why it couldn't just be an editor-level thing though
16:45hyPiRionSuccess
16:45hyPiRion,(let [qsort (fn qs [[p :as l]] (if p (let [{f 1 p 0 l -1} (-> (partial compare p) (group-by l))] (lazy-cat (qs f) p (qs l)))))] (qsort [5 1 8 3 2 0]))
16:45clojurebot(0 1 2 3 5 ...)
16:45tbaldridge(waves Jedi hands) : you do not want paren-free lisp....
16:45hyPiRionNot with juxt though.
16:45seangroveParsing clojure is pretty straight-forward, seems like if someone wanted to do it they could just make an emacs-mode
16:45tbaldridge(waves Jedi hands) : You want to go home and re-think your life
16:45tbaldridge:-P
16:45amalloyseangrove: because the whole premise is absurd
16:46amalloythere's not enough information without the parens
16:46seangroveMeh, you'd have to introduce additional semantics, etc
16:46seangroveBut clojure has to be one of the easiest language for someone (who wants that) to do it
16:46seangroveNo need to request it, it seems
16:46hyPiRionThe most difficult thing would be destructuring.
16:47hyPiRionIf you're going to be delimiter-free
16:47gfredericksO_O
16:47seangroveAh, good point
16:48seangroveDoesn't seem like a very high-value project, personally
16:48dnolen_seangrove: paren-free Lisps are an old idea with few success stories - Dylan being a notable exception, but the macro system looks more like syntax-rules (for better or worse)
16:48technomancymany people have tried it with other lisps, and it works about as well as you'd expect from a project explicitly designed for newbies to abandon once they achieve proficiency
16:49seangroveHeh, sorry, I was speaking tongue-in-cheek about suggesting it
16:49seangrovePure troll, didn't mean for it to be taken very seriously
16:50gfrederickswhat about a language that is like clojure but with more parentheses
16:50seangrovehaha
16:50Raynesseangrove: People have.
16:50cemerickTimMc has been pioneering that for a while
16:50hyPiRiongfredericks: And more sharp-quoting!
16:50rasmustogfredericks: ( is a macro for (((((
16:50bawrhow about...
16:50pjstadiguuids!
16:50RaynesAnd they get surprised when the realize nobody cares about a non-pareny syntax.
16:50bawra clojure with more APL syntax? xD
16:51hiredmandon't make me figure out how to load pl in to clojurebot again
16:51gfredericksat the very least we can have mandatory metadata
16:51hyPiRion(let ((a 10)) (+ a a)) vs (let [a 10] (+ a a)), count the parens.
16:51amalloygfredericks: like clojure but with more parens? common lisp is a winner
16:52gfredericks(ommon li)(p
16:52hyPiRionAnd remove car and cdr, such that you have to do destructuring for those values.
16:53amalloylixp?
16:54hyPiRionHmm, you could probably make a brainfuck-like version of lisp, where () denotes a function, (()) denotes another function and (() ()) denotes a function call, etc.
16:54jballanchyPiRion: I've seen raw lambda calculus implementations like that
16:54hyPiRionNot sure how you distinguish (()) from ( () ) though,
16:54jcromartiedevlol: hello?
16:54gfrederickshyPiRion: whitespace sensitive s-expressions?
16:54hyPiRionjballanc: Oh, that sounds nice.
16:55gfredericksit's the opposite of clojure: ' ' is not whitespace
16:55hyPiRiongfredericks: Hmm.
16:55hyPiRionThat's the opposite of every language in existence though, except Python.
16:55gfredericksyou could use two different kinds of spaces and treat them like brackets that have to be balanced
16:56gfrederickshyPiRion: I meant opposite in the sense that clojure has an extra char \, which is whitespace
16:56bawrgfredericks: you evil, evil man.
16:56hyPiRionlike ' ' and ' '?
16:56gfrederickshyPiRion: sure
16:56jcromartieyou're talking about church numerals?
16:56hyPiRionoh, humm.
16:56jballancyup, that's the term I was looking for
16:56jballanchttp://en.wikipedia.org/wiki/Church_encoding
16:56hyPiRion,(let [  10] (+   2))
16:56clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:>
16:56hyPiRion,(let [  10] (+   2))
16:56clojurebot12
16:56jcromartiehttp://en.wikipedia.org/wiki/Church_encoding
16:57jcromartiederp
16:57amalloyhyPiRion: binary lambda calculus
16:57amalloyhttp://www.ioccc.org/2012/tromp/hint.html
16:57jcromartie"sexpression crimes"
16:58hyPiRionamalloy: That looks nice.
16:58technomancygfredericks: I'd trade tabs as non-whitespace for non-breaking space as whitespace
16:58hyPiRionI wonder what ' ' munges into.
16:58amalloyit's pretty amazing, yes. i'm glad the IOCCC is finally back in business
16:59hyPiRionWe should have IOCLJCC, so that people could hone their Swearjure skills.
17:00technomancylightning talk on swearjure at clojurewest
17:00gfredericks"Ew, look at those swearjure skills. Have you thought about maybe honing them?"
17:00gfredericksTimMc: now you have to come to clojurewest
17:01TimMcThat's what I hear.
17:01hyPiRionWhat, Swearjure is a topic on Clojurewest?
17:01hyPiRionlike, an actual talk?
17:01gfredericksTimMc is presenting
17:02hyPiRionThey better be filming it
17:02hyPiRion/s/be filming/film/
17:02gfrederickswith lots of bleeps
17:02TimMcgfredericks: You are such a troublemaker.
17:02gfredericksTimMc: I still can't believe they made it a keynote
17:03TimMcI hear that next year it will be SwearjureWest
17:03gfredericksTimMc: quick what's the smallest swearjure expression that evaluates to "conf"
17:04TimMcNot sure I can do that.
17:04TimMcI could probably get you some of those letters as chars.
17:05gfredericksI think this is a minimum requirement for you having your own conference
17:05TimMcIt's a shame that inc doesn't work on chars.
17:06TimMcI could produce a seq which, when pretty-printed, shows a raster rendering of "CONF" though.
17:06TimMcI'm not *going* to, mind you.
17:06gfredericksgood to know
17:07technomancyis that a threat then? =)
17:07hyPiRionTimMc: I'll make one for you. For free and all.
17:08TimMcaw
17:08abpWhat to use to internationalize libs for web development?
17:09abpThere's tower, using an atom for the whole config, but I haven't thougt about wether that's good..
17:10TimMc,(`[~@(`[~@'`(~+)](*))](+))
17:10clojurebotclojure.core/concat
17:10bawrabp: internationalize... libs?
17:10bawrI'm not sure I follow
17:11abpbawr, yes, validation with default translations and the like.. Well mostly validation libraries..
17:11augustlTimMc: can clojurebot do JavaScript? :)
17:12bawrabp: what are you trying to achieve?
17:13augustlabp: I like to use thread local variables for config in servlet settings
17:14augustls/servlet settings/servlets/
17:14reiddraperhyPiRion: '{foo, A, bar, B} != {bar, B, foo, A},', correct, but that's not something people do in erlang, idiomatically anyway
17:15hyPiRiongfredericks: I demand that "Macros: Why, When, and How" should be renamed into "Why `{~% ~@%} is legal Clojure and how to utilize it".
17:15abpbawr: Using https://github.com/jkk/formative in a german web app. It uses https://github.com/jkk/verily for validation. I can overwrite the messages all the time, for each validation definition, but changing the defaults would be cleaner.
17:16hyPiRion*will
17:16gfrederickshyPiRion: aaack!
17:16bawrabp: Oooh, I see.
17:16hyPiRionreiddraper: Okay, thanks for confirming.
17:16hyPiRion(inc reiddraper)
17:16lazybot⇒ 1
17:16bawrabp: In that case, not sure. :-)
17:16abpaugustl, so your approach sure would work, to define translation maps in different ns or one gigantic translation map for all supported languages.
17:17pjstadigi'm going to start a mechanical turk service for obfuscating clojure code, that is basically just a bridge to this irc channel
17:17augustlabp: didn't think of the limitation in most validation frameworks of messages being hardcoded and/or only settable once
17:17bawrpjstadig: pshaw! make a bot thhat learns obfuscations for this channel.
17:18bawr*FROM
17:18hyPiRionpjstadig: "Hello guys, how do you do (mapv + [1 2 3] [4 5 6]) in swearjure?"
17:18bawrarrgh
17:18augustlabp: one hack could of course be to make the messages strings of localization tokens etc
17:18hyPiRionMeh, I'm still frustrated that I can't do vararg mapv in Swearjure.
17:19TimMcvararg mapv?
17:19TimMcThat's (mapv f v1 v2 ...)?
17:19hyPiRionTimMc: Variable maps, yesh.
17:20hyPiRionI can't do apply or partial, that's the issue.
17:21abpaugustl, sure, but I prefer to "solve" that not only for my app(s).
17:21hyPiRionOh hey, I think I can do quicksort in Swearjure. Going to take me some time though.
17:22hiredmanwhy don't you just write a clojure to sweajure compiler?
17:22hiredmanthen you are done
17:23bawrthat would be cheating
17:23bawrunless it's written in swearjure
17:23hiredmanafter you write it you would run it on it
17:24hyPiRionhiredman: TimMc has something on that, but I want to figure out if we can map every piece of Clojure to Swearjure. We have some issues with eval, apply, partial etc right now.
17:24bawr*unless it's written in swearjure to begin with
17:27TimMchiredman: I've started work on one that translates a *very* limited subset of Clojure.
17:28gfredericksis core.logic good for handling code yet?
17:29gfrederickse.g., vectors vs seqs?
17:29hyPiRiongfredericks: Actually, I think it may be interesting. Let me find the link of something which may be relevant.
17:30hyPiRionhttp://www.youtube.com/watch?v=5Q9x16uIsKA#t=1104s
17:30dnolengfredericks: we try to preserve the original type. Far as dealing w/ source there are a couple more tweaks to be made - but making it easy to work with source is a goal.
17:30hyPiRionIf we filter out those with alphanumerics, then we're good to go.
17:30gfredericksdnolen: and then let the quine generation begin?
17:31TimMcGeneration Quine
17:31gfredericks"A new generation of programmers who call themselves 'The Quine Generation' have ..."
17:31hyPiRiondeveloped a Swearjure Quine.
17:32dnolengfredericks: heh, well you can already do that today - generate quines relational that can be passed to eval.
17:32dnolenrelationally
17:34gfredericksso you (defn evalo [expr res] ...)?
17:35technomancyhttp://ceaude.twoticketsplease.de/js-lisps.html
17:35dnolengfredericks: if you mean to ask if you do what Will & Dan demo at their talks - yes
17:36gfrederickstechnomancy: where's the corresponding list of JS impls written in lisp?
17:36technomancygfredericks: []
17:36technomancyactually I think there's one
17:37gfredericksthis demonstrates that lisp is not JS-complete
17:37qzhow do i make thread-local var? i'm doing (def ^:dynamic var (SomeClass.)) and i'm getting crashes because of not synchnorized access to the SomeClass object
17:37technomancy[https://mxr.mozilla.org/mozilla/source/js2/semantics/README?force=1]
17:37gfredericksqz: its value is not thread-local until you use binding
17:37TimMcIs it possibly to tell programmatically that a Clojure macro is hygienic?
17:37gfredericksqz: so (def ^:dynamic var) (binding [var (SomeClass.)] (do stuff))
17:38gfredericksTimMc: something to do with &env maybe?
17:38qzgfredericks: aha, will try now
17:39amalloyqz: you can also use https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L197 to create a real ThreadLocal object
17:39devloljcromartie: I googled about compojure + swagger documentation and ended up with a chatlog from this channel. I'm currently on the same path you were on september. Did you pursue this way (generating doc from compojure routes) ?
17:39jcromartieah ha
17:39amalloyTimMc: i doubt it
17:39qzgfredericks: do i have to work with var only within binding block ?
17:39jcromartiedevlol: I think the answer is metadata on vars
17:40qzamalloy: will take a look, thanks.. but i thought clojure supported thread local vars out of the box
17:40jcromartieI never got it wokring
17:40amalloyit supports manual, temporary redefinition of vars per thread
17:40jcromartiebut mostly because I was moved off the project after embarassing the Java devs
17:40jcromartie:P
17:40amalloyit doesn't have anything built-in for automatically giving each thread its own copy of something
17:45jcromartiedevlol: I do believe that compojure will let you do (defroutes ^{:foo :bar} route-var …)
17:45jcromartiethen swagger can inspect a namespace
17:46jcromartieer
17:46jcromartieyou can write a routing that inspects a namespace
17:46jcromartieto speak Swagger
17:46devloljcromartie: ok, i see. I have something working https://gist.github.com/b15be97304bee4e56092 which can then output json for iodocs
17:47jcromartieinteresting, did you write your own GET/PUT?
17:48devlolyes, i wrote a small lib on top of compojure which allow groups with docs & wrappers
17:49hyPiRionTimMc: qsort progress: https://www.refheap.com/paste/40edd5d1d3764c7cbb8aff056
17:50hyPiRionIt seems fairly straightforward from here on actually, so now we have a useful program without alphanumerics.
17:50devloljcromartie: i'm still unsure about whether use swagger or iodocs and wanted to be sure i was not missing something that may already exist for clojure
17:50jcromartieI think they're all kind of silly actually
17:52jcromartieI'd rather just see some good human writing.
17:52jcromartiebecause Swagger et al just always seem to end up with some quirk in the API that can't be expressed easily
17:55devloljcromartie: true, however i think having doc in sync with routes definition can be really useful especially if you are in a small team
17:55jcromartieyes, definitely
17:58qzamalloy: flatland utils worked like charm for thread locals, thanks :)
17:58RaynesYou're welcome.
18:04TimMchyPiRion: Nice. That looks compilable, too.
18:05devloljcromartie: thank you for your response :)
18:05hyPiRionTimMc: Now we can preach the power of Swearjure to everyone
18:05hyPiRionI wonder if I ever get to the point where I implement Dijkstra's algorithm in Swearjure.
18:06TimMchyPiRion: I bet that whole thing could be modified to emit a fn instead of taking hardcoded input.
18:06TimMcThat's the real blocker to adoption, I'm sure of it.
18:07hyPiRionTimMc: I'm all ears. How do you do it?
18:07hyPiRionThe #()'s inside a #(), I mean.
18:08TimMcWell, this problem doesn't require a general-case partial.
18:08TimMcI don't have a technique yet, just a hunch.
18:08hyPiRionI'll have a look after some way of getting partial and apply as well. I need it for my mapv.
18:33rodnaphcore.logic question - i tried doing (dec x) which i didn't expect to work and didn't - but not sure where to look to explore where to go next - is this anything to do with the fd namespace?
18:43TimMchyPiRion: OK, maybe not. :-)
18:44hyPiRionTimMc: :'(
18:45hyPiRionThis is getting a bit hairy.
18:45hyPiRionOh well.
18:45TimMcThe central problem is that of binding.
18:47hyPiRionIndeed. I have just 12 functions in this qsort, so even larger problems may be hairy.
18:48hyPiRionI think the main concern is that of function literals inside function literals.
18:48TimMcThere's probably some combinator that would provide the necessary currying, but I can't imagine that the combinator could be written without function nesting.
18:49hyPiRionTimMc: Have you looked at the #= macro?
18:49hyPiRionI couldn't manage to make anonymous functions with it.
18:49hyPiRionBut maybe there's some loophole
18:52hyPiRionOH
18:53hyPiRion#= resolves symbols, i.e. #=(+ 1 2) takes the actual symbol and resolves it.
18:53hyPiRionIf we could just prepare a form to #= and let it read it, we could use apply and concat.
18:54TimMcInteresting, but the call-position has to be a literal symbol.
18:54hyPiRionYeah, that's the problem. Hmm.
18:54TimMc#=((or + *) 1 2) ;; ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
18:55hyPiRionSame for `[#=~(prepare-form)].
18:55TimMc...and we don't have read, anyway
18:56TimMcI think "(" is the only valid follower of #=.
18:56TimMcYou can
18:56TimMcYou can't unquote into the readerm anyhow.
18:57hyPiRionYeah, true.
18:57TimMcOh, we can get various chars, by the way.
18:57hyPiRionOh?
18:57TimMc,[\+ \ \"]
18:57clojurebot[\+ \space \"]
18:58hyPiRionWell, space looks interesting.
18:58TimMcWe don't have str, int, or char. :-/
18:58hyPiRionWe don't have much, do we.
19:01TimMc,#!/bin/bash
19:01clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:02hyPiRion,;;what
19:02clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:02hyPiRionIt expects a value before comments/"eof" I suppose
19:04TimMc,(. #"" '"test")
19:04clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: quote for class java.util.regex.Pattern>
19:04TimMcBleh.
19:04TimMcThat "would have worked" in Java.
19:06TimMc,'(. #"some-regex" '"test") ;; for clarity
19:06clojurebot(. #"some-regex" (quote "test"))
19:06hyPiRionHumm
19:07hyPiRionI thought that was static
19:07TimMcIt is.
19:08TimMcJava will allow "new Pattern(...).quote(...)".
19:08hyPiRionWeird.
19:09hyPiRionMaybe it's for uncompiled patterns
19:09TimMcWhat, quote?
19:09amalloyTimMc: you can refer to static members non-statically if you want
19:10hyPiRionWait. Hrm.
19:10amalloy(in java, not the jvm)
19:10TimMcamalloy: So Java translates someRegex.quote("") into Patter.quote("")?
19:10TimMc*Pattern
19:10hyPiRionThat makes sense.
19:10amalloyjavac does that, yes
19:10hyPiRionTimMc: Try out ((Pattern) null).quote(...)
19:11amalloyi presume it still produces someRegex and then throws it away, in case of side effects
19:11TimMcAh, sure.
19:11TimMcWell, I'll sleep on it.
19:11RaynesSleep!?!?!111!
19:12RaynesIt's only 4:12PM!
19:12RaynesIt's awesome how quickly I stop caring about my old timezone after I've moved to a different one.
19:12hyPiRionRaynes: 1:12 am here.
19:12cbphi
19:13hyPiRionRaynes: But you were up very late for some weeks ago for your timezone, I think?
19:13RaynesI was always up late for my timezone, hyPiRion.
19:13RaynesI used to go to sleep at 7AM.
19:13cbpIs there a sqrt function around that returns a BigDecimal?
19:13RaynesNow I have to get up at like 8:45AM. It's ruthless, this.
19:13callenbotRaynes: I wake up at 6:30 am so I can commute for 1:45 each way.
19:13yedii'm starting a webapp in clojure, how should I go about getting up to speed w/ clojure on the web? my plan is to checkout the compojure and ring docs/tuts, but if anyone knows of other great resources lemme know
19:14callenbotRaynes: fuck you man :(
19:14callenbotI figured out my request context thingy I wanted.
19:14Raynescallenbot: Yeah, I'll probably have to get up earlier if they move the office. I already have to take a 40 minute or so bus.
19:14callenbotit's a dynamic var of an atom of a map.
19:14callenbotRaynes: that's pretty bad for most people actually.
19:14Raynescallenbot: Any new music for me? I'm sitting in the office jamming in the corner.
19:14cbpor more like a nicely precise sqrt function
19:16callenbotRaynes: http://toogl.es/#/view/VeU5bM_ccXo
19:16hyPiRioncbp: http://stackoverflow.com/questions/1384919/are-there-libraries-for-square-root-over-bigdecimal
19:16hyPiRionSo apparently it's uglier than I suspected.
19:16Raynescallenbot: What is this crap?
19:16callenbotRaynes: the closest thing I could find to Firefly-esque music.
19:17callenbotRaynes: want some unicorn rainbows instead?
19:17RaynesNo, I meant this website.
19:17callenbotRaynes: angularjs magick.
19:17cbpthank you
19:19callenbotalso I need to remember to run the type-hinted laser results and integrate them into the test results.
19:19callenbotRaynes: don't let me forget ^^
19:20callenbotRaynes: what did you see when you ran them?
19:20tmcivercallenbot: what's the video from?
19:20RaynesUh, I can't remember. It was a little faster, callenbot.
19:30callenbottmciver: I didn't pay any attention to that bit. I just wanted the music.
19:31callenbotRaynes: cool, I'll post the results tonight.
19:31tmciverAh, looked kinda cool.
19:31tmciverI was especially interested because you mentioned Firefly.
19:32callenbottmciver: I think the movie is Final Fantasy or something.
19:32RaynesI guess I should watch that show.
19:32callenbotRaynes: firefly is godly.
19:32tmcivercallenbot: yeah, looks like it.
19:32FrozenlockRaynes: yes, do it.
19:32callenbotRaynes: I don't even like TV usually and Firefly was worth every minute.
19:32FrozenlockAnd then the movie.
19:32RaynesI saw one episode.
19:32tmciverYes! Best Sci-Fi TV show to be cancelled after one season, ever!
19:32ohpauleezYou have to stick with it
19:32RaynesIt was kind of meh.
19:32ohpauleezwatch them in order
19:33ohpauleezthen the movie
19:33RaynesI've never watched a show out of order. Except for Family Guy and such.
19:33tmciverRaynes: you watch your mouth!
19:33ohpauleezthen you'll be like, "now I understand"
19:33RaynesBut yeah, I'll watch the rest.
19:33RaynesI wasn't turned off by the first episode or anything, I just never got around to watching the rest.
19:33ohpauleezDoctor Who is the same way - you need to stick with it, and watch it in order
19:33ohpauleezbut then you totally get it
19:34RaynesDoctor Who <3
19:34Frozenlockohpauleez: I was dissapointed but the last seasons...
19:34RaynesFrozenlock: you watch your mouth!
19:34ohpauleezFrozenlock: I haven't seen the MOOOOST recent ones
19:34Frozenlock*by the last seasons
19:34FrozenlockI guess I'm not fond of the new doctor.
19:35seangroveFrozenlock: No one ever is
19:35seangroveI don't even watch Doctor Who and I know that
19:35RaynesI love Matt Smith.
19:36RaynesSo your argument is invalid.
19:37FrozenlockAt least he has a bow tie. Bow ties are cool.
19:37FrozenlockI also want to critique how they overused the weeping angels.
19:51imeredithFrozenlock: i really liked the new doctor - i thought that it would suck without David Tenant, but Matt Smith is better imo
19:52callenbotRaynes: http://toogl.es/#/view/0Q35mUz2TOY Listen to a song about Elizabeth Bathory now.
19:54Frozenlockimeredith: but what about Christopher Eccleston? :P
19:54imeredithi had the same feelings when he left, but he was the worst :P
19:54combataircraftwhat is the clojure equivalent of socket.io?
19:55technomancyit wasn't fair to Smith to make him follow Tennant
19:55imeredithAmy and Rory have been the best companions so far too
19:55Raynestechnomancy: That's true.
19:56imeredithtechnomancy: idk, i think it would have been worse for Tennant to follow Smith...
19:59combataircraftany ideas?
19:59technomancycombataircraft: what is it?
19:59Raynes$google socket.io
19:59lazybot[Socket.IO: the cross-browser WebSocket for realtime apps.] http://socket.io/
20:00combataircraftit's a cool NodeJS library that simplifies real-time communication between server and browser
20:00ivancombataircraft: http://thegeez.net/2012/04/03/why_browserchannel.html
20:01ivanSocket.IO et al will lose/reorder data
20:01combataircraftoh, come on…
20:02ivanfeel free to think about its HTTP transport for 5 minutes
20:06Frozenlockivan: for someone who isn't very literate in these communication stuff, what's the difference between clj-browserchannel and fetch?
20:07ivanFrozenlock: I don't think fetch can push some data from the server to the client
20:08FrozenlockOh! No I don't think so. Or at least I didn't see anything to do so.
20:08hiredmanamalloy: the "140KB of Clojure source!" made me chuckle
20:08ivan(the basic trick to that is keeping an HTTP request open until the server has something to respond with, and the fun part is setting up reliable message queues and ACKs on both sides)
20:09ivanBrowserChannel has already implemented everything
20:09amalloyhiredman: given clojure's density, that's probably enough to rewrite chrome from the ground up
20:09hiredmanreason number 64 I refuse to look at midje
20:10callenbothiredman: sorry?
20:10callenbothiredman: I'm not familiar with midje, what don't you like about it?
20:10amalloyhiredman: is the 78MB git-clone reason 63 or 65?
20:11hiredmanamalloy: it's in there somewhere
20:12amalloyi shouldn't poke fun, though. midje isn't really my style, but i suspect it's pretty cool if you're into that sort of thing
20:12hiredman#1 is the guy who wrote is constantly hitting these kind of issues, can never figure them out, and goes to the clojure mailing list with "what is going on?"
20:12technomancyrunning the tests on load is =(
20:12RaynesLaser's tests use midje. Just cuz.
20:12Raynestechnomancy: Well, you can wrap them in deftests if you want.
20:12hiredmanyou'd think after the second time he would have stopped and learned some clojure/jvm internals
20:13technomancyalso: macros and dynamic binding over simple things like with-redefs
20:14hiredmanto steal a turn of phrase from technomancy: it's clown shoes
20:14technomancycallenbot: the biggest reason though is just that you can do so much with only learning 2 forms from clojure.test, and anything that adds additional concepts on top of that should have to pay significant dividends for additional conceptual overhead
20:15callenbottechnomancy: it did seem like an awful lot of code.
20:15hiredmanrunning tests are load is horrible, I wasn't aware it did that
20:15callenbottechnomancy: I'm not convinced clojure.test isn't fine. OTOH, I'm one of those Python people that like unittest/unittest2 fine.
20:15technomancyrelevant: http://technomancy.us/118
20:16amalloyhiredman: that's just a bad convention, at least, and not an actual requirement. he just has (fact ...) instead of (deftest foo (fact ...)) like any sane person would recommend
20:16callenbottechnomancy: this is fucking sweet, thans.
20:16callenbottechnomancy: I've made a lot of progress in hacking up web apps in Clojure. I'm beginning to settle on a micro-framework
20:17callenbottechnomancy: thanks for posting bludgeon, I like it.
20:17callenbottechnomancy: this is actually a good sanity checker for libraries.
20:18technomancyit's really not, but it does make a point
20:18Raynestechnomancy: You're getting more cynical than I am, I think.
20:19technomancyRaynes: heh, that post was from 2008
20:19Raynestechnomancy: I was referring to the message right before I said that.
20:19FrozenlockDoes one get more, or less cynical with time?
20:19technomancy...which is right around the time I stopped doing ruby, actually. hm.
20:19abpcallenbot: will your micro-framework be released?
20:19technomancyRaynes: well, I mean it's a joke.
20:20ivanwould anyone but me have a use for a thing that made it easy to turn Clojure output into org-mode trees? I've often had a need for something as simple as stdout but with collapsible trees. (The annoying part is getting streaming output working)
20:20technomancyyou have to think about conceptual overhead vs value provided, and I don't think either can be measured with `wc -l`
20:20gfrederickshas somebody mentioned running bludgeon on itself yet?
20:21technomancygfredericks: probably not since 2008
20:21Frozenlockivan: org-mode trees? Like: *title 1 **subtitle1 and such?
20:21gfredericksoh I didn't realize this wasn't new
20:21gfredericksno wonder it's about ruby
20:21ivanFrozenlock: right. the idea is that you could look through a big pile of output with a lot less pain
20:23qztechnomancy: you stopped doing ruby completely, or just switched to clojure for some tasks?
20:23technomancyqz: I still use ruby for small things
20:23technomancythings under the bludgeon threshold =)
20:23technomancybut it's only recently that I've needed it again
20:23qztechnomancy: but for all web stuff you use clojure now?
20:23FrozenlockI see how this could be usefull for maps. But I'm not sure I would take the time to transfer them into a new buffer. But something like it in the repl would be amazing. (with-fold my-map) ----> {:key1 ... \n :key2 ...}
20:23technomancyI don't really do much web stuff
20:24technomancyjust clojars and syme really
20:24ivanFrozenlock: yeah, I'll have to do something horrible with nrepl.el
20:25Frozenlockivan: If it's worth something, you have my whole moral support to implement something like this :P
20:25ivancool :)
20:25qztechnomancy: nice, now i know how proper web app in clojure looks like
20:25hyPiRionTimMc: All hail the quicksort: https://www.refheap.com/paste/15a076693ba66105e21b44a1c
20:25gfredericksclojars: a proper web app.
20:26Frozenlockivan: actually I just made code to convert a java object into a map. Only problem is when I print it in the repl it's often too big. Folding it would be perfect.
20:26technomancyqz: it's pretty good considering its age. we're in a bit of an awkward point right now transitioning between data stores, so it's not as clean as it could be
20:27yediis jdbc pretty much the standard for db manipulation (i'll be using postgresql most likely)
20:27hyPiRionOkay, give me a month and I'll make Dijkstra in Swearjure. Better be good.
20:27gfredericksyedi: meaning clojure.java.jdbc the contrib lib?
20:27yediyea, it's a contrib lib?
20:28qzgfredericks: what do you think about korma for sql stuff?
20:28yediso i guess that means it's basically standard or at teh very least a really great api
20:28technomancyit's not really a shining example of a great API
20:28technomancybut it is widely used
20:28technomancyI think there's a rewrite on a branch
20:28technomancy(of the API at least)
20:29gfredericksqz: I think lots of conflicting things
20:29craigbrohehe
20:29technomancy^ talking about c.j.jdbc
20:30yediqz: korma is another popular option? have you used it and if so how'd you like it?
20:32qzyedi: it works and i like the api, but again, i'm new to clojure and we should listen to more experienced people here ;)
20:33gfrederickshyPiRion: "Practical Swearjure"?
20:33yedijust found this: https://github.com/korma/Korma/issues/62
20:34hyPiRiongfredericks: Yeah, you can use Quicksort to sort a vector.
20:34hyPiRionIf that isn't practical then I don't know.
20:34gfrederickstechnomancy: my favorite is #64: "Korma is not simple."
20:34gfredericksyedi: ^ meant that for you
20:34gfrederickstechnomancy: ^ did not mean that for you. carry on.
20:34technomancygfredericks: zarro boogs found
20:35gfrederickshyPiRion: I just meant it sounds like a book you're working on
20:35hyPiRiongfredericks: Do you think it will sell well?
20:36hyPiRionI believe a lot of corporations would enjoy using Swearjure as their back-end connecting to their database
20:36yedioh korma is built on top of jdbc
20:36gfrederickshyPiRion: yes it will sell quite well
20:37hyPiRionIt sounds like Korma is built on top of Swearjure by all the bashing of it
20:37qztechnomancy: but again, writing raw sql becomes boring very soon. what are alternatives besides jdbc?
20:37hyPiRiongfredericks: Excellent, I'll start writing today.
20:37technomancyqz: if you don't want to write raw SQL you should use Korma or implement something new based on honeysql
20:38yedihoneysql looks tasty
20:38qztechnomancy: i just got used to activerecord for simple db stuff :(
20:38xeqisuper alpha https://github.com/seancorfield/jsql
20:39yediit's interesting to see the different API approaches
20:40abpxeqi: that seems to be in there too: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc/sql.clj
20:40xeqiabp: ah, hadn't looked at the latest c.j.jdbc
20:41xeqiI saw the ml post where the dynamic vars are no longer required
20:41abpxeqi: for now it looks strange with all the = for everything.
20:44qztechnomancy: are you gonna migrate from korma in clojars?
20:45technomancyqz: yeah, our data set is trivial, so it's not a good fit for SQL at all
20:45technomancywe are switching to two in-memory atoms and a lucene index
20:45qztechnomancy: migrate to.. ?
20:45qzoh
20:46qzso everything that persists will be stored in lucene?
20:46technomancyusers/groups will just be in the atom and event logs
20:47technomancydeployed artifacts will be in lucene
20:47technomancyhttps://groups.google.com/group/clojars-maintainers/browse_thread/thread/8ea301d80b95a78c
20:48yediif paredit-mode for emacs is working correct, i shouldn't be able to delete closing parens right? and typing an open paren should automatically close it?
20:48xeqitechnomancy: I seem to remember it might need to be three atoms, but I forget why off hand
20:49technomancyxeqi: there are three event logs
20:49technomancybut I don't think deploys need to be queried outside lucene
20:51yedioh, i guess paredit doesn't automatically turn on when you open a new buffer
20:54qzwish there was paredit for vim that's not horribly broken..
20:54Raynesqz: I didn't have trouble with it when I used it. What's wrong with it?
20:54xeqi_technomancy: artifact pages for old version wouldn't be in lucene :/
20:55qzRaynes: i had problems with <leader>W (it just does W w/out leader) and some other keybindings
20:56qzworst of it is that it doesnt work, then you type it again and it works..
20:56amalloyhttps://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548 for anyone who isn't watching the read-eval jira ticket
20:57Raynesomg
20:57qzand last thing was trying to do <leader>W on "blah" with cursor on first quote.. ("blah") as result ? nooo.. (")blah"
21:03bttfanyone had their cljs repl hang on them ? i'm using lein-cljsbuild 0.3.0
21:04Frozenlockbttf: what do you mean 'hang on them'. Sometimes (not often) the REPL stop responding. If I look in the js console there's an usually an error from a bad command I entered.
21:06bttfwell i started a repl server with repl-listen
21:06bttfdid a simple (+ 2 2) and it hung
21:06bttf(+ 2 2) on the cli
21:06clojurebot4
21:09bttfi see an error with the GET request in the js console on the webpage that im trying to connect to the repl ... maybe its related
21:11Frozenlockbttf: You can try to reload the page. Also make sure the repl/connect function is used only after the page is loaded.
21:12tuordauterive: Are you Val who used to work at BNR/Nortel?
21:13technomancyxeqi: oh, those can just hit the disk straight
21:13technomancyoh, but not the listing
21:14ChongLiwhat sort of data structure would be best at representing the current value of the keyboard?
21:14ChongLiI was previously using a set
21:14georgekhi, I'm getting a ConcurrentModificationException because I'm removing an element from a Java Set while iterating over it -- the Java HashSet has a remove method (which I'm using) but perhaps Clojure is putting some other iterable in between that's making it not work, or...?
21:14ChongLibut I think I need something else to take into account weird contradicting keys
21:14georgekI'm doing it in a doseq
21:15technomancyxeqi: I think we might just have to change the index to have a latest? y/n field
21:15technomancyalong with a published_at field
21:23amalloygeorgek: that's just as illegal in java as what you're doing in clojure. iterators specifically tell you not to do that
21:24amalloyif you really, really want to remove items from a set while you iterate it (hint: you don't), you have to use the iterator's .remove method
21:25ChongLiis there a data structure which acts like a stack and a set?
21:25georgekamalloy: that's the funny thing, I am using the .remove method on HashSet, which says " if the set is modified at any time after the iterator is created, in any way except through the iterator's own remove method, " -- so I need to get an iterator of the hashset first
21:27georgekah, I see, I just need iterator() -- sorry for the noob question
21:27georgekthis is also a good explanation, http://tech.puredanger.com/2009/02/02/java-concurrency-bugs-concurrentmodificationexception/
21:27ChongLihmm I guess I should just use a list
21:28georgekchongli: maybe an ordered set?
21:28ChongLiwell there's a sorted set
21:28ChongLibut I want it sorted like a stack
21:28amalloyChongLi: the best stack+set duo that i know of is a stack and a set glued together
21:29ChongLifirst in last out
21:29ChongLiit's designed to handle keyboard input in an annoying complex way
21:29ChongLithe question I keep banging my head into a wall over is what happens when you press left and right at the same time?
21:30ChongLiI don't think it should cancel out
21:31ChongLiit should always be moving in some direction, allowing you to switch from left to right without stopping in between
21:31ChongLiexcept when no keys are down
21:32georgekwhat are you using to get input?
21:32ChongLiflapjax
21:32ChongLi(F/extractEventE js/window "keydown")
21:32ChongLieetc.
21:33ChongLimerging it all into one event stream that produces a simple value of the keyboard at that moment
21:35ChongLiperhaps this is the wrong approach altogether
21:35ChongLihmm
21:40georgekwhen I ask for an iterator() for the HashSet and then do the modification, I then get " Don't know how to create ISeq from: java.util.HashMap$KeyIterator clojure.lang.RT.seqFrom (RT.java:494)"
21:41georgekso what is a better idea -- iterate over a copy of the HashSet?
21:43FrozenlockChongLi: I used sets. Not that it should be used as an example. https://github.com/Frozenlock/zyzanie
21:43xumingmingv&(.iterator (hash-set 1 2))
21:43lazybot⇒ #<SeqIterator clojure.lang.SeqIterator@127a744>
21:43ChongLihow does this handle left and right at the same time?
21:44ChongLiI guess that doesn't really make sense in emacs
21:44amalloygeorgek: same way as anything else in clojure: don't mutate things. compute a new set by applying a pure function to the old set, and then use the new one
21:44FrozenlockChongLi: Let me try that...
21:47tomojI think an ordered set makes sense
21:47tomojwhy do you say LIFO? doesn't the order in which the keyups arrive determine the order in which elements are removed?
21:48ChongLitomoj: you're right
21:49ChongLiso what order should the set be in?
21:49FrozenlockChongLi: Interesting... doesn't work :/ I'll have to correct this bug.
21:50ChongLifor this example sequence of events: keydown "left" -> keydown "right" -> keyup "left" -> keyup "right"
21:50tomoj#{} #{:left} #{:left :right} #{:right} #{}
21:50tomojordered set could implement IPersistentStack so peek would be the most recent key
21:50ChongLiyeah I get that part
21:51tomoj(I meant those as ordered sets)
21:51ChongLiwhat I want to know is what direction will be resolved during each step of that sequence
21:51ChongLiI don't want contradicting keys to cancel out
21:52ChongLithis allows you to chord from left to right without stopping in the middle
21:52ChongLior having some weird reversal of direction
21:52tomojdoesn't peek give you the direction you want on the events above?
21:53ChongLilet me try
21:53tomoj..assuming it returns the last element of the ordered set, the most recent key
21:53dnolencore.logic protocols/interface finally moved into their own namespace, hacking on core.logic should now be less tedious
21:59ChongLiI think I'll just use a list and just use contains? to prevent duplicates
21:59ChongLiis that idiomatic? heh
22:00tomojuse contains?, on a list?
22:00ChongLiwhy not?
22:00dnolenChongLi: contains? only works on associative data structures
22:01tomoj&(contains? '(1 2 3) 2)
22:01lazybot⇒ false
22:01ChongLihmm
22:01ChongLiguess I have to use some
22:03ChongLiyeah this works really well
22:03ChongLisome and remove
22:04ChongLiI'm still using sets though (for the predicate) :)
22:05S11001001ChongLi: sorted maps pointing to constant values are sorted sets
22:05ChongLiI'm not sure I follow
22:05ChongLiI want a set that preserves insertion order
22:07piranhaFrozenlock: speaking about key bindings handling, I recently wrote JS lib for that and instead of binding to elements I choose the way of manually enabled namespaces. I was really determined to do former, but then experience turned out to be that in my case context of key bindings has changed, but focus is somewhere not on the actual nested element (i.e. in menu, where you just switched a tab or something). I'm not sure what I'm trying to te
22:07piranhall, just sharing experience. :)
22:08Frozenlockpiranha: what do you mean manually enabled namespaces?
22:09FrozenlockOh you just missed what I asked didn't you...
22:09Frozenlockpiranha: what do you mean manually enabled namespaces?
22:09piranhaFrozenlock: https://github.com/piranha/keymage#scopes
22:09piranhano, I somehow got it :)
22:10S11001001ChongLi: ah
22:10tomojChongLi: right, an ordered set
22:10tomojhttps://github.com/flatland/ordered
22:10Frozenlockpiranha: What is chat, if not an element?
22:10tomojno cljs though :(
22:10ChongLiyeah I'm on cljs
22:10tomojI'll port it someday
22:10piranhaFrozenlock: just an arbitrary chosen name for a scope
22:11piranhaFrozenlock: so let's imagine I have multiple sections in my application, and I can switch between them (it's a single-page app), then when I go to chat, I call setScope('chat')
22:11piranhaand when I go to contact list management, I call setScope('contacts')
22:11tomojas a stopgap for implementing an ordered set you could just write your own functions that work with a vector and set
22:11tomojordered-conj etc
22:12FrozenlockIsn't it the same as a container with "chat"?
22:12FrozenlockOh I see, it could be divided into two parts in the page...
22:12piranhaFrozenlock: and when in chat, if I press some 'search for a contact' button, I do pushScope('quicksearch'), which handles some shortcuts for this search
22:12ChongLiusing a list with some, conj and remove seems to work well enough
22:12piranhaFrozenlock: exactly!
22:12ChongLisome to guard against duplicate insertion
22:12piranhathat was my problem with elements
22:12piranhawhen you switched with a mouse, your focus is not in the #chat, but in #menu
22:12tomojyeah.. since the number of keys pressed will always be small
22:13ChongLiyeah it's not like I'm dealing with a long list
22:13tomoja list could be faster than an ordered set anyway
22:13ChongLiyeah the constant factor with a list is fairly small
22:13ChongLithough I'm not sure how it works in cljs
22:14Frozenlockpiranha: I dealt with the focus problem with this: https://github.com/Frozenlock/zyzanie/blob/master/src/zyzanie/core.cljs#L295
22:15Frozenlockpiranha: I'm not really sure I understand your problem with chat VS menu however :P
22:17piranhaFrozenlock: <ul id="menu"><li data-tab="chat">chat</li></ul><div id="tabs"><div id="chat"></div></div> - your focus is in #menu, since you just clicked 'chat' li. Your shortcuts, which are bound to #chat, won't work.
22:17piranhathat was my main problem
22:19Frozenlockpiranha: ah ok. What did you do? Manually changed the focus when pressed a tab?
22:21piranhaargh, my connection is abysmal
22:21Frozenlockfrom 1 min ago:
22:21Frozenlockpiranha: ah ok. What did you do? Manually changed the focus when pressed a tab?
22:21piranhaFrozenlock: well, I just do keymage.setScope('chat') there :)
22:21piranhaI really don't want to play with focus :))
22:22piranhaso all my shortcuts are global, but then application switches scopes when it needs to
22:24FrozenlockI like that. Stealing focus was really a dirty hack on my part.
22:24FrozenlockIn fact the whole lot is a dirty hack from when I was learning cljs (without ever touching JS).
22:25xeqiamalloy: the whitelist in the read-eval change allows you to remove namespaces :/
22:28xeqihmmm, what inherits from clojure.lang.Fn?
22:30dnolenread eval fix from rhickey - http://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548, http://github.com/clojure/clojure/commit/38a129f2631a75ed999b52d8e0440f730b00da1f
22:31ChongLiyay!
22:32dnolenand fixes to support flexvec in 1.5.0, hells yeah!
22:32Frozenlock\o/
22:32ChongLisome weird commit message
22:32ChongLidoesn't seem related!
22:33ChongLiI guess github abbreviates it
22:33ChongLiah yeah
22:34ChongLithis is basically a must if we're going to be able to trust edn right?
22:35ChongLiotherwise users could stick arbitrary clojure code in there and it'd be eval'd?
22:35FrozenlockIf you read it.
22:36technomancyyou can fix the default yourself without this
22:36technomancytechnically this just helps catch cases where you forgot to rebind it when reading user data
22:36xeqiI actually think this commit is bad
22:36ChongLiwhy?
22:36clojurebotChongLi: because you can't handle the truth!
22:37technomancybut since the consequences of getting it wrong are so bad and the likelihood of actually realizing it if you did make that mistake, the default matters all the more
22:37dnolentechnomancy: the patch actually fixes more - classForName via the read no longer loads classes.
22:37dnolen(I think)
22:37xeqiwith that patch (read-string "#=(clojure.lang.Namespace/remove user)") will remove the namespace
22:37xeqitesting it for more holes atm
22:38ChongLidid you look further down?
22:38ChongLi#= has been changed
22:38ChongLito include a quote
22:38xeqiI typed it into a 1.5.0-RC5
22:38ChongLi#="
22:38technomancyoh, I haven't read the patch
22:38xeqiwhich is on sonatype-oss with this commit
22:39ChongLi1864
22:39ChongLi- w.write("#="); 1870
22:39ChongLi+ w.write("#=\"");
22:39ChongLigah, tabs
22:41dnolenxeqi: it's RC6 that has those commits
22:43xeqidnolen: RC5 has https://github.com/clojure/clojure/commit/974a64c06917861b7557fd73154254195b2de548
22:43xeqibut I missed the RC6 release
22:43xeqipulling that now
22:55ivannice find re: that hole
22:58dnolenxeqi: oh anything on the *read-whitelist*
22:59xeqidnolen: yep, just send off to -dev
22:59xeqi*sent
23:01dnolenxeqi: yeah, seems like only find is really needed
23:06yedithis line throws an "Unparsable namespace form:" error -- (ns skateproj.db (:use korma.db))
23:09Frozenlockivan: I don't but I'm bound to forget it one day or another.
23:16ivanuser> (ns skateproj.db (:use korma.db))
23:16ivanCompilerException java.lang.ClassFormatError: Truncated class file, compiling:(clojure/java/jdbc.clj:299:3)
23:19yedii just ran it in the repl (instead of lein ring server) and i got this instead: FileNotFoundException Could not locate korma/db__init.class or korma/db.clj on classpath: clojure.lang.RT.load (RT.java:432)
23:20ivana repl started by lein repl?
23:21amalloyxeqi: the Collection and Map entries on the whitelist scare me way more than Namespace
23:22xeqiamalloy: why so?
23:22amalloyeven using a non-classloading version of Class/forName there's got to be potential for invoking static methods on dangerous subclasses of Map
23:23technomancya dos via Namespace/remove is a pretty serious improvement over arbitrary execution still =)
23:23xeqitechnomancy: theres no workaround in RC6 tho
23:25ivanjust have to bind *read-whitelist* too now
23:25xeqiamalloy: true, I was looking for a class with fun static methods earlier
23:25ivanthe tribal knowledge expands
23:25xeqiivan: ... your right
23:25xeqithanks
23:26xeqiamalloy: the non-classloading version of Class/forname means no static initializer problems right?
23:26yediivan: nrepl in emacs
23:26amalloyprobably, though i haven't looked at it
23:27ivanyedi: did you use nrepl-jack-in to start it? did it find the right project.clj? does that project.clj mention korma?
23:28tomojis there a flexmap which supports fast merge?
23:29xeqi#=(var ..) looks dangerous, but would require some application code to help it
23:29yedimy project.clj has korma as a dependency
23:30yediivan: i did use nrepl-jack-in
23:30yedinot sure if it found the right project.clj, though i assume so
23:31amalloyxeqi: the application code would have to be explicitly setting *read-eval* to true, right?
23:32amalloyso i don't think there's any need to worry about that
23:35ivannope, #=(var does things with *read-eval* false
23:35xeqiamalloy: even with false and RC6, using #=(var ..) causes it to return the resolved var;
23:36xeqiimagine someone expecting a map and doing (expected-map :x)
23:43yediall the dependencies in project.clj get added to your classpath right?
23:48mabesanyone know of a command-line friendly debugger for clojure?