#clojure logs

2013-01-26

01:24warzhrm, how do you import an AOT compiled class in seperate clj file? (gen-class)
01:24warzwould i import it like a java class?
01:26warzi might just need to go with java for this stuff, haha. i was going to try to be cool and use clojure.
02:41tenpaiyomiQuick question…just learning, so it's a bit of a newbish question, but I am trying to do an if-else statement, and I understand that it needs to be setup in a scenario like (if cond true_result false_result), but I'm not entirely sure how I would set it up in a scenario that my either of my true or false needs to be more than a single action. Like, say I'm wanting to perform an action on 2 different variables, each on a separate lin
02:41tenpaiyomiI've tried wrapping them in parenthesis, but that causes an error.
02:45amalloytenpaiyomi: (do x y). but since most things in clojure are immutable, that's useful/necessary less often than you think so far
02:46tenpaiyomiamalloy: Thanks, I actually figured the do statement out, my only problem now is my get is returning nil, even though I verified that the value I am trying to get exists in my vector...
02:55wei_how do you build a cljs plugin for release to clojars?
02:55wei_e.g. I'm trying to push my fork of fetch, https://github.com/ibdknox/fetch, but I'm not sure how to compile the jar.
02:57FrozenlockThe voices of Cljs are impenetrable "Uncaught TypeError: Cannot read property 'xk' of undefined"
03:02ivanthat usually means a property got renamed that you did not want renamed
03:02ivanyou need externs for third-party libs. you probably already know this.
03:02FrozenlockWell yeah... but which one...
03:02ivanheh
03:03FrozenlockYes, done... perhaps it was not taken while compiling...
03:03PhonatacidHi. I'm trying to implement "augmented" agents and I'd like to have some advices about restructuring the args I use for creating them. Basically I'd like to add, say, 3 keyed arguments, provide default values for them, check for the presence of one of them (the preconditionnal way), then place all of them in the agent meta-map.
03:03PhonatacidBasically my function's prototype would look like
03:03Phonatacid(super-agent [state :myarg1 myval1 [:myarg2 myval2 :myarg3 myval3] & agentargs].
03:03PhonatacidHow can I achieve this ? (sorry for the spam)
03:25wei_suddenly getting a lot of these errors: WARNING: Use of undeclared Var jayq.core/clj->js at line 75 file:/Users/wei/.m2/repository/jayq/jayq/2.0.0/jayq-2.0.0.jar!/jayq/core.cljs.
03:26wei_using jayq 2.0.0 and lein-cljsbuild 0.3.0 (most recent everything, I think)
03:26wei_how do you see what version of clojurescript you're using?
04:36rlI'm trying to write a HTML template system. Is it possible to set a namespace in a paticular function to avoid naming collisions?
04:38rlMy idea is to produce a list of expressions, where each expression should evalulate to a string
04:39rlbut I want to disallow "global variable" access
04:43magnarsI have a map, and I want to "map over it" to create another map with the same keys, but with all the values transformed by a function ... I'd wager there's some nice built in function to do just that?
04:43tomoj:D
04:45tomojthere's no nice built in function
04:47magnarsreduce it is, then - thanks!
04:47tomojpeople usually do stuff like (into {} (for [[k v] m] [k (f v)])) I think
04:48magnarslook at that - not too shabby. Thanks!
04:48tomojreducers could someday do it
04:59rlhm so in clojure is there a way to not allow access to symbols that are not defined in a function?
05:04rli guess i can do some hack to real the template in a file, and in the documentation say to access variables for the template use (:key vars) or something....kind of ugly though =/
05:05rlI still don't like the fact global variables can still be accessed <_<
05:06amalloyit's basically impossible to do anything without referring to globals
05:06Sgeoamalloy, Newspeak?
05:06SgeoWell, at least, if the full Newspeak system was working properly
05:24zby_home(seq (.split #"," "one,two,three"))
05:24zby_homeis there an eval bot here?
05:25tomoj&(seq (.split #"," "one,two,three"))
05:25lazybot⇒ ("one" "two" "three")
05:25zby_homethanks
05:26zby_homeat my interpreter it fails with: Exception Ambiguous match for ",\" \"one,two,three\"))" by #<Object[] [Ljava.lang.Object;@6a9cce0f>
05:26zby_homeis that a known feature?
05:30tomojI think there's something wrong with your interpreter
05:51cemerickzby_home: are you squared away now?
05:53zby_homecemerick - more or less
05:54zby_homeI found that the problem was with the session wrapper
05:54cemerickhow so?
05:55zby_homehttps://groups.google.com/d/topic/ring-clojure/0QslnWVSoNg/discussion
05:56zby_homemaybe it is something obvious - but I thought that (dev app (wrap-session handler)) is the same as (defn app [request] ((wrap-session handler) request))
05:56zby_homeit should be the same function
05:56zby_homebut the second at each request sends a new session cookie
05:56cemerickyeah, that makes sense
05:57cemerickno other way for it to generate a constant key on a per-middleware-usage basis
05:58cemerickan implicit side effect :-P
05:58zby_homeaha
05:58zby_homeOK
05:59zby_homeI think there was one more thing
06:00zby_homeyeah: https://gist.github.com/4633508
06:01zby_homecemerick ^^^
06:03cemerickand you're sure you're using the specified code and getting that behaviour? That would happen if you're getting a different session key on every request, as you discovered separately.
06:03zby_homethat's a different one
06:04zby_homethe session key I eventually figured out how to workaround
06:04zby_homethat is not use 'defn'
06:06zby_homeI'll regenerate it here
06:06zby_homeand check it again
06:08cemerickzby_home: it's exactly the same thing; you're using defn to define secured-app
06:08zby_homeOK - I'll check it here - I think I fixed that part yesterday
06:16santo`Is it good for Clojure to have multiple platforms?
06:17santo`?
06:18zby_homecemerick - OK - so the last version that I save is this: http://nopaste.me/paste/7719855465103bb61f1a60
06:18zby_homeand it still have one problem
06:18zby_homewhich is a 404 on the /admin page
06:18zby_homeI have not yet really analyzed it
06:19zby_homebut maybe it is something obvious
06:20santo`Can I run ClojureCLR on linux with mono?
06:22santo`Helllo?
06:22ChongLisanto`: hi
06:23ChongLiI believe it can run on mono
06:28cemerickzby_home: nice, Friend bug
06:29cemerickchange the /admin branch to: (friend/authorize #{::admin} (do response-map-here))
06:29cemerickit's actually a bug/feature :-P
06:29ejackson:)
06:30zby_homeresponse-map-here - literally or use my map there?
06:30cemerickthe latter
06:31cemerickI enhanced authorize a while back to accept an (optional) second map argument, that is merged into the unauthorized error stone if present.
06:31zby_homeworked :)
06:32cemerickPerhaps a poor mimicry of the maps used for pre/postconditions in clojure fns.
06:32zby_homesorry - but that does not ring any bell for me
06:32zby_homeI started learning clojure just a week ago
06:32cemerickdon't worry about it :-)
06:32cemerickThanks for the report
06:32zby_home:)
06:33zby_homedo you plan to add an example to the code?
06:33zby_homeI mean something that people like me could just copy
06:33zby_homeand run
06:33zby_homethis would be very useful
06:34zby_homeI did not know how to run the example from tests
06:34cemerickzby_home: working on it: https://friend-demo.herokuapp.com/
06:34zby_homegreat!
06:34zby_homeOK - thanks for your help
06:34cemerickthanks for your patience :-)
06:47augustlanyone got some suggestions for getting started using ZeroMQ from Clojure?
07:24cemerickzby_home: here's an issue you can track for that bug: https://github.com/cemerick/friend/issues/46
08:28zeussphinx?
08:49Thallasios_Xelonhello :))
08:49Thallasios_Xelonanyone using counterclockwise?
08:50Thallasios_Xelonis there a way to run again without a new repl window?
08:50Thallasios_Xeloni mean when i press run,to update the last on
09:17rodnaphcore.logic - i'm trying to write a relation to assert a list contains unique values, but am completely stumped - can anyone help?
09:21borkdudedoes someone here has an org-mode/jekyll basic skeleton which I could use?
09:42xumingmi`anyone know Rich's email address? I have sent him the Clojure CA, want to send him an email to inform him
09:48marcellus123i want to use a jquery plugin that basically requires setting a bunch of callback methods on an object. is there a smooth way to handle this in clojurescript? Would it be horrible to just, in JS, make an object that just fires an event on each callback and then deal with them in cljs?
09:50Thallasios_Xelon<Thallasios_Xelon> anyone using counterclockwise?
09:50Thallasios_Xelon<Thallasios_Xelon> is there a way to run again without a new repl window?
10:11Thallasios_Xelonthere is an update for counterclockwise
10:11Thallasios_Xelonits very usefull
10:17borkdudeThallasios_Xelon what kind of update
10:22hyPiRionxumingmi`: You'll automatically pop up under http://clojure.org/contributing when it's been received
10:33FrozenlockCould anyone take a look at this externs.js file? The advanced compilation munge names it should not and I'm wondering if it's because I did something wrong in this file https://github.com/Frozenlock/envision-cljs/tree/master/src-cljs/externs .
11:09tazleshould (line-seq (java.io.BufferedReader. *in*)) terminate at some point?
11:10progonot if the EOF isn't given
11:11progoconsider how 'cat', 'wc' etc work.
11:11tazlewell, there should be an EOF with <-redirection
11:12progoYes, unless it's a pipe
11:12tazleit's a file, and cat terminates but doseq on the above doesn't - weird
11:17Thallasios_Xelonis there a way to find the line of the error i know (pst)
11:23jeremyheilertazle: is this essentially what you are doing? https://www.refheap.com/paste/8987
11:25tazlejeremyheiler: https://gist.github.com/4643117 is what I'm doing
11:25tazleand then lein run -m log4j-parser.cat < ../snippet
11:30jeremyheilertry: lein trampoline run -m log4j-parser.cat < ../snippet
11:30tazlethen it terminates
11:31danI'm new to clojure, and struggling to construct a map of of arithmetic inverses. This works as expected: (def inverse {:+ - :- +}), but this fails with an invalid token exception: (def inverse {:+ - :- + :/ *}). Is there some some kind of escape character I can use to create this map?
11:31ChongLidan: yes
11:31ChongLiyou can quote those symbols
11:31jeremyheilertazle: what's happening here (i think) is that standard in with out trampoline is being directed to lein, not your code.
11:32uvtcdan: use '+ and '- (instead of bare + and -)
11:32ChongLi(def inverse {'+ '- '- '+ '/ '* '* '/})
11:32danAh, thanks to you both. That seems so obvious now. =)
11:32tazlejeremyheiler: and leiningen is then passing it on, and not closing things, it seems
11:32ChongLi&({'+ '- '- '+ '/ '* '* '/} '+)
11:32lazybot⇒ -
11:33jeremyheilertazle, you'll normally file bugs here: https://github.com/technomancy/leiningen/issues
11:34jeremyheilerbut i dont' think this is a bug
11:34tazlehow is it not a bug to not close the stdin of a program you run if you aren't going to write to it anymore?
11:35progoyes. An eof's an eof.
11:37jeremyheilerusing trampoline allows you to run your project in its own jvm. if eof is never given to the stream with out trampoline, then why should it terminate?
11:38progobut the EOF is given in that case
11:54augustlanyone here ever used zeromq from clojure? Trying to figure out how to make leiningen use the .jar I compiled from the jzmq git repo.
11:58no7hingyou could always install it in your local maven repo
11:58augustlno7hing: I tried, but leiningen doesn't find it for some reason
11:58augustlI get an early adopter vibe from trying to use ZeroMQ from the JVM :)
11:59a|ianyone using SumblimeREPL here?
11:59no7hing@augustl you're not the only one getting burned by zmq + jvm
11:59Foxborona|i: yes
12:00a|iFoxboron: what is that damn ^,,l key shortcut in osx for evaluating a line?
12:00Foxborona|i: when i was on Windows the keys where broke. So i am not sure if that also applies on OSX, i suggest you go into the keymap files for sublimeRepl and check the OSX keymap
12:01a|iFoxboron: it's this: { "keys": ["ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines"}} and it never works.
12:01a|ihow do people work with repl + sublime text if that shortcut doesn't work?
12:01Foxborona|i: you change the key and see if it works.
12:02Foxborona|i: try use "cmd" instead of "ctrl"
12:02a|iFoxboron: cmd+, is a classic for preferences in mac.
12:02a|iis it possible to connect repl with the lein project once, and have it auto reloaded when the file saves?
12:03Foxborona|i: ummm....nope
12:04a|iwhat's the state of light table ide?
12:04a|iI'm just looking for a sane ide other than emacs+smile.
12:04Frozenlockemacs+nrepl?
12:05a|iFrozenlock: how is that better?
12:05Foxborona|i: tried emacs and nrepl?
12:05FrozenlockOh, better...
12:05Foxboronits just. better
12:05Foxboronmore awsomesausce packed into one thing
12:06FrozenlockFoxboron: I still consider nrepl.el ~= slime
12:06a|iFoxboron: trying to get some newbies into clojure, they are not of emacs/vim type. clojure itself is enough barrier, asking them to learn emacs makes it just more difficult to market clojure to them.
12:07jeremyheilera|i, perhaps have them use eclipse with counterclockwise?
12:07Foxborona|i: i see. I believe a texteditor + repl is the best option. If you solve the keymap issue with sublimeREPL it should be easy
12:07a|ijeremyheiler: ccw also has broken windows here and there.
12:07a|iit looks like there is no close to official quality ide for clojure outside of emacs.
12:08Foxborona|i: sad truth
12:08a|ieven scala came to the conclusion that they have to support an ide officially.
12:09Frozenlocklets make clojure officially support emacs :)
12:09craigbroindeed
12:10craigbroa|i you don't want "auto reload when saved"
12:10a|iFrozenlock: emacs is not for everyone. that'd be amistake.
12:10craigbroa|i: you compile teh file, it will save
12:10craigbroC-c C-l will prompt to save if it hasn't been, or you just eval specific expressions. Clojure is not quite so "file" based.
12:10craigbroC-c C-k that is, sorry
12:11Frozenlocka|i: There's no IDE for everyone...
12:11FrozenlockUnless you count our dear friend Notepad.exe. Ah, notepad.
12:12Foxborona|i: i debugged the keymap for you
12:12Foxboronfound the error
12:12Foxboron(in sublime)
12:12augustlhmm, "NoClassDefFoundError Could not initialize class org.zeromq.ZMQ java.lang.Class.forName0 (Class.java:-2)", this is fun..
12:12a|iFoxboron: I think they fixed it that bug: https://github.com/wuub/SublimeREPL/pull/116
12:14rationalrevoltDoes a var need to be tagged dynamic in order to bind it using binding? In the repl (binding [a 20] (println a)) works even if a was not declared using the dynamic metadata
12:14Foxborona|i: if you search for repl_transfer_current in the keymap file, and change the keybind from ["ctrl+","l"] too ["ctrl+l"] it works without a hazzel atleast
12:14Foxborona|i: if you also decide too use Sublime, i might have 2 helpfull plugins for Sublime.
12:15a|iFoxboron: I installed your clojure docs, but didn't figourout how to use it.
12:16Foxborona|i: hah. ctrl+shift+p, search for "clj" and you will find it.
12:16Foxborona|i: i believe the keymap files might be a bit fucked on several systems (my fault for not correcting that)
12:17a|iFoxboron: I meant how to _use_ the plugin. how do you get the docs for something?
12:18augustlhow do I modify java.library.path without hardcoding the path into my project.clj?
12:18Foxborona|i: ctrl+shift+p, find "clj-docs", you will see a search bar in the bottom. Type... "hash-map" as an example. Then you wait 2 sec and you should see the menu
12:18Foxborona|i: i might go about making a cache system so you can search the docs offline also.
12:19a|iFoxboron: is it possible to get the docs for a selection?
12:19Foxborona|i: you mean, selecting a keyword?
12:19a|iFoxboron: eg, if I select 'map', is there a shortcut to bring up the doc for map?
12:20a|iFoxboron: or better, something like light table?
12:20Foxborona|i: i was actually going to add a light table'ish system. But i havent coded up everything yet.
12:21Foxborona|i: the shortcut is "supre+shift+c"
12:21Foxboronyou can place your cursor beside the item, or select it.
12:21augustlseems my only option is to set :native-path to "my-jni" or whatever, and put my compiled stuff there, rather than specifying to leiningen where it actually resides on my system
12:22technomancyaugustl: :native-path is an output path; it's where lein extracts native components of dependencies
12:22Foxborona|i: also, if you have any suggestions for the plugin in general, just throw me a PM.
12:23technomancyaugustl: there's no setting for java.library.path except :jvm-opts currently
12:23technomancyhttps://github.com/technomancy/leiningen/issues/906
12:23augustltechnomancy: hmm, according to http://www.paullegato.com/blog/jni-leiningen-native-path/ setting :native-path also sets java.library.path
12:23a|iFoxboron: great, thanks.
12:23augustltechnomancy: I see. I currently have my native stuff in /Users/augustl/local/zmq, do I have to hardcode that specific path into project.clj?
12:23Foxborona|i: i have not added threading, so a little freeze when you search is normal. (it's bad i know)
12:24technomancyaugustl: that's intended for managed native components, not manually installed stuff
12:25augustltechnomancy: hmm, not following. ~/local/zmq is the path to the native libs for zmq that the jzmq project loads via jni
12:27technomancyaugustl: I mean the :native-path setting is intended as a way to tell Leiningen "if you find any native components in the dependencies, extract them to the filesystem here"
12:28technomancyaugustl: it's not intended for "oh by the way, I have some native code that I downloaded myself; here it is"
12:28technomancyfor the latter, currently :jvm-opts is the only way to do it, but we should add better support for it; see the issue link above
12:29augustltechnomancy: I see, thanks
12:31augustlboth :jvm-opts and JVM_OPTS in env worked fine
12:44rationalrevoltHi room, can someone point me to why I am able to use binding with vars that were not declared dynamic?
12:44rationalrevoltI'm supposed to be getting an exception, but i don't
12:45rationalrevolti'm trying this in the repl
12:45rationalrevolt(def a 10) followed by (binding [a 20] (println a)) - this shouldn't work because a wasn't declared with ^:dynamic
12:46dnolenrationalrevolt: doesn't work for me. What version of Clojure are you running?
12:47rationalrevolthmm, 1.2.0 maybe thats why?
12:47dnolenrationalrevolt: yes
12:48rationalrevoltthanks, i dint realize
12:48dnolenrationalrevolt: 1.2.0 is pretty old - unless there's a good reason I would move to 1.4.0
12:49rationalrevoltright, i was playing with the example for compojure - din't realize the lein deps were configured with the old version
12:49seangroveJesus, creating a custom component for goog.ui is insanely verbose
12:50rationalrevoltsorry enlive
12:50dnolenwow compojure is still on 1.2.1?
12:50rationalrevoltno, i corrected myself: for enlive
12:51rationalrevoltthe templating library
12:51seangroveAnd it's not really clear how to do this in cljs
12:52dnolenseangrove: yeah, you need to write some macros for it not be a hassle. The UI components are done in a very classical OOP style if I recall.
12:53seangroveDamn, this is the last thing to do before release :P
12:53seangroveWell, I'll feel better once I've started I suppose
12:54seangrovednolen: So it looks like I need to make a function, and then alter its prototype: https://www.refheap.com/paste/8990
12:55seangroveI'm struggling a bit to think of how to translate this to cljs
12:56dnolenseangrove: that's what deftype does - creates a function and alters the prototype
12:56seangroveAh, hadn't come across deftype before
12:57seangroveWill look it up
12:57dnolenseangrove: all the data structures are written in terms of it - it's the "closest" thing to the host.
12:58FrozenlockWait, so I didn't need "(set! (.-createDragElement (.-prototype new-dragger)) create-drag-element-fn)" :/
13:00dnolenFrozenlock: nope, you can plain object menthods to deftype's via Object
13:00dnolen(deftype Draggable [...] Object (createDragElement [this] ...)) etc
13:00dnolen"you can add plain object methods to deftype" I mean
13:01tgoossensI'm making a clojure implementation of the STRIPS planning algorithm. An operator is represnted by e map. I noticed that I make a LOT of copies during the algorithm. And also there are a lot of equality tests (comparing maps seems expensive to me).
13:01tgoossensI'm considering giving every operator an ID.
13:02tgoossensOr make it an atom. But since operators are values and hence will never change i think that is an unnecessesary addition of compexity
13:03tgoossenshttps://github.com/tgoossens/cljstrips/issues/2
13:03tgoossensa bit extra description:
13:04tgoossensthere are several possible "links" in the strips algorithm. Establish link "operator X establishes a precondition of operator Y"
13:04tgoossensbefore: "operator X must come before operator Y"
13:04tgoossensin my first attempt
13:04tgoossensan before link was {:first operatorX :last operatorY}
13:04Bodilseangrove: If you're having to deal with JS OOP stuff, you might want to look at https://github.com/bodil/pylon
13:05Bronsadnolen: in clojure that's not possible to do, but in clojurescript's datastructures implementation that's done extensively, do you think this means that deftypes should be able to specify methods not owned by any protocol/interface?
13:05tgoossensoperatorX being effectively the operator value.
13:05tgoossensI'm fearing that this cannot be very efficient
13:05tgoossensSo my question is. Any thoughts, concepts I should look into that might help me to solve my problem
13:06tgoossensor to better understand my problem
13:06seangroveBodil: Oh, wow, this looks great for dealing with closure classes
13:06augustltechnomancy: http://augustl.com/blog/2013/using_zeromq_from_clojure/ :)
13:06seangroveDoes the :extends keyword come out as goog.base()?
13:06dnolenBodil: nice!
13:06Bodilseangrove: Yeah, it's using goog.* stuff internally, so it shouldn't give you any trouble.
13:07dnolenBodil: hmm, why doesn't it work w/ advanced compilation if you're leveraging it on Closure?
13:07Bodilseangrove: It uses goog.base() to extend, yes. :)
13:08Bodildnolen: Wish I knew, but the compiler kept mangling my method names...
13:08seangroveAh, but I need advanced compilation to deploy in production - you can't use that with pylon?
13:08seangroveAh, just saw that, hah
13:08BodilNo :(
13:08dnolenBronsa: probably. If I recall there's a few other things that deftype needs for real JVM CLJ-in-CLJ
13:09dnolenBodil: hmm, so names get mangled w/in a project? Like code in the same project can't call code?
13:10dnolenBodil: oh you use aset & aget, why not switch those to static access?
13:11Bodildnolen: Should that matter? It seemed to compile down to the same thing anyway, iirc?
13:12dnolenBodil: no it does not. aset -> foo["yucky_string"]
13:12dnolenset! -> f.nice_property
13:12Frozenlock!!!
13:12FrozenlockI've been trying to make advanced compilation work for hours! It might just be this!
13:12Bodildnolen: Aha, interesting - I'll have a go and see if that helps.
13:13dnolenBodil: if you change that, everything should work out nicely with advanced compilation
13:13seangroveThat'd be awesome :)
13:13piskettiPerhaps a stupid question but is there any way to bind the last item of a coll using destructuring?
13:13piskettiIn contrast to binding the first by something like [[x & xs] coll].
13:14tgoossensreverse?
13:14tgoossens [[x & xs] (reverse coll)]
13:15tgoossens,(let [[x & xs] (reverse [1 2 3]) x)
13:15tgoossensbut i guess that's not exactly what you need
13:16piskettithanks. I'd lose other bindigs but that's definitely a way to get the last
13:16tgoossensor
13:16dnolenpisketti: not possible
13:17tgoossens,(let [[x & xs] '(1 2 3) y (last xs)] y)
13:17dnolentgoossens: it's pretty normal to need ids when programming in language designed around immutable values
13:17tgoossensdnolen: not much experience here :)
13:17dnolentgoossens: just do it w/ ids
13:17piskettidnolen: ok
13:18Bodildnolen: Hmm, lein-noderepl doesn't work with the latest cljs release - what did you change? :)
13:18dnolenBodil: hmm, there was a REPL related change to Rhino support
13:18dnolenBodil: if you can do a git bisect that would be helpful.
13:19Bodildnolen: Just reverted to Rhino for now, I'll try and figure it out later...
13:19dnolenBodil: there needs to be a CLJS project test matrix ...
13:21wei_is there a way to use the clojure.math.numeric_tower library in clojurescript?
13:21dnolenBodil: looking at pylons the one tricky bit is needing to set a local, I don't think that one bit can be done w/o js* unfortunately.
13:21seangroveWell, for browser-testing I know Sauce Labs has free testing for OSS projects
13:21wei_actually, I really just need a round fn
13:22Bodildnolen: Where's that?
13:22dnolenline 15 in classes.cljs
13:22dnolenwhere you set properties in the ctor
13:22wei_js/Math.round
13:22technomancywei_: the javascript runtime doesn't really support ... reasonable numerics
13:22wei_haha
13:22technomancyit's more like a numeric hovel
13:23seangrovewei_: Why not use js/Math.round?
13:23seangrove(def round (.-round js/Math)) (round 99.54)
13:23wei_just found out about that. thanks
13:23dnolenBodil: actually, it can be done - looks like this-as allows it
13:23seangroveAh, ok, heh
13:23dnolenBodil: just tried (defn foo [x] (this-as this (set! (.-bar this) 1))), works
13:24equalsdannyGuys, does anybody know why does `lein run` takes up to 4 seconds to launch a simple project?
13:24equalsdannyI think I definitely miss something
13:24Bodildnolen: Did you solve this already? :)
13:24dnolenequalsdanny: JVM start up time + compilation time.
13:24dnolenBodil: I think that was fogus actually
13:25equalsdannydnolen: is there any way to keep JVM up so that I can reduce the edit-compile-run cycle a bit?
13:25craigbroequalsdanny: don't edit comile run
13:25craigbroequalsdanny: use emacs+nrepl for intereactive developemnt
13:26dnolenequalsdanny: most people don't bother with lein run, they code interactively w/ a REPL
13:26Bodildnolen: Problem is, I need to set a dynamic property...
13:26dnolenBodil: which property?
13:27craigbroequalsdanny: basically, you load up your whole program, and then you edit little bits of it, and compile and load just those parts, and then you have the REPL where you type in code snippets to test them, or "run" your program
13:27craigbroequalsdanny: stop me if I'm being overly pedantic 8^)
13:27Bodildnolen: A lot of them - I'm wrapping every method in a bind function...
13:28dnolenBodil: hmm I don't see any cases where you setting a dynamic name ...
13:28dnolenBodil: oh ... the bind list
13:28Bodildnolen: Yeah, and likewise with the actual method definitions - like (aset prototype function-name function-value)
13:29equalsdannycraigbro: I will try to set that up. thx :)
13:30dnolenBodil: ok, yeah - I thought you were trying to do something where you wouldn't need to use dynamic names like that. The bit about leverage Closure threw me off.
13:31Bodildnolen: No, that's the problem right there - because js* only takes inline strings, I can't construct anything Closure Compiler would recognise.
13:31tgoossensdnolen: is it also normal that I have to pass to functions like "threatens?" the mapping of id to value. Or is it more a sign of a flaw in my design
13:32dnolentgoossens: it's not strange to have to write functions around managing ids
13:34dnolenBodil: hmm yeah ... sorry to mislead :( tho I don't really understand yet why making something that interops well w/ the Closure class stuff is diffcult.
13:35technomancyequalsdanny: you can also try export LEIN_FAST_TRAMPOLINE=y lein trampoline run
13:35technomancysuccessive runs can skip the "outer" JVM
13:35seangroveWhat do I :require if I want to use goog.base, goog.inherits, goog.now, goog.addSingletonGetter? *shudder*
13:35Bodildnolen: I think it needs to have the methods annotated as such, or something. Problem is, it mangles method invocations because it doesn't realise they're actually defined.
13:35dnolentgoossens: the whole id thing seemed weird to me as well, eventually it sunk in, I also saw Ben Moseley talk about it in the context of Haskell at TechMesh so I'm pretty sure this how it must be done sometimes
13:35dnolentgoossens: http://shaffner.us/cs/papers/tarpit.pdf
13:36dnolenis a great read
13:36dnolenBodil: hmm ...
13:36craigbrohehe
13:37craigbroI shoudl check that out
13:37dnolenBodil: back in the day I was against providing something to allow creation of Closure style classes - now I'm thinking it's not such a bad idea.
13:37craigbrothe inspiration for FRP application in my project came during a nap on the futon in my old apartment, quite vivid
13:37dnolenBodil: it's come up many times ...
13:38seangrovednolen: At the very least for interop, not for building cljs systems on
13:38dnolenseangrove: yeah
13:38Bodildnolen: It's a good idea for interop, though I hate the idea of putting classes in Cljs on general principle...
13:39dnolenBodil: yes, for interop - it's kind of a glaring omissions considering we ship CLJS w/ Closure but then don't provide proper tools to use it :P
13:39Bodildnolen: That's definitely a valid point :)
13:41clojure-newbcemerick: hi, I'm having a little trouble understanding what is happening with an NPE on the BCrypt.hashpw used by 'friend' when I substitute one user map for another…, I'm guessing its the structure of the hashed/encrypted item ?
13:43dnolenopened up a ticket for "genclass" for CLJS - http://dev.clojure.org/jira/browse/CLJS-463
13:44Bodildnolen: Nice :)
13:47ziltiHow do I turn the contents of an InputStream into a byte array?
13:47dnolenBodil: let me know about noderepl when you get a chance
13:47Bodildnolen: Will do.
13:49craigbrozilti: byte arrays don't really exist in clojure
13:50craigbrozilti: seems more like a java question
13:52clojure-newbhey guys, sorry, should have opened the question out further… I've got two maps each with a :password key (bcrypted value) one is causing an NPE with friends 'bcrypt-credential-fn' function via 'BCrypt.hashpw' any ideas ?
13:53clojure-newbboth passwords were hashed the same way
13:53craigbrozilti: you might actually find a useful solution here:
13:55craigbrohttp://stackoverflow.com/questions/7250229/reading-a-binary-file-into-a-single-byte-array-in-java
13:55craigbrothe solution depends on the input stream a bit
13:55craigbroclojure-newb: I would open up bcrypt-credential-fn and see what data it is passing to Bcrypt.hashpw - and then work backwards
13:55clojure-newbcraigbro: thx, I'll give it a go
13:55tgoossensdnolen: thanks
13:55craigbroif I was in emacs I would jump to source
13:56craigbrotoggle read-ony if needed
13:56craigbroand then add in some prints
13:56tgoossensdnolen: you are elready the second person who sends me out of the tarpit. Better take a look at it :p
13:56craigbroeval the defn and try again...
13:56clojure-newbcraigbro: I'm an emacs newb too though I'm trying to get started with emacs live
13:56ieurezilti: I use Apache commons-io's IOUtils class for this kind of stuff. Works fine.
13:57craigbroclojure-newb: ah, ok, not fmailiar with that distribution exactly, but I imagine you are using nrepl to connect to a running clojure process?
13:57ieurezilti: This method is probably close to what you want: http://commons.apache.org/io/apidocs/org/apache/commons/io/IOUtils.html#toByteArray(java.net.URI)
13:57clojure-newbyes
13:57ziltiieure, craigbro : Thanks!
13:58craigbroclojure-newb: ok, first, try this: M-x help m
13:58craigbroaka, get mode help
13:58clojure-newbok will do
13:58craigbrodo that when you are inside a buffer with clojure source code
13:58craigbroit'll tell you all the keymappings available
13:58craigbrouseful stuff
13:59craigbroIf you do M-.
14:00craigbroit jumps to the definition of the function your cursor is on
14:00clojure-newbnice
14:00Bodildnolen: Would the closure compiler actually care if a property access is foo.bar or foo["bar"] as long as "bar" is a string literal?
14:02clojure-newbcraigbro: hmmm, I get .../TAGS is not a valid tags table.. but i'm not sure what that means
14:04cemerickdnolen: thanks for the commit; hope the ___repl_env thing wasn't too janky :-)
14:09craigbroclojure-newb: interesting, apparently you don't have clojure-mode or something
14:09craigbroclojure-newb: I don't know emacs live enough to help beyond that
14:10clojure-newbcraigbro: no worries, I'll tinker with it,… sure I had it working before
14:16clojure-newbhmm, doing some debug the old fashioned way println of creds defined in 'credentials.clj' line 45 displaying : '{"me" {:username "me", :password "$2a$10$/K2EysmmQFNYpBgZ8XUkneIPPIshpSXeUD3Mug2dupO/rts/B5Fem", :roles #{:x.y/user}}}' gives me the NPE, anyone got any ideas ?
14:16clojure-newbsorry, this was using 'friend'
14:17clojure-newbits definitely the password value causing me problems, substituting it for one created in a map locally works
14:17seangroveBodil: Couldn't you use protocols for some of the closure ui interop?
14:17seangroveThe components have the same interface anyway
14:17yedihow do i know if paredit in emacs is active? (what does it actually do)
14:18seangroveyedi: If you type '(' then ')' automatically appears
14:18seangroveSame with [,{,"
14:18daimrodyedi: C-h v paredit-mode RET t means it's active; you can also look at the mode-line.
14:18Bodilseangrove: I don't know, I'm not doing Closure UI interop. :)
14:18seangroveAnd you can't delete a single paren (i.e. they can never be unbalanced)
14:18seangroveBodil: Heh, ok, just wondering if I had missed something
14:19cemerickclojure-newb: can you paste some code / stacktrace anywhere?
14:19seangroveHaven't used protocols yet, feels like shaky ground to start on, but I'll give it a go
14:19clojure-newbcemerick: sure.. one moment
14:21Bodilseangrove: For my purposes at least (subclassing Ace and Backbone) protocols won't help.
14:21seangroveBodil: Why's that?
14:21seangroveStill wrapping my heads around them a bit
14:22Bodilseangrove: Because they aren't subclasses, they're just a way to extend Cljs's idea of what a preexisting JS class/type/whatever can do.
14:23seangroveSure, but I was thinking about defining a protocol, deftyping it, constructing on, and then manually going goog.inherits(x, y)
14:23clojure-newbcemerick: stack trace is at : https://www.refheap.com/paste/8992, preparing code sample now...
14:24Bodilseangrove: Yeah, that sounds like it might work.
14:26clojure-newbcemerick: code is at https://www.refheap.com/paste/8993
14:26borkdudemaybe some people in here know this? org-mode seems a bit quiet: I am translating some org-mode to html for a blog I'm trying to setup. Why does this [[/img/foo.jpg]] gets translated to <img src="file://img/foo.jpg"/> and if I do [[./img/foo.jpg]] the file is ommitted? it should be ommitted always in my case
14:27clojure-newbcemerick: when I replace users with users-new I get the NPE though the password is the same one at creation time, crypted in the same way
14:28FrozenlockArg! I'm trying to use an external js library with advanced compilation. I've made my externs file. The compiler won't munge the main name "some-library", but everything under it will be... "some-library.xd.ax". Sound familiar?
14:29seangroveborkdude: Presumably the /../ looks like a filesystem path
14:30skelternetborkdude: is the leading slash a problem?
14:30borkdudeskelternet yes
14:30seangroveI'd just look at the code for it
14:30skelternetborkdude: http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
14:30skelternetI mean in the image tag. Maybe it should be [[./img/foo.jpg]]
14:31cemerickclojure-newb: users-new needs to return the credentials map (i.e. the value of (users "me@me.com)). You're creating and returning the full map of identities.
14:31skelternetor [[img/foo.jpg]]
14:31borkdudeskelternet so no absolute paths huh
14:31borkdudeskelternet no, it should be /img in my case, because the images are not on the same level as the html (org originally)
14:32clojure-newbcemerick: doh! thanks for your help
14:32dnolenBodil: it does care
14:33dnolencemerick: np
14:34skelternetborkdude: the file /img/foo.jpg actually exists?
14:34yedihas anyone gotten nrepl.el to work with emacs prelude
14:36borkdudeskelternet yes, http://localhost:4000/img/test.jpg returns the picture
14:37skelternetborkdude and I presume file:///img/test.jpg would also work through the file system
14:37borkdudeskelternet no, the web server uses a specific dir as root dir
14:38borkdudeskelternet it's just a jekyll website btw
14:38skelternetborkdude: hmm. odd. I suspect org-mode may do that for absolute paths. I'm not positive, though.
14:38borkdudeskelternet yes, the docs say: no absolute path
14:39skelternetborkdude: I've been torn between writing my own using Dexy or looking at Jekyl. How has your experience with jekyl been?
14:39borkdudeskelternet probably this guy here uses literal html for his images for this reason http://orgmode.org/worg/org-tutorials/org-jekyll.html
14:41borkdudeskelternet to be honest, I didn't use jekyll that much, just copied someones repo from github and adapted some things, playing around
14:41borkdudeskelternet I'm just looking for a way to use org-mode to set up a blog and this looked promising
14:44skelternetI was involved in something like 10-15 projects at my old job and org-mode was the only way to maintain sanity.
14:45skelternetI used to generate meeting notes from org-mode and run my task lists in it.
14:46skelternetKept the files in version control.
14:46skelternetI'm down to 1 project now so I don't use it as much. Was useful, though.
14:47skelternetMeeting agendas and follow up notes exported to PDF and HTML and made available to the team.
14:47borkdudeof course I can always use a relative path like this ../../../img/test.jpg
14:48borkdudebut that's kind of ugly, I want the org-files not having to know about the structure of the jekyll site
14:48skelternetborkdude: yeah, but…sematically…is ../../.. meaningful? Wish we could define a variable root higher up in the org doc
14:49skelternetborkdude: would the web address be appropriate? [[http://myblog/images/foo.jpg]] ?
14:50borkdudeskelternet could do that, but what if I change domains, etc.. nah
14:50skelternetborkdude: *nod*
14:50skelternetFamily just arrived back home. I'm off to be dad. good luck.
14:51FrozenlockDoes the google compiler keep a table of the original names? Say I could look "sv" and see that it was "my-awesome-function" elsewhere.
14:57ivanFrozenlock: I think you can make it generate a property renaming map
14:58Frozenlockivan: thanks - however I just found a solution to my problem. Include the externs.js file directly in my project, instead of my underlying jar library.
14:58ivanwhy do you expect it to munge the main name SomeLibrary?
14:58ivanokay
14:58FrozenlockI expect it to NOT munge it :p
14:59FrozenlockI'll have to see with emezeske why the externs.js included in jar is not used...
15:01ivaraasenhm, Prismatic's Flop looks interesting
15:02wilfredhI want to (use foo) and catch when it doesn't work, but FileNotFoundException isn't in scope.
15:02wilfredhany suggestions where I can import it from?
15:04wilfredhah, java.io.FileNotFoundException
15:04wilfredhthat'll teach me for learning Clojure without knowing much Java :)
15:06yediwhere would I be adding these lines? https://github.com/kingtim/nrepl.el#configuration
15:06yediI should be putting it in nrepl.el right?
15:07ivanyedi: in your .emacs.d/init.el
15:08yediivan: ty
15:09dabdI'd like to sort a list of cards by their ranks according to the normal rank order in a deck of cards. I can't figure why this doesn't work https://gist.github.com/4644325
15:10dabdi get (sort-by-rank-order '("KTo" "KQo" "AJo" "AQo" "AKo"))
15:10dabd("AKo" "AQo" "KQo" "AJo" "KTo")
15:10dabdAny tips please?
15:10Seba51I am playing with clutch a couchdb client libray and saw things like "WARNING: assoc! already refers to: #'clojure.core/assoc! in namespace". My guess is, that libraries should not names as clojure methods. Is this correct?
15:12tomojdabd: hard to tell what you're really trying to do. I mean I understand rank order, but what's all the notation? anyway [(first h) (second h)] in your cond clause looks suspicious. a vector is always logically true
15:12ivanSeba51: you can, if you exclude from clojure.core with a (:refer-clojure :exclude [assoc!])
15:12ivan(haven't tried it though)
15:12tomojoh, nevermind
15:12ivanthat is, in your (ns
15:12tomojI misread it, damn you cond
15:13Seba51@Ivan thanks for the tip. Is this OK for a library to reuse the names. I am just wondering if the library is badly designed.
15:13dabdAKo = Ace King off suit KQs = King Queen suited
15:14borkdudeI solved my problem by writing a hook fn for org-publish-before-export-hook which replaces $SITEPATH$.. kind of templating in an org-file - is this something that could be done in an easier way?
15:14S11001001Seba51: yes, it's OK
15:14dabdtomoj: Is this you don't understand?
15:14S11001001Seba51: It means you aren't supposed to just (:use the-lib), you're supposed to :require :as, or :use :only
15:15S11001001ivan, Seba51: I missed part of conversation, sorry for repeat
15:16Seba51Thanks for the feedback. I just found this as well "Use good names, and don't be afraid to collide with names in other namespaces. That's what the flexible namespace support is there for." in http://dev.clojure.org/display/design/Library+Coding+Standards
15:17tomojwow, I was going to say your comparator should return -1, 0, or 1 instead of booleans
15:18tomojI used (sort > coll) before but didn't think about it
15:19tomoj&(= (sort compare [1 2 3]) (sort < [1 2 3]))
15:19lazybot⇒ true
15:21seangrovehrm
15:21seangroveIn cljs, when I create a (deftype ...) and give it some functions, and then instantiate that type, where are the functions? How can I call them from javascript-land?
15:21yediwhat does load file mean in nrepl? I'd assume it'd mean to load all of the clojure code of a file so that the repl has access to all the functions/variables
15:22S11001001yedi: yes, but "repl has access" probably doesn't mean what you think
15:22yediload into memory
15:22tomoj&(java.util.Collections/min [3 2 1] (comparator <))
15:22lazybot⇒ 1
15:23tomoj&(java.util.Collections/min [3 2 1] <)
15:23lazybot⇒ 1
15:23tomoj(def comparator identity)
15:23S11001001yedi: yes, it fits that
15:23tomojexcept for (comparator a-map) or some crazy shit
15:23yediin my emacs setup, running C-c C-l to load my file doesn't seem to work
15:23S11001001yedi: what does "doesn't seem to work" mean?
15:23ivaraasenso, I just wrote my first macro, guys.
15:23yediand I don't want to have to evaluate every form in the file by hand
15:23seangroveDoesn't seem to be in the namespace...
15:24ivaraasenit's ugly as hell, but it will do
15:24yediCompilerException java.lang.RuntimeException: Unable to resolve symbol: rhyme-scheme in this context, compiling:(NO_SOURCE_PATH:1)
15:24S11001001yedi: then by "repl has access" you don't mean anything about memory, you mean the environment of the repl
15:24seangroveAh, on the object iself
15:24S11001001yedi: the repl starts in ns user
15:24S11001001yedi: your code is in some other ns, whatever you declared it as
15:25S11001001yedi: loading a file *only* loads it, it doesn't mess with the ns your repl is in
15:25S11001001yedi: you can use nrepl-set-ns when in a file to switch your repl to the file's ns
15:25yediah, i see
15:25Frozenlockivaraasen: Was it _really_ necessary?
15:25S11001001yedi: or you can type out the commands in the repl for changing namespaces, loading your namespace into user, etc
15:26ivaraasenFrozenlock: well, I was trying to implement an interface somewhat similar to Flop, so, yes
15:26xeqiyedi, S11001001: C-c M-n will change the namespace to the current buffer
15:28tomojapparently Comparator is the reason AFunction exists
15:29S11001001yedi: I recommend using what xeqi mentioned. You can :use your ns into user, but that won't pick up changes you make to the ns, and won't give you access to private defs in your ns, so can get very annoying
15:29S11001001xeqi: I always forget that binding :]
15:30seangroveGoddamn, I don't understand deftype in cljs
15:30yediS11001001, xeqi: thanks a lot, i'm still having trouble getting the hang of emacs esp in conjunction with learning clojure
15:31S11001001Emacs for life
15:31Frozenlock^
15:31tomojemacs for now
15:31seangroveWhat is the this inside of the functions generated by deftype?
15:32tomojmaybe you're older than me, but I hope to use something much better before I die :)
15:32Frozenlocktomoj: emacs with some kind of graphical support?
15:33tomojheh
15:34tomojseangrove: inside?
15:34ChongLiahh this is funny
15:34tomojinside should just be the code you wrote
15:34ChongLifunctional programming in C
15:34ChongLilist *
15:34ChongLimap(list *l, void *(*fn)(void *, void *), void *args)
15:34seangrovetomoj: One second...
15:35S11001001tomoj: I assume the much better thing will simply be an enhanced emacs :)
15:35Frozenlockemacs with namespace would be nice
15:35S11001001faketional programming
15:35gfredericksseangrove: the first argument to any deftype function is this
15:36gfredericksyou can call it `this` or anything else
15:36ChongLibasically shotting off the type system at this point
15:36seangrovehttps://www.refheap.com/paste/8994
15:36ChongLiif you're only using void pointers
15:36tomojoh, "the this"
15:36seangroveI see that self__ = this, stats_control = this
15:36FrozenlockNot knowing JS, could someone briefly explain what it 'this'?
15:37ChongLiFrozenlock: briefly?
15:37Frozenlocks/it/is
15:37seangroveNot 100% clear on how the 'this' is getting assigned
15:37ChongLijavascript has late binding
15:37gfredericksFrozenlock: it's a magical -1th argument to every function
15:37ChongLiso 'this' is set at call time
15:38ChongLi'this' is not lexically scoped
15:38ivanit is the most evil thing :(
15:38gfredericksivan: but but! object orientation!
15:38gfredericksright!?
15:38ChongLino
15:38clojurebotflatten |is| rarely the right answer. What if your "base type" is a list
15:38ChongLiother OO languages handle 'this' properly
15:38Bodilseangrove: OK, I managed to make Pylon work with advanced optimisations, making a release now. :)
15:38FrozenlockChongLi: So you don't know what it will be in advance?
15:38seangroveBodil: Ah, ok, thank you so much
15:38ChongLiFrozenlock: right
15:39seangroveThis is such a horrid nightmare
15:39gfredericksFrozenlock: you can be pretty sure if you're doing things normally though
15:39ChongLibest practice is to assign something else to this and then pass that in
15:39gfredericksit's not like it's randomly selected by the runtime or anything
15:39ChongLiafaik
15:40gfredericksit's only mildly different from if it were just an explicit first argument
15:40seangroveFrozenlock: You'll see a lot of "var self = this;" type stuff, and then using "self" from then on, in case 'this' changes in a callback
15:40gfredericksan first argument that you had to name `this` so that it shadowed any outer occurrences :)
15:40ChongLijavascript is such a strange language
15:41ivanhttp://ecma262-5.com/ELS5_HTML.htm#Section_10.4.3
15:41ChongLiI mean, it has lexical closures right there!
15:41ivanmy favorite step is "Else if thisArg is null or undefined, set the ThisBinding to the global object."
15:42ChongLiyeah
15:42ChongLiso if you screw up your invocation of a constructor you risk trashing the global object
15:42FrozenlockSo 'this' can never be null? Weird first argument :P
15:43gfredericksoh I didn't realize that
15:43gfredericksat least in the case of f.call(null)
15:43ChongLijavascript has all kinds of "helpful" stuff going on
15:44gfredericksso for CLJS golf, maybe js/this is a shortcut for js/window
15:44ChongLilike null == undefined
15:44ChongLifor example
15:44gfredericksChongLi: 0 == [] I think
15:44ChongLioh it's even worse than that
15:45ChongLi"0" == false
15:45gfredericksoh nevermind js/this doesn't work
15:45gfredericksChongLi: holy cow
15:46ChongLianother fun one is to write a function which counts the occurrences of words in a string
15:46FrozenlockChongLi: wait, the string zero is false?
15:46ChongLiyeah
15:46Frozenlock*mind blown*
15:46gfredericksFrozenlock: it must helpfully convert it to a number first
15:47ChongLijavascript implicitly coerces the types on both sides of the expression until they're comparable
15:47gfredericksdespite the fact that you're not even comparing it to a number
15:47ChongLiso "0" will get turned to 0
15:47ivan"-0" == false :)
15:47gfredericksChongLi: how does that help comparing to a boolean though?
15:47ChongLi0 in js is false
15:47gfredericksyes I know
15:48ChongLias is -0
15:48gfredericksbut strings are generally true excepting ""
15:48gfredericksso the fact that the string contains a number seems irrelevant when comparing to a boolean
15:48Frozenlockwhat about "false" == false
15:48ChongLino, that's false
15:48gfredericksI'm just saying this makes one chunk less sense than "0" == 0
15:49seangroveBodil: Let me know when you've pushed the new release
15:49ChongLiit'll keep trying until it lines up the types to do a comparison
15:49gfredericksI'll stop trying to make sense of it
15:49ChongLithis is how all operators in javascript work (except for the reference ones)
15:50ChongLi=== is reference equality
15:50ChongLiaka pointer equality
15:50ChongLiso that'll pretty much always work
15:50ChongLiexcept when you have two objects that are equal but not the same
15:50ChongLithat's pretty rare though
15:51gfredericksI'm just thinking that you can satisfy the "coerce until comparable" description by going straight from a string to a boolean without the intervening number
15:51gfredericks"This string is not empty, thus it is == true"
15:52ChongLiit basically converts both to a number
15:52ChongLifalse gets converted to 0
15:52dabdwhy does sort accepts both (comparator some-pred) and some-pred as the comparator argument?
15:53ChongLidabd: hmm?
15:53dabdobv some-pred does not implement the java.util.Comparator interface so I don't understand how it works
15:53gfredericksChongLi: that would lead me to expect "foo" == 7
15:53dabd,(sort < [5 3 1 7])
15:53clojurebot(1 3 5 7)
15:53ChongLino
15:54dabd,(sort (comparator <) [5 3 1 7])
15:54clojurebot(1 3 5 7)
15:54ChongLi"foo" gets parsed as NaN
15:54dabdboth work
15:54gfredericksChongLi: oh right; I retract previous statement
15:55ChongLicomparator is useful with java.util.Collections/sort
15:55ChongLidabd: does that help?
15:55ChongLihere's the other interesting thing
15:56ChongLiin order to make sure "foo" == "bar" returns false (and some other things)
15:56ChongLiNaN == NaN always returns false
15:56gfrederickswell that implies "foo" == "foo" returns false
15:56ChongLioh good point
15:57ChongLibut NaN == NaN does return false
15:57ChongLiwhich is bizarre
15:57gfredericksis NaN in the floating point spec?
15:57ChongLiyeah
15:57dabdit does not explain why it accepts a function that does not implement the java.util.Comparator interface when the documentation states that it must do
15:57gfredericksdo they say anything about NaN == NaN
15:58ChongLidabd: clojure.core/sort accepts any predicate
15:58ChongLijava.util.Collections/sort requires that the predicate be an implementation of java.util.Comparator
15:59ChongLidabd: why would clojure.core/sort be written to have a limitation of java when it doesn't have to?
16:00FrozenlockIs it possible to "(set! (.-onload js/window) some-fn)" multiple time, or will it erase any previous functions?
16:00gfredericks,(doc sort)
16:00clojurebot"([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
16:00gfredericksChongLi: I think he's asking why the docs say otherwise
16:00ChongLihmm let me see
16:01dabdI'm looking at the sort implementation for explanations :-)
16:01gfredericks,(instance? java.util.Comparator <)
16:01clojurebottrue
16:01gfredericks^ that's probably part of it
16:01ChongLiah so there you go
16:01gfredericksI suspect the docs are accurate as the type hint is there
16:01dabdaha
16:01dabdthanks gfredericks
16:01gfredericks,(sort #(< %1 %2) [1 2 3 4])
16:01clojurebot(1 2 3 4)
16:02S11001001&(instance? java.util.Comparator (fn [] 42))
16:02lazybot⇒ true
16:02ChongLiso there you go
16:02gfredericks,(instance? java.util.Comparator fn?)
16:02clojurebottrue
16:02gfrederickswelp.
16:02gfredericksthat's interesting.
16:02ChongLiall clojure functions automatically implement it
16:02gfredericks,(instance? java.util.Comparator {})
16:02clojurebotfalse
16:02gfredericks,(parents clojure.lang.Fn)
16:02clojurebotnil
16:02gfredericks,(supers clojure.lang.Fn)
16:02clojurebotnil
16:02ChongLi,(instance? java.util.Comparator #{})
16:02clojurebotfalse
16:02ChongLihmmm
16:03ChongLioh right
16:03gfredericksoh Fn is an interface
16:03gfrederickswhat the heck
16:03ChongLia comparator is not a normal predicate
16:03gfredericks,(supers (class (fn [] 42)))
16:03dabdthe implementation shows (. java.util.Arrays (sort a comp))
16:03clojurebot#{java.lang.Runnable clojure.lang.Fn java.io.Serializable java.util.concurrent.Callable java.util.Comparator ...}
16:03dabdwhat sort is being called in (sort a comp)?
16:04ChongLiit returns -1 0 1 I believe
16:04ChongLi,((comparator >) 3 2)
16:05clojurebot-1
16:05tomoj&(.compare (fn [x y] (< x y)) 3 2)
16:05lazybot⇒ 1
16:05ChongLi,((comparator >) 2 3)
16:05clojurebot1
16:05ChongLiyeah there you go
16:05tomojthis is what I was talking about earlier
16:05ChongLidabd: does that clear it up for you?
16:05tomojon AFunctions, comparator is identity
16:06tomojhttps://github.com/clojure/clojure/blob/a5f786a847a202e78048dae8fdf15a7e8748dd3d/src/jvm/clojure/lang/AFunction.java#L46
16:07tomoj(well, comparator isn't really identity of course - only as far as .compare is concerned)
16:07tomojoops, ##(.compare < 2 3)
16:07lazybot⇒ -1
16:13ohpauleezFor those interested in the Leap Motion: http://www.pauldee.org/ClojureLeapMouse.mov
16:13ohpauleez30 second teaser of mousing using Leap and Clojure
16:14ohpauleezthe API/Library, clojure-leap, has gesture recognition. In that example I use a gesture to toggle the Leap on and off
16:15ohpauleezFor all coming to Clojure/West, you're welcome to play with it :)
16:15seangroveohpauleez: Looks awesome!
16:16ohpauleezseangrove: Thanks!
16:16ohpauleezThat was all possible in about two days worth of work. Gotta love Clojure
16:16tomojohpauleez: sweet
16:16seangroveLooking up leap motion now...
16:18ohpauleeztomoj: Playing with it on the repl is a blast
16:18tomojso you need some special driver I guess?
16:19seangroveohpauleez: how'd you get one? Looks like they're still pre-order
16:20ohpauleezit's just a USB device + generic driver
16:20TimMcseangrove: Just coming into the conversation, I couldn't figure out how tree traversal algorithms were related to this. :-P
16:20ohpauleezseangrove: developer program
16:22ChongLiman what's up with vlc?
16:22ChongLiI pause your video
16:22ChongLiand then when I restart it it plays a few seconds and then kicks out of full screen and stops the video
16:23Raynesohpauleez: Give me your leap motion thingy.
16:23ohpauleezhaha
16:23RaynesI want it.
16:23RaynesIt's unfair that I don't have mine yet.
16:23ohpauleezAlso, that code example is 38 lines of code
16:24seangroveohpauleez: Do you have any specific use-case for it in mind?
16:25ohpauleezseangrove: I'm creating a 3D equivalent of the the FingerWorks TouchStream experience
16:25ohpauleezAdaptive keyboard, mousing, macro'd gestures
16:25ohpauleezetc
16:26ohpauleeztechnomancy: sick!
16:26technomancyit's interesting. completely useless for typing, but fun for games and stuff.
16:26technomancyI'd probably use it if I actually did design work or something.
16:26Raynes<3 das
16:26ohpauleezit's interesting, doing the adaptive typing for the Leap has been super hard as well
16:26ChongLidas keyboard?
16:27ChongLiI've got a filco
16:27ivaraasenI've got a ThinkPad
16:27seangroveohpauleez: ... as a kind of 3d keyboard?
16:27ChongLisince getting used to a filco I find rubber-dome keyboards intolerable!
16:27technomancyI even have a 2003-era ibook that I keep around only because it's the only thing with an old enough USB stack to be able to reprogram the touchstream =\
16:27tomoj"perfectly smooth surface" re touchstream
16:27tomojhopefully it does have imperfections?
16:28tomoj..preferably on 'f' and 'j' ?
16:28technomancynot that I would have ever forgiven them for killing hypercard, mind you.
16:28Apage43ChongLi: Heh, I've taken mine to work
16:28ohpauleezseangrove: The idea is that you can place your hands anywhere (in your lap, for example) and type. Based on the diffs/deltas/motions, I know what key you intended
16:28RaynesChongLi: Yeah, das.
16:28Apage43the clacking reverberates throughout the office
16:28ChongLiI'd have gotten a das if they offered a tenkeyless one
16:28seangroveohpauleez: Crazy, that would be amazing
16:28RaynesChongLi: I use it and my macbook pro's keyboard. I find the macbook's keyboard surprisingly tolerable.
16:29ChongLiI'm all about the tenkeyless
16:29ChongLiI don't know anyone who does extensive work on a numeric keypad
16:30Apage43ChongLi: *shrug* I rarely -use- the numpad and junk, but I don't begrudge having it there. I'd like to get a tenkeyless that has a detachable cable though, just for portability.
16:30RaynesI prefer having a numpad.
16:30RaynesI mean, I wish it were smaller, but when I do need it I'm happy it is there
16:30ohpauleezRaynes: For when you're adding up all your fat stacks of cash?
16:31ChongLiI find the numpad forces my arms too far apart
16:31RaynesYeah, man.
16:31ivaraasenI tried doing stuff with Emacspeak once. it was ... interesting.
16:31ohpauleezBut for real, I live just a couple of blocks from the venue of Clojure/West
16:31ohpauleezhappy to let people play around with the Leap Motion
16:31RaynesI fully intend to take my das on my first day of work Monday after next and pound on it until my team's ears bleed.
16:31ivaraasenohpauleez: too lucky, man
16:32technomancyhmm... maybe I can unload my touchstream at clojurewest if there's interest in gesturey stuff =)
16:32ChongLiRaynes: at least it's not a unicomp
16:32ChongLiI'm tempted to get one of those
16:32ChongLiI wish they'd make a tenkeyless!
16:32ohpauleeztechnomancy: I'm always looking for well-maintained TouchStreams
16:32ChongLifrom what I've heard unicomp has fallen a bit on hard times
16:33ohpauleezRaynes: Where are you starting to work?
16:33ChongLipeople only ever need one of their keyboards
16:33ChongLithe buckling springs are too durable!
16:33Raynesohpauleez: Finally moving to LA to work full time at Geni/MyHeritage.
16:33ohpauleezcool
16:33ohpauleezcongrats!
16:33technomancyohpauleez: mine is actually a digitouch, one of the ones originally designed for internal use on 2004-era macbooks but put in a case.
16:33ChongLithat sounds pretty exciting
16:33ChongLido they use clojail?
16:34ChongLiI love that talk btw
16:34RaynesWell, we use lazybot which uses clojail.
16:34RaynesSo I guess you could say that.
16:34RaynesI've been working for them for 2 years as an intern.
16:34RaynesRemotely.
16:34RaynesAlso, thanks.
16:35technomancyare you going to level up to non-intern-ness?
16:35RaynesThat talk is unfortunately entirely inaccurate now. I've rewritten half of the thing since then.
16:35ChongLiyou nailed one of the most important aspects of giving a good talk: use humor
16:35bbloom,(into {} (map vec (partition 2 [:a 1 :b 2])))
16:35clojurebot{:a 1, :b 2}
16:35bbloom,(into {} (partition 2 [:a 1 :b 2]))
16:35clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
16:35bbloomi know i can do:
16:35bbloom,(apply hash-map [:a 1 :b 2])
16:35clojurebot{:a 1, :b 2}
16:35bbloombut what if i have a record type i want to into with a sequence of key vals? something like:
16:35Raynestechnomancy: Yes, this is is a full time non-intern stealing-you-old-timer's-jobs position.
16:35technomancynice
16:35Apage43i once leveled up to non-internness
16:35Apage43it was okay
16:36hiredman,(conj {} '(:a 1))
16:36clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
16:36bbloom(into (Foo. 1 2) [:x 3 :y 4])
16:36ChongLipretty soon you'll be partying in hollywood
16:36hiredman,(conj {} [:a 1])
16:36clojurebot{:a 1}
16:36RaynesI'm reaching non-intern level 4. It's like Super Saiyan 3, but with better salary.
16:36bbloomhiredman: yup, so i don't have an empty {}, i have a record with stuff in it
16:36bbloomhiredman: what's the best way to poor a sequence into there
16:37hiredmanreduce
16:37technomancyRaynes: word of advice: pick the longsword proficiency
16:37ChongLiI think everybody knows that
16:37ChongLilongswords are the best!
16:37RaynesReally? I was hoping for archery.
16:37bblooms/poor/pour
16:37bbloomhiredman: reduce assoc?
16:38gfredericksinto uses transients
16:38bbloomhiredman: with the partition 2 in there, then it needs to destructure too, seems relatively inefficient
16:38seangroveDidn't realize technomancy was an old-timer
16:39bbloomgfredericks: yeah, i'm looking for the most idiomatic way to pour a sequence into a record efficiently
16:39gfredericksbbloom: oh I guess records can't transient?
16:40ChongLianyone here read the reasoned schemer?
16:40ChongLi(I assume some have)
16:40bbloomgfredericks: apparently not. into checks instance? IEditableCollection
16:40bbloomrecords do not appear to be editable collections
16:40bbloomwhich kinda sucks
16:41hiredmangfredericks: it doesn't matter, his problemis he is trying to conj lists created by partition-all instead of 2 elements vactors on to a map
16:41josteinktechnomancy: congrats on the lein 2 release!
16:41bbloom,(reduce (partial apply assoc) {} (partition 2 [:a 1 :b 2]))
16:41clojurebot{:b 2, :a 1}
16:42technomancyjosteink: thanks!
16:42josteinkI saw someone on HN refer to leiningen as such a fantastic tool, that it alone was worth learning clojure for ;)
16:42josteink(in case you missed it)
16:42tomojbbloom: records don't need to be editable, do they?
16:42josteinkits really very, very good
16:42ChongLijosteink: yeah I saw (and mentioned) the same thing
16:42josteinkso a happy weekend to you :)
16:42tomojI guess it could help
16:42hiredmanbbloom: I would be surprised if papply is more efficient then destructuring
16:43bbloomhiredman: oh yeah, clearly gonna be a wash, i'm just trying to figure out what to do exactly
16:43bbloomtomoj: one of the main reasons for records is performance, is it not?
16:43ChongLiperformance and polymorphism
16:44bbloomChongLi: right
16:44bbloom,(->> [:a 1 :b 2] (partition 2) (map vec))
16:44clojurebot([:a 1] [:b 2])
16:44hiredmanthey cannot support O(1) transition from from persistent to transient
16:44hiredmanrecords don't have the tree structure required for it, exactly for performance
16:45tomojwell O(k) where k is number of fields?
16:45ivaraasenwow, primitives are way faster than I initially suspected
16:45tomojI mean the extmap is editable, right?
16:46tomojbut I guess that's only useful if you're stuffing a whole bunch of ext keys in
16:47bbloomhiredman: the number of defined fields is a constant, so it's technically O(1) to copy them all
16:47Raynesdrewr: https://github.com/Raynes/postal/commit/ca4561f1f82266443aacd49161a10fa89e6e96ca just did this for fun (haven't had much chance to use conch myself, and I found a small thing that needed changing by doing this, so hooray). Not sure if you'd be interested, but thar she blows.
16:48bbloomhiredman: and if that number is < 30 (the branching factor of the vector objects) then it's probably cheaper to copy them than it is to create intermediate nodes
16:48bbloomanyway, i'm going with map vec for now
17:01tomoj"the" android terminal emulator?
17:02josteinkthe AOSP one, or one shipped with AOSP roms
17:02josteinkor AOSP-based ones like CM
17:02josteinkon a machine with a good keybord dock, like the asus transformer, the terminal emulator makes for a good hacking space
17:02josteinkon a machine with 16 hours battery life ;)
17:07ivaraasenjosteink: oh what I would give for decent battery life
17:08josteinkI tried using my actual laptop earlier today, from the couch. lasted me less than 2 hours
17:08josteinkthats just not good enough
17:11ivaraasenjosteink: I've got about five hours. considering adding a slice battery for long hikes
17:11tgoossensOut of the tarpit. I've been hearing about it a few times now. Someone read it here?
17:11hyPiRiontgoossens: yes
17:11ivaraasentgoossens: yeah, it's a pretty good read.
17:11ChongLiit's not that long either
17:12tgoossensi'm searching some reading material for while travelling (and next semester)
17:12warzif ive used gen-class in one namespace to create an aot compiled class, and i need to create an instance of it in a different namespace, do i have to :import it like a java class?
17:13ivaraasenhyPiRion: woho, just finished some macros inspired by Flop. it's pretty nice to use primitives without all the clutter.
17:13tgoossenscurrently i'm reading the pragmatic programmer, interesting book
17:13ChongLitgoossens: what's your list so far?
17:13josteinktgoossens: it has very good ideas. the hard part is picking them up and actually taking them seriously. translating them into action.
17:13tgoossensjosteink: that's always the tricky part
17:14tgoossenslet me see what do i have in my library
17:14josteinktgoossens: some ideas are more seductive than others ;)
17:14tgoossensseven programming languages in seven weeks (not really useful while travelling i think)
17:14josteinktgoossens: TPP's ideas tend to leave you with (what seems like) more work ;P
17:15tgoossensjosteink: i'm at page 40, so still lot to read :)
17:15hyPiRionivaraasen: Sounds useful, link?
17:15ChongLipaul graham's on lisp is pretty nice
17:15ivaraasenhyPiRion: they support bindings, so finding the dot product is as simple as (asum [x xs y ys] (* x y)
17:15tgoossensFunctional programming for the OO programmer (by marick)
17:16tgoossensand "how to so solve it"
17:16ivaraasenhyPiRion: Flop isn't released yet I'm afraid. but it's probably going to be quite nice.
17:16tgoossensbut i think tarpit & pragmatic programmer is enought for the coming weeks :p
17:17hyPiRionivaraasen: I was thinking about your macros :)
17:17tgoossensfun fact: i never read programming books before until I came into contact with the clojure community.
17:17tgoossensIts almost unavoidable
17:17tgoossenseverytime I watch a talk
17:17tgoossens"you should read/buy this book at amazon" :p
17:18ChongLitgoossens: yeah same here pretty much
17:18ChongLiwhen I started with haskell (before clojure) I mainly read academic papers
17:18ChongLimany of which were very hard to follow
17:19tgoossensnever read papers really
17:19ivaraasenhyPiRion: oh, gimme a sec
17:19ChongLia lot of them used denotational semantics
17:19josteinkChongLi: Ive tried to complete SICP (but its pretty damn long :P ), and found it very englightening so far
17:19ChongLiwhich I have yet to learn
17:19josteinkChongLi: how does PG's book relate to that?
17:19ChongLiyeah SICP is great
17:20josteinkis it trying to sell me lisp, or is it trying to teach lispers something new?
17:20ChongLion lisp is basically all about macros
17:20josteinkhm ok. sounds nice.
17:20ChongLiit was the first book to really dive in and give tons of example macros
17:20tgoossensso far, reading TPP has been really confronting
17:21ChongLisome of the macros in PG's book are pretty hard to follow
17:21josteinktgoossens: the first thing TPP tought me was that Im not really such a good programmer as I tend to think I am :P
17:21ChongLibut I suspect that's due to bad formatting on my kindle
17:21tgoossensjosteink: exactly
17:21josteinkChongLi: Ive had the same issue with other programming books on the kindle
17:21ChongLihard wrapping can screw up indentation and really make code a chore to read
17:21josteinkmhm
17:22ChongLiSICP's ebook version is well formatted though
17:23tgoossensjosteink: with me. It invoked a sudden change in direction. My idea has always been to go and study software engineering
17:23tgoossensbut suddenly i realised
17:23tgoossensthat might not be the best choice for me
17:23ivaraasenhyPiRion: https://www.refheap.com/paste/c3b278e7697715aa8b5ff9b19
17:24ChongLifrom what I've seen a lot of schools tend to just churn out java CRUD programmers
17:24tgoossensbecause
17:24tgoossensI have gotten the impression that I am going to waste my time
17:24tgoossensfor a large part
17:24josteinkChongLi: I did Electrical engineering, and just graduated when the industry had token a complete nosedive
17:25ChongLiif you can take a course that still teaches SICP it'd be worth it
17:25josteinkChongLi: for every job I applied, tehre were 100 experienced engineers who had just gotten downsized
17:25tgoossensthis is what i'm heading for now
17:25tgoossenshttp://onderwijsaanbod.kuleuven.be/opleidingen/v/e/SC_51016867.htm#bl=01
17:25ChongLijosteink: that's awful
17:25josteinkI stood no chance getting a job. So my childhood hobby of programming it was :P
17:25josteinkcould have been worse :)
17:25tgoossensjosteink: programming has always been my hobby
17:25tgoossensand suddenly i realised
17:25tgoossensit should stay that way
17:26tgoossensat least while i'm at college
17:26josteinkyeah thaht was my idea as well
17:26tgoossensI have no interest in being pushed in some
17:26tgoossensdirection
17:26clojurebotI don't understand.
17:26josteinkdidnt quite work out that well :P
17:26tgoossensbeing oblligated
17:26tgoossensto work on certain concepts
17:26tgoossensi want to keep exploring on my own
17:26tgoossensin my case
17:26tgoossensmy whole master revolves around OO
17:26tgoossensand I am not willing to cope with that
17:27tgoossenslong story short
17:27tgoossensI realized that what i would be learning is
17:27hyPiRionivaraasen: thanks!
17:27tgoossens1) when i graduate it is old knowledge.
17:27josteinkah well. a degree CAN be a career-opener.
17:28tgoossens2) is not something i cannot learn on my own (for the most part)
17:28josteinkmost jobs wants/expects some sort of papers ;)
17:28ChongLidon't disparage old knowledge
17:28tgoossenschongli:i don't
17:28ChongLimost people still haven't realized the powerful stuff you'll find in stuff like SICP and On Lisp
17:28josteinkthey have gotten me jobs though ;)
17:28tomojhmm, wikipedia says SSA is a well-behaved subset of CPS which "excludes non-local control". are promises that too?
17:29tgoossensits just
17:29tgoossensi know a lot of people (even some working at google now)
17:29tgoossensthat never even studied software engineering
17:29josteinksure
17:29josteinkbut dont trick yourself into thinking the exception is the rule
17:29tgoossenshmmyes
17:30josteinkwhile you are discussing reasons to NOT get a degree
17:30josteinkIm a practicing professional
17:30tgoossensi AM going to get a degree
17:30tgoossensbut in a different profession :p
17:30tgoossens*master
17:30josteinkwhich never got an (IT) degree, who wish he had ;)
17:30tgoossenshmm
17:30tgoossensi have 6 months stillb
17:30josteinkthere is some theoretical background Id really like to have, which Ill never have the time to read up on now
17:31tgoossensbefore i have to choose
17:31devnuniversities work with private businesses
17:31tgoossensits only been a few days that
17:31tgoossensthis idea has been going through my heaf
17:31tgoossens*head
17:31josteinkbut lets flip perspective slightly
17:31josteinkyou live in the US, right?
17:31tgoossensbelgium
17:31ivaraasenhyPiRion: it was a fun exercise. hopefully it'll be useful for some numerics stuff I'm planning on doing in Clojure
17:31josteinkok. same deal. western world
17:32josteinkwhy would you invest your future in something which everyone will outsource to india in 10 years? :P
17:32tgoossenssimple
17:33tgoossensits ME who is going to send it TO india then ;) :p
17:33tgoossensbut no
17:33tgoossensi'm not really into that
17:33tgoossensidea
17:33tgoossensoutsourcing can be great
17:33tgoossensfor cost
17:33devnjust don't be outsourceable and you don't have a problem.
17:34devnit's a choice you have throughout any career in nearly any field
17:34josteinkIt was a tongue-in-cheek remark
17:34josteinkbut still
17:34josteinklooking at the IT world today, compared to 10 years ago.... lots of skills I had is now either obsolete or priced obscenely low
17:35hyPiRionivaraasen: Yeah, I find math in Clojure to be rather slow without those tricks, so those were handy.
17:35tgoossensjosteink: the thing i'm considering studying now is. Numerical models for scientific purposes
17:35josteinkIm not sure where IT is going to be heading (job-wise) the next 10 years. Im not sure where i'd put my bets ;)
17:36tgoossensand simulations
17:36ivaraasenhyPiRion: yeah. I tried doing some geomechanics stuff. probably should've used matrices anyway, but still, way too slow
17:37tgoossensoh well
17:37tgoossensjust dreaming and thinking
17:37tgoossensstill got time to think and choose
17:37tgoossensand change opinions
17:37tgoossensits a good thing i'm actively thinking about it though
17:38seangroveBodil: Are you able to work in the repl with pylon, when building up classes with them?
17:38seangroveSeems to be breaking with chrome as the eval env
17:38tgoossensi better go to bed now. Still have to study for my exam :)
17:39hyPiRionivaraasen: hah, yeah. I tend to go down to C/CUDA when running HPC-stuff. Thinking about doing some CUDA/Java/Clojure wrapping, seems useful considering the speed gain you get.
17:39Bodilseangrove: Only tried with Node, but that should work.
17:40ivaraasenhyPiRion: that would be awesome. I'm rooting for core.matrix myself
17:42hyPiRionivaraasen: Oh yeah, I saw it on the Clojure-dev list the other day.
17:42hyPiRionWould be sweet to have something in core.
17:43josteink"One kernel to rule them all, one protocol to find them, one terminal to to bring them all and in the darkness bind... err... send commands to them."
17:45technomancyhttp://first.clojure-conj.org/speakers#mcgranaghan
17:45josteinkhaha. nice
17:46josteinkI was thinking more about linux than ring though ;)
17:46ivaraasenhyPiRion: definitely. it will probably take a couple of iterations before they come up with the right abstractions though. core libraries aren't supposed to break backwards compatibility that often, I believe
17:46josteinkdidn't know "ring" came from such a deep metaphor though
17:46technomancywell... not really
17:47technomancymore like Wagner
17:47technomancythe request/response cycle
17:47technomancyis shaped like a ring
17:47josteinkfair enough
17:47technomancy(not actually Wagner, just making a "ring cycle" joke)
17:48ivaraasentechnomancy: that's still pretty deep, man
17:48hyPiRionivaraasen: Yeah. At least it's a start. It would probably take some time to get it up too, from my JIRA experiences.
17:50ChongLidas rheingold!
17:50technomancykind of disappointed there aren't more wagner-themed ring libraries actually
17:53seangroveBodil: Maybe I have a typo in here somewhere, but getting this error: clojure.lang.ExceptionInfo: Could not locate pylon/macros__init.class or pylon/macros.clj on classpath: at line 1 {:tag :cljs/analysis-error, :file nil, :line 1}
17:53seangroveHere's the code I'm trying to eval: https://www.refheap.com/paste/05eeaac85264aee5dc0cd5f8b
17:53seangroveIt compiles without warning and loads, but after connecting the browser to nrepl, I get the above error
17:54seangroveMaybe this is expected and I'm just confused
17:54Bodilseangrove: So it's the (ns) that doesn't eval?
17:55seangroveHrm, actually, let me try restarting my nrepl server
17:55Bodilseangrove: Sounds like it's got classpath issues - afraid that's a bit beyond me. But definitely not expected.
17:55seangroveNo problem, just glad to clarify :)
17:56seangroveWhat was the problem with advanced mode, by the way?
17:57tomoj(.contains (base32-encode (hmac "HmacSHA1" "foo" "foobarbaz")) "JAVA")
17:58Bodilseangrove: It's currently doing things like class.prototype["method"] = function instead of class.prototype.method = function to define methods; Closure Compiler leaves the former unmangled, but not the latter. And you're normally calling your methods using the latter, so...
17:59Bodilseangrove: That was the short explanation, at least :)
17:59seangroveYeah, sounds like what I went through as well
17:59seangroveDefinitely careful with aset/aget now...
17:59TimMctomoj: ?!
18:00tomojthat was the very first thing I tried, too, not like I kept going till I saw a message in the sig
18:00tomojbut what's the PETWHAC?
18:00seangroveBodil: Getting this error now with nrepl-jack-in: Invalid js form js/Object.getPrototypeOf at line 11 file:/Users/sgrove/.m2/repository/org/bodil/pylon/0.1.0/pylon-0.1.0.jar!/pylon/classes.cljs
18:01seangroveI can fix that up and submit a pr...
18:01Bodilseangrove: Hmm, what cljs version are you using?
18:02seangroveBodil: head
18:02seangroveMore or less, I think
18:03seangroveMight be a week or two old now
18:03BodilWeird... that form compiles for me.
18:03BodilBut yeah, it should probably be (.getPrototypeOf js/Object)
18:05tomojI think there's a 1/32^3 = 1/32768 chance of finding a particular length 4 string in a base32-HmacSHA1? so surprise ~= 0
18:07tomojwell 29/32^4 or whatever
18:09gfrederickshow does core.logic/occurs-check work?
18:10TimMctomoj: I don't know much about HMAC -- does this rely on whatever random init key was used?
18:10tomojthe key was "foobarbaz"
18:10tomojthat expression will always return the same result
18:12TimMctomoj: I was trying to reproduce this using javax.crypto but couldn't figure out how to initialize HmacSHA1 with a non-random key.
18:15tomojhttps://github.com/kzar/ring-hmac-check/blob/master/src/ring/middleware/hmac_check.clj
18:16gfrederickshttp://en.wikipedia.org/wiki/File:Uniform_tiling_54-t2.png
18:16gfredericks^ exploring that with core.logic (or any other paradigm I know of) is mildly maddening.
18:16tomojinteresting
18:18josteinkseangrove: I must admit I found cljs not quite sexy as I expected it to be
18:18seangrovejosteink: In general, I love it
18:18seangroveSome very painful edges though
18:18josteinkthe idea is good
18:19josteinkbut you want to be able to work with everything else wonderful in JS land
18:19josteinkand none of that follows any sort of clojure convention
18:19tomojgfredericks: why core.logic?
18:19seangroveNot sure how much is wonderful out there, though
18:19josteinkseangrove: its sure more wonderful than reinventing a wheel ;)
18:20seangrovejosteink: In most cases, yes
18:20tomojI wrote something in cljs that did a triangular tiling
18:20seangroveBut having built some large javascript apps now, I can say, not always :)
18:20josteinkanyway
18:20seangroveWe built an mvp on jquery and friends, and it worked alright until it didn't - leaked a lot of memory, speed issues, hard to refactor
18:20josteinkI wasnt trying to cause a bad vibe. more interested in seeing a cøljs "sucess case"
18:20seangroveA lot of that lands on us, but a lot lands on bad practices in the stuff out there
18:21seangroveIf you're talking about angular and friends, I'm certainly much more interested though
18:21gfrederickstomoj: because I don't have any coordinate system I know of that I can use
18:21josteinkIve yet to decide if I like angular
18:21seangroveThey seem to be writing some clean code, and I don't think it fits in smoothly with cljs yet
18:21josteinkto be quite honest
18:21gfredericksthus a major problem is telling when two descriptions of a square are the same square
18:21seangroveThough bbloom would know more about that than me
18:21seangroveWhy's that? I haven't used it yet
18:22seangroveIt just looks far more suitable than jQuery and the myriad of plugins
18:22josteinkits a bit too much magic :)
18:22josteinkI like to knkow whats happening, what my contexts are, and to be able to debug my code without the need for breakpoints ;)
18:22tomojoh, you already can generate the squares?
18:23gfrederickstomoj: well I can easily generate all paths from a starting point
18:23gfredericksbut then how can I tell if two paths lead to the same place?
18:23josteinkalso, Im sceptical about buying into a google controlled "open source" project if I can choose not to
18:23josteinkthey control enough of the internet already
18:23tomojyou mean because of rounding error?
18:23josteinkthey shouldnt have to be in control of MY code :P
18:23gfrederickstomoj: no I'm trying to do this in an algebraic way rather than geometric
18:24gfredericksso e.g. [:left :up :up :right]
18:24tomojoh, now it makes sense
18:24tomojvery cool
18:24seangroveHeh, well, that's one way of looking at it
18:24gfrederickswell left/right/up/down aren't well defined
18:24gfredericksso it's more like forward-left-right-forward or something like that
18:24gfredericksthis is all very trippy :/
18:26gfredericksI'm trying to use unification to some effect or another
18:28josteinkseangrove: my main complaint about angular is that it seems very fuzzy where the border goes for what is data and what is code
18:28josteinkseangrove: in a bad way, quite unlike in lisps :P
18:30TimMcgfredericks: So you need some way of saying what the canonical path to a square is.
18:30gfredericksTimMc: that would definitely be useful.
18:33TimMcgfredericks: Is there an origin square or an origin vertex?
18:33gfredericksmay as well assume so
18:33gfredericksI'm dealing with vertices at the moment
18:33TimMcNo, I mean which one?
18:33gfredericksso an origin vertex
18:34gfredericksI'm trying the approach of ignoring the squares and just thinking of it as a graph where each vertex has 5 neighbors
18:34gfredericksjust an algorithm that can return the number of vertices within N hops would be an achievement
18:35gfredericksor equivalently generate a graph data structure by walking up to N steps from the origin
18:35gfrederickss/equivalently/even better/
18:36gfredericksI guess there's slightly more information present than in a regular graph; i.e., the neighbors of a vertex have a sort-of-ordering ("clockwise")
18:37TimMcgfredericks: Well, just looking at that diagram, canonical paths could be hard.
18:38gfredericksyes. :) I've had this problem in my head for a month at least.
18:38TimMcup,right is the same as right,up
18:39tomojthis is apparently why you can't use a zipper
18:39tomojI guess there would be two important directions, down and right
18:40gfrederickso_O?
18:40clojurebotjoyofclojure is http://joyofclojure.com/
18:40gfredericksclojurebot: thanks man
18:40clojurebotI'm no man, and she's no lady!
18:40tomojI mean you can generate all the vertices with down and right, right? you might call down 'out'
18:41Bodilseangrove: Released! https://clojars.org/org.bodil/pylon/versions/0.2.0
18:41tomojand right 'clockwise'
18:41seangroveBodil: Awesome :)
18:41gfrederickstomoj: hmmm...you'd still have redundancy. But maybe there is always a unique shortest path?
18:41seangroveI've about three more pages of javascript to convert over to pylons and then I can test it out
18:42gfrederickstomoj: you're talking about traversing squares, right? not vertices?
18:42tomojvertices
18:42tomojI'm probably confused
18:42gfredericksI'm always confused when I'm thinking about this.
18:43tomoj#(-> % out out right right) would just be a noop
18:43TimMcgfredericks: Well, this version of canonical paths is probably too complicated: http://i.imgur.com/nvnBiGs.jpg
18:43gfrederickstomoj: then I definitely don't know what you're talking about
18:44josteinkBodil: out of curiousity... in what cases would be using a library like that?
18:45augustlI'm about to implement a "with-reste" type macro that yields an object and ensures it gets a proper teardown via a try/finally, etc. Is there a better way to do this, such as implementing some kind of interface so I can reuse with-open, or something like that?
18:45gfredericksTimMc: yeah; I can't tell what's going on there
18:45josteinkwhere caused you to see the need and go for it? :)
18:45gfredericksaugustl: so your issue is that "proper teardown" =/= (.close ob)?
18:45Bodiljosteink: When you want to deal with heavily class based JS APIs - my use cases were Ace and Backbone.
18:45TimMcgfredericks: The idea was to always move forward along either of the middle two options when arriving at a vertex, but that leaves some vertices out, so I was trying to find a way to jump sideways sometimes.
18:46augustlgfredericks: not really, currently it's (teardown ob), and ob is a map, and I do stuff with entires in the map
18:46augustlgfredericks: perhaps I could somehow implement it so all that stuff happens in a .close method
18:46rayluhi. i'm fairly new and i had some style questions. is it normal to use let immediately inside a defn like this? https://pastee.org/q9uvj
18:46gfredericksTimMc: I thought of that but the three green paths near the top-right seemed to contradict the idea
18:46augustlraylu: very normal yeah
18:47Bodilaugustl: Methods are smelly, you should go ahead and make your macro imo. :)
18:47augustlraylu: doto is perhaps better though
18:47augustlBodil: but, but, reuse!
18:47josteinkBodil: ah. backbone. fair enough. just barely looked into that, but never got going.
18:47rayluaugustl: i'm only doing two things to mac, though, and one of them is inside the let
18:48augustlraylu: ah, misread it
18:48ivaraasenhyPiRion: haha https://www.refheap.com/paste/e5c5bca04d7b7206367c03f4e
18:48rayluaugustl: ok. thanks for confirming :D
18:49Bodiljosteink: Don't take that as an endorsement, Backbone was just my obvious test case - wouldn't use it myself. :)
18:49augustlraylu: your indentation is _very_ unconventional, though
18:50amalloyraylu: yes, the code is fine, but the whitespace is very different from what anyone else would do
18:50rayluyeah, i noticed. i don't understand why the other is more common. i'm used to this because it let's me move entire lines around easily
18:50TimMcgfredericks: Right, but those sprout from a side-path, so that's not too surprising. :-/
18:50augustlraylu: you don't use paredit mode with emacs, apparently :)
18:51TimMcDamn this is hard.
18:51amalloyraylu: https://gist.github.com/b754aa03bb81749c86d1, for reference
18:51TimMcgfredericks: Have you already checked for coordinate systems for hyperbolic spaces?
18:51gfredericksyeah; it's tricksy
18:52amalloyand yeah, it's harder to move around entire lines this way, but...moving around entire lines is just an indication that your editor isn't helping you out: you should be focused more on moving around sexps
18:52gfredericksTimMc: my current thought is that there are two/four kinds of relationships between two vertices that are two hops apart
18:53TimMcgfredericks: There might be something generalizable from this: http://i.imgur.com/0YWlhvB.jpg
18:53TimMcgfredericks: State machines. :-)
18:53gfredericks(sharp-right a b) (dull-right a b) (sharp-right b a) (dull-right b a)
18:53gfrederickswell insert a c as the second arg in all of those
18:54gfredericks(c being the intermediate vertex)
18:54gfredericksthat might give you the language to express the geometric...shape of the thing
18:55gfredericksin any case I'm running out for a few hours. If you win any fields medals let me know.
18:56hyPiRionivaraasen: sweet
18:57ivaraasenhyPiRion: mean execution time is about 3 us. a bit slower than Apache Commons probably, but it's probably viable for one-off calculations
18:59gfredericksTimMc: just kidding I'm still here. Even if you can get a canonical path, implementing a `neighbors` function doesn't seem straightforward? but maybe it would be
18:59gfrederickstwo neighbors could have arbitrarily different paths; but it might still be easy
19:05augustloh hey, this is the first time I wrote a macro and it worked as I expected the first time I ran it.
19:06ivaraasenaugustl: congrats
19:06TimMcgfredericks: What would be nice would be a graphics program where I can draw lines and color squares and then drag the hyperbolic space to recenter it... but that would probably require having a coordinate system. :-P
19:08S11001001this stuff is pretty funny: [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
19:09S11001001https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/Lib/RT.cs#L1343
19:10amalloyS11001001: CA1709:IdentifiersSHOULDbecaseCoRRectly
19:13S11001001CA42:SuppressingWarningsShouldntBeSuchABloodyChore
19:14S11001001,(take 10 (repeat [42, 84]))
19:14clojurebot([42 84] [42 84] [42 84] [42 84] [42 84] ...)
19:16gfredericksTimMc: that's one of my end goals actually
19:17hyPiRion,(repeat 10 [42 84])
19:17clojurebot([42 84] [42 84] [42 84] [42 84] [42 84] ...)
19:17TimMcgfredericks: I see.
19:18TimMcgfredericks: Anyway, congratulations. You've successfully nerd-sniped me and my wife.
19:19TimMc"For God's sake, please give it up. Fear it no less than the sensual passion, because it, too, may take up all your time and deprive you of your health, peace of mind and happiness in life." -- Wolfgang Bolyai urging his son János Bolyai to give up work on hyperbolic geometry.
19:19gfrederickshaha
19:22gfredericksit bothers me that the lines in that diagram are straight
19:24technomancyS11001001: wow, talk about boilerplate
19:25S11001001I think someone has funny ideas about "correctly"
19:25S11001001what it means, that is
19:26S11001001I take it back; it might be fair, I don't know anything about the C# developer community.
19:26S11001001We certainly don't put up with any nonsense-not-like-this.
19:26amalloyindeed. the C# guys like PublicMethods to have UpperCamelCase
19:27S11001001I know the stdlib is like that
19:27josteinkS11001001: as a .net developer, the main reason I do JVM-based clojure is that clojure-clr seems all dead :)
19:27S11001001josteink: dmiller seems to well keep up with it
19:27cbp`I'm unsure what to put in public pgp when registering to clojars, since the public key is in binary
19:28S11001001cbp`: use --armor option to gpg
19:28josteinkcbp`: the public key has a ascii fingerprint of sorts though
19:29josteinkyou should be able to get gpg to export the public key, in an ascii-ish format
19:29cbp`thank you
19:30TimMc--enarmor
19:30TimMcI think
19:30TimMcgfredericks: I think I'm more used to seeing this as fours of pentagons, not fives of squares.
19:33ThatOneGuyhola yall. I know this is probably somewhere on the web, but I thought it would be easier to ask here. What is the difference between ` (backquote) and ' (single quote) in clojure? and more specifically in macros?
19:35S11001001ThatOneGuy: ' is the true quote (nothing evalled); ` is syntax sugar for a thing that is not that. Neither changes behavior in macros.
19:36hyPiRion,`(vector ~(+ 1 2) ~@(vector :a :b :c)) ; example of backquote
19:36clojurebot(clojure.core/vector 3 :a :b :c)
19:36S11001001ThatOneGuy: any attempt to rehash all the ` features here would almost certainly miss something.
19:36hyPiRion,'(vector ~(+ 1 2) ~@(vector :a :b :c)) ; normal quote
19:36clojurebot(vector (clojure.core/unquote (+ 1 2)) (clojure.core/unquote-splicing (vector :a :b :c)))
19:37ThatOneGuy"for a thing that is not that." what do you mean by this? I get the rest of your answer though.
19:37S11001001ThatOneGuy: a thing that is not the true quote
19:38ThatOneGuyso ` backquote does more expansion than a regular quote? (evals the unquote function and the unquote-splicing)
19:39ThatOneGuyor allows for more expanded unquoting
19:39hyPiRionThatOneGuy: As a start, yes. Also notice that ##`(vector ...) returns clojure.core/vector instead of just vector
19:39lazybot⇒ (clojure.core/vector ...)
19:40hyPiRionTo top it all off, symbols can be appended with a # to create gensyms
19:40ThatOneGuyso fully qualifies function names?
19:40hyPiRionThatOneGuy: Yes
19:40rayluok. so... what does :cost do? https://github.com/clojure/java.jdbc
19:40hyPiRion,`(let [foo# 100] (+ foo# 999))
19:40clojurebot(clojure.core/let [foo__79__auto__ 100] (clojure.core/+ foo__79__auto__ 999))
19:41amalloyit's just a column in his sql table, raylu
19:41ThatOneGuySo when creating DSLs with macros, backquote is better. and when you want a raw list for data use single quote?
19:41hyPiRionThat's the crash course of macros, I think.
19:42hyPiRionThatOneGuy: Yes, that's the standard. Though amalloy could probably tell you how often you should write macros.
19:42rayluamalloy: suddenly, the maps part of the cheatsheet makes a lot more sense
19:42amalloywho, me?
19:42hyPiRionAnyone else named amalloy here?
19:42raylui mean i read (:key my-map) → ( get my-map :key)
19:43raylubut i had no idea what it meant until you said that, amalloy
19:49tomojgfredericks: http://bulatov.org/math/1001/#(52)
19:50tomojseen that deck already? pretty neat
19:50augustlraylu: also, fyi, it's not a macro, :key is actually a function
19:50josteinkraylu: you should read the joy of clojure
19:50augustl(inc josteink)
19:50lazybot⇒ 1
19:50josteinkit will walk you trough lots of these things in a very enlightening way
19:51josteinkI think clojure is pretty straight forward, except when its not
19:51josteinkbut one of the parts of clojure where small aspects have a big impact in clojure is collections
19:52josteinkand the joy of clojure will walk you through them pretty thoroughly and good
19:52ThatOneGuylol "clojure is pretty straight forward, except when its not" nothing else is like this in the entire world. /s
19:53josteinkwell
19:53josteinktell me I'm wrong :P
19:53josteinkI dare you :D
19:55rayluis == the same as = except only for nums?
19:58seangroveBodil: Slightly confused from some errors here
19:58seangroveIf I see: goog.base(this, goog.ui.Container.Orientation.VERTICAL,
19:59seangrovein the closure docs, should I be calling (super this, goog.ui.Con....), or just (super goog.ui.Con...) ?
19:59seangroveLooking at the macro, it looks like you automatically put in the "this"
20:00Bodilseangrove: The super macro takes the arguments for the superclass method. It's designed so you won't ever have to worry about passing this around.
20:01Bodilseangrove: Oh, and you can't specify a superclass, it always picks the first one in the prototype chain with the method you're calling.
20:02ivaraasenhyPiRion: just got arrseq working, which is doseq, but for arrays. could be nice if you need to have side-effects only.
20:02seangroveBodil: The superclass is chosen from the :extends argument, right?
20:02seangroveI'm not looking to choose the superclass, just trying to translate this closure ui custom component code, which is not particularly nice
20:03Bodilseangrove: Yeah, Foo :extends Bar causes goog.interits(Foo, Bar), essentially.
20:03Bodilgoog.inherits*
20:03seangroveYeah, thought so
20:05Bodilseangrove: goog.base(this, superclass, args) translates simply to (super args)
20:07Bodilseangrove: uh, no, that's not goog.base's signature... but you get the idea :)
20:07seangroveSo, goog.base(this, goog.ui.Container.Orientation.VERTICAL, ChecklistRenderer.getInstance()); => (super goog.ui.Container.Orientation.VERTICAL (.getInstance ChecklistRenderer))
20:07BodilYeah, looks right.
20:07seangroveAlright, will figure out what's wrong from here then
20:07devnI could use a spot of help with luminus. I am deploying to heroku and want to connect my app to an elasticsearch addon. It seems like it's not doing it.
20:07seangroveI can't believe what a horrible nightmare extending goog.ui is
20:08devnyogthos|away: ^^
20:08augustlseangrove: for what it's worth, I spent 3 months writing something in Google Closure I then spent 1 week rewriting in AngularJS, and it was much stabler, and even had more features
20:08seangroveHeh, this *is* our re-write from jQuery ;)
20:08seangroveWith cljs, augustl ?
20:08devnI call (connect! (System/getenv "BONSAI_URL")) in myapp.handler/init
20:09augustlseangrove: no just plain JS
20:09augustlseangrove: the biggest pain was updating the UI after initially creating the DOM elements (or goog.ui.Components)
20:09devnI run my server on heroku using: lein with-profile production ring server
20:09devnI have :ring {:handler myapp.handler/app} in my project.clj
20:10gfredericksTimMc: I think the two are dual
20:10augustlwith angularjs, everything is lazy, so it doesn't matter if you do some operation the 1st or 2nd or 97th time
20:10josteinkquite a few comitts the last few days ;)
20:12augustlseangrove: angularjs is probably not a good fit for clojurescript, though. angular is _all in_ mutability
20:13rayluso, (= a b) seems to do a java ==, not a java .equals (right now, a and b are byte-arrays)
20:13devnyogthos|away: nevermind, needed to add :init to project.clj
20:13raylubut the documentation says otherwise...
20:13devnyogthos|away: it might be a good idea to include that by default in the project.clj
20:13seangroveaugustl: Heh, maybe for the next rewrite then :)
20:13seangroveI've found closure to be very fast, which is nice
20:14seangroveBut not a whole lot that's nice beyond that
20:14seangroveReasonably stable
20:14augustlraylu: seems to boil down to clojure.lang.Util/equiv, whatever that might be
20:14ivaraasenhyPiRion: and now we've got destructive map! for in-place mapping. fun
20:14augustlseangrove: every time I work with raw DOM elements, I wish I had Google Closure there. I like to think of goog.ui.Component as DOM elements on steroids (lifecycle, better event handling, etc)
20:15rayluis there a simple way to compare byte arrays?
20:15augustlraylu: for byte equality?
20:15rayluyes
20:15cshellraylu: You'd have to write a for loop I'd imagine
20:15technomancycompare seqs over them
20:16rayluT.T
20:16augustlraylu: here's the Java code for = https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L24
20:16cshellyeah, or that :)
20:16augustlit's a call to .equals it seems
20:16josteinkraylu: the problem with equality of complex entities is unfortunately not entirely eliminated in clojure ;)
20:16technomancybyte arrays are mutable; you can't have two different mutable objects that are equal
20:16josteinkraylu: or what technomancy said
20:17technomancyfor background I highly recommend reading "Equal Rights for Functional Objects"
20:17josteinkhah
20:17josteinkis that book or a blog post?
20:18technomancyit's a paper ಠ_ಠ
20:18technomancyclojurebot: equal rights for functional objects
20:18clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html
20:18josteinkoooh. now I feel so unacademical
20:18technomancyhaha
20:18augustlpapers should have boring titles :S
20:18technomancys'ok; it's just one of my favourite rant topics
20:18rayluoh. are you telling me that .equals wouldn't have worked in java either?
20:18technomancyespecially when there are CLers present
20:18technomancyraylu: I'm saying Java's notion of equality is not particularly useful
20:19augustlraylu: it appears that = just ends up calling .equals unless they're numbers, so yeah
20:19augustlbut I'm not sure
20:19technomancyit can be used in some limited circumstances, but "do these different objects happen to have the same value during this exact instant" is not the kind of thing you should base a language around
20:20augustland is "this exact instant" atomic for things like byte arrays? :)
20:20cshellThanks for the link, technomancy - I always like to find things like this
20:20augustlwould be nice if = locked!
20:20josteinkhahahaha
20:21josteinkI cant foresee the amount of bugs THAT would cause
20:21seangrovetechnomancy: Why when CLers are present?
20:21josteinkseangrove: I think CLers are rumoured to be the most pedantic of all programmers alive :P
20:21technomancyseangrove: because that paper is written by someone who really wants to like CL but is honest about its deep-seated shortcomingsn
20:22seangrovetechnomancy: It has (nearly) no shortcomings
20:22josteinkI happened to end up at a news years party with a CLer
20:22seangroveHow could it? The spec is ~1500pages long :P
20:22josteinkhe tried to convince me a seperate namespace for functions was a good thing
20:22josteinkon new years eve
20:22seangrovejosteink: I like that feature
20:23technomancyCLers like to imagine that because their language can expand to include anything that it possesses unlimited power, but for some reason they don't understand that certain types of power (immutability, sane equality, GC, etc) are derived from giving up harmful semantics.
20:23josteinkI so do not
20:23seangroveBut I didn't see it as particularly useful
20:23technomancylisp-2 is really wretched in elisp
20:23seangroveI didn't know elisp was a lisp-2
20:23technomancymakes most higher-order functions so cumbersome to work with that the imperative equivalent ends up being shorter =\
20:24seangroveI always use it as though it's not
20:26gfrederickstomoj: this presentation is. good.
20:27josteinkatleast pretty close ;)
20:28seangroveI feel like drinking after all this horrible goog.ui stuff
20:29josteinkyou know
20:29josteinkI spedn way too much time on HN
20:30josteinkbut one of the discussions I read there was about CLJS
20:30josteinkand the consensus seemed (among many) to be that CLJS really doesnt have that fun, sparkling, dynamic nature which people usually associate with clojure
20:30technomancygfredericks: not even about the good old days?
20:30gfrederickstechnomancy: first I've heard of them
20:31josteinkand I tend to agree
20:31technomancygfredericks: everyone says it's all gone downhill
20:31josteinkwith CLJS you spend way too much time dealing with bullshit
20:31josteinkthings which are not your primary concern
20:31ivaraasenoh, the good old days, when no one ate quiche and Fortran seemed like Python in comparison to anything else.
20:31technomancybut I don't know whether the good old days were just "back before I was able tell whether I was wasting my time on useless discussions" or not
20:32josteinkheh
20:32josteinkthe only place which hasnt gone downhill is irc
20:32josteinkbecause it has actually had a decrease in amount of users ;)
20:32technomancyfreenode is the best social network; no contest
20:33gfredericksthey never send me emails asking for a photo of my birth certificate
20:33josteinkhaha
20:33gfredericks...yet
20:33technomancyactually have been musing on ways in which I could replace my twitter usage with freenode
20:34raylutechnomancy: bitlbee will.. sort of do that for you
20:34josteinkIve decided that I dont -need- twitter
20:34technomancytwitter is great for broadcast, but everyone I actually want to have conversations with is on freenode
20:34technomancyraylu: actually I'm thinking of the other direction
20:34angusiguessYou could limit every irc message to 140 characters.
20:34josteinkI just open a twitter tab and post stuff if I want to spam it :)
20:34technomancyI want my freenode conversations to be accessible on my mobile
20:34angusiguessOr use more octothorpes.
20:35josteinktechnomancy: you could always put up a irc XMPP proxy into a gtalk account
20:35josteinktechnomancy: but that would probably make your (android) cellphone go crazy :P
20:35technomancyso they can fill the "checking up on useless information" gap that I currently use twitter for; more of a compulsive need to gather data
20:35gfrederickstomoj: this is maybe the most amazing thing I've seen in months or something
20:35amalloytechnomancy: surely your mobile has an irc client. so you must mean something else i'm not quite following
20:36technomancyamalloy: mobile IRC clients are incredibly poor
20:36josteinkraylu: bitlbee works. but is not very friendly for mobile
20:36technomancyI don't necessarily want to focus on a real-time conversation
20:36technomancyI'd rather have summarization and search features
20:36amalloymine's not bad, but i suppose i don't really ask for much given that my desktop client is pretty poor
20:37ivaraasenI use way too much mail
20:37josteinkI've stopped using desktop irc clients ages ago
20:37josteinkI like having a session running anytime, anywhere
20:38technomancyamalloy: you don't use ERC?
20:38josteinkwhich I can attach to when I need it :)
20:38amalloyno. i use erc for editing code. shameful, i know
20:39amalloyer, emacs
20:39gfredericksman that was almost interesting
20:39technomancywas going to say, that's a neat trick
20:39ivaraasenanyone interested in looking at some utility stuff for doing primitive numerics in Clojure? (Flop-ish)
20:39amalloyheh, yes. any clojure program i can't fit in an irc message isn't worth writing
20:40technomancy /msg ~/src/leiningen/project.clj sed -i s/clj-http "0.5.7"/clj-http "0.5.8"/
20:40josteinkanyway
20:40josteinkmight be coincidence
20:40josteinkmight be something else
20:41josteinkbut your (final) release of leiningen 2.0.0 seemed to have woken up projects around the clojure-verse
20:41josteink:)
20:41ThatOneGuyanother quick question. What does a solitary keyword value do a function body? e.g. (defn something [func] :fn func)
20:42amalloynothing
20:42josteinknothing
20:42josteinkit checks if that func is a map which contains a key with the keyword :fn, and in that case retrieves the value associated with that key
20:42josteinkand in all other cases it is falsey
20:44jeremyheilerjsteink, i think you're assuming there are parens around ":fn func"
20:44josteinkI realized that as well. afterwards
20:45jeremyheilerheh
20:45ivaraasenjosteink: by the way, you're Scandinavian?
20:46ThatOneGuy(defmacro component [name params & r] `(defn ~name ~params ~@r))
20:46ThatOneGuy(component renderable [func] :fn func)
20:46ThatOneGuydoes that help give some context?
20:47josteinkivaraasen: obviously.
20:47josteinkand you stick out like a sore thumb :P
20:49ThatOneGuy[(renderable `(custom-render-func))] so would that be putting the keyword :fn and func inside the vector?
20:49josteinkyes
20:49jeremyheilerThatOneGuy, invoking renderable will just return the value of func because it is the last expression in the function body.
20:50josteinkor that :P
20:50ThatOneGuyso the function would be added to the vector and not the keyword
20:52josteinkjeremyheiler: wouldnt it just return the function as is? since its never really invoked?
20:52josteinkI mean not to be nitpicking details, but this is definitely a details type question ;)
20:52ivaraasenjosteink: I get PMs all the time asking me if I'm Turkish for some reason
20:52jeremyheilerthe fact that the value of func is a function is by happenstance, if the value of func is a function, then yes the function will be return.
20:54jeremyheilerThatOneGuy, [(user/custom-render-func)] is what your vector would look like
20:54jeremyheilerThat is because '(custom-render-func) is the last argument supplied to renderable.
20:57ThatOneGuyok. I'm going through the game [ChromaShift](https://github.com/ibdknox/ChromaShift), and it looks like he is putting a :fn (custom-render-func) in the vector because he grabs it out to render each entity, so I must be missing something
21:01jeremyheilerThat compnent macro is different than yours.
21:01ThatOneGuyyeah, I was trying to translate it to regular clojure, because I don't want to use clojurescript.
21:01TimMcgfredericks: http://bulatov.org/math/1101/webtalk.html#%2821%29 and the next few slides may be interesting.
21:02TimMcgfredericks: I'm not sure that slide actually indicates a non-overlapping enumeration scheme, though.
21:02jeremyheilerTheOneGuy, right, so you can see that ultimately a string and keyword are passed into the js-obj function.
21:03gfredericksTimMc: I saw that; doesn't suggest anything to me though :/
21:03jeremyheileralong with whatever happens to be in r.
21:04ThatOneGuyyeah. and in js-obj it calls (apply gobject/create keyvals)
21:04jeremyheilerso if name="foo" and r=(:x :y), then the function is (cljs.core/js-obj "name" :foo :x :y)
21:05gfredericksit just occurred to me that (repeat x) could return a special ISeq for which rest returns itself
21:05ThatOneGuyyeah. then gobject/create probably creates a javascript object from those keyvals and that is what is stored in the vector
21:06jeremyheilerprobably
21:06ThatOneGuyso I guess the thing I need to understand to translate this better is the letc macro, as that is what is used to get then renderable component out of an entity
21:06TimMcgfredericks: http://bulatov.org/math/1101/img/dod_tiling_01.jpg :-D
21:07gfrederickscube-like dodecahedrons!
21:09gfredericksTimMc: I think I might like the pentagon version better, at least for playing Go
21:12jeremyheilerThatOneGuy, I guess that depends on what pairs is. It's basically doing some stuff to create a bunch of bindings for a let, which puts all those bindings in context of the body.
21:14ThatOneGuy](letc e [rend :renderable], so the pairs (I think) describe the let binding name to use and keyword to grab from the underlying datastructure
21:14ThatOneGuyignore the first ] idk why that is there
21:18seangroveBodil: Is pylon aware of the difference in calling super in instance methods versus prototype methods?
21:20bbloomRaynes: I can only assume that you want me to ask this:
21:20jeremyheilerThatOneGuy, that sounds legit, but I really don't know what js/Game.as is.
21:20bbloomRaynes: "What's updoc?"
21:23amalloybbloom: yes, that is why he named it updoc
21:23bbloomamalloy: clearly :-)
21:23bbloomi looked at it, so id ont even want to know the answer to that question
21:23ThatOneGuyso do you know how I would convert that to regular clojure? where I could add a :renderable-fn keyword and value to the vector so I can grab the function later?
21:24jeremyheilerYou would at least need to have a map that maps a keyword to function. If you want to get any fancier, that's your choice.
21:25jeremyheilerAlas, I really don't know the reasoning behind all of this, so I can't really help you with the design.
21:27ThatOneGuytrue. In his game, he is using something called the component-entity-system (CES) model for modelling game entities in a functional language. and I am trying to convert that to regular clojure to use in a game project of mine.
21:27seangrovepylon seems to die if called from a prototype's method ('this' is undefined in that case, so super won't work properly)
21:28ThatOneGuyI like the elegance of entities being defined as [:player [(component-1) (component-2)]] but it looks like I need a more verbose solution like [:player {:renderer (renderable-component) …}]
21:29jeremyheilerThatOneGuy, perhaps a better approach would be to figure out what all the cljs.core/* and js/* functions do and keep the rest as-is.
21:30jeremyheilerUnless you really want to get into all the details first.
21:32ThatOneGuythanks. gotta head home. brb
21:41Raynesamalloy: Good work on updoc's name. Didn't take long until people caught on.
21:41amalloydid you announce it recently or something?
21:42Raynesamalloy: I just pushed it to Github yesterday is all. I didn't 'announce' it. It's like the most useless thing I've ever made.
21:51ivaraasenRaynes: it's pretty sweet to see how easy it's to do stuff like this in Clojure, though.
22:03rlo.O
22:03rlthink i found a bug in the interpreter
22:03rlCompilerException java.lang.RuntimeException: Unable to resolve symbol: template-list in this context, compiling:(NO_SOURCE_PATH:1:1)
22:03rlerm
22:04rl=> (agility.template/eval-template-list template-list (["Somestr" "Hello" "(inc 1)"] ["Somestr" "Hello2" "(inc 2)"]))
22:04rlit ignores the eval- part
22:04rlif i do eval2 then
22:04rl(agility.template/eval2-template-list template-list (["Somestr" "Hello" "(inc 1)"] ["Somestr" "Hello2" "(inc 2)"]))
22:04rlCompilerException java.lang.RuntimeException: No such var: agility.template/eval2-template-list, compiling:(NO_SOURCE_PATH:1:1)
22:04jeremyheilerYou sure it's not referencing the template-list right after it?
22:06rlyeah, hold on igot to dig deeper..i'm not using macros here or anything
22:07jeremyheilerThe error indicates that "template-list" does not exist. If you type a random symbol into your repl, you'll get the same "unable to resolve symbol" compiler exception.
22:07rljeremyheiler: the problem is i was using (eval-template-list ...)
22:08rlit should say eval-templte-list dosen't exist, not template-list
22:08rloh
22:08rl<_<
22:08rlsorry
22:08rllol
22:09rli see what your saying, yes my bad lol
22:09jeremyheilerheh, no problem ;-)
22:13yedihow can I change the current working directory in an nrepl
22:14yedilooks like you can't do that in java..? so how can i get nrepl to start with q certain working directory
22:15cshellis it setting the java run directory property?
22:17TimMcgfredericks: Funny you should say that, I got overloaded with hyperbolic geometry and Alex suggested playing Go.
22:17cshellis it the user.dir property?
22:20yedii solved my issue by running lein repl from the terminal and running nrepl in emacs (instead of nrepl-jack-in)
22:28RaynesThere is no interpreter.
22:51yedidoes anyone know of data sets similar to http://wordnet.princeton.edu/wordnet/
22:56cshellLike these? http://richard.cyganiak.de/2007/10/lod/
22:57cshellwordnet is in there, so maybe that's what you're looking for
23:05dabdcan someone help me with the following macro? https://gist.github.com/4646206
23:06dabdit generates a function but when i call it like this: ((parse-stack-interval "9.0,9.7-10.8,19.1+") 19.1) it returns false
23:06dabdhowever if i call directly the result of the macroexpansion (macroexpand-1 '(parse-stack-interval "9.0,9.7-10.8,19.1+")) it returns true
23:14yedioh yessss, just remembered i can leverage java libraries
23:42mmarczykdnolen: ping
23:45amalloydabd: there's no parse-stack-interval function in that paste
23:49amalloybut assuming you meant interval-test-fn, it's because 19.1 is a double, and (Float/parseFloat "19.1") is a float: ##(>= 19.1 (float 19.1))
23:49lazybot⇒ false
23:49amalloywhen you take the macroexpanded output and type it back in, it goes through the reader again, which parses the function body as doubles, not floats
23:51dabdamalloy: i just renamed things a bit it's the interval-test-fn macro
23:52dabdso i should parse the string as a double?
23:52amalloy*shrug* it depends what you want, probably. mostly you should just be careful not to compare doubles with floats
23:53dabdok thanks