2012-11-14
| 00:00 | adu | Raynes: where are you? |
| 00:00 | antares_ | Raynes: we are in pretty different weight classes but yeah |
| 00:00 | Raynes | antares_: How much do you weigh, sir? |
| 00:01 | antares_ | Raynes: ~ 145 lbs |
| 00:01 | Raynes | Were you assuming me to weigh less or more? |
| 00:01 | Raynes | Oh wait, were you calling me fat? |
| 00:02 | Raynes | :p |
| 00:02 | antares_ | Raynes: :) |
| 00:02 | adu | Raynes: should I repeat myself? |
| 00:02 | Raynes | adu: That's a decision you have to make yourself. |
| 00:02 | adu | what is conj? |
| 00:03 | adu | is it in NC? |
| 00:03 | adu | this must be it |
| 00:04 | Raynes | I'm in Eldridge, Alabama. |
| 00:04 | adu | I'm in Maryland |
| 00:04 | Raynes | In aproximately 13 hours I will be in Raleigh, North Carolina. |
| 00:04 | Raynes | approximately* |
| 00:05 | adu | but I'll be in NC after the 18th |
| 00:05 | adu | but aparently that just won't do |
| 00:05 | Raynes | I will be leaving the morning of the 18th. :p |
| 00:07 | adu | I feel like I wouldn't fit in anyways, though, I've only written 2 webnoir sites |
| 00:07 | xeqi | TylerGillies: I notice its looking for "fuseresource", but the path has "fusesource" |
| 00:07 | TylerGillies | xeqi: ack! thanks |
| 00:08 | TylerGillies | must have typoed it |
| 00:08 | TylerGillies | good catch |
| 00:19 | zodiak | I hope the conj videos will be up lickety split for all us poor people out there :) |
| 00:20 | zodiak | heck.. give it to the group for a conj-free ;) |
| 00:21 | zodiak | I still chuckle at the erlang conf out in SF, which is like $500 for a 'cheap' ticket |
| 00:24 | TylerGillies | is there something analogous to 'import org.foo.bar.*' in clojure? |
| 00:24 | adu | TylerGillies: use |
| 00:24 | TylerGillies | adu: thanks |
| 00:25 | TylerGillies | use org.foo.bar or use org.foo.bar.* ? |
| 00:25 | zodiak | isn't require :refer :all the proper way now ? |
| 00:25 | adu | possibly |
| 00:25 | zodiak | I believe as of 1.4 it is |
| 00:26 | zodiak | (:require [org.foo.bar :refer :all]) |
| 00:26 | adu | I only ever do (:require [… :as …]) |
| 00:26 | zodiak | open to being wrong/stupid/moron |
| 00:28 | zodiak | TylerGillies, you got it ? |
| 00:28 | TylerGillies | its not finding the jar, not sure if because it didn't download this dep as a dependency or im doing it wrong |
| 00:28 | TylerGillies | FileNotFoundException Could not locate org/iq80/leveldb__init.class or org/iq80/leveldb.clj on classpath: clojure.lang.RT.load (RT.java:432) |
| 00:29 | zodiak | TylerGillies, you using lein/lein2 deps ? |
| 00:29 | TylerGillies | zodiak: yes |
| 00:29 | TylerGillies | the libs downloaded |
| 00:29 | TylerGillies | not sure if this dependency was implicit, im following instructions on the java page |
| 00:30 | zodiak | TylerGillies, fling up your project.clj someplace (pastiebin or some such) |
| 00:31 | amalloy | looks like a problem in your ns clause, not your project.clj |
| 00:31 | TylerGillies | zodiak: |
| 00:31 | TylerGillies | http://pastebin.com/Kr9u52pb |
| 00:31 | TylerGillies | amalloy: http://pastebin.com/6Y5V0qzm |
| 00:33 | amalloy | leveldb is a java project, not clojure. require is for clojure namespaces, not java stuff |
| 00:33 | TylerGillies | ah |
| 00:33 | TylerGillies | im a ruby guy, we started doing some stuff in clojure for performace, in the hopes of moving more towards that direction |
| 00:33 | TylerGillies | so im somewhat of a novice |
| 00:33 | adu | iirc, import is for java |
| 00:34 | zodiak | import is indeed the ticket |
| 00:34 | TylerGillies | ah |
| 00:34 | TylerGillies | thanks guys |
| 00:35 | zodiak | np |
| 00:35 | TylerGillies | looks like the :refer :all syntax is off now though |
| 00:35 | zodiak | yeah.. you don't use :refer :all with import.. jst import and use as usual |
| 00:36 | zodiak | sorry, import and then program as usual (not use as in :use) |
| 00:36 | TylerGillies | zodiak: ah, thanks |
| 00:36 | TylerGillies | i used .*, and it didn't complain |
| 00:36 | TylerGillies | hopefully that doesn't shoot me in the foot later |
| 00:36 | zodiak | it's java so, probably :P |
| 00:38 | TylerGillies | lol |
| 00:43 | TylerGillies | looks like Rich Has Spoken on not being able to import * http://groups.google.com/group/clojure/msg/ddca7ec56ea8b51f?pli=1 |
| 00:47 | zodiak | clojure is a pragmatic language, it's not like python with it's BDFL |
| 00:47 | zodiak | if you need to import .* go for it, jst know the risks ;) |
| 00:48 | TylerGillies | so you _can_ import .* ? |
| 00:48 | TylerGillies | the above reference makes it seem its not possible |
| 00:49 | zodiak | I think you can, I read that message as 'not a great idea' .. but then .. it's way past my bedtime ;) |
| 00:49 | TylerGillies | heh |
| 00:50 | TylerGillies | i added .*sdfsdf to the (import ...) and it didn't complain, so im not gonna take failure of output to mean success |
| 00:51 | TylerGillies | im just gonna jar tf the jar file and manually add the classes i need :) |
| 00:54 | ynniv | why would you import something that you aren't referencing? |
| 01:02 | TylerGillies | ynniv: ask the java documentation that ;) |
| 01:03 | ynniv | if you aren't referencing a class, what is the point of importing it? |
| 01:03 | TylerGillies | referto previous statement |
| 01:03 | TylerGillies | figured out what problem was |
| 01:03 | TylerGillies | repl was open before i did lein deps, doh |
| 01:05 | ynniv | the previous statement being that the class couldn't be found? |
| 01:08 | TylerGillies | previous statement being "ynniv: ask the java documentation that ;)" |
| 01:10 | ynniv | That isn't making any sense, but I'm glad that you found lein deps. You probably want to use lein 2.0, which no longer needs the deps command. |
| 01:15 | TylerGillies | ynniv: it was tongue in cheek, hence the ";)" im not a java guy but from a lot, if not most, of the java projects i've seen, import org.foo.* is quite common |
| 01:15 | TylerGillies | ynniv: so in a round about way i was asking "Ask the people who made that normal why they do it" |
| 01:16 | ynniv | importing org.foo.* is a shortcut that is usually frowned upon even with Java folks because it reduces readability |
| 01:17 | ynniv | because the code you are reading imports *, you don't know which classes are in which packages, hence you want to import * |
| 01:17 | TylerGillies | well it seems social pressure if not enough because through my power of observation i see that it is quite prevalent |
| 01:18 | ynniv | only in sample code, or with people who don't use an IDE |
| 01:18 | ynniv | IDEs will use an import for every class to make it clear where classes come from |
| 01:18 | TylerGillies | ynniv: in sample code, i don't really know from the interwebs whether someone uses an IDE or not |
| 01:19 | TylerGillies | since im not a java guy, as previously stated, i don't have much interaction with them face-to-face |
| 02:07 | amalloy | technomancy: thanks for the pointer to parsatron. looks reasonably well designed, and small enough to learn to use easily |
| 02:10 | amalloy | although i don't think i've seen such a high letfn-per-LOC in any other clojure file ever |
| 02:38 | jasonyeh | hi, has anyone experimented with Nate Young's the.parsatron? |
| 02:47 | amalloy | jasonyeh: i dunno how long you've been in the channel, but i was just saying that i recently took a look and it seems pretty good although i haven't tried it |
| 02:52 | jasonyeh | amalloy: thanks, was confused by the line "(eof)" in bf parser in the readme. the "(eof)" seems to prevent repl printing the parsed result |
| 02:54 | amalloy | well, the parsed result isn't very interesting: it's just the input string split up into characters. he's using the bf parser to recognize/validate bf, but not to do anything interesting with it |
| 02:55 | Raynes | amalloy: Wow, what are the odds of that? |
| 02:55 | Raynes | That he would ask about it like 10 seconds after you said you liked it. |
| 02:57 | amalloy | i think the simplest change to make (bf xs) return its parsed input would probably be (defparser bf [] (let->> [parsed (many (instruction)) _ (eof)] parsed)) |
| 02:58 | Raynes | amalloy: What are you doing with parser combinators anyway? |
| 02:59 | amalloy | not much. marveling, mostly, and reflecting how gloss is kinda-sorta a parser combinator but missing many of the usual building blocks |
| 02:59 | Raynes | I don't think I share your interest in things like that. |
| 02:59 | Raynes | I get off on monads and applicative functors, but not parser combinators. |
| 02:59 | Raynes | Did you see me using arrows earlier? It was hot. |
| 03:00 | amalloy | i looked at your paste, but to say that i saw it would be an overstatement |
| 03:00 | Raynes | It was one line, dude. |
| 03:00 | Raynes | FOCUS. |
| 03:00 | Raynes | https://github.com/Raynes/haskheap/blob/master/src/Network/Haskheap.hs#L32 |
| 03:01 | amalloy | oh, are those arrows? i remember either *** or &&& just being juxt |
| 03:02 | amalloy | i guess it must be &&& that's juxt, and *** is the "knit" i added to useful? |
| 03:02 | Raynes | amalloy: `(f *** f) (a,b)` = `(f a, f b)` |
| 03:02 | Raynes | I don't know how it works at all (haven't learned about arrows), but cool. |
| 03:03 | amalloy | (f *** g) (a,b) = (f a, g b)? |
| 03:03 | Raynes | Yes |
| 03:04 | shachaf | over both :: (a -> b) -> (a, a) -> (b, b) |
| 03:04 | shachaf | amalloy: Any lenses in your near past/future? |
| 03:05 | amalloy | shachaf: the extent of my knowledge about lenses is someone else's statement that they're a convoluted way to get clojure's update-in wedged into a static-typed language |
| 03:06 | amalloy | i skimmed an article once but didn't learn much |
| 03:06 | shachaf | amalloy: That doesn't sound right. |
| 03:06 | shachaf | A lens is a "functional reference" to some value which is "within" another value in some sense. |
| 03:06 | jasonyeh | amalloy: sorry for the dumb question, what's the underscore in (defparser bf [] (let->> [parsed (many (instruction)) _ (eof)] parsed))? |
| 03:07 | amalloy | a name for the result of (eof), _ conventionally meaning "i'll ignore this" |
| 03:07 | shachaf | Reading deeply-nested values is easy -- (foo . bar . vaz) -- but updating can be annoying in Haskell. |
| 03:07 | shachaf | A lens is sort of like a composable (getter, setter) pair that you can use for both purposes. |
| 03:08 | shachaf | But the really nifty part is a generalization of lenses to traversals, which are references to N values instead of just one. |
| 03:08 | shachaf | For example, you can say "world.monsters.traverse.appendages.traverse.position.x += 1" to move all the appendages of all the monsters one unit to the right. |
| 03:09 | shachaf | (The above is actual Haskell code.) |
| 03:17 | Sgeo__ | I feel like maybe I'm glad I never tried to implement lenses in Clojure. I wouldn't have known about the cool stuff |
| 03:17 | Sgeo__ | Just more the idea that the logic is in the lenses rather than in the data structure or the function |
| 03:21 | brainproxy | Raynes: jimduey mentioned to me a couple of weeks ago that he's working on a protocol based arrows implementation for clojure |
| 03:21 | brainproxy | sounded excited about it, but hasn't put anything on GitHub yet |
| 03:21 | Raynes | I can't get excited about Haskell things in Clojure. |
| 03:24 | clgv | Raynes: me neither. |
| 03:24 | brainproxy | Raynes: have you spent any time with frege? |
| 03:24 | clgv | I always wonder why there are some people eagerly describing monads in clojure, as well... |
| 03:25 | shachaf | Sgeo__: Hmm? |
| 03:25 | jjido | clgv monads are supposed to be the answer to side-effects in a pure language :) |
| 03:25 | brainproxy | clgv: the abstractions can prove pretty useful, i think that's a fairly practical motivation |
| 03:26 | Sgeo__ | shachaf, I have vaguely wanted to implement lenses in Clojure at one point, but haven't gotten around to it, and now I doubt that I'd know what the traversal stuff is, so probably wouldn't have done it, which would be sad, so maybe it's good that I didn't do it. |
| 03:26 | shachaf | Traversals are the future. |
| 03:27 | clgv | but until now I haven't seen an example where one of these monad implementations would improve clojure code. in the tutorials it was harder to read most of the time |
| 03:28 | brainproxy | clgv: because of having to setup the monad context, or what do you mean? |
| 03:29 | clgv | brainproxy: I just read 3-4 tutorials briefly, yet. maybe it's the added indirection. |
| 03:30 | brainproxy | i think protocol-monads can possibly help w/ that a bit, but there is still a bit of a chicken-and-egg problem |
| 03:30 | clgv | additionally, I have not seen a "Clojure success story with monads", yet ;) |
| 03:31 | brainproxy | i.o.w. to understand what it's doing for you, you need something of a mental model of what monads are all about in the first place |
| 03:32 | jjido | what are they all about? |
| 03:32 | brainproxy | jjido: encapsulating various plumbing patterns for moving data between functions |
| 03:33 | clgv | brainproxy: where would *you* really see a need to use them in clojure in *your* projects? |
| 03:33 | brainproxy | clgv: sure.. so the project I'm working on has a really nasty control flow scenario |
| 03:33 | brainproxy | using state-transformer and maybe monad and writer monad together seems to be helping |
| 03:34 | clgv | humm, you cant sketch the scenario outline, can you? |
| 03:34 | amalloy | clgv: the `for` macro is a special-cased implementation of the list monad. -?> in contrib is a special-cased implementation of the maybe monad |
| 03:35 | clgv | amalloy: ah ok, in these cases they are manifesting implicitely |
| 03:35 | brainproxy | okay, so consider a uri pattern that looks like /api/[filter]/[item]/[collection]/[item]/[collection]/[item]... |
| 03:35 | brainproxy | now, assume that when trying to resolve the various hops between item,coll,item,coll... |
| 03:36 | amalloy | that's basically how it goes. monads are a useful tool for capturing and working with common patterns that come up even if you don't know about them |
| 03:36 | brainproxy | you have diverse data sources that can spit back data which doesn't match up well between different kinds of collections and items |
| 03:36 | amalloy | i implemented a clojurey version of the io monad in jiraph, so that i could do computations that appear side-effecty on the database, but make them safe to re-do in case of partially-committed transactions |
| 03:37 | clgv | ok |
| 04:07 | thorwil | where did -?> go for clojure 1.4? |
| 04:09 | clgv | thorwil: it's still in core.incubator lib |
| 04:10 | clgv | I'd wish that it was included in clojure.core by 1.5 - but there is no info on that |
| 04:11 | thorwil | ok. it seems impossible to find it via google. even when calling it nilsafe |
| 04:12 | clgv | thorwil: lookup the core.incubator lib^^ |
| 04:12 | clgv | thorwil: defnilsafe is the macro used to implement those threading macros |
| 04:14 | _ulises | morning folk |
| 04:14 | _ulises | clgv: what TZ are you on? you seem to be here during my mornings :) |
| 04:14 | clgv | _ulises: GMT+1 |
| 04:14 | _ulises | cool |
| 04:16 | clgv | thorwil: well, 1.5 will get when-> which tests for logical true during threading |
| 04:18 | clgv | thorwil: ah and (test-> (comp not nil?) ... ) would work it seems |
| 04:20 | thorwil | good. whatever works that is less noisy then maybe-m |
| 04:21 | clgv | thorwil: currently I juest use -?> from core.incubator |
| 04:21 | clgv | *just |
| 04:32 | otfrom | morning |
| 04:32 | otfrom | I'm guessing everyone here is *not* going to the conj. |
| 04:37 | _ulises | otfrom: how so? is it happening like *right now*? |
| 04:38 | clgv | _ulises: tomorrow I think |
| 04:39 | _ulises | ah |
| 04:39 | muhoo | it's EST time, so, tonight if you're in GMT-ish land |
| 04:40 | muhoo | EDST, to be pedantic |
| 04:41 | clgv | muhoo: huh. it says 15th and we have the same date :P |
| 04:44 | otfrom | muhoo: I thought the east coast US was back on EST |
| 04:45 | clgv | it's tomorrow for GMT+1 as well since it's a negative offset ;) |
| 04:46 | otfrom | I figured anyone on here this time of the morning wasn't in NC |
| 04:46 | muhoo | ah, right, summer is DST, winter is not (reverse) |
| 04:52 | thorwil | with the code in https://github.com/thorwil/tlog i can log in as admin and then the /admin will no longer redirect. but /admin then still does not use my handler, but delivers "Sorry, you do not have access to this resource." |
| 04:56 | muhoo | are you sure the session is getting saved? |
| 04:56 | muhoo | also, note the :: in your realms |
| 04:56 | thorwil | i'm not sure of anything. but if the session is not saved, wouldn't it still redirect? |
| 04:57 | muhoo | auth realms must be fully qualified |
| 04:57 | muhoo | so i wouldn't use ::, i'd explicitly call out where those realms are defined instead |
| 04:58 | muhoo | not ::admin, but :tlog.wherever/admin |
| 04:59 | Raynes | muhoo: I've probably asked you this 400 times: are you going to the conj? |
| 04:59 | muhoo | Raynes: sadly, no. |
| 04:59 | muhoo | are you there already? |
| 05:00 | Raynes | Why do people keep asking me that? It's a whole day before the conference even starts. |
| 05:00 | Raynes | Right? I haven't missed half the conference or anything, right? |
| 05:00 | muhoo | because you can time travel too |
| 05:00 | Raynes | Cause like 10 people have asked me if I was there already today. |
| 05:00 | muhoo | as well as write haskell. |
| 05:00 | Raynes | The Doctor isn't here right now. |
| 05:04 | clgv | better get going then ;) |
| 05:05 | muhoo | speaking of the Doctor, does rhickey still have that fourth doctor hair? i wanted to give him a scarf at clj/west. |
| 05:06 | muhoo | http://en.wikipedia.org/wiki/File:Fourth_Doctor.jpg <-- conj keynote speaker |
| 05:06 | thorwil | muhoo: :tlog.init/admin makes it work. thank you. all the examples are flat and no mention of this auth realm business |
| 05:06 | maleghast | *guffaw* |
| 05:07 | maleghast | "To the TARDIS!" |
| 05:08 | muhoo | thorwil: if it's not explicit in the docs, maybe ask cemerick about it, or report it as a feature request to add it to the docs |
| 05:08 | muhoo | the examples assume everything is in one namespace. you've got what looks like an mvc-ish thing going there => trouble. |
| 05:08 | clgv | thorwil: it's more a namespaced keyword shortcut issue^^ |
| 05:10 | muhoo | also, i don't know if he calls it a realm, but those keywords need to be namespaced |
| 05:10 | clgv | thorwil: you will have the exact same problem if you use that shortcut for namespaced keywords elsewhere. as a rule of thumb only use something like "::my-keyword" if they are only used in the same namespace - otherwise always fullqualify them |
| 05:10 | thorwil | just the usual web pseudo mvc. though just today i wondered about going model -> database or persist and view -> respond |
| 05:11 | muhoo | try it, see what fits the problem domain best, i guess. |
| 05:15 | Licenser | I wonder is there a good place to start with noir+pinot ? |
| 05:18 | clgv | Licenser: afair, you shouldnt use pinot anymore but the libs it was split to |
| 05:18 | Licenser | ahhh sneaky |
| 05:19 | Licenser | clgv I read the article about that but thought it's still inside the smae library |
| 05:19 | piranha | Maybe I'm wrong, but I had the impression that Datomic has some event/notification mechanism to notify you when certain data has changed... Am I wrong? |
| 05:38 | Raynes | antares_: Thanks for updating monger. I didn't even know you did it until I tried to push a commit just a second ago. :p |
| 05:38 | Raynes | It's deployed. |
| 05:38 | antares_ | Raynes: sweet |
| 05:39 | antares_ | this reminds me, we need to update it again, although I guess 1.3.4 fixes are not relevant for refheap |
| 05:40 | Raynes | antares_: When are we going to write a rethinkdb driver together? :D |
| 05:43 | antares_ | Raynes: it is hilarious that a company called RethinkDB is just a me-too mongodb clone :( |
| 05:43 | antares_ | and by hilarious I mean sad |
| 05:43 | Raynes | antares_: From what I've seen, it appears to be better than mongodb in most of the areas where people complain about mongodb. |
| 05:43 | Raynes | Am I wrong? |
| 05:44 | antares_ | possibly but they are still a me-too player now |
| 05:44 | Raynes | I don't know what that means. Is it anything like shitting rainbows? |
| 05:45 | antares_ | yes but you shit them inside |
| 05:45 | antares_ | so, it makes you über cool but nobody will notice |
| 05:53 | nickik | Is there a UseCase where I would prefer Mongo/rethink over Datomic? I do not know Mongo or rethink very well |
| 05:54 | Raynes | The case where you want an open source database. |
| 05:55 | nickik | Raynes, I think Mongo has some more support for geodata |
| 05:55 | nickik | some pre defined querys |
| 05:56 | nickik | or something |
| 06:28 | Chiron | any clojure lib that allows for something like Scala match case ? |
| 06:29 | Anderkent | how is scalas match case different from clojures match ? |
| 06:30 | Anderkent | ,(doc match) |
| 06:30 | clojurebot | I don't understand. |
| 06:30 | Anderkent | geh |
| 06:30 | antares_ | Chiron: core.match |
| 06:30 | antares_ | Anderkent: destructuring is very limited in scope compared to pattern matching in Erlang or Scala |
| 06:31 | Chiron | does it worth to introduce it if i need match/case only two or three times in my code ? |
| 06:31 | antares_ | Chiron: it's up to you, I don't think it is a huge dependency by any means |
| 06:32 | Chiron | is it possible to use core.match were cases should match class Types ? |
| 06:32 | Chiron | something like (instance?) |
| 06:37 | orbidansm | hello mate |
| 06:38 | antares_ | Chiron: see core.match documentation, they supposed to have it |
| 06:39 | Chiron | ok . thanks :) amazing clojureworks btw |
| 06:39 | orbidansm | I'm using ERC Version 5.3 with GNU Emacs 24.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1, multi-tty) of 2012-09-18. |
| 06:52 | antares_ | Chiron: you mean, clojurewerkz? thanks! |
| 06:52 | Chiron | oh, clojure.match couldn't be used with AOT :/ |
| 08:22 | ro_st | what's the idiomatic way to respond 404 with noir? |
| 08:23 | _ulises | ro_st: there's a bunch of response helpers in noir I think |
| 08:27 | ro_st | just searched the noir source. no helper |
| 08:31 | jweiss | anyone got a link to how to destructure nested maps? i found {{:keys [bar]} :test} but that seems to only allow you to assign names to values at one level of the structure. |
| 08:35 | jweiss | ah here we go http://java.dzone.com/articles/clojure-destructuring |
| 08:35 | jweiss | {{bar :bar} :test} |
| 08:35 | jweiss | weird, never saw that syntax before. |
| 08:35 | Anderkent | ro_st: (noir.statuses/get-page 404) ? |
| 08:36 | Anderkent | ro_st: or just set the response status code and not provide any content, it should do the statuses/get-page automatically then |
| 08:37 | ro_st | going to try that, Anderkent: {:status 404} |
| 08:42 | Kototama | I specified [org.clojure/clojure "[1.4.0,1.5.0)"] in project.clj but lein2 uses clojrue 1.5 beta1 nonetheless, any ideas? |
| 08:46 | ro_st | Anderkent: it just serves up an empty 404. so i guess i need to manually respond with 404 and the statuses/get 404 |
| 08:48 | ro_st | (response/status 404 (statuses/get-page 404)) works |
| 08:48 | ro_st | they couldn't just make (response/404) ? tsk. |
| 08:49 | Mr_Bond | you could suggest a patch to them :) |
| 08:50 | Mr_Bond | I'm sure they are not hostile against improvements |
| 08:50 | ro_st | i had to write 404, like, twice. like, DRY, y'know. |
| 08:50 | Mr_Bond | do they also supply you with free finger-massages? |
| 08:50 | Mr_Bond | from the excessive keyboard typing? |
| 08:51 | ro_st | no, but they should, now that you mention it |
| 08:51 | Mr_Bond | yes :) |
| 08:51 | ro_st | (noir.perks/finger-massage!) |
| 09:10 | Chiron | Hi, any better ideas how to write this in idiomatic Clojure ? |
| 09:10 | Chiron | http://pastie.org/5377160 |
| 09:15 | joegallo | Hard to say, without seeing cond-1, cond-2, and action-2. |
| 09:15 | _ulises | Chiron: what joegallo said |
| 09:15 | danlarkin | yeah what joegallo said |
| 09:15 | joegallo | yeah! |
| 09:15 | joegallo | :D |
| 09:16 | Chiron | cond-1 and cond-2 are (instance?) |
| 09:16 | Chiron | action-1 returns a list |
| 09:16 | joegallo | it is not idiomatic to call instance with 1 argument... :) |
| 09:16 | joegallo | s/1 argument/0 arguments/ |
| 09:17 | _ulises | Chiron: perhaps better if you paste your actual code? (if you can) |
| 09:17 | joegallo | unless this is the code for launching ze missiles, how about you just paste more? |
| 09:19 | Chiron | http://pastie.org/5377198 |
| 09:19 | Chiron | cond-1 and cond-2 are calling to instance? functions |
| 09:24 | orbidansm | can you use if instead of cond ? |
| 09:30 | Chiron | properly yes |
| 09:30 | Licenser | Okay I'm back to bug you all gain, I'm trying to get a little web applicaiton to run and am truely surprised how much walls I run into o.o. Is noir and the related clojure script libraries still maintained or is there a new thing to go with? |
| 09:31 | wink | Licenser: do you have a special problem? because I started a new noir app with 1.4 last week and it worked very well |
| 09:32 | Licenser | wink I try to get noir+noir-cljs to work and it all keeps failing stacktraces, something with a hiccup file not working |
| 09:32 | wink | Licenser: err, ok, I used no clojurescript, sorry, misread |
| 09:32 | Licenser | ^^ |
| 09:33 | Licenser | I was a bit surprised since people are soo happy with clojure |
| 09:33 | zodiak | Licenser, not to sound stupid here but, have you tried running through the clojurescript quickstart ? |
| 09:34 | zodiak | because it surely doesn't mention noir ;P |
| 09:34 | zodiak | as with all things comp sci, take it all back to first principles if you hit a roadblock |
| 09:34 | Licenser | zodiak I know the clojure basics and clojurescripts basics |
| 09:34 | zodiak | good show, fling up a stracktrace on pastie then |
| 09:35 | Licenser | zodiak my question is not about the stacktrace, I figured the problem itself (it's just a version incompatibility), more about the state of the libraries or if there is something new around since I looked last :) |
| 09:36 | zodiak | oh .. spiffy :) |
| 09:36 | zodiak | well, ~personally~ I use compojure+moustache so.. I maybe the wrong person to answer |
| 09:36 | maleghast | Licenser: I've had a lot more luck leaving Noir out of the equation and just using Comojure, fwiw |
| 09:36 | zodiak | maleghast, +1 internets |
| 09:37 | maleghast | zodiak: I thank you… ;-) |
| 09:37 | Licenser | Comojure = compojure? |
| 09:38 | zodiak | Licenser, yes |
| 09:38 | maleghast | Licenser: yes, my typing sucks, what can I tell ya? |
| 09:38 | Licenser | maleghast mine too ;) just wanted to be sure |
| 09:38 | Licenser | but I guess I crawl back under my erlang rock for now |
| 09:38 | maleghast | Licenser: no worries |
| 09:38 | Licenser | ^^ |
| 09:39 | maleghast | Licenser: Erlang, eh? And I thought I had some esoteric language interests... |
| 09:39 | maleghast | ;-) |
| 09:39 | patrkris | hi folks, i'm trying out reducers in Clojure 1.5 with the following code: https://www.refheap.com/paste/6668 |
| 09:39 | patrkris | why do I get an OutOfMemoryException when running (reducerslib)? |
| 09:39 | Licenser | maleghast ^^ all the other parts of the applicaiton are written in erlang, I was pretty much interested in the clojure/clojurescript integration |
| 09:40 | Licenser | but since I fail at making that simple I guess the energy to getting it all figured out is bigger then the energy saved for me in this case |
| 09:40 | maleghast | Licenser: Fair enough - if I had the time and / or a business need I think that I would enjoy ClojureScript too, but as it is I've not had the opportunity to use it yet. |
| 09:40 | maleghast | If you want a nice, terse syntax for generating JS, why not look at Coffee? |
| 09:41 | Licenser | *nods* would have loved to, since I adore clojure but well :) I hardly can expect other contributors to fight with stuff when I have already trouble with it :P |
| 09:42 | zodiak | ugh.. coffeescript is jst.. horrible :) |
| 09:42 | zodiak | tell me, honestly asked, how do you ~sanely~ debug coffeescript ? |
| 09:42 | zodiak | (assuming something slips past tdd etc ;) |
| 09:42 | maleghast | zodiak: *raised eyebrow* That's fair, I guess, but seeing as nodeJS can run it interactively I think there are a few ways |
| 09:44 | zodiak | maleghast, that's what is stopping me adopting it. debugging. I mean, I can compile down into js, find the bug in the js and then reverse back into the cs |
| 09:44 | zodiak | but.. it feels... nasty |
| 09:45 | zodiak | I am open to other ways :) |
| 09:45 | nicl | Hey all, I've just started my first serious Clojure application - a compojure app which exposes an API to create and store books (along with reviews, and some meta data - author, isbn etc.) |
| 09:46 | nicl | I have a few questions: 1. what are the recommended libraries which abstract sql interaction - I've seen korma. Is there anything else I should be aware of? |
| 09:47 | maleghast | zodiak: Yeah, I can see that… As I thought, you can do it with Node, see the second answer, here -> http://stackoverflow.com/questions/11068023/debugging-coffeescript-line-by-line |
| 09:47 | Licenser | zodiak it's doable but not pleasent |
| 09:47 | nicl | 2. SQL or Mongo ? - I've experienced with SQL but haven't used a noSQL db before. This is a purely personal/hobby project so it would be nice to learn something new in mongo, but is this widly inappropriate / what do people suggest? |
| 09:47 | Licenser | nicl SQL |
| 09:47 | nicl | (this might be a hopeless/too broad question) |
| 09:47 | Licenser | or Riak |
| 09:47 | zodiak | maleghast, *reading* |
| 09:48 | Licenser | nicl and if you use SQL please go for postgresql |
| 09:48 | patrkris | nicl: Datomic ;) http://datomic.com |
| 09:48 | zodiak | nicl, clj-record if you want activerecord instead of data-mapper ;) |
| 09:49 | nicl | patrkris: ha - I guess that would be appropriate although I am slightly scared by it! |
| 09:50 | zodiak | maleghast, ta for the link.. time to play about with it and see how it shapes up :) |
| 09:50 | patrkris | nicl: yeah, me too... but it's beautiful |
| 09:50 | Mr_Bond | doesn't ACID transactions in datomic pretty much kill the performance it gains over regular rdbs? |
| 09:51 | clgv | Mr_Bond: I thought ACID in an immutable db is easier thus cheaper, no? |
| 09:51 | Mr_Bond | no |
| 09:51 | nicl | Licenser: not sure if you are suggesting I use SQL, or that there is an actual library called SQL for interacting with an SQL db? |
| 09:52 | Licenser | nicl I suggest not using mongo actually, there are many scarry things to be read about that |
| 09:52 | Mr_Bond | to be ACID compliant, the write has to be commited to disk before the transaction is finnished |
| 09:52 | Mr_Bond | commited as in fsync |
| 09:53 | clgv | Mr_Bond: really, so in-memory dbs cannot be ACID compliant? |
| 09:53 | Mr_Bond | clgv: that is correct |
| 09:53 | algernon | I'd suggest using mongo, because for a hobby project, when one wants to learn something new, it's perfect. (and monger has great docs to boot, better than korma's imo) |
| 09:54 | Mr_Bond | it's the only way to guarantee consistancy from the databases perspective |
| 09:54 | maleghast | Certainly MongoDB is a powerful, stable product that no one should be frightened of, but like all tools it has its uses, and also there are things for which it is not fit. |
| 09:54 | Mr_Bond | it's like if you turn off fsync in mysql, it's dirt fast |
| 09:55 | patrkris | Mr_Bond: but why do you think it will perform worse than RDBMS? because of the extra layer added over the storage service (datomic on top of e.g. DynamoDB or PostgreSQL)? |
| 09:55 | maleghast | nicl: I suggest that if you are not in any danger of losing any money then have a go with Mongo - it's well suited to the domain that you describe, it's fast to get up and running and you'll learn something new. |
| 09:56 | Mr_Bond | patrkris: I didn't say it would, I just thought it would kill most of the performance gains nosql typically has |
| 09:56 | devn | "if you're not in danger of losing money, use mongo!" |
| 09:56 | devn | ^-new mongodb tagline |
| 09:56 | Licenser | maleghast how about riak? It's also a pretty awesome K/V store |
| 09:56 | Mr_Bond | common issues with mongodb, is sharding on wrong keys (having data moving about too much), and scaling out when it's too late |
| 09:57 | Mr_Bond | if you avoid those, and follow guidelines, you'll moste likely be fine |
| 09:57 | Mr_Bond | and what devn said |
| 09:57 | Mr_Bond | :) |
| 09:57 | maleghast | Licenser: I hear it is, though what I hear is that it's particularly well suited to very high traffic writes, due to its design choices |
| 09:57 | patrkris | Mr_Bond: I think Rich says that datomic is not good for massive amounts of writes |
| 09:58 | patrkris | but its fast for reads and provides ACID |
| 09:58 | Licenser | maleghast it scales very well and has a nice data integrety scheme |
| 09:58 | patrkris | and that's by design |
| 09:58 | zoldar | I don't know if that still holds for current release, but mongodb has some insane default settings with regard to handling write operations |
| 09:59 | Mr_Bond | patrkris: yes, but reads are typically not slow in rdbs either |
| 09:59 | maleghast | devn: Hardly, there are large organisations using it in anger, the trick is to not use it for everything and to use it well, like any tool. My point to nicl was that he / she may as well learn something new (be it Mongo, Riak, Cassandra, RethinkDB) if there is no financial or business risk. |
| 09:59 | nicl | wow - sounds like I will just have to decide what I want to learn. |
| 09:59 | nicl | there is no financial risk - it is purely a spare time/learning thing |
| 09:59 | maleghast | nicl: precisely |
| 09:59 | Mr_Bond | go for it :) |
| 09:59 | patrkris | Mr_Bond: right... but I guess (I don't know much about this) scaling is harder |
| 09:59 | nicl | thanks for all the advice |
| 09:59 | maleghast | Why not hook it up to all of them one after the other and see which one you like best? |
| 09:59 | Licenser | :) |
| 10:00 | Mr_Bond | patrkris: yeah |
| 10:00 | nicl | maleghast: if I get the time!!! |
| 10:00 | maleghast | Don't forget ArangoDB :-) |
| 10:00 | algernon | nicl: use whatever has the best docs, if you want to learn :) |
| 10:02 | zoldar | for the record, here's an experiment that somebody did some time ago on mysql: bypassing the whole sql parsing layer and talking straight to ndb api: http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-for.html |
| 10:03 | mtd | otfrom if it's on-topic, I have a random question about the upcoming London Clojurians hackathon's structure: do we come and work on our own projects, or one that's given to us on the day, or something in-between? |
| 10:13 | nicl | mtd: when is the hackathon? |
| 10:17 | orbidansm | hackathon is like coding dojo, I guess. But longer |
| 10:18 | orbidansm | I havent been to any clojure hackathon |
| 10:19 | mtd | nicl: Dec 8, Tower 42 - http://www.meetup.com/london-scala/events/91346712/ |
| 10:19 | mtd | orbidansm: so...like a dojo, there is an assigned project, right? |
| 10:19 | marutks | yes |
| 10:19 | nicl | mtd: thanks |
| 10:20 | mtd | nicl: np |
| 10:54 | otfrom | mtd: are you talking about Hack The Tower? |
| 11:00 | otfrom | mtd: I don't know if there is a "set problem" as such, but it is focusing on building webistes |
| 11:00 | otfrom | *websites |
| 11:42 | tgoossens | hi. i'm just thinking. If i have "pieces" ([x y] coordinate) on a "board". One way to do this is to have define a board. {:pieces #{}} which has a set of pieces |
| 11:42 | tgoossens | i write all the functions to add pieces and do some useful stuff with this |
| 11:43 | tgoossens | but then |
| 11:43 | tgoossens | i want it to happen in constant time |
| 11:43 | tgoossens | so |
| 11:43 | Anderkent | why do you want it to happen in constant time? |
| 11:43 | tgoossens | :pieces must now be a map of vector->piece |
| 11:43 | Anderkent | oh sorry i thought that was it, continue :P |
| 11:44 | wingy_ | ibdknox: good LT update automation :) |
| 11:44 | tgoossens | :) |
| 11:44 | tgoossens | then |
| 11:45 | tgoossens | when i compare it how i do it in java (this was part of an assignment in a course on OO but now i'm trying to do it in clojure (for myself)) |
| 11:45 | tgoossens | then |
| 11:45 | tgoossens | board.hasPiece(Piece) |
| 11:45 | tgoossens | and all other stuff could still be used |
| 11:45 | tgoossens | but I don't see how i can (in a clean way) |
| 11:45 | tgoossens | suddenly adapt everything to the map |
| 11:46 | tgoossens | that suddenly was introduced instead of the set |
| 11:46 | tgoossens | -- that ends the question |
| 11:47 | tgoossens | (note: i've only been exploring clojure for one month now. my only experience is OO so far) |
| 11:47 | tgoossens | (got interested into it by accident :D and so far i love it) |
| 11:47 | Anderkent | ,(vals {[0 1] {:type :rook} [2 3] {:type :king}}) |
| 11:48 | clojurebot | ({:type :king} {:type :rook}) |
| 11:48 | Anderkent | you can look at a map as if you were looking at a set, if you just want to check whether something is in a map |
| 11:49 | tgoossens | What i'm trying to ask is. Do i have to "rewrite" all my functions, do i "write new ones", or something else? |
| 11:49 | TimMc | Well, you can for the keys. |
| 11:49 | TimMc | tgoossens: If you change the backing store, you'll need to change the implementations of the functions, but probably not their contracts. |
| 11:50 | tgoossens | the typical argument from an oO-fanatic would be now: "that it is a set or a map should be encapsulated". And having only experience with OO, i cannot deny this argument |
| 11:50 | tgoossens | what am i not seeing? |
| 11:51 | Anderkent | a set or a map have completely different meanings |
| 11:51 | TimMc | A user of your fns shouldn't know whether it's a set or a map, but your fns absolutely *should* know. |
| 11:51 | Anderkent | any function that directly interacts with the set/map will have to be updated |
| 11:51 | Anderkent | but after it is it can behave in the same way as before |
| 11:52 | Anderkent | thus the fact it is a set and/or map is hidden from anyone who uses the function |
| 11:52 | clojurebot | Alles klar |
| 11:52 | TimMc | ~botsmack |
| 11:52 | clojurebot | botsmack is headdesk |
| 11:52 | tgoossens | mmm |
| 11:52 | TimMc | clojurebot: forget botsmack |is| headdesk |
| 11:52 | clojurebot | I forgot that botsmack is headdesk |
| 11:52 | TimMc | ~botsmack |
| 11:52 | clojurebot | botsmack is headdesk |
| 11:52 | tgoossens | not quite getting it (yet) |
| 11:52 | TimMc | Damn inference engine. |
| 11:52 | Anderkent | look back at your board.hasPiece, it used some kind of set, map or array as a backend, right? |
| 11:52 | tgoossens | yes |
| 11:53 | Anderkent | if you changed the backend data type, you would have to change board.hasPiece |
| 11:53 | TimMc | tgoossens: Think of it algebraicly: (has-piece (make-board ...) ...) should return a certain answer independently of the implementation. |
| 11:53 | tgoossens | correct |
| 11:53 | tgoossens | oh |
| 11:53 | Anderkent | but anything that uses hasPiece does not change |
| 11:53 | Anderkent | it's the same way here - your (has-piece) function has to be changed |
| 11:53 | Anderkent | but anything that calls (has-piece) does not. |
| 11:53 | clojurebot | It's greek to me. |
| 11:53 | Anderkent | Does that make sense? |
| 11:54 | tgoossens | mmyes |
| 11:55 | tgoossens | it was just |
| 11:56 | tgoossens | hmm |
| 11:56 | tgoossens | could multimethods help here? |
| 11:56 | tgoossens | dispatch on collection type |
| 11:57 | tgoossens | or is that just bullshit |
| 11:57 | tgoossens | if for some reason |
| 11:57 | tgoossens | multiple forms of board are present |
| 11:57 | tgoossens | but then.. why would that happen hmm |
| 11:57 | tgoossens | maybe i'm seeing problems where there aren't any |
| 11:59 | Anderkent | if you want to support multiple types of boards |
| 11:59 | Anderkent | then protocols are probably what you want to use |
| 11:59 | tgoossens | because of the speed? |
| 11:59 | TimMc | Nah, protocols are restrictive. |
| 11:59 | tgoossens | or because of the "interface-like" behaviour |
| 11:59 | TimMc | Multimethods are far more flexible. |
| 12:00 | tgoossens | i like multimethods so far |
| 12:00 | tgoossens | seem quite powerful |
| 12:00 | tgoossens | but read that they are slower (because of the dynamic dispatch) |
| 12:00 | tgoossens | but that speed |
| 12:00 | Anderkent | the speed doesn't really matter 99% of the time |
| 12:00 | tgoossens | is not relevant here |
| 12:00 | tgoossens | anderkent: as you say. that is only in critical systems :p |
| 12:02 | firesofmay | Hi, I am looking to design LOGO programming environment in clojure. Can anyone give me pointers on how to get started on it? Like the libraries I should look at? |
| 12:02 | firesofmay | Its just to learn/fun. |
| 12:03 | tgoossens | ps: it really nice i don't have to invent my own type everytime ovr again :p |
| 12:04 | mtd | otfrom: yes, I was wondering about "Hack the Tower". I've got a website idea I'd like to build, and would love to do it in clojure with some people working on similar problems sitting next to me to bounce ideas off of, and vice-versa, but I don't want to waste anyone's time and money if the purpose of that meetup is to hack on salesforce.com's API or similar...just wondering what the structure was planned to be, as I'm not a hackathon regular. |
| 12:09 | tgoossens | Anyone heard of java "Future" |
| 12:09 | tgoossens | ? |
| 12:10 | Anderkent | yes, similar things in clojure are futures or promises |
| 12:10 | tgoossens | a friend told me a couple of minutes about it |
| 12:10 | tgoossens | never heard of it |
| 12:12 | tgoossens | looks ok to me |
| 12:13 | mycelloandi | firesofmay: take a look over here http://clojure-libraries.appspot.com should be a graphics section |
| 12:14 | tgoossens | Do i get this straight? Promises are the same as futures. but you can "deliver" later on a value? instead of defining what thread will do it? |
| 12:14 | firesofmay | mycelloandi, okay thanks. I was just checking out quil. I am wondering if there is something that will help me dynamically interact and generate. Will check it out. :) |
| 12:15 | holo | hi |
| 12:15 | mycelloandi | firesofmay: you could also use html5 canvas or svg via clojurescript |
| 12:16 | firesofmay | mycelloandi, I see. any advantage of doing/using that? |
| 12:16 | mycelloandi | easy to say "hey check this out" and just send a url :-) |
| 12:17 | Anderkent | with promises, you create it first and give it to someone other thread. Then at some point you deliver the promise, saying "You can now use this value" |
| 12:17 | tgoossens | ok. then i got it right :) |
| 12:17 | tgoossens | thanks |
| 12:17 | Anderkent | with futures, you ask some other thread to run computation for you, and wait for the result |
| 12:17 | holo | when i run a script with `lein run -m script.spam`, i get a "java.lang.ClassNotFoundException: clojure.string" if i remove an unneeded library. if i put it there with a require (and i don't even use it) the script runs perfectly. do i need to clean something? |
| 12:17 | tgoossens | so futures are more for thread-pool like stuff / executors? |
| 12:19 | firesofmay | mycelloandi, Hmm. Point taken. |
| 12:25 | pjstadig | if anyone it at the Sheraton for the conj and wants a chocoroom, stop by the board room |
| 12:25 | danlarkin | stop giving away our chocorooms paul |
| 12:27 | wink | I'm not sure I want to ask for details. |
| 12:27 | egghead | :) |
| 12:33 | alexnixon | why doesn't LazySeq have a .toString method? |
| 12:33 | tgoossens | think about what would happen |
| 12:34 | tgoossens | if it is an infinite sequence |
| 12:34 | tgoossens | like (repeat 5) |
| 12:34 | tgoossens | not sure that "is" the reason |
| 12:34 | alexnixon | then "here be dragons" as always with lazy sequences |
| 12:34 | tgoossens | but it makes sense to me |
| 12:34 | alexnixon | ,(str (doall (lazy-seq [1 2 3]))) |
| 12:34 | clojurebot | "clojure.lang.LazySeq@7861" |
| 12:34 | alexnixon | ,(str (seq (doall (lazy-seq [1 2 3])))) |
| 12:34 | clojurebot | "(1 2 3)" |
| 12:35 | alexnixon | seems odd |
| 12:35 | Anderkent | well, why the doall? |
| 12:35 | Anderkent | doesnt seem odd without doall at all :) |
| 12:35 | alexnixon | oh, I was just playing (to see whether it returns a realized lazy seq, or a seq) |
| 12:36 | alexnixon | and to point out that the "your sequence could be infinite" doesn't really apply when your lazy seq has already been realized |
| 12:36 | Anderkent | but you don't want the output of str to change depending on whether the seq was realized or not |
| 12:37 | ebraminio | Hi, how I can use map here? (merge* @fy @fz) to (merge* (map #(@%) fy fz)) |
| 12:38 | alexnixon | no, I agree you don't. I'm wondering why it doesn't just realize the seq, and just allow users to call .toString on an infinite sequence and shoot themselves in the foot |
| 12:38 | ebraminio | merge* is a custom (user defined) function and fy fz are two futures here |
| 12:39 | Anderkent | alexnixon: because you don't know whether a lazy seq is infinite or not, and you might want to call str on infinite seqs as well (f.e. in a debugger) |
| 12:39 | Anderkent | ebraminio: (merge * (apply deref fy fz)) |
| 12:39 | Anderkent | should be map |
| 12:39 | Anderkent | not apply |
| 12:40 | Anderkent | but basically @x => (deref x) |
| 12:41 | alexnixon | the debugger argument is a good one, but I don't think the "you don't know if it's infinite or not" is. We let users (apply hash-map col) when col could be infinite. |
| 12:44 | mefisto | so, if I want to implement something that matches keywords to functions (as in, if we get this keyword, call this function, as defined in a map or something like that) do I need to make a macro for that? |
| 12:44 | ebraminio | Anderkent, thanks a lot! :) can you help me a bit about it? when i write code i get this error Don't know how to create ISeq from: clojure.core$future_call$reify__5684 I guess (apply ...) is lazy, am I must (into [] x) it? |
| 12:44 | Anderkent | alexnixon: the expectation is that (str x) should be safe to do on any x |
| 12:45 | Anderkent | ebraminio: sorry, i said lower: it should be map. (merge* (map deref fx fy fz)) |
| 12:47 | Anderkent | mefisto: you can have functions in maps, but if you're just dispatching on a keyword you might want multimethods instead |
| 12:47 | Anderkent | ,((:my-str-keyword {:my-print-keyword prn :my-str-keyword str}) \A \B) |
| 12:47 | clojurebot | "AB" |
| 12:48 | alexnixon | Anderkent: then why not (str (range)) => "(0 1 2 3 4 ..." |
| 12:49 | alexnixon | perhaps I should just use prn and not worry about .toString |
| 12:49 | mefisto | Anderkent: ok, thanks! |
| 12:49 | Anderkent | alexnixon: what if each element is very costly? say you have a lazy seqs of files on remote server... How many do you fetch? What if they have side effects? |
| 12:50 | ebraminio | Anderkent, Sorry again, I am getting this "Wrong number of args (1) passed to" how I can fix it? |
| 12:51 | Anderkent | ebraminio: (apply merge* (map deref fx fy fz)) . Sorry! I knew I wanted apply there. |
| 12:51 | alexnixon | Anderkent: then I'd argue that you shouldn't use str without understanding that you'll realize some portion of your sequence. If you don't want that, don't use str |
| 12:53 | Anderkent | That means str is suddenly dangerous to use and I can't just print stuff in a repl. Bad cost just to have (str ...) instead of (str (seq ...)) |
| 12:54 | Anderkent | honestly I'm surprised prn does evaluate lazy seqs |
| 12:55 | ebraminio | Anderkent, oh great, but very sorry again, I am getting "Don't know how to create ISeq from: clojure.core$future_call$reify__5684" |
| 12:56 | alexnixon | Anderkent: so what about this: (let [x (range) y (seq x)]) |
| 12:56 | ebraminio | Anderkent, (apply merge* (map deref [fy fz])) |
| 12:56 | ebraminio | Anderkent, thanks a lot :) |
| 12:56 | alexnixon | Anderkent: if you don't call .toString on y, things are fine. If you do call .toString on y, you go OOM |
| 13:01 | tgoossens | i must admit. The first time i wanted to print lazy sequences. I was quite confused why it didn't work |
| 13:01 | alexnixon | I'm actually confused by that example - how do you explain this? &| (let [x (range) y (seq x)] (realized? x)) |& |
| 13:01 | lazybot | ⇒ true |
| 13:02 | ebraminio | Anderkent, http://imgs.xkcd.com/comics/logic_boat.png as a gift for you :) |
| 13:02 | TimMc | &(let [a (atom nil)] (reset! a a) a) |
| 13:02 | lazybot | java.lang.StackOverflowError |
| 13:04 | TimMc | ^ There are other things that can't be printed safely, by the way. |
| 13:04 | tgoossens | sense it makes none? :p |
| 13:04 | TimMc | Is that a bug? I don't know. |
| 13:04 | Anderkent | alexnixon: (seq x) realizes the first element of x if i recall correctly |
| 13:05 | alexnixon | Anderkent: that may be, but realized? should apply to the whole sequence |
| 13:06 | alexnixon | at least that's my understanding of it |
| 13:06 | TimMc | Wait wait wait, since when does lazybot have this &| [1 2 3] |& inline eval syntax? |
| 13:06 | lazybot | ⇒ [1 2 3] |
| 13:06 | Anderkent | I think there's a difference between 'lazy as a contract' and 'lazy as an implementation detail' |
| 13:06 | Anderkent | but I might be wrong/confused |
| 13:07 | Anderkent | seq's are lazy of the 'implementation detail' kind, so they're presumed safe to print |
| 13:07 | Anderkent | lazy-seqs are lazy of the 'I told you I'm lazy' kind, so they aren't safe to print |
| 13:07 | TimMc | I wouldn't say that. |
| 13:07 | Anderkent | Might be wrong her e:) |
| 13:07 | alexnixon | Anderkent: even though assuming that a seq is safe to print is dangerous |
| 13:07 | alexnixon | see my example above |
| 13:07 | TimMc | An infinite seq is contractually lazy. It wouldn't make sense any other way. |
| 13:07 | Anderkent | sure you can make things that break the expectations |
| 13:09 | raek | it's interesting that (str some-seq) actually realizes it... |
| 13:10 | Anderkent | TimMc: can you make an infinite seq without using lazy-seq somewhere? |
| 13:10 | raek | I think it is realized because toString uses its hashcode |
| 13:10 | seangrove | Hey all, I've been working in Clojurescript for awhile now, have some questions |
| 13:10 | raek | Anderkent: sure, you could define a new ISeq (that, for example, returns itself when you call rest on it) |
| 13:10 | seangrove | I would like to write a macro that will read from some template files locally and insert them as strings in the clojurescript code at compiletime |
| 13:11 | alexnixon | trying to keep this on track - my proposal is that it's more consistent, and more in line with the "principle of least surprise" for lazy sequences to have a .toString method |
| 13:11 | seangrove | Just want to make sure I'm thinking of this rigth with cljs - macros will run at compiletime, and therefore have access to the file system, right? |
| 13:12 | TimMc | alexnixon: I think a more appropriate track is to look at how prn handles lazy seqs. |
| 13:12 | Negdayen | seangrove: yep, should be so. |
| 13:12 | TimMc | (The whole print family of fns.) |
| 13:12 | seangrove | Negdayen: Thanks, cljs sometimes causes a bit of circular thought for me |
| 13:12 | Negdayen | (that's assuming cljs still uses clojure macros--should be so) |
| 13:19 | alexnixon | TimMc: (str (range 0 2)) => "clojure.lang.LazySeq@3c2". (pr-str (range 0 2)) => "(0 1)" |
| 13:20 | Anderkent | I think it's definitely surprising for .toString to realize lazy-seqs, but then again I find it surprising pr does it. |
| 13:20 | alexnixon | TimMc: (str (range)) => death. (pr-str (range)) => death. |
| 13:20 | alexnixon | so it seems that calling .toString on a lazy sequence *does* realize the whole thing, but also prints garbage |
| 13:21 | Anderkent | in which case it manages to combine the worst of both cases |
| 13:21 | alexnixon | Anderkent: yep :-( |
| 13:21 | alexnixon | Anderkent: and bolsters the argument for giving clojure.lang.LazySeq a .toString method |
| 13:23 | alexnixon | ah, and of course Stuart Sierra has gotten there first: https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/F68GRPrbfWo |
| 13:23 | Anderkent | (defn prange ([] (prange 1)) ([n] (prn 'Realized' n) (cons n (lazy-seq (prange (inc n)))))) |
| 13:23 | Anderkent | is useful for exploring that |
| 13:24 | Anderkent | (should be double quotes around realized, of course) |
| 13:24 | Anderkent | and indeed it realizes all of it - try (str (take 10 (prange)) |
| 13:25 | alexnixon | yeah as the email above (and raek pointed out) it's because hashCode is called |
| 13:26 | alexnixon | so sensible behaviour is either 1. give lazy-seq a toString method which *doesn't* realize the seq, and prints garbage. 2. give lazy-seq a toString method which *does* realize the seq, and prints it |
| 13:27 | Anderkent | yep |
| 13:30 | alexnixon | well at least that's the issue clarified, even though I'm not sure which of those is the better option |
| 13:30 | alexnixon | have to go now - thanks for the help |
| 13:30 | tgoossens | easy question: how to turn "nil" into "false" |
| 13:31 | tgoossens | (other than using if) |
| 13:32 | alexnixon | (defn truthy [x] (comp not not)) |
| 13:32 | Anderkent | tgoossens: what should it do on not-nill values? |
| 13:32 | tgoossens | wel |
| 13:32 | tgoossens | *well: |
| 13:32 | Anderkent | false on nil true on everything else? |
| 13:32 | tgoossens | yes |
| 13:32 | tgoossens | (def haspiece? [{:keys [pieces] :as board} piece] |
| 13:32 | tgoossens | (pieces piece)) |
| 13:33 | Anderkent | ,(not (nil? nil)) |
| 13:33 | clojurebot | false |
| 13:33 | Anderkent | hm |
| 13:33 | pyrtsa | tgoossens: (doc boolean) |
| 13:33 | tgoossens | thats it! |
| 13:33 | tgoossens | thanks |
| 13:33 | pyrtsa | Often not needed, like you probably know. |
| 13:34 | Anderkent | you dont want boolean since it will give you false on false. |
| 13:34 | Anderkent | ,(not (nil? false)) |
| 13:34 | clojurebot | true |
| 13:34 | Anderkent | ,(boolean false) |
| 13:34 | clojurebot | false |
| 13:34 | pyrtsa | Then (comp not nil?) |
| 13:35 | tgoossens | ,(boolean nil) |
| 13:35 | clojurebot | false |
| 13:40 | tgoossens | when i rewrote my OO project from last year in clojure. I'm going to mindblow the professor (or so i hope :p ) |
| 13:41 | akhudek | tgoossens: is the rewrite shorter? |
| 13:41 | tgoossens | i just started today :p |
| 13:41 | tgoossens | but for the functionality i rewrote atm |
| 13:41 | tgoossens | yes |
| 13:42 | tgoossens | its just. i find it a real pity that the coming years everything will be in the theme of "OOP": "OO is the best, and all you should do is OO" |
| 13:42 | tgoossens | and I would like an opinion on that |
| 13:42 | tgoossens | but i'll first create an example |
| 13:42 | tgoossens | many people in my study |
| 13:43 | tgoossens | have heard ONLY of OO. Don't event know that there are other ways to program |
| 13:43 | tgoossens | thats just lame |
| 13:43 | tgoossens | and I want to try to change that awareness a bit |
| 13:43 | tgoossens | (not in the shortterm, but in the longterm) |
| 13:44 | akhudek | tgoossens: it takes time for popularity to shift. The lack of popularity for functional languages has been a hotly debated topic for many many years |
| 13:44 | akhudek | since the first lisp probably :) |
| 13:45 | tgoossens | any advice on what I should talk with my professor about? |
| 13:45 | tgoossens | akhudek: probably yes. All i want for now is the professors opinion |
| 13:46 | tgoossens | (ps: university of leuven, belgium) |
| 13:47 | akhudek | not particularly. If you want his opinion just ask and listen. Don't discard what he says idly. |
| 13:47 | scriptor | just ask him what his opinion is on functional programming |
| 13:47 | scriptor | before you show off your code to him |
| 13:47 | tgoossens | you're right |
| 13:47 | scriptor | I'm sure he's had plenty of students trying to impress him before |
| 13:47 | Iceland_jack | Don't be surprised if he doesn't care that much |
| 13:48 | tgoossens | why would that be? |
| 13:50 | madsy | tgoossens: If anyone tries to sell you OO as some ultimate method, show them http://c2.com/cgi/wiki?GoldenHammer |
| 13:51 | akhudek | tgoossens: profs come in as many variations as people elsewhere. Some are just interested in their narrow domain and may not find the OO vs functional debate interesting. Ohter profs love questions like that and will happily spend time talking to you about it and perhaps trying to convince you of their point of view. You won't know until you talk to him/her. |
| 13:52 | tgoossens | madsy: lol |
| 13:52 | tgoossens | akhudek: i'll just ask his opinion. and see how it goes :) |
| 13:53 | Iceland_jack | That's a good plan |
| 13:53 | scriptor | also, stay humble |
| 13:54 | Iceland_jack | ^^ |
| 13:55 | tgoossens | oh. don't worry about that. I've been interfering humbly in a professors teaching before succesfully ;) |
| 13:56 | tgoossens | and now he mentions what i told. in his classes :) |
| 13:57 | tgoossens | and now a confession: |
| 13:58 | tgoossens | it has only been a month since my first contact with functional programming and clojure in particular |
| 13:58 | tgoossens | before that i was "OO-fanatic" ("oo" is the best) |
| 13:58 | tgoossens | but i prefer to become more pragmatic :) |
| 13:59 | Iceland_jack | It sounds like you're still forming your opinions and preferences |
| 13:59 | tgoossens | yes |
| 13:59 | tgoossens | absolutely |
| 13:59 | Iceland_jack | so I'd think carefully before becoming too dogmatic either way |
| 13:59 | Iceland_jack | Not saying you are, but it's not unheard of |
| 13:59 | TimMc | ,{(range) 5} |
| 14:00 | clojurebot | {(0 1 2 3 4 ...) 5} |
| 14:00 | TimMc | ,(hash-map (range) 5) |
| 14:00 | tgoossens | yes. thats why i'm learning about FP on myself |
| 14:00 | clojurebot | Execution Timed Out |
| 14:00 | tgoossens | and OO will be in class |
| 14:00 | scriptor | hmm... |
| 14:00 | Iceland_jack | Glad to hear that |
| 14:00 | tgoossens | but that doesn't rule out |
| 14:00 | TimMc | Iceland_jack: The zeal of the convert? |
| 14:01 | tgoossens | that i want the opinion of my prof :) |
| 14:01 | Chiron | Hi, i don't really understand tree-seq (tree-seq vector? seq [[1 2 [3]] [4]]) would you please explain to me its output ? |
| 14:01 | Chiron | , (tree-seq vector? seq [[1 2 [3]] [4]]) |
| 14:01 | clojurebot | ([[1 2 [3]] [4]] [1 2 [3]] 1 2 [3] ...) |
| 14:01 | tgoossens | but as you said |
| 14:01 | tgoossens | currently sstill forming |
| 14:01 | tgoossens | and a lot of "quoting" of the talks i saw about clojure & fp |
| 14:02 | tgoossens | (even overexcited perhaps) |
| 14:04 | tgoossens | g2g bye! |
| 14:14 | bobo_ | doesnt it work to modify an atom if you do it in another thread? just calling my function seems to work. but submiting it to a executor doesnt seem to work? |
| 14:15 | TimMc | bobo_: It's not really clear what you're asking. Wht did you do, what did you expect, and what actually happened? |
| 14:16 | bobo_ | I have an atom, i have a function that resets the value. When i call that function, the value of the atom resets. |
| 14:16 | bobo_ | but when i submit the function to a scheduledexecutor, nothing happens |
| 14:16 | bobo_ | ive been away from clojure for way to long |
| 14:16 | TimMc | So you have any evidence the fn is actually being run? |
| 14:16 | TimMc | *Do |
| 14:17 | bobo_ | hm, good point |
| 14:24 | piranha | I've retrieved contrib.datalog from old monolithic contrib, which is fun - could be used as an in-memory db for cljs apps, but it seems to be quite slow :( |
| 15:06 | `fogus | piranha: There are many reasons why it's slow, the least of which is that it does a lot of set operations |
| 16:03 | seangrove | I can't seem to get the google closure hash library working in clojurescript properly: https://gist.github.com/4074776 |
| 16:03 | seangrove | It's saying the required namespace was never provided |
| 16:04 | seangrove | If I just require [goog.crypt :as crypt] instead of [goog.crypt.Md5 :as md5] it works, but the md5 methods aren't there |
| 16:07 | Chiron | Hi, list comprehension is clear choice , but any other ways ? http://pastie.org/5379078 |
| 16:08 | znDuff | "get the coll-3 of each coll-2 of each coll-1"? |
| 16:09 | znDuff | Chiron: An example that's complete enough to be independently runnable would be helpful. Otherwise, it's not clear what the "coll-3" of a "coll-2" _is_. |
| 16:09 | Chiron | coll-1 has a seq 'call-2' . each element in coll-2 has a seq named 'coll-3' |
| 16:10 | znDuff | Chiron: ...also, if you're doing this for side-effects, which the do-some-thing name implies, you should probably be using doseq rather than for. |
| 16:10 | znDuff | ... |
| 16:11 | znDuff | Chiron: It's still not clear. Let's go at it from a different direction: How does what you have already differ from what you want? |
| 16:12 | Chiron | the current for works (which it is something like Java's nested loops) . i'm only wondering how list comprehension could be done in Clojure in another way |
| 16:13 | znDuff | Chiron: "list comprehension" is Python terminology -- it's not exactly common here. |
| 16:13 | Chiron | http://clojuredocs.org/clojure_core/clojure.core/for |
| 16:14 | znDuff | *shrug*. Even so, I haven't seen it used in Clojure outside the documentation, and people coming from Python. |
| 16:15 | znDuff | ...anyhow -- other approaches. *shrug*. You can look at what the for macro expands to, of course. |
| 16:15 | Chiron | thank you |
| 16:25 | seangrove | Ok, after digging around in the goog-closure jar, it looks like none of them actually include the md5 library |
| 16:26 | seangrove | anyone know if it's fundamentally incompatible, or just omitted for some reason? |
| 16:27 | wei_ | is there a clj socket library? or do people just use java sockets? |
| 16:29 | wei_ | ^ I see there's a wrapper called pocket |
| 16:29 | nightfly_ | I just use Java sockets but: https://clojars.org/search?q=socket |
| 16:31 | zodiak | hrm. stupid question, in vimclojure, how do I map \rt to run all tests for the project, not jst the tests in the current buffer ? |
| 16:32 | lkjklkjj | If I have a java array #<long[] [J@75da931b> How do I stop class cast exception when calling (java.util.Arrays/asList ) |
| 16:32 | lkjklkjj | [J cannot be cast to [Ljava.lang.Object |
| 16:33 | raek | lkjklkjj: does this work? (let [^:longs array (expression-yielding-array)] (java.util.Arrays/asList array)) |
| 16:34 | raek | sorry, "^longs" |
| 16:35 | raek | perhaps this works too (let [^"[J" array ...] ...) |
| 16:35 | lkjklkjj | ^no :( |
| 16:39 | lkjklkjj | This works fine as its a list of Object |
| 16:39 | lkjklkjj | (java.util.Arrays/asList (.toArray (java.util.ArrayList. [4 3 2 1]))) |
| 16:41 | zackzackzack | When I am writing tests with clojure.test, how can I test to see if a code throws an error? |
| 16:42 | lkjklkjj | but this (java.util.Arrays/asList (.array (-> (java.nio.LongBuffer/allocate 4) (.put 4) (.put 3) (.put 2) (.put 1)))) fails with [J cannot be cast to [Ljava.lang.Object; |
| 16:46 | TimMc | THat seems... unlikely. |
| 16:55 | alexyk | hey -- clojurescriptone wants leon 1.7. How can I have 2 leins coexist? |
| 16:55 | alexyk | lein, not león. |
| 16:57 | znDuff | alexyk: calling the old one "lein1" is the typical approach. |
| 16:57 | alexyk | znDuff: is that enough? just get the old lein driver and call it? |
| 16:57 | znDuff | yup. |
| 16:58 | wei_ | thanks nightfly_ |
| 16:59 | jamii | http://dresdencodak.tumblr.com/post/35721129714/let-me-tell-you-about-fake-geek-guys |
| 16:59 | jamii | Ooops |
| 16:59 | jamii | I need to just close non-hackerschool tabs :( |
| 17:02 | andrewmcveigh | lkjklkjj: I think you want "doto" instead of "->" |
| 17:10 | lkjklkjj | still just can't figure out how to call asList correctly (def mla (.array (doto (java.nio.LongBuffer/allocate 4) (.put 4) (.put 3) (.put 2) (.put 1)))) mla #<long[] [J@626287d3> (java.util.Arrays/asList mla) ClassCastException [J cannot be cast to [Ljava.lang.Object; |
| 17:10 | amalloy | lkjklkjj: asList takes an Object[]. you don't have an Object[], you have a long[] |
| 17:11 | amalloy | there is no way to call asList with the result of (.array someLongBuffer) |
| 17:11 | lkjklkjj | Shouldn't it take T whatever T is? |
| 17:12 | amalloy | provided that T subclasses Object, which primitives do not |
| 17:12 | lkjklkjj | Ah |
| 17:13 | lkjklkjj | Thanks I that would explain it |
| 17:13 | TimMc | Argh, right. |
| 17:14 | terom | (Java compiler accepts Arrays.asList(somePrimitiveArray), but it will create a List with one Object in it what would be your primitive array. It's still probably something you don't want...) |
| 17:28 | devn | Is anyone else annoyed w/r/t finding the most recent version of any given modular contrib library? |
| 17:29 | hiredman | what do you mean? |
| 17:29 | znDuff | devn: Seems like the kind of thing Maven is good at. |
| 17:29 | devn | Where do you look if you're about to require, for instance, logging? |
| 17:29 | hiredman | by which I mean, no |
| 17:29 | devn | To find the most recent version, I mean. |
| 17:29 | hiredman | clojure.tools.logging |
| 17:30 | devn | What is your workflow to find the latest version you can require? |
| 17:30 | hiredman | I don't look for the latest version |
| 17:30 | devn | So in project.clj you type what? |
| 17:30 | hiredman | devn: it's already in there, and it never changes |
| 17:31 | devn | hiredman: Suppose you're on a new project... |
| 17:31 | devn | What would you do? |
| 17:31 | hiredman | I go to https://github.com/clojure/tools.logging and read the readme |
| 17:31 | hiredman | https://github.com/clojure/tools.logging#installation |
| 17:32 | devn | Wouldn't it be nice to just hit clojars and see the release there? |
| 17:32 | hiredman | devn: why? |
| 17:32 | hiredman | I never go to the clojars website |
| 17:32 | hiredman | the release is most likely not even in clojars |
| 17:33 | hiredman | contrib stuff goes to maven central |
| 17:33 | devn | hiredman: Right, how do search maven central? |
| 17:33 | hiredman | depends, I genenrally don't though |
| 17:33 | devn | Why not? |
| 17:33 | hiredman | because I don't search for things that are in maven |
| 17:34 | brehaut | devn: https://oss.sonatype.org/index.html |
| 17:34 | devn | brehaut: loading... I'm on a plane |
| 17:34 | hiredman | I search for a projact or library that does X, and when I find one I go to the installation / usage instructions |
| 17:34 | hiredman | project |
| 17:34 | brehaut | devn: oh well shit, thats an ext or whateveritscallednow app |
| 17:34 | brehaut | devn: but it will let you search central |
| 17:35 | devn | hiredman: brehaut: I guess all I'm getting at is that we have these disparate sources and methods for finding current versions for one ecosystem |
| 17:35 | hiredman | there is no single ecosystem |
| 17:35 | brehaut | i <3 distributed ecosystem |
| 17:35 | hiredman | that is a myth |
| 17:35 | devn | Depends on how you define ecosystem |
| 17:36 | franics_ | Hello all - I'm using clojure java.jdbc to run some sql queries against a AWS RDS mysql instance and I'm getting some extremely long query times. SQL reports that the query takes ~4 sec[0] - however the time for the entire process with JDBC is taking ~30 seconds. Has anyone else had issues with this/have thoughts on the matter? |
| 17:36 | franics_ | |
| 17:36 | franics_ | Please note that I am running the query from an amazon server in the exact same zone as the DB instance. |
| 17:36 | franics_ | |
| 17:36 | franics_ | http://paste.lisp.org/display/133749 - the code I'm using |
| 17:36 | franics_ | |
| 17:36 | franics_ | [0] As showing by profiling the query |
| 17:37 | devn | "gem install foo" vs "realize that contrib is now modular and each lib has its own github repo, navigate to said github repo and find the most recent version assuming the author updated the readme, but well, you may want to search maven central just in case" |
| 17:37 | hiredman | there is no single source of maven info |
| 17:37 | devn | that's just weak sauce |
| 17:37 | hiredman | there are many maven repos with many different things |
| 17:37 | hiredman | no, gems are weak sauce and dumb |
| 17:38 | brehaut | devn‽ leins defaults let you do just the same (unless you want to play on bleeding edge contrib snapshots) |
| 17:38 | brehaut | its not rocket surgery to set up more repos either |
| 17:38 | devn | hiredman: care to qualify that? |
| 17:38 | hiredman | devn: you qualify yours first |
| 17:39 | devn | i asked first |
| 17:39 | hiredman | no |
| 17:40 | hiredman | I do not care to qualify that |
| 17:40 | devn | look: I just think it's silly that we can't come up with one place to search for patently clojure dependencies. |
| 17:40 | devn | i think it is a shitty user experience |
| 17:40 | franics_ | devn: agreed - I'd love to know if you've any thoughts as to make it better. |
| 17:42 | devn | franics_: a new clojars maybe? |
| 17:42 | franics_ | devn: why would it have to be new - and what precicely would you do to improve on the current formula? |
| 17:43 | devn | franics_: it doesn't have to be new -- it could just be building on the existing clojars |
| 17:43 | francis | just realized my name was spelled wrong *smh* |
| 17:43 | devn | but what i imagine is: you go to clojars, and you see releases for things that are in maven central that lots of clojure-folk use |
| 17:43 | devn | regardless of whether they *live* on clojars |
| 17:44 | devn | tools.logging, for instance. i feel like you should be able to search for that. |
| 17:44 | francis | Ah, that's cool - though I'm not sure how you would get data about jars that don't *live* there |
| 17:44 | devn | francis: scrape maven central |
| 17:46 | devn | francis: whether anyone likes gems or not, you can at leasr `gem search -r foo` and find meaningful libs. I still don't get how leiningen's search utility is supposed to work or be useful to new users. most tutorials in clojure start out with: get leiningen. |
| 17:46 | devn | s/leasr/least |
| 17:48 | devn | honestly a lot of this stuff is /done/ and works, it's just that it's usually given a really annoying interface |
| 17:48 | devn | For instance: Here's the output of `lein search` with no args... |
| 17:49 | devn | Wrong number of arguments to search task. |
| 17:49 | devn | Expected ((project query page)) |
| 17:49 | devn | Super informative, eh? |
| 17:50 | francis | devn: Talk to Phil about it - I'm sure if you've got some improvement your willing to implement he'd be more than happy to discuss improving lein |
| 17:50 | devn | So you type `lein help search` -- better, but it's still just kind of weird |
| 17:50 | francis | *you're |
| 17:50 | francis | devn: personally I never use lein search and as such don't feel your pain in this particular situation |
| 17:50 | devn | Fair enough -- I'll bring it up at the conj. Hopefully hiredman doesn't beat me up |
| 17:51 | devn | They just told me to put away my 'puter. Wheels down RDU. |
| 17:51 | devn | Cheers |
| 17:51 | francis | devn: have fun at the conj yo |
| 17:51 | hiredman | when have I ever beat anyone up? |
| 17:52 | francis | I'm sure everyone already heard this before - but... |
| 17:52 | francis | Hello all - I'm using clojure java.jdbc to run some sql queries against a AWS RDS mysql instance and I'm getting some extremely long query times. SQL reports that the query takes ~4 sec[0] - however the time for the entire process with JDBC is taking ~30 seconds. Has anyone else had issues with this/have thoughts on the matter? |
| 17:52 | francis | |
| 17:52 | francis | Please note that I am running the query from an amazon server in the exact same zone as the DB instance. |
| 17:52 | francis | |
| 17:52 | francis | http://paste.lisp.org/display/133749 - the code I'm using |
| 17:52 | francis | |
| 17:52 | francis | [0] As showing by profiling the query |
| 17:53 | TimMc | francis: Please don't re-paste like that -- I can still see the first copy at the top of my screen. |
| 17:53 | francis | TimMc: noted. |
| 17:55 | seangrove | Hey guys, wondering about the goog-closure.jar, and where it comes from |
| 17:55 | seangrove | Is it centrally maintained, or can I compile my own version? The few I've found so far are missing the md5 libs |
| 17:56 | seangrove | (speaking about clojurescript of course) |
| 17:57 | ivan | I just put closure-library\closure and closure-library\third_party\closure in my CLASSPATH |
| 17:58 | ivan | you can make your own jar with those, I guess |
| 18:02 | technomancy | devn: looks like a bug that the project arg is shown in the error message there |
| 18:03 | technomancy | they screwed us up by removing the old index format, so there was a while where lein search just wouldn't work |
| 18:05 | seangrove | ivan thanks, I'll give that a try, been a rough patch after a great start. |
| 18:08 | egghead | hmm, with expectations and with-redefs, does the redef only happen once per file? I'm making some changes to atom in one redef that are showing up in another with-redef |
| 18:11 | technomancy | devn: fixed |
| 18:13 | egghead | ah, I was confusing redef-state with with-redefs |
| 18:13 | egghead | nope, nvm |
| 18:14 | alexyk | I have a name conflict in my namespace from imports, how do I rename the colliding symbol away? |
| 18:16 | gfredericks | alexyk: they both come from other namespaces? |
| 18:17 | alexyk | yep |
| 18:17 | gfredericks | the easy way is to not refer at least one of the namespaces -- i.e., give it a prefix |
| 18:17 | alexyk | that kind of answered my question :) |
| 18:17 | gfredericks | I know refer lets you rename things |
| 18:17 | gfredericks | but I don't know the exact syntax |
| 18:18 | gfredericks | but prefixing is the normal approach I think |
| 18:18 | gfredericks | e.g., (:require [clojure.string :as s]) |
| 18:19 | Apage43 | refer takes a :rename {from-symbol to-symbol ...} |
| 18:19 | Apage43 | if you really do want to do that |
| 18:22 | azkane | is there a function to check if a string is a substring of another? other than using a regex? |
| 18:23 | gfredericks | the string class has that I think |
| 18:23 | znDuff | azkane: the java standard library's String class has methods for that, yes. |
| 18:24 | kofno | (.contains ...) |
| 18:24 | kofno | I think |
| 18:24 | azkane | oh, i thought there was a clojure function for that, will use the java one thanks! |
| 18:32 | alexyk | say I did (use 'bad) and regret it. How do I dissociate bad namespace from current? |
| 18:33 | Apage43 | alexyk: if you didn't clobber any symbols you can use ns-unmap and ns-publics |
| 18:37 | alexyk | (ns-unmap ['user 'server]) |
| 18:37 | alexyk | ArityException Wrong number of args (1) passed to: core$ns-unmap clojure.lang.AFn.throwArity (AFn.java:437) |
| 18:37 | alexyk | ? |
| 18:37 | alexyk | doc ns-unmap says it takes [ns sym] |
| 18:39 | alexyk | omg nm |
| 18:39 | brehaut | (ns-unmap 'user 'server) |
| 18:40 | alexyk | yeah, a case of rusty idiocy/idiotic rustiness |
| 18:40 | alexyk | in #Haskell 3 people would have said that already! you guys rock |
| 18:41 | brehaut | ? |
| 18:42 | alexyk | brehaut: rustiness on my part :) |
| 18:43 | brehaut | right |
| 18:43 | alexyk | I'm glad folks here are helpful in all cases :) |
| 18:43 | alexyk | btw there's a remove-ns |
| 18:53 | zodiak | stupid question.. I have a defn inside a (-> ..), how do I 'promise' I will defn one of these methods later ? |
| 18:53 | zodiak | or rather; (-> f add-behaviors show!) .. and I defn add-behaviors later in the same file |
| 18:54 | cgag | declare? |
| 18:54 | zodiak | how do I say 'promise it will come later' (ala prototype ?) |
| 18:54 | cgag | (declare add-behavior) |
| 18:54 | zodiak | aahhh |
| 18:54 | zodiak | yup. (doc declare) has it.. awesome ta |
| 18:59 | mpan | what's the simplest (not necessarily proper) way to use a jar I have locally? |
| 18:59 | znDuff | mpan: ...well, the _proper_ way is to install it in your local Maven repo (the ~/.m2/ cache) |
| 18:59 | znDuff | mpan: ...which Maven has a subcommand to do. |
| 19:00 | mpan | I wasn't aware I even had maven, except that lein brought it along at some point |
| 19:01 | znDuff | well -- see if you have a mvn command |
| 19:01 | znDuff | if you don't, you might need to install it. |
| 19:01 | mpan | autocomplete for "mv" only has "mv" so I guess I don't |
| 19:02 | mpan | is there somewhere I can just drop the jar as a one-off for now? |
| 19:02 | mpan | google also suggests I do it "properly" but I've dug myself into a deadline hole |
| 19:05 | znDuff | Well -- yes, but you'll have to create a .pom file by hand |
| 19:05 | mpan | I was really hoping just to point lein at a path |
| 19:05 | mpan | (wouldn't mind hard-coding it for now) |
| 19:05 | znDuff | if you want to call it example.com/mylib 1.0, then create ~/.m2/repository/example/com/1.0/ |
| 19:07 | znDuff | ...and drop mylib-1.0.jar in there |
| 19:07 | mpan | does that approach require writing more config also? or just make the path and drop the jar? |
| 19:08 | znDuff | ...and create a mylib-1.0.pom file that looks like https://gist.github.com/4075744 |
| 19:08 | znDuff | and that's it. |
| 19:08 | znDuff | so -- you drop the jar, and you create the tiny little XML file, and that's it. |
| 19:10 | mpan | great! thank you! |
| 19:12 | thmzlt | anyone having "Invalid memory access" issues with lein and OS X? |
| 19:21 | wei_ | what's idiomatic clojure to continuously read from a socket? |
| 19:22 | gfredericks | without any context at all, I would think you could do that with a lazy seq |
| 19:24 | amalloy | wei_: http://stackoverflow.com/questions/1054170/clojure-variables-and-looping may be relevant |
| 19:24 | seangrove | What's a better/more efficient way to write this function to detect if a string contains a double-byte char: https://gist.github.com/a38106fe15a521288708 |
| 19:24 | wei_ | gfredericks: how do you do that in another thread so the repl is still responsive? |
| 19:25 | seangrove | It has to target clojurescript though, so can't use Java utils |
| 19:27 | gfredericks | wei_: you don't have to do it in another thread |
| 19:27 | wei_ | ah, just read through amalloy's link. thanks |
| 19:27 | Apage43 | seangrove: it's worth noting that any unicode codepoint > 127, not 255, will have a multi-byte encoding |
| 19:28 | seangrove | Ah, good point |
| 19:28 | seangrove | As far as writing an efficient function though? |
| 19:28 | seangrove | Recur keeps it from having to traverse the whole string, but it looks clunky |
| 19:29 | dnolen | seangrove: if efficiency is the main concern just right it just like you in JS w/ loop/recur. |
| 19:29 | Somelauw | Can't you use filter and check if the resulting lazy-seq has at least 1 element? |
| 19:29 | dnolen | er s/right/write |
| 19:29 | TimMc | In CLJS, what are the elements of a string seq? |
| 19:30 | seangrove | It's not the biggest concern, it's used on short strings, and rarely, but was just curious |
| 19:30 | TimMc | (some #(...) string) |
| 19:30 | seangrove | TimMc: I believe strings of length-1 |
| 19:30 | TimMc | Bah, OK. |
| 19:30 | Somelauw | like (seq (filter #(> (.charCodeAt % 0) 255)) |
| 19:30 | TimMc | That spawns a ton of tiny strings. |
| 19:31 | dnolen | seangrove: if efficiency doesn't matter then TimMc's suggestion works fine. |
| 19:32 | Somelauw | oh, some does that as well |
| 19:33 | seangrove | Ah, yes, some, that looks like what I wanted |
| 19:36 | seangrove | Thanks TimMc, appreciate it |
| 19:50 | mpan | I'm getting a strange error from "lein deps" using a local repo https://www.refheap.com/paste/6688 |
| 19:50 | mpan | I followed some tutorials but I may have messed up the process midway |
| 19:50 | mpan | can someone help me understand what that error is? |
| 19:51 | mpan | the jar file is in the same spot as the pom file but it doesn't seem to find it? |
| 19:52 | znDuff | mpan: Pasting the POM wouldn't be a bad place to start. |
| 19:52 | mpan | here's the pom file https://www.refheap.com/paste/6689 |
| 19:53 | mpan | the jar and the pom file are both in the same spot in the local repo |
| 19:56 | znDuff | your local repo isn't at ~/.m2/repository? |
| 19:56 | znDuff | anyhow -- what does your project.clj look like? |
| 19:57 | mpan | :repositories {"local" ~(str (.toURI (java.io.File. "mvn_repo")))} |
| 19:57 | mpan | under :dependencies, there is [jgap/jgap "3.6.2"] |
| 19:58 | mpan | I was following a tutorial that recommended making a new directory for it |
| 19:58 | mpan | should I use the one under .m2 instead? |
| 19:58 | znDuff | Does it work properly if you don't do that, and use the default local repository? |
| 20:01 | mpan | should I just copy the directory structure over? |
| 20:02 | znDuff | Sure. |
| 20:05 | mpan | it seems to have worked |
| 20:05 | mpan | thank you! |
| 20:06 | mpan | in the future, should I use mvn's install directly to the default repo? |
| 20:06 | znDuff | It's what I do, anyhow. |
| 20:06 | znDuff | Wouldn't be surprised if whitespace in the path were an issue. |
| 20:07 | znDuff | (with respect to why the other approach wasn't working) |
| 20:08 | mpan | in general, should I worry about naming my directories with spaces? |
| 20:10 | zodiak | why in a repl does (source foo) not work after I have done; (defn foo "test" [] "x") |
| 20:10 | zodiak | it works for (source doc) jst dandy |
| 20:10 | zodiak | mpan, yeah.. spaces in dirs/filenames are jst a pain in the tucas |
| 20:11 | ivan | zodiak: Clojure doesn't preserve the source for functions it compiles |
| 20:11 | ivan | ,serializable-fn |
| 20:11 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: serializable-fn in this context, compiling:(NO_SOURCE_PATH:0)> |
| 20:11 | ivan | serializable-fn? |
| 20:11 | clojurebot | serializable-fn is a hack for preserving source of a compiled function: https://github.com/technomancy/serializable-fn |
| 20:12 | ToxicFrog | zodiak: (source) works by tracking down the original .clj file and reading it, AIUI |
| 20:13 | zodiak | spiffy .. ta |
| 20:18 | ivan | so (source) is probably a lot of fun if you've changed the .clj file |
| 20:22 | amalloy | mpan: definitely don't use spaces in directory/namespace names. they're equivalent to java package names, which are restricted exactly to java identifiers |
| 20:24 | znDuff | mpan: In an ideal world, you wouldn't have to worry about it. |
| 20:24 | znDuff | mpan: ...in the real world, it tends to expose bugs that would otherwise not trigger. |
| 20:25 | znDuff | mpan: ...so -- if I wanted to spend my time finding and fixing bugs in other peoples' software, I'd have my home directory have a space in its path. |
| 20:25 | znDuff | amalloy: the context here isn't namespace names, but Maven repo path names. |
| 20:26 | zackzackzack | Is there a way to get leiningen to be more verbose? I'm trying to debug a "error in opening zip file" and not having much luck. |
| 20:27 | zackzackzack | Found DEBUG=TRUE but it doesn't help much. |
| 20:36 | DaReaper5 | Hi again! I have another clojure question. This time about hwo to return an input stream in the body of a message. |
| 20:36 | DaReaper5 | I have the following: :body (io/input-stream (simple.FastReportTest/reTest) |
| 20:37 | DaReaper5 | simple.FastReportTest/reTest returns a ByteArrayInputStream |
| 20:38 | zodiak | zackzackzack, I don't think so, but, without sounding like a troll, write a few tests around the fn that deals with the zip files.. no ? |
| 20:39 | DaReaper5 | I get the following error: java.lang.IllegalArgumentException: No implementation of method: :make-input-stream of protocol: #'clojure.java.io/IOFactory found for class: nil |
| 20:39 | zackzackzack | zodiak: This is more of a dependency issue than anything else. I'm using leiningen as a tool right now and to write tests would mean I would have to set it up locally and test it here |
| 20:42 | DaReaper5 | any help would be much appreciated. To sum up my question again: How to i return an input stream properly in the body of a message? |
| 20:45 | DaReaper5 | The following also does not work: :body (java.io.ByteArrayInputStream. (simple.FastReportTest/reTest) |
| 20:46 | DaReaper5 | I get a java.lang.NullPointerException |
| 20:46 | DaReaper5 | However on a local test using the same java code i know null is not being returned. |
| 20:47 | DaReaper5 | :( |
| 20:48 | znDuff | DaReaper5: Can you provide enough context that we can actually reproduce your result? |
| 20:50 | DaReaper5 | it would take way too much for you to reproduce exporting a dynamically created jasper report. However ALL i want to know is what is the standard convention for returning an input stream that is NOT a file. (I can return files fine) |
| 20:50 | znDuff | (ideally, enough context and not the tiniest bit more) |
| 20:51 | DaReaper5 | to return a ByteArrayInputStream in :body do i do: [:body (java.io.ByteArrayInputStream. (simple.FastReportTest/reTest)], [:body (io/input-stream (simple.FastReportTest/reTest)], or something else |
| 20:52 | DaReaper5 | [:body (io/input-stream "file.xls") ] works |
| 20:52 | DaReaper5 | hmm maybe more high level context: |
| 20:52 | znDuff | ...so, if you're returning something lazy that isn't valid when it's evaluated later, that would be the more usual cause of that kind of issue. |
| 20:53 | znDuff | that's not specific to input streams, though |
| 20:53 | DaReaper5 | i have a clojure web server which responds to api calls. I am creating a test that returns a dynamically created file, but am having issue with ":body" |
| 20:53 | DaReaper5 | "returning something lazy |
| 20:54 | DaReaper5 | "?* |
| 20:54 | znDuff | "lazy" == "not existing until referenced" (or until read). |
| 20:54 | znDuff | ...it's very, very easy to make things lazy in Clojure |
| 20:55 | znDuff | and if you have something that's lazy and gets evaluated after you're outside of a thread-local scope where valid bindings for it existed, you get problems like what you're describing here |
| 20:55 | znDuff | but because you aren't giving us enough context to reproduce, that's guesswork. |
| 20:55 | znDuff | You're fixating on the "but it's an input stream!" bit, but if that input stream runs code that depends on thread-local context before it can be read, that code matters. :) |
| 20:56 | spear | Hey guys. I'm going to try to not sound like a noob here. A few months ago I was planning to learn clojure, but then I read an article that said it was significantly slower than Java. |
| 20:56 | spear | It said that because Clojure generated docstrings (for production as well as development programs, when its only needed for dev), it was slower. Has anything been done about this? |
| 20:56 | znDuff | spear: docstrings have nothing to do with it. |
| 20:56 | DaReaper5 | sorry, (clojure noob) but i thought it was all in one thread because the static java method is being called inside the clojure method |
| 20:57 | znDuff | DaReaper5: it's not about the threading, it's about the bindings, and their ability to go out of scope |
| 20:57 | znDuff | DaReaper5: ...again, typically. This is, again, guesswork, because you aren't showing code. |
| 20:57 | DaReaper5 | so i should bind the return of the java method to a variable then provide that variable!!! |
| 20:58 | mpan | I have something created with proxy, extending a base class, and when I try to call a method on it, I get nil: https://www.refheap.com/paste/6691 |
| 20:58 | mpan | I'm expecting an empty vector |
| 20:58 | ivan | spear: startup times are not really a problem if you keep your JVM running |
| 20:58 | znDuff | DaReaper5: ...waitamoment. If _all_ you're returning is that one value, why not just evaluate to that value? |
| 20:59 | DaReaper5 | sorry i still am not lisp/clojure minded |
| 21:00 | DaReaper5 | i was trying to provide the return of the method as a parameter to io/input-stream |
| 21:00 | znDuff | Ahh. |
| 21:00 | znDuff | Sorry -- I misunderstood your question as something more complex |
| 21:01 | DaReaper5 | when (as i understand it). In order for the return value/instance to be used it has to be binded to a variable (let)? Right? |
| 21:01 | DaReaper5 | one second checking |
| 21:01 | znDuff | (io/input-stream (simple.FastReportTest/reTest)) calls the static function, and passes its return value to io/input-stream |
| 21:01 | mpan | if I change the method I'm overriding to return a string, I still get nil: https://www.refheap.com/paste/6692 |
| 21:02 | mpan | have I got the syntax for 'proxy' wrong or something? |
| 21:03 | DaReaper5 | Ugh trying all possible combinations for testing is going to be anoying. https://www.refheap.com/paste/6693 |
| 21:03 | znDuff | DaReaper5: You don't need to do that -- I misunderstood your question. |
| 21:03 | DaReaper5 | Could you tell me what i have to do? Should i specify foo2 as a ByteArrayInputStream? Should i replace io/input-stream with ByteArrayInputStream |
| 21:04 | znDuff | DaReaper5: ...no need for the let there -- it adds nothing. |
| 21:04 | DaReaper5 | ... xnDuff so i could posibly pass the method call assuming that its return will be used as a parameter? |
| 21:04 | spear | ivan, znDuff "My summary is that it spends 95% of the startup-time loading the clojure.core namespace (the clojure.lang.RT class in particular) and filling out all the metadata/docstrings etc for the methods. This process stresses the GC quite a bit, some 130k objects are allocated and 90k free-d during multiple invokes of the GC (3-6 times), the building up of meta data is one big source of this massive object churn." |
| 21:04 | spear | From the article |
| 21:04 | znDuff | DaReaper5: {:body (io/input-stream (simple.FastReportTest/reTest))} is fine. Initially you were using square brackets rather than curly, which is a rather different thing. |
| 21:05 | znDuff | spear: Yes, but that's _startup_ time. |
| 21:05 | znDuff | spear: Who cares about startup time? It's runtime that's important for most applications. |
| 21:05 | znDuff | spear: ...if you're writing something that needs to start up quickly, Java is usually the wrong language too. |
| 21:05 | DaReaper5 | oh sorry about that (was just separating things out in the irc) |
| 21:06 | DaReaper5 | http://stackoverflow.com/questions/13140875/intermittent-error-serving-a-binary-file-with-clojure-ring does the following :body (ByteArrayInputStream. pixel-bytes)})) |
| 21:06 | DaReaper5 | ... however this did not work for me |
| 21:06 | spear | Is regular runtime comparable to Java? |
| 21:07 | znDuff | spear: Clojure isn't exceptionally fast at runtime either for a single thread, but it parallelizes astonishingly well -- I've seen major performance gains via a Clojure rewrite for code running on extremely parallel hardware. |
| 21:07 | mpan | I'm so confused. If I make an proxy for j.l.Object it works fine. If I make a proxy for some strange class with a type parameter T, it gives me nil instead of what my overriding method should be returning. |
| 21:07 | znDuff | spear: ...so -- if you're doing something where you can take advantage of having Clojure's STM available instead of locking, and will be running on lots of cores, Clojure is a good fit. Otherwise, if you're performance-bound, probably not. |
| 21:07 | clojurebot | 'Sea, mhuise. |
| 21:07 | mpan | Is my issue the fact that the class uses generics? |
| 21:08 | toofishes | hi everyone. i'm trying to do something like this (reduced into a standalone one-liner), but the apply isn't working as i hoped. (map apply [#(Integer/parseInt % 16) #(Long/parseLong % 16) #(Short/parseShort % 16)] ["a0" "a0" "a0"]) |
| 21:08 | toofishes | ArityException Wrong number of args (2) passed to: core$eval419$fn clojure.lang.AFn.throwArity (AFn.java:437) |
| 21:08 | DaReaper5 | znDuff, http://grokbase.com/t/gg/clj-noir/1234t3bx3g/noir-hooking-gzip-middleware-in-noir does :body (java.io.ByteArrayInputStream. (.toByteArray out))}) |
| 21:08 | DaReaper5 | but that did not work for me either (because it is practially the same) |
| 21:08 | DaReaper5 | so i come here to see if i am being stupid with syntax |
| 21:09 | spear | Ah I see |
| 21:09 | spear | thanks, znDuff |
| 21:09 | znDuff | DaReaper5: The tiny snippets you give us aren't obviously wrong, but they lack enough context to evaluate. |
| 21:10 | znDuff | DaReaper5: ...I mean, some web frameworks expect the return value to be a dict with a :body key, but you haven't even told us what you're using. |
| 21:10 | DaReaper5 | znDuff ... but i just want to return an input stream :P. Not sure what else i should provide. Shouldn't this be basic for clojure web servers? |
| 21:10 | mattmoss | (doc juxt) |
| 21:10 | clojurebot | "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]" |
| 21:10 | mattmoss | toofishes: Take a look at juxt. |
| 21:11 | DaReaper5 | however, most of the example i fine are returning static files (gah!) |
| 21:11 | DaReaper5 | examples* |
| 21:11 | znDuff | DaReaper5: Build a reproducer that doesn't require your huge dependency chain. You won't be able to get help that isn't guesswork until you can do that. |
| 21:12 | znDuff | DaReaper5: ...it shouldn't be that hard to find a non-file inputstream -- the standard library includes some memory-backed ones, after all. |
| 21:13 | DaReaper5 | could you reference me a non-file inputsream :) |
| 21:13 | znDuff | I search through the Java standard library docs when I need such a thing |
| 21:13 | znDuff | don't keep it all off the top of my head. |
| 21:13 | mpan | oh my gosh, I just did the same thing twice and it worked only the second time |
| 21:13 | DaReaper5 | okie dokie |
| 21:14 | DaReaper5 | true |
| 21:14 | mpan | I'm a bit scared now |
| 21:14 | gfredericks | the javadocs list "Direct Know Subclasses" when you look at inputstream |
| 21:14 | gfredericks | s/Know/Known/ |
| 21:14 | toofishes | mattmoss: i'm not looking at applying each function to each arg, it looks like that is what juxt does? more like [(functionA argA) (funcB argB) (funcC argC)] |
| 21:14 | mpan | my best explanation is that I'm not properly loading my changes into the repl |
| 21:16 | mattmoss | toofishes: Then maybe just... (map (fn [f a] (f a)) [fs...] [as...]) |
| 21:16 | mattmoss | toofishes: The function you map with can have multiple arguments... one arg per collection provided. |
| 21:16 | DaReaper5 | hmm something different and interesting: java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IFn |
| 21:16 | DaReaper5 | new error |
| 21:16 | DaReaper5 | progres!? |
| 21:17 | toofishes | mattmoss: oh, geez. that sounds so easy now. |
| 21:17 | toofishes | thank you! |
| 21:17 | mattmoss | ,(map (fn [f x y] (f x y)) [+ -] [1 2] [3 4]) |
| 21:17 | clojurebot | (4 -2) |
| 21:18 | toofishes | ,(map (fn [f a] (f a)) [#(Integer/parseInt % 16) #(Long/parseLong % 16) #(Short/parseShort % 16)] ["a0" "a0" "a0"]) |
| 21:18 | clojurebot | (160 160 160) |
| 21:18 | mattmoss | wootage |
| 21:19 | mattmoss | ,(map (fn [f a] (let [x (f a)] [x (class x)]) [#(Integer/parseInt % 16) #(Long/parseLong % 16) #(Short/parseShort % 16)] ["a0" "a0" "a0"]) |
| 21:19 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 21:19 | mattmoss | oops |
| 21:19 | mattmoss | ,(map (fn [f a] (let [x (f a)] [x (class x)])) [#(Integer/parseInt % 16) #(Long/parseLong % 16) #(Short/parseShort % 16)] ["a0" "a0" "a0"]) |
| 21:19 | clojurebot | ([160 java.lang.Integer] [160 java.lang.Long] [160 java.lang.Short]) |
| 21:20 | DaReaper5 | ITS ALIVE! IT WORKED |
| 21:20 | DaReaper5 | wow |
| 21:20 | mattmoss | Bwhahaha? |
| 21:20 | DaReaper5 | :body foo2 |
| 21:20 | DaReaper5 | thats it |
| 21:20 | DaReaper5 | no bs needed before it |
| 21:48 | mpan | I introduced a new local dependency, ran lein deps and it succeeded, but I'm still getting a classnotfoundexception at runtime |
| 21:48 | mpan | How should I debug this? |
| 21:49 | mpan | the class is in the jar and the jar is in the place I expect under ~/.m2/repository/ |
| 21:50 | yedi | http://blog.wolfram.com/2012/11/14/code-length-measured-in-14-languages/ |
| 21:51 | yedi | clojure trashes everything except for mathematica |
| 21:55 | mpan | gfredericks: supposedly that's what wolfram alpha is, approximately |
| 21:55 | mpan | the thought of it confuses me as well |
| 21:56 | mpan | ah! second time today! doing the same thing twice yields different results! first incorrect then correct |
| 21:56 | gfredericks | my point is that I think mathematica is rather special-purpose |
| 21:56 | mpan | if only I knew where I was actually differing |
| 21:58 | mpan | gfredericks: I suppose wolfram themselves have a vested interest in the business success of it |
| 21:59 | mpan | I certainly don't imagine myself waking up tomorrow and thinking to myself... hm, I'll write a web-app in mathematica/matlab/etc |
| 22:44 | yedi | i swear the process for getting clojure/swank/lein working with emacs is a mechanism for filtering out idiots from the clojure community |
| 22:45 | brehaut | yedi: nrepl+lein2 is much easier to get going than swank |
| 22:46 | brehaut | see also http://technomancy.us/163 |
| 22:46 | ivan | Emacs itself is the great filter |
| 22:46 | yedi | sweet, thanks |
| 22:47 | brehaut | ivan: hmm. it's a filter alright, but swank is/was an especially weird piece of the puzzle |
| 22:51 | azkane | so is there an advantage in using swank over nrepl? |
| 22:52 | brehaut | you like pain? |
| 22:52 | brehaut | theres some features that swank supports that nrepl doesnt have yet |
| 22:52 | brehaut | emphasis on yet |
| 22:53 | brehaut | from memory i think swank has some better debugging / stepping stuff? |
| 22:53 | brehaut | i never used it though, so i cant say |
| 22:55 | Sgeo__ | Isn't there some ritz thing? I haven't tried it though. I should |
| 23:00 | brehaut | Sgeo__: thats a name i have seen but have no familiarity with |
| 23:05 | amalloy | ritz does indeed have more features than stock swank/slime. IME it was a lot harder to set up, and the payoff wasn't really that big because the bytecode and line numbers the compiler generates confuse the heck out of the debugger |
| 23:12 | Sgeo__ | Is it worth to set up over plain nREPL.el? |
| 23:30 | yedi | whats the best/simplest way to do line by line file processing? |
| 23:37 | hyPiRion | simplest is probably line-seq |
| 23:37 | hyPiRion | ,(doc line-seq) |
| 23:37 | clojurebot | "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader." |
| 23:38 | yedi | cool, ty |
| 23:38 | hyPiRion | just be a bit careful with it though - as it is lazy, you cannot close the buffer before you've actually finished reading all the lines. |
| 23:39 | hyPiRion | you could wrap it in a doall if you know you're going to process all the lines in the file. |
| 23:42 | hiredman | https://gist.github.com/4075459 |