2012-02-03
| 00:11 | muhoo | ok stupid question time. first returns nil if the list is empty, but rest returns empty list? |
| 00:11 | muhoo | that seems... confusing. |
| 00:13 | muhoo | (let [foo '()] [(first foo) (rest foo)]) |
| 00:13 | muhoo | &(let [foo '()] [(first foo) (rest foo)]) |
| 00:13 | lazybot | ⇒ [nil ()] |
| 00:14 | _phil | ,(doc rest) |
| 00:14 | clojurebot | "([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument." |
| 00:14 | G0SUB | muhoo, that's the difference between rest & next. |
| 00:15 | G0SUB | ,(doc next) |
| 00:15 | clojurebot | "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." |
| 00:15 | muhoo | hm, ok. it still seems weird to me. |
| 00:15 | _phil | ,(reduce + 0 nil) |
| 00:15 | clojurebot | 0 |
| 00:16 | G0SUB | muhoo, use next if you need that behavior. |
| 00:16 | _phil | ,(reduce + nil) |
| 00:16 | clojurebot | 0 |
| 00:16 | _phil | ok then i dunno what it is for :) |
| 00:17 | _phil | since functions operating on seqs seem to not have any problems with nil |
| 00:17 | muhoo | &(seq nil) |
| 00:17 | lazybot | ⇒ nil |
| 00:17 | muhoo | &(seq) |
| 00:17 | lazybot | clojure.lang.ArityException: Wrong number of args (0) passed to: core$seq |
| 00:18 | muhoo | ok, so first/next instead of first/rest, got it. |
| 02:20 | echo-area | Is `alter' retried for every commits in other transactions? |
| 02:21 | echo-area | E.g. if there are 5 versions made by some other transactions, an alter will be retried for 5 times? |
| 02:24 | echo-area | http://pastebin.com/PqatZHZu |
| 02:25 | echo-area | For example, the transaction in function `retries' is always retried for 3 times |
| 02:42 | echo-area | Hmm, Clojure's Java source code is in Whitesmiths style |
| 02:51 | raek | echo-area: have you seen this? http://java.ociweb.com/mark/stm/article.html |
| 02:51 | echo-area | raek: No, but I'm reading now, thank you |
| 02:55 | echo-area | raek: The first glance makes me believe that this link is definitely more informational than the source code. Thank you! |
| 02:57 | raek | the point in time when it is determined if the current transaction should be retried is at the end of the transaction |
| 02:57 | raek | they are optimistic, so they won't be aborted halfway through |
| 02:59 | echo-area | I seem to understand what these two sentences mean, but don't know how this connects to my question. Will come back to them when I finish reading. |
| 03:00 | raek | "Is `alter' retried for every commits in other transactions?" Calls to alter are not retried, whole dosync blocks are. |
| 03:01 | raek | "E.g. if there are 5 versions made by some other transactions, an alter will be retried for 5 times?" |
| 03:02 | raek | if those 5 changes by some other thread all happen during the transaction of the first thread, the transaction if the first thread will be retried once |
| 03:02 | echo-area | Oh, I see. So when the whole transaction is retried for the second time, another change to `r1' happens, this triggers the third retry. |
| 03:03 | echo-area | Completely understood. Thank you :) |
| 03:03 | raek | the "start point" and the "end point" of a transaction are where the interesting things happen at... |
| 03:15 | mduerksen | what tools are recommended for authentication in a ring-based web-app? |
| 03:15 | mduerksen | sandbar? |
| 03:33 | brehaut | mduerksen: what tools are recommended for building a build? it depends on the building |
| 03:38 | Blkt | good morning everyone |
| 03:40 | mduerksen | brehaut: you're right, my question is quite vague. next try: do you know of other alternatives for basic-authentication+ssl in a ring-based web-app? |
| 03:55 | tscheibl | mduerksen: cookies + ssl |
| 03:55 | clojurebot | I don't understand. |
| 04:05 | mduerksen | tscheibl: yes, basic-auth for login, then cookies, and everything with ssl, that's what i have in mind. my question is: should i write it myself, with my own ring middleware for redirecting to https when necessary, together with ring.middleware.cookie, or is there already a solution for this? i'm not experienced in security and authentification, so i don't know what puzzle pieces i may miss. |
| 04:05 | ivan___ | Good Evening. In scala i have a state machine that is implemented with actors because we have several tasks running through it - ie one thread manages a lot of of concurrent workflows. Is there a way I can do this with clojure? I've been looking at agents but im not 100% sure |
| 04:11 | aperiodic | yeah, agents are an easy way to do that |
| 04:12 | aperiodic | i have some code that does farms out most of its io to agents |
| 04:12 | aperiodic | to deal with so many failures and dropped connections |
| 04:13 | aperiodic | basically, set the state of the agent to the data you want to send, then write a function that takes that state as input and attempts to flush it |
| 04:14 | aperiodic | it returns what it didn't manage to flush, so if it flushed everything, it returns an empty collection |
| 04:15 | ivan___ | aperiodic: so one state machine is something that provisions a ec2 server. the workflow is, you launch a server, then wait until it comes up, currently in akka I use a scheduler to send a message every 10s to look at state of server to see if its ready |
| 04:15 | ivan___ | if its not, i send the same state 10s later |
| 04:15 | ivan___ | if it is, im done |
| 04:15 | aperiodic | ivan___: you could have the agents implement state machine functionality, sure |
| 04:15 | aperiodic | they run in their own threads |
| 04:16 | ivan___ | 1 agent = 1 thread? |
| 04:16 | aperiodic | yup |
| 04:16 | aperiodic | use send-off! to start an io-bound agent, though |
| 04:16 | ivan___ | what happens if you want to have say 10 threads for the state machines (in akka you do 10 actor instances, and you can load balance them) |
| 04:16 | aperiodic | it denotes that it's gonna be sleeping a lot, so cpu cores will be oversubscribed |
| 04:16 | aperiodic | that's fine |
| 04:16 | aperiodic | fire them up as needed |
| 04:17 | aperiodic | when you need to wait on one, deref it (see the '@' reader macro) |
| 04:17 | aperiodic | they're even stopped if the reference is gc'd! |
| 04:18 | aperiodic | that's one of the great things about clojure; this kind of thing is not hairy at all |
| 04:18 | aperiodic | i mean, i haven't had an issue, it's possible YMMV |
| 04:18 | ivan___ | do they have to store state? |
| 04:18 | aperiodic | my n is 1 |
| 04:19 | aperiodic | well you can just think of it as a computation |
| 04:19 | ivan___ | so in akka my state is what i send the actor, its not actaully reading input, and mutating state |
| 04:20 | ivan___ | the function that reads the state sends a new message back to itself with the new state, progressing the machine |
| 04:20 | aperiodic | the state machine is implemented as a pure function? |
| 04:21 | aperiodic | you can do the same thing in clojure |
| 04:21 | ivan___ | so its like def receive = { case Task("somestate") => self ! Task("somenewstate") |
| 04:21 | ivan___ | if you are familiar with scala at all .. |
| 04:21 | aperiodic | i am not familiar in the least, sorry |
| 04:22 | aperiodic | but you can have the actor do only io |
| 04:22 | aperiodic | um, agent |
| 04:22 | aperiodic | sorry |
| 04:22 | aperiodic | or do both |
| 04:22 | ivan___ | thats just matching a case with state == somestate, and sending a new message back to the actor with the updated state, no internal mutation of state |
| 04:22 | ivan___ | ok |
| 04:23 | ivan___ | it doesnt help that im learning clojure while doing this ;) |
| 04:23 | aperiodic | have you done any erlang? |
| 04:24 | aperiodic | this sounds a bit similar to some erlang idioms i've seen |
| 04:24 | echo-area | Is add-watcher removed in the current Clojure? |
| 04:24 | ivan___ | yeah i believe akka/scala actors were based on erlang |
| 04:24 | ivan___ | i havent done any erlang, although its on my todo list |
| 04:25 | ivan___ | we do use erlang at work (the scala state machine is from a work project too) |
| 04:25 | ivan___ | aperiodic: i guess one question i have is am i even approaching this the right way in clojure. I feel like im just trying to reimplement an actor |
| 04:26 | aperiodic | have you read through all the sidebars on clojure.org? |
| 04:26 | ivan___ | ive done about half 4clojure.org hehe, and read some of the sidebars |
| 04:27 | ivan___ | aperiodic: until i found 4clojure i was really lost in lisp |
| 04:27 | aperiodic | i'd highly recommend sitting down and reading through all those sidebars |
| 04:28 | aperiodic | once i grokked clojure's focus on immutability and its approaches to concurrency writing this sort of code became much easier for me |
| 04:28 | ivan___ | immutability is fine, most of the scala i write is immutable, its more the approach to concurrency |
| 04:29 | aperiodic | each concurrency primitive has a really well-defined scope, and one is usually a fairly natural fit for any given way i want to access the data/have the computation performed |
| 04:29 | ivan___ | actaully learning clojure has been fairly easy, everything is a function, just look up the function api |
| 04:29 | aperiodic | right? |
| 04:29 | aperiodic | it's just a big list |
| 04:29 | aperiodic | not some crazy javadoc where you have to do the class hunt |
| 04:30 | aperiodic | also, i've been reading through joy of clojure this weex |
| 04:30 | aperiodic | *week |
| 04:30 | aperiodic | and i've learned a ton |
| 04:30 | ivan___ | aperiodic: so there is one more constraint i havent told you about... i need to update a db each time the state changes, and have the state machine be resumable - this is by far the hardest part of the whole exercise since state machines are pretty common |
| 04:31 | aperiodic | afraid i don't have any RDB experience |
| 04:31 | aperiodic | only redis and hbase |
| 04:31 | ivan___ | we are probably going to be using redis |
| 04:31 | ivan___ | but where its persisted is irrelevant |
| 04:31 | ivan___ | thats easy |
| 04:31 | Psy-Q | wow, that's some big doc comments in clojure core :| |
| 04:32 | aperiodic | ivan___: i've found using redis to be pretty painless |
| 04:32 | ivan___ | aperiodic: currently we store everything in json on disk, anything is painless compared to that... :) |
| 04:33 | aperiodic | ivan___: just in the fs? access it via file open? |
| 04:33 | ivan___ | i mean, im trying to right a v2 of this app, v2 wont do fs |
| 04:33 | aperiodic | ivan___: gotcha ;) |
| 04:34 | patchwork | I am having a problem with load-file. I try to say (use 'clojure.string) but it gives me "Unable to resolve symbol: use in this context"? Does load-file really not know use? |
| 04:35 | aperiodic | ivan___: i don't see much need for a state-machine framework/library... i think they're implemented pretty well using letfn |
| 04:35 | twem2 | // |
| 04:35 | twem2 | # |
| 04:35 | twem2 | uit |
| 04:36 | aperiodic | ivan___: if you wanted you could write some macros for that, or even just high-level functions |
| 04:36 | ivan___ | aperiodic: a workmate said we could implement it around a blocking queue, actors are just conventent in scala |
| 04:36 | ivan___ | i need to read up on concurrency more |
| 04:38 | lucian | ivan___: your scala case can be expressed in a regular clojure function in several ways, afaikl |
| 04:38 | aperiodic | ivan___: i usually use a map, since our data is coming in semi-structured, and it allows me to, e.g., flush certain parts of that structure faster than others |
| 04:38 | lucian | ivan___: explicit (case ...), multimethod, protocol |
| 04:38 | ivan___ | i was just pointed to channels |
| 04:39 | lucian | ivan___: there are also a few matching libraries for clojure |
| 04:39 | lucian | ivan___: i think i'd express a state machine as a multimethod |
| 04:39 | aperiodic | ivan___: have the main thread loop through the structure and see what needs flushing, then farm out the actual transaction to an agent, have the agent return what it couldn't flush, rinse, repeat |
| 04:39 | ivan___ | lucian: that stuff im not really worried about, its more the state changes |
| 04:40 | aperiodic | ivan___: but i'm not a whiz or anything, so there are almost certainly better ways to do it ;) |
| 04:40 | lucian | ivan___: right. the way i understand it (and i'm a clojure newbie too) is that you give the actor a function to change itself with |
| 04:40 | lucian | s/actor/agent/ |
| 04:40 | ivan___ | aperiodic: i think ill ask again tomorrow during more primetime, but you have given me things to thing about |
| 04:40 | lucian | dammit, the terms are too similar |
| 04:40 | ivan___ | lucian: yeah, although im not sure i even need an agent |
| 04:41 | lucian | ivan___: so i think you could put your data in an agent and then pass it the state machine function until it runs out of data |
| 04:41 | osa1 | why (type 'true) is java.lang.Boolean? shouldn't it be clojure.lang.Symbol ? |
| 04:41 | aperiodic | ivan___: yeah, i'll probably be actually online 2-5 PST |
| 04:42 | lucian | ivan___: they seem the right thing to use here, i guess. i highly recommend reading The Joy of Clojure |
| 04:42 | ivan___ | aperiodic: i think ill try and write some code with an agent, and then gist it and ask for advice... one issue i have is actaully visualising what we have been talking about ;) |
| 04:42 | aperiodic | ivan___: yeah, that's how one really gets a handle on things. |
| 04:43 | aperiodic | man fogus must love us |
| 04:43 | ivan___ | i have a few ideas |
| 06:27 | osa1 | why (type 'true) is java.lang.Boolean? shouldn't it be clojure.lang.Symbol ? |
| 07:05 | raek | osa1: no. true, false, and nil look like symbols but they aren't |
| 07:14 | osa1 | raek: why do we need false and true as symbols when we already have true/false special values? |
| 07:18 | fhd_ | I'm changing the Leiningen source path by setting :source-path (to src/clj), but now it doesn't find my custom plugin (under src/clj/leiningen) anymore. Ideas? |
| 07:26 | raek | osa1: are you asking why one would want to have true/false/nil as special values or why one would want to have true/false/nil as symbols? |
| 07:27 | osa1 | raek: actually why one would want to have both at once |
| 07:28 | raek | I didn't say that one would want that |
| 07:28 | raek | but technically it is possible in CLojure |
| 07:29 | raek | (just not recommended) |
| 07:29 | lucian | one could make false truthy or something |
| 07:30 | raek | that too :) |
| 08:30 | yawNO | howdy world |
| 09:07 | uvtc | When using `ns`, why don't the "references" need to be quoted? That is, (ns foo (:use (my.lib this that))) seems like it ought to be (ns foo '(:use (my.lib this that))) or (ns foo (:use '(my.lib this that)))... |
| 09:09 | compj | ns is a macro I guess |
| 09:10 | uvtc | Seems like Clojure would try to treat (my.lib this that) as a fn call... and also it would not be able to resolve those symbols. |
| 09:13 | compj | the forms are already quoted passed to the (ns...) call, because it is a macro |
| 09:13 | compj | sentence broken, hope you get it :) |
| 09:14 | uvtc | compj, thanks. Yes ... macros appear to be aware of the matrix. :) |
| 09:14 | uvtc | Is there a way to ask if a given symbol refers to a macro (as opposed to a regular fn)? |
| 09:15 | compj | try (.isMacro #'ns) |
| 09:16 | compj | don't think this is part of the stable api |
| 09:16 | uvtc | compj: oooh. |
| 09:17 | uvtc | compj, neat. Oh, doh -- also it says right at the top of the output from `(doc ns)` that it's a macro. Should've noticed that. |
| 09:17 | TimMc | Huh, I figured that was a special form. |
| 09:18 | compj | yes, thought you were looking for a api call. (:macro (meta #'ns)) should also work |
| 09:18 | TimMc | seeing as it is used in the first form in core.clj |
| 09:19 | compj | is defined in core.clj:5065 here |
| 09:25 | TimMc | Interesting... |
| 09:25 | TimMc | but it is definitely used at the top of the file, also |
| 09:26 | compj | so macros can be used over its definition, maybe |
| 09:26 | TimMc | That's probably a compiler literal that is later shadowed by a macro. |
| 10:07 | Psy-Q | any book recommendations to get into clojure? |
| 10:08 | joegallo | Joy of Clojure is very good. |
| 10:08 | Psy-Q | i'm reading Joy of Clojure and will probably get the pragprog book, but beyond that i'd be happy about recommendations. |
| 10:08 | Psy-Q | oh good, then i'm on the right path :) |
| 10:08 | joegallo | "The best book on programming for the layman is 'Alice in Wonderland'; but that's because it's the best book on anything for the layman." |
| 10:08 | joegallo | ;) |
| 10:08 | joegallo | jk, jk |
| 10:09 | Psy-Q | :) |
| 10:09 | Psy-Q | it seems there's no section on book recommendations in the wikibook linked from clojure.org |
| 10:09 | jeremyheiler | Psy-Q: Just start creating stuff. |
| 10:09 | Psy-Q | is that on purpose, so as not to be biased towards anyone's book? |
| 10:09 | TimMc | Doubt it. |
| 10:10 | algernon | It's because all of them are awesome, so if you buy and read any Clojure book, that's good. |
| 10:10 | jeremyheiler | Psy-Q: oh, and solve problems on 4clojure.com ! |
| 10:10 | Psy-Q | jeremyheiler: we're making a media archive system and we have a small REST interface now, i wanted to dive into the deep end and make something in clojure that displays a grid of images from the archive via REST with a java GUI |
| 10:11 | jeremyheiler | Psy-Q: Nice, that sounds cool. |
| 10:11 | Psy-Q | could do that in clojurescript with a browser, now that i think about it |
| 10:11 | Psy-Q | jeremyheiler: ah, will do 4clojure stuff this weekend then |
| 10:48 | brett_h | Java Interop question: I can't figure out how to access the CompressionType enum given the SequenceFile class http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/io/SequenceFile.CompressionType.html |
| 10:48 | brett_h | I've tried (. foo bar), foo/bar, etc to no avail |
| 10:48 | joegallo | SequenceFile$CompressionType |
| 10:48 | joegallo | bit a wart, imho |
| 10:49 | joegallo | bit of a wart, even |
| 10:50 | brett_h | thanks |
| 10:50 | brett_h | ah, that's kind of hidden on http://clojure.org/java_interop :) |
| 10:51 | brett_h | hmm, Unable to resolve symbol: SequenceFile$CompressionType in this context |
| 10:51 | joegallo | of course, that's the actual class on disk, but java provides pretty sugar when you reference it |
| 10:51 | joegallo | import it? |
| 10:51 | brett_h | SequenceFile is |
| 10:52 | joegallo | gotta do both, i think |
| 10:52 | brett_h | I don't have to/can't import CompressionType can I? |
| 10:52 | brett_h | hmm |
| 10:52 | joegallo | these are two distinct classes, the name relationship is a trap |
| 10:52 | brett_h | it's nested, now I'm confused, so do I actually import foo$bar? |
| 10:52 | joegallo | (:import (some.package Foo$Bar)) |
| 10:53 | joegallo | It's a legitimate distinct class, you just need to treat it as such, do not be fooled by the $. ;) |
| 10:54 | gtrak` | can you actually construct non-static inner classes from clojure? |
| 10:55 | gtrak` | in java you would do this.new InnerClass(); |
| 10:55 | raek | the whole nested classes thing is a java compiler invention |
| 10:55 | raek | it does not exist on the byte code level |
| 10:56 | raek | (except for some annotations and attibutes) |
| 10:56 | gtrak` | I imagine in clojure you would have to do (InnerClass. outer arg1 arg2..) |
| 10:56 | raek | gtrak`: ah, now I understood the question. |
| 10:56 | raek | in theory, yes |
| 10:57 | raek | you can look at the output from javap -c to see what the contstructors really look like |
| 10:57 | raek | there is a good article about this |
| 10:59 | raek | ah, here it is: http://www.theserverside.com/news/1363881/The-Working-Developers-Guide-to-Java-Bytecode |
| 11:03 | gtrak` | raek: thanks, on my reading list :-) |
| 11:03 | TimMc | tmciver and I are working on "import+", which will have renaming imports. |
| 11:04 | TimMc | Doing something about the inner$class situation would be in scope. |
| 11:22 | raek | TimMc: will it be able to import static fields too? (e.g. enum values) |
| 11:40 | tmciver | raek: you can import static fields like Math/PI but...no sure about enums |
| 11:44 | TimMc | raek: Sure, that's the goal. |
| 11:44 | TimMc | raek: We're actually building it off of clojure.contrib.import-static, which really needs an overhaul itself. |
| 13:17 | cemerick | FYI, new Mostly λazy: Episode 0.0.4 w/ hugod and tbatchelli about #pallet and more (from Clojure Conj 2011) http://wp.me/p1Y10D-15 |
| 13:18 | pyr | when / where is euroconj |
| 13:19 | tbatchelli | pyr: may 24+25, London |
| 13:19 | pyr | 'k sounds nice |
| 13:20 | tbatchelli | it does. Airplane tickets from SF don't look that nice though :( |
| 13:20 | pyr | heh |
| 13:20 | pyr | not gonna complain for once |
| 13:20 | pyr | tickets from geneva will be much less :) |
| 13:31 | tutysara | Hi room |
| 13:31 | mdeboard | hi |
| 13:31 | tutysara | clojure newbie |
| 13:31 | tutysara | trying to setup a clojure env with emacs |
| 13:32 | tutysara | following the instructions at - http://data-sorcery.org/2009/12/20/getting-started/ |
| 13:32 | tutysara | got an error while installing - slime-repl |
| 13:32 | mdeboard | tutysara: That is very outdated |
| 13:32 | the-kenny-w | 2009 is pretty outdated |
| 13:32 | dnolen_ | tutysara: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs |
| 13:32 | tutysara | slime-repl.el:122:39:Error: No setf-method known for slime-connection-output-buffer |
| 13:33 | tutysara | yes outdated |
| 13:33 | tutysara | let me try your link |
| 13:33 | mdeboard | It's literally like 2 steps nowadays :P |
| 13:33 | the-kenny-w | Short version: Use leiningen, install swank-clojure as leiningen plugin, install clojure-mode in emacs and do M-x clojure-jack-in |
| 13:34 | tutysara | as simple as that? |
| 13:35 | technomancy | you probably have to get rid of your current slime setup first |
| 13:35 | mdeboard | tutysara: Yes |
| 13:35 | mdeboard | tutysara: It's extremely easy thanks to that one dude who made lein |
| 13:35 | mdeboard | and all the other contribs to it |
| 13:36 | the-kenny-w | technomancy: Btw. is there a way to prevent jack-in from bootstrapping slime by installing a compatible version? Sometimes, when I restart emacs, I find myself without slime when I want to use it with scheme. |
| 13:39 | technomancy | the-kenny-w: if you don't want to bootstrap slime you should use lein swank instead of jack-in |
| 13:40 | the-kenny-w | Hmm |
| 13:40 | the-kenny-w | Nah, I'll stick with jack-in. |
| 13:57 | hagna | I suppose someone here would agree with Rich Hickey that you should leave information alone and not turn it into an object? |
| 13:58 | TimMc | hagna: Not sure where you're getting that. |
| 13:59 | TimMc | {:a 5} is an object |
| 14:00 | hagna | 56:23 in http://www.infoq.com/presentations/Simple-Made-Easy he said class with information-specific methods |
| 14:00 | TimMc | Oh, *classes*, sure. |
| 14:01 | hagna | heh not sure I get it then hmmm |
| 14:01 | TimMc | hagna: {:a 5} is an object that is an instance of.... let's see: ##(class {:a 5}) |
| 14:01 | lazybot | ⇒ clojure.lang.PersistentArrayMap |
| 14:02 | TimMc | that ^ |
| 14:02 | hagna | TimMc: I don't know clojure that well |
| 14:02 | hagna | TimMc: but an ORM does seem to hide information behind a micro-language |
| 14:02 | TimMc | ORM's are a whole 'nother kettle of monkeys |
| 14:03 | arohner_ | hagna: the point there is that each class is it's own mini-DSL, .getFoo, .getBar, etc, while 'everything is a map' means you can use the same api on all maps |
| 14:03 | TimMc | arohner_: Thanks, I was struggling to phrase that. |
| 14:04 | hagna | arohner_: so if I have a database then ... what's the nice way to represent the data? |
| 14:04 | hagna | everything is a map again? |
| 14:04 | arohner_ | hagna: every row is a map, in most clojure DB libraries |
| 14:05 | TimMc | a set or list or vector of maps |
| 14:06 | TimMc | or more likely, a seq of maps |
| 14:11 | ibdknox | hagna: try Korma: http://www.sqlkorma.com |
| 14:11 | hagna | seems to me the ORM made databse access more consistent and possible easier to reason about |
| 14:11 | hagna | ibdknox: ok |
| 14:12 | hagna | s/possible/possibly |
| 14:12 | TimMc | ibdknox: Does Korma provide data manipulation, or just retrieval? |
| 14:13 | ibdknox | TimMc: hm? I does all the standard SQL stuff |
| 14:13 | ibdknox | it* |
| 14:13 | ibdknox | insert/update/delete/select |
| 14:13 | ibdknox | korma.incubator has some of the DDL stuff in it too |
| 14:13 | ibdknox | though I didn't finish it |
| 14:18 | TimMc | I've run into a situation in one of my projects where SQL wasn't sufficient, so I pull allll the data into memory and munge it from there, then stuff it all into a different database at the end. |
| 14:19 | TimMc | Now there's a bit where I actually wish I had SQL semantics for data-structures. |
| 14:19 | TimMc | I probably just need to dump stuff into the DB sooner than I had been. |
| 14:20 | hagna | is it pretty simple to give someone a clojure program if that someone is using osx, windows, linux or droid linux? |
| 14:22 | TimMc | hagna: Yes, if they have a JVM installed. |
| 14:22 | TimMc | which most people do |
| 14:22 | ibdknox | TimMc: I played around with doing that |
| 14:22 | ibdknox | I don't have the motivation to really do it though |
| 14:22 | TimMc | ibdknox: ANy luck? |
| 14:22 | hagna | TimMc: so what do you give the person a jar file? |
| 14:23 | ibdknox | TimMc: yeah, it seemed like I could apply a decent subset of Korma's functionality directly to objects |
| 14:23 | TimMc | hagna: Yep. `lein uberjar` makes a jar with all the dependencies, and you hand them that and maybe a shell script to call java -jar foo.jar |
| 14:24 | dougs87 | TimMc: is that jar file then dependent on a particular JVM version? |
| 14:24 | TimMc | "Sufficiently recent" should be good. |
| 14:25 | dougs87 | same major version sort of thing? |
| 14:25 | ibdknox | TimMc: simple example: https://refheap.com/paste/601 |
| 14:26 | hagna | leiningen as in vs. the ants? |
| 14:26 | mdeboard | yes |
| 14:27 | hagna | that' |
| 14:27 | hagna | s quite humerous |
| 14:28 | ibdknox | TimMc: with some more macro magic, you could get rid of the (% :t) necessary |
| 14:32 | ibdknox | it'd probably be pretty useful |
| 14:35 | ibdknox | For those not using Noir, I'd love to hear why not :) |
| 14:38 | hagna | lein compile gave me Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core/main__init.class |
| 14:38 | technomancy | hagna: leiningen from git is not quite ready for consumption; use a stable release. |
| 14:39 | hagna | technomancy: ahh ok |
| 14:39 | hagna | I suppose I ought to delete .lein to get back to a fresh state? |
| 14:40 | chewbranca | ibdknox: I've been using noir for some personal projects and its been working well, clean framework that makes it easy to get stuff done. I would say the biggest issue is mainly just lack of 3rd party libs, especially coming from the rails world, but that will only get better with time |
| 14:40 | technomancy | hagna: probably doesn't matter, but you can try that if you have trouble |
| 14:41 | ibdknox | chewbranca: yeah, just a matter of people building them :) |
| 14:41 | hagna | technomancy: so I was following the instructions that say download lein then do lein self-install |
| 14:41 | TimMc | ibdknox: Yeah, definitely looks reasonable. |
| 14:42 | technomancy | hagna: yes, but the instructions point to the stable branch, not master |
| 14:42 | hagna | technomancy: do I need a different version of lein or just a different jar in the .lein/self-installs/ directory |
| 14:42 | hagna | oh oops I copied the link instead |
| 14:43 | chewbranca | ibdknox: one recommendation I have is to maybe add some documentation about how to go from a development noir app to actually running in a production environment. Right now I'm just using git and manually grabbing the latest and then I've got a little shell script that sets some server environment variables |
| 14:43 | hagna | technomancy: the link to download one file points to master http://zef.me/2470/building-clojure-projects-with-leiningen |
| 14:44 | chewbranca | which works decently well, but I'm not sure how to do things like no downtime deploys and what not, although that could be more related to my inexperience with the java ecosystem |
| 14:44 | technomancy | hagna: you'll do much better if you follow the official documentation rather than some dude's blog from 2 years ago =) |
| 14:44 | ibdknox | chewbranca: that's not really a noir-level problem |
| 14:45 | ibdknox | chewbranca: most of the time you should run a server in front of your actual app (nginx probably) |
| 14:45 | ibdknox | chewbranca: or you could deploy to heroku :) |
| 14:47 | hagna | technomancy: oh ok where is that on github? |
| 14:47 | technomancy | clojurebot: leiningen? |
| 14:47 | clojurebot | leiningen is always the easiest way |
| 14:47 | technomancy | ... |
| 14:47 | chewbranca | ibdknox: I agree that its not entirely a noir level problem, and I am running behind nginx, but nginx doesn't assist you in doing live deploys, you would want to use something like ha proxy for that |
| 14:47 | technomancy | hagna: yeah |
| 14:47 | TimMc | hagna: Google it! |
| 14:47 | chewbranca | ibdknox: but things like dev/production mode in noir I didn't see until I was poking around in the noir src |
| 14:47 | ibdknox | chewbranca: well, if you have nginx setup as a reverse proxy, you can do hot deploys |
| 14:48 | ibdknox | chewbranca: just bring up to instaces on different ports, swap the config and restart nginx |
| 14:48 | ibdknox | two* |
| 14:49 | chewbranca | yeah that works ok, I just thought haproxy handles reloading configs better when dealing with live connections |
| 14:49 | ibdknox | yeah, it will :) |
| 14:50 | chewbranca | ibdknox: anyways, I'm enjoying noir a lot and its working well, just giving my thoughts as someone new to clojure who started using noir as their first clojure web stack |
| 14:50 | ibdknox | chewbranca: you're right though, a tutorial or some documentation on that would be a good addition. There are a few such things I need to write at some point |
| 14:51 | ibdknox | chewbranca: I'm glad it's work out :) Thanks for the feedback! |
| 14:52 | chewbranca | ibdknox: no problem, thanks for the great projects! |
| 14:52 | ibdknox | man my typing is terrible today |
| 14:52 | pandeiro | ibdknox: it's the vim you've been vimming man |
| 14:53 | ibdknox | lol |
| 14:53 | ibdknox | I think it's the half-asleep bit more than anything heh |
| 14:53 | pandeiro | have you been doing a lot of client-side stuff too lately? |
| 14:54 | ibdknox | pandeiro: have you been talking to someone from the bay area clojure group? lol |
| 14:54 | ibdknox | I showed a bunch of stuff last night |
| 14:54 | pandeiro | ibdknox: wish i was... i would like to see! |
| 14:55 | ibdknox | well enough people hounded me last night that I'll try and put some stuff up this weekend |
| 14:56 | pandeiro | ibdknox: i won't hound you... in person |
| 14:56 | ibdknox | haha |
| 14:56 | pandeiro | can i ask you one question with a bug i'm having? |
| 14:56 | pandeiro | cljs.reader stuff |
| 14:57 | ibdknox | pandeiro: here's the example code I showed: https://refheap.com/paste/602 |
| 14:57 | ibdknox | sure |
| 14:57 | pandeiro | the cljs reader should be able to process maps with keys that begin with a colon and a number? |
| 15:00 | technomancy | ibdknox: doing a little sneak peaking? |
| 15:00 | technomancy | *peeking |
| 15:01 | pandeiro | for serialization purposes i am playing with cljs.reader/read-string and it can't handle such keys... when i try to debug, i come to a function in the same ns called number-literal? that i cannot get to return true... |
| 15:01 | pandeiro | anyway i could just file a bug on jira but i was trying to solve the mystery |
| 15:01 | ibdknox | technomancy: not of the thing I showed you :) |
| 15:02 | ibdknox | pandeiro: I'm not sure |
| 15:02 | ibdknox | sounds like a bug |
| 15:03 | dnolen | pandeiro: definitely a bug please open a ticket. |
| 15:03 | technomancy | ibdknox: aha. how many did you guys have there? |
| 15:03 | ibdknox | technomancy: 25ish? |
| 15:03 | technomancy | nice |
| 15:03 | pandeiro | dnolen: will do, sorry i couldn't patch it myself |
| 15:04 | dnolen | pandeiro: reader isn't actually that tricky :) feel to try to patch it at anytime ;) |
| 15:04 | dnolen | feel free |
| 15:07 | ibdknox | technomancy: that refheap has some new stuff in it actually. I've been working on some state management stuff and there's a little bit of my lazy-store in there too. Basically a map that you can request keys for that get fetched lazily and cached :) |
| 15:08 | pandeiro | dnolen: sadly i already did :) ... i can't get cljs.reader/number-literal? to ever return true, and there the trail goes cold for me |
| 15:09 | technomancy | you mean ... a memoized function? =) |
| 15:09 | ibdknox | technomancy: no, sorry, fetched over the network :) |
| 15:09 | technomancy | gotcha |
| 15:09 | ibdknox | from the server to the client |
| 15:09 | dnolen | pandeiro: gotcha, please do put what you've discovered in the ticket |
| 15:17 | pandeiro | dnolen: http://dev.clojure.org/jira/browse/CLJS-142 |
| 15:18 | dnolen | pandeiro: thx |
| 15:26 | pjstadig | hugod: ping |
| 16:00 | daaku | is there some easy way to have code auto reload on file save in a running repl? (one started using `lein repl`) |
| 16:00 | brehaut | (use :reload 'my.namespace) |
| 16:00 | brehaut | or (use :reload-all 'my.namespace) |
| 16:00 | brehaut | you could probably steal some of the autoreload stuff from ring |
| 16:01 | brehaut | and those should be requires probably |
| 16:01 | daaku | brehaut: i use :reload atm, was wondering if i could somehow trigger that on file save -- the ring stuff for sure -- will look into it |
| 16:01 | duck1123 | I have a feeling it would be kind of annoying if your namespace was automatically reloaded on every save |
| 16:02 | brehaut | daaku: https://github.com/mmcgrana/ring/blob/master/ring-devel/src/ring/middleware/reload.clj |
| 16:02 | brehaut | daaku: looks like it depends on an ns-tracker library |
| 16:03 | brehaut | daaku: https://github.com/weavejester/ns-tracker |
| 16:04 | daaku | brehaut: nice, thanks -- that doesn't look terribly difficult to build into my stuff |
| 16:04 | daaku | trigger it via :repl-init |
| 16:04 | daaku | thanks |
| 16:16 | cemerick | LazySeq.withMeta forces the first value in the seq. Anyone know the rationale for that? |
| 16:19 | technomancy | does the fact that (seq ()) is nil imply that there's no such thing as an empty seq, only an empty list? |
| 16:20 | dnolen | ,(lazy-seq) |
| 16:20 | clojurebot | () |
| 16:20 | cemerick | There are definitely empty seqs. |
| 16:21 | technomancy | what's the rationale behind getting nil there then? |
| 16:21 | cemerick | I just can't think of why anything meta-related should impact realization. |
| 16:21 | tomoj | 'seq' is conflated? |
| 16:21 | technomancy | seems like a bizarre special case just to avoid using clojure.core/empty? |
| 16:22 | cemerick | (seq ()) => nil is just part of the contract. |
| 16:22 | cemerick | s/the/seq's |
| 16:22 | cemerick | but, (not= (seq ()) (lazy-seq ())) |
| 16:22 | technomancy | doesn't make it any less bizarre |
| 16:40 | cemerick | technomancy: I just realized that your first msg re: seqs had nothing to do with my msg re: meta on lazy seqs. :-P |
| 16:42 | technomancy | not necessarily |
| 17:17 | simonj | Confused as to why the seq returned by this func isn't lazy. https://gist.github.com/1716056 |
| 17:23 | Raynes | simonj: What is the type of nodes? (type nodes) |
| 17:24 | tmciver | simonj: my guess is that the call to getLength on nodelist walks the seq |
| 17:24 | hiredman | simonj: there is optimization on lazy-seqs called chunking that happens |
| 17:24 | hiredman | range creates a chunked seq, iterate does not |
| 17:25 | Raynes | That's what I figured. |
| 17:25 | Raynes | simonj: Your seq is still lazy, but instead of being evaluated one at a time as needed, it is evaluated in chucks of 32 elements. |
| 17:25 | hiredman | certain operations like for and map respect chunking |
| 17:39 | muhoo | does korma deal with composite primary keys? |
| 17:40 | muhoo | i.e. PRIMARY KEY (foo_id, bar_id, baz_id) , where all 3 are foreign keys referencing another table? |
| 17:44 | emezeske | technomancy: I'm having trouble finding the docs on what each :dependencies sub-vector can look like |
| 17:44 | muhoo | hagna: "droid linux"? |
| 17:44 | muhoo | what's that? |
| 17:44 | emezeske | technomancy: I'm probably just bad at google-fu :( |
| 17:44 | emezeske | technomancy: can you point me in the right direction? |
| 17:45 | technomancy | emezeske: I think it's all in "lein help sample"? |
| 17:45 | technomancy | lemme see |
| 17:45 | technomancy | yeah, just :exclusions, :type, and :classifier |
| 17:46 | emezeske | technomancy: gah, why didn't I look there!? |
| 17:46 | emezeske | technomancy: thanks |
| 17:46 | emezeske | technomancy: is it safe to assume that the first entry of the vector is always the symbol describing the jar? |
| 17:46 | technomancy | yep |
| 17:46 | emezeske | cool, thanks! |
| 17:47 | technomancy | sure |
| 17:47 | muhoo | hiredman: Raynes: also, i remember reading that "do" is an implicit non-lazy, or something like that. |
| 17:48 | Raynes | That'd surprise me. |
| 17:49 | amalloy | it's not clear what that means, but whatever it is it's nonsense |
| 17:52 | brehaut | muhoo: are you perhaps confusing dorun, doall, and doseq with plain do? |
| 17:53 | muhoo | brehaut: probably, yes. thanks. |
| 17:53 | brehaut | muhoo: do just lets you do a bunch of expressions imperatively; like { } in a c-family language |
| 17:54 | brehaut | (and the return value of a do is the result of the last expression) |
| 17:54 | muhoo | ah, ok. thanks. |
| 18:07 | daaku | for anyone interested in the repl auto reloading stuff, i made it into a module (uses java 1.7 file watching stuff) -- https://github.com/nshah/auto-reload.clj/blob/master/src/auto_reload/core.clj |
| 18:09 | aaelony | I've been using R for years with various tools, but the RStudio guys really did a great job providing an ideal IDE experience (Demo video at http://rstudio.org/). Would really nice to see something like that for Clojure as they've done a great job really thinking about how people use R and what they need/use. Worth checking out! :) |
| 18:26 | ibdknox | muhoo: it doesn't deal with composite keys implicitly, but you can always do your joins and specify the keys to join on |
| 18:33 | amalloy | does anyone know what the deal is with org.clojure.contrib/mock? it's got a name that sounds like...half compatible with 1.3, and half old-contrib; i can't figure out where its source is to have a look at it, and the only projects that depend on it seem to be hiccup and clojureql |
| 18:36 | Scriptor | on windows 7, where should should I install the emacs starter kit? |
| 18:36 | Scriptor | I tried putting it in documents and settings but it didn't seem to work |
| 18:36 | konr | No REPL was launched with clojure-jack-in, which I got from el-get. Must I launch it through a command or something? |
| 18:38 | technomancy | konr: I've seen that in a few cases, but I'm not sure what causes it. I recommend installing via marmalade in any case. |
| 18:38 | konr | technomancy: ok! Thanks! |
| 18:45 | TimMc | technomancy: Here's how I *tried* to do work in a temporary namespace: <https://refheap.com/paste/4f2b029ae4b03b1563d4028f> -- but in-ns inside a let doesn't do anything! How did you solve it in slamhound? |
| 18:45 | TimMc | I was looking, but failed to spot the trick. |
| 18:45 | technomancy | don't you just have to bind *ns* first? |
| 18:46 | TimMc | Huh! |
| 18:46 | TimMc | I'll take a look at that. |
| 18:46 | TimMc | technomancy: The interesting thing is that it works fine in a 'do form, just not in a 'let. |
| 18:47 | TimMc | Wow, is it really just as simple as binding *ns*? |
| 18:48 | technomancy | set! only works on bound vars |
| 18:49 | TimMc | I wasn't using set! at all. |
| 18:49 | technomancy | ,(source in-ns) |
| 18:50 | clojurebot | Source not found |
| 18:50 | technomancy | ~botsmack |
| 18:50 | clojurebot | clojurebot evades successfully! |
| 18:50 | TimMc | I'll take a look. |
| 18:51 | TimMc | Ah, it's a special. |
| 18:53 | TimMc | technomancy: It's interesting that you use 'remove-ns inside the binding. Looks dangerous! |
| 18:54 | technomancy | slamhound is hell of dangerous |
| 18:54 | technomancy | that's why it's named after an explosive device |
| 18:55 | TimMc | heh |
| 19:00 | TimMc | technomancy: It's not good enough -- I'm seeing defs from the "outer" namespace from inside. |
| 19:01 | TimMc | I wonder if macro expansion is the problem -- if things are getting namespace-resolved... |
| 19:03 | ibdknox | TimMc: what are you doing this for? |
| 19:04 | TimMc | ibdknox: I'm working with tmciver to bring clojure.contrib.import-static into 2012. I'd like the tests to not pollute each other's namespaces. |
| 19:05 | ibdknox | ah cool |
| 19:06 | TimMc | but for now I think we might just import stuff and test the test namespace |
| 19:25 | TimMc | Sample syntax: (import+ [java.awt Color [geom :rename {Point2D$Double P2D}]]) |
| 19:28 | TimMc | I'd like to unify that with static imports, and I'm kind of stuck on the syntax. |
| 19:31 | aperiodic | static imports? is that another import+ feature? |
| 19:31 | TimMc | hopefully! |
| 19:32 | TimMc | I'd like to be able to say, "I want sin, cos, and PI from java.lang.Math, but PI should be pi" |
| 19:34 | arohner | TimMc: how would that work? Wouldn't you need to create a clojure fn to wrap the java method? |
| 19:35 | aperiodic | do you have a static import syntax already? |
| 19:39 | TimMc | aperiodic: Insofar as import-static does. It's not very extensible, and that API will probably be thrown out for 2.0 |
| 19:39 | TimMc | arohner: Yep, needs to be wrapped in a hinted fn. I think it will be HotSpot-inlinable! |
| 19:39 | TimMc | arohner: c.c.import-static currently makes macros, which you can't pass around. Terrible. |
| 19:40 | TimMc | I was thinking that (import+ (java.lang (Math :statics {PI pi}))) would be reasonable, until I remembered that you can't distinguish packages from classes of the same name. |
| 19:41 | TimMc | emr, pretend those inner lists were vectors, for clarity ;-) |
| 19:42 | TimMc | I really don't want to give up the sub-package syntax. |
| 19:42 | aperiodic | yeah, that's pretty nice |
| 19:43 | TimMc | This should be able to simplify the handling of both fuckoff-long package names and classnames. |
| 19:44 | aperiodic | you mean i won't have to have thirty lines of hadoop class imports? |
| 19:44 | TimMc | Hopefully. |
| 19:45 | TimMc | You can only reduce the problem so much, though. |
| 19:47 | aperiodic | you say that the above syntax doesn't distinguish packages from classes: is the capitalization distinction for packages and classes just a convention? |
| 19:47 | TimMc | yeah |
| 19:47 | TimMc | And I just tried building com.java and com/foo.java in the same space -- it totally worked. |
| 19:48 | TimMc | Packages, classes, methods, and fields all have completely separate "namespaces". |
| 19:51 | benares_98 | Would this quicksort require O(n) extra memory allocation? https://refheap.com/paste/610 |
| 19:51 | aperiodic | that all map down to source code representations non-injectively |
| 19:51 | aperiodic | brilliant |
| 19:51 | aperiodic | is there any way to detect conflict/misuse? |
| 19:51 | TimMc | aperiodic: There *are* no conflicts, just abuses. |
| 19:52 | TimMc | benares_98: It will consume O(n) stack |
| 19:53 | TimMc | Memory allocation... I'm not even going to try to figure that out. |
| 19:54 | gfredericks | (malloc 10) |
| 19:54 | TimMc | haha |
| 19:54 | benares_98 | TimMc: that's what I meant thanks |
| 19:59 | arohner | gfredericks: goto is easy when you have access to the instruction pointer :-) |
| 19:59 | lynaghk | aperiodic, is that you Dan? |
| 20:01 | TimMc | gfredericks: I bet you love first-order continuations. |
| 20:02 | aperiodic | lynaghk: hey kevin! |
| 20:02 | lynaghk | how's it going? |
| 20:02 | lynaghk | small internets. |
| 20:03 | aperiodic | no kiddin' |
| 20:03 | lynaghk | Are you finally getting on the Clojure boat then? |
| 20:03 | arohner | where did wall-hack-method go? |
| 20:03 | aperiodic | I've been on the Clojure boat since about June |
| 20:03 | TimMc | arohner: From contrib? |
| 20:03 | aperiodic | finally starting to get the hang of it now |
| 20:03 | aperiodic | i think |
| 20:04 | lynaghk | Have you bitten the bullet and moved over to emacs then? |
| 20:04 | arohner | TimMc: didn't it get renamed, and possibly moved into cor? |
| 20:04 | hiredman | arohner: it got renamed to something boring |
| 20:04 | arohner | hiredman: yeah, I remember that, and now I can't find it |
| 20:04 | aperiodic | lynaghk: nope! vim forever |
| 20:05 | TimMc | aperiodic: I hear vim is pretty good for Clojure, actually. |
| 20:05 | aperiodic | TimMc: I've been meaning to trick it out more. Right now I only have syntax highlighting + tslime. |
| 20:06 | TimMc | aperiodic: And paredit, surely? |
| 20:06 | lynaghk | is there a paredit for vim? |
| 20:06 | TimMc | yep! |
| 20:06 | aperiodic | TimMc: I'll probably just copy Raynes's setup |
| 20:06 | lynaghk | Yes, Dan, you need the paredit! |
| 20:06 | aperiodic | TimMc: nope |
| 20:06 | lynaghk | talk to homer right now |
| 20:06 | aperiodic | i've been using % |
| 20:06 | TimMc | You *have* to have it. |
| 20:07 | gfredericks | augh; I wanted to find out how big this data structure was without vomiting it up on the screen so I said (count (prn data)) |
| 20:07 | TimMc | It's not as fully-featured as Emacs' version, but I wouldn't be able to code in lisps without it. |
| 20:07 | gfredericks | that was not the way to do it. |
| 20:07 | TimMc | haha |
| 20:07 | hiredman | (ha ha) |
| 20:08 | TimMc | I probably wouldn't even consider moving to vim until paredit.vim supported paredit-convolute-sexp |
| 20:08 | TimMc | (def ha #(% %)) |
| 20:08 | gfredericks | TimMc: I was just thinking that |
| 20:09 | hiredman | earlier today a co-worker and I were doing things with seqs of numbers, and we wanted to save some for local analysis, so (spit some-file some-numbers) |
| 20:09 | arohner | ok, so wallhack got moved to c.c.reflect |
| 20:09 | arohner | which also didn't get promoted |
| 20:09 | hiredman | and guess what was in the file we scp'ed down the localhost? |
| 20:09 | hiredman | ,(.toString (map inc (range 10))) |
| 20:09 | clojurebot | "clojure.lang.LazySeq@c5d38b66" |
| 20:10 | gfredericks | hiredman: wonderful |
| 20:11 | hiredman | arohner: there is a clojure.reflect now, but I think it only describes classes, no accessing fields or invoking methods |
| 20:13 | amalloy | arohner: https://github.com/flatland/useful/blob/develop/src/useful/java.clj#L28 if you don't need something officially blessed |
| 20:15 | arohner | amalloy: no worries, I still have https://github.com/arohner/clojure-contrib/tree/1.3-compat |
| 20:19 | hiredman | https://github.com/clojure/clojure-contrib/commit/cc4e2ec2bf558f059330ebc97a031d7806a1e364?w=true |
| 20:35 | daaku | i'm specifying a module for :repl-init which does things upon being required -- but seems like marginalia includes this module and ends up stuck because my :repl-init logic spawns a thread. not sure what the right fix is here (only start the thread for :repl-init somehow, or detect marginalia?). anyone got any pointers? |
| 20:36 | TimMc | Why would marginalia do that? |
| 20:37 | daaku | TimMc: to get the vars defined in the ns i assumed? |
| 20:37 | daaku | maybe it's lein doing it.. since i'm running "lein marg" (but then why is lein running :repl-init for "lein marg") |
| 20:38 | TimMc | Maybe the answer lies in the marg plugin. grep for the string "repl". |
| 20:38 | brehaut | daaku: i think marginalia uses its own reader to dig about your code, rather than loading the NSes? |
| 20:38 | brehaut | (it might do both though) |
| 20:40 | daaku | git grep repl in lein-marginalia yields nothing |
| 20:40 | daaku | oh, here's a definitive test -- this happens even without :repl-init defined |
| 20:41 | daaku | so it's marginalia that must be including the ns |
| 20:41 | daaku | or lein-marginalia |
| 20:45 | tmciver | I find that I finally have to learn how to write macros. I have what I think is probably a dumb question: why do I have to quote the if here: ##(list 'if true :true) |
| 20:45 | lazybot | ⇒ (if true :true) |
| 20:45 | tmciver | ,(list if true :true) |
| 20:45 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: if in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:47 | gfredericks | tmciver: if you didn't quote it that would mean you were trying to take its value |
| 20:47 | Null-A | ,(eval '(if true :true)) |
| 20:47 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 20:47 | TimMc | tmciver: Because you want the symbol, not its value. |
| 20:47 | TimMc | dammit, gfredericks-sniped |
| 20:47 | Null-A | ,(defn fact [n] 3) |
| 20:47 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 20:47 | TimMc | tmciver: Leaving aside 'if not resolving to a value at all, itself being a macor or special form. |
| 20:48 | TimMc | Null-A: The SANBOX forbids! |
| 20:48 | gfredericks | ,(let [if 12] (list if true :true)) |
| 20:48 | clojurebot | (12 true :true) |
| 20:48 | Null-A | ,((fn foo [n] (* (foo (dec n)) (foo (- n 2)))) 3) |
| 20:48 | tmciver | ooh, nice. |
| 20:48 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError> |
| 20:48 | gfredericks | ^ I'm sure that clears everything up |
| 20:49 | Null-A | ,((fn foo [n] (if (= n 1) 1 (* (foo (dec n)) (foo (- n 2))))) 3) |
| 20:49 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError> |
| 20:49 | tmciver | ,(list (symbol if) true :true) |
| 20:49 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: if in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:49 | Null-A | ,((fn foo [n] (if (<= n 1) 1 (* (foo (dec n)) (foo (- n 2))))) |
| 20:49 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 20:49 | tmciver | ,(list (symbol "if") true :true) |
| 20:49 | clojurebot | (if true :true) |
| 20:49 | tmciver | Got it! Thanks. |
| 20:49 | Null-A | ,((fn foo [n] (if (< n 2) 1 (* (foo (dec n)) (foo (- n 2))))) |
| 20:49 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 20:50 | Null-A | ,((fn foo [n] (if (< n 2) 1 (* (foo (dec n)) (foo (- n 2))))) 3) |
| 20:50 | clojurebot | 1 |
| 20:50 | Null-A | ,((fn foo [n] (if (< n 2) 1 (* (foo (dec n)) (foo (- n 2))))) 30) |
| 20:50 | clojurebot | 1 |
| 20:51 | gfredericks | Null-A: dost thou have thine own repl? |
| 20:51 | Null-A | no, I develop all my programs here |
| 20:51 | gfredericks | ah, carry on then |
| 20:51 | TimMc | Null-A: clojurebot and lazybot support /msg |
| 20:53 | brehaut | are we writing fibonaccis with the bots again? |
| 20:55 | Null-A | It would be like bill gates back in mainframe days |
| 20:56 | Null-A | He could only afford an ethernet cable and a 5 volt battery |
| 20:57 | gfredericks | one-repl-per-child |
| 20:57 | TimMc | and apparently only one window per IRC server? |
| 20:58 | TimMc | tmciver: Did you see my email? |
| 21:02 | TimMc | Ugh, I do *not* want an O(n^2) algorithm over a list of 1e4 items. |
| 21:02 | gfredericks | TimMc: so use a O(log n) algorithm duh |
| 21:02 | TimMc | Oh! |
| 21:02 | TimMc | Thanks, you're a life-saver! |
| 21:03 | TimMc | (I find it amusing that a layperson would not realize that was all a joke.) |
| 21:03 | gfredericks | haha laypeople are dumb |
| 21:04 | TimMc | >_< |
| 21:04 | gfredericks | TimMc: but I am curious what your algorithm is |
| 21:06 | TimMc | I have a list of image-to-tag records, {:imageID int, :catID int, :tagID int} (where category and tag are a composite key for tags), and a map of {:catID {:tagID set(tagIDs)}} indicating parent relationships. |
| 21:07 | TimMc | I want to end up with a list of image-to-tag records like the first, but with an additional :implicit boolean key indicating whether it was in the original list or added via that map. |
| 21:08 | TimMc | (Actually, those tagIDs are not parents, but *all* ancestors -- I've already computed the transitive closure.) |
| 21:08 | TimMc | I suppose the first step is to group everything by category and merge again at the end. |
| 21:08 | gfredericks | a hash-set doesn't help here? |
| 21:09 | gfredericks | i.e., to check whether things exist yet... |
| 21:09 | TimMc | I'm sure it does, but I haven't figured out the algorithm yet. |
| 21:09 | gfredericks | if I understood what the parent-child relationship meant I might be able to imagine it |
| 21:09 | gfredericks | you have hierarchical tags? |
| 21:09 | TimMc | yeah |
| 21:09 | TimMc | tag DAG |
| 21:09 | gfredericks | okay, I guess that makes sense |
| 21:10 | gfredericks | wait |
| 21:10 | gfredericks | in your second map |
| 21:10 | gfredericks | the values are always singleton maps with just the :tagID key? |
| 21:10 | TimMc | No, I forgot the ellipses in both levels. |
| 21:11 | gfredericks | wait what's a category? just a non-leaf tag? |
| 21:11 | gfredericks | it's not a tree? it's a proper DAG? |
| 21:11 | TimMc | The tag space is partitioned into completely independent categories. |
| 21:12 | TimMc | each of which contains a probably-disconnected DAG of tags. |
| 21:12 | gfredericks | okay, I give up. I need to finish my own algorithm. This doesn't sound very O(n^2)ey though |
| 21:12 | TimMc | Probably ends up being O(n log n). |
| 21:13 | TimMc | http://gallery.brainonfire.net/view/8b28667c47b2b47b8246e824953389bc is the final result -- categories of tags, with some implicit and some explicit. |
| 21:14 | amalloy | gfredericks: a lot classier: "Hast thou thine own repl?" i'm not sure the other one is good grammar, but maybe it is |
| 21:15 | TimMc | dost has! |
| 21:15 | gfredericks | amalloy: it's so frustrating not having a reliable intuition about these things |
| 21:15 | TimMc | <insert lolcat in Shakespearean garb here> |
| 21:15 | gfredericks | #0thworldproblems |
| 21:19 | amalloy | gfredericks: "thou" is the second-person informal, whereas "you" is second-person formal. english decided to junk the informal quite a while ago, but if you're talking olde tyme, you want to make sure your verbs conjugate to match the subjects (hast thou, have you) |
| 21:19 | gfredericks | amalloy: this sounds fuzzily familiar |
| 21:22 | amalloy | i guess that doesn't really address the actual issue of putting in a "dost" |
| 21:22 | amalloy | but it's a fun little history lesson all the same |
| 21:24 | gfredericks | quite |
| 21:26 | gfredericks | why is that buffer named "*slime-repl nil*"? |
| 21:42 | gfredericks | emacs tabs semicolon comments to the weirdest places... |
| 21:43 | jodaro | what, like the back of a volkswagen? |
| 21:43 | TimMc | gfredericks: double-semicolon is probably what you want |
| 21:44 | gfredericks | TimMc: I bet I do; so what does single-semicolon function as? |
| 21:44 | jodaro | (i guess that works better with "uncomfortable places") |
| 21:44 | hiredman | gfredericks: that is to warn you are making a mistake |
| 21:44 | gfredericks | oh; single semicolons are accidents? |
| 21:44 | TimMc | Right-column comments, like you see in assembly code. |
| 21:44 | hiredman | gfredericks: for comments on their own like use double semi colons |
| 21:44 | hiredman | single semicolons are for comments after a form |
| 21:45 | gfredericks | aah, I see |
| 21:45 | gfredericks | thanks |
| 21:46 | TimMc | Ignore hiredman, follow http://mumble.net/~campbell/scheme/style.txt |
| 21:46 | TimMc | Oh, I misinterpreted "after a form". |
| 21:48 | oakwise | jodaro: I chortled |
| 21:48 | gfredericks | Rationale: The parentheses grow lonely if their closing brackets are |
| 21:48 | gfredericks | all kept separated and segregated. |
| 21:48 | gfredericks | jodaro: I also appreciated the comment but didn't think of any good way to acknowledge it |
| 21:48 | TimMc | This is why God invented "LOL", which stands for "Laughing On-Line". |
| 21:49 | TimMc | (not really, it is just punctuation these days) |
| 21:49 | gfredericks | really?LOL! |
| 21:49 | gfredericks | huh that kind of looks legible |
| 21:51 | jodaro | thanks guys |
| 21:52 | TimMc | gfredericks: MY DEAREST MARIA LOL STORE BURNED DOWN LOL COMING HOME WITHIN WEEK FULL LOL |
| 21:53 | gfredericks | :D |
| 21:53 | TimMc | (I didn't invent that interpretation, but could not find the original.) |
| 21:55 | gfredericks | I suppose he means to eat a large meal before he comes home? |
| 21:55 | TimMc | Are you familiar with "full stop" from telegrams? |
| 21:56 | gfredericks | oh that makes sense of it |
| 21:56 | gfredericks | I was sure that "week full" meant something |
| 21:56 | TimMc | The original made it clearer. |
| 22:03 | benares_98 | Lots of Love |
| 22:03 | TimMc | Haha, yeah. |
| 22:03 | benares_98 | "I heard your father died, LOL" |
| 22:19 | TimMc | Yesss... expansion takes 75,565 tag-to-image relationships to 148,872. |
| 22:31 | echo-area | Is there the online video of Mark Volkmann's Clojure STM talk on StrangeLoop 2009? |
| 22:50 | tutysra | hi there |
| 22:51 | tutysra | trying to install clojure-mode for emacs and following the instructions in its site - https://github.com/technomancy/clojure-mode/blob/master/README.md |
| 22:51 | tutysra | struck at - step 2 (Setting up package.el) |
| 22:52 | tutysra | i didn't had a init.el in my emacs.d dir, so i created a new file and added the contents given to that file |
| 22:52 | tutysra | (require 'package) |
| 22:52 | tutysra | (add-to-list 'package-archives |
| 22:52 | tutysra | '("marmalade" . "http://marmalade-repo.org/packages/")) |
| 22:52 | tutysra | (package-initialize) |
| 22:53 | tmciver | tutysra: you can add that stuff to your .emacs too. |
| 22:53 | tutysra | then called init.el from my .emacs file as (when (load (expand-file-name "~/.emacs.d/init.el")) (package-initialize)) |
| 22:54 | tutysra | i thought init.el was a better place since we have a separate place to put all our initialization stuff (that is what the site recommends anyway) |
| 22:55 | tutysra | i get this error when i start emacs - Symbol's value as variable is void: package-archives |
| 22:55 | tmciver | tutysra: go with that then. I have similar code to what you posted in my .emacs; I didn't have an init.el either. |
| 22:56 | tmciver | I'm sure it works either way. |
| 22:56 | tutysra | ok |
| 22:57 | tutysra | add-to-list 'package-archives - this is the line which gives an error message when put in init.el, have any idea how to fix it? |
| 22:59 | tmciver | tutysra: what error? Is it complaining about 'package-archives? |
| 22:59 | tutysra | yes you are right - Symbol's value as variable is void: package-archives |
| 23:00 | tmciver | My setup may be a little out-dated but I think you have to call 'package-initialize' (once you've loaded the package.el file). |
| 23:01 | tmciver | tutysra: here is the relevant section of my .emacs: https://refheap.com/paste/613 |
| 23:01 | tutysra | tmciver: yes, I am doing the package-initialize in .emacs where I have the setup to load package.el |
| 23:03 | tmciver | tutysra: are you using package.el from here: http://bit.ly/pkg-el23 |
| 23:03 | tmciver | tutysra: and are you using emacs 23? |
| 23:03 | tutysra | tmciver: yes 23.3.1 build |
| 23:04 | tmciver | tutysra: I'm no expert on this stuff, but I know there was a version of package.el that you had to get - not the one that comes with emacs. |
| 23:05 | tmciver | the declaration of package-archives is only in the package.el at the link above; you need that one. |
| 23:05 | tutysra | tmciver: I got that from elpa site - http://tromey.com/elpa/install.html |
| 23:06 | tmciver | tutysra: Yeah, I think that might be the wrong one. |
| 23:07 | tmciver | tutysra: there's a link to the right package.el that you can get to from the link you listed above: https://github.com/technomancy/clojure-mode/blob/master/README.md |
| 23:07 | tutysra | tmciver : I tried moving that to my .emacs file, still the same error, so as you guessed something with package.el versions |
| 23:12 | tutysra | tmciver : got the package.el from the link you had given, works without issues for the configs in .emacs, i will also try init.el |
| 23:13 | TimMc | tmciver: Signing off for the night. |
| 23:14 | tutysra | tmciver :thx, it works from init.el as well |