2013-01-26
| 01:24 | warz | hrm, how do you import an AOT compiled class in seperate clj file? (gen-class) |
| 01:24 | warz | would i import it like a java class? |
| 01:26 | warz | i might just need to go with java for this stuff, haha. i was going to try to be cool and use clojure. |
| 02:41 | tenpaiyomi | Quick 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:41 | tenpaiyomi | I've tried wrapping them in parenthesis, but that causes an error. |
| 02:45 | amalloy | tenpaiyomi: (do x y). but since most things in clojure are immutable, that's useful/necessary less often than you think so far |
| 02:46 | tenpaiyomi | amalloy: 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:55 | wei_ | how do you build a cljs plugin for release to clojars? |
| 02:55 | wei_ | 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:57 | Frozenlock | The voices of Cljs are impenetrable "Uncaught TypeError: Cannot read property 'xk' of undefined" |
| 03:02 | ivan | that usually means a property got renamed that you did not want renamed |
| 03:02 | ivan | you need externs for third-party libs. you probably already know this. |
| 03:02 | Frozenlock | Well yeah... but which one... |
| 03:02 | ivan | heh |
| 03:03 | Frozenlock | Yes, done... perhaps it was not taken while compiling... |
| 03:03 | Phonatacid | Hi. 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:03 | Phonatacid | Basically my function's prototype would look like |
| 03:03 | Phonatacid | (super-agent [state :myarg1 myval1 [:myarg2 myval2 :myarg3 myval3] & agentargs]. |
| 03:03 | Phonatacid | How can I achieve this ? (sorry for the spam) |
| 03:25 | wei_ | 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:26 | wei_ | using jayq 2.0.0 and lein-cljsbuild 0.3.0 (most recent everything, I think) |
| 03:26 | wei_ | how do you see what version of clojurescript you're using? |
| 04:36 | rl | I'm trying to write a HTML template system. Is it possible to set a namespace in a paticular function to avoid naming collisions? |
| 04:38 | rl | My idea is to produce a list of expressions, where each expression should evalulate to a string |
| 04:39 | rl | but I want to disallow "global variable" access |
| 04:43 | magnars | I 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:43 | tomoj | :D |
| 04:45 | tomoj | there's no nice built in function |
| 04:47 | magnars | reduce it is, then - thanks! |
| 04:47 | tomoj | people usually do stuff like (into {} (for [[k v] m] [k (f v)])) I think |
| 04:48 | magnars | look at that - not too shabby. Thanks! |
| 04:48 | tomoj | reducers could someday do it |
| 04:59 | rl | hm so in clojure is there a way to not allow access to symbols that are not defined in a function? |
| 05:04 | rl | i 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:05 | rl | I still don't like the fact global variables can still be accessed <_< |
| 05:06 | amalloy | it's basically impossible to do anything without referring to globals |
| 05:06 | Sgeo | amalloy, Newspeak? |
| 05:06 | Sgeo | Well, at least, if the full Newspeak system was working properly |
| 05:24 | zby_home | (seq (.split #"," "one,two,three")) |
| 05:24 | zby_home | is there an eval bot here? |
| 05:25 | tomoj | &(seq (.split #"," "one,two,three")) |
| 05:25 | lazybot | ⇒ ("one" "two" "three") |
| 05:25 | zby_home | thanks |
| 05:26 | zby_home | at my interpreter it fails with: Exception Ambiguous match for ",\" \"one,two,three\"))" by #<Object[] [Ljava.lang.Object;@6a9cce0f> |
| 05:26 | zby_home | is that a known feature? |
| 05:30 | tomoj | I think there's something wrong with your interpreter |
| 05:51 | cemerick | zby_home: are you squared away now? |
| 05:53 | zby_home | cemerick - more or less |
| 05:54 | zby_home | I found that the problem was with the session wrapper |
| 05:54 | cemerick | how so? |
| 05:55 | zby_home | https://groups.google.com/d/topic/ring-clojure/0QslnWVSoNg/discussion |
| 05:56 | zby_home | maybe 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:56 | zby_home | it should be the same function |
| 05:56 | zby_home | but the second at each request sends a new session cookie |
| 05:56 | cemerick | yeah, that makes sense |
| 05:57 | cemerick | no other way for it to generate a constant key on a per-middleware-usage basis |
| 05:58 | cemerick | an implicit side effect :-P |
| 05:58 | zby_home | aha |
| 05:58 | zby_home | OK |
| 05:59 | zby_home | I think there was one more thing |
| 06:00 | zby_home | yeah: https://gist.github.com/4633508 |
| 06:01 | zby_home | cemerick ^^^ |
| 06:03 | cemerick | and 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:03 | zby_home | that's a different one |
| 06:04 | zby_home | the session key I eventually figured out how to workaround |
| 06:04 | zby_home | that is not use 'defn' |
| 06:06 | zby_home | I'll regenerate it here |
| 06:06 | zby_home | and check it again |
| 06:08 | cemerick | zby_home: it's exactly the same thing; you're using defn to define secured-app |
| 06:08 | zby_home | OK - I'll check it here - I think I fixed that part yesterday |
| 06:16 | santo` | Is it good for Clojure to have multiple platforms? |
| 06:17 | santo` | ? |
| 06:18 | zby_home | cemerick - OK - so the last version that I save is this: http://nopaste.me/paste/7719855465103bb61f1a60 |
| 06:18 | zby_home | and it still have one problem |
| 06:18 | zby_home | which is a 404 on the /admin page |
| 06:18 | zby_home | I have not yet really analyzed it |
| 06:19 | zby_home | but maybe it is something obvious |
| 06:20 | santo` | Can I run ClojureCLR on linux with mono? |
| 06:22 | santo` | Helllo? |
| 06:22 | ChongLi | santo`: hi |
| 06:23 | ChongLi | I believe it can run on mono |
| 06:28 | cemerick | zby_home: nice, Friend bug |
| 06:29 | cemerick | change the /admin branch to: (friend/authorize #{::admin} (do response-map-here)) |
| 06:29 | cemerick | it's actually a bug/feature :-P |
| 06:29 | ejackson | :) |
| 06:30 | zby_home | response-map-here - literally or use my map there? |
| 06:30 | cemerick | the latter |
| 06:31 | cemerick | I enhanced authorize a while back to accept an (optional) second map argument, that is merged into the unauthorized error stone if present. |
| 06:31 | zby_home | worked :) |
| 06:32 | cemerick | Perhaps a poor mimicry of the maps used for pre/postconditions in clojure fns. |
| 06:32 | zby_home | sorry - but that does not ring any bell for me |
| 06:32 | zby_home | I started learning clojure just a week ago |
| 06:32 | cemerick | don't worry about it :-) |
| 06:32 | cemerick | Thanks for the report |
| 06:32 | zby_home | :) |
| 06:33 | zby_home | do you plan to add an example to the code? |
| 06:33 | zby_home | I mean something that people like me could just copy |
| 06:33 | zby_home | and run |
| 06:33 | zby_home | this would be very useful |
| 06:34 | zby_home | I did not know how to run the example from tests |
| 06:34 | cemerick | zby_home: working on it: https://friend-demo.herokuapp.com/ |
| 06:34 | zby_home | great! |
| 06:34 | zby_home | OK - thanks for your help |
| 06:34 | cemerick | thanks for your patience :-) |
| 06:47 | augustl | anyone got some suggestions for getting started using ZeroMQ from Clojure? |
| 07:24 | cemerick | zby_home: here's an issue you can track for that bug: https://github.com/cemerick/friend/issues/46 |
| 08:28 | zeussphinx | ? |
| 08:49 | Thallasios_Xelon | hello :)) |
| 08:49 | Thallasios_Xelon | anyone using counterclockwise? |
| 08:50 | Thallasios_Xelon | is there a way to run again without a new repl window? |
| 08:50 | Thallasios_Xelon | i mean when i press run,to update the last on |
| 09:17 | rodnaph | core.logic - i'm trying to write a relation to assert a list contains unique values, but am completely stumped - can anyone help? |
| 09:21 | borkdude | does someone here has an org-mode/jekyll basic skeleton which I could use? |
| 09:42 | xumingmi` | anyone know Rich's email address? I have sent him the Clojure CA, want to send him an email to inform him |
| 09:48 | marcellus123 | i 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:50 | Thallasios_Xelon | <Thallasios_Xelon> anyone using counterclockwise? |
| 09:50 | Thallasios_Xelon | <Thallasios_Xelon> is there a way to run again without a new repl window? |
| 10:11 | Thallasios_Xelon | there is an update for counterclockwise |
| 10:11 | Thallasios_Xelon | its very usefull |
| 10:17 | borkdude | Thallasios_Xelon what kind of update |
| 10:22 | hyPiRion | xumingmi`: You'll automatically pop up under http://clojure.org/contributing when it's been received |
| 10:33 | Frozenlock | Could 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:09 | tazle | should (line-seq (java.io.BufferedReader. *in*)) terminate at some point? |
| 11:10 | progo | not if the EOF isn't given |
| 11:11 | progo | consider how 'cat', 'wc' etc work. |
| 11:11 | tazle | well, there should be an EOF with <-redirection |
| 11:12 | progo | Yes, unless it's a pipe |
| 11:12 | tazle | it's a file, and cat terminates but doseq on the above doesn't - weird |
| 11:17 | Thallasios_Xelon | is there a way to find the line of the error i know (pst) |
| 11:23 | jeremyheiler | tazle: is this essentially what you are doing? https://www.refheap.com/paste/8987 |
| 11:25 | tazle | jeremyheiler: https://gist.github.com/4643117 is what I'm doing |
| 11:25 | tazle | and then lein run -m log4j-parser.cat < ../snippet |
| 11:30 | jeremyheiler | try: lein trampoline run -m log4j-parser.cat < ../snippet |
| 11:30 | tazle | then it terminates |
| 11:31 | dan | I'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:31 | ChongLi | dan: yes |
| 11:31 | ChongLi | you can quote those symbols |
| 11:31 | jeremyheiler | tazle: what's happening here (i think) is that standard in with out trampoline is being directed to lein, not your code. |
| 11:32 | uvtc | dan: use '+ and '- (instead of bare + and -) |
| 11:32 | ChongLi | (def inverse {'+ '- '- '+ '/ '* '* '/}) |
| 11:32 | dan | Ah, thanks to you both. That seems so obvious now. =) |
| 11:32 | tazle | jeremyheiler: and leiningen is then passing it on, and not closing things, it seems |
| 11:32 | ChongLi | &({'+ '- '- '+ '/ '* '* '/} '+) |
| 11:32 | lazybot | ⇒ - |
| 11:33 | jeremyheiler | tazle, you'll normally file bugs here: https://github.com/technomancy/leiningen/issues |
| 11:34 | jeremyheiler | but i dont' think this is a bug |
| 11:34 | tazle | how 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:35 | progo | yes. An eof's an eof. |
| 11:37 | jeremyheiler | using 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:38 | progo | but the EOF is given in that case |
| 11:54 | augustl | anyone 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:58 | no7hing | you could always install it in your local maven repo |
| 11:58 | augustl | no7hing: I tried, but leiningen doesn't find it for some reason |
| 11:58 | augustl | I get an early adopter vibe from trying to use ZeroMQ from the JVM :) |
| 11:59 | a|i | anyone using SumblimeREPL here? |
| 11:59 | no7hing | @augustl you're not the only one getting burned by zmq + jvm |
| 11:59 | Foxboron | a|i: yes |
| 12:00 | a|i | Foxboron: what is that damn ^,,l key shortcut in osx for evaluating a line? |
| 12:00 | Foxboron | a|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:01 | a|i | Foxboron: it's this: { "keys": ["ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines"}} and it never works. |
| 12:01 | a|i | how do people work with repl + sublime text if that shortcut doesn't work? |
| 12:01 | Foxboron | a|i: you change the key and see if it works. |
| 12:02 | Foxboron | a|i: try use "cmd" instead of "ctrl" |
| 12:02 | a|i | Foxboron: cmd+, is a classic for preferences in mac. |
| 12:02 | a|i | is it possible to connect repl with the lein project once, and have it auto reloaded when the file saves? |
| 12:03 | Foxboron | a|i: ummm....nope |
| 12:04 | a|i | what's the state of light table ide? |
| 12:04 | a|i | I'm just looking for a sane ide other than emacs+smile. |
| 12:04 | Frozenlock | emacs+nrepl? |
| 12:05 | a|i | Frozenlock: how is that better? |
| 12:05 | Foxboron | a|i: tried emacs and nrepl? |
| 12:05 | Frozenlock | Oh, better... |
| 12:05 | Foxboron | its just. better |
| 12:05 | Foxboron | more awsomesausce packed into one thing |
| 12:06 | Frozenlock | Foxboron: I still consider nrepl.el ~= slime |
| 12:06 | a|i | Foxboron: 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:07 | jeremyheiler | a|i, perhaps have them use eclipse with counterclockwise? |
| 12:07 | Foxboron | a|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:07 | a|i | jeremyheiler: ccw also has broken windows here and there. |
| 12:07 | a|i | it looks like there is no close to official quality ide for clojure outside of emacs. |
| 12:08 | Foxboron | a|i: sad truth |
| 12:08 | a|i | even scala came to the conclusion that they have to support an ide officially. |
| 12:09 | Frozenlock | lets make clojure officially support emacs :) |
| 12:09 | craigbro | indeed |
| 12:10 | craigbro | a|i you don't want "auto reload when saved" |
| 12:10 | a|i | Frozenlock: emacs is not for everyone. that'd be amistake. |
| 12:10 | craigbro | a|i: you compile teh file, it will save |
| 12:10 | craigbro | C-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:10 | craigbro | C-c C-k that is, sorry |
| 12:11 | Frozenlock | a|i: There's no IDE for everyone... |
| 12:11 | Frozenlock | Unless you count our dear friend Notepad.exe. Ah, notepad. |
| 12:12 | Foxboron | a|i: i debugged the keymap for you |
| 12:12 | Foxboron | found the error |
| 12:12 | Foxboron | (in sublime) |
| 12:12 | augustl | hmm, "NoClassDefFoundError Could not initialize class org.zeromq.ZMQ java.lang.Class.forName0 (Class.java:-2)", this is fun.. |
| 12:12 | a|i | Foxboron: I think they fixed it that bug: https://github.com/wuub/SublimeREPL/pull/116 |
| 12:14 | rationalrevolt | Does 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:14 | Foxboron | a|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:14 | Foxboron | a|i: if you also decide too use Sublime, i might have 2 helpfull plugins for Sublime. |
| 12:15 | a|i | Foxboron: I installed your clojure docs, but didn't figourout how to use it. |
| 12:16 | Foxboron | a|i: hah. ctrl+shift+p, search for "clj" and you will find it. |
| 12:16 | Foxboron | a|i: i believe the keymap files might be a bit fucked on several systems (my fault for not correcting that) |
| 12:17 | a|i | Foxboron: I meant how to _use_ the plugin. how do you get the docs for something? |
| 12:18 | augustl | how do I modify java.library.path without hardcoding the path into my project.clj? |
| 12:18 | Foxboron | a|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:18 | Foxboron | a|i: i might go about making a cache system so you can search the docs offline also. |
| 12:19 | a|i | Foxboron: is it possible to get the docs for a selection? |
| 12:19 | Foxboron | a|i: you mean, selecting a keyword? |
| 12:19 | a|i | Foxboron: eg, if I select 'map', is there a shortcut to bring up the doc for map? |
| 12:20 | a|i | Foxboron: or better, something like light table? |
| 12:20 | Foxboron | a|i: i was actually going to add a light table'ish system. But i havent coded up everything yet. |
| 12:21 | Foxboron | a|i: the shortcut is "supre+shift+c" |
| 12:21 | Foxboron | you can place your cursor beside the item, or select it. |
| 12:21 | augustl | seems 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:22 | technomancy | augustl: :native-path is an output path; it's where lein extracts native components of dependencies |
| 12:22 | Foxboron | a|i: also, if you have any suggestions for the plugin in general, just throw me a PM. |
| 12:23 | technomancy | augustl: there's no setting for java.library.path except :jvm-opts currently |
| 12:23 | technomancy | https://github.com/technomancy/leiningen/issues/906 |
| 12:23 | augustl | technomancy: hmm, according to http://www.paullegato.com/blog/jni-leiningen-native-path/ setting :native-path also sets java.library.path |
| 12:23 | a|i | Foxboron: great, thanks. |
| 12:23 | augustl | technomancy: 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:23 | Foxboron | a|i: i have not added threading, so a little freeze when you search is normal. (it's bad i know) |
| 12:24 | technomancy | augustl: that's intended for managed native components, not manually installed stuff |
| 12:25 | augustl | technomancy: hmm, not following. ~/local/zmq is the path to the native libs for zmq that the jzmq project loads via jni |
| 12:27 | technomancy | augustl: 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:28 | technomancy | augustl: it's not intended for "oh by the way, I have some native code that I downloaded myself; here it is" |
| 12:28 | technomancy | for 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:29 | augustl | technomancy: I see, thanks |
| 12:31 | augustl | both :jvm-opts and JVM_OPTS in env worked fine |
| 12:44 | rationalrevolt | Hi room, can someone point me to why I am able to use binding with vars that were not declared dynamic? |
| 12:44 | rationalrevolt | I'm supposed to be getting an exception, but i don't |
| 12:45 | rationalrevolt | i'm trying this in the repl |
| 12:45 | rationalrevolt | (def a 10) followed by (binding [a 20] (println a)) - this shouldn't work because a wasn't declared with ^:dynamic |
| 12:46 | dnolen | rationalrevolt: doesn't work for me. What version of Clojure are you running? |
| 12:47 | rationalrevolt | hmm, 1.2.0 maybe thats why? |
| 12:47 | dnolen | rationalrevolt: yes |
| 12:48 | rationalrevolt | thanks, i dint realize |
| 12:48 | dnolen | rationalrevolt: 1.2.0 is pretty old - unless there's a good reason I would move to 1.4.0 |
| 12:49 | rationalrevolt | right, i was playing with the example for compojure - din't realize the lein deps were configured with the old version |
| 12:49 | seangrove | Jesus, creating a custom component for goog.ui is insanely verbose |
| 12:50 | rationalrevolt | sorry enlive |
| 12:50 | dnolen | wow compojure is still on 1.2.1? |
| 12:50 | rationalrevolt | no, i corrected myself: for enlive |
| 12:51 | rationalrevolt | the templating library |
| 12:51 | seangrove | And it's not really clear how to do this in cljs |
| 12:52 | dnolen | seangrove: 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:53 | seangrove | Damn, this is the last thing to do before release :P |
| 12:53 | seangrove | Well, I'll feel better once I've started I suppose |
| 12:54 | seangrove | dnolen: So it looks like I need to make a function, and then alter its prototype: https://www.refheap.com/paste/8990 |
| 12:55 | seangrove | I'm struggling a bit to think of how to translate this to cljs |
| 12:56 | dnolen | seangrove: that's what deftype does - creates a function and alters the prototype |
| 12:56 | seangrove | Ah, hadn't come across deftype before |
| 12:57 | seangrove | Will look it up |
| 12:57 | dnolen | seangrove: all the data structures are written in terms of it - it's the "closest" thing to the host. |
| 12:58 | Frozenlock | Wait, so I didn't need "(set! (.-createDragElement (.-prototype new-dragger)) create-drag-element-fn)" :/ |
| 13:00 | dnolen | Frozenlock: nope, you can plain object menthods to deftype's via Object |
| 13:00 | dnolen | (deftype Draggable [...] Object (createDragElement [this] ...)) etc |
| 13:00 | dnolen | "you can add plain object methods to deftype" I mean |
| 13:01 | tgoossens | I'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:01 | tgoossens | I'm considering giving every operator an ID. |
| 13:02 | tgoossens | Or make it an atom. But since operators are values and hence will never change i think that is an unnecessesary addition of compexity |
| 13:03 | tgoossens | https://github.com/tgoossens/cljstrips/issues/2 |
| 13:03 | tgoossens | a bit extra description: |
| 13:04 | tgoossens | there are several possible "links" in the strips algorithm. Establish link "operator X establishes a precondition of operator Y" |
| 13:04 | tgoossens | before: "operator X must come before operator Y" |
| 13:04 | tgoossens | in my first attempt |
| 13:04 | tgoossens | an before link was {:first operatorX :last operatorY} |
| 13:04 | Bodil | seangrove: If you're having to deal with JS OOP stuff, you might want to look at https://github.com/bodil/pylon |
| 13:05 | Bronsa | dnolen: 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:05 | tgoossens | operatorX being effectively the operator value. |
| 13:05 | tgoossens | I'm fearing that this cannot be very efficient |
| 13:05 | tgoossens | So my question is. Any thoughts, concepts I should look into that might help me to solve my problem |
| 13:06 | tgoossens | or to better understand my problem |
| 13:06 | seangrove | Bodil: Oh, wow, this looks great for dealing with closure classes |
| 13:06 | augustl | technomancy: http://augustl.com/blog/2013/using_zeromq_from_clojure/ :) |
| 13:06 | seangrove | Does the :extends keyword come out as goog.base()? |
| 13:06 | dnolen | Bodil: nice! |
| 13:06 | Bodil | seangrove: Yeah, it's using goog.* stuff internally, so it shouldn't give you any trouble. |
| 13:07 | dnolen | Bodil: hmm, why doesn't it work w/ advanced compilation if you're leveraging it on Closure? |
| 13:07 | Bodil | seangrove: It uses goog.base() to extend, yes. :) |
| 13:08 | Bodil | dnolen: Wish I knew, but the compiler kept mangling my method names... |
| 13:08 | seangrove | Ah, but I need advanced compilation to deploy in production - you can't use that with pylon? |
| 13:08 | seangrove | Ah, just saw that, hah |
| 13:08 | Bodil | No :( |
| 13:08 | dnolen | Bronsa: probably. If I recall there's a few other things that deftype needs for real JVM CLJ-in-CLJ |
| 13:09 | dnolen | Bodil: hmm, so names get mangled w/in a project? Like code in the same project can't call code? |
| 13:10 | dnolen | Bodil: oh you use aset & aget, why not switch those to static access? |
| 13:11 | Bodil | dnolen: Should that matter? It seemed to compile down to the same thing anyway, iirc? |
| 13:12 | dnolen | Bodil: no it does not. aset -> foo["yucky_string"] |
| 13:12 | dnolen | set! -> f.nice_property |
| 13:12 | Frozenlock | !!! |
| 13:12 | Frozenlock | I've been trying to make advanced compilation work for hours! It might just be this! |
| 13:12 | Bodil | dnolen: Aha, interesting - I'll have a go and see if that helps. |
| 13:13 | dnolen | Bodil: if you change that, everything should work out nicely with advanced compilation |
| 13:13 | seangrove | That'd be awesome :) |
| 13:13 | pisketti | Perhaps a stupid question but is there any way to bind the last item of a coll using destructuring? |
| 13:13 | pisketti | In contrast to binding the first by something like [[x & xs] coll]. |
| 13:14 | tgoossens | reverse? |
| 13:14 | tgoossens | [[x & xs] (reverse coll)] |
| 13:15 | tgoossens | ,(let [[x & xs] (reverse [1 2 3]) x) |
| 13:15 | tgoossens | but i guess that's not exactly what you need |
| 13:16 | pisketti | thanks. I'd lose other bindigs but that's definitely a way to get the last |
| 13:16 | tgoossens | or |
| 13:16 | dnolen | pisketti: not possible |
| 13:17 | tgoossens | ,(let [[x & xs] '(1 2 3) y (last xs)] y) |
| 13:17 | dnolen | tgoossens: it's pretty normal to need ids when programming in language designed around immutable values |
| 13:17 | tgoossens | dnolen: not much experience here :) |
| 13:17 | dnolen | tgoossens: just do it w/ ids |
| 13:17 | pisketti | dnolen: ok |
| 13:18 | Bodil | dnolen: Hmm, lein-noderepl doesn't work with the latest cljs release - what did you change? :) |
| 13:18 | dnolen | Bodil: hmm, there was a REPL related change to Rhino support |
| 13:18 | dnolen | Bodil: if you can do a git bisect that would be helpful. |
| 13:19 | Bodil | dnolen: Just reverted to Rhino for now, I'll try and figure it out later... |
| 13:19 | dnolen | Bodil: there needs to be a CLJS project test matrix ... |
| 13:21 | wei_ | is there a way to use the clojure.math.numeric_tower library in clojurescript? |
| 13:21 | dnolen | Bodil: 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:21 | seangrove | Well, for browser-testing I know Sauce Labs has free testing for OSS projects |
| 13:21 | wei_ | actually, I really just need a round fn |
| 13:22 | Bodil | dnolen: Where's that? |
| 13:22 | dnolen | line 15 in classes.cljs |
| 13:22 | dnolen | where you set properties in the ctor |
| 13:22 | wei_ | js/Math.round |
| 13:22 | technomancy | wei_: the javascript runtime doesn't really support ... reasonable numerics |
| 13:22 | wei_ | haha |
| 13:22 | technomancy | it's more like a numeric hovel |
| 13:23 | seangrove | wei_: Why not use js/Math.round? |
| 13:23 | seangrove | (def round (.-round js/Math)) (round 99.54) |
| 13:23 | wei_ | just found out about that. thanks |
| 13:23 | dnolen | Bodil: actually, it can be done - looks like this-as allows it |
| 13:23 | seangrove | Ah, ok, heh |
| 13:23 | dnolen | Bodil: just tried (defn foo [x] (this-as this (set! (.-bar this) 1))), works |
| 13:24 | equalsdanny | Guys, does anybody know why does `lein run` takes up to 4 seconds to launch a simple project? |
| 13:24 | equalsdanny | I think I definitely miss something |
| 13:24 | Bodil | dnolen: Did you solve this already? :) |
| 13:24 | dnolen | equalsdanny: JVM start up time + compilation time. |
| 13:24 | dnolen | Bodil: I think that was fogus actually |
| 13:25 | equalsdanny | dnolen: is there any way to keep JVM up so that I can reduce the edit-compile-run cycle a bit? |
| 13:25 | craigbro | equalsdanny: don't edit comile run |
| 13:25 | craigbro | equalsdanny: use emacs+nrepl for intereactive developemnt |
| 13:26 | dnolen | equalsdanny: most people don't bother with lein run, they code interactively w/ a REPL |
| 13:26 | Bodil | dnolen: Problem is, I need to set a dynamic property... |
| 13:26 | dnolen | Bodil: which property? |
| 13:27 | craigbro | equalsdanny: 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:27 | craigbro | equalsdanny: stop me if I'm being overly pedantic 8^) |
| 13:27 | Bodil | dnolen: A lot of them - I'm wrapping every method in a bind function... |
| 13:28 | dnolen | Bodil: hmm I don't see any cases where you setting a dynamic name ... |
| 13:28 | dnolen | Bodil: oh ... the bind list |
| 13:28 | Bodil | dnolen: Yeah, and likewise with the actual method definitions - like (aset prototype function-name function-value) |
| 13:29 | equalsdanny | craigbro: I will try to set that up. thx :) |
| 13:30 | dnolen | Bodil: 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:31 | Bodil | dnolen: No, that's the problem right there - because js* only takes inline strings, I can't construct anything Closure Compiler would recognise. |
| 13:31 | tgoossens | dnolen: 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:32 | dnolen | tgoossens: it's not strange to have to write functions around managing ids |
| 13:34 | dnolen | Bodil: 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:35 | technomancy | equalsdanny: you can also try export LEIN_FAST_TRAMPOLINE=y lein trampoline run |
| 13:35 | technomancy | successive runs can skip the "outer" JVM |
| 13:35 | seangrove | What do I :require if I want to use goog.base, goog.inherits, goog.now, goog.addSingletonGetter? *shudder* |
| 13:35 | Bodil | dnolen: 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:35 | dnolen | tgoossens: 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:35 | dnolen | tgoossens: http://shaffner.us/cs/papers/tarpit.pdf |
| 13:36 | dnolen | is a great read |
| 13:36 | dnolen | Bodil: hmm ... |
| 13:36 | craigbro | hehe |
| 13:37 | craigbro | I shoudl check that out |
| 13:37 | dnolen | Bodil: 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:37 | craigbro | the inspiration for FRP application in my project came during a nap on the futon in my old apartment, quite vivid |
| 13:37 | dnolen | Bodil: it's come up many times ... |
| 13:38 | seangrove | dnolen: At the very least for interop, not for building cljs systems on |
| 13:38 | dnolen | seangrove: yeah |
| 13:38 | Bodil | dnolen: It's a good idea for interop, though I hate the idea of putting classes in Cljs on general principle... |
| 13:39 | dnolen | Bodil: 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:39 | Bodil | dnolen: That's definitely a valid point :) |
| 13:41 | clojure-newb | cemerick: 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:43 | dnolen | opened up a ticket for "genclass" for CLJS - http://dev.clojure.org/jira/browse/CLJS-463 |
| 13:44 | Bodil | dnolen: Nice :) |
| 13:47 | zilti | How do I turn the contents of an InputStream into a byte array? |
| 13:47 | dnolen | Bodil: let me know about noderepl when you get a chance |
| 13:47 | Bodil | dnolen: Will do. |
| 13:49 | craigbro | zilti: byte arrays don't really exist in clojure |
| 13:50 | craigbro | zilti: seems more like a java question |
| 13:52 | clojure-newb | hey 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:53 | clojure-newb | both passwords were hashed the same way |
| 13:53 | craigbro | zilti: you might actually find a useful solution here: |
| 13:55 | craigbro | http://stackoverflow.com/questions/7250229/reading-a-binary-file-into-a-single-byte-array-in-java |
| 13:55 | craigbro | the solution depends on the input stream a bit |
| 13:55 | craigbro | clojure-newb: I would open up bcrypt-credential-fn and see what data it is passing to Bcrypt.hashpw - and then work backwards |
| 13:55 | clojure-newb | craigbro: thx, I'll give it a go |
| 13:55 | tgoossens | dnolen: thanks |
| 13:55 | craigbro | if I was in emacs I would jump to source |
| 13:56 | craigbro | toggle read-ony if needed |
| 13:56 | craigbro | and then add in some prints |
| 13:56 | tgoossens | dnolen: you are elready the second person who sends me out of the tarpit. Better take a look at it :p |
| 13:56 | craigbro | eval the defn and try again... |
| 13:56 | clojure-newb | craigbro: I'm an emacs newb too though I'm trying to get started with emacs live |
| 13:56 | ieure | zilti: I use Apache commons-io's IOUtils class for this kind of stuff. Works fine. |
| 13:57 | craigbro | clojure-newb: ah, ok, not fmailiar with that distribution exactly, but I imagine you are using nrepl to connect to a running clojure process? |
| 13:57 | ieure | zilti: 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:57 | clojure-newb | yes |
| 13:57 | zilti | ieure, craigbro : Thanks! |
| 13:58 | craigbro | clojure-newb: ok, first, try this: M-x help m |
| 13:58 | craigbro | aka, get mode help |
| 13:58 | clojure-newb | ok will do |
| 13:58 | craigbro | do that when you are inside a buffer with clojure source code |
| 13:58 | craigbro | it'll tell you all the keymappings available |
| 13:58 | craigbro | useful stuff |
| 13:59 | craigbro | If you do M-. |
| 14:00 | craigbro | it jumps to the definition of the function your cursor is on |
| 14:00 | clojure-newb | nice |
| 14:00 | Bodil | dnolen: 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:02 | clojure-newb | craigbro: hmmm, I get .../TAGS is not a valid tags table.. but i'm not sure what that means |
| 14:04 | cemerick | dnolen: thanks for the commit; hope the ___repl_env thing wasn't too janky :-) |
| 14:09 | craigbro | clojure-newb: interesting, apparently you don't have clojure-mode or something |
| 14:09 | craigbro | clojure-newb: I don't know emacs live enough to help beyond that |
| 14:10 | clojure-newb | craigbro: no worries, I'll tinker with it,… sure I had it working before |
| 14:16 | clojure-newb | hmm, 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:16 | clojure-newb | sorry, this was using 'friend' |
| 14:17 | clojure-newb | its definitely the password value causing me problems, substituting it for one created in a map locally works |
| 14:17 | seangrove | Bodil: Couldn't you use protocols for some of the closure ui interop? |
| 14:17 | seangrove | The components have the same interface anyway |
| 14:17 | yedi | how do i know if paredit in emacs is active? (what does it actually do) |
| 14:18 | seangrove | yedi: If you type '(' then ')' automatically appears |
| 14:18 | seangrove | Same with [,{," |
| 14:18 | daimrod | yedi: C-h v paredit-mode RET t means it's active; you can also look at the mode-line. |
| 14:18 | Bodil | seangrove: I don't know, I'm not doing Closure UI interop. :) |
| 14:18 | seangrove | And you can't delete a single paren (i.e. they can never be unbalanced) |
| 14:18 | seangrove | Bodil: Heh, ok, just wondering if I had missed something |
| 14:19 | cemerick | clojure-newb: can you paste some code / stacktrace anywhere? |
| 14:19 | seangrove | Haven't used protocols yet, feels like shaky ground to start on, but I'll give it a go |
| 14:19 | clojure-newb | cemerick: sure.. one moment |
| 14:21 | Bodil | seangrove: For my purposes at least (subclassing Ace and Backbone) protocols won't help. |
| 14:21 | seangrove | Bodil: Why's that? |
| 14:21 | seangrove | Still wrapping my heads around them a bit |
| 14:22 | Bodil | seangrove: 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:23 | seangrove | Sure, but I was thinking about defining a protocol, deftyping it, constructing on, and then manually going goog.inherits(x, y) |
| 14:23 | clojure-newb | cemerick: stack trace is at : https://www.refheap.com/paste/8992, preparing code sample now... |
| 14:24 | Bodil | seangrove: Yeah, that sounds like it might work. |
| 14:26 | clojure-newb | cemerick: code is at https://www.refheap.com/paste/8993 |
| 14:26 | borkdude | maybe 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:27 | clojure-newb | cemerick: 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:28 | Frozenlock | Arg! 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:29 | seangrove | borkdude: Presumably the /../ looks like a filesystem path |
| 14:30 | skelternet | borkdude: is the leading slash a problem? |
| 14:30 | borkdude | skelternet yes |
| 14:30 | seangrove | I'd just look at the code for it |
| 14:30 | skelternet | borkdude: http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html |
| 14:30 | skelternet | I mean in the image tag. Maybe it should be [[./img/foo.jpg]] |
| 14:31 | cemerick | clojure-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:31 | skelternet | or [[img/foo.jpg]] |
| 14:31 | borkdude | skelternet so no absolute paths huh |
| 14:31 | borkdude | skelternet no, it should be /img in my case, because the images are not on the same level as the html (org originally) |
| 14:32 | clojure-newb | cemerick: doh! thanks for your help |
| 14:32 | dnolen | Bodil: it does care |
| 14:33 | dnolen | cemerick: np |
| 14:34 | skelternet | borkdude: the file /img/foo.jpg actually exists? |
| 14:34 | yedi | has anyone gotten nrepl.el to work with emacs prelude |
| 14:36 | borkdude | skelternet yes, http://localhost:4000/img/test.jpg returns the picture |
| 14:37 | skelternet | borkdude and I presume file:///img/test.jpg would also work through the file system |
| 14:37 | borkdude | skelternet no, the web server uses a specific dir as root dir |
| 14:38 | borkdude | skelternet it's just a jekyll website btw |
| 14:38 | skelternet | borkdude: hmm. odd. I suspect org-mode may do that for absolute paths. I'm not positive, though. |
| 14:38 | borkdude | skelternet yes, the docs say: no absolute path |
| 14:39 | skelternet | borkdude: I've been torn between writing my own using Dexy or looking at Jekyl. How has your experience with jekyl been? |
| 14:39 | borkdude | skelternet probably this guy here uses literal html for his images for this reason http://orgmode.org/worg/org-tutorials/org-jekyll.html |
| 14:41 | borkdude | skelternet to be honest, I didn't use jekyll that much, just copied someones repo from github and adapted some things, playing around |
| 14:41 | borkdude | skelternet I'm just looking for a way to use org-mode to set up a blog and this looked promising |
| 14:44 | skelternet | I was involved in something like 10-15 projects at my old job and org-mode was the only way to maintain sanity. |
| 14:45 | skelternet | I used to generate meeting notes from org-mode and run my task lists in it. |
| 14:46 | skelternet | Kept the files in version control. |
| 14:46 | skelternet | I'm down to 1 project now so I don't use it as much. Was useful, though. |
| 14:47 | skelternet | Meeting agendas and follow up notes exported to PDF and HTML and made available to the team. |
| 14:47 | borkdude | of course I can always use a relative path like this ../../../img/test.jpg |
| 14:48 | borkdude | but that's kind of ugly, I want the org-files not having to know about the structure of the jekyll site |
| 14:48 | skelternet | borkdude: yeah, but…sematically…is ../../.. meaningful? Wish we could define a variable root higher up in the org doc |
| 14:49 | skelternet | borkdude: would the web address be appropriate? [[http://myblog/images/foo.jpg]] ? |
| 14:50 | borkdude | skelternet could do that, but what if I change domains, etc.. nah |
| 14:50 | skelternet | borkdude: *nod* |
| 14:50 | skelternet | Family just arrived back home. I'm off to be dad. good luck. |
| 14:51 | Frozenlock | Does 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:57 | ivan | Frozenlock: I think you can make it generate a property renaming map |
| 14:58 | Frozenlock | ivan: 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:58 | ivan | why do you expect it to munge the main name SomeLibrary? |
| 14:58 | ivan | okay |
| 14:58 | Frozenlock | I expect it to NOT munge it :p |
| 14:59 | Frozenlock | I'll have to see with emezeske why the externs.js included in jar is not used... |
| 15:01 | ivaraasen | hm, Prismatic's Flop looks interesting |
| 15:02 | wilfredh | I want to (use foo) and catch when it doesn't work, but FileNotFoundException isn't in scope. |
| 15:02 | wilfredh | any suggestions where I can import it from? |
| 15:04 | wilfredh | ah, java.io.FileNotFoundException |
| 15:04 | wilfredh | that'll teach me for learning Clojure without knowing much Java :) |
| 15:06 | yedi | where would I be adding these lines? https://github.com/kingtim/nrepl.el#configuration |
| 15:06 | yedi | I should be putting it in nrepl.el right? |
| 15:07 | ivan | yedi: in your .emacs.d/init.el |
| 15:08 | yedi | ivan: ty |
| 15:09 | dabd | I'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:10 | dabd | i get (sort-by-rank-order '("KTo" "KQo" "AJo" "AQo" "AKo")) |
| 15:10 | dabd | ("AKo" "AQo" "KQo" "AJo" "KTo") |
| 15:10 | dabd | Any tips please? |
| 15:10 | Seba51 | I 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:12 | tomoj | dabd: 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:12 | ivan | Seba51: you can, if you exclude from clojure.core with a (:refer-clojure :exclude [assoc!]) |
| 15:12 | ivan | (haven't tried it though) |
| 15:12 | tomoj | oh, nevermind |
| 15:12 | ivan | that is, in your (ns |
| 15:12 | tomoj | I misread it, damn you cond |
| 15:13 | Seba51 | @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:13 | dabd | AKo = Ace King off suit KQs = King Queen suited |
| 15:14 | borkdude | I 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:14 | S11001001 | Seba51: yes, it's OK |
| 15:14 | dabd | tomoj: Is this you don't understand? |
| 15:14 | S11001001 | Seba51: It means you aren't supposed to just (:use the-lib), you're supposed to :require :as, or :use :only |
| 15:15 | S11001001 | ivan, Seba51: I missed part of conversation, sorry for repeat |
| 15:16 | Seba51 | Thanks 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:17 | tomoj | wow, I was going to say your comparator should return -1, 0, or 1 instead of booleans |
| 15:18 | tomoj | I used (sort > coll) before but didn't think about it |
| 15:19 | tomoj | &(= (sort compare [1 2 3]) (sort < [1 2 3])) |
| 15:19 | lazybot | ⇒ true |
| 15:21 | seangrove | hrm |
| 15:21 | seangrove | In 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:21 | yedi | what 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:22 | S11001001 | yedi: yes, but "repl has access" probably doesn't mean what you think |
| 15:22 | yedi | load into memory |
| 15:22 | tomoj | &(java.util.Collections/min [3 2 1] (comparator <)) |
| 15:22 | lazybot | ⇒ 1 |
| 15:23 | tomoj | &(java.util.Collections/min [3 2 1] <) |
| 15:23 | lazybot | ⇒ 1 |
| 15:23 | tomoj | (def comparator identity) |
| 15:23 | S11001001 | yedi: yes, it fits that |
| 15:23 | tomoj | except for (comparator a-map) or some crazy shit |
| 15:23 | yedi | in my emacs setup, running C-c C-l to load my file doesn't seem to work |
| 15:23 | S11001001 | yedi: what does "doesn't seem to work" mean? |
| 15:23 | ivaraasen | so, I just wrote my first macro, guys. |
| 15:23 | yedi | and I don't want to have to evaluate every form in the file by hand |
| 15:23 | seangrove | Doesn't seem to be in the namespace... |
| 15:24 | ivaraasen | it's ugly as hell, but it will do |
| 15:24 | yedi | CompilerException java.lang.RuntimeException: Unable to resolve symbol: rhyme-scheme in this context, compiling:(NO_SOURCE_PATH:1) |
| 15:24 | S11001001 | yedi: then by "repl has access" you don't mean anything about memory, you mean the environment of the repl |
| 15:24 | seangrove | Ah, on the object iself |
| 15:24 | S11001001 | yedi: the repl starts in ns user |
| 15:24 | S11001001 | yedi: your code is in some other ns, whatever you declared it as |
| 15:25 | S11001001 | yedi: loading a file *only* loads it, it doesn't mess with the ns your repl is in |
| 15:25 | S11001001 | yedi: you can use nrepl-set-ns when in a file to switch your repl to the file's ns |
| 15:25 | yedi | ah, i see |
| 15:25 | Frozenlock | ivaraasen: Was it _really_ necessary? |
| 15:25 | S11001001 | yedi: or you can type out the commands in the repl for changing namespaces, loading your namespace into user, etc |
| 15:26 | ivaraasen | Frozenlock: well, I was trying to implement an interface somewhat similar to Flop, so, yes |
| 15:26 | xeqi | yedi, S11001001: C-c M-n will change the namespace to the current buffer |
| 15:28 | tomoj | apparently Comparator is the reason AFunction exists |
| 15:29 | S11001001 | yedi: 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:29 | S11001001 | xeqi: I always forget that binding :] |
| 15:30 | seangrove | Goddamn, I don't understand deftype in cljs |
| 15:30 | yedi | S11001001, xeqi: thanks a lot, i'm still having trouble getting the hang of emacs esp in conjunction with learning clojure |
| 15:31 | S11001001 | Emacs for life |
| 15:31 | Frozenlock | ^ |
| 15:31 | tomoj | emacs for now |
| 15:31 | seangrove | What is the this inside of the functions generated by deftype? |
| 15:32 | tomoj | maybe you're older than me, but I hope to use something much better before I die :) |
| 15:32 | Frozenlock | tomoj: emacs with some kind of graphical support? |
| 15:33 | tomoj | heh |
| 15:34 | tomoj | seangrove: inside? |
| 15:34 | ChongLi | ahh this is funny |
| 15:34 | tomoj | inside should just be the code you wrote |
| 15:34 | ChongLi | functional programming in C |
| 15:34 | ChongLi | list * |
| 15:34 | ChongLi | map(list *l, void *(*fn)(void *, void *), void *args) |
| 15:34 | seangrove | tomoj: One second... |
| 15:35 | S11001001 | tomoj: I assume the much better thing will simply be an enhanced emacs :) |
| 15:35 | Frozenlock | emacs with namespace would be nice |
| 15:35 | S11001001 | faketional programming |
| 15:35 | gfredericks | seangrove: the first argument to any deftype function is this |
| 15:36 | gfredericks | you can call it `this` or anything else |
| 15:36 | ChongLi | basically shotting off the type system at this point |
| 15:36 | seangrove | https://www.refheap.com/paste/8994 |
| 15:36 | ChongLi | if you're only using void pointers |
| 15:36 | tomoj | oh, "the this" |
| 15:36 | seangrove | I see that self__ = this, stats_control = this |
| 15:36 | Frozenlock | Not knowing JS, could someone briefly explain what it 'this'? |
| 15:37 | ChongLi | Frozenlock: briefly? |
| 15:37 | Frozenlock | s/it/is |
| 15:37 | seangrove | Not 100% clear on how the 'this' is getting assigned |
| 15:37 | ChongLi | javascript has late binding |
| 15:37 | gfredericks | Frozenlock: it's a magical -1th argument to every function |
| 15:37 | ChongLi | so 'this' is set at call time |
| 15:38 | ChongLi | 'this' is not lexically scoped |
| 15:38 | ivan | it is the most evil thing :( |
| 15:38 | gfredericks | ivan: but but! object orientation! |
| 15:38 | gfredericks | right!? |
| 15:38 | ChongLi | no |
| 15:38 | clojurebot | flatten |is| rarely the right answer. What if your "base type" is a list |
| 15:38 | ChongLi | other OO languages handle 'this' properly |
| 15:38 | Bodil | seangrove: OK, I managed to make Pylon work with advanced optimisations, making a release now. :) |
| 15:38 | Frozenlock | ChongLi: So you don't know what it will be in advance? |
| 15:38 | seangrove | Bodil: Ah, ok, thank you so much |
| 15:38 | ChongLi | Frozenlock: right |
| 15:39 | seangrove | This is such a horrid nightmare |
| 15:39 | gfredericks | Frozenlock: you can be pretty sure if you're doing things normally though |
| 15:39 | ChongLi | best practice is to assign something else to this and then pass that in |
| 15:39 | gfredericks | it's not like it's randomly selected by the runtime or anything |
| 15:39 | ChongLi | afaik |
| 15:40 | gfredericks | it's only mildly different from if it were just an explicit first argument |
| 15:40 | seangrove | Frozenlock: 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:40 | gfredericks | an first argument that you had to name `this` so that it shadowed any outer occurrences :) |
| 15:40 | ChongLi | javascript is such a strange language |
| 15:41 | ivan | http://ecma262-5.com/ELS5_HTML.htm#Section_10.4.3 |
| 15:41 | ChongLi | I mean, it has lexical closures right there! |
| 15:41 | ivan | my favorite step is "Else if thisArg is null or undefined, set the ThisBinding to the global object." |
| 15:42 | ChongLi | yeah |
| 15:42 | ChongLi | so if you screw up your invocation of a constructor you risk trashing the global object |
| 15:42 | Frozenlock | So 'this' can never be null? Weird first argument :P |
| 15:43 | gfredericks | oh I didn't realize that |
| 15:43 | gfredericks | at least in the case of f.call(null) |
| 15:43 | ChongLi | javascript has all kinds of "helpful" stuff going on |
| 15:44 | gfredericks | so for CLJS golf, maybe js/this is a shortcut for js/window |
| 15:44 | ChongLi | like null == undefined |
| 15:44 | ChongLi | for example |
| 15:44 | gfredericks | ChongLi: 0 == [] I think |
| 15:44 | ChongLi | oh it's even worse than that |
| 15:45 | ChongLi | "0" == false |
| 15:45 | gfredericks | oh nevermind js/this doesn't work |
| 15:45 | gfredericks | ChongLi: holy cow |
| 15:46 | ChongLi | another fun one is to write a function which counts the occurrences of words in a string |
| 15:46 | Frozenlock | ChongLi: wait, the string zero is false? |
| 15:46 | ChongLi | yeah |
| 15:46 | Frozenlock | *mind blown* |
| 15:46 | gfredericks | Frozenlock: it must helpfully convert it to a number first |
| 15:47 | ChongLi | javascript implicitly coerces the types on both sides of the expression until they're comparable |
| 15:47 | gfredericks | despite the fact that you're not even comparing it to a number |
| 15:47 | ChongLi | so "0" will get turned to 0 |
| 15:47 | ivan | "-0" == false :) |
| 15:47 | gfredericks | ChongLi: how does that help comparing to a boolean though? |
| 15:47 | ChongLi | 0 in js is false |
| 15:47 | gfredericks | yes I know |
| 15:48 | ChongLi | as is -0 |
| 15:48 | gfredericks | but strings are generally true excepting "" |
| 15:48 | gfredericks | so the fact that the string contains a number seems irrelevant when comparing to a boolean |
| 15:48 | Frozenlock | what about "false" == false |
| 15:48 | ChongLi | no, that's false |
| 15:48 | gfredericks | I'm just saying this makes one chunk less sense than "0" == 0 |
| 15:49 | seangrove | Bodil: Let me know when you've pushed the new release |
| 15:49 | ChongLi | it'll keep trying until it lines up the types to do a comparison |
| 15:49 | gfredericks | I'll stop trying to make sense of it |
| 15:49 | ChongLi | this is how all operators in javascript work (except for the reference ones) |
| 15:50 | ChongLi | === is reference equality |
| 15:50 | ChongLi | aka pointer equality |
| 15:50 | ChongLi | so that'll pretty much always work |
| 15:50 | ChongLi | except when you have two objects that are equal but not the same |
| 15:50 | ChongLi | that's pretty rare though |
| 15:51 | gfredericks | I'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:51 | gfredericks | "This string is not empty, thus it is == true" |
| 15:52 | ChongLi | it basically converts both to a number |
| 15:52 | ChongLi | false gets converted to 0 |
| 15:52 | dabd | why does sort accepts both (comparator some-pred) and some-pred as the comparator argument? |
| 15:53 | ChongLi | dabd: hmm? |
| 15:53 | dabd | obv some-pred does not implement the java.util.Comparator interface so I don't understand how it works |
| 15:53 | gfredericks | ChongLi: that would lead me to expect "foo" == 7 |
| 15:53 | dabd | ,(sort < [5 3 1 7]) |
| 15:53 | clojurebot | (1 3 5 7) |
| 15:53 | ChongLi | no |
| 15:54 | dabd | ,(sort (comparator <) [5 3 1 7]) |
| 15:54 | clojurebot | (1 3 5 7) |
| 15:54 | ChongLi | "foo" gets parsed as NaN |
| 15:54 | dabd | both work |
| 15:54 | gfredericks | ChongLi: oh right; I retract previous statement |
| 15:55 | ChongLi | comparator is useful with java.util.Collections/sort |
| 15:55 | ChongLi | dabd: does that help? |
| 15:55 | ChongLi | here's the other interesting thing |
| 15:56 | ChongLi | in order to make sure "foo" == "bar" returns false (and some other things) |
| 15:56 | ChongLi | NaN == NaN always returns false |
| 15:56 | gfredericks | well that implies "foo" == "foo" returns false |
| 15:56 | ChongLi | oh good point |
| 15:57 | ChongLi | but NaN == NaN does return false |
| 15:57 | ChongLi | which is bizarre |
| 15:57 | gfredericks | is NaN in the floating point spec? |
| 15:57 | ChongLi | yeah |
| 15:57 | dabd | it 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:57 | gfredericks | do they say anything about NaN == NaN |
| 15:58 | ChongLi | dabd: clojure.core/sort accepts any predicate |
| 15:58 | ChongLi | java.util.Collections/sort requires that the predicate be an implementation of java.util.Comparator |
| 15:59 | ChongLi | dabd: why would clojure.core/sort be written to have a limitation of java when it doesn't have to? |
| 16:00 | Frozenlock | Is it possible to "(set! (.-onload js/window) some-fn)" multiple time, or will it erase any previous functions? |
| 16:00 | gfredericks | ,(doc sort) |
| 16:00 | clojurebot | "([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:00 | gfredericks | ChongLi: I think he's asking why the docs say otherwise |
| 16:00 | ChongLi | hmm let me see |
| 16:01 | dabd | I'm looking at the sort implementation for explanations :-) |
| 16:01 | gfredericks | ,(instance? java.util.Comparator <) |
| 16:01 | clojurebot | true |
| 16:01 | gfredericks | ^ that's probably part of it |
| 16:01 | ChongLi | ah so there you go |
| 16:01 | gfredericks | I suspect the docs are accurate as the type hint is there |
| 16:01 | dabd | aha |
| 16:01 | dabd | thanks gfredericks |
| 16:01 | gfredericks | ,(sort #(< %1 %2) [1 2 3 4]) |
| 16:01 | clojurebot | (1 2 3 4) |
| 16:02 | S11001001 | &(instance? java.util.Comparator (fn [] 42)) |
| 16:02 | lazybot | ⇒ true |
| 16:02 | ChongLi | so there you go |
| 16:02 | gfredericks | ,(instance? java.util.Comparator fn?) |
| 16:02 | clojurebot | true |
| 16:02 | gfredericks | welp. |
| 16:02 | gfredericks | that's interesting. |
| 16:02 | ChongLi | all clojure functions automatically implement it |
| 16:02 | gfredericks | ,(instance? java.util.Comparator {}) |
| 16:02 | clojurebot | false |
| 16:02 | gfredericks | ,(parents clojure.lang.Fn) |
| 16:02 | clojurebot | nil |
| 16:02 | gfredericks | ,(supers clojure.lang.Fn) |
| 16:02 | clojurebot | nil |
| 16:02 | ChongLi | ,(instance? java.util.Comparator #{}) |
| 16:02 | clojurebot | false |
| 16:02 | ChongLi | hmmm |
| 16:03 | ChongLi | oh right |
| 16:03 | gfredericks | oh Fn is an interface |
| 16:03 | gfredericks | what the heck |
| 16:03 | ChongLi | a comparator is not a normal predicate |
| 16:03 | gfredericks | ,(supers (class (fn [] 42))) |
| 16:03 | dabd | the implementation shows (. java.util.Arrays (sort a comp)) |
| 16:03 | clojurebot | #{java.lang.Runnable clojure.lang.Fn java.io.Serializable java.util.concurrent.Callable java.util.Comparator ...} |
| 16:03 | dabd | what sort is being called in (sort a comp)? |
| 16:04 | ChongLi | it returns -1 0 1 I believe |
| 16:04 | ChongLi | ,((comparator >) 3 2) |
| 16:05 | clojurebot | -1 |
| 16:05 | tomoj | &(.compare (fn [x y] (< x y)) 3 2) |
| 16:05 | lazybot | ⇒ 1 |
| 16:05 | ChongLi | ,((comparator >) 2 3) |
| 16:05 | clojurebot | 1 |
| 16:05 | ChongLi | yeah there you go |
| 16:05 | tomoj | this is what I was talking about earlier |
| 16:05 | ChongLi | dabd: does that clear it up for you? |
| 16:05 | tomoj | on AFunctions, comparator is identity |
| 16:06 | tomoj | https://github.com/clojure/clojure/blob/a5f786a847a202e78048dae8fdf15a7e8748dd3d/src/jvm/clojure/lang/AFunction.java#L46 |
| 16:07 | tomoj | (well, comparator isn't really identity of course - only as far as .compare is concerned) |
| 16:07 | tomoj | oops, ##(.compare < 2 3) |
| 16:07 | lazybot | ⇒ -1 |
| 16:13 | ohpauleez | For those interested in the Leap Motion: http://www.pauldee.org/ClojureLeapMouse.mov |
| 16:13 | ohpauleez | 30 second teaser of mousing using Leap and Clojure |
| 16:14 | ohpauleez | the API/Library, clojure-leap, has gesture recognition. In that example I use a gesture to toggle the Leap on and off |
| 16:15 | ohpauleez | For all coming to Clojure/West, you're welcome to play with it :) |
| 16:15 | seangrove | ohpauleez: Looks awesome! |
| 16:16 | ohpauleez | seangrove: Thanks! |
| 16:16 | ohpauleez | That was all possible in about two days worth of work. Gotta love Clojure |
| 16:16 | tomoj | ohpauleez: sweet |
| 16:16 | seangrove | Looking up leap motion now... |
| 16:18 | ohpauleez | tomoj: Playing with it on the repl is a blast |
| 16:18 | tomoj | so you need some special driver I guess? |
| 16:19 | seangrove | ohpauleez: how'd you get one? Looks like they're still pre-order |
| 16:20 | ohpauleez | it's just a USB device + generic driver |
| 16:20 | TimMc | seangrove: Just coming into the conversation, I couldn't figure out how tree traversal algorithms were related to this. :-P |
| 16:20 | ohpauleez | seangrove: developer program |
| 16:22 | ChongLi | man what's up with vlc? |
| 16:22 | ChongLi | I pause your video |
| 16:22 | ChongLi | and then when I restart it it plays a few seconds and then kicks out of full screen and stops the video |
| 16:23 | Raynes | ohpauleez: Give me your leap motion thingy. |
| 16:23 | ohpauleez | haha |
| 16:23 | Raynes | I want it. |
| 16:23 | Raynes | It's unfair that I don't have mine yet. |
| 16:23 | ohpauleez | Also, that code example is 38 lines of code |
| 16:24 | seangrove | ohpauleez: Do you have any specific use-case for it in mind? |
| 16:25 | ohpauleez | seangrove: I'm creating a 3D equivalent of the the FingerWorks TouchStream experience |
| 16:25 | ohpauleez | Adaptive keyboard, mousing, macro'd gestures |
| 16:25 | ohpauleez | etc |
| 16:26 | ohpauleez | technomancy: sick! |
| 16:26 | technomancy | it's interesting. completely useless for typing, but fun for games and stuff. |
| 16:26 | technomancy | I'd probably use it if I actually did design work or something. |
| 16:26 | Raynes | <3 das |
| 16:26 | ohpauleez | it's interesting, doing the adaptive typing for the Leap has been super hard as well |
| 16:26 | ChongLi | das keyboard? |
| 16:27 | ChongLi | I've got a filco |
| 16:27 | ivaraasen | I've got a ThinkPad |
| 16:27 | seangrove | ohpauleez: ... as a kind of 3d keyboard? |
| 16:27 | ChongLi | since getting used to a filco I find rubber-dome keyboards intolerable! |
| 16:27 | technomancy | I 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:27 | tomoj | "perfectly smooth surface" re touchstream |
| 16:27 | tomoj | hopefully it does have imperfections? |
| 16:28 | tomoj | ..preferably on 'f' and 'j' ? |
| 16:28 | technomancy | not that I would have ever forgiven them for killing hypercard, mind you. |
| 16:28 | Apage43 | ChongLi: Heh, I've taken mine to work |
| 16:28 | ohpauleez | seangrove: 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:28 | Raynes | ChongLi: Yeah, das. |
| 16:28 | Apage43 | the clacking reverberates throughout the office |
| 16:28 | ChongLi | I'd have gotten a das if they offered a tenkeyless one |
| 16:28 | seangrove | ohpauleez: Crazy, that would be amazing |
| 16:28 | Raynes | ChongLi: I use it and my macbook pro's keyboard. I find the macbook's keyboard surprisingly tolerable. |
| 16:29 | ChongLi | I'm all about the tenkeyless |
| 16:29 | ChongLi | I don't know anyone who does extensive work on a numeric keypad |
| 16:30 | Apage43 | ChongLi: *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:30 | Raynes | I prefer having a numpad. |
| 16:30 | Raynes | I mean, I wish it were smaller, but when I do need it I'm happy it is there |
| 16:30 | ohpauleez | Raynes: For when you're adding up all your fat stacks of cash? |
| 16:31 | ChongLi | I find the numpad forces my arms too far apart |
| 16:31 | Raynes | Yeah, man. |
| 16:31 | ivaraasen | I tried doing stuff with Emacspeak once. it was ... interesting. |
| 16:31 | ohpauleez | But for real, I live just a couple of blocks from the venue of Clojure/West |
| 16:31 | ohpauleez | happy to let people play around with the Leap Motion |
| 16:31 | Raynes | I 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:31 | ivaraasen | ohpauleez: too lucky, man |
| 16:32 | technomancy | hmm... maybe I can unload my touchstream at clojurewest if there's interest in gesturey stuff =) |
| 16:32 | ChongLi | Raynes: at least it's not a unicomp |
| 16:32 | ChongLi | I'm tempted to get one of those |
| 16:32 | ChongLi | I wish they'd make a tenkeyless! |
| 16:32 | ohpauleez | technomancy: I'm always looking for well-maintained TouchStreams |
| 16:32 | ChongLi | from what I've heard unicomp has fallen a bit on hard times |
| 16:33 | ohpauleez | Raynes: Where are you starting to work? |
| 16:33 | ChongLi | people only ever need one of their keyboards |
| 16:33 | ChongLi | the buckling springs are too durable! |
| 16:33 | Raynes | ohpauleez: Finally moving to LA to work full time at Geni/MyHeritage. |
| 16:33 | ohpauleez | cool |
| 16:33 | ohpauleez | congrats! |
| 16:33 | technomancy | ohpauleez: mine is actually a digitouch, one of the ones originally designed for internal use on 2004-era macbooks but put in a case. |
| 16:33 | ChongLi | that sounds pretty exciting |
| 16:33 | ChongLi | do they use clojail? |
| 16:34 | ChongLi | I love that talk btw |
| 16:34 | Raynes | Well, we use lazybot which uses clojail. |
| 16:34 | Raynes | So I guess you could say that. |
| 16:34 | Raynes | I've been working for them for 2 years as an intern. |
| 16:34 | Raynes | Remotely. |
| 16:34 | Raynes | Also, thanks. |
| 16:35 | technomancy | are you going to level up to non-intern-ness? |
| 16:35 | Raynes | That talk is unfortunately entirely inaccurate now. I've rewritten half of the thing since then. |
| 16:35 | ChongLi | you nailed one of the most important aspects of giving a good talk: use humor |
| 16:35 | bbloom | ,(into {} (map vec (partition 2 [:a 1 :b 2]))) |
| 16:35 | clojurebot | {:a 1, :b 2} |
| 16:35 | bbloom | ,(into {} (partition 2 [:a 1 :b 2])) |
| 16:35 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry> |
| 16:35 | bbloom | i know i can do: |
| 16:35 | bbloom | ,(apply hash-map [:a 1 :b 2]) |
| 16:35 | clojurebot | {:a 1, :b 2} |
| 16:35 | bbloom | but what if i have a record type i want to into with a sequence of key vals? something like: |
| 16:35 | Raynes | technomancy: Yes, this is is a full time non-intern stealing-you-old-timer's-jobs position. |
| 16:35 | technomancy | nice |
| 16:35 | Apage43 | i once leveled up to non-internness |
| 16:35 | Apage43 | it was okay |
| 16:36 | hiredman | ,(conj {} '(:a 1)) |
| 16:36 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry> |
| 16:36 | bbloom | (into (Foo. 1 2) [:x 3 :y 4]) |
| 16:36 | ChongLi | pretty soon you'll be partying in hollywood |
| 16:36 | hiredman | ,(conj {} [:a 1]) |
| 16:36 | clojurebot | {:a 1} |
| 16:36 | Raynes | I'm reaching non-intern level 4. It's like Super Saiyan 3, but with better salary. |
| 16:36 | bbloom | hiredman: yup, so i don't have an empty {}, i have a record with stuff in it |
| 16:36 | bbloom | hiredman: what's the best way to poor a sequence into there |
| 16:37 | hiredman | reduce |
| 16:37 | technomancy | Raynes: word of advice: pick the longsword proficiency |
| 16:37 | ChongLi | I think everybody knows that |
| 16:37 | ChongLi | longswords are the best! |
| 16:37 | Raynes | Really? I was hoping for archery. |
| 16:37 | bbloom | s/poor/pour |
| 16:37 | bbloom | hiredman: reduce assoc? |
| 16:38 | gfredericks | into uses transients |
| 16:38 | bbloom | hiredman: with the partition 2 in there, then it needs to destructure too, seems relatively inefficient |
| 16:38 | seangrove | Didn't realize technomancy was an old-timer |
| 16:39 | bbloom | gfredericks: yeah, i'm looking for the most idiomatic way to pour a sequence into a record efficiently |
| 16:39 | gfredericks | bbloom: oh I guess records can't transient? |
| 16:40 | ChongLi | anyone here read the reasoned schemer? |
| 16:40 | ChongLi | (I assume some have) |
| 16:40 | bbloom | gfredericks: apparently not. into checks instance? IEditableCollection |
| 16:40 | bbloom | records do not appear to be editable collections |
| 16:40 | bbloom | which kinda sucks |
| 16:41 | hiredman | gfredericks: 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:41 | josteink | technomancy: congrats on the lein 2 release! |
| 16:41 | bbloom | ,(reduce (partial apply assoc) {} (partition 2 [:a 1 :b 2])) |
| 16:41 | clojurebot | {:b 2, :a 1} |
| 16:42 | technomancy | josteink: thanks! |
| 16:42 | josteink | I saw someone on HN refer to leiningen as such a fantastic tool, that it alone was worth learning clojure for ;) |
| 16:42 | josteink | (in case you missed it) |
| 16:42 | tomoj | bbloom: records don't need to be editable, do they? |
| 16:42 | josteink | its really very, very good |
| 16:42 | ChongLi | josteink: yeah I saw (and mentioned) the same thing |
| 16:42 | josteink | so a happy weekend to you :) |
| 16:42 | tomoj | I guess it could help |
| 16:42 | hiredman | bbloom: I would be surprised if papply is more efficient then destructuring |
| 16:43 | bbloom | hiredman: oh yeah, clearly gonna be a wash, i'm just trying to figure out what to do exactly |
| 16:43 | bbloom | tomoj: one of the main reasons for records is performance, is it not? |
| 16:43 | ChongLi | performance and polymorphism |
| 16:44 | bbloom | ChongLi: right |
| 16:44 | bbloom | ,(->> [:a 1 :b 2] (partition 2) (map vec)) |
| 16:44 | clojurebot | ([:a 1] [:b 2]) |
| 16:44 | hiredman | they cannot support O(1) transition from from persistent to transient |
| 16:44 | hiredman | records don't have the tree structure required for it, exactly for performance |
| 16:45 | tomoj | well O(k) where k is number of fields? |
| 16:45 | ivaraasen | wow, primitives are way faster than I initially suspected |
| 16:45 | tomoj | I mean the extmap is editable, right? |
| 16:46 | tomoj | but I guess that's only useful if you're stuffing a whole bunch of ext keys in |
| 16:47 | bbloom | hiredman: the number of defined fields is a constant, so it's technically O(1) to copy them all |
| 16:47 | Raynes | drewr: 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:48 | bbloom | hiredman: 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:48 | bbloom | anyway, i'm going with map vec for now |
| 17:01 | tomoj | "the" android terminal emulator? |
| 17:02 | josteink | the AOSP one, or one shipped with AOSP roms |
| 17:02 | josteink | or AOSP-based ones like CM |
| 17:02 | josteink | on a machine with a good keybord dock, like the asus transformer, the terminal emulator makes for a good hacking space |
| 17:02 | josteink | on a machine with 16 hours battery life ;) |
| 17:07 | ivaraasen | josteink: oh what I would give for decent battery life |
| 17:08 | josteink | I tried using my actual laptop earlier today, from the couch. lasted me less than 2 hours |
| 17:08 | josteink | thats just not good enough |
| 17:11 | ivaraasen | josteink: I've got about five hours. considering adding a slice battery for long hikes |
| 17:11 | tgoossens | Out of the tarpit. I've been hearing about it a few times now. Someone read it here? |
| 17:11 | hyPiRion | tgoossens: yes |
| 17:11 | ivaraasen | tgoossens: yeah, it's a pretty good read. |
| 17:11 | ChongLi | it's not that long either |
| 17:12 | tgoossens | i'm searching some reading material for while travelling (and next semester) |
| 17:12 | warz | if 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:13 | ivaraasen | hyPiRion: woho, just finished some macros inspired by Flop. it's pretty nice to use primitives without all the clutter. |
| 17:13 | tgoossens | currently i'm reading the pragmatic programmer, interesting book |
| 17:13 | ChongLi | tgoossens: what's your list so far? |
| 17:13 | josteink | tgoossens: it has very good ideas. the hard part is picking them up and actually taking them seriously. translating them into action. |
| 17:13 | tgoossens | josteink: that's always the tricky part |
| 17:14 | tgoossens | let me see what do i have in my library |
| 17:14 | josteink | tgoossens: some ideas are more seductive than others ;) |
| 17:14 | tgoossens | seven programming languages in seven weeks (not really useful while travelling i think) |
| 17:14 | josteink | tgoossens: TPP's ideas tend to leave you with (what seems like) more work ;P |
| 17:15 | tgoossens | josteink: i'm at page 40, so still lot to read :) |
| 17:15 | hyPiRion | ivaraasen: Sounds useful, link? |
| 17:15 | ChongLi | paul graham's on lisp is pretty nice |
| 17:15 | ivaraasen | hyPiRion: they support bindings, so finding the dot product is as simple as (asum [x xs y ys] (* x y) |
| 17:15 | tgoossens | Functional programming for the OO programmer (by marick) |
| 17:16 | tgoossens | and "how to so solve it" |
| 17:16 | ivaraasen | hyPiRion: Flop isn't released yet I'm afraid. but it's probably going to be quite nice. |
| 17:16 | tgoossens | but i think tarpit & pragmatic programmer is enought for the coming weeks :p |
| 17:17 | hyPiRion | ivaraasen: I was thinking about your macros :) |
| 17:17 | tgoossens | fun fact: i never read programming books before until I came into contact with the clojure community. |
| 17:17 | tgoossens | Its almost unavoidable |
| 17:17 | tgoossens | everytime I watch a talk |
| 17:17 | tgoossens | "you should read/buy this book at amazon" :p |
| 17:18 | ChongLi | tgoossens: yeah same here pretty much |
| 17:18 | ChongLi | when I started with haskell (before clojure) I mainly read academic papers |
| 17:18 | ChongLi | many of which were very hard to follow |
| 17:19 | tgoossens | never read papers really |
| 17:19 | ivaraasen | hyPiRion: oh, gimme a sec |
| 17:19 | ChongLi | a lot of them used denotational semantics |
| 17:19 | josteink | ChongLi: Ive tried to complete SICP (but its pretty damn long :P ), and found it very englightening so far |
| 17:19 | ChongLi | which I have yet to learn |
| 17:19 | josteink | ChongLi: how does PG's book relate to that? |
| 17:19 | ChongLi | yeah SICP is great |
| 17:20 | josteink | is it trying to sell me lisp, or is it trying to teach lispers something new? |
| 17:20 | ChongLi | on lisp is basically all about macros |
| 17:20 | josteink | hm ok. sounds nice. |
| 17:20 | ChongLi | it was the first book to really dive in and give tons of example macros |
| 17:20 | tgoossens | so far, reading TPP has been really confronting |
| 17:21 | ChongLi | some of the macros in PG's book are pretty hard to follow |
| 17:21 | josteink | tgoossens: the first thing TPP tought me was that Im not really such a good programmer as I tend to think I am :P |
| 17:21 | ChongLi | but I suspect that's due to bad formatting on my kindle |
| 17:21 | tgoossens | josteink: exactly |
| 17:21 | josteink | ChongLi: Ive had the same issue with other programming books on the kindle |
| 17:21 | ChongLi | hard wrapping can screw up indentation and really make code a chore to read |
| 17:21 | josteink | mhm |
| 17:22 | ChongLi | SICP's ebook version is well formatted though |
| 17:23 | tgoossens | josteink: with me. It invoked a sudden change in direction. My idea has always been to go and study software engineering |
| 17:23 | tgoossens | but suddenly i realised |
| 17:23 | tgoossens | that might not be the best choice for me |
| 17:23 | ivaraasen | hyPiRion: https://www.refheap.com/paste/c3b278e7697715aa8b5ff9b19 |
| 17:24 | ChongLi | from what I've seen a lot of schools tend to just churn out java CRUD programmers |
| 17:24 | tgoossens | because |
| 17:24 | tgoossens | I have gotten the impression that I am going to waste my time |
| 17:24 | tgoossens | for a large part |
| 17:24 | josteink | ChongLi: I did Electrical engineering, and just graduated when the industry had token a complete nosedive |
| 17:25 | ChongLi | if you can take a course that still teaches SICP it'd be worth it |
| 17:25 | josteink | ChongLi: for every job I applied, tehre were 100 experienced engineers who had just gotten downsized |
| 17:25 | tgoossens | this is what i'm heading for now |
| 17:25 | tgoossens | http://onderwijsaanbod.kuleuven.be/opleidingen/v/e/SC_51016867.htm#bl=01 |
| 17:25 | ChongLi | josteink: that's awful |
| 17:25 | josteink | I stood no chance getting a job. So my childhood hobby of programming it was :P |
| 17:25 | josteink | could have been worse :) |
| 17:25 | tgoossens | josteink: programming has always been my hobby |
| 17:25 | tgoossens | and suddenly i realised |
| 17:25 | tgoossens | it should stay that way |
| 17:26 | tgoossens | at least while i'm at college |
| 17:26 | josteink | yeah thaht was my idea as well |
| 17:26 | tgoossens | I have no interest in being pushed in some |
| 17:26 | tgoossens | direction |
| 17:26 | clojurebot | I don't understand. |
| 17:26 | josteink | didnt quite work out that well :P |
| 17:26 | tgoossens | being oblligated |
| 17:26 | tgoossens | to work on certain concepts |
| 17:26 | tgoossens | i want to keep exploring on my own |
| 17:26 | tgoossens | in my case |
| 17:26 | tgoossens | my whole master revolves around OO |
| 17:26 | tgoossens | and I am not willing to cope with that |
| 17:27 | tgoossens | long story short |
| 17:27 | tgoossens | I realized that what i would be learning is |
| 17:27 | hyPiRion | ivaraasen: thanks! |
| 17:27 | tgoossens | 1) when i graduate it is old knowledge. |
| 17:27 | josteink | ah well. a degree CAN be a career-opener. |
| 17:28 | tgoossens | 2) is not something i cannot learn on my own (for the most part) |
| 17:28 | josteink | most jobs wants/expects some sort of papers ;) |
| 17:28 | ChongLi | don't disparage old knowledge |
| 17:28 | tgoossens | chongli:i don't |
| 17:28 | ChongLi | most people still haven't realized the powerful stuff you'll find in stuff like SICP and On Lisp |
| 17:28 | josteink | they have gotten me jobs though ;) |
| 17:28 | tomoj | hmm, wikipedia says SSA is a well-behaved subset of CPS which "excludes non-local control". are promises that too? |
| 17:29 | tgoossens | its just |
| 17:29 | tgoossens | i know a lot of people (even some working at google now) |
| 17:29 | tgoossens | that never even studied software engineering |
| 17:29 | josteink | sure |
| 17:29 | josteink | but dont trick yourself into thinking the exception is the rule |
| 17:29 | tgoossens | hmmyes |
| 17:30 | josteink | while you are discussing reasons to NOT get a degree |
| 17:30 | josteink | Im a practicing professional |
| 17:30 | tgoossens | i AM going to get a degree |
| 17:30 | tgoossens | but in a different profession :p |
| 17:30 | tgoossens | *master |
| 17:30 | josteink | which never got an (IT) degree, who wish he had ;) |
| 17:30 | tgoossens | hmm |
| 17:30 | tgoossens | i have 6 months stillb |
| 17:30 | josteink | there is some theoretical background Id really like to have, which Ill never have the time to read up on now |
| 17:31 | tgoossens | before i have to choose |
| 17:31 | devn | universities work with private businesses |
| 17:31 | tgoossens | its only been a few days that |
| 17:31 | tgoossens | this idea has been going through my heaf |
| 17:31 | tgoossens | *head |
| 17:31 | josteink | but lets flip perspective slightly |
| 17:31 | josteink | you live in the US, right? |
| 17:31 | tgoossens | belgium |
| 17:31 | ivaraasen | hyPiRion: it was a fun exercise. hopefully it'll be useful for some numerics stuff I'm planning on doing in Clojure |
| 17:31 | josteink | ok. same deal. western world |
| 17:32 | josteink | why would you invest your future in something which everyone will outsource to india in 10 years? :P |
| 17:32 | tgoossens | simple |
| 17:33 | tgoossens | its ME who is going to send it TO india then ;) :p |
| 17:33 | tgoossens | but no |
| 17:33 | tgoossens | i'm not really into that |
| 17:33 | tgoossens | idea |
| 17:33 | tgoossens | outsourcing can be great |
| 17:33 | tgoossens | for cost |
| 17:33 | devn | just don't be outsourceable and you don't have a problem. |
| 17:34 | devn | it's a choice you have throughout any career in nearly any field |
| 17:34 | josteink | It was a tongue-in-cheek remark |
| 17:34 | josteink | but still |
| 17:34 | josteink | looking at the IT world today, compared to 10 years ago.... lots of skills I had is now either obsolete or priced obscenely low |
| 17:35 | hyPiRion | ivaraasen: Yeah, I find math in Clojure to be rather slow without those tricks, so those were handy. |
| 17:35 | tgoossens | josteink: the thing i'm considering studying now is. Numerical models for scientific purposes |
| 17:35 | josteink | Im 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:36 | tgoossens | and simulations |
| 17:36 | ivaraasen | hyPiRion: yeah. I tried doing some geomechanics stuff. probably should've used matrices anyway, but still, way too slow |
| 17:37 | tgoossens | oh well |
| 17:37 | tgoossens | just dreaming and thinking |
| 17:37 | tgoossens | still got time to think and choose |
| 17:37 | tgoossens | and change opinions |
| 17:37 | tgoossens | its a good thing i'm actively thinking about it though |
| 17:38 | seangrove | Bodil: Are you able to work in the repl with pylon, when building up classes with them? |
| 17:38 | seangrove | Seems to be breaking with chrome as the eval env |
| 17:38 | tgoossens | i better go to bed now. Still have to study for my exam :) |
| 17:39 | hyPiRion | ivaraasen: 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:39 | Bodil | seangrove: Only tried with Node, but that should work. |
| 17:40 | ivaraasen | hyPiRion: that would be awesome. I'm rooting for core.matrix myself |
| 17:42 | hyPiRion | ivaraasen: Oh yeah, I saw it on the Clojure-dev list the other day. |
| 17:42 | hyPiRion | Would be sweet to have something in core. |
| 17:43 | josteink | "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:45 | technomancy | http://first.clojure-conj.org/speakers#mcgranaghan |
| 17:45 | josteink | haha. nice |
| 17:46 | josteink | I was thinking more about linux than ring though ;) |
| 17:46 | ivaraasen | hyPiRion: 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:46 | josteink | didn't know "ring" came from such a deep metaphor though |
| 17:46 | technomancy | well... not really |
| 17:47 | technomancy | more like Wagner |
| 17:47 | technomancy | the request/response cycle |
| 17:47 | technomancy | is shaped like a ring |
| 17:47 | josteink | fair enough |
| 17:47 | technomancy | (not actually Wagner, just making a "ring cycle" joke) |
| 17:48 | ivaraasen | technomancy: that's still pretty deep, man |
| 17:48 | hyPiRion | ivaraasen: Yeah. At least it's a start. It would probably take some time to get it up too, from my JIRA experiences. |
| 17:50 | ChongLi | das rheingold! |
| 17:50 | technomancy | kind of disappointed there aren't more wagner-themed ring libraries actually |
| 17:53 | seangrove | Bodil: 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:53 | seangrove | Here's the code I'm trying to eval: https://www.refheap.com/paste/05eeaac85264aee5dc0cd5f8b |
| 17:53 | seangrove | It compiles without warning and loads, but after connecting the browser to nrepl, I get the above error |
| 17:54 | seangrove | Maybe this is expected and I'm just confused |
| 17:54 | Bodil | seangrove: So it's the (ns) that doesn't eval? |
| 17:55 | seangrove | Hrm, actually, let me try restarting my nrepl server |
| 17:55 | Bodil | seangrove: Sounds like it's got classpath issues - afraid that's a bit beyond me. But definitely not expected. |
| 17:55 | seangrove | No problem, just glad to clarify :) |
| 17:56 | seangrove | What was the problem with advanced mode, by the way? |
| 17:57 | tomoj | (.contains (base32-encode (hmac "HmacSHA1" "foo" "foobarbaz")) "JAVA") |
| 17:58 | Bodil | seangrove: 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:59 | Bodil | seangrove: That was the short explanation, at least :) |
| 17:59 | seangrove | Yeah, sounds like what I went through as well |
| 17:59 | seangrove | Definitely careful with aset/aget now... |
| 17:59 | TimMc | tomoj: ?! |
| 18:00 | tomoj | that was the very first thing I tried, too, not like I kept going till I saw a message in the sig |
| 18:00 | tomoj | but what's the PETWHAC? |
| 18:00 | seangrove | Bodil: 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:01 | seangrove | I can fix that up and submit a pr... |
| 18:01 | Bodil | seangrove: Hmm, what cljs version are you using? |
| 18:02 | seangrove | Bodil: head |
| 18:02 | seangrove | More or less, I think |
| 18:03 | seangrove | Might be a week or two old now |
| 18:03 | Bodil | Weird... that form compiles for me. |
| 18:03 | Bodil | But yeah, it should probably be (.getPrototypeOf js/Object) |
| 18:05 | tomoj | I 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:07 | tomoj | well 29/32^4 or whatever |
| 18:09 | gfredericks | how does core.logic/occurs-check work? |
| 18:10 | TimMc | tomoj: I don't know much about HMAC -- does this rely on whatever random init key was used? |
| 18:10 | tomoj | the key was "foobarbaz" |
| 18:10 | tomoj | that expression will always return the same result |
| 18:12 | TimMc | tomoj: I was trying to reproduce this using javax.crypto but couldn't figure out how to initialize HmacSHA1 with a non-random key. |
| 18:15 | tomoj | https://github.com/kzar/ring-hmac-check/blob/master/src/ring/middleware/hmac_check.clj |
| 18:16 | gfredericks | http://en.wikipedia.org/wiki/File:Uniform_tiling_54-t2.png |
| 18:16 | gfredericks | ^ exploring that with core.logic (or any other paradigm I know of) is mildly maddening. |
| 18:16 | tomoj | interesting |
| 18:18 | josteink | seangrove: I must admit I found cljs not quite sexy as I expected it to be |
| 18:18 | seangrove | josteink: In general, I love it |
| 18:18 | seangrove | Some very painful edges though |
| 18:18 | josteink | the idea is good |
| 18:19 | josteink | but you want to be able to work with everything else wonderful in JS land |
| 18:19 | josteink | and none of that follows any sort of clojure convention |
| 18:19 | tomoj | gfredericks: why core.logic? |
| 18:19 | seangrove | Not sure how much is wonderful out there, though |
| 18:19 | josteink | seangrove: its sure more wonderful than reinventing a wheel ;) |
| 18:20 | seangrove | josteink: In most cases, yes |
| 18:20 | tomoj | I wrote something in cljs that did a triangular tiling |
| 18:20 | seangrove | But having built some large javascript apps now, I can say, not always :) |
| 18:20 | josteink | anyway |
| 18:20 | seangrove | We 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:20 | josteink | I wasnt trying to cause a bad vibe. more interested in seeing a cøljs "sucess case" |
| 18:20 | seangrove | A lot of that lands on us, but a lot lands on bad practices in the stuff out there |
| 18:21 | seangrove | If you're talking about angular and friends, I'm certainly much more interested though |
| 18:21 | gfredericks | tomoj: because I don't have any coordinate system I know of that I can use |
| 18:21 | josteink | Ive yet to decide if I like angular |
| 18:21 | seangrove | They seem to be writing some clean code, and I don't think it fits in smoothly with cljs yet |
| 18:21 | josteink | to be quite honest |
| 18:21 | gfredericks | thus a major problem is telling when two descriptions of a square are the same square |
| 18:21 | seangrove | Though bbloom would know more about that than me |
| 18:21 | seangrove | Why's that? I haven't used it yet |
| 18:22 | seangrove | It just looks far more suitable than jQuery and the myriad of plugins |
| 18:22 | josteink | its a bit too much magic :) |
| 18:22 | josteink | I like to knkow whats happening, what my contexts are, and to be able to debug my code without the need for breakpoints ;) |
| 18:22 | tomoj | oh, you already can generate the squares? |
| 18:23 | gfredericks | tomoj: well I can easily generate all paths from a starting point |
| 18:23 | gfredericks | but then how can I tell if two paths lead to the same place? |
| 18:23 | josteink | also, Im sceptical about buying into a google controlled "open source" project if I can choose not to |
| 18:23 | josteink | they control enough of the internet already |
| 18:23 | tomoj | you mean because of rounding error? |
| 18:23 | josteink | they shouldnt have to be in control of MY code :P |
| 18:23 | gfredericks | tomoj: no I'm trying to do this in an algebraic way rather than geometric |
| 18:24 | gfredericks | so e.g. [:left :up :up :right] |
| 18:24 | tomoj | oh, now it makes sense |
| 18:24 | tomoj | very cool |
| 18:24 | seangrove | Heh, well, that's one way of looking at it |
| 18:24 | gfredericks | well left/right/up/down aren't well defined |
| 18:24 | gfredericks | so it's more like forward-left-right-forward or something like that |
| 18:24 | gfredericks | this is all very trippy :/ |
| 18:26 | gfredericks | I'm trying to use unification to some effect or another |
| 18:28 | josteink | seangrove: my main complaint about angular is that it seems very fuzzy where the border goes for what is data and what is code |
| 18:28 | josteink | seangrove: in a bad way, quite unlike in lisps :P |
| 18:30 | TimMc | gfredericks: So you need some way of saying what the canonical path to a square is. |
| 18:30 | gfredericks | TimMc: that would definitely be useful. |
| 18:33 | TimMc | gfredericks: Is there an origin square or an origin vertex? |
| 18:33 | gfredericks | may as well assume so |
| 18:33 | gfredericks | I'm dealing with vertices at the moment |
| 18:33 | TimMc | No, I mean which one? |
| 18:33 | gfredericks | so an origin vertex |
| 18:34 | gfredericks | I'm trying the approach of ignoring the squares and just thinking of it as a graph where each vertex has 5 neighbors |
| 18:34 | gfredericks | just an algorithm that can return the number of vertices within N hops would be an achievement |
| 18:35 | gfredericks | or equivalently generate a graph data structure by walking up to N steps from the origin |
| 18:35 | gfredericks | s/equivalently/even better/ |
| 18:36 | gfredericks | I 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:37 | TimMc | gfredericks: Well, just looking at that diagram, canonical paths could be hard. |
| 18:38 | gfredericks | yes. :) I've had this problem in my head for a month at least. |
| 18:38 | TimMc | up,right is the same as right,up |
| 18:39 | tomoj | this is apparently why you can't use a zipper |
| 18:39 | tomoj | I guess there would be two important directions, down and right |
| 18:40 | gfredericks | o_O? |
| 18:40 | clojurebot | joyofclojure is http://joyofclojure.com/ |
| 18:40 | gfredericks | clojurebot: thanks man |
| 18:40 | clojurebot | I'm no man, and she's no lady! |
| 18:40 | tomoj | I mean you can generate all the vertices with down and right, right? you might call down 'out' |
| 18:41 | Bodil | seangrove: Released! https://clojars.org/org.bodil/pylon/versions/0.2.0 |
| 18:41 | tomoj | and right 'clockwise' |
| 18:41 | seangrove | Bodil: Awesome :) |
| 18:41 | gfredericks | tomoj: hmmm...you'd still have redundancy. But maybe there is always a unique shortest path? |
| 18:41 | seangrove | I've about three more pages of javascript to convert over to pylons and then I can test it out |
| 18:42 | gfredericks | tomoj: you're talking about traversing squares, right? not vertices? |
| 18:42 | tomoj | vertices |
| 18:42 | tomoj | I'm probably confused |
| 18:42 | gfredericks | I'm always confused when I'm thinking about this. |
| 18:43 | tomoj | #(-> % out out right right) would just be a noop |
| 18:43 | TimMc | gfredericks: Well, this version of canonical paths is probably too complicated: http://i.imgur.com/nvnBiGs.jpg |
| 18:43 | gfredericks | tomoj: then I definitely don't know what you're talking about |
| 18:44 | josteink | Bodil: out of curiousity... in what cases would be using a library like that? |
| 18:45 | augustl | I'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:45 | gfredericks | TimMc: yeah; I can't tell what's going on there |
| 18:45 | josteink | where caused you to see the need and go for it? :) |
| 18:45 | gfredericks | augustl: so your issue is that "proper teardown" =/= (.close ob)? |
| 18:45 | Bodil | josteink: When you want to deal with heavily class based JS APIs - my use cases were Ace and Backbone. |
| 18:45 | TimMc | gfredericks: 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:46 | augustl | gfredericks: not really, currently it's (teardown ob), and ob is a map, and I do stuff with entires in the map |
| 18:46 | augustl | gfredericks: perhaps I could somehow implement it so all that stuff happens in a .close method |
| 18:46 | raylu | hi. 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:46 | gfredericks | TimMc: I thought of that but the three green paths near the top-right seemed to contradict the idea |
| 18:46 | augustl | raylu: very normal yeah |
| 18:47 | Bodil | augustl: Methods are smelly, you should go ahead and make your macro imo. :) |
| 18:47 | augustl | raylu: doto is perhaps better though |
| 18:47 | augustl | Bodil: but, but, reuse! |
| 18:47 | josteink | Bodil: ah. backbone. fair enough. just barely looked into that, but never got going. |
| 18:47 | raylu | augustl: i'm only doing two things to mac, though, and one of them is inside the let |
| 18:48 | augustl | raylu: ah, misread it |
| 18:48 | ivaraasen | hyPiRion: haha https://www.refheap.com/paste/e5c5bca04d7b7206367c03f4e |
| 18:48 | raylu | augustl: ok. thanks for confirming :D |
| 18:49 | Bodil | josteink: Don't take that as an endorsement, Backbone was just my obvious test case - wouldn't use it myself. :) |
| 18:49 | augustl | raylu: your indentation is _very_ unconventional, though |
| 18:50 | amalloy | raylu: yes, the code is fine, but the whitespace is very different from what anyone else would do |
| 18:50 | raylu | yeah, 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:50 | TimMc | gfredericks: Right, but those sprout from a side-path, so that's not too surprising. :-/ |
| 18:50 | augustl | raylu: you don't use paredit mode with emacs, apparently :) |
| 18:51 | TimMc | Damn this is hard. |
| 18:51 | amalloy | raylu: https://gist.github.com/b754aa03bb81749c86d1, for reference |
| 18:51 | TimMc | gfredericks: Have you already checked for coordinate systems for hyperbolic spaces? |
| 18:51 | gfredericks | yeah; it's tricksy |
| 18:52 | amalloy | and 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:52 | gfredericks | TimMc: my current thought is that there are two/four kinds of relationships between two vertices that are two hops apart |
| 18:53 | TimMc | gfredericks: There might be something generalizable from this: http://i.imgur.com/0YWlhvB.jpg |
| 18:53 | TimMc | gfredericks: State machines. :-) |
| 18:53 | gfredericks | (sharp-right a b) (dull-right a b) (sharp-right b a) (dull-right b a) |
| 18:53 | gfredericks | well insert a c as the second arg in all of those |
| 18:54 | gfredericks | (c being the intermediate vertex) |
| 18:54 | gfredericks | that might give you the language to express the geometric...shape of the thing |
| 18:55 | gfredericks | in any case I'm running out for a few hours. If you win any fields medals let me know. |
| 18:56 | hyPiRion | ivaraasen: sweet |
| 18:57 | ivaraasen | hyPiRion: mean execution time is about 3 us. a bit slower than Apache Commons probably, but it's probably viable for one-off calculations |
| 18:59 | gfredericks | TimMc: 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:59 | gfredericks | two neighbors could have arbitrarily different paths; but it might still be easy |
| 19:05 | augustl | oh hey, this is the first time I wrote a macro and it worked as I expected the first time I ran it. |
| 19:06 | ivaraasen | augustl: congrats |
| 19:06 | TimMc | gfredericks: 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:08 | S11001001 | this stuff is pretty funny: [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] |
| 19:09 | S11001001 | https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/Lib/RT.cs#L1343 |
| 19:10 | amalloy | S11001001: CA1709:IdentifiersSHOULDbecaseCoRRectly |
| 19:13 | S11001001 | CA42:SuppressingWarningsShouldntBeSuchABloodyChore |
| 19:14 | S11001001 | ,(take 10 (repeat [42, 84])) |
| 19:14 | clojurebot | ([42 84] [42 84] [42 84] [42 84] [42 84] ...) |
| 19:16 | gfredericks | TimMc: that's one of my end goals actually |
| 19:17 | hyPiRion | ,(repeat 10 [42 84]) |
| 19:17 | clojurebot | ([42 84] [42 84] [42 84] [42 84] [42 84] ...) |
| 19:17 | TimMc | gfredericks: I see. |
| 19:18 | TimMc | gfredericks: Anyway, congratulations. You've successfully nerd-sniped me and my wife. |
| 19:19 | TimMc | "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:19 | gfredericks | haha |
| 19:22 | gfredericks | it bothers me that the lines in that diagram are straight |
| 19:24 | technomancy | S11001001: wow, talk about boilerplate |
| 19:25 | S11001001 | I think someone has funny ideas about "correctly" |
| 19:25 | S11001001 | what it means, that is |
| 19:26 | S11001001 | I take it back; it might be fair, I don't know anything about the C# developer community. |
| 19:26 | S11001001 | We certainly don't put up with any nonsense-not-like-this. |
| 19:26 | amalloy | indeed. the C# guys like PublicMethods to have UpperCamelCase |
| 19:27 | S11001001 | I know the stdlib is like that |
| 19:27 | josteink | S11001001: as a .net developer, the main reason I do JVM-based clojure is that clojure-clr seems all dead :) |
| 19:27 | S11001001 | josteink: dmiller seems to well keep up with it |
| 19:27 | cbp` | I'm unsure what to put in public pgp when registering to clojars, since the public key is in binary |
| 19:28 | S11001001 | cbp`: use --armor option to gpg |
| 19:28 | josteink | cbp`: the public key has a ascii fingerprint of sorts though |
| 19:29 | josteink | you should be able to get gpg to export the public key, in an ascii-ish format |
| 19:29 | cbp` | thank you |
| 19:30 | TimMc | --enarmor |
| 19:30 | TimMc | I think |
| 19:30 | TimMc | gfredericks: I think I'm more used to seeing this as fours of pentagons, not fives of squares. |
| 19:33 | ThatOneGuy | hola 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:35 | S11001001 | ThatOneGuy: ' is the true quote (nothing evalled); ` is syntax sugar for a thing that is not that. Neither changes behavior in macros. |
| 19:36 | hyPiRion | ,`(vector ~(+ 1 2) ~@(vector :a :b :c)) ; example of backquote |
| 19:36 | clojurebot | (clojure.core/vector 3 :a :b :c) |
| 19:36 | S11001001 | ThatOneGuy: any attempt to rehash all the ` features here would almost certainly miss something. |
| 19:36 | hyPiRion | ,'(vector ~(+ 1 2) ~@(vector :a :b :c)) ; normal quote |
| 19:36 | clojurebot | (vector (clojure.core/unquote (+ 1 2)) (clojure.core/unquote-splicing (vector :a :b :c))) |
| 19:37 | ThatOneGuy | "for a thing that is not that." what do you mean by this? I get the rest of your answer though. |
| 19:37 | S11001001 | ThatOneGuy: a thing that is not the true quote |
| 19:38 | ThatOneGuy | so ` backquote does more expansion than a regular quote? (evals the unquote function and the unquote-splicing) |
| 19:39 | ThatOneGuy | or allows for more expanded unquoting |
| 19:39 | hyPiRion | ThatOneGuy: As a start, yes. Also notice that ##`(vector ...) returns clojure.core/vector instead of just vector |
| 19:39 | lazybot | ⇒ (clojure.core/vector ...) |
| 19:40 | hyPiRion | To top it all off, symbols can be appended with a # to create gensyms |
| 19:40 | ThatOneGuy | so fully qualifies function names? |
| 19:40 | hyPiRion | ThatOneGuy: Yes |
| 19:40 | raylu | ok. so... what does :cost do? https://github.com/clojure/java.jdbc |
| 19:40 | hyPiRion | ,`(let [foo# 100] (+ foo# 999)) |
| 19:40 | clojurebot | (clojure.core/let [foo__79__auto__ 100] (clojure.core/+ foo__79__auto__ 999)) |
| 19:41 | amalloy | it's just a column in his sql table, raylu |
| 19:41 | ThatOneGuy | So when creating DSLs with macros, backquote is better. and when you want a raw list for data use single quote? |
| 19:41 | hyPiRion | That's the crash course of macros, I think. |
| 19:42 | hyPiRion | ThatOneGuy: Yes, that's the standard. Though amalloy could probably tell you how often you should write macros. |
| 19:42 | raylu | amalloy: suddenly, the maps part of the cheatsheet makes a lot more sense |
| 19:42 | amalloy | who, me? |
| 19:42 | hyPiRion | Anyone else named amalloy here? |
| 19:42 | raylu | i mean i read (:key my-map) → ( get my-map :key) |
| 19:43 | raylu | but i had no idea what it meant until you said that, amalloy |
| 19:49 | tomoj | gfredericks: http://bulatov.org/math/1001/#(52) |
| 19:50 | tomoj | seen that deck already? pretty neat |
| 19:50 | augustl | raylu: also, fyi, it's not a macro, :key is actually a function |
| 19:50 | josteink | raylu: you should read the joy of clojure |
| 19:50 | augustl | (inc josteink) |
| 19:50 | lazybot | ⇒ 1 |
| 19:50 | josteink | it will walk you trough lots of these things in a very enlightening way |
| 19:51 | josteink | I think clojure is pretty straight forward, except when its not |
| 19:51 | josteink | but one of the parts of clojure where small aspects have a big impact in clojure is collections |
| 19:52 | josteink | and the joy of clojure will walk you through them pretty thoroughly and good |
| 19:52 | ThatOneGuy | lol "clojure is pretty straight forward, except when its not" nothing else is like this in the entire world. /s |
| 19:53 | josteink | well |
| 19:53 | josteink | tell me I'm wrong :P |
| 19:53 | josteink | I dare you :D |
| 19:55 | raylu | is == the same as = except only for nums? |
| 19:58 | seangrove | Bodil: Slightly confused from some errors here |
| 19:58 | seangrove | If I see: goog.base(this, goog.ui.Container.Orientation.VERTICAL, |
| 19:59 | seangrove | in the closure docs, should I be calling (super this, goog.ui.Con....), or just (super goog.ui.Con...) ? |
| 19:59 | seangrove | Looking at the macro, it looks like you automatically put in the "this" |
| 20:00 | Bodil | seangrove: 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:01 | Bodil | seangrove: 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:02 | ivaraasen | hyPiRion: just got arrseq working, which is doseq, but for arrays. could be nice if you need to have side-effects only. |
| 20:02 | seangrove | Bodil: The superclass is chosen from the :extends argument, right? |
| 20:02 | seangrove | I'm not looking to choose the superclass, just trying to translate this closure ui custom component code, which is not particularly nice |
| 20:03 | Bodil | seangrove: Yeah, Foo :extends Bar causes goog.interits(Foo, Bar), essentially. |
| 20:03 | Bodil | goog.inherits* |
| 20:03 | seangrove | Yeah, thought so |
| 20:05 | Bodil | seangrove: goog.base(this, superclass, args) translates simply to (super args) |
| 20:07 | Bodil | seangrove: uh, no, that's not goog.base's signature... but you get the idea :) |
| 20:07 | seangrove | So, goog.base(this, goog.ui.Container.Orientation.VERTICAL, ChecklistRenderer.getInstance()); => (super goog.ui.Container.Orientation.VERTICAL (.getInstance ChecklistRenderer)) |
| 20:07 | Bodil | Yeah, looks right. |
| 20:07 | seangrove | Alright, will figure out what's wrong from here then |
| 20:07 | devn | I 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:07 | seangrove | I can't believe what a horrible nightmare extending goog.ui is |
| 20:08 | devn | yogthos|away: ^^ |
| 20:08 | augustl | seangrove: 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:08 | seangrove | Heh, this *is* our re-write from jQuery ;) |
| 20:08 | seangrove | With cljs, augustl ? |
| 20:08 | devn | I call (connect! (System/getenv "BONSAI_URL")) in myapp.handler/init |
| 20:09 | augustl | seangrove: no just plain JS |
| 20:09 | augustl | seangrove: the biggest pain was updating the UI after initially creating the DOM elements (or goog.ui.Components) |
| 20:09 | devn | I run my server on heroku using: lein with-profile production ring server |
| 20:09 | devn | I have :ring {:handler myapp.handler/app} in my project.clj |
| 20:10 | gfredericks | TimMc: I think the two are dual |
| 20:10 | augustl | with angularjs, everything is lazy, so it doesn't matter if you do some operation the 1st or 2nd or 97th time |
| 20:10 | josteink | quite a few comitts the last few days ;) |
| 20:12 | augustl | seangrove: angularjs is probably not a good fit for clojurescript, though. angular is _all in_ mutability |
| 20:13 | raylu | so, (= a b) seems to do a java ==, not a java .equals (right now, a and b are byte-arrays) |
| 20:13 | devn | yogthos|away: nevermind, needed to add :init to project.clj |
| 20:13 | raylu | but the documentation says otherwise... |
| 20:13 | devn | yogthos|away: it might be a good idea to include that by default in the project.clj |
| 20:13 | seangrove | augustl: Heh, maybe for the next rewrite then :) |
| 20:13 | seangrove | I've found closure to be very fast, which is nice |
| 20:14 | seangrove | But not a whole lot that's nice beyond that |
| 20:14 | seangrove | Reasonably stable |
| 20:14 | augustl | raylu: seems to boil down to clojure.lang.Util/equiv, whatever that might be |
| 20:14 | ivaraasen | hyPiRion: and now we've got destructive map! for in-place mapping. fun |
| 20:14 | augustl | seangrove: 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:15 | raylu | is there a simple way to compare byte arrays? |
| 20:15 | augustl | raylu: for byte equality? |
| 20:15 | raylu | yes |
| 20:15 | cshell | raylu: You'd have to write a for loop I'd imagine |
| 20:15 | technomancy | compare seqs over them |
| 20:16 | raylu | T.T |
| 20:16 | augustl | raylu: here's the Java code for = https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L24 |
| 20:16 | cshell | yeah, or that :) |
| 20:16 | augustl | it's a call to .equals it seems |
| 20:16 | josteink | raylu: the problem with equality of complex entities is unfortunately not entirely eliminated in clojure ;) |
| 20:16 | technomancy | byte arrays are mutable; you can't have two different mutable objects that are equal |
| 20:16 | josteink | raylu: or what technomancy said |
| 20:17 | technomancy | for background I highly recommend reading "Equal Rights for Functional Objects" |
| 20:17 | josteink | hah |
| 20:17 | josteink | is that book or a blog post? |
| 20:18 | technomancy | it's a paper ಠ_ಠ |
| 20:18 | technomancy | clojurebot: equal rights for functional objects |
| 20:18 | clojurebot | Equal 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:18 | josteink | oooh. now I feel so unacademical |
| 20:18 | technomancy | haha |
| 20:18 | augustl | papers should have boring titles :S |
| 20:18 | technomancy | s'ok; it's just one of my favourite rant topics |
| 20:18 | raylu | oh. are you telling me that .equals wouldn't have worked in java either? |
| 20:18 | technomancy | especially when there are CLers present |
| 20:18 | technomancy | raylu: I'm saying Java's notion of equality is not particularly useful |
| 20:19 | augustl | raylu: it appears that = just ends up calling .equals unless they're numbers, so yeah |
| 20:19 | augustl | but I'm not sure |
| 20:19 | technomancy | it 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:20 | augustl | and is "this exact instant" atomic for things like byte arrays? :) |
| 20:20 | cshell | Thanks for the link, technomancy - I always like to find things like this |
| 20:20 | augustl | would be nice if = locked! |
| 20:20 | josteink | hahahaha |
| 20:21 | josteink | I cant foresee the amount of bugs THAT would cause |
| 20:21 | seangrove | technomancy: Why when CLers are present? |
| 20:21 | josteink | seangrove: I think CLers are rumoured to be the most pedantic of all programmers alive :P |
| 20:21 | technomancy | seangrove: because that paper is written by someone who really wants to like CL but is honest about its deep-seated shortcomingsn |
| 20:22 | seangrove | technomancy: It has (nearly) no shortcomings |
| 20:22 | josteink | I happened to end up at a news years party with a CLer |
| 20:22 | seangrove | How could it? The spec is ~1500pages long :P |
| 20:22 | josteink | he tried to convince me a seperate namespace for functions was a good thing |
| 20:22 | josteink | on new years eve |
| 20:22 | seangrove | josteink: I like that feature |
| 20:23 | technomancy | CLers 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:23 | josteink | I so do not |
| 20:23 | seangrove | But I didn't see it as particularly useful |
| 20:23 | technomancy | lisp-2 is really wretched in elisp |
| 20:23 | seangrove | I didn't know elisp was a lisp-2 |
| 20:23 | technomancy | makes most higher-order functions so cumbersome to work with that the imperative equivalent ends up being shorter =\ |
| 20:24 | seangrove | I always use it as though it's not |
| 20:26 | gfredericks | tomoj: this presentation is. good. |
| 20:27 | josteink | atleast pretty close ;) |
| 20:28 | seangrove | I feel like drinking after all this horrible goog.ui stuff |
| 20:29 | josteink | you know |
| 20:29 | josteink | I spedn way too much time on HN |
| 20:30 | josteink | but one of the discussions I read there was about CLJS |
| 20:30 | josteink | and the consensus seemed (among many) to be that CLJS really doesnt have that fun, sparkling, dynamic nature which people usually associate with clojure |
| 20:30 | technomancy | gfredericks: not even about the good old days? |
| 20:30 | gfredericks | technomancy: first I've heard of them |
| 20:31 | josteink | and I tend to agree |
| 20:31 | technomancy | gfredericks: everyone says it's all gone downhill |
| 20:31 | josteink | with CLJS you spend way too much time dealing with bullshit |
| 20:31 | josteink | things which are not your primary concern |
| 20:31 | ivaraasen | oh, the good old days, when no one ate quiche and Fortran seemed like Python in comparison to anything else. |
| 20:31 | technomancy | but 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:32 | josteink | heh |
| 20:32 | josteink | the only place which hasnt gone downhill is irc |
| 20:32 | josteink | because it has actually had a decrease in amount of users ;) |
| 20:32 | technomancy | freenode is the best social network; no contest |
| 20:33 | gfredericks | they never send me emails asking for a photo of my birth certificate |
| 20:33 | josteink | haha |
| 20:33 | gfredericks | ...yet |
| 20:33 | technomancy | actually have been musing on ways in which I could replace my twitter usage with freenode |
| 20:34 | raylu | technomancy: bitlbee will.. sort of do that for you |
| 20:34 | josteink | Ive decided that I dont -need- twitter |
| 20:34 | technomancy | twitter is great for broadcast, but everyone I actually want to have conversations with is on freenode |
| 20:34 | technomancy | raylu: actually I'm thinking of the other direction |
| 20:34 | angusiguess | You could limit every irc message to 140 characters. |
| 20:34 | josteink | I just open a twitter tab and post stuff if I want to spam it :) |
| 20:34 | technomancy | I want my freenode conversations to be accessible on my mobile |
| 20:34 | angusiguess | Or use more octothorpes. |
| 20:35 | josteink | technomancy: you could always put up a irc XMPP proxy into a gtalk account |
| 20:35 | josteink | technomancy: but that would probably make your (android) cellphone go crazy :P |
| 20:35 | technomancy | so 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:35 | gfredericks | tomoj: this is maybe the most amazing thing I've seen in months or something |
| 20:35 | amalloy | technomancy: surely your mobile has an irc client. so you must mean something else i'm not quite following |
| 20:36 | technomancy | amalloy: mobile IRC clients are incredibly poor |
| 20:36 | josteink | raylu: bitlbee works. but is not very friendly for mobile |
| 20:36 | technomancy | I don't necessarily want to focus on a real-time conversation |
| 20:36 | technomancy | I'd rather have summarization and search features |
| 20:36 | amalloy | mine's not bad, but i suppose i don't really ask for much given that my desktop client is pretty poor |
| 20:37 | ivaraasen | I use way too much mail |
| 20:37 | josteink | I've stopped using desktop irc clients ages ago |
| 20:37 | josteink | I like having a session running anytime, anywhere |
| 20:38 | technomancy | amalloy: you don't use ERC? |
| 20:38 | josteink | which I can attach to when I need it :) |
| 20:38 | amalloy | no. i use erc for editing code. shameful, i know |
| 20:39 | amalloy | er, emacs |
| 20:39 | gfredericks | man that was almost interesting |
| 20:39 | technomancy | was going to say, that's a neat trick |
| 20:39 | ivaraasen | anyone interested in looking at some utility stuff for doing primitive numerics in Clojure? (Flop-ish) |
| 20:39 | amalloy | heh, yes. any clojure program i can't fit in an irc message isn't worth writing |
| 20:40 | technomancy | /msg ~/src/leiningen/project.clj sed -i s/clj-http "0.5.7"/clj-http "0.5.8"/ |
| 20:40 | josteink | anyway |
| 20:40 | josteink | might be coincidence |
| 20:40 | josteink | might be something else |
| 20:41 | josteink | but your (final) release of leiningen 2.0.0 seemed to have woken up projects around the clojure-verse |
| 20:41 | josteink | :) |
| 20:41 | ThatOneGuy | another quick question. What does a solitary keyword value do a function body? e.g. (defn something [func] :fn func) |
| 20:42 | amalloy | nothing |
| 20:42 | josteink | nothing |
| 20:42 | josteink | it 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:42 | josteink | and in all other cases it is falsey |
| 20:44 | jeremyheiler | jsteink, i think you're assuming there are parens around ":fn func" |
| 20:44 | josteink | I realized that as well. afterwards |
| 20:45 | jeremyheiler | heh |
| 20:45 | ivaraasen | josteink: by the way, you're Scandinavian? |
| 20:46 | ThatOneGuy | (defmacro component [name params & r] `(defn ~name ~params ~@r)) |
| 20:46 | ThatOneGuy | (component renderable [func] :fn func) |
| 20:46 | ThatOneGuy | does that help give some context? |
| 20:47 | josteink | ivaraasen: obviously. |
| 20:47 | josteink | and you stick out like a sore thumb :P |
| 20:49 | ThatOneGuy | [(renderable `(custom-render-func))] so would that be putting the keyword :fn and func inside the vector? |
| 20:49 | josteink | yes |
| 20:49 | jeremyheiler | ThatOneGuy, invoking renderable will just return the value of func because it is the last expression in the function body. |
| 20:50 | josteink | or that :P |
| 20:50 | ThatOneGuy | so the function would be added to the vector and not the keyword |
| 20:52 | josteink | jeremyheiler: wouldnt it just return the function as is? since its never really invoked? |
| 20:52 | josteink | I mean not to be nitpicking details, but this is definitely a details type question ;) |
| 20:52 | ivaraasen | josteink: I get PMs all the time asking me if I'm Turkish for some reason |
| 20:52 | jeremyheiler | the 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:54 | jeremyheiler | ThatOneGuy, [(user/custom-render-func)] is what your vector would look like |
| 20:54 | jeremyheiler | That is because '(custom-render-func) is the last argument supplied to renderable. |
| 20:57 | ThatOneGuy | ok. 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:01 | jeremyheiler | That compnent macro is different than yours. |
| 21:01 | ThatOneGuy | yeah, I was trying to translate it to regular clojure, because I don't want to use clojurescript. |
| 21:01 | TimMc | gfredericks: http://bulatov.org/math/1101/webtalk.html#%2821%29 and the next few slides may be interesting. |
| 21:02 | TimMc | gfredericks: I'm not sure that slide actually indicates a non-overlapping enumeration scheme, though. |
| 21:02 | jeremyheiler | TheOneGuy, right, so you can see that ultimately a string and keyword are passed into the js-obj function. |
| 21:03 | gfredericks | TimMc: I saw that; doesn't suggest anything to me though :/ |
| 21:03 | jeremyheiler | along with whatever happens to be in r. |
| 21:04 | ThatOneGuy | yeah. and in js-obj it calls (apply gobject/create keyvals) |
| 21:04 | jeremyheiler | so if name="foo" and r=(:x :y), then the function is (cljs.core/js-obj "name" :foo :x :y) |
| 21:05 | gfredericks | it just occurred to me that (repeat x) could return a special ISeq for which rest returns itself |
| 21:05 | ThatOneGuy | yeah. then gobject/create probably creates a javascript object from those keyvals and that is what is stored in the vector |
| 21:06 | jeremyheiler | probably |
| 21:06 | ThatOneGuy | so 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:06 | TimMc | gfredericks: http://bulatov.org/math/1101/img/dod_tiling_01.jpg :-D |
| 21:07 | gfredericks | cube-like dodecahedrons! |
| 21:09 | gfredericks | TimMc: I think I might like the pentagon version better, at least for playing Go |
| 21:12 | jeremyheiler | ThatOneGuy, 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:14 | ThatOneGuy | ](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:14 | ThatOneGuy | ignore the first ] idk why that is there |
| 21:18 | seangrove | Bodil: Is pylon aware of the difference in calling super in instance methods versus prototype methods? |
| 21:20 | bbloom | Raynes: I can only assume that you want me to ask this: |
| 21:20 | jeremyheiler | ThatOneGuy, that sounds legit, but I really don't know what js/Game.as is. |
| 21:20 | bbloom | Raynes: "What's updoc?" |
| 21:23 | amalloy | bbloom: yes, that is why he named it updoc |
| 21:23 | bbloom | amalloy: clearly :-) |
| 21:23 | bbloom | i looked at it, so id ont even want to know the answer to that question |
| 21:23 | ThatOneGuy | so 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:24 | jeremyheiler | You 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:25 | jeremyheiler | Alas, I really don't know the reasoning behind all of this, so I can't really help you with the design. |
| 21:27 | ThatOneGuy | true. 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:27 | seangrove | pylon seems to die if called from a prototype's method ('this' is undefined in that case, so super won't work properly) |
| 21:28 | ThatOneGuy | I 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:29 | jeremyheiler | ThatOneGuy, 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:30 | jeremyheiler | Unless you really want to get into all the details first. |
| 21:32 | ThatOneGuy | thanks. gotta head home. brb |
| 21:41 | Raynes | amalloy: Good work on updoc's name. Didn't take long until people caught on. |
| 21:41 | amalloy | did you announce it recently or something? |
| 21:42 | Raynes | amalloy: 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:51 | ivaraasen | Raynes: it's pretty sweet to see how easy it's to do stuff like this in Clojure, though. |
| 22:03 | rl | o.O |
| 22:03 | rl | think i found a bug in the interpreter |
| 22:03 | rl | CompilerException java.lang.RuntimeException: Unable to resolve symbol: template-list in this context, compiling:(NO_SOURCE_PATH:1:1) |
| 22:03 | rl | erm |
| 22:04 | rl | => (agility.template/eval-template-list template-list (["Somestr" "Hello" "(inc 1)"] ["Somestr" "Hello2" "(inc 2)"])) |
| 22:04 | rl | it ignores the eval- part |
| 22:04 | rl | if i do eval2 then |
| 22:04 | rl | (agility.template/eval2-template-list template-list (["Somestr" "Hello" "(inc 1)"] ["Somestr" "Hello2" "(inc 2)"])) |
| 22:04 | rl | CompilerException java.lang.RuntimeException: No such var: agility.template/eval2-template-list, compiling:(NO_SOURCE_PATH:1:1) |
| 22:04 | jeremyheiler | You sure it's not referencing the template-list right after it? |
| 22:06 | rl | yeah, hold on igot to dig deeper..i'm not using macros here or anything |
| 22:07 | jeremyheiler | The 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:07 | rl | jeremyheiler: the problem is i was using (eval-template-list ...) |
| 22:08 | rl | it should say eval-templte-list dosen't exist, not template-list |
| 22:08 | rl | oh |
| 22:08 | rl | <_< |
| 22:08 | rl | sorry |
| 22:08 | rl | lol |
| 22:09 | rl | i see what your saying, yes my bad lol |
| 22:09 | jeremyheiler | heh, no problem ;-) |
| 22:13 | yedi | how can I change the current working directory in an nrepl |
| 22:14 | yedi | looks like you can't do that in java..? so how can i get nrepl to start with q certain working directory |
| 22:15 | cshell | is it setting the java run directory property? |
| 22:17 | TimMc | gfredericks: Funny you should say that, I got overloaded with hyperbolic geometry and Alex suggested playing Go. |
| 22:17 | cshell | is it the user.dir property? |
| 22:20 | yedi | i solved my issue by running lein repl from the terminal and running nrepl in emacs (instead of nrepl-jack-in) |
| 22:28 | Raynes | There is no interpreter. |
| 22:51 | yedi | does anyone know of data sets similar to http://wordnet.princeton.edu/wordnet/ |
| 22:56 | cshell | Like these? http://richard.cyganiak.de/2007/10/lod/ |
| 22:57 | cshell | wordnet is in there, so maybe that's what you're looking for |
| 23:05 | dabd | can someone help me with the following macro? https://gist.github.com/4646206 |
| 23:06 | dabd | it 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:06 | dabd | however 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:14 | yedi | oh yessss, just remembered i can leverage java libraries |
| 23:42 | mmarczyk | dnolen: ping |
| 23:45 | amalloy | dabd: there's no parse-stack-interval function in that paste |
| 23:49 | amalloy | but 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:49 | lazybot | ⇒ false |
| 23:49 | amalloy | when 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:51 | dabd | amalloy: i just renamed things a bit it's the interval-test-fn macro |
| 23:52 | dabd | so i should parse the string as a double? |
| 23:52 | amalloy | *shrug* it depends what you want, probably. mostly you should just be careful not to compare doubles with floats |
| 23:53 | dabd | ok thanks |