2011-11-17
| 00:04 | changbeer | http://ideone.com/4D5hj looking at this simple example, can anyone see why it cant locate clj_record |
| 00:06 | Raynes | changbeer: You're requiring clj-record.boot, but you're using clj-record.core. |
| 00:07 | Raynes | That is *a* problem, not necessarily *the* problem. |
| 00:07 | Raynes | It's a start though. |
| 00:10 | hiredman | monads? |
| 00:10 | clojurebot | monads is http://okmij.org/ftp/Scheme/monad-in-Scheme.html |
| 00:10 | hiredman | I tell you, runtime patching via the repl is the devil |
| 00:23 | jcromartie | hiredman: really? |
| 00:23 | jcromartie | how about Erlang? |
| 00:23 | hiredman | what about it? |
| 00:25 | jcromartie | you said runtime patching via the REPL is the devil |
| 00:25 | hiredman | and? |
| 00:25 | jcromartie | what about hot-swapped updates, a la Erlang |
| 00:25 | jcromartie | they seem to do pretty well |
| 00:25 | jcromartie | I think Clojure could do the same |
| 00:26 | hiredman | the issue with runtime patching via the repl is keeping a consistent state, it is all to easy to, change a function, change another function, reload the system, find the second function doesn't work, change it back, now your functions don't work together, etc |
| 00:28 | jcromartie | true |
| 00:28 | jcromartie | but I guess it's a matter of degrees |
| 00:28 | jcromartie | what if you design for hot-swapping, and test before deploying the update somewhere? |
| 00:29 | jcromartie | i.e. defonce, etc. |
| 00:29 | jcromartie | anyway, off to be with me |
| 00:29 | jcromartie | bed |
| 00:29 | jcromartie | goodnight |
| 00:29 | jcromartie | how the heck is it midnight already |
| 00:31 | noncom | hello! |
| 00:32 | noncom | i have a question |
| 00:33 | brehaut | noncom: just ask it, if someone can answer they will |
| 00:34 | noncom | i want to begin learning clojure (and already did), but everywhere i go, i mostly see stallnesss. the 1.3.0 version was released over a year ago. clojure box is no longer maintained since clojure 1.2.0, last comment on rich hickey blog is for almost a year ago. counterclockwise for eclipse is also only for clojure 1.2.0.... no real books to read about clojure 1.3.0. |
| 00:34 | noncom | this is SAD! since i like the language. |
| 00:34 | hiredman | 1.3.0 was released a few months ago |
| 00:34 | Raynes | No way. |
| 00:34 | Raynes | 1.3.0 was *just* released. |
| 00:36 | noncom | Raynes: hmm then my source was wrong about that |
| 00:37 | noncom | well, anyway, what development environment would you recommend then? preferably something like counterclockwise or clojure box. or is the only possibility for now - emacs? |
| 00:37 | amalloy | noncom: isn't clojurebox emacs? |
| 00:37 | ibdknox | CCW, emacs, vim, la clojure |
| 00:38 | noncom | it is, but it is all-in-a-box. i like eclipse and i see no point in learning emacs for that... |
| 00:38 | ibdknox | ccw works quite well |
| 00:38 | hiredman | so I was doing some parts of speech tagging in the inference stuff (for complex stuff it would try and just pull out nouns and infer with those) but it makes looks 100x slower |
| 00:38 | noncom | yes it does. but is there any way to integrate clojure 1.3.0 into it? |
| 00:38 | hiredman | egads |
| 00:39 | ibdknox | noncom: just replace the dependency with a 1.3.0 dependency? |
| 00:39 | hiredman | look ups |
| 00:40 | noncom | ok, i will try) then i will go on in clojure direction, you have calmed me) |
| 00:42 | noncom | thank you for your attention) |
| 00:43 | brehaut | counterclockwise has had two siginficant releases in the last month or so too |
| 00:43 | brehaut | 0.4.0 and 0.5.0 ? |
| 00:43 | Raynes | And Rich just isn't a blogger. |
| 00:43 | Raynes | Which is why that doesn't get updated much. |
| 00:44 | Raynes | As far as books go, 1.2 -> 1.3 wasn't a huge jump, so older books like Practical Clojure and The Joy of Clojure still apply just fine. |
| 00:44 | noncom | yeah my ccw is 0.5.0stable002 |
| 00:44 | Raynes | Clojure Programming, a new book targeting 1.3, is mostly done and not too far from the printers. |
| 00:44 | Raynes | I'm writing a book targeting 1.3 and potentially 1.4 myself. |
| 00:45 | Raynes | I assure you Clojure is no more stalled than the Earth blasting through space around the sun. |
| 00:45 | noncom | this is very good to hear since i am very interested with it as it is lisp and is for java |
| 00:46 | noncom | i am not a lisp professional but clojure seems the best for me since i am mostly from java |
| 00:50 | noncom | one more question about the books - will they be available on the main clojure site? online versions? printed versions? |
| 00:53 | noncom | ok, i have to go, see you late! |
| 02:55 | mindbender1 | hi |
| 02:55 | brehaut | hi |
| 03:46 | keith_ | Which language construct is appropriate for building on top of host objects that mutate. deftype? (I'm new to Clojure) |
| 03:46 | brehaut | keith_: thats a heavy weight solution |
| 03:47 | brehaut | keith_: are you new to functional programming or just clojure? |
| 03:47 | Chousuke | keith_: building in which way? |
| 03:47 | keith_ | both, but mostly clojure |
| 03:48 | brehaut | keith_: you can write a huge amount of clojure without ever having to touch a deftype |
| 03:48 | Chousuke | in general if you're working with mutable java objects via interop there's little to help you. The best you can do is try to keep the code with mutable things small and separate from other logic |
| 03:49 | brehaut | keith_: the reference types are generally sufficient for most mutation, and they manage access semantics much more clearly than an ad hoc deftype |
| 03:49 | Chousuke | you can also try converting the data from the mutable object into some immutable form and process that. |
| 03:49 | Chousuke | reference types won't help with java objects though |
| 03:49 | keith_ | ya |
| 03:50 | Chousuke | at least until pods appear, or whatever Rich comes up with :P |
| 03:50 | Chousuke | I wonder what happened to that idea |
| 03:50 | brehaut | oh, i misread; you have mutating objects already ? |
| 03:50 | amalloy | Chousuke: he mentioned pods again at the conj |
| 03:50 | Chousuke | oh, cool |
| 03:51 | keith_ | brehaut: I'm not actually working on something specific. I'm just trying to understand the paradigm |
| 03:51 | amalloy | it still isn't very developed as an idea |
| 03:51 | amalloy | keith_: paradigm: avoid mutation |
| 03:51 | Chousuke | keith_: you can't avoid mutable things if you deal with java but you can do various things to minimise the code that touches it |
| 03:52 | Chousuke | having a clean design is a good start |
| 03:53 | Chousuke | the keyword is isolation. try to keep mutation separate from program logic that does not need mutation. |
| 03:54 | Chousuke | that way you can at least test the non-mutating code separately and you have a smaller problem to deal with :) |
| 03:56 | Chousuke | I guess something like line-seq is a good example. it converts a stateful thing into an immutable sequence. The code that consumes the seq does not need to care what the seq comes from, only the part which calls the seq-consuming function needs to deal with closing the input stream and any exceptions. |
| 03:58 | brehaut | just did a rewrite of my syntax highlighter brush; the parser now correct attaches all the prefix symbols to the following form |
| 03:58 | brehaut | (not that it does anything with them yet) |
| 03:59 | keith_ | From listening to Rich's videos and what not I can understand why mutable objects (in the sense of Date, String, etc.) are bad. I'm having trouble understanding how things like web-servers or user-interfaces should be written |
| 04:00 | brehaut | keith_: leaving aside database access, a web app (and server) is actually a pretty good example |
| 04:00 | brehaut | you have a narrow interface to the world that deals with mutable state (handling sockets, accepting incoming data) |
| 04:00 | clojurebot | datatype is see datatypes |
| 04:01 | keith_ | so if I were to write a UI for another programmer to consume. In OOP he'd get a class. In clojure he'd get a function that took a socket? |
| 04:01 | Wild_Cat | brehaut: indeed, webapps are mostly stateless, due to HTTP's own stateless nature. GUI apps, OTOH, are another problem. |
| 04:01 | keith_ | s/UI/web-server |
| 04:03 | brehaut | keith_: i dont understand the question |
| 04:03 | keith_ | If I were writing a web-server for another programmer to use. What is the programmatic interface I would give him? |
| 04:03 | brehaut | Wild_Cat: thats like saying 'inherent state is inherent'! |
| 04:04 | amalloy | Chousuke: line-seq isn't a very good example, because it's not the case taht only the seq-producing code neads to deal with closing the file |
| 04:04 | brehaut | Wild_Cat: you can still remove accidental state, just like you can in a web service. it happens that you'll probably remove less, but thats beside the point |
| 04:04 | brehaut | keith_: is the other programmer using the web server to build a website? |
| 04:05 | keith_ | sure I guess, or maybe a web-service or restful API. whatever |
| 04:05 | brehaut | keith_: because if so, id expect the web server to respect the ring interface, where a server is passed a single function that takes a map representing the request and returns a map representing the response |
| 04:06 | keith_ | and it calls that function for each request? |
| 04:06 | brehaut | eg, heres how you start up a jetty webserver with the ring adapter: (run-jetty your-website-handler {:port 8000}) |
| 04:07 | brehaut | your-website-handler is just a function |
| 04:07 | brehaut | a really simple website might be |
| 04:07 | brehaut | (defn your-website-function [req] {:status 200 :headers {} :body "Hello, world!"} ) |
| 04:07 | brehaut | keith_: yes |
| 04:08 | Wild_Cat | of course, that function will have to, at some point, query a database and/or modify session vars, and that's where the mutability is concentrated. |
| 04:09 | amalloy | or a slightly more involved example: (defn your-website-function [req] {:status 404 :headers {} :body (str "Sorry, I couldn't find " (:uri req))}) |
| 04:09 | amalloy | Wild_Cat: if you drop "of course" and replace "will have to" with "might", that's more accurate :P |
| 04:10 | amalloy | for example, you could snarf the whole db into memory at load time and present a read-only view of it, like for elephantdb |
| 04:10 | Wild_Cat | amalloy: well, I ignored static websites for the purposes of this discussion, because static websites are by definition immutable ;) |
| 04:11 | Wild_Cat | likewise read-only DBs ;) |
| 04:11 | Wild_Cat | you shouldn't need mutable state to represent/render immutable data. |
| 04:12 | brehaut | Wild_Cat: and yet, if you were to use python or java or ruby, you would have buckets of the stuff |
| 04:12 | brehaut | (where 'the stuff' is mutable data) |
| 04:13 | Wild_Cat | brehaut: not really, no. In Python I'd simply start up a template engine, make a quick query to an ORM and presto. |
| 04:13 | Wild_Cat | however, Python doesn't *enfore* immutability. |
| 04:13 | Wild_Cat | enforce* |
| 04:13 | brehaut | Wild_Cat: neither does clojure |
| 04:13 | brehaut | this isnt haskell |
| 04:13 | keith_ | but maps are immutable |
| 04:13 | Wild_Cat | brehaut: but most of its data structures are immutable, though? |
| 04:14 | brehaut | Wild_Cat: sure, but thats not the same as enforcing immutability |
| 04:14 | Wild_Cat | I mean, you have to explicitly declare stuff as mutable (or use Java classes but it's cheating), right? |
| 04:15 | brehaut | if you mean, you can suddenly treat an immutable datastructure as mutable, well of course, but mutabilty is available trivially, (and as an asside, java classes are not 'cheating' in clojure; java is first class) |
| 04:16 | brehaut | ,(let [a (atom 1)] (prn @a) (reset! a 2) (prn @a) nil) |
| 04:16 | clojurebot | 1 |
| 04:16 | clojurebot | 2 |
| 04:16 | brehaut | trivial mutable state, and i can stick that anywhere in my program as needed (although i would try not to) |
| 04:17 | clgv | brehaut: yes you can. ;) but make sure that you really need it |
| 04:17 | brehaut | in contrast, if you were to try that in haskell you would be required (by the type system) to use either IO, STM or ST monads |
| 04:19 | brehaut | Wild_Cat: thing is, basically every non trivial program has state. its inherent in the whole endeavor. the important thing is that where possible the only state in the program is related to the actual problem at hand, and no accidental state forced upon you by the tools. |
| 04:21 | keith_ | I'm just too used to gluing objects together inside of other objects |
| 04:21 | amalloy | keith_: it's super-easy to shove maps inside of other maps instead :) |
| 04:21 | clgv | keith_: it takes a few weeks programming clojure to get rid of that ;) |
| 04:21 | brehaut | and functions inside other functions! |
| 04:22 | amalloy | true that. i love higher-order functions |
| 04:22 | keith_ | brehaut: I'm starting to see why function composition ACTUALLY works when OOP is so frustrating |
| 04:22 | amalloy | i can't really think usefully at even the third order, but second-order functions are immensely useful all over |
| 04:22 | brehaut | amalloy: +1 |
| 04:23 | keith_ | but, take the user-interface example, I still don't quite understand how I would abstract something like that |
| 04:23 | brehaut | im not entirely sure i even know what a third order function is |
| 04:23 | amalloy | brehaut: a function that takes, or returns, a second-order function |
| 04:23 | keith_ | coming from environments where I would sub-class Control/Widget/Whatever |
| 04:23 | amalloy | according to whatshisname |
| 04:23 | brehaut | keith_: you'd have a couple of reference types holding coarse grained immutable data, and you'd defereference it when you need to update the view, |
| 04:24 | keith_ | dereference meaning getting a value? |
| 04:24 | brehaut | good old whatshisname |
| 04:24 | brehaut | keith_: yes |
| 04:24 | brehaut | @ is the deference operator |
| 04:24 | amalloy | $google sixth order functions parser combinators |
| 04:24 | lazybot | [Even Higher-Order Functions for Parsing or Why Would Anyone ...] http://www.eecs.usma.edu/webs/people/okasaki/jfp98.ps |
| 04:24 | brehaut | well, reader thingimy |
| 04:24 | clojurebot | is translated to unquote by the reader, and as ` is expanded it is removed |
| 04:24 | keith_ | ya I saw that. So that's intended to be used with things like atom then? |
| 04:24 | amalloy | brehaut: okasaki, apparently |
| 04:24 | brehaut | amalloy: wow. this looks like brain bending |
| 04:25 | amalloy | yeah, i don't think i finished reading it |
| 04:25 | brehaut | all the ML is hurting my simple brain |
| 04:26 | brehaut | curiously, it appears that straight forward lambda calculus never steps below second order |
| 04:26 | alex_baranosky | ~ml |
| 04:26 | clojurebot | XmL is case-sensitive |
| 04:27 | brehaut | alex_baranosky: Meta Langauge; the family containg ocaml, sml, F# and distantly Haskell |
| 04:27 | amalloy | brehaut: i don't think that's true, is it? you can add two numbers in lambda calculus without involving function composition, i thought |
| 04:28 | alex_baranosky | brehaut: I don't do the ~ thing to learn... mostly just to see what silly thing ClojureBot will come up with :) |
| 04:28 | brehaut | amalloy: but every number is itself a function right? |
| 04:28 | keith_ | in lambda calc aren't numbers just functions? |
| 04:28 | brehaut | alex_baranosky: aha |
| 04:29 | brehaut | i really need to head to bed |
| 04:29 | brehaut | i fear i may have extremely higher order nightmares |
| 04:29 | keith_ | brehaut: thanks for the help |
| 04:29 | brehaut | no worries |
| 07:09 | clgv | which is the fastest way to create a hashmap from key-value-pair data (large) read from disk? |
| 07:13 | lucian | clgv: a lazy map backed by mmap might work, but i don't even know if java provides mmap |
| 07:13 | clgv | lucian: no, I meant I already have the data read and want to create a clojure map |
| 07:14 | lucian | i see. don't know what would be faster then |
| 07:16 | clgv | clojure.lang.PersistentHashMap/createWithCheck seems to consume a lot of time |
| 07:21 | clgv | oh it has a create-method for something implementing java.util.Map as well |
| 07:34 | raek | clgv: something like this? (loop [m {}] (if (end-of-file? ...) m (let [key (read-from-file), val (read-from-file)] (recur (assoc m key val))))) |
| 07:35 | raek | or perhaps (into {} (sequence-of-pairs-from-file)) |
| 07:36 | raek | where that sequence can be lazy |
| 07:36 | clgv | raek: no thats already done. actually I have a java.util.HashMap and want a clojure hash-map. but that seems to consume a lot of time |
| 07:37 | raek | so constructing a clojure hash map takes too long time? |
| 07:38 | raek | clgv: have you tried if a transient clojure hash map sovles the problem? |
| 07:39 | clgv | raek: yeah, actually I just change that conversion to clojure.lang.PersistentHashMap/create - it's still slow and I currently prepare the benchmarkrun |
| 07:41 | clgv | fyi: create uses EMPTY.asTransient() |
| 07:45 | clgv | I only read a total of 5.6MB and its lasting pretty long |
| 07:57 | clgv | ok, the previous map related bottleneck is solved. now there is the problem that I cant write a defrecord in clojure 1.2.1 - so I store it as a normal hashmap and use into to get the data back into the instance - thats pretty damn slow. |
| 07:57 | clgv | most of the time is now spend in the reduce of into |
| 07:58 | clgv | can I do any transient stuff on the map implementation part of a defrecord? |
| 08:00 | raek | clgv: btw, what was the previous map related bottleneck? |
| 08:02 | clgv | raek: I replace the previous conversiobn from java.util.HashMap with (clojure.lang.PersistentHashMap/create java-hash-map) - before it used clojure.lang.PersistentHashMap/createWithCheck implicitly |
| 08:09 | clgv | I noticed that since a week or two the rendering of clojure's core.clj on github is pretty time consuming. did anyone experience this, too? |
| 08:11 | cemerick | clgv: using a transient hashmap will likely help your loading issues, and be cleaner than mucking with PHM static methods. |
| 08:22 | michael_campbell | are there any rules of thumb as to when to use cond vs if? Is it when you have > 2 decision paths or something? |
| 08:23 | jcromartie | michael_campbell: that's it exactly |
| 08:23 | jcromartie | michael_campbell: also, condp is even more powerful |
| 08:24 | michael_campbell | didn't know about that one yet... going to look =) Thanks |
| 08:25 | clgv | michael_campbell: 'cond expands to nested 'if statements so you may use it whenever it provides better readability |
| 08:26 | michael_campbell | Thanks. Is the :else keyword in cond used more or less where 't would have been in lisp? |
| 08:27 | clgv | michael_campbell: you only need to provide something truthy for the "catch all others" clause - it does not have to be an :else |
| 08:28 | michael_campbell | Gotcha. |
| 08:59 | Borkdude | I'm reading in the book Clean code about the opposites between procedural and OO. When adding new functions, procedural has no problem, but when new datastructures are added, functions must change to deal with them. In OO you can add new datastructures (classes) without changing code (polymorphism), but when you want to introduce new functions, code has to change. What is Clojure's take on this again? Have few datastructures and a lot |
| 08:59 | Borkdude | of functions? |
| 09:04 | duck1123 | clojure has a lot of functions that work with many different datatypes |
| 09:05 | Borkdude | duck1123: say I want concat to work with my own datastructures... the take would be that my datastructure would implement ISeq right? And then we're back in OO. |
| 09:05 | duck1123 | and most of the time, you use the standard clojure datatypes instead of inventing new ones. Instead of a class, you just use a hash map |
| 09:06 | duck1123 | Borkdude: are you defining this type in Clojure or in something like java? |
| 09:07 | Borkdude | duck1123: preferably in clojure itself |
| 09:07 | ohpauleez | Borkdude: Clojure's approach is to have 100 functions that operate on 10 abstractions |
| 09:08 | ohpauleez | You apply transformations to generic data - that data is built up (or fulfills) certain abstractions |
| 09:09 | duck1123 | Borkdude: you might want to look at defrecord if you want something map-like (holds key/vals) but is also typed |
| 09:09 | ohpauleez | if you want to build a low level data structure, you can, but you'll probably find that hash maps, sorted maps, vectors, finger trees, and records give you all you need |
| 09:09 | Borkdude | duck1123: do most functinos in clojure work on self defined records? |
| 09:09 | duck1123 | but chances are, you don't even need the type and Clojure's data structures would work for you |
| 09:09 | ohpauleez | if you need a certain functionality from these generic data structures, you make a new abstraction, and extend their functionality |
| 09:11 | Borkdude | I guess I would have to see an example of this to understand this more |
| 09:11 | duck1123 | Borkdude: most functions just work on sequences or maps, or whatnot. and don't really care what the type is, so long as it can do it's transformation |
| 09:12 | Borkdude | duck1123: what is the underlying type of a defrecord, a hash map? |
| 09:12 | duck1123 | yes |
| 09:12 | duck1123 | at least, they act like maps |
| 09:12 | ohpauleez | Borkdude: you should stop thinking of underlying types, and instead underlying abstractions |
| 09:12 | licenser | dun dun dun |
| 09:12 | Borkdude | duck1123: then why would I use that? (I never felt the need so far) |
| 09:13 | ohpauleez | Borkdude: You want to frame your problem using verbs, not the kingdom of nouns |
| 09:14 | Borkdude | ohpauleez: that's how I mostly do Clojure, I never felt the problem, but I was just wondering since I'm reading this book ;-) |
| 09:16 | ohpauleez | Borkdude: Records just fulfill protocol for map-like lookups |
| 09:16 | duck1123 | Borkdude: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/ |
| 09:16 | ohpauleez | so that they map interface when you use them |
| 09:16 | cemerick | more translations always wanted on that, BTW ^^ |
| 09:16 | cemerick | :-) |
| 09:17 | TimMc | gfredericks: I might fork your lib-2367 and try adding getters to the macro, and maybe some support for isFoo for boolean fields. |
| 09:17 | Borkdude | duck1123: cemerick awesome |
| 09:18 | Borkdude | cemerick: translations? |
| 09:18 | cemerick | Portugese and Japanese translations are linked near the bottom. |
| 09:18 | Borkdude | cemerick: I could make a Dutch one if you'd like |
| 09:18 | cemerick | I should get Christophe to do one in French. |
| 09:18 | cemerick | Borkdude: If you make it, I'll link it. :-) |
| 09:19 | Borkdude | cemerick: in what program did you make it, Omnigraffle ? |
| 09:19 | duck1123 | I could probably get it translated to Lojban, but it's doubtful that would help anyone |
| 09:19 | cemerick | yeah |
| 09:19 | cemerick | Borkdude: I can send you the source file if that would help |
| 09:20 | Borkdude | cemerick: sure, I'll download the 14 day trial and change the text |
| 09:20 | licenser | cemerick: I could offer german :) |
| 09:21 | duck1123 | so where's the clojure program that will generate this as SVG? |
| 09:22 | cemerick | Borkdude, licenser: msg me your email addresses, I'll share a dropbox folder with you that contains the source diagram :-) |
| 09:22 | Borkdude | cemerick: how do I send a private message in emacs / erc? ;) |
| 09:22 | cemerick | do => /msg cemerick <your email addy> |
| 09:23 | Borkdude | done |
| 09:23 | raek | cemerick: I can provide a Swedish translation |
| 09:28 | cemerick | raek, Borkdude: licenser had a much better idea — I'll just create a github project and take pull requests. Don't know why I didn't think of that to start. :-P |
| 09:29 | Borkdude | cemerick: ok |
| 09:29 | licenser | cemerick: to make me feel smrt! |
| 09:30 | Borkdude | cemerick: maybe you could externalize the text somehow, so it would be easier for people to provide the text, without having a Omnigraffle license? |
| 09:30 | cemerick | hrm |
| 09:31 | Borkdude | cemerick: don't know how much trouble that is, or if it is possible at all |
| 09:31 | Borkdude | cemerick: we could write some clojure code that generates latex maybe instead |
| 09:31 | cemerick | It's all XML, so I think it's easily editable without omnigraffle anyway |
| 09:31 | Borkdude | cemerick: ooh that's good, problem solved |
| 09:34 | hugod | ot: if anyone can help me getting conkeror to work on lion, could you msg me… |
| 09:43 | cemerick | Borkdude, licenser, raek: See https://github.com/cemerick/clojure-type-selection-flowchart — just copy the top-level graffle file to a corresponding language-specific version in /translations, and edit there; omnigraffle would be easiest, but if you take a run at adding translations via editing the XML directly, I'll be happy to produce a corresponding png |
| 09:43 | licenser | cool cool :) |
| 09:52 | Borkdude | cemerick: working on it. Just a question. What do you mean with "statically refer to" |
| 09:52 | shtutgart | how can i find out what version of clojure.tools.macro (and other) available? There is <version>0.1.2-SNAPSHOT</version> in the pom.xml, but [org.clojure/tools.macro "0.1.2-SNAPSHOT"] doesn't work |
| 09:53 | cemerick | Borkdude: be able to use the name of a class within a JVM language source file that is to be processed via static compilation (e.g. Java) |
| 09:53 | cemerick | s/Java/Java + javac |
| 09:55 | joegallo | shtutgart: http://search.maven.org/#search|ga|1|a%3A%22tools.macro%22 |
| 09:56 | joegallo | which is to say -- go here http://search.maven.org/#search|ga|1| and then type tools.macro in the search field ;) |
| 09:57 | joegallo | alternatively, if you are using leiningen, you can lein search tools.macro |
| 09:59 | duck1123 | 0.1.2-SNAPSHOT is on sonatype https://oss.sonatype.org/content/repositories/snapshots/org/clojure/tools.macro/ |
| 10:01 | shtutgart | joegallo: thanks, I should remember lein search command :) |
| 10:01 | joegallo | you're welcome! |
| 10:09 | Borkdude | cemerick: I'm almost done, wondering how Omnigraffle will take care of ë in XML |
| 10:10 | raek | I have similar conserns... |
| 10:12 | duck1123 | If I have a file containing a large clojure data structure, what's the best way to read that into a var? |
| 10:12 | raek | Borkdude: just make sure the text is encoded in UTF-8 (the encoding which the xml file declares that it uses) |
| 10:15 | Borkdude | cemerick: https://github.com/Borkdude/clojure-type-selection-flowchart can you try to compile that graffle? |
| 10:15 | TimMc | or Clojure AOT, yeah? |
| 10:16 | TimMc | (sorry, replying to scrollback -- referring to "statically refer to") |
| 10:18 | Borkdude | cemerick: wait, I installed omnigraffle now |
| 10:18 | Borkdude | and I see it's not yet perfect |
| 10:19 | Borkdude | cemerick: what exactly do you mean "associated with performance sensitive" |
| 10:19 | Borkdude | cemerick: do you mean: instance of the type will be used in performance sensitive situations? |
| 10:25 | cemerick | Borkdude: yes |
| 10:26 | cemerick | the .graffle file is omnigraffle's native format |
| 10:29 | raek | cemerick: I see that this flowchart never recommends 'reify' for pure-clojure uses |
| 10:29 | Borkdude | cemerick: graffle is on my repo |
| 10:30 | cemerick | raek: you mean with protocols? Yeah. |
| 10:31 | cemerick | it's already complex enough, and I didn't want to try to reorganize the layout yet again :-P |
| 10:32 | cemerick | a rare enough use case that I didn't feel bad about not including it. |
| 10:32 | cemerick | (so goes my justification anyway) |
| 10:35 | Borkdude | cemerick: sorry I send two pull requests, one when I didn't have the png on it. I also added the .graffle file for my own good. |
| 10:37 | Borkdude | I last used omnigraffle in 2005 :) |
| 10:40 | raek | cemerick: yeah, simple is good |
| 10:44 | raek | I really want to have a one-syllable word for "map" in Swedish... |
| 10:44 | lucian | i hate how the word map is overloaded, especially in functional languages |
| 10:45 | Borkdude | raek: I tend to not translate those words, because they are concepts in clojure itself |
| 10:45 | raek | "avbildning" is probably the correct translation, but unless you have been to a university you have probably never heard of it |
| 10:46 | raek | we just say "map" [mäp] in Linköping Clojure User Group :-) |
| 10:47 | TimMc | Hmm, the ä doesn't show up correctly on my work machine. |
| 10:48 | TimMc | Time to blame Linux Mint again! |
| 10:49 | lucian | TimMc: i'd blame your client |
| 10:52 | TimMc | lucian: Client is irssi under screen via SSH. |
| 10:52 | TimMc | Everything looks fine from my personal laptop. |
| 10:52 | lucian | right, so lots of things on the way to potentially fuck up :) |
| 10:53 | lucian | i bet on your terminal |
| 10:53 | TimMc | true |
| 10:55 | broquaint | Looks good from here with the same setup, TimMc, FWIW. |
| 10:57 | rafl | broquaint: o/ |
| 11:03 | broquaint | o/ :) |
| 11:05 | cemerick | Borkdude: thanks! 2 things: (a) Feel free to add attribution to the png/graffle if you like, and (b) could you squash those commits into one? |
| 11:05 | Borkdude | cemerick: ok, wait a moment. |
| 11:06 | Borkdude | cemerick: I'm kind of a git n00b, how do I do this |
| 11:06 | cemerick | git rebase -i chas-origin/master |
| 11:06 | cemerick | You can then squash two of the commits and then give a single comment for the result |
| 11:07 | cemerick | lucian: once they become public, sure; before then, might as well to make the progression of things clear |
| 11:08 | michael_campbell | TimMc: I see the umlauted 'a' fine in linux mint on xchat. |
| 11:08 | lucian | cemerick: i still don't like it much :) i also use hg, that might be a factor |
| 11:08 | lucian | michael_campbell: same here, ubuntu xchat |
| 11:09 | michael_campbell | TimMc: I'm on Mint 11 though; you said you use 10, right? |
| 11:10 | Borkdude | cemerick: fatal: Needed a single revision |
| 11:10 | Borkdude | Invalid base |
| 11:10 | TimMc | michael_campbell: Yeah. |
| 11:11 | Borkdude | cemerick: what I did was a fork on github |
| 11:11 | Borkdude | cemerick: and then cloned it on my machine, edited |
| 11:11 | Borkdude | cemerick: and pushed |
| 11:21 | TimMc | OK, let's say you have a lazy seq of strings. Is there a better way than (doseq [s seq-of-str] (print s)) to print all the strings without holding onto the head? |
| 11:22 | TimMc | "Better" meaning clearer to the programmer or possibly more efficient. |
| 11:28 | fliebel | drewr: What does your map look like for multipart messages? |
| 11:29 | fliebel | TimMc: hm, this looks fine, but an alternative could be ##(dorun (map print ["foo" "bar" "baz"])) |
| 11:29 | lazybot | ⇒ foobarbaznil |
| 11:37 | kephale | fliebel: any reason to use a dorun there instead of a doall? |
| 11:38 | TimMc | kephale: dorun drops the head, I think |
| 11:38 | TimMc | fliebel: I think that expresses it better, thanks. |
| 11:39 | kephale | ooo good to know |
| 11:41 | TimMc | &(doall (map print (range 5))) |
| 11:41 | lazybot | ⇒ 01234(nil nil nil nil nil) |
| 11:41 | TimMc | &(dorun (map print (range 5))) |
| 11:41 | lazybot | ⇒ 01234nil |
| 11:41 | kephale | gotcha |
| 11:41 | TimMc | THe purpose of doall is to realize an entire lazy seq. |
| 11:42 | TimMc | and give it back to you. |
| 11:43 | kephale | but doseq holds onto the head? |
| 11:43 | TimMc | I think not. |
| 11:43 | TimMc | ,(doc doseq) |
| 11:44 | clojurebot | "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil." |
| 11:44 | kephale | mmm… |
| 11:45 | TimMc | (doseq [x s] foo) is like (dorun (map #(fn [x] foo) s)) |
| 11:45 | kephale | right, so i'm kind of unclear why you would switch to dorun/map from doseq |
| 11:46 | TimMc | I'm not sure either! |
| 11:46 | kephale | lol |
| 11:46 | duck1123 | doseq conveys the intention better |
| 11:47 | TimMc | Maybe. |
| 11:48 | TimMc | (doseq [x strs] (print x)) vs. (dorun (map print strs))... meh. They're pretty similar, aren't they. |
| 11:49 | kephale | doseq is actually kind of longer |
| 11:50 | duck1123 | is there a performance difference maybe? |
| 11:51 | kephale | kind of hard to tell, the code for doseq is relatively long |
| 11:52 | TimMc | I don't like having to name the "x". |
| 11:53 | kephale | agreed |
| 11:54 | Borkdude | paradoxically x usually stands for something unnamed ;) |
| 11:56 | duck1123 | It's funny. I was changing a block of my code from a map to a doseq right when this topic started |
| 11:57 | tsdh | When I have a symbol naming a namespace, how do I get the namespace? |
| 11:59 | fliebel | tsdh: find-ns? |
| 11:59 | fliebel | Why does derive require namespaced keywords? |
| 12:00 | tsdh | fliebel: Yes, that works. Thx |
| 12:07 | Borkdude | amalloy_: can I ask you in what way you prevent your own settings from a dev branch to be merged in with master's config.clj in 4clojure? |
| 12:08 | Borkdude | or anyone else |
| 12:14 | duck1123 | Borkdude: http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html |
| 12:16 | Borkdude | duck1123: that's another way, but then I would have to do it for every time I would branch from master |
| 12:17 | Borkdude | duck1123: the thing I want to make sure it that the config.clj is never changed, without having to think about it ever again |
| 12:17 | Borkdude | in master that is |
| 12:18 | duck1123 | Borkdude: I don't know of any foolproof ways other than just taking care of what you're staging |
| 12:20 | Borkdude | duck1123: I read this answer on SO, http://stackoverflow.com/questions/928646/how-do-i-tell-git-to-always-select-my-local-version-for-conflicted-merges-on-a-s |
| 12:20 | Borkdude | duck1123: it uses .gitattributes, but I wondered what way is used in the 4clojure project exactly |
| 12:21 | Borkdude | duck1123: there are several ways, I want the most git idiomatic one ;) |
| 12:22 | duck1123 | In one pof my projects, I keep config.clj out of git and have it ignored, then I require the user to rename the sample file. I don't know what you'd do if the config file is already checked in like that |
| 12:23 | duck1123 | of course the issue with that is I'll make new config options and then forget to add them to the template |
| 12:24 | Borkdude | duck1123: that problem would also exist with the SO solution |
| 12:25 | arohner | is there any way to control the user> prompt on slime? I'd love to change it to the hostname of the box I'm connected to |
| 12:27 | duck1123 | arohner: repl takes a :prompt param. IIRC lein has a way to set the repl options |
| 12:27 | duck1123 | :repl-options [:prompt (fn [] (print "your command, master? ") (flush))] |
| 12:28 | arohner | duck1123: thanks, but I think I need something different for slime |
| 12:36 | duck1123 | I wish korma translated dashes to underscores. It hurts my head to do things like :venue_type_id in clojure |
| 12:37 | duck1123 | I need to start playing with the transform option more |
| 12:41 | Borkdude | Just wondering, what is the origin (and exact meaning) of the expression "Blabla 101".. "in the very beginning of blabla"? |
| 12:41 | nDuff | Borkdude, 101 is the usual course number for introductory classes |
| 12:41 | Borkdude | nDuff: in what country |
| 12:41 | nDuff | Borkdude, the United States, at least; can't comment elsewhere. |
| 12:42 | Borkdude | nDuff: really, they have a system that actually saves a course id like "Blabla 101", and the next one is "Blabla 201" or ".. 102"? |
| 12:42 | duck1123 | More that it's considered the introductory class. Few schools actually have a 101, oddly |
| 12:43 | duck1123 | I guess that's an overly broad statement |
| 12:43 | Borkdude | it has become a standard expression, I first thought it referred to a "one on one class setting" |
| 12:43 | Borkdude | like private lessons |
| 12:43 | nDuff | Borkdude, 200- and 300-level classes typically refer to the year in which students are expected to take them -- at the university I attended, taking 300-level classes before one's second year required faculty permission |
| 12:43 | nDuff | (err, before or during) |
| 12:44 | Borkdude | nDuff: ah ok |
| 12:44 | Borkdude | duck1123: what is a broad statement, that it's a standard expression? |
| 12:44 | Borkdude | duck1123: I've seen it a lot lately, especially in the context of programming tutorials |
| 12:46 | nDuff | ...been a while, though, such that I'm not sure of the extent to which my memory can be trusted. |
| 12:46 | Borkdude | ok, got that cleared up then |
| 12:46 | Borkdude | I read here in this book: "We learned in OO 101 that there are concrete classes"... |
| 12:49 | bhenry | anyone run into ie problems with clojurescript yet? |
| 12:49 | bhenry | s/anyone/anyone_else |
| 12:51 | Borkdude | bhenry: I haven't, but that's only because I didn't use it yet ;) |
| 12:51 | duck1123 | users of IE deserve what they get |
| 12:52 | bhenry | duck1123: unfortunately driven by corporate policy : / |
| 12:52 | duck1123 | stupid corporate policy... |
| 12:54 | bhenry | seriously |
| 12:55 | Borkdude | IE6 was the reason I quit doing anything with html, javascript or css for a few years |
| 12:55 | bhenry | clojure.browser.dom/log is using js/console and apparently that's undefined in ie. |
| 12:55 | bhenry | Borkdude: i hear that. |
| 12:56 | Borkdude | I'm still recovering |
| 12:56 | duck1123 | does that undefined actually cause errors? or is it just an ignorable warning? |
| 12:59 | samaaron | cemerick: are you about? |
| 12:59 | cemerick | I am. |
| 12:59 | samaaron | cemerick: I wrote a TRULY HORRIBLE wav concat example in Overtone |
| 13:00 | bhenry | duck1123: it stops other things from working. |
| 13:00 | cemerick | heh |
| 13:00 | cemerick | samaaron: can't be *that* bad :-) |
| 13:00 | samaaron | cemerick: it worked though |
| 13:00 | cemerick | you also said overtone couldn't make music :-P |
| 13:00 | samaaron | cemerick: yeah, it's really bad :-) |
| 13:01 | cemerick | well, you beat me to it. I was going to take a look tomorrow. |
| 13:01 | cemerick | All of the docs are for wav -- is aiff not supported? Or does it really matter? |
| 13:01 | bhenry | if i change clojurescript source locally, do i have to run script/bootstrap again for those changes to take effect when compiling my cljs in projects? |
| 13:01 | samaaron | cemerick: https://gist.github.com/1373905 |
| 13:02 | samaaron | cemerick: SuperCollider can read in a bunch of stuff - wav and aif are definitely supported |
| 13:02 | samaaron | this snippet will always output a wav file though |
| 13:02 | samaaron | regardless of what it reads in |
| 13:02 | wastrel | :[ |
| 13:03 | cemerick | samaaron: surely that's not core's concat? From audio-file or live? |
| 13:03 | samaaron | cemerick: yep, that's core's concat |
| 13:03 | cemerick | you tricksy bastard ;-) |
| 13:04 | samaaron | I told you it was horrible ;-) |
| 13:04 | cemerick | so is it boxing each datum from the respective samples? |
| 13:04 | cemerick | must be! |
| 13:04 | hugod | samaaron: what do you use to generate your ascii-art? |
| 13:05 | fliebel | $mail drewr I did some email reading stuff. Not as part of Postal for now. https://github.com/pepijndevos/Wemail/blob/master/src/wemail/store.clj |
| 13:05 | lazybot | Message saved. |
| 13:05 | samaaron | I use SC to load up the source files, I then copy the normalised data across to Clojure-land through jna which comes as a Java float array, I then concat them and use JVM libs to spit out a wav file (which is currently horrendously inefficient) |
| 13:05 | samaaron | hugod: hey there, it was great meeting you at the conj |
| 13:05 | devn | samaaron: is there a way, given a sample, like for instance, say I record some guitar without a metronome and then I want to fit a midi drum track to the length of the sample |
| 13:06 | devn | is that possible programatically? I know it doesn't guarantee it will sound /good/, just curious how I might do that |
| 13:06 | samaaron | hugod: I was using some awful online image->ascii conversion site and then hand cleaning things in Emacs |
| 13:06 | cemerick | samaaron: that's OK, I can heat the house with my macbook instead of oil for a day… :-D |
| 13:07 | cemerick | samaaron: BTW, I need bumpers :-) Otherwise, I'm gonna use a one-line wobble. :-P |
| 13:07 | hugod | samaaron: likewise - it was a blast meeting you and everyone else |
| 13:08 | devn | wob wob wob, dubstep |
| 13:08 | samaaron | hugod: however I discovered this awesomely awful ascii art editor the other day |
| 13:08 | devn | samaaron: JavE? |
| 13:08 | zerokarmaleft | TheDraw! |
| 13:09 | Bronsa | EMACS |
| 13:09 | samaaron | devn: exactly! |
| 13:09 | devn | samaaron: Don't upgrade to lion! |
| 13:09 | devn | (if you're on OSX) |
| 13:09 | devn | Rosetta apps are canned in 10.7 :( |
| 13:09 | devn | Hence, no more JavE |
| 13:09 | samaaron | cemerick: bumpers are on tonight's todo list. Uni got me running round chasing admin chores today :-( |
| 13:09 | devn | JavE is the best I've seen |
| 13:10 | samaaron | devn: I got JavE working on lion |
| 13:10 | devn | ! how!? |
| 13:10 | cemerick | samaaron: bummer; no worries in any case :-) |
| 13:10 | samaaron | devn: I don't quite understand your sample/midi question |
| 13:10 | clojurebot | tufflax: there was a question somewhere in there, the answer is no |
| 13:11 | devn | samaaron: I'd like a "phrase" of drums to expand to fit the length of a sample |
| 13:11 | samaaron | devn: It's totally possible to calculate the duration of a recorded sample in Overtone |
| 13:12 | devn | samaaron: I'll have to look into it more I guess -- I knew that was possible, I just didn't know if this was a normal thing to do or if I'm just bad at recording stuff :) |
| 13:12 | samaaron | devn: stretching the drums out (whether algorithmically generated or pre-recorded) would be trivial. However, correctly aligning them to the sample would be more tricky |
| 13:12 | samaaron | hugod: http://www.jave.de/ |
| 13:12 | devn | samaaron: yeah, im starting to walk down that path -- I was thinking I could train it with my spacebar or something |
| 13:13 | samaaron | devn: there are basic ugens for beat detection if i remember correctly |
| 13:13 | hugod | samaaron: thanks - working nicely in lion here too |
| 13:13 | kephale | does anyone happen to know what the arguments to the constructor of java.nio.DoubleBuffer are? I can't find them for the life of me |
| 13:13 | devn | hugod: samaaron: are you guys just running the jar? |
| 13:13 | samaaron | hugod: the interface is ass - but I guess that's to be expected for an ascii-art editor ;-) |
| 13:14 | samaaron | devn: yep, I just double clicked it |
| 13:14 | devn | hmph, that's great -- the OSX version is no longer working, but if you just grab the jar it works |
| 13:15 | michael_campbell | all the doublebuffer ctors are package-private |
| 13:15 | samaaron | here's the result of an hour or so of futzing around with JavE: https://gist.github.com/2ee0b48436038208ee8a |
| 13:16 | michael_campbell | kephale: but the argsa are int mark, int pos, int lim, int cap, double[] hb, int offset |
| 13:16 | cemerick | shouldn't the UI for an ascii-art editor be build out of ascii? |
| 13:16 | michael_campbell | kephale: or: int mark, int pos, int lim, int cap which calls the other one with null and 0 for hb and offset |
| 13:16 | kephale | michael_campbell: thank you! |
| 13:17 | michael_campbell | kephale: my pleasure |
| 13:17 | samaaron | cemerick: btw, the audio concat code i gisted only works on edge Overtone - the edge version on my machine that is - i'll push in a moment |
| 13:17 | samaaron | cemerick: not if you find it useful to have rendered images in a lower layer to work with |
| 13:18 | cemerick | samaaron: that was *mostly* snark ;-) |
| 13:18 | cemerick | samaaron: OK, I'll see if I can interpose fade-in, fade-out transitions then |
| 13:18 | samaaron | cemerick: of course, Emacs has artist-mode |
| 13:18 | cemerick | of course! :-P |
| 13:19 | cemerick | Raynes: man, what did you do to rickasaurus? |
| 13:19 | devn | so I have JavE again -- of course the first logical thing to do is make a great clojure ascii art logo |
| 13:19 | samaaron | cemerick: now, fade-in, fade-out are in standard Overtone terratory. Although you'll be working in real time. We don't run SC in non-realtime mode (which would allow for fast audio rendering stuff like this) |
| 13:20 | cemerick | ah |
| 13:20 | samaaron | cemerick: remember, Overtone is about live production and manipulation of audio - not so much editing of actual audio |
| 13:20 | samaaron | devn: did you see my link? |
| 13:22 | samaaron | OK, I'm going to bike home - chat later |
| 13:23 | devn | samaaron: ha! I'm going to make one too :) |
| 13:27 | Raynes | cemerick: Dude. I don't know! |
| 13:28 | cemerick | Raynes: I know him fairly well, used to work 10 minutes from here. Super-nice guy, not sure what to say. |
| 13:29 | Raynes | cemerick: He went nuts last night. He tweeted about his desire to use redis, but that he was worried it wouldn't be able to handle the volume of data he wanted. I replied with "I'm sure it can handle the megabyte of data you keep under your pillow.". |
| 13:29 | cemerick | yeah, I thought that was in character :-) |
| 13:29 | Raynes | I guess I didn't realize it, but that was the most tasteless joke I've ever made or something. |
| 13:29 | Raynes | But that was it. I'm not sure what I did in the past that bothered him, but that was certainly what took him over the edge last night. :p |
| 13:30 | cemerick | I guess everyone has a bad day. *shrug* |
| 13:30 | Raynes | Indeed. |
| 13:31 | Vinzent | wait, array map doesn't guarrante the ordering of elems? |
| 13:33 | cemerick | it does; if it grows past its defined bounds and turns into a hashmap, then ordering becomes undefined. |
| 13:36 | drguildo | has anyone had any success with tools.cli? |
| 13:36 | Vinzent | then why it sorts the map? http://pastie.org/2879193 |
| 13:36 | Raynes | drguildo: Lots of people. Go ahead and just ask your question. If anybody can answer it, they will. :) |
| 13:36 | drguildo | well, i basically can't get it to work |
| 13:37 | drguildo | i used the final example from the README |
| 13:37 | devn | https://gist.github.com/1374015 <-another clojure ASCII art logo :) |
| 13:37 | drguildo | but when i run it, passing -h to my program |
| 13:38 | Raynes | devn: https://github.com/Raynes/lein-newnew <-- Don't know if you saw this last night. |
| 13:38 | drguildo | the contents of *command-line-args* and options (from tools.cli/cli) are: |
| 13:38 | drguildo | (-h) |
| 13:38 | drguildo | {:help false, :faux bar} |
| 13:38 | Raynes | devn: It is backwards compatible with the old 'lein new' and shadows it, so install it and don't give me any lip about it. |
| 13:39 | drguildo | :help should totally be true |
| 13:39 | drguildo | yet it isn't |
| 13:40 | drguildo | http://pastie.org/2879215 |
| 13:40 | Raynes | Strange. Might be a tools.cli bug. A lot of things were changed recently. |
| 13:42 | tsdh | When I create a namespace with stuff programatically by creating a form like (do (ns foo) (defn foo [x] x)) and evaling it, how can I use that namespace? I can do (in-ns 'foo), but (use 'foo) errors with file-not-found foo_init.class / foo.clj... |
| 13:44 | duck1123 | tsdh: IIRC it's because clojure compiles the entire do form before running it, or some such. |
| 13:45 | TimMc | duck1123: I think that's a different thing. |
| 13:45 | tsdh | duck1123: The eval compiles it, doesn't it? And that works fine, and I can switch to the namespace. I just can't use it to make its vars accessible in the current namespace... |
| 13:46 | duck1123 | You're probably going to hit no end of problems if you're trying to dynamically generate namespaces |
| 13:48 | tsdh | duck1123: Hm, but there's no other way when you have the information to generate new Vars only at runtime. |
| 13:49 | whidden | In Clojure 1.2.1 is there an upper limit to the number of promise an app can have? |
| 13:49 | TimMc | tsdh: Really? You need a whole new namespace? |
| 13:50 | devn | Raynes: cool |
| 13:50 | tsdh | duck1123: In my case, I define core.logic relations from some data structure. That data structure has a qualified name, so I thought it would be a good idea to define the relations in a new namespace corresponding to that qname. |
| 13:51 | devn | Raynes: i'm really interested in getting some default templates into lein for new users |
| 13:52 | devn | so you could "lein init" or something which would prompt you for testing framework of choice, web framework, etc. etc. |
| 13:52 | Raynes | devn: technomancy has not expressed interest in having templates beyond the three already included. Which is understandable, given that you can install templates just like Leiningen plugins. |
| 13:52 | Raynes | But we might be able to convince him of something like that. |
| 13:53 | Raynes | An interactive template would be very interesting. |
| 13:54 | Raynes | Even if it wasn't included in Leiningen itself, it'd be a good thing to do. |
| 13:57 | Vinzent | seriously, is there a reason why (first (array-map :b 1 :a 2)) returns [:b 1] (as expected), but (first {:b 1 :a 2}) returns [:a 2]? |
| 13:58 | apgwoz | only some maps guarantee order |
| 13:58 | apgwoz | maps created with {} do not |
| 13:58 | Raynes | &(doc sorted-map) |
| 13:58 | lazybot | ⇒ "([& keyvals]); keyval => key val Returns a new sorted map with supplied mappings." |
| 13:59 | Vinzent | also, (read-string "{:b 1 :a 2}") return correct result, but after eval'ing the entries become swapped |
| 13:59 | Borkdude | Raynes: sorted here menas order preserving or really sorted and on what? |
| 13:59 | duck1123 | Vinzent: also https://github.com/flatland/ordered |
| 13:59 | brehaut | sorted maps are sorted, they are not ordered |
| 13:59 | tsdh | TimMc: Do you have a better idea? |
| 14:00 | TimMc | &(sequential? {:a 1, :b 2}) ; Vinzent |
| 14:00 | lazybot | ⇒ false |
| 14:00 | amalloy | Vinzent: maps make no guarantees at all about order, unless they're sorted. or, as duck1123 points out, ordered - but that's a data type that's not part of the core lib |
| 14:00 | tsdh | TimMc: Probably, I could write the code to a tmp file and then load that. Then, there would be a ns<->file association which use seems to require... |
| 14:01 | TimMc | tsdh: Not familiar with core.logic or what you're trying to do with it. :-/ |
| 14:01 | brehaut | amalloy: hmm. joy of clojure advertises array-maps as an ordered map implementation. |
| 14:01 | TimMc | Vinzent: http://www.brainonfire.net/files/seqs-and-colls/collection-properties-venn.png |
| 14:02 | amalloy | brehaut: rip that page out of your book and set it afire |
| 14:02 | gfredericks | amalloy: I just got clojurebot to report that: monads is #=(str "super" "awesome") |
| 14:02 | brehaut | amalloy: i dont know how to do that to a pdf |
| 14:02 | amalloy | haha probably violates your DRM anyway |
| 14:02 | gfredericks | brehaut: print it and bind it first |
| 14:02 | TimMc | brehaut: It's easy, just use a sharpie on your screen. |
| 14:02 | tsdh | TimMc: It's not specific to core.logic. It's just that I have to create a bunch of vars dynamically that should not clobber *ns*. |
| 14:03 | brehaut | i dont think manning DRM their PDFs? |
| 14:03 | TimMc | tsdh: I guess I'm not sure why you want to create Vars in the first place. |
| 14:03 | Vinzent | Thanks you all for the links and explanations... That's too bad: I was hoping to use ^:metadata syntax to describe trasnformation of the args to my macro |
| 14:04 | tsdh | TimMc: That's where core.logic comes into play. (defrel male x) is a macro that expands into a def. So it's not under my control. |
| 14:04 | amalloy | whidden: just dont' run out of heap, that's about it |
| 14:05 | TimMc | tsdh: So it's actually at load-time? |
| 14:05 | hiredman | ~shrimp |
| 14:05 | clojurebot | shrimp must be endofunctors |
| 14:06 | tsdh | TimMc: No, that there should be a relation male is information I get at runtime. |
| 14:07 | TimMc | yikes |
| 14:08 | michael_campbell | amalloy: At the beer/art thing, you had a mini-rant on the for comprehension. As a neophyte in this, can you explain to me where/when it should be used but isn't (and/or, shouldn't, but is?) |
| 14:08 | amalloy | $javadoc java.nio.DoubleBuffer ;; kephale - next time you get lost |
| 14:08 | lazybot | http://download.oracle.com/javase/6/docs/api/java/nio/DoubleBuffer.html |
| 14:09 | TimMc | ,((juxt sequential? associative? counted?) clojure.lang.PersistentQueue/EMPTY) |
| 14:09 | michael_campbell | amalloy: the javadoc didn't include ctors |
| 14:09 | clojurebot | [true false true] |
| 14:10 | kephale | amalloy: ty |
| 14:10 | amalloy | then it doesn't have any constructors |
| 14:10 | kephale | yeah |
| 14:10 | whidden | amalloy: That's what I was hoping. Thanks for the reply. |
| 14:10 | amalloy | but it has static allocate methods |
| 14:11 | kephale | but i get a ctor error |
| 14:11 | amalloy | public static java.nio.DoubleBuffer java.nio.DoubleBuffer.wrap(double[],int,int) |
| 14:11 | kephale | when i inspect the bean i see that the constructors that michael_campbell mentioned at least match in type |
| 14:13 | amalloy | michael_campbell: i mean, i mostly use for anytime i need to walk over a sequence in which i don't have a prebuilt function to do it. like (map inc foo) - great. but (for [x foo] (* 2 (- x 10))) is way nicer than (map (fn [x] (* 2 (- x 10))) foo) |
| 14:13 | kephale | ah, i'll try the wrap. the lack of explanation about what the args are is causing some problems |
| 14:13 | amalloy | kephale: http://download.oracle.com/javase/6/docs/api/java/nio/DoubleBuffer.html#wrap(double[], int, int) |
| 14:13 | Borkdude | Raynes: is there a preliminary preview of your book somewhere, if I dare ask? I'm looking for some easy introduction to Clojure for a class I'm giving next semester |
| 14:14 | Raynes | &(macroexpand (for [x [1 2]] (* 2 (- x 10)))) |
| 14:14 | lazybot | ⇒ (-18 -16) |
| 14:14 | Raynes | &(macroexpand '(for [x [1 2]] (* 2 (- x 10)))) |
| 14:14 | lazybot | ⇒ (let* [iter__4191__auto__ (clojure.core/fn iter__14790 [s__14791] (clojure.core/lazy-seq (clojure.core/loop [s__14791 s__14791] (clojure.core/when-let [s__14791 (clojure.core/seq s__14791)] (if (clojure.core/chunked-seq? s__14791) (clojure.core/let [c__4189__auto__... https://gist.github.com/1374112 |
| 14:14 | Raynes | Borkdude: Nope. I'd happily throw you an early copy if there actually was a reasonable one to give. |
| 14:14 | amalloy | and it's especially valuable when you want to work with a nested structure, like transforming {:person {:name 'david :friends '[nancy mark]}} into a list of person/friend pairs |
| 14:15 | Iceland_jack | &(map #(- % 1) [1 2 3 4]) |
| 14:15 | lazybot | ⇒ (0 1 2 3) |
| 14:15 | Borkdude | Raynes: ok |
| 14:15 | brehaut | Raynes, Borkdude: i was hoping that the book was going to be entirely made up of macro expansions of core forms |
| 14:15 | Borkdude | brehaut: I already took those macro's as a no |
| 14:16 | Borkdude | brehaut: macroexpansions that is |
| 14:16 | kephale | amalloy: wrap FTY, ty again |
| 14:16 | Raynes | amalloy: I'm not sure I can agree that (map #(* 2 (- % 10)) foo) is less nice. |
| 14:16 | kephale | err FTW |
| 14:16 | Raynes | amalloy: I think it'd be better if 'for' printed incremental results, of course. ;) |
| 14:16 | michael_campbell | amalloy: I see. Thanks. Trying to get my head around some of when/why ... after I figure out "how" =) |
| 14:17 | amalloy | michael_campbell: consider how easy https://gist.github.com/1374123 is, for example |
| 14:18 | amalloy | Raynes: map is so much more limited there. for example you can't nest that inside some other #() expr |
| 14:18 | Raynes | amalloy: You gave me a limited example. |
| 14:20 | amalloy | my rule of thumb: use for unless you have a prebuilt map function, or can get one simply with comp/juxt/etc |
| 14:20 | michael_campbell | amalloy: I recall someone saying "nuts for juxt".... Raynes, maybe? |
| 14:20 | amalloy | yes, he called me nuts for juxt |
| 14:20 | Raynes | My rule of thumb: use map unless it is prohibitive or inconvenient to do so. |
| 14:21 | michael_campbell | Thanks both; I'm sure I'll develop my own sense of when, but looking for some "guardrails" to start with ;-) |
| 14:21 | amalloy | and avoid stuff like (reduce #(assoc %1 %2 (foo %2)) {} xs) - it's easier to write that as (into {} (for [x xs] [x (foo x)])) |
| 14:21 | broquaint | Feeling a bit slow - how might I treat a string as a collection e.g (contains? (sudo-make-me-a-seq "abc") \b)? |
| 14:21 | Borkdude | for has too much syntax ;-) |
| 14:21 | amalloy | ~contains? |
| 14:21 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use clojure.core/some or the java method .contains |
| 14:22 | Raynes | contains? doesn't do what you think it does. |
| 14:22 | brehaut | Borkdude: how dare you disparage for! |
| 14:22 | Borkdude | contains? should be renamed |
| 14:22 | gfredericks | amalloy: "for example" <- pun intended? |
| 14:22 | Raynes | &(contains? [:a :b :c] :b) |
| 14:22 | lazybot | ⇒ false |
| 14:23 | amalloy | hah |
| 14:23 | Raynes | broquaint: Try ##(some {\b} "abc") |
| 14:23 | amalloy | *cough* #{\b} |
| 14:23 | amalloy | or (.indexOf "abc" "b") |
| 14:23 | Raynes | Right. |
| 14:23 | Raynes | &(some #{\b} "abc") |
| 14:23 | lazybot | ⇒ \b |
| 14:23 | Raynes | amalloy: Or maybe he can use for! |
| 14:24 | broquaint | Thanks, Raynes & amalloy! |
| 14:24 | michael_campbell | *chuckle* |
| 14:24 | Raynes | &(for [x "abc" :when (#{\b} x)] x) |
| 14:24 | lazybot | ⇒ (\b) |
| 14:24 | Raynes | That's amalloy's preferred way of doing things, methinks. |
| 14:24 | amalloy | &(first (for [[idx char] (map-indexed list "abc") :when (= \b char)] idx))? |
| 14:24 | lazybot | ⇒ 1 |
| 14:25 | brehaut | Raynes: really? theres no juxt |
| 14:25 | Borkdude | amalloy: map-indexed isn't in core anymore right? |
| 14:25 | amalloy | yes it is |
| 14:25 | amalloy | &*clojure-version* |
| 14:25 | lazybot | ⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil} |
| 14:25 | Borkdude | amalloy: where |
| 14:26 | Raynes | clojure.core/map-index |
| 14:26 | Raynes | clojure.core/map-indexed |
| 14:26 | Raynes | My fingers are numb. :< |
| 14:26 | Borkdude | ah really, why did I think only keep-indexed was in core |
| 14:26 | amalloy | Borkdude: dude, why ask me? just ask lazybot |
| 14:26 | amalloy | &#'map-indexed |
| 14:26 | lazybot | ⇒ #'clojure.core/map-indexed |
| 14:26 | Borkdude | ok, I don't know where I got that from then |
| 14:26 | amalloy | he's so helpful |
| 14:26 | amalloy | Borkdude: indexed was removed in (i think?) 1.2 |
| 14:27 | Borkdude | amalloy: ah that's it |
| 14:27 | Borkdude | why actually, because you can do it with keep-indexed? |
| 14:28 | amalloy | map-indexed is more general and spends less memory |
| 14:31 | Borkdude | fair enough |
| 14:41 | nDuff | Any schedule on when videos from the conj will be available? |
| 14:45 | devn | Raynes: I disagree that forcing new users to clojure to get a special "make it easier for me" plugin is the right move |
| 14:47 | TimMc | &(doto "foo" print) |
| 14:47 | lazybot | ⇒ foo"foo" |
| 14:47 | TimMc | &(doto "foo" #(print %)) |
| 14:47 | lazybot | ⇒ "foo" |
| 14:47 | TimMc | &(doto "foo" (#(print %))) |
| 14:47 | lazybot | ⇒ foo"foo" |
| 14:52 | Raynes | devn: I don't necessarily disagree. |
| 14:55 | kzar | I have to keep a small amount of state in my web app, messages come in and sometimes they are in seperate parts so I have to assemble and decode them before storing. Running on Heroku and for now I've used a ref which works fine, messages are pretty small and generally all the parts come in at once so it's not a big deal. Problem is I figure if I scale up the web process parts of the messages might hit different proc |
| 14:55 | kzar | esses and I guess the ref wouldn't be accessible accross them all. Unless Heroku knows to root requests from the same client to the same server I'm going to need shared state, but using a database for such a small thing seems mad. What do you think I should do? |
| 14:56 | kzar | route* |
| 14:57 | gfredericks | erlang-map-reduce-storm-4j |
| 14:59 | technomancy | kzar: you pretty much have to treat your processes as disposable, so if there's any data that needs to stick around between requests, it needs to go somewhere durable |
| 14:59 | technomancy | (this is true of anything on EC2, not specific to heroku) |
| 15:00 | kzar | technomancy: Yea I mean luckily the way it is the parts come in at once and if the odd message gets dropped because the store got ditched half way through it doesn't matter |
| 15:00 | kzar | technomancy: But even so I figure I need a better store, but setting up Postgres or something for such a small thing seems mad |
| 15:01 | technomancy | well... "setting up postgres" is like a single command =) |
| 15:01 | technomancy | or redis, or couch, or whatever |
| 15:02 | technomancy | (sql/with-connection (System/getenv "DATABASE_URL") (sql/insert-record :stuffs {:data "Hello World"})) |
| 15:02 | TimMc | Can you queue the message pieces and then segment them such that all the parts of one message always go to the same process? |
| 15:02 | technomancy | schema creation is still not as streamlined as it could be unfortunately |
| 15:02 | TimMc | Never mind, just use a DB for now, worry about scaling *that* later. |
| 15:07 | brehaut | "<technomancy> well... "setting up postgres" is like a single command =)" holy crap |
| 15:08 | technomancy | brehaut: $ heroku addons:add shared-database |
| 15:08 | brehaut | technomancy: magic has been achieved |
| 15:09 | technomancy | any sufficiently advanced technology, &c. |
| 15:20 | gfredericks | technomancy: does this ring a bell? java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V at leiningen.util.paths$native_arch_path.<clinit>(paths.clj:32) |
| 15:20 | gfredericks | not holding me up or anything, but thought it was weird |
| 15:20 | technomancy | gfredericks: clojure 1.3 snuck onto your classpath? |
| 15:20 | gfredericks | hmm |
| 15:20 | gfredericks | for leiningen's execution you mean? |
| 15:21 | technomancy | right |
| 15:21 | gfredericks | huh. I wasn't doing anything funny, I don't think. okay, I won't worry about it. |
| 15:21 | gfredericks | thanks |
| 15:21 | duck1123 | you need to find the dev dependency that's using 1.3, and exclude clojure from it |
| 15:22 | gfredericks | oh the dev dependencies get used by leiningen's process? |
| 15:22 | technomancy | aye |
| 15:22 | gfredericks | that makes sense, as I'm using clojure.java.jdbc for testing |
| 15:23 | gfredericks | now I'm confused as to why it hasn't been doing this the whole time |
| 15:29 | kzar | technomancy: Hey I was meaning to ask you, do you know anything about Heroku timing out when trying to launch your app? |
| 15:30 | technomancy | kzar: yeah, if you don't bind to a port in under 60 seconds it assumes there was a problem |
| 15:30 | kzar | Yea, I suppose I mean to say how to avoid the problem. I'm using Noir and a few libraries but my app isn't massive |
| 15:31 | kzar | I mean one app that times out sometimes is really tiny, it's basically noir a few libraries, one controller and a static html file |
| 15:32 | technomancy | it takes over 60s to bind the noir app to a port? |
| 15:32 | wilkes | dnolen: did you post the code from your clojurescript talk? I want to steal the extension that changes "[object Object]" to something useful. |
| 15:35 | kzar | technomancy: I guess so, just did a test on my laptop and it took about 27 seconds and part of that was Lein checking for updates for snapshot packages |
| 15:35 | Raynes | Evil things, those snapshot packages. |
| 15:35 | technomancy | kzar: dependencies should already be resolved at build time on heroku though, so it shouldn't affect process launch |
| 15:36 | dnolen | wilkes: you just need to extend IPrintable to the particular type you care about |
| 15:36 | dnolen | wilkes: https://gist.github.com/1362856#file_gistfile1.clj |
| 15:37 | wilkes | dnolen: thanks! |
| 15:37 | dnolen | wilkes: extend the type to IPrintable rather |
| 15:40 | ejackson | dnolen: took the cljs browser repl for my first spin today - WOW ! |
| 15:42 | kzar | technomancy: Ah right, do you think Noir is especially slow? |
| 15:42 | technomancy | kzar: I don't think so. it may help to put ":checksum-deps true" in project.clj |
| 15:43 | duck1123 | does that 60s include dep resolution an compiling? |
| 15:44 | dnolen | ejackson: pretty cool eh :) |
| 15:44 | ejackson | definitive. |
| 15:45 | technomancy | kzar: you had some trouble with BUILDPACK_URL, right? could you msg me the output of "heroku config -s" in your project? |
| 15:46 | ejackson | now just need to figure out what trickery cljs-watch is playing |
| 15:48 | kzar | technomancy: Trying that ":checksum-deps true" thing on the small project, tailing the logs now and it seems to just be downloading loads of stuff each time I do a `heroku restart`. First time I restarted it loaded second time it timed out |
| 15:48 | kzar | technomancy: buildpack problems was on the larger project, I'll message you config of both though 1 mo |
| 15:49 | technomancy | kzar: interesting, I will definitely take a look |
| 15:49 | technomancy | with :checksum-deps true it should only fetch on git push |
| 15:49 | zerokarmaleft | ejackson: my hangup was figuring out that cljs-watch's default output is resources/public/cljs/bootstrap.js |
| 15:50 | ejackson | zerokarmaleft: yeah, I've spotted that, now I just need to figure out where its stashed goog.* in its special jar file so I can include things. |
| 15:51 | goodieboy | could someone recommend a good, lightweight xml parsing library? |
| 15:53 | wink | lightweight? xml? |
| 15:53 | wink | well, jackson works. kind of |
| 15:53 | ejackson | zerokarmaleft: oh, perhaps I don't need to, seems its put just about everything into it. |
| 15:53 | ejackson | wink: what's that you say !!!!!!!! |
| 15:53 | ejackson | :P |
| 15:53 | gfredericks | ejackson: I guess he wants you to parse some xml? |
| 15:54 | duck1123 | goodieboy: Do you need it to be-namespace aware? |
| 15:54 | zerokarmaleft | ejackson: yea, goog.dom.* afaict |
| 15:54 | kzar | technomancy: Thanks, arohner had this problem as well by the way |
| 15:55 | Raynes | ejackson: You know, you should talk at next year's Conj. You have an insane amount of energy. |
| 15:55 | goodieboy | duck1123: no actually |
| 15:55 | technomancy | kzar: interesting; I'll follow up with him |
| 15:55 | Raynes | I remember being super tired on like the second conference day and you were bouncing around like a pogo stick. |
| 15:55 | duck1123 | clojure.xml and the zip filters are pretty easy if you don't need ns support |
| 15:55 | zerokarmaleft | ejackson + djspiewak = spontaneous combustion? |
| 15:56 | goodieboy | duck1123: great i'll have a look, thanks |
| 15:56 | ejackson | Raynes: Thanks dude. |
| 15:57 | Raynes | ejackson: At the very least, you should have sung something by Coldplay. You look a lot like Chris Martin. |
| 15:57 | ejackson | dear lord, the abuse I'm taking. First being mistaken for an XML parser, and now this... |
| 15:58 | kzar | I would rather be an XML parser than Chris Martin |
| 16:00 | ejackson | Raynes: I work alone, at home, so when I peep out into the real world, I tend to get a little excitable. |
| 16:00 | technomancy | ejackson: heh; I know how that is =) |
| 16:01 | duck1123 | is it better to like Coldplay or XML? |
| 16:01 | brehaut | ejackson, technomancy: definately :) |
| 16:01 | TimMc | Coldplay. |
| 16:01 | TimMc | XML is inexcusable. |
| 16:01 | technomancy | but Coldplay's not extensible. |
| 16:02 | TimMc | I count that as a positive. |
| 16:02 | nDuff | ...and XML has _namespaces_! |
| 16:02 | brehaut | nor is coldplay enterprise lisp |
| 16:03 | duck1123 | I feel shame for having once written a website with an XML database, queried with XQuery, processed with XProc feeding into XSLT templates producing XForms |
| 16:03 | duck1123 | far too many angled brackets |
| 16:03 | ejackson | technomancy: but Xoldplay is. |
| 16:03 | Raynes | https://github.com/fileability/self-ml |
| 16:03 | technomancy | ejackson: don't give anyone any ideas |
| 16:04 | Raynes | IIRC, self-ml is used for the Chocolat text editor's syntax files. Almost as hard to look at as XML. |
| 16:04 | brehaut | xoldplay: sounds like it should be an overtone project; markov chains based on coldplay songs to generate new xoldplay songs |
| 16:05 | Raynes | But I suppose that's because of the sheer volume of those syntax files. |
| 16:06 | Raynes | https://github.com/chocolat/clojure.truffle/blob/master/languages/Clojure/syntax.selfml |
| 16:07 | Raynes | I don't understand how you can write something like that by hand. |
| 16:07 | brehaut | unrelated: today is friday in the US right? where is the next mostly lazy |
| 16:07 | Raynes | Today is Thursday |
| 16:07 | hiredman | ,(java.util.Date.) |
| 16:08 | clojurebot | #<Date Thu Nov 17 13:01:43 PST 2011> |
| 16:08 | brehaut | Raynes: line at a time |
| 16:08 | brehaut | rats |
| 16:09 | brehaut | Raynes: that is a serious grammer |
| 16:21 | TimMc | "written by humans and read by computers" |
| 16:21 | TimMc | I'd really like to have "read by humans" in there too... |
| 16:22 | brehaut | hah |
| 16:22 | TimMc | 'cuz regex would fit that description as is |
| 16:25 | brehaut | TimMc: definately |
| 16:25 | brehaut | TimMc: on the other hand, not using regexps can be equally unreadable |
| 16:26 | TimMc | :-) |
| 16:34 | amalloy | Raynes: observe the comment to http://stackoverflow.com/questions/8167063/whats-the-best-way-to-handle-this-sequence-transformation-in-clojure/8167458#8167458 - in which i confess that map is way cooler than for in some cases |
| 16:47 | brehaut | im mucking about with my syntax highlighting rules some more; should the opening and closing symbols for maps, vectors and sets (and the empty list) should be styled as 'values' (using the same style as numbers and characters) or as something else? |
| 16:48 | brehaut | and how much do people care about rainbow parens? |
| 16:52 | technomancy | brehaut: I think they're an anti-pattern |
| 16:52 | technomancy | brehaut: the problem is that they make it easier to match up parens |
| 16:54 | cemerick | please no angry fruit salad |
| 16:54 | cemerick | says the guy with the IDE that uses rainbow parens :-P |
| 16:54 | brehaut | cemerick: even if i do support it, you'd have to include additional CSS for it to be visable |
| 16:54 | brehaut | technomancy: by anti pattern you mean that we shouldnt be caring about the parens anyway? |
| 16:54 | cemerick | you're certainly being comprehensive :-) |
| 16:55 | technomancy | brehaut: precisely. especially when reading, let indentation be your guide. |
| 16:55 | brehaut | technomancy: sure. ideally id like to do something where the form under the mouse was highlighted as need be, but im currently unsure if i can implement that |
| 16:55 | cemerick | I wonder if we can come up with a preprocessor to add in the parens based off of e.g. python-like indentation? |
| 16:55 | brehaut | cemerick: thats the plan :) |
| 16:56 | brehaut | cemerick: wait, the plan is related to comprehensive |
| 16:56 | cemerick | brehaut: yeah, I was trying to troll someone on sweet expressions or whatever they're called |
| 16:57 | brehaut | ah :) yeah, it doesnt sound like a very practical idea. i want less magic in my syntax, not more! |
| 16:57 | cemerick | my problem is that I'm incapable of trolling effectively because I can't hold a pose like that for long enough |
| 16:57 | brehaut | (caveat, i love haskell's layout rules) |
| 16:58 | brehaut | ive just changed my code to no longer care about rainbow parens, but it does annotate incorrectly matched closing tokens |
| 16:58 | Raynes | I don't love the fact that there are 16 different possible indentations for pretty much any point that you hit return in while editing Haskell. |
| 17:00 | brehaut | (which incidentally pulls me up on a few cases on my ring introduct. shame!) |
| 17:59 | ibdknox | quiet day |
| 18:00 | kephale | overall its been a quiet week |
| 18:00 | ibdknox | post conj recovery |
| 18:00 | brehaut | everyone is capitulating on the conj |
| 18:01 | ibdknox | yeah, I've been doing korma stuff |
| 18:02 | brehaut | ive been punishing myself with javascritp |
| 18:02 | Raynes | technomancy: So, does that mean that ibdknox and I are doing better than you since we designed *and* wrote the 'new' task for 2.0? |
| 18:02 | technomancy | Raynes: depends how much hammock time you put into it =) |
| 18:02 | ibdknox | technomancy: 5 man years |
| 18:03 | Raynes | technomancy: Well, precisely 1 day of work went into it, but ibdknox and I had had plenty of time to think about it since we had been working on Spawn recently. We knew what we wanted, I think. |
| 18:03 | technomancy | ibdknox: teach me the secrets of relativity |
| 18:04 | ibdknox | technomancy: we farmed a job out for hammock time to mechanical turk ;) |
| 18:04 | technomancy | couldn't have been cheap |
| 18:05 | Raynes | We wrote a lein plugin to give us hammock time transparently. |
| 18:05 | ibdknox | lein hammock |
| 18:05 | ibdknox | it's like lein trampoline, but more relaxing |
| 18:06 | amalloy | that's awesome. i should write a hammock fn for core |
| 18:07 | amalloy | (hammock some-thunk) ;; calls (some-thunk) forever until it gets a different result |
| 18:07 | ibdknox | (defn hammock [] (Thread/sleep (* 1000 60 30)) (println "Do you have an answer yet?")) |
| 18:09 | amalloy | ibdknox: make it turn off your monitor around the sleep call, and you're done, right? |
| 18:09 | ibdknox | basically |
| 18:09 | ibdknox | ;) |
| 18:09 | amalloy | it should probably require you to answer y two times in a row, because the first answer is wrong anyway |
| 18:09 | ibdknox | lol |
| 18:10 | amalloy | "Do you have an answer?" "Yeah man let me type some stuff" "We'll see if you still feel that way in half an hour" |
| 18:12 | Raynes | ibdknox, technomancy: lein plugin install lein-hammock 0.1.0 && lein hammock |
| 18:12 | brehaut | ,(apropos 'let) |
| 18:12 | clojurebot | (letfn let when-let if-let delete-file) |
| 18:13 | ibdknox | lol |
| 18:13 | ibdknox | Raynes: well done |
| 18:16 | Raynes | https://github.com/Raynes/lein-hammock |
| 18:16 | brehaut | lol |
| 18:16 | brehaut | that amazing |
| 18:17 | tensorpudding | what does it do? |
| 18:17 | ibdknox | Raynes: did you use something to generate the ascii? |
| 18:17 | Raynes | No, what is amazing is that I googled for 'ascii hammock' and got a relevant result. |
| 18:17 | ibdknox | wow |
| 18:17 | tensorpudding | heh |
| 18:17 | Raynes | http://ascii.co.uk/art/hammock |
| 18:17 | amalloy | (inc Raynes) |
| 18:17 | lazybot | ⇒ 11 |
| 18:18 | duck1123 | you don't expect him to put a lot of work into something called lein-hammock |
| 18:18 | ibdknox | duck1123: why not? this is serious business. |
| 18:18 | Raynes | Indeed. |
| 18:18 | Raynes | ibdknox: Also, that plugin was created via 'lein new plugin lein-hammock'. All hail lein-newnew! |
| 18:19 | ibdknox | Raynes: I saw that :) |
| 18:35 | bbommarito | Evening all. I have a quick question: Can anyone explain juxt to me? The API is a bit terse and I am not quite groking it. |
| 18:35 | ibdknox | ,((juxt inc dec) 1) |
| 18:35 | clojurebot | [2 0] |
| 18:36 | ipostelnik | ,((juxt inc dec) [1 2]) |
| 18:36 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number> |
| 18:36 | ibdknox | bbommarito: it returns a function that takes in one value and returns a vector of the results of applying the given functions to it in order |
| 18:36 | kephale | ,(map (juxt inc dec) [1 2]) |
| 18:36 | clojurebot | ([2 0] [3 1]) |
| 18:36 | bbommarito | ibdknox: Okay, I was thinking that was what it was doing, but I wasn't sure from context. Basically, watching a Full Disclosure on FizzBuzz and was trying to understand it. |
| 18:38 | bbommarito | ibdknox: He was using ((apply juxt fb-list) 15) so the apply was confusing e. |
| 18:38 | bbommarito | me...wow m key is dying. |
| 18:38 | ibdknox | ah |
| 18:38 | ibdknox | yeah |
| 18:38 | ibdknox | that's creating the list of functions to apply dynamically |
| 18:38 | ibdknox | ((apply juxt [inc dec]) 1) |
| 18:39 | ibdknox | ,((apply juxt [inc dec]) 1) |
| 18:39 | clojurebot | [2 0] |
| 18:39 | ipostelnik | i think juxt is like map but for applying many functions to one value vs. applying one function to many values |
| 18:40 | bbommarito | ibdknox: I think that is what's confusing me. Looking at what you were evaling here, they both look to do the same thing (juxt vs apply juxt). |
| 18:40 | ibdknox | well |
| 18:40 | ibdknox | I couldn't do this |
| 18:40 | technomancy | ipostelnik: never thought of it that way, but it makes sense |
| 18:40 | ibdknox | ,((juxt [inc dec]) 1) |
| 18:40 | clojurebot | [#<core$dec clojure.core$dec@a40b04>] |
| 18:40 | ibdknox | ipostelnik: sort of, except it returns a function as opposed to executing it |
| 18:41 | brehaut | chrome is trying to tell me that my brush will highlight all of clojure core in 1ms. that smells funny to me |
| 18:41 | ibdknox | brehaut: a bit. |
| 18:41 | brehaut | ibdknox: a lot! all of necessary-evil takes 10ms |
| 18:41 | ibdknox | haha |
| 18:41 | brehaut | core is a wee bit bigger |
| 18:42 | bbommarito | ibdknox: OH, I understand it now. Okay yea now it makes a bit of sense. You will have to forgive me, as I come from the land of C# and Ruby and Clojure is...well a bit different. |
| 18:42 | ibdknox | bbommarito: I used to work on C# :) |
| 18:43 | ibdknox | bbommarito: at MSFT |
| 18:43 | amalloy | ~juxt |
| 18:43 | clojurebot | juxt is usually the right answer |
| 18:43 | amalloy | aw. i wanted the other one, clojurebot |
| 18:43 | ibdknox | amalloy: I was amazed you didn't vome into this sooner |
| 18:43 | ibdknox | come* |
| 18:44 | ibdknox | you're off your game ;) |
| 18:44 | amalloy | ibdknox: truly, i regret taking some time out of irc to do actual work |
| 18:44 | amalloy | how often does someone ASK about juxt |
| 18:44 | amalloy | usually you have to preach |
| 18:44 | ibdknox | hehe |
| 18:44 | lucian | it's a pretty useful function |
| 18:44 | ibdknox | it's *very* useful :) |
| 18:45 | lucian | "give me the results of these functions on this value" |
| 18:45 | bbommarito | Hey, I learn by reading source, and if I find something confusing, I ask:) |
| 18:46 | amalloy | ~juxt |
| 18:46 | clojurebot | juxt is usually the right answer |
| 18:46 | amalloy | feh |
| 18:46 | bbommarito | OH, I also come from the land of Smalltalk. |
| 18:47 | lucian | that's a pretty nice land |
| 18:47 | amalloy | bbommarito: then perhaps you will like findfn? |
| 18:47 | amalloy | $findfn 1 2 4 7 |
| 18:47 | lazybot | [clojure.core/bit-or clojure.core/bit-xor clojure.core/+ clojure.core/+'] |
| 18:47 | amalloy | i understand y'all have something similar but better |
| 18:48 | bbommarito | amalloy: We do, but I don't think I have ever used it. |
| 18:50 | eanxgeek | I'm new to clojure and I'm trying to figure out the equal of foreach(), I'm enterin in at my repl (class (browser getAllLinks)) and I get back [Ljava.lang.String I'd like to the equal of a foreach link in (browser getAllLinks); do .. |
| 18:50 | brehaut | woo! core highlights :D |
| 18:50 | brehaut | (and heats up my mac doing so) |
| 18:50 | bbommarito | The thing that really bothered me in the land of Smalltalk is when Cincom took WebVelocity and made it paid only... |
| 18:51 | eanxgeek | what would the easiest approach be? I couldn't get doseq to work, probably bdu error |
| 18:51 | ibdknox | eanxgeek: (doseq) or (for ..) depending on what you want |
| 18:51 | brehaut | 3.8 seconds to highlight all of core |
| 18:52 | ibdknox | brehaut: time to make it incremental ;) |
| 18:52 | brehaut | ibdknox: i wish i could! |
| 18:52 | eanxgeek | ibdknox: I'm probably looking at using link in another function, i.e. do click link |
| 18:53 | ibdknox | eanxgeek: (doseq [link (browser getAllLinks)] (click link)) |
| 18:54 | eanxgeek | ibdknox: ah thanks sure enough I had my braces wrong. |
| 18:59 | emacsen | anyone seen Fogus? |
| 18:59 | bbommarito | Perhaps I need to sit down and watch all of the Clojure for Java Developers talk. Might help me a bit. |
| 19:00 | emacsen | bbommarito, what's your question? |
| 19:01 | bbommarito | emacsen: I got my question answered:) |
| 19:01 | bbommarito | Oh and thank you emacs for telling me I had an unbalanced paren... |
| 19:05 | brehaut | ibdknox: i think (because i cant easily profile this) that the majority of time for highlighting core isnt actually my parser, its the highlighter generating the html etc, so an incremental parser wouldnt help |
| 19:05 | Borkdude` | hmm |
| 19:06 | Borkdude` | my old self quit |
| 19:10 | bbommarito | I came across Clojure while hunting for a new language to work in. I am so burned out on Ruby that I can't even tolerate to work on it for personal projects, so I had heard about Clojure and started investigating. |
| 19:12 | ibdknox | brehaut: ah |
| 19:13 | emacsen | bbommarito, have you worked in any other "non-traditional" languages? |
| 19:13 | cemerick | Borkdude: Yup, I pulled it in. :-) |
| 19:13 | bbommarito | emacsen: I have played with Erlang for smaller things, messed with Haskell a little bit, until I hit Monads. IO as well. |
| 19:14 | Borkdude | cemerick: ah great |
| 19:14 | emacsen | bbommarito, okay, well I think you'll like Clojure then. It's like both, but without the same pain (it has its own of course) |
| 19:14 | bbommarito | emacsen: And, if you want to call them languages MUF (Multi-User Forth), and Moo (MUD Object Oriented) |
| 19:15 | bbommarito | emacsen: I think one thing I really appreciate about Clojure is: It's not OOP. Too often people try to shove everything into OOP, and more often than not, it makes no sense to do so. |
| 19:15 | emacsen | bbommarito, right. it's not OOP, but it has a lovely dispatch system |
| 19:18 | bbommarito | emacsen: And multimethods look interesting, though I haven't started to delve into them. |
| 19:18 | emacsen | multimethods are the dispatch system :) |
| 19:19 | emacsen | bbommarito, you don't /need/ to use either one though, of course |
| 19:20 | Borkdude | I really haven't needed multimethods, but maybe I'm missing out on something here |
| 19:20 | emacsen | Borkdude, nope. But it's there if you want it :) |
| 19:23 | Borkdude | I read in a survey that a lot of people come from Ruby to Clojure right? |
| 19:24 | technomancy | Borkdude: not appreciably more than from python, and less than from java |
| 19:24 | technomancy | but they tend to make more noise for some reason =) |
| 19:25 | Borkdude | Ah: http://bit.ly/sSfBzE |
| 19:25 | bbommarito | Borkdude: I could see that being the case since Ruby is...sort of functional and it's presumably a bit easier to understand Clojure. Plus, Clojure runs on the JVM which is /way/ more performant than MRI |
| 19:26 | bbommarito | Wow, only 5% from CL? That surprises me. |
| 19:27 | Borkdude | What surprises me is 3% Ada |
| 19:27 | Borkdude | Ada? |
| 19:27 | clojurebot | only when you've earned it |
| 19:27 | technomancy | Borkdude: probably a higher percent of "oops, accidentally clicked Ada" since it sorts at the top alphabetically. =) |
| 19:28 | Borkdude | Wasn't it just the first language in the list of options? |
| 19:28 | Borkdude | technomancy: right.. |
| 19:28 | bbommarito | "I came to Clojure from QBasic" |
| 19:29 | bbommarito | 2% from Scala. I looked into Scala, and I really can't see what the fuss is about. |
| 19:29 | Borkdude | No F# |
| 19:30 | bbommarito | Well, F# is a MS language, so if you are writing F#, you are doing so to stay in the .net world. |
| 19:31 | bbommarito | If someone was writing F# because they just loved the language, OCaml is very similar. |
| 19:31 | Borkdude | bbommarito: sometimes you're kind of forced into the .net world, at least I was in one compnay |
| 19:31 | Borkdude | bbommarito: then I started using F# to get some air |
| 19:31 | technomancy | F# doesn't have full inference though, does it? |
| 19:32 | technomancy | still have to declare args like scala? |
| 19:32 | Borkdude | full inference, like type inference? it has that |
| 19:32 | bbommarito | Borkdude: I wasn't forced into .net, and still don't mind .net. Though, I don't mind Java either. |
| 19:32 | technomancy | Borkdude: interesting. I was under the impression that it's impossible to implement in scala; I wonder why F# is different |
| 19:32 | Borkdude | bbommarito: before I came to .net I spend time in Common Lisp |
| 19:32 | technomancy | since they both have to interop with a strongly-OO host |
| 19:33 | hiredman | http://twitpic.com/6njqiz |
| 19:33 | Borkdude | technomancy: http://msdn.microsoft.com/en-us/library/dd233180.aspx |
| 19:34 | brehaut | technomancy: as long as you stick with function, and non object records, F# can do full inference; when you cross over into classes it starts to fail |
| 19:34 | hiredman | as the only person here with an F# sticker on his laptop I demand to be heard |
| 19:34 | Borkdude | bbommarito: actually I started using Clojure because I was forced to Java |
| 19:34 | hiredman | I don't really have anything to say though |
| 19:34 | technomancy | Borkdude: that doesn't look like hindley-milner |
| 19:35 | bbommarito | hiredman: Why do you write F#? Is it to stay in .Net, or do you just like F#? |
| 19:35 | hiredman | I don't |
| 19:35 | hiredman | I have the sticker |
| 19:35 | bbommarito | Ah. |
| 19:35 | hiredman | I did a few euler problems |
| 19:35 | technomancy | brehaut: ok, interesting. I wonder why scala doesn't do that |
| 19:36 | hiredman | well, scala has way more of an oop focus |
| 19:36 | technomancy | I can buy the "static types are less trouble than they're worth" argument, but if you have to declare types for every single argument it's very clearly false. |
| 19:36 | Borkdude | technomancy: why not? |
| 19:37 | technomancy | Borkdude: never mind, I was just skimming. |
| 19:39 | Borkdude | What is the statys of ClojureCLR, are people actually using it? |
| 19:40 | Borkdude | If I knew it existed I could have tried it when I was bound to .NET |
| 19:41 | Borkdude | but that was in like 2007 or 08 |
| 19:41 | bbommarito | So, my goal in learning Clojure is to learn enough to build a blog system (Yes, that old tired trend) in Compjure, Ring and Hiccup. |
| 19:41 | brehaut | technomancy: everyone should have a play with F#s units of measure type system at least once too. its pretty great |
| 19:42 | technomancy | brehaut: is it anything like frink? |
| 19:42 | amalloy | bbommarito: give ibdknox a chance to sell you on noir |
| 19:42 | Borkdude | brehaut: ah yes, that was just new when I used F# |
| 19:42 | Borkdude | brehaut: the newest cool thing |
| 19:43 | brehaut | technomancy: its less pervasive, but it ties in nicely with the rest of the type system |
| 19:43 | Borkdude | I even have the book Real world functional programming in F# and C#, and several other F# books |
| 19:44 | bbommarito | amalloy: I had not heard about noir. |
| 19:44 | ibdknox | bbommarito: yeah, you should definitely check out Noir: http://www.webnoir.org |
| 19:44 | ibdknox | bbommarito: it will make your life *much* easier |
| 19:44 | Borkdude | bbommarito: noir is great |
| 19:44 | Raynes | Noir is the bet. |
| 19:45 | Raynes | best* |
| 19:45 | tensorpudding | noir is pretty cool |
| 19:45 | Borkdude | I feel a survey coming. |
| 19:45 | ibdknox | better than ice cream even |
| 19:45 | tensorpudding | more fun than using compojure or ring directly |
| 19:45 | tensorpudding | better than ice cream sandwich? |
| 19:45 | ibdknox | tensorpudding: We should ask the guy who wrote it ;) |
| 19:46 | technomancy | ibdknox: did you get a chance to get rid of those nasty unqualified :use calls? |
| 19:46 | ibdknox | though I hear he's kind of an ass |
| 19:46 | tensorpudding | wrote what? |
| 19:46 | ibdknox | Noir |
| 19:46 | brehaut | some tool called chris granger i think |
| 19:46 | ibdknox | technomancy: yessir |
| 19:46 | tensorpudding | ...that's you isn't it |
| 19:46 | technomancy | ibdknox: excellent |
| 19:46 | tensorpudding | i thought |
| 19:46 | technomancy | ibdknox: did you see the stuff about :require possibly deprecating :use? |
| 19:46 | bbommarito | ibdknox: He appears to be. I mean look at the Noir site, it's all minimalistic and hipster-ish. |
| 19:46 | ibdknox | technomancy: I'm all for it. |
| 19:47 | ibdknox | bbommarito: srsly. I take back the idea about asking him. Try to avoid him at all costs. |
| 19:47 | ibdknox | technomancy: it was always weird to me that those two notions were separated |
| 19:47 | technomancy | ibdknox: yeah, it confuses everyone |
| 19:48 | ibdknox | technomancy: I also want to do what hiredman was talking about (:require ..) vs (require ..) |
| 19:48 | ibdknox | that just doesn't make sense |
| 19:48 | technomancy | rich even said at dinner that he couldn't keep them straight in his head and goes to look it up every so often |
| 19:48 | ibdknox | technomancy: I've had to explain it to every person I've gotten to use Clojure |
| 19:48 | ibdknox | lol |
| 19:48 | hiredman | yes, someone start a separate thread about that on the ml |
| 19:48 | technomancy | the problem with (require ...) in the ns form is that the function form requires quoting |
| 19:49 | ibdknox | technomancy: make it an illusion |
| 19:49 | tensorpudding | the :require vs. require thing makes some sense |
| 19:49 | hiredman | ns can translate require into :require |
| 19:49 | technomancy | ibdknox: yeah, that's just to say I think you have to fix require at the repl at the same time as fixing :require in ns |
| 19:49 | ibdknox | technomancy: I don't care if it actually uses require, just that it looks the same :p Though, obviously that would be best |
| 19:49 | technomancy | otherwise it just shifts around the inconsistency |
| 19:50 | ibdknox | technomancy: I'll hide complexity from the user in the implementation any day ;) |
| 19:50 | Borkdude | and also, rename contains? |
| 19:50 | hiredman | so apparently rich wrote the ns macro, and at the time argued for keywords instead of symbols to "make it clearly declarative" |
| 19:50 | tensorpudding | why does the colon matter? |
| 19:50 | ibdknox | technomancy: but sure, I don't think require at the repl should need quoting |
| 19:50 | hiredman | so I'm not holding my breath on it changing |
| 19:50 | technomancy | Borkdude: whoa let's not get too crazy here |
| 19:50 | technomancy | Borkdude: actually contains? is part of rich's secret plan to trick people into thinking about big-o notation |
| 19:51 | brehaut | contains? has a long and proud tradition of confusing new users |
| 19:51 | Borkdude | technomancy: elaborate |
| 19:51 | technomancy | ibdknox: but that's a breaking change |
| 19:51 | ibdknox | technomancy: I'm sure there's a way to support both |
| 19:52 | technomancy | Borkdude: contains? forces you to be O(1) while clojure.core/some is O(n) |
| 19:52 | ibdknox | technomancy: the possible inputs to (require ..) are fairly limited |
| 19:52 | stevelew | heya |
| 19:53 | hiredman | ibdknox: the sane inputs |
| 19:53 | amalloy | hiredman: i don't understand why we're still talking about "making" ns support require vs :require. it already does that |
| 19:53 | hiredman | you can infact do stuff like (require ['foo :as 'bar]) |
| 19:53 | Borkdude | technomancy: 'contains?' operates constant or logarithmic time |
| 19:54 | ibdknox | amalloy: that doesn't do anything bad? |
| 19:54 | ibdknox | amalloy: do you still need to quote it? |
| 19:54 | hiredman | amalloy: it may accidently, but it should explicitly treat it the same way as :require, and everyone should use that |
| 19:55 | amalloy | i agree it's probably an accident. i'm not really sold on making it the "right way" |
| 19:55 | amalloy | unless you can also retrofit the "not in ns" version |
| 19:55 | amalloy | ibdknox: try it, it just works. drop the : from all your ns decls |
| 19:56 | ibdknox | huh |
| 19:56 | hiredman | amalloy: so right now the confusion is quoting confusion and keyword confusion |
| 19:56 | hiredman | if you dropped the keyword bit you would just have quoting confusion |
| 19:56 | technomancy | Borkdude: right, the thing is that people use contains? on data structures that don't support constant-time lookup, the fact that this doesn't work forces people to think about the lookup characteristics when they otherwise wouldn't |
| 19:56 | amalloy | right. i think the keyword confusion is helping to combat the quoting confusion, though |
| 19:57 | hiredman | two kinds of confusion is always worse than one |
| 19:57 | stevelew | complected confusions |
| 19:57 | amalloy | at least this way when someone says "i'm doing (:use '[blah]) and it doesn't work", we can say "hey man you shouldn't be quoting there" |
| 19:57 | amalloy | if (use '[blah]) works in some contexts and not in others it's harder to figure out what the issue is |
| 19:57 | ibdknox | amalloy: I agree, a halfway solution is a bad one |
| 19:58 | ibdknox | there's value in figuring out a real solution though |
| 19:58 | gfredericks | you could totally switch things up and make ns more like a clojure function with opts -- so you just get one :use, one :require, and one :import |
| 19:58 | ibdknox | that being said, a big first step would be removing the use/require complexity as technomancy is suggesting |
| 20:00 | hiredman | possibly just write a ns2 macro and get it into core, so for backwards compat there is ns |
| 20:00 | Borkdude | technomancy: I think function names should be intuitive. contains? applied to a vector, my intuition is that it will check if some element is inside the vector. has-key? would have been a better name I think |
| 20:01 | ibdknox | Borkdude: I agree |
| 20:01 | TimMc | clojurebot: contains? |
| 20:01 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains |
| 20:01 | TimMc | clojurebot: contains? |
| 20:01 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use clojure.core/some or the java method .contains |
| 20:01 | tensorpudding | making the arguments to ns positional would be a pain |
| 20:01 | TimMc | Hrmf. I thought it had some snarky responses. |
| 20:01 | tensorpudding | it'd be less clear |
| 20:02 | ibdknox | positional? |
| 20:02 | tensorpudding | what gfredericks was suggesting, making use/require into arguments |
| 20:02 | ibdknox | they wouldn't be positional |
| 20:02 | tensorpudding | at least, what i interpreted it |
| 20:02 | ibdknox | they'd be named arguments |
| 20:02 | gfredericks | (ns2 :use [foo.bar bar.baz] :import [com.Thomas]) |
| 20:02 | tensorpudding | okay |
| 20:03 | gfredericks | whoops forgot the name of the namespace :) |
| 20:03 | hiredman | :( |
| 20:03 | gfredericks | more like an implicit map is what I was thinking |
| 20:03 | tensorpudding | that'd be acceptable but i like the idea of removing the :use/:import/:require distinction somewhat |
| 20:03 | ibdknox | somewhat related, why is the guidance for Clojure libs to unpack options maps? |
| 20:04 | Borkdude | what about (ns2 {:use [x y] :importy [z]}) |
| 20:04 | gfredericks | ibdknox: as opposed to explicit maps? |
| 20:04 | ibdknox | that makes composition much more difficult |
| 20:04 | ibdknox | gfredericks: yes |
| 20:04 | gfredericks | I agree |
| 20:04 | gfredericks | it feels macro-like |
| 20:04 | ibdknox | it's an anti-pattern in my mind |
| 20:04 | ibdknox | a very simple case is when using threading |
| 20:05 | TimMc | tensorpudding: Like this? (ns2 foo :use [net.cgrand.enlive-html/* org.timmc.chelydra]) |
| 20:05 | hiredman | agreed |
| 20:05 | TimMc | where the first means use, the second means require |
| 20:05 | tensorpudding | that seems a bit pythonesque |
| 20:05 | ibdknox | (-> x (foo some-opts)) becomes (-> x #(apply foo % some-opts)) |
| 20:05 | TimMc | tensorpudding: That's a compliment, then? I like Python's imports. |
| 20:06 | hiredman | but gfrederick's ns2 is a non-starter |
| 20:06 | tensorpudding | i like it okay |
| 20:06 | tensorpudding | python's explicitness is missing |
| 20:06 | technomancy | Borkdude: I didn't say I agreed. just that it's a cunning plan. |
| 20:06 | hiredman | mostly because of the way it makes using :use without :only easier |
| 20:06 | tensorpudding | from net.cgrand.enlive-html import * would be more expository and understandable to the newb |
| 20:06 | technomancy | has-key? is absolutely the clearest name for that function |
| 20:07 | Borkdude | technomancy: I think misnaming a function doesn't make people think about big-O ;) |
| 20:07 | hiredman | (ns2 :use [[foo.bar :only [foo]] [bar.baz :only [bar]]] :import [com.Thomas]) |
| 20:07 | tensorpudding | but it's brief and once you know what it does it is readable |
| 20:07 | hiredman | yetch |
| 20:07 | hiredman | tensorpudding: no import * please |
| 20:07 | tensorpudding | no, i'm not saying put that into clojure |
| 20:08 | tensorpudding | just saying that it's very clear what it does |
| 20:08 | amalloy | only if you know what import and * do |
| 20:08 | tensorpudding | python people think that from foo import * is a bad idea anyway |
| 20:08 | amalloy | and what the names of all the functions in that package are |
| 20:08 | hiredman | (ns2 some.ns (use foo.bar :only [bar] foo.baz :only [baz])) |
| 20:09 | TimMc | Is there a Clojure Lint? |
| 20:09 | Borkdude | technomancy: is nil a value? |
| 20:09 | technomancy | Borkdude: sure? |
| 20:09 | TimMc | So... what's wrong with the current ns again? |
| 20:10 | TimMc | Borkdude: It's kind of second-class. |
| 20:10 | tensorpudding | why do .clj files use :require and :use in the ns definition instead of using explicit require and use |
| 20:10 | gfredericks | hiredman: could a generic approach to discouraging naked use's be to enforce asking for them? (:use foo.bar :all), e.g.? |
| 20:11 | Borkdude | if it wasn't then this shouldn't be true (contains? {:a nil} :a) by clojurebots definition |
| 20:11 | TimMc | I like that. |
| 20:11 | hiredman | gfredericks: it would be to go with technomancy's proposal |
| 20:11 | hiredman | and eventually get rid of use |
| 20:12 | tensorpudding | i dislike the idea of use |
| 20:12 | ibdknox | use is very useful at times |
| 20:13 | tensorpudding | well, it does cut down on the verbosity when you're using helpers from a package |
| 20:13 | hiredman | the main case is clojure.test |
| 20:14 | Borkdude | naked use is useful on the repl |
| 20:14 | duck1123 | my test nses are the worst about naked uses |
| 20:14 | hiredman | yeah |
| 20:14 | TimMc | Hey, maybe if we had decent documentation, this would be less of a problem! |
| 20:14 | hiredman | generally you at least have a naked use for clojure.test and the ns being tested |
| 20:15 | TimMc | Or maybe I am being optimistic about people R'ing the FM. |
| 20:15 | amalloy | clojure.test could have a macro for doing naked-use |
| 20:15 | amalloy | and then you don't need it in the new-ns |
| 20:15 | hiredman | *shrug* |
| 20:19 | Borkdude | hmm you can even use nil as a key in a map |
| 20:20 | moogatronic | is there an emacs/slime command to execute an s-exp and put the results in the current buffer with a comment char in front? |
| 20:21 | scottj | moogatronic: ; C-u C-x C-e |
| 20:22 | moogatronic | scottj: awesome thanks. It doesn't auto comment, but it gets me the results! |
| 20:23 | amalloy | moogatronic: i think that's what the ; was for... |
| 20:23 | moogatronic | ah, my eyes. |
| 20:23 | moogatronic | and the size of the font in textual. =) |
| 20:23 | Borkdude | moogatronic: if you make your own elisp func you can call this slime func and do the comment after the slime func is done? |
| 20:24 | moogatronic | Borkdude: yeah, I just didn't know if there was a baked-in feature that did the ;=> type of comment, results thing that you see a lot in peoples examples on blogs / etc. |
| 20:25 | Borkdude | moogatronic: I usually type that in myself |
| 20:25 | hiredman | you can write some elisp and get it |
| 20:27 | Borkdude | I wrote my first serious elisp fns yesterday |
| 20:27 | Borkdude | it writes java files automatically for all classes listed in the buffer, compiles them and runs main :) |
| 20:31 | stevelew | that's cool |
| 20:46 | scottj | moogatronic: http://jaderholm.com/paste/eval-sexp-comment-result.html I tried to get it so you wouldn't have to C-u but couldn't. So it's C-u C-x C-E will give you ;=>result |
| 21:06 | Borkdude | scottj: replacing (slime-eval-last-expression) with (slime-eval-print-last-expression (slime-last-expression)) works better for me |
| 21:09 | rplevy | are the extensible reader plans mentioned in the keynote talk written up anywhere? |
| 21:10 | rplevy | I took notes, and then realized I didn't write down enough to remember what I saw |
| 21:10 | amalloy | rplevy: slides for most of the talks are up, so it's probably there |
| 21:10 | rplevy | that talk is not up |
| 21:11 | alex_baranosky | #=() |
| 21:11 | scottj | rplevy: rhickey does't like to release slides without video |
| 21:12 | rplevy | alex_baranosky: no, that's different |
| 21:12 | scottj | rplevy: if extensible reader has to do with recent discussion about datetime literals there's docs on that on dev wiki |
| 21:12 | rplevy | scottj: that's related, but there's a more general way of extending the reader proposed |
| 21:13 | amalloy | scottj: can't say i blame him given (for example) how nuts the twitterverse went over his "TDD hatred" from the strangeloop slides before the video came out |
| 21:13 | Borkdude | scottj: this is what I'm going to use |
| 21:13 | Borkdude | scottj: https://gist.github.com/1375329 |
| 21:13 | Borkdude | scottj: tnx for the inital version ;) |
| 21:13 | scottj | amalloy: actually that's what I was basing it on, though I don't think he released his slides for strangeloop before the video |
| 21:14 | alex_baranosky | if you scour the clojure dev google group you may see the syntax mentioned there |
| 21:14 | alex_baranosky | people had strong reactions to that StrangeLoop talk |
| 21:14 | alex_baranosky | one way or the other |
| 21:15 | rplevy | so if my memory serves me, it almost seems like what is being planned approaches reader macros. The concrete implementation that the user-defined syntax gets coupled with-- is it an arbitrary function? and what is its input? |
| 21:15 | moogatronic | scottj: thanks for that elisp! (was eating dinner) |
| 21:15 | scottj | Borkdude: if you care about making it work with elisp just say so I have code to do that |
| 21:15 | scottj | working with elisp and slime that is |
| 21:16 | Borkdude | ah sure |
| 21:18 | alex_baranosky | rplevy: what do you think of the idea of colorizing Midje's command line output? |
| 21:18 | rplevy | alex_baranosky: I saw those slides. I think the exact quote was "Fuck TDD. Also, fuck Simon Peyton Jones." |
| 21:19 | alex_baranosky | rplevy: it seems like reader macros, yes, but a really limited scope. |
| 21:19 | alex_baranosky | rplevy: hehe |
| 21:19 | duck1123 | colorized midje output would be cool |
| 21:19 | rplevy | alex_baranosky: what is the limitation exactly? |
| 21:20 | ibdknox | duck1123: https://github.com/ibdknox/colorize |
| 21:20 | duck1123 | ibdknox: neat. I'll have to remember that if I ever have a use |
| 21:21 | alex_baranosky | rplevy: syntax is limited, right? |
| 21:21 | scottj | Borkdude: I take it back, the code didn't translate as directly as I thought |
| 21:21 | duck1123 | I've been enjoying the effect of clj-stacktrace's pst+ lately |
| 21:21 | Borkdude | scottj: not a problem, I'll use it mostly for clojure anyway |
| 21:21 | alex_baranosky | duck1123: thanks, there's a namespace in lazytest as well; I'll have to steal the best bits |
| 21:22 | rplevy | I'm doing a report-back on the conj for the rest of the team that didn't go. I don't want to misrepresent it because when I say it will sound identical to reader macros, but I fairly certain this is less than that. |
| 21:22 | Borkdude | (+ 1 2 3) |
| 21:22 | Borkdude | ;=>6 <-- this is elisp in action :) |
| 21:22 | Borkdude | |
| 21:22 | clojurebot | *suffusion of yellow* |
| 21:22 | alex_baranosky | ~yodel |
| 21:22 | clojurebot | excusez-moi |
| 21:22 | alex_baranosky | ~yeah! |
| 21:22 | clojurebot | Gabh mo leithscéal? |
| 21:22 | rplevy | did clojurebot acheive sentience? |
| 21:23 | scgilardi | long ago |
| 21:23 | scottj | duck1123: what's sad is clj-stacktrace would probably have been builtin had rich known about it when he changed 1.3's stacktraces |
| 21:23 | alex_baranosky | ~shrimp |
| 21:23 | clojurebot | shrimp must be functors that map a category to itself. |
| 21:23 | duck1123 | is anyone out there using Midje with lazytest? I started with lazytest, but then I switched to midje because it had better support for "around" fixtures |
| 21:23 | hiredman | I added some inference stuff to clojurebot in the last few days, still tinkering with it |
| 21:23 | rplevy | hiredman: hehe |
| 21:24 | alex_baranosky | duck1123L: funny you ask that; just tonight I was thinking about planning to figure out how to add auto.lazy powers to Midje |
| 21:25 | scottj | ibdknox: no bold in colorize? |
| 21:25 | alex_baranosky | but maybe I don't have to? Can Midje be simply composed with lazytest without needing any special purpose code? |
| 21:25 | ibdknox | scottj: I forgot to add those |
| 21:25 | ibdknox | scottj: I'll fix that tonight |
| 21:25 | rplevy | cemerick: do you know what the difference is between the new extended reader idea and full reader macro support? when the concrete implementation of a user-defined reader syntax is added, is it a function, and what is its input (character stream?, an s-expression form?) |
| 21:26 | alex_baranosky | scottj: more options here: https://github.com/stuartsierra/lazytest/blob/master/modules/lazytest/src/main/clojure/lazytest/color.clj |
| 21:26 | duck1123 | It might be. I fear that the way lazytest generates the test functions might interfere with midje's backgrounds |
| 21:26 | hiredman | rplevy: I think in rich's mind a big difference is you can namespace tags |
| 21:26 | scottj | ibdknox: also I don't know about console colors or colorize but maybe (inverse (blue "foo")) |
| 21:26 | alex_baranosky | hey ibdknox: want to add all the options from the lazytest link? Seems best to have one community colorize library... I can submit patch if you don't want to |
| 21:27 | scottj | alex_baranosky: ahh cool |
| 21:27 | duck1123 | scottj: trampoline with inverse to blink? |
| 21:27 | ibdknox | lol |
| 21:27 | ibdknox | alex_baranosky: sure |
| 21:27 | rplevy | hiredman: that is important, and makes sense |
| 21:30 | cemerick | rplevy: the data involved remains Clojure data literals, and the extended literals should nest and compose just like "regular" literals do today |
| 21:30 | cemerick | composition policies of reader macros is (AFAIK) left entirely up to the macro implementations themselves |
| 21:31 | cemerick | cooperative vs. preemptive multitasking, applied to reader policy and literal composition :-P |
| 21:32 | rplevy | cemerick: ok, great, that seems only slightly less powerful than user-defined reader macros. Not possible to add support for a string without escaping quotes for example. |
| 21:32 | cemerick | right |
| 21:32 | cemerick | you can define reader macros today anyway, if you're willing to go black hat :-P |
| 21:33 | cemerick | and be stoned in public, perhaps |
| 21:33 | rplevy | patch the clojure source, yup :) |
| 21:33 | cemerick | nah, at runtime |
| 21:33 | rplevy | oh |
| 21:34 | duck1123 | probably still stoned in public |
| 21:34 | cemerick | doubly so, actually |
| 21:40 | scottj | I have a reader macro to do member access, #.foo:bar is (or (:bar foo) (get foo "bar")) |
| 21:47 | amalloy | i...you...what. scottj, that is terrible |
| 21:48 | scottj | amalloy: I know, I actually never use it :) |
| 21:48 | amalloy | haha k. i won't preach then |
| 21:48 | scottj | but I do think symbol syntax for lookup would be nice |
| 21:48 | hiredman | it's coming |
| 21:48 | amalloy | i don't know what "symbol syntax for lookup" means |
| 21:49 | scottj | foo:bar |
| 21:49 | hiredman | http://dev.clojure.org/jira/browse/CLJ-872 |
| 21:49 | hiredman | http://dev.clojure.org/jira/browse/CLJS-89 |
| 21:49 | scottj | http://www.youtube.com/watch?v=OiaYxaONChg |
| 21:49 | scottj | at the end I show symbol syntax for lookup working in clojure |
| 21:50 | hiredman | horrible |
| 21:50 | amalloy | scottj: only works when both foo and bar are symbols. seems like pretty limited utility |
| 21:50 | amalloy | you can't, like foo:(inc bar) |
| 21:50 | scottj | it is limited, but it's a pretty common use case still |
| 21:51 | zerokarmaleft | scottj: oh man, i was wondering who did these crack videos |
| 21:51 | scottj | zerokarmaleft: guilty |
| 21:52 | zerokarmaleft | scottj: not complaining really, a lot of screencasts tend to drag |
| 21:56 | scottj | hiredman: I don't think any of those do the lookup I was talking about that doesn't require parnes |
| 21:56 | scottj | parens |
| 21:57 | cemerick | scottj: did you do a custom build, or the runtime reader hack? |
| 21:57 | scottj | cemerick: in the video custom build, but I've also implemented the same thing as a runtime reader |
| 21:57 | scottj | custom build is naturally better because you don't have to prefix with #. |
| 21:58 | scottj | s/naturally better/some description rhickey wouldn't object to/ |
| 21:58 | scottj | shorter :) |
| 21:58 | cemerick | heh, right |
| 21:59 | scottj | I showed it to rhickey at the first conj and he hated it :) |
| 21:59 | cemerick | oh, I'm sure :-) |
| 21:59 | cemerick | these things happen |
| 22:09 | TimMc | cemerick: That flowchart is far too convoluted. |
| 22:10 | cemerick | TimMc: I agree. |
| 22:10 | rplevy | I'm curious to investigate this runtime reader hack, but then I might actually use it sometime, so it's better I not know the details, haha. |
| 22:10 | TimMc | cemerick: I only just realized that the "Interop zone |
| 22:11 | TimMc | " leaks, in the lower left. |
| 22:11 | cemerick | yup |
| 22:24 | TimMc | I see. |
| 22:24 | TimMc | Your publisher won't mind putting it on a centerfold, right? |
| 22:27 | cemerick | hah |
| 22:27 | cemerick | :-) |
| 22:46 | jodaro | http://code.google.com/p/clojure-cxx/ |
| 22:46 | TimMc | lolwut |
| 22:47 | jodaro | yeah |
| 22:47 | jodaro | its amazing what the googles find for you |
| 22:51 | tensorpudding | qt? |
| 22:52 | tensorpudding | not a very busy project |
| 22:52 | jodaro | yeah |
| 22:52 | hiredman | well, google code |
| 22:53 | tensorpudding | google code isn't bad |
| 22:53 | tensorpudding | i contributed to projects hosted there |
| 22:53 | tensorpudding | they had the good sense to not use svn though |
| 22:53 | jodaro | yeah i used it before github |
| 22:55 | tensorpudding | no readme, no docs, no boilerplate |
| 22:55 | tensorpudding | it must not be far along yet |
| 23:04 | jodaro | wow |
| 23:05 | jodaro | you can suck a project right out of an svn repo when you create it on github |
| 23:05 | jodaro | keeps dates and commit messages intact |
| 23:14 | sritchie | hey guys, are protocols defined with defprotocol accessible from java? |
| 23:14 | cemerick | sure |
| 23:14 | hiredman | it sort of depends |
| 23:14 | cemerick | the compile down to interfaces, which you can implement |
| 23:14 | hiredman | but defprotocol generates an interface, and defrecords with the protocol inline will implement the interface |
| 23:14 | sritchie | So with aot compilation, I can import a protocol as an interface |
| 23:15 | cemerick | right |
| 23:15 | sritchie | sure, I'm just looking to create an interface for other java classes to implement if they like |
| 23:15 | sritchie | and wondering if the way to do that is to aot-compile the namespace containing the protocol |
| 23:15 | hiredman | there is also a definterface |
| 23:15 | hiredman | where you can specify argument types, etc |
| 23:17 | sritchie | okay, that's good to know about |
| 23:18 | sritchie | the docs from defprotocol state that it "has no special compile-time effect" |
| 23:19 | hiredman | *shrug* |
| 23:19 | sritchie | I guess I'll try it, or go with definterface |
| 23:20 | hiredman | http://clojure.org/protocols |
| 23:21 | sritchie | yeah, this looks good: "A Java client looking to participate in the protocol can do so most efficiently by implementing the protocol-generated interface" |
| 23:21 | sritchie | I'm just having trouble tracking down an example |
| 23:21 | sritchie | of the clojure-> java route, that is; java->clojure is clear and wonderful |
| 23:26 | hiredman | http://clojure-log.n01se.net/date/2009-10-13.html#12:02 |
| 23:26 | hiredman | 3 years ago |
| 23:28 | cemerick | hiredman: 2 years, just 2! |
| 23:29 | hiredman | lets see |
| 23:29 | hiredman | (- 2011 2009) |
| 23:29 | clojurebot | 2 |
| 23:29 | hiredman | I see |
| 23:33 | sritchie | thanks, reading through now |
| 23:33 | Raynes | cemerick: Grandpa. |
| 23:33 | cemerick | Get off my lawn!!!11!!1! |
| 23:37 | tensorpudding | does clojurebot parse everything that starts with ( as a clojure statement |
| 23:38 | tensorpudding | (hmm) |
| 23:38 | hiredman | no |
| 23:38 | hiredman | just math |
| 23:38 | hiredman | (+ 5 4) |
| 23:38 | clojurebot | *suffusion of yellow* |
| 23:38 | tensorpudding | (- (* 2 3) 4) |
| 23:38 | hiredman | (* 2 1) |
| 23:38 | clojurebot | 2 |
| 23:38 | tensorpudding | not very clever |
| 23:38 | tensorpudding | ,(- (* 2 3) 4) |
| 23:38 | clojurebot | 2 |
| 23:39 | hiredman | 2d64+24 |
| 23:39 | clojurebot | 83 |
| 23:39 | tensorpudding | 2d64 |
| 23:39 | clojurebot | 20 |
| 23:39 | Raynes | cemerick: I heard that you are going to switch to Leiningen for your projects. |
| 23:39 | tensorpudding | oh, that's random? |
| 23:39 | tensorpudding | thought it was some fancy radix magic for a moment |
| 23:39 | cemerick | Raynes: once the right pieces are in place, yes |
| 23:40 | hiredman | it's dice |
| 23:40 | tensorpudding | there's an alternative to lein? |
| 23:40 | Raynes | cemerick: Uh… Dude, we already have lein-hammock. What more can you possibly need? |
| 23:40 | cemerick | :-) |
| 23:40 | tensorpudding | i heard of cake |
| 23:40 | cemerick | not much of a hammock person, perhaps |
| 23:41 | tensorpudding | but only when i heard that it was going to get merged with lein |
| 23:41 | cemerick | tensorpudding: maven, ant, gradle, rake, buildr…various options |
| 23:41 | cemerick | bash FTW |
| 23:43 | tensorpudding | i didn't think maven was as easy to use |
| 23:43 | tensorpudding | and ant...that's java junk |
| 23:43 | Raynes | "Java junk" mostly applies to Clojure as well. |
| 23:43 | tensorpudding | i should have said, xml junk |
| 23:43 | Raynes | And maven is arguably not as easy to use, but that doesn't stop people from using it. Leiningen uses maven for dependency management. |
| 23:44 | hiredman | no xml in maven |
| 23:44 | tensorpudding | i meant ant |
| 23:44 | tensorpudding | maven seems sane enough |
| 23:44 | cemerick | no build tool is sane |
| 23:44 | tensorpudding | i've never heard of gradle and i'm pretty sure rake is from ruby |
| 23:45 | klauern | gradle is ant with Groovy instead of XML |
| 23:45 | klauern | or at least how I see it |
| 23:45 | tensorpudding | lein is the simplest project tool i've seen in a while |
| 23:45 | cemerick | I assure you, it's not simple. |
| 23:46 | cemerick | Much more pleasant learning curve, certainly. |
| 23:46 | tensorpudding | where's the complication? |
| 23:47 | klauern | http proxies, mirror/proxy maven repos, dependency / dev-dep duplication, |
| 23:47 | tensorpudding | proxies? |
| 23:48 | tensorpudding | wouldn't any tool doing dependency fetching have to deal with that? |
| 23:49 | klauern | you'd think so, but so many people don't have to worry about them that it doesn't get implemented right away |
| 23:49 | tensorpudding | i meant more of |
| 23:49 | tensorpudding | what tools get that right? |
| 23:49 | klauern | I had problems with Ruby doing it right up until about a year ago |
| 23:50 | klauern | It's an enterprise-level feature, so I would guess it's just not high priority unless you work in one |
| 23:50 | klauern | I run into it all the time, so half of my tickets for projects are "add http proxy support" or something to that effect |
| 23:50 | tensorpudding | why is http proxying enterprise? |
| 23:50 | tensorpudding | i thought http proxying was to get around firewalls |
| 23:50 | tensorpudding | and for caching performance blah blah blah |
| 23:51 | klauern | yeah, but I don't have one at home, and I don't know many startups that even worry about that kind of thing |
| 23:51 | hiredman | no, it's for keeping on eye on employees |
| 23:51 | hiredman | an |
| 23:51 | klauern | I see it as something corporations make sure they have checked on some form so they can claim "strong" security standards |
| 23:52 | tensorpudding | bleh |
| 23:53 | klauern | I tend to think that if a tool can support all that bloated enterprisey stuff, they gain a large number of dabblers that can test and patch code |
| 23:54 | klauern | I know I wouldn't be contributing much if I couldn't run Leiningen behind a proxy for 80% of my workflow |
| 23:54 | klauern | not that I'm patching code, but I'm definitely dabbling |