2012-07-04
| 00:00 | technomancy | the lanterna google code page links to https://issues.sonatype.org/browse/OSSRH-3751, which has the snapshots repo |
| 00:00 | technomancy | but they really do need to make it more obvious |
| 00:00 | technomancy | maybe they will once they have a release and aren't working with snapshots? |
| 00:00 | sjl | well I think they have their non-snapshots in Maven central |
| 00:00 | sjl | which I think would just magically work with lein, right? |
| 00:01 | technomancy | it's in :repositories by default, yeah |
| 00:02 | technomancy | lein pprint :repositories # -> {"central" {:url "http://repo1.maven.org/maven2"} "clojars" {:url "https://clojars.org/repo/"}} |
| 00:08 | michaelr` | technomancy: pprint? a plugin? |
| 00:08 | technomancy | michaelr`: yeah, https://clojars.org/lein-pprint |
| 00:08 | technomancy | good for debugging |
| 00:09 | michaelr` | good to know |
| 00:12 | michaelr` | btw technomancy, is there some list/registry of all lein plugins? |
| 00:12 | michaelr` | could be usefull |
| 00:12 | technomancy | there certainly is |
| 00:12 | technomancy | https://github.com/technomancy/leiningen/wiki/Plugins |
| 00:12 | michaelr` | cool thanks |
| 00:13 | technomancy | no problem |
| 00:13 | michaelr` | wow, lots of plugins |
| 00:13 | technomancy | yeah, it's really grown =) |
| 00:27 | zawzey | hmm, does anyone have much experience mixing library versions: http://groups.google.com/group/clojure/browse_thread/thread/abddc241243a01ea/500864190706078b |
| 00:29 | zawzey | so can 2 libraries with different versions exist in the same project? (aside from using lein exclusion) |
| 00:29 | technomancy | zawzey: AFIAK there's no good way to do that cleanly, you have to manually construct isolated classloaders |
| 00:29 | zawzey | technomancy: Yes, any examples of that? |
| 00:30 | technomancy | no, sorry |
| 00:30 | talios | damn you hibernate - you'll make me go even more bald than I am at this rate :( |
| 00:31 | zawzey | technomancy: No problems, it's an long-standing topic, i suppose. http://groups.google.com/group/clojure/browse_thread/thread/182f171afc49473b/297393ed49f4dffe |
| 00:31 | technomancy | zawzey: it's almost always going to be better to just make it work with a single version; doing both is going to be a huge yak shave |
| 00:33 | zawzey | technomany: True that, it's just using external libraries (with conflicting dependencies) can become a problem, guess when the time comes, just have to fork off the original lib |
| 00:33 | technomancy | hopefully the one using the older version will accept patches |
| 00:33 | zawzey | technomancy: Or just have to fork off it, if it's no longer maintained |
| 00:33 | amalloy | you could give polycosm a shot, but i'm not sure how production-ready it is |
| 00:34 | technomancy | oh right; I forgot about that |
| 00:34 | zawzey | amalloy: thanks for the headsup |
| 00:34 | amalloy | i think polycosm needs you to plan your whole application around the split classloaders ahead of time, or nearly so |
| 00:35 | technomancy | yeah, there's no way to make this work seamlessly |
| 00:44 | dnolen | Shambles_: still there? |
| 00:44 | zawzey | thanks guys, guess will need to be aware of this if we need to scale our project |
| 00:50 | amalloy | did you guys know, there's only one user in here whose name starts with Q? but we have six Xs! what is up with that? |
| 00:51 | technomancy | amalloy: it's an eXtreme channel, no surprise there |
| 00:52 | amalloy | x-clojure, for programmers too eXtreme to wait for an officially-blessed MIME-type? |
| 00:53 | hiredman | http://vimeo.com/44968627 this is great, and I want it |
| 00:54 | dnolen | well perhaps Shambles_ is gone, but porting animals.py to a vector of maps was pretty dead simple as I expected. no atoms or zippers - code looks pretty much the same - https://gist.github.com/3045400 |
| 00:54 | dnolen | hiredman: yeah kovasb's prez was awesome. |
| 00:55 | amalloy | summary from anyone so folks know whether to dedicate half an hour to watching a the video? |
| 00:55 | borkdude | gitrepl: a repl in which the states are bound to commit ids… and always the possibility to go back, clone, etc, who wants to implement that? ;-) |
| 00:56 | dnolen | amalloy: it's worth it, thinking about evolving the REPL |
| 00:57 | dnolen | amalloy: one of most compelling reasons for data literals & CLJS IMO |
| 00:57 | technomancy | borkdude: I've wanted transactional require for a loooong time =) |
| 00:57 | hiredman | I was just thinking about this because of all the "python notebook" headlines I've been seeing around |
| 00:59 | dnolen | amalloy: session is basically just scratching the surface of what we could do. |
| 01:01 | hiredman | oh god, he has a checked in .DS_Store |
| 01:03 | arohner | I've been wanting serializable *everything* for a long time. fns, infinite seqs, etc |
| 01:04 | hiredman | *shrug* just serialize the code that generates them |
| 01:06 | borkdude | serializing infinite seqs to disk isn't a problem, as long as your disk is lazy too. |
| 01:07 | borkdude | sorry, I just woke up |
| 01:07 | borkdude | much too early, grrr! |
| 01:08 | sjl | just serialize them to MongoDB, they're probably get garbage collected before an fsync anyway. |
| 01:14 | amalloy | arohner: serializable-fn serializes any function whose lexical environment is serializable |
| 01:15 | arohner | amalloy: I know. but I think there's a lot of cool things that could be made if the whole environment could be serialized |
| 01:16 | amalloy | automatic serialization of any old object is basically impossible, unless all your objects are cons cells |
| 01:18 | arohner | that's a little overstated |
| 01:18 | arohner | strings, ints, clojure data structures are all serializable. I don't see why anonymous fns, refs & atoms & agents can't be |
| 01:19 | amalloy | lambdas can be, as i said with serializable-fn |
| 01:19 | arohner | in a hacky, unsupported way |
| 01:20 | arohner | I'm talking about fully supported |
| 01:22 | amalloy | refs and friends are identities, not values; how will you write them? #clj/ref [id-number current-value]? then you have to somehow keep id-numbers around between calls to the serialization mechanism, or require that your entire program state be serializable from a single root. what do you do about the circular data introduced by refs? |
| 01:22 | amalloy | and that still doesn't cover things like mongodb session handles, or whatever - the whole environment isn't serializable if they aren't |
| 01:23 | amalloy | and what's hacky about using the built-in customizable-serialization hook? |
| 01:24 | amalloy | those problems are probably all soluble (maybe not the mongodb handles), but it's not easy |
| 01:25 | arohner | this is like arguing that C has "good enough" function pointers and OO features. serialization is a thing that isn't fully supported. Yes you can hack, but it unlocks a lot of power when those things just work |
| 01:26 | amalloy | so do what technomancy did. start a serializable-ref library, and use it until it's awesome enough to get into clojure.core |
| 01:26 | technomancy | amalloy: someone did that... alyssa kwan? |
| 01:26 | technomancy | but it was a fork of clojure |
| 01:26 | amalloy | yeah, those persistent refs or whatever she called them? |
| 01:26 | technomancy | and she posted about it and nobody paid any attention =\ |
| 01:27 | amalloy | technomancy: that doesn't sound like the clojure ML! surely someone showed up to tell her we don't want that? |
| 01:27 | technomancy | mwahaha |
| 01:27 | michaelr` | what did you say? i wasn't paying any attention.. |
| 01:44 | cljs_newb_2302 | when calling javascript functions from clojurescript functions, how is the "this" variable set? |
| 01:48 | borkdude | nice video about Session |
| 02:12 | wingy | anyone here knows what the difference between :db/id and :db/ident is in datomic? |
| 02:12 | wingy | eg. {:db/id #db/id[:db.part/user -2] |
| 02:13 | wingy | :db/ident :person.gender/female} |
| 02:13 | wingy | why id and ident at the same time .. since im using the latter as reference why do i need to specify the id |
| 02:26 | john2x | Hello, i'm following the instructions here (https://github.com/quil/quil/wiki/Installing), and have Leiningen installed and `lein deps` is done. But when I try (use 'quil.core') in the repl, I get a FileNotFoundException. |
| 02:27 | wingy | nvm i posted it in the datomic mailing list |
| 02:28 | wingy | and it seems that both are semantically identical, just that when something has a :db/ident you can refer it using the keyword instead of the id |
| 03:12 | LoganLK | every time I run lein run/repl/deps the console gets filled with "could not find artifact org.clojure:clojure:pom:1.+ in *repo name* messages, then it will successfully execute the command (eg run the project). I'm running lein2 preview7 on windows |
| 03:12 | LoganLK | pic of errors http://i.imgur.com/JjuWU.png . any ideas? |
| 03:15 | adu | LoganLK: are you connected to the internet |
| 03:15 | adu | ? |
| 03:15 | LoganLK | adu: yes |
| 03:15 | adu | hmm, i donno |
| 03:15 | talios | Is that saying version 1.+? |
| 03:16 | talios | or am I misreading it? |
| 03:16 | LoganLK | talios: it says 1.+? |
| 03:16 | LoganLK | but as you can see in the project I have specified the version. I have tried "1.3.0", but same thing happens |
| 03:17 | adu | LoganLK: "org.clojure:clojure:pom:1.+ in *repo name* messages" |
| 03:17 | adu | what is your project.clj? |
| 03:17 | LoganLK | adu: http://i.imgur.com/JjuWU.png |
| 03:17 | talios | project.clj was at the top of the image |
| 03:18 | talios | odd - looks like its trying to find org.clojure:clojure:pom:1.+ for some weird reason. |
| 03:18 | talios | I dont use lein so maybe I'm misreading the output tho |
| 03:19 | adu | does that mean there's an object called 1, and it's trying to find it's "+" method? |
| 03:19 | adu | that sounds like a much bigger problem misreported |
| 03:22 | amalloy | i'd guess an issue with one of your lein plugins? ask in #leiningen; it's lower-traffic so shouldn't get lost in the flood of #clojure before being noticed by someone who can help |
| 03:22 | LoganLK | amalloy: no lein plugins :( thanks |
| 05:25 | ro_st | muhoo: i gave you a link to a clojurescript starter template. now i can't find it. do you have the link handy? |
| 05:25 | ro_st | scratch that, just found it |
| 05:40 | wingy | how do i convert this line to one without read-string? @(d/transact conn (read-string "[{:db/id #db/id[:db.part/user -1000001], :item/name \"Item 1\"}]")) |
| 05:40 | wingy | Is there a way to do that even though it's using a reader literal? |
| 05:56 | lewis1711 | TEttinger: you think THIS language is better than scheme? |
| 05:56 | lewis1711 | really? |
| 05:58 | TEttinger | hi lewis1711. yes. |
| 05:59 | clgv | wingy: afaik yes. just write normal clojure and add the reader literal |
| 06:00 | clgv | lewis1711: what's THIS? |
| 06:02 | lewis1711 | lol |
| 06:02 | lewis1711 | clgv: clojure |
| 06:02 | clgv | just wanted to know what language you are talking about ^^ |
| 07:16 | clojure-newcomer | Hi guys, I am trying to simplify the key names on my datomic entity so I can use them with Noir… currently getting 'Can't let qualified name' with keys like ':my entity/name', any ideas ? I thought of using rename-keys but get an AbstractMethodError as I am working with a 'datomic.query.EntityMap' |
| 07:33 | ro_st | argh. so i'm using midje to test my database layer fns. as part of the fns that write data, i timestamp stuff, so i know when created/when updated |
| 07:33 | ro_st | i'm mocking all the data out in my midje test, but i'm not sure how to write my checker to see that some test data that was written is coming back out correctly, because the data coming out has been timestamped |
| 07:37 | ro_st | got it |
| 07:38 | ro_st | holy crap midje is cool |
| 08:26 | ordnungswidrig | does 1.3 use type hints on record fields? |
| 08:28 | clgv | ordnungswidrig: only primitive type hints - 1.2 did so as well |
| 08:29 | ordnungswidrig | clgv: (defrecord Foo [^Integer foo]) macro-expands to a deftype* where no typehints are visible |
| 08:30 | ordnungswidrig | ,(macroexpand-1 '(defrecord Foo [^Integer foo])) |
| 08:30 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 08:30 | clgv | ordnungswidrig: type hints are metadata which is "eaten" by the reader. you have too look at the metadat of the symbol |
| 08:31 | ordnungswidrig | which symbol? Foo is a class, so no metadata is available |
| 08:32 | clgv | no Foo is a symbol in the expanded defrecord macro |
| 08:32 | ordnungswidrig | clgv: there's (deftype* Foo user.Foo [foo __meta __extmap] :implements ...) |
| 08:32 | clgv | if you want to know whether your type hint succeeded you can use a decompiler like JD-GUI |
| 08:33 | ordnungswidrig | clgv: so the compiler uses the type hints extracted by the reader? |
| 08:33 | clgv | ordnungswidrig: yes. and Foo carries metadata which is not printed. |
| 08:33 | ordnungswidrig | clgv: How can I access this metadata, then? |
| 08:33 | clgv | why would you want to do that? |
| 08:34 | ordnungswidrig | I wondered if there is runtime access to the typehints |
| 08:34 | ordnungswidrig | So I suppose this is only possible when doing AOT |
| 08:34 | ro_st | (meta thing) |
| 08:34 | ro_st | (:type (meta thing)) *shoots from the hip* |
| 08:35 | ordnungswidrig | ro_st: *target missed* |
| 08:35 | clgv | no there is no Runtime access if you have the compiled defrecord |
| 08:36 | clgv | you can access it in the expanded macro though |
| 08:36 | ordnungswidrig | clgv: no there is no type hint in the expanded macro |
| 08:38 | clgv | ordnungswidrig: there is! try: (-> '(defrecord Foo [^int a b c]) macroexpand-1 (nth 2) (nth 3) first meta) |
| 08:39 | clgv | took a bit to get the navigation in the expansion done ;) |
| 08:39 | ordnungswidrig | clgv: *doh* |
| 08:40 | clgv | ordnungswidrig: type hints or metadata in general, will never appear in macroexpand. |
| 08:41 | clgv | you could write a specialized print method to show them |
| 08:41 | mystiiq | I am using clj-ssh in my project, i've got this line: (:use [cljaws core helpers] [clj-ssh.ssh]) and it tells me that Could not locate clj_ssh/ssh__init.class or clj_ssh/ssh.clj on classpath: |
| 08:41 | mystiiq | what am I doing wrong |
| 08:42 | mystiiq | in my another project I only got (:use [clj-ssh.ssh]) and it works |
| 08:43 | ordnungswidrig | clgv: I missed that the __meta field actually contains the metadata |
| 08:43 | ordnungswidrig | clgv: or has it attached |
| 08:44 | clgv | ordnungswidrig: no, the __meta field will contain only metadata that was assigned to an instance of your Foo record |
| 08:46 | clgv | ordnungswidrig: try that to see the typehint on the fields (binding [*print-dup* true] (-> '(defrecord Foo [^int a b c]) macroexpand-1 pr-str)) |
| 08:46 | clgv | => "(clojure.core/let [] (deftype* Foo user.Foo [^int a b c __meta __extmap] ..." |
| 08:52 | wingy | clgv: it doesn;t work |
| 08:52 | wingy | tried this one: @(d/transact conn [{:db/id 17592186045796, :item/name \"Item 1\"}) |
| 08:52 | wingy | i mean this one: @(d/transact conn [{:db/id 17592186045796, :item/name \"Galaxy Tab 3\"}]) |
| 08:53 | wingy | damn .. let me make it better |
| 08:53 | clgv | but read-string should not differ much from how a source file is read or the REPL reads |
| 08:54 | clgv | wingy: you should make the test minimal: skip the transaction code |
| 08:55 | wingy | https://gist.github.com/3047203 |
| 08:57 | wingy | but i think the # read literal is used by read-string |
| 08:57 | wingy | it does some magic on it |
| 08:57 | wingy | oh it worked |
| 08:58 | wingy | @(d/transact conn [{:db/id 17592186045796, :item/name "Galaxy Tab 3"}]) |
| 08:58 | wingy | without the back slashes :) |
| 08:58 | wingy | clgv: thx for the test minimal hint :) |
| 08:59 | ro_st | how's the clojure going, wingy |
| 08:59 | ro_st | you killin' it? |
| 09:02 | clgv | wingy: btw in your examples you only use namespace-prefixed-keywords, no reader literals |
| 09:04 | wingy | ro_st: very fun. using it together with datomic |
| 09:04 | wingy | world's best database |
| 09:06 | wingy | clgv: yeah i forgot the # |
| 09:06 | wingy | @(d/transact conn [{:db/id #db/id[:db.part/user -1000001], :item/name "Galaxy Tab 2"}]) ;; gave an error |
| 09:07 | wingy | ill just use the read-string til i get more about how clojure works |
| 09:07 | clgv | thats probably because [:db.part/user -1000001] is wrong |
| 09:08 | wingy | it cant |
| 09:08 | wingy | its just a keyword and a nr |
| 09:08 | wingy | nothing wrong syntatically |
| 09:09 | wingy | what i get is a clojure error: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> |
| 09:09 | clgv | and the function handling #db/id expects a vector of those two things? |
| 09:09 | wingy | oh yeah |
| 09:09 | wingy | must be it |
| 09:10 | wingy | reader literal was used to make it more convenient |
| 09:10 | wingy | ill just use the read-string for now |
| 09:11 | wingy | cant find my ways around clojure 100% yet |
| 09:11 | clgv | did you read any of the books? |
| 09:21 | wingy | clgv: im still in Clojure Programming |
| 09:21 | wingy | didn't read all of it though since I realized i have to play with clojure a little to get familiar with the basics first before i jump into macros, records etc |
| 09:22 | wingy | have to apply an iterative style even on learning .. that's the best method i think |
| 09:25 | ro_st | wingy, found the clojure koans yet? |
| 09:27 | wingy | ro_st: what does koans mean? |
| 09:28 | ro_st | https://github.com/functional-koans/clojure-koans/ |
| 09:31 | clgv | why not 4clojure.com ? |
| 09:33 | wingy | wow didnt know about all these starter kits |
| 09:33 | wingy | ill do the koan first |
| 09:37 | ro_st | why not both? :-) |
| 09:37 | ro_st | there's labrepl too |
| 09:37 | ro_st | what's nice about clojure-koans is you do it in your editor of choice |
| 09:37 | ro_st | nice for getting comfy with emacs |
| 09:37 | clgv | wingy: 4clojure only helps a bit when you start with the Elementary problems. it's more to test your clojure skills^^ |
| 09:38 | clgv | you should do the more difficult problems of 4clojure in your own IDE as well ;) |
| 09:41 | wingy | so cool .. clojure-koans autodetects changes :) |
| 09:43 | wingy | already learned my first lesson |
| 09:43 | wingy | (1 1 1) works :) |
| 09:43 | clgv | &(1 1 1) |
| 09:43 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 09:44 | wingy | is i mean (= 1 1 1) :) |
| 09:44 | wingy | btw .. (= 2 2/1 2) .. how come that 1/2 works .. is it syntatic sugar over prefix mode? |
| 09:45 | Vinzent | wingy, no, it's ratios. Cool, yeah? |
| 09:45 | wingy | oh right forgot that |
| 09:45 | wingy | yeah clojure (lisp) is so cool! |
| 09:46 | wingy | it beats other langs by light years |
| 09:46 | wingy | i will never go back..ever! |
| 09:47 | Vinzent | ;) |
| 09:47 | wingy | i rather die |
| 09:47 | wingy | yes |
| 09:49 | tbaldridge | wingy: http://xkcd.com/224/ |
| 09:51 | wingy | :) |
| 09:51 | clgv | wingy: http://xkcd.com/297/ |
| 09:51 | wingy | i think i would like clojure more though |
| 09:52 | wingy | haha |
| 09:52 | wingy | () power |
| 09:54 | wingy | not= is the same as != it seems |
| 09:55 | wingy | is there a reason not to use != instead? or is it just a matter of taste? |
| 09:55 | wingy | i mean != in other langs |
| 09:57 | clgv | wingy: well there is also: not, when-not, if-not ... |
| 10:10 | wingy | clojure koans was really fun |
| 10:11 | wingy | more fun than reading a lot without doing code |
| 10:11 | wingy | even though i try to play with it in repl |
| 10:13 | wingy | i cant wait for light table to come out and help us with the live doc .. too many functions to remember and having to look all up (arity, desc, examples) is taking a lot of efforts |
| 10:19 | wingy | apparently you can use (first []) on a vector |
| 10:20 | Scriptor | wingy: as in (first [1 2 3]) |
| 10:20 | mybuddymichael | ,(first [3 4 7]) |
| 10:20 | clojurebot | 3 |
| 10:20 | Scriptor | that's because first calls seq on its argument(s) |
| 10:21 | Scriptor | er, make that just one argument |
| 10:21 | Scriptor | so it converts the vector into a seq, and then gets the result of calling its first() method |
| 10:22 | Scriptor | wingy: note this line https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L567 |
| 10:23 | wingy | Scriptor: but how do i know this without looking at source |
| 10:23 | wingy | first only works on sequences |
| 10:23 | wingy | and vector is not a sequence |
| 10:24 | wingy | the doc doesn't clarify this |
| 10:24 | wingy | how do you know what functions work on what structures |
| 10:24 | Scriptor | wingy: had a discussion on this a few days ago! Basically first works on *seqables*, not just seqs |
| 10:25 | Scriptor | and vector is a seqable, because it supports the creation of a seq from the vector |
| 10:25 | dnolen | wingy: it does, it says it calls seq on it's argument. |
| 10:25 | metellus | ,(doc seq) |
| 10:25 | clojurebot | "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable." |
| 10:25 | metellus | sorry |
| 10:25 | metellus | ,(doc first) |
| 10:25 | clojurebot | "([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil." |
| 10:25 | metellus | a vec is a collection |
| 10:25 | metellus | so first should work |
| 10:28 | metellus | wingy: for the most part, clojure functions will work as you expect them to. Vectors have first elements, so it makes sense that first works on them. There may be minor differences in how things work when they are ambiguous (like conj), but you can find them out quickly in a repl |
| 10:30 | wingy | ok so the "sequences" to the left means "seqables" as well http://clojuredocs.org/quickref/shortdesc/Clojure%20Core |
| 10:30 | clgv | wingy: well for questions like that you should progress in your book ;) |
| 10:31 | Scriptor | wingy: that section is for both collections *and* sequences |
| 10:31 | Scriptor | so a hashmap is a collection, but not a sequence |
| 10:31 | wingy | there was a link i forgot to save .. where they listed tables for differences between sequences and collections |
| 10:31 | dnolen | wingy: all the clojure collections are seqable. |
| 10:33 | wingy | Scriptor: yeah but _first_ was found below Sequences section |
| 10:33 | clgv | wingy: I would continue reading the book, saves you time ;) |
| 10:33 | wingy | the first function is _seq_ .. that means it returns seqable and not a sequence? |
| 10:34 | wingy | clgv: yeah i will .. after the koans :) |
| 10:34 | wingy | but if it returns seqable then why not call that section Seqable and not Sequence |
| 10:34 | wingy | its ambiguous |
| 10:35 | clgv | first returns the element at position 0 or nil |
| 10:35 | wingy | clgv: i mean the first function below that section is seq :) |
| 10:36 | wingy | i think the confusion comes in when the doc is not very clear about what is for seqable (collections) and what is for sequence (list) |
| 10:37 | metellus | is there anything that isn't for both? |
| 10:37 | tbaldridge | wingy: there's a difference between seqable and seq |
| 10:38 | tbaldridge | seqable means it can be turned into a seq |
| 10:38 | tbaldridge | so a list is both seqable and seq (in this case calling seq on a list is a no-op because it is a seq) |
| 10:39 | tbaldridge | a vector is seqable as calling (seq [1 2 3]) returns an entirely different type of object. |
| 10:39 | tbaldridge | but a vector is not a seq |
| 10:40 | tbaldridge | I don't know if this helps at all, but these map to Java interfaces: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Seqable.java |
| 10:40 | metellus | he knows all that; his issue is that the docs don't really explicitly say "things will work for seqables even if they say that they work for seqs" |
| 10:40 | tbaldridge | yeah that is a bit confusing. |
| 10:41 | clgv | humm not really. |
| 10:41 | wingy | ok ill just assume that everything just works for collections (seqables) .. since they will be converted into sequences |
| 10:42 | metellus | wingy: as far as I know, that will work. If you do encounter something weird, try out some examples in a repl to see what's going on |
| 10:42 | wingy | but honestly i don't enjoy confusions like these where it takes so much time to figure things out .. "Dont make me think" is a really good book explaining why you don't want unnecessary overhead for users |
| 10:43 | clgv | wingy: you could have read it in your book. you won't fin general global-scope explanations in docstrings ;) |
| 10:43 | mystiiq | how can I iterate over a map and define variables with given key and set value of that corresponding key |
| 10:44 | wingy | if there is someone here with authority/knowledge to change docs i hope these things could be cleared out to make the looking up process more enjoyable |
| 10:44 | metellus | to be fair, http://clojure.org/data_structures#Data Structures-Collections does say "Because collections support the seq function, all of the sequence functions can be used with any collection." |
| 10:44 | clgv | mystiiq: give an example |
| 10:46 | mystiiq | I read a file into a map containing config parameters and then I want to define them as a system-wire variables |
| 10:46 | clgv | mystiiq: oh. then you have to create the def statements and eval them |
| 10:47 | clgv | mystiiq: but that approach does not sound idiomatic... |
| 10:49 | wingy | metellus: yeah more fair |
| 10:49 | wingy | ill read them through |
| 10:50 | wingy | and thx for all explanations the 2nd time now :) |
| 10:50 | wingy | i think its solid with the diff :) |
| 11:05 | tbaldridge | clgv: why is that not idiomatic? |
| 11:06 | clgv | tbaldridge: global defs for config created at runtime sounds pretty wrong. there would be the option to set up something with thread local binding or such |
| 11:07 | tbaldridge | clgv: yeah, I can see that |
| 11:08 | clgv | tbaldridge: most of the time when you use eval in a function, there is a good chance you are doing it wrong, as well |
| 11:08 | tbaldridge | clvg: it depends though, if it's a config for a website, global defs would probably be preferable |
| 11:10 | tbaldridge | so yeah, the eval version sounds bad, but what about putting defs in a seperate namespace, then reading the config file and runtime and using set! to init all the configs |
| 11:10 | clgv | tbaldridge: well thread-local bindings are propagated since 1.3 |
| 11:10 | tbaldridge | no eval, but yet global defs (for stuff like db servers) |
| 11:10 | clgv | tbaldridge: and why not using thread-local bindings? |
| 11:11 | clgv | you read the config before you do anything website related, I guess |
| 11:12 | tbaldridge | the problem with using the bindings is that I then have to wrap my entire app in a (binding []) |
| 11:13 | tbaldridge | but I'll admit can see allot of benefit to your method. |
| 11:14 | clgv | tbaldridge: well you have a single point of entry anyway, when you launch jetty&co |
| 11:15 | clgv | tbaldridge: and you could even easily overwrite config params for user-specific settings |
| 11:18 | tbaldridge | clgv, yeah, I hadn't thought of it that way. If they are propagated to sub-threads then yeah, it sounds like it would work fine. Cool I learned something today. |
| 11:18 | clgv | =) |
| 11:19 | wingy | doing clojure koans is like doing sudoku |
| 11:19 | mmarczyk | dnolen: good catch on 330, thanks! |
| 11:19 | borkdude | then sudoku must be a very nice game |
| 11:19 | wingy | someone release a clojure sudoku app for android/iphone |
| 11:19 | wingy | so i can do it on the bus |
| 11:20 | borkdude | wingy this is your next assignment |
| 11:20 | wingy | no .. i pay! |
| 11:20 | clgv | p(l)ay? |
| 11:20 | clojurebot | clojure is the brand |
| 11:20 | wingy | and pay |
| 11:20 | borkdude | 4clojure app |
| 11:21 | borkdude | could be nice project |
| 11:21 | clgv | lol I would not want to program anything on a smartphone ;) |
| 11:21 | borkdude | but I don't have a smart phone either ;-) |
| 11:21 | wingy | but since it's cumbersome to type things in an iphone it would be better with alternatives as answers |
| 11:21 | borkdude | wingy I have a Nokia E71 for that |
| 11:21 | mmarczyk | dnolen: btw, could you look into cljs-319 in a free moment? bbloom's patch worked for me perfectly last time I checked and the issue is so annoying :-P |
| 11:22 | borkdude | wingy well I guess that is a smart phone, but symbian is dead |
| 11:22 | borkdude | wingy at least is has a keyboard |
| 11:24 | wingy | fill in: (= (+ __ 1) 23) 1) 23 2) 31 3) 22 .. and you press a nr |
| 11:24 | wingy | no need to type |
| 11:24 | borkdude | wingy or make the game: drag the expression in the right order ;) |
| 11:24 | wingy | borkdude: yeah but your are on the bus .. and wanna learn with no typing efforts |
| 11:25 | wingy | yeah |
| 11:25 | wingy | all kind of stuff |
| 11:25 | wingy | come on .. some clojure guru who needs some time to kill |
| 11:25 | wingy | i think people would buy the app |
| 11:25 | wingy | subscription based! |
| 11:25 | borkdude | wingy just buy a macbook air or smth, so much easier |
| 11:26 | wingy | if you release new levels each month i could pay like 2 dollars each month |
| 11:26 | wingy | borkdude: but its no fun reading books all day long |
| 11:26 | wingy | you wanna play and learn just like clojure koans |
| 11:26 | borkdude | wingy that you can do on a macbook air? |
| 11:27 | borkdude | wingy with a full fledged REPL and no limitations |
| 11:27 | wingy | i have a macbook pro .. but i feel it would be more fun to do it on the go |
| 11:27 | wingy | new kind of learning |
| 11:27 | borkdude | wingy yes, on the go… I do clojure while commuting sometimes |
| 11:27 | wingy | for php, ruby and other langs as well .. this is business! |
| 11:27 | wingy | i know it will be big |
| 11:28 | wingy | borkdude: haha |
| 11:28 | wingy | look at sudoku |
| 11:28 | wingy | try to release one .. you will get millions |
| 11:28 | wingy | im never wrong |
| 11:28 | borkdude | wingy what would you do with all those millions, life would get very boring? ;P |
| 11:29 | wingy | so many people who wants to know programming but not thorugh reading books |
| 11:29 | wingy | and they don't wanna spend efforts in repl typing/testing everything themselves |
| 11:29 | wingy | borkdude: i would make more apps |
| 11:29 | wingy | and get billions! |
| 11:30 | dnolen | mmarczyk: I suspected something deeper was going on w/ 330 |
| 11:30 | dnolen | mmarczyk: I don't like the double doseq calls in 319, worth investigating removing those. |
| 11:30 | wingy | then climb up to the top of a mountain screaming .. BILL!!!!!!!!!!!!!! |
| 11:31 | mmarczyk | dnolen: re: 330, yeah, I think your commit nails it |
| 11:32 | mmarczyk | dnolen: alternatively we could extend to "null" and "undefined" avoiding the nil? check |
| 11:32 | mmarczyk | dnolen: probably not worth the trouble though? |
| 11:34 | mmarczyk | dnolen: re: 319, ok, that's worth a try |
| 11:40 | dnolen | mmarczyk: I think the nil? check is sufficiently cheap. I think handling undefined at all is not worth it. |
| 11:41 | technomancy | man, I wish the clojure reader would treat nonbreaking spaces correctly =\ |
| 11:47 | pepijndevos | Is there anything that prevents one from writing a multithreaded asynchronous server? |
| 11:49 | dnolen | pepijndevos: like Netty? |
| 11:49 | pepijndevos | dnolen, I don't know. Like netty? I just noticed that all these tthings like node, libev, twisted ed are all singlethreaded. |
| 11:50 | dnolen | pepijndevos: look at Netty. |
| 11:50 | pepijndevos | cool, thanks |
| 11:50 | dnolen | pepijndevos: Aleph is built on top of it. |
| 11:51 | pepijndevos | yea, aleph rocks |
| 11:53 | wingy | how do i make an anonymous fn return 1 |
| 11:53 | wingy | when it's run |
| 11:53 | wingy | (#('1)) ;; yields error |
| 11:54 | rkz | wingy: ' isn't a quote, it's a special form |
| 11:57 | wingy | rkz: it's a quote in '(1 2 3) ? |
| 11:59 | dnolen | wingy: you can't do that with fn literals, regardless of quote, the body of the fn literal is an expression, so you're invoking (quote 1) as a function. |
| 11:59 | rkz | wingy: that says evaluate the form without using 1 as a fuction call and 2 3 as args |
| 11:59 | Iceland_word | wingy: maybe check out http://clojuredocs.org/clojure_core/clojure.core/constantly ? |
| 12:00 | dnolen | ,((fn [] 1)) |
| 12:00 | clojurebot | 1 |
| 12:00 | dnolen | ,(#(do 1)) |
| 12:00 | clojurebot | 1 |
| 12:00 | metellus | ,(#(1)) |
| 12:00 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 12:01 | rkz | ,(#(identity 1)) |
| 12:01 | clojurebot | 1 |
| 12:02 | wingy | cool solutions |
| 12:17 | gfredericks | ,((constantly 1)) |
| 12:17 | clojurebot | 1 |
| 13:17 | cmcbride | if I have a vector of maps, and I want to update a specific key in each map, whats the best way to do that? |
| 13:18 | borkdude | (mapv (fn [m] (assoc m k new)) vec-of-maps) ;; something like this? |
| 13:19 | cmcbride | yes, I forgot about mapv. Thanks |
| 13:30 | sirsublime | sup peepz |
| 13:30 | sirsublime | List comprehension question coming up |
| 13:30 | sirsublime | Say I have some seq and I know it's sorted. |
| 13:31 | sirsublime | And I want to do list comprehension on it, but with n values, instead of one. |
| 13:31 | sirsublime | So, if I have a vector [1, 2, 3, 4], then I could itterate by [1,2] and [3,4]. |
| 13:32 | sirsublime | I don't think plain vanilla (for ..) does it. |
| 13:32 | sirsublime | Any tips? |
| 13:32 | cockadoodledoo | maybe partition? |
| 13:32 | cockadoodledoo | http://clojuredocs.org/clojure_core/clojure.core/partition |
| 13:33 | sirsublime | (for [[x y] (partition 2 foo-list))? |
| 13:33 | sirsublime | I love you coc... Almost fell for that one. |
| 13:34 | cockadoodledoo | (partition 2 [ 1 2 3 4]) |
| 13:34 | sirsublime | This is awesome. Thanks! |
| 13:34 | cockadoodledoo | np |
| 14:06 | TimMc | sirsublime: Also see partition-all, for future reference. |
| 14:21 | sirsublime | TimMc: Thanks! |
| 15:06 | lynaghk | dnolen: I'm playing with core.logic and the Zebra puzzle, and things take very long if I move the unify statement (milk is drunk in the middle house) past one or two membero statements. Is this because the unify nails down a lot of the free variables early on in the search or something? |
| 15:06 | lynaghk | dnolen: do you find you have to rearrange ordering like this to get your logic programs to complete? |
| 15:18 | pendlepants | if I have a nested map like {:recent-tracks {:track {:artist {:text "name"} :name "song name"}}}, is there a better way to get nested values than (:text (:artist (:track (:recenttracks var))))? |
| 15:19 | dnolen | pendlepants: get-in |
| 15:19 | dnolen | (get-in x [:recent-tracks :track :artist :text]) |
| 15:19 | pendlepants | that's perfect; thanks dnolen. |
| 15:40 | augustl | how do I add unpublished dependencies to a leiningen project? My project consists of a bunch of modules, and some of them depend on some of the others. These modules won't be published on clojars though |
| 15:40 | augustl | set up my own maven repo perhaps? |
| 15:42 | augustl | if so, any suggestion for reading material for a person that has no prior experience on the Java platform? :) |
| 15:43 | xeqi | augustl: are they just being used on one machine? |
| 15:43 | augustl | xeqi: well, I don't mind building and deploying uberwars, it's ok if you have to somehow link stuff in by hand locally or whatever |
| 15:45 | TimMc | ~repeatability |
| 15:45 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 15:46 | augustl | TimMc: aww, so I have to set up a repo then |
| 15:46 | augustl | let's hope that won't take too many days of my time :P |
| 15:46 | augustl | ooh, private s3 buckets |
| 15:49 | Jayunit100_ | man there is no irc for regular old java . just realized that. |
| 15:51 | yonatane | not many one liners |
| 15:56 | Shambles_ | dnolen: I saw the code you posted yesterday. Thanks for doing that. I wasn't expecting it. |
| 15:57 | TimMc | Jayunit100_: ##java, but you won't be happy |
| 15:57 | dnolen | Shambles_: no problem - as I suspected using a vector allowed pretty much a direct translation |
| 15:57 | dnolen | Shambles_: no atom, no zippers etc. |
| 15:57 | ssutch | when using java interop, what is the best way to run a method against an instance in let, eg: http://www.exampledepot.com/egs/java.security/GenKeyPair.html |
| 15:58 | ssutch | i want to run keyGen.initialize(1024) (. keyGen initialize 1024) before using it |
| 15:58 | ssutch | would i just run that as an expr in the body of the let |
| 15:58 | TimMc | Not sure what 'let has to do with it. |
| 15:58 | TimMc | (.initialize keyGen 1024) |
| 15:59 | TimMc | ssutch: Or even better, use doto |
| 15:59 | ssutch | TimMc it probably doesn't, this is only my 2nd day with clojure, so looking for best practices |
| 15:59 | ssutch | doto, interesting, i am not familiar, i'll look it up |
| 16:00 | TimMc | (doto (KeyPairGenerator/getInstance "DSA") (.initialize 1024)) |
| 16:00 | ssutch | aha! |
| 16:00 | ssutch | i knew there would bea more succinct way to express that |
| 16:00 | dnolen | Shambles_: also hopefully you can see that the functional data structure support is quite good. only 2 lines that deals with managing indexes. |
| 16:01 | TimMc | ssutch: It's a good macro to use if you want to call a contructor (or similar), hammer on the object, then return it. |
| 16:01 | ssutch | that's rad, thanks TimMc |
| 16:02 | ssutch | is it sane to put that in the bindings of a let in the body of a defn? |
| 16:02 | TimMc | Sure! |
| 16:02 | ssutch | (let [keygen (doto (KeyPairGenerator/getInstance "DSA") (.initialize 1024))] ...) |
| 16:02 | TimMc | You'll also see people use it to temporarily sneak in debugging statements: ##(+ 3 (doto (* 5 6) (println))), but that's just a hack. |
| 16:02 | lazybot | ⇒ 30 33 |
| 16:03 | Shambles_ | dnolen: I had no problem believing Clojure (being a functional language) would be good at working with data structures in a functional way. Mutation, or working around using it, is another matter. I probably have a long way to go to get my head around that. I admit to not understanding your code, but I'll stare at it and look at documentation until it sinks in. |
| 16:03 | Shambles_ | dnolen: It's not like the original code was the cleanest written thing anyway. |
| 16:03 | dnolen | Shambles_: working mutation is just familiarity. It's easy to get frustrated if you can't rely on old habits. |
| 16:04 | dnolen | using mutation is just famliarity I mean. |
| 16:04 | dnolen | Shambles_: the code is a direct translation of animal.py - I didn't stray very far. |
| 16:06 | Shambles_ | dnolen: The parts that are giving me trouble are the various -in operations and juxt and the like. Basically the different data structure. |
| 16:06 | Shambles_ | dnolen: But I should be able to figure it out if I read the documentation and think about it long enough. |
| 16:07 | TimMc | <3 update-in |
| 16:07 | dnolen | Shambles_: yes, it just a vector of nodes, knowledge always starts at index 0. |
| 16:07 | dnolen | Shambles_: juxt is sweet |
| 16:07 | dnolen | ,((juxt inc dec) 1) |
| 16:07 | clojurebot | [2 0] |
| 16:07 | TimMc | &((juxt filter remove) odd? (range 10)) |
| 16:07 | lazybot | ⇒ [(1 3 5 7 9) (0 2 4 6 8)] |
| 16:07 | Shambles_ | dnolen: Not that this ever happens in this program, but I wonder how tolerant it would be of having nodes removed, since I think that'd mess the indexing up. |
| 16:08 | dnolen | Shambles_: functional thinking requires patience, but Clojure delivers a lot of tools so that you can keep code as brief as mutable versions nearly every time. |
| 16:08 | dnolen | Shambles_: it's a toy, expect a toy solution. |
| 16:13 | dnolen | Shambles_: even so, removing nodes doesn't pose any real challenges |
| 16:20 | wilfredh | I would like to define a macro that has the same semantics as defn, but builds a list of all the functions that have been defined with it. Should I use a var, or something else? |
| 16:22 | wilfredh | I'm not quite sure how to set a variable at compile time such that I can access it at run time. |
| 16:30 | ohpauleez | wilfredh: Your macro can compile down to defns, which is common for macros creating DSLs |
| 16:32 | ohpauleez | wilfredh: https://github.com/ibdknox/noir/blob/master/src/noir/core.clj#L80 |
| 16:32 | bpr | wilfredh: i would put that macro in its own namespace. Also, in that namespace would be the var with the list(s) as its value. Then define a function in the namespace that can be called at runtime to access the lists. |
| 16:32 | ohpauleez | But as a rule of thumb, you should prefer to use functions over macros whenever possible |
| 16:33 | ohpauleez | a good solution here would be to use a decorator |
| 16:33 | bpr | wilfredh: so the macro updates the var, and the var can be read using the function. |
| 16:33 | ohpauleez | and decorate the functions outside of a defn, onto another def |
| 16:34 | ohpauleez | wilfredh: but here is an example of exactly what you're talking about |
| 16:34 | ohpauleez | https://github.com/shoreleave/shoreleave-remote-noir/blob/master/src/noir/shoreleave/rpc.clj |
| 16:35 | bpr | ohpauleez: unless i'm wrong i think this requires a macro. You'd have to walk the source of the function to see what functions it calls |
| 16:35 | ohpauleez | with a macro |
| 16:35 | ohpauleez | bpr: No a decorator is appropriate, but it involves double def'ing |
| 16:35 | ohpauleez | or adding metadata |
| 16:35 | ohpauleez | which is probably the best idea |
| 16:35 | ohpauleez | since you can define it with defn anyway |
| 16:36 | bpr | i agree with the metadata |
| 16:36 | ohpauleez | wilfredh: Can you use metadata, then just define one predicate function? |
| 16:36 | bpr | but how do you, check which functions are being called? |
| 16:37 | hiredman | cemerick: why is drawbridge so temperamental? I can usual send a single request via curl, where I get a response, after which I always get an empty response |
| 16:38 | ohpauleez | bpr: just use another function (higher-order) that takes a fn, and any args, and has a pre conditional constraint on approved-fn? |
| 16:39 | ohpauleez | where the function `approved-fn?` checks the metadata of a function |
| 16:39 | bpr | i don't think he wants to write the meta-data by hand |
| 16:39 | ohpauleez | and inside the function described above, you just do an `(apply …)` |
| 16:39 | ohpauleez | bpr: Right, so he can use a decorator, and double def |
| 16:40 | ohpauleez | or he can write a macro |
| 16:40 | ohpauleez | or if it's just a few, I'd write it by hand |
| 16:41 | bpr | if i understand what he wants correctly he wants to write: (def-annotated-fn foo [] (bar (baz))) and have a list defined somewhere that says (somehow) that foo calls bar and baz |
| 16:42 | ohpauleez | oh, I thought he just wanted whitelisting |
| 16:42 | ohpauleez | I didn't know he wanted tracing |
| 16:42 | ohpauleez | Clojure already has tracing capabilities |
| 16:42 | bpr | i coulda read it wrong |
| 16:43 | gf3 | How do you guys go about playing with misc. libraries from the command line repl? |
| 16:43 | gf3 | As part of no specific project? |
| 16:45 | bpr | i did read it wrong lol: he wants (def-annotated-fn bar [] ...) that would then create a list saying bar is called by foo... |
| 16:45 | bpr | but w/e |
| 16:46 | ohpauleez | gf3: You can use lein-exec or just spin up a quick one off project |
| 16:46 | ohpauleez | https://github.com/kumarshantanu/lein-exec |
| 16:46 | bpr | it still seems to need to consider the source directly |
| 16:47 | gf3 | ohpauleez: That's great, thank you |
| 16:47 | ohpauleez | gf3: Totally welcome |
| 16:48 | bagelz | why can't I do this in clojure on my phone: (for [x 1 y 1] [x y]) |
| 16:52 | ohpauleez | bagelz: (for [x [1] y [1]] [x y]) |
| 16:52 | ohpauleez | for is a list comprehension |
| 16:52 | ohpauleez | not an iteration, really |
| 16:53 | ohpauleez | perhaps you meant (let [x 1, y 1] [x y]) |
| 17:06 | bagelz | I actually meant (for [x 1 y 1] [x y]) |
| 17:06 | bagelz | it gives a stack overflow |
| 17:06 | bagelz | do I only have 16MB in my dalvik vm? |
| 17:09 | ohpauleez | bagelz: That's an incorrect `for` |
| 17:09 | ssutch | if i want to do something like Security.addProvider(new BouncyCastleProvider()); which is a static thing that should be called only once, do i do it in the (ns ) body? |
| 17:10 | ohpauleez | see my example above |
| 17:10 | ohpauleez | ssutch: No you do it in the file like you normally would call it |
| 17:11 | ssutch | so just amongst my defns and whatnot |
| 17:11 | ohpauleez | correct |
| 17:11 | ssutch | cool, thanks |
| 17:11 | ohpauleez | np |
| 17:13 | ssutch | sweet! |
| 17:13 | ssutch | my first clojure function that does something! |
| 17:16 | augustl | those are the best functions |
| 17:17 | y3di | do/have you guys used state machines to control your applications' flow? |
| 17:18 | ohpauleez | y3di: Yes when the app can be expressed nicely as a state machine |
| 17:19 | ohpauleez | There are a few libs (for Clojure and for CLJS), but I've never used them, just used maps and keywords for my limited use cases |
| 17:19 | y3di | ohpauleez, can you reccommend some learning materials about state machines? |
| 17:22 | ohpauleez | y3di: I don't any off the top my head - I could dig through some CS, AI or my SE books |
| 17:22 | ohpauleez | but google turns up this video: http://video.google.com/videoplay?docid=-5837841629284334824 |
| 17:23 | y3di | I learned about them a year ago in class, but theoretical cs seemed so far removed from real world coding that i didn't pay much attention to it |
| 17:23 | ohpauleez | The wikipedia page actually has some helpful links and references |
| 17:24 | ppppaul | y3di pinot does (clojurescript framework) |
| 17:24 | ohpauleez | ppppaul: that's been pulled out into its own library |
| 17:24 | ppppaul | iknow |
| 17:24 | ppppaul | but i don't know the name of the lib |
| 17:25 | y3di | ppppaul, didn't you used to hang out in #documentcloud all the time? |
| 17:25 | ppppaul | i still do |
| 17:26 | ppppaul | also hang out in couchdb and tell the devs to fix all the bugs i find |
| 17:26 | ppppaul | sate machines are really useful for web apps |
| 17:26 | ohpauleez | y3di: If you have a problem that can be expressed in a series of stable states with events that map to clean transitions between those states, and FSM lib could help |
| 17:26 | ppppaul | i do some state machine hacky crap with backbone |
| 17:27 | y3di | ppppaul, you should write a blogpost on your methodology |
| 17:27 | ohpauleez | I find that I model most of my systems off of event buses (like a C2 architecture) and less off of an FSM |
| 17:27 | ohpauleez | but I model my Cucumber tests using FSMs |
| 17:27 | ppppaul | i do it in JS, so my methodology is discipline :( |
| 17:27 | y3di | event buses, never heard of that one before |
| 17:28 | ppppaul | i use event buses |
| 17:28 | ohpauleez | y3di: pub/sub stuff, same thing |
| 17:28 | y3di | oh ok |
| 17:28 | ppppaul | global/tiered event stuff |
| 17:28 | ppppaul | clojure has a event thing in it modelled off of mailboxes |
| 17:28 | ppppaul | it seems very cool |
| 17:28 | ppppaul | i forgot the name :( |
| 17:28 | ohpauleez | because an FSM is tightly coupled, and not open for extension, whereas C2 avoids those tradeoffs |
| 17:30 | ppppaul | i find it tricky to model events, i try to make as loosly coupled components as possible |
| 17:31 | ppppaul | i put everything in the event bus and hope i don't have typos or conflicts >_< |
| 17:34 | amalloy | $mail dnolen i tried binding a dynamic variable to a fresh logic variable, to make it easily accessible throughout my program (we discussed this and decided it probably ought to work). but from https://gist.github.com/3049645 it looks like that binding just creates a snapshot of the logic variable, which can't be unified with anything anymore |
| 17:34 | lazybot | Message saved. |
| 17:38 | Jayunit100_ | i learned those dynamic var thingies from this https://github.com/alexott/clojure-hadoop :) its pretty cool . he sets the job context for hadoop as a dynamic global so that macros that call map/reduce functions set it beforehand. |
| 17:40 | augustl | so, just wrote this http://pastie.org/4201008 Any reusable existing module for that? |
| 17:40 | augustl | that = a ring middleware for parsing JSON on incoming requests and making sure the response is always JSON |
| 17:41 | weavejester | augustl: I have a ring-json-response and Mark has a ring-json-params. I'm planning on combining them into a ring-json library soon, but they can be used separately. |
| 17:41 | augustl | weavejester: ah cool, looking them up, thanks |
| 17:42 | amalloy | noir has wrap-json in there somewhere; probably every webapp uses one of those or writes its own |
| 17:42 | amalloy | (i'm sure it's part of lib-noir now, so you don't need the whole noir thing) |
| 17:46 | augustl | thanks folks :) |
| 17:50 | augustl | want to use https://github.com/technomancy/s3-wagon-private, are there any docs anywhere for how to actually publish projects to an s3 bucket? |
| 17:51 | brehaut | i dont think i have seen that |
| 17:51 | brehaut | whoops wrong window sorry |
| 17:59 | augustl | well that was easy, "lein deploy" |
| 17:59 | brehaut | i blame a caffeine deficiency |
| 18:01 | augustl | hmm it seems I need to have _all_ dependencies on s3 when I use that plugin |
| 18:03 | mybuddymichael | Why are Java String methods imported automatically by the REPL, and how can I see what other Java classes are automatically imported? |
| 18:06 | mybuddymichael | Anyone want to take a stab? |
| 18:06 | talios | they are? |
| 18:07 | mybuddymichael | At least with `leon repl`, yes. |
| 18:07 | mybuddymichael | lein* |
| 18:07 | mybuddymichael | ,(.toUpperCase "michael") |
| 18:07 | clojurebot | "MICHAEL" |
| 18:07 | mybuddymichael | And here too, apparently. |
| 18:07 | brehaut | mybuddymichael: those are sugar over the . special form; the methods themseves are not imported into the NS |
| 18:08 | talios | what brehaut said :) |
| 18:08 | talios | he types faster |
| 18:08 | mybuddymichael | ,(doc .) |
| 18:08 | clojurebot | It's greek to me. |
| 18:08 | mybuddymichael | Hah. |
| 18:08 | brehaut | you'll probably have to look at clojure.org |
| 18:09 | mybuddymichael | Yep, because that doesn't make too much sense to me. |
| 18:09 | brehaut | http://clojure.org/java_interop#dot |
| 18:09 | mybuddymichael | Thanks, guys. |
| 18:09 | augustl | are there any tutorials around for s3-wagon-private? |
| 18:09 | mybuddymichael | Oh, awesome. |
| 18:09 | mybuddymichael | brehaut: Thanks. |
| 18:09 | brehaut | np |
| 18:10 | brehaut | mybuddymichael: its worth reading all the pages on clojure.orgs sidebar |
| 18:11 | mybuddymichael | brehaut: Good idea. I'm actually working through Clojure Programming and JoC right now. |
| 18:11 | brehaut | those are both good resources |
| 18:11 | augustl | seems I need to understand much about how maven works in order to be able to have unpublished internal modules as dependencies of my projects |
| 18:11 | mybuddymichael | brehaut: But I have not read much from the official site. |
| 18:12 | mybuddymichael | brehaut: Other than the "features" section. |
| 18:12 | gstamp | small problem on OS/X that I was wondering if anyone might be able to help with… whenever a new JVM starts up (for instance when running clojure-jack-in) the focus moves to the new JVM. Is there anyway to stop that? It's very annoying. |
| 18:12 | mybuddymichael | brehaut: But I've heard various people mention that the official site is frequently outdated? |
| 18:13 | brehaut | its not the most timely resource |
| 18:13 | brehaut | but especially for things like what the reader is doing, what various forms mean etc |
| 18:14 | brehaut | its a good place to start |
| 18:14 | mybuddymichael | brehaut: Right on. |
| 18:15 | augustl | http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ seems to be a solution, but it means committing the jars into git |
| 18:15 | mybuddymichael | brehaut: By the way, I somehow stumbled upon your "brief over of the Clojure web stack" the other day. Helpful stuff. |
| 18:15 | mybuddymichael | brehaut: Thanks for writing it. |
| 18:15 | brehaut | thanks |
| 18:16 | brehaut | FWIW in that i say that i prefer moustache; ive changed my mind and now prefer compojure |
| 18:17 | mybuddymichael | brehaut: Interesting. |
| 18:18 | brehaut | it has some features around route and request destructuring that i didnt know about that are really excellent |
| 18:18 | samaaron | MINI BEAST: https://github.com/aaron-santos/mini-beast |
| 18:19 | brehaut | samaaron: that looks amazing! |
| 18:19 | samaaron | brehaut: it's sick |
| 18:20 | samaaron | it totally works too |
| 18:20 | samaaron | haha |
| 18:21 | samaaron | the insanely cool thing is that all the source for it is in Clojure |
| 18:21 | samaaron | every single part |
| 18:21 | samaaron | from the interface, to the MIDI events to the synthesis |
| 18:21 | augustl | any suggestions for how to set up a private maven repo for non-free local dependencies in leiningen? |
| 18:22 | augustl | seems I can just scp files to any HTTP server, would be nice to be able to "lein deploy" though |
| 18:23 | brehaut | mybuddymichael: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax btw |
| 18:24 | mybuddymichael | brehaut: Sweet. Thanks. |
| 18:37 | seancorfield | augustl: have you looked at the s3-wagon stuff for private maven repos based on amazon s3 storage? |
| 18:37 | ssutch | what is the & in defn - i can't quite figure it out |
| 18:38 | enteL | hello, im using swank-clojure in emacs which works fine, but unlike with common lisp C-M-x to eval a exp isnt sending the output to the repl, anyone know how to get it do that? |
| 18:38 | seancorfield | ssutch: it's for variadic argument functions - [& more] will initialize more to a sequence of the arguments |
| 18:38 | ssutch | seancorfield thank you! |
| 18:39 | seancorfield | so [a b & more] has two required args and more is all the rest |
| 18:39 | ssutch | seancorfield excellent that helps a lot, thanks |
| 18:47 | augustl | seancorfield: yeah, only annoyance now is that it spits out a gazillion stack traces when lein resolves dependencies |
| 18:48 | augustl | basically, it seems that leiningen tries the s3 repo first for all deps, and a non-existing dep in my repo (that is, public clojars) yields an insane 404 and a stack trace |
| 18:48 | augustl | it _works_ but it's pretty annoying |
| 18:50 | fil512 | lein compile isn't compiling anything--it's silently failing. thoughts? |
| 18:50 | fil512 | it's almost like it doesn't know to look in the src folder... |
| 18:52 | Frozenlock | Is there a way to get every fields from a java class? |
| 18:56 | cgag | I'm trying to base64 encode something, and i found this: http://commons.apache.org/codec/index.html. How would I actually go about using this, like how would I figure out what needs to be put into leinigen? I see that someone put it on clojars, but I'd like to figure this out. |
| 18:58 | brehaut | "Yes, PHP has a better dependency manager than any other languages." |
| 18:58 | brehaut | O_o |
| 18:58 | Frozenlock | cgag: This could be helpful https://github.com/clojure/data.codec/ |
| 18:59 | weavejester | cgag: Ring has a base64 encode and decode based on Apache commons codec |
| 18:59 | weavejester | cgag: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/util/codec.clj |
| 18:59 | weavejester | cgag: Line 53 to 61 |
| 19:01 | madsy | I tried to build the "simple" example from lein-cljsbuild, but it seems that hiccup 1.0.0 is incompatible with lein-ring 0.7.0, according to the error I get and some hits on google. |
| 19:01 | madsy | Anyone knows it this is an issue with the example at github or if the error is on my end? |
| 19:01 | augustl | any tutorials out there for setting up your own nexus and using it from leiningen? Got a nexus up and running, but getting authentication errors when deploying. |
| 19:03 | weavejester | madsy: lein-ring 0.7.1 is the latest version, but 0.7.0 shouldn't be incompatible. Do you have a dependency to Ring 1.0.0 on your classpath? |
| 19:03 | weavejester | madsy: Or Compojure 1.0.0 |
| 19:03 | yonatane | cgag: i had problems with data.codec cutting the last character. Use apache commons codec. |
| 19:04 | cgag | weavejester, so i see that's using the commons codec library i was asking about, and i see in your project.clj you just have [commons-codec "1.6"], my question is where did that come from |
| 19:04 | cgag | i see 1.3 on clojars, but it doesn't have the same group/artifact id |
| 19:04 | madsy | weavejester: Yes, I do. Here's the project clj file for the example: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/simple/project.clj |
| 19:05 | weavejester | cgag: From maven central. Clojars isn't the only default reposity in Leiningen :) |
| 19:05 | weavejester | madsy: Update the Compojure dependency to 1.1.0 and the problem should be resolved. |
| 19:06 | madsy | Let me try that :) |
| 19:07 | yonatane | weavejester, I didn't include commons-codec in my project.clj, yet it worked anyway. Could it be because I did include ring or noir? |
| 19:07 | yonatane | i just called (org.apache.commons.codec.binary.Base64/decodeBase64 input-bytes) without thinking about it |
| 19:07 | weavejester | yonatane: Yes; Ring depends on commons-codec |
| 19:09 | cgag | weavejester, i found this on maven central: http://search.maven.org/#artifactdetails%7Corg.apache.directory.studio%7Corg.apache.commons.codec%7C1.6%7Cjar, but wouldn't your leiningen entry then look like '[org.apache.directory.studio/org.apache.commons.codec "1.6"]? |
| 19:09 | yonatane | thanks |
| 19:10 | weavejester | cgag: Yes, but the library I use is: http://search.maven.org/#browse%7C-1511838660 |
| 19:10 | weavejester | cgag: Which is commons-codec/commons-codec |
| 19:10 | weavejester | cgag: Leiningen simplifies that to commons-codec |
| 19:13 | cgag | ah guess i missed that one, thanks, i just wanted to be sure i was understanding maven/leiningen conventions |
| 19:19 | madsy | weavejester: Hm.. not sure what the cause is now. When I run "lein ring server-headless 3000" it complains about not finding the "app" ring handler in the path. But the code itself compiles fine. |
| 19:19 | weavejester | madsy: What do your :ring options in your project.clj file look like? |
| 19:20 | madsy | :ring {:handler example.routes/app}, unmodified from the example on github I linked to |
| 19:20 | weavejester | And there's a file at src/example/routes.clj ? |
| 19:21 | weavejester | Oh, I see your project. Let me look |
| 19:21 | weavejester | Hm, wait, you have lein-ring as a dev-dependency and not a plugin? That's wrong... |
| 19:21 | weavejester | lein-ring is a plugin |
| 19:21 | madsy | The clojure source path is :source-path "src-clj", and the routes.clj lives under ./src-clj/example/routes.clj |
| 19:21 | weavejester | It's only dev-dependencies on older versions of Lein that didn't have :plugins |
| 19:22 | madsy | Yeah, but I did add lein-ring to my profiles.clj |
| 19:22 | nuno | Hello, anyone knows a beginning tutorial for clojure? (no previous programming knowledge) |
| 19:24 | weavejester | nuno: Hm, no previous programming knowledge? I'm not sure I've seen a Clojure tutorial that teaches from scratch. |
| 19:24 | amalloy | nuno: you could try 4clojure? it's not totally a standalone learn-to-program tool, but it has links to some relevant materials |
| 19:25 | nuno | ok, thanks |
| 19:26 | yonatane | there's the SICP book not completely converted to clojure: http://sicpinclojure.com/ |
| 19:26 | ToxicFrog | 4clojure I really didn't like, personally - its "your answer must be a single form we can splice in" model makes some solutions unnecessarily convoluted, and a lot of the problems are just (poorly) recycled Project Euler. |
| 19:26 | ToxicFrog | And it also assumes that you're actually learning Clojure from something else. |
| 19:26 | yonatane | you will have to do some of the work yourself, reading about clojure a little to convert the samples. |
| 19:27 | seancorfield | with no prior programming background, i'd suggest http://tryclj.com/ since you can type in tutorial and it takes you thru with baby steps |
| 19:27 | weavejester | madsy: It looks like it works if the Clojure source directory is just "src", the default… It looks like it might be a bug in lein-ring. |
| 19:27 | ToxicFrog | yonatane: where do I file bug reports against sicpinclojure? |
| 19:27 | madsy | weavejester: thanks :) |
| 19:28 | yonatane | it has a github repository i think |
| 19:28 | yonatane | but i have no idea |
| 19:28 | madsy | weavejester: So, uh merge the two src-clj and src-cljs directories to "src" ? |
| 19:29 | weavejester | madsy: Well, just change the src-clj to src works. But hm… which version of lein are you using? |
| 19:29 | madsy | lein 2.0.0-preview7 with openjdk 6 |
| 19:30 | weavejester | madsy: Ah, I think the option might have changed in Leiningen. |
| 19:30 | weavejester | madsy: In here: https://github.com/technomancy/leiningen/blob/master/sample.project.clj |
| 19:30 | weavejester | madsy: It's source-paths |
| 19:31 | weavejester | madsy: Followed by a vector, not source-path |
| 19:31 | madsy | aha, thanks :) |
| 19:31 | weavejester | madsy: :source-paths ["src-clj"] works |
| 19:32 | madsy | weavejester: Thanks a lot for your time. Different project using lein and lein 2 without specifying can be quite the headache. |
| 19:33 | weavejester | madsy: Yeah, there's a bit of pain switching, but worth it in the long run, I think :) |
| 19:33 | madsy | I'll be sure to double check the project-clj map keys next time |
| 19:42 | ToxicFrog | Huh. The clojure-clr 1.4.0-3.5 download is broken. |
| 19:59 | augustl | if the key :json-body is present in a map, I want to create a new map without :json-body and where :body is the value of :json-body passed through a function. Suggestions? :) |
| 20:01 | nicholasf | what's the convention for organising code in namespaces in clojure projects? It's obviously different than the java conventions? |
| 20:01 | brehaut | augustl: dissoc + assoc |
| 20:01 | augustl | brehaut: I suppose there's no specific function for this :) |
| 20:01 | augustl | thanks |
| 20:10 | amalloy | &(doc clojure.set/rename-keys) |
| 20:10 | lazybot | ⇒ "([map kmap]); Returns the map with the keys in kmap renamed to the vals in kmap" |
| 20:10 | amalloy | is close, but probably just assoc/dissoc is fine |
| 20:16 | ssutch | how would someone do a (with-connection …) sort of form? |
| 20:16 | ssutch | i want to do a (with-keypair) sort of thing |
| 20:23 | rlb | ssutch: this might be more than you need, the source for with-open could be a model -- http://clojuredocs.org/clojure_core/clojure.core/with-open#source |
| 20:28 | augustl | is there a way to require a file by path and access its defs? Was thinking of using a .clj for setting config vars for my app, would be nice of the config file didn't have to define a namespace etc |
| 20:30 | ssutch | load-file? |
| 20:30 | augustl | ssutch: experimenting with it now |
| 20:31 | augustl | how does it work? It seems to "inline" it, so that any defs from the file becomes def in the file where I load-file |
| 20:35 | ssutch | augustl no idea |
| 20:35 | ssutch | sorry |
| 20:35 | augustl | :) |
| 20:36 | enteL | pa/wc |
| 20:36 | enteL | oops |
| 20:38 | ssutch | rlb that doesn't quite do what i want, i am looking for more like with-connection |
| 20:38 | ssutch | which defines a connection and then functions called in the body have the connection available to it |
| 20:39 | ssutch | https://github.com/richhickey/clojure-contrib/blob/e2014cf11b5598a955dd5a1d6e8ce9c06f934ae8/src/main/clojure/clojure/contrib/sql.clj#L32 |
| 21:20 | ssutch | so i came up with this, but "keypair" is always unbound: https://gist.github.com/fc74626ef88db412d318 |
| 21:23 | ssutch | ah ha! https://gist.github.com/fc74626ef88db412d318 <- that fixed it |
| 21:28 | madsy | If a function in Javascript is foo.bar.baz(), can I refer to it as "(baz)" in clojurescript somehow? |
| 21:29 | madsy | How the namespaces are set up is kind of confusing :) |
| 21:34 | augustl | what's a good way to find if a map has keys in it other than keys defined in a vector, like ["foo" "bar"]? |
| 21:36 | brehaut | ,(do (use 'clojure.set) (subset? ["foo" "bar"] (keys {"foo" 1 "bar" 2 "baz" 3})) |
| 21:36 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 21:36 | brehaut | ,(do (use 'clojure.set) (subset? ["foo" "bar"] (keys {"foo" 1 "bar" 2 "baz" 3}))) |
| 21:36 | clojurebot | false |
| 21:37 | brehaut | bah. something like that |
| 21:37 | augustl | neat |
| 21:37 | technomancy | ,(empty? (apply dissoc {"foo" 1 "bar" 2} ["foo" "bar"])) |
| 21:37 | clojurebot | true |
| 21:38 | brehaut | technomany wins. his actually answers the question |
| 21:40 | xeqi | &(remove #{"foo" "bar"} (keys {"foo" 1 "bar" 2 "baz"3})) |
| 21:40 | lazybot | ⇒ ("baz") |
| 21:40 | xeqi | just checking |
| 21:43 | augustl | technomancy: nice, that way I'll have the list of invalid keys too |
| 21:51 | wingy | what does 3N mean? |
| 21:51 | wingy | and 3M |
| 21:52 | brehaut | , (map class [3N 3M]) |
| 21:52 | clojurebot | (clojure.lang.BigInt java.math.BigDecimal) |
| 21:53 | wingy | brehaut: i c |
| 21:54 | wingy | im not familiar with java, is there a good place to look up the differences between all the sizes of numbers? |
| 21:56 | brehaut | ,Long/MAX_VALUE |
| 21:56 | clojurebot | 9223372036854775807 |
| 21:57 | brehaut | Big numbers dont have a max value |
| 21:58 | wingy | is there a matrix somewhere for fast lookup? |
| 21:58 | brehaut | probably |
| 21:59 | brehaut | but you mostly only want primative longs for speed or bigints for precision |
| 21:59 | brehaut | clojure defaults to performance because thats what you want in most cases |
| 22:00 | technomancy | "most" cases |
| 22:00 | amalloy | man, when do i ever want performance |
| 22:00 | wingy | so i work with longs in clojure, but when do i know i have to switch to big int? |
| 22:00 | wingy | will i get an error if clojure can't handle that math operation? |
| 22:01 | amalloy | rich has robbed me of the joy that comes from optimizing my own code |
| 22:01 | amalloy | &(inc Long/MAX_VALUE) |
| 22:01 | lazybot | java.lang.ArithmeticException: integer overflow |
| 22:01 | amalloy | &(inc' Long/MAX_VALUE) |
| 22:01 | lazybot | ⇒ 9223372036854775808N |
| 22:03 | wingy | i c |
| 22:03 | wingy | so no need to know the others only: java.lang.Long and clojure.lang.BigInt ? |
| 22:05 | wingy | nDuff: tell us how it goes .. im pretty interested in that topic as well |
| 22:06 | amalloy | i can't think why you'd need to know either of those either. just use numbers, and if they happen to be an instance of Long you usually don't care |
| 22:07 | brehaut | s/to/for/ |
| 22:08 | wingy | i guess |
| 22:09 | augustl | any recommendations for mongodb libraries? Not sure what kind of abstractions I want, all I know is that I need to write and read to mongodb :) |
| 22:10 | augustl | in general I know I want a level above raw mongodb driver, I need at least data validation |
| 22:18 | xeqi | augustl: reheap.com recently moved to https://github.com/michaelklishin/monger/ |
| 22:18 | xeqi | *refheap |
| 22:18 | augustl | let's pretend for a second that mongodb wasn't a requirement :) Are there any databases that can be said to be "best" for Clojure (other than Datomic)? |
| 22:19 | augustl | xeqi: you work on refheap.com? Have you written your own validations and what not on top of monger? |
| 22:19 | brehaut | surely a database is best for a particular program rather than a language? |
| 22:19 | augustl | brehaut: I suppose when you leave Datomic out of the equation, that's true |
| 22:19 | augustl | or more true |
| 22:19 | brehaut | or do you mean which language has the best library sypport in clojure? |
| 22:19 | xeqi | no, but I saw a tweet about it |
| 22:20 | augustl | datomic seems to be a pretty good match for Clojure, since it has similar semantics for abstracting away time |
| 22:20 | augustl | brehaut: I guess :) |
| 22:20 | wingy | augustl: why not datomic? |
| 22:21 | augustl | wingy: because I can't use it yet, I think, it's an invite only beta isn't it? |
| 22:21 | wingy | no |
| 22:21 | wingy | just download it and play with it .. im was pretty amazed |
| 22:21 | wingy | perfect fit for clojure |
| 22:21 | xeqi | just as another data point, clojars uses sqlite3 |
| 22:21 | brehaut | augustl: well, SQL has a couple of solid librarys (clojure.something.jdbc, korma (ontop of said)), i understand that mongo is well supported, and the couchdb lib (clutch) is great. |
| 22:22 | augustl | wingy: hmm, why not :) |
| 22:22 | wingy | augustl: take a look at datomic .. you probably don't want to do mongo et al. afterwards :) |
| 22:23 | augustl | wingy: it seems insane to have all the data in memory :) |
| 22:23 | wingy | you wont have all the data in the memory (if its big) |
| 22:24 | augustl | my storage requirements are dead simple though.. Just a few tables and some primary key lookups :) |
| 22:24 | wingy | perfect match :) |
| 22:25 | augustl | datomic you mean? |
| 22:25 | wingy | as far as i understand it it's using storage services (postgresql, mysql, dynamodb etc) as persistent layer .. you don't need to care about how to communicate with these |
| 22:25 | augustl | I'm considering postgres, but since datomic cna store to postgres I can consider datomic a clojure front-end to postgres, heh |
| 22:25 | wingy | just like these traditional dbs are using the filesystem to persist information |
| 22:25 | wingy | its a layer above |
| 22:26 | wingy | just the diff that you are able to choose what persistent service to use to save the data of datomic for scalability on read |
| 22:27 | wingy | but i hope they will manage the whole package one day so we don't need to isntall it manually |
| 22:27 | ToxicFrog | What would people recommend for parsing a JSON-like (but not actually JSON) language in Clojure? |
| 22:28 | wingy | just using the datomic peer lib as a lein dep and ready to go |
| 22:28 | wingy | augustl: then you wont need 3rd party abstraction layers above dbs like we use to need today for some reason |
| 22:29 | wingy | its a new way of interacting with data .. keep it local .. it will persist |
| 22:29 | brehaut | ToxicFrog: what do you mean? |
| 22:29 | augustl | damn google, queries for datomic turns into atomic |
| 22:29 | brehaut | ToxicFrog: are you wanting recommendation for parser building libraries, or a specific non-json lib? |
| 22:29 | ToxicFrog | brehaut: I have input data in a format that resembles JSON. I need to write a parser for it. |
| 22:29 | ToxicFrog | The former. |
| 22:30 | ToxicFrog | I used LPEG for this in Lua and util.parsing.combinator in Scala; what would you recommend in Clojure? |
| 22:30 | augustl | datomic breaks clojars :) https://clojars.org/search?q=datomic I just get an empty page |
| 22:31 | brehaut | ToxicFrog: probably not fnparse, because even though its quite nice, its effectively dead; the official version is not 1.3 compatible and hasnt updated in ages (there are 1.3+ forks around though) |
| 22:31 | wingy | it's travelling through time and space .. difficult to lock it in |
| 22:31 | brehaut | ToxicFrog: there are other parser combinator libraries around but im not familiar enough to talk about them. There is also cgrand's parsley library |
| 22:31 | brehaut | ToxicFrog: which is its own thing |
| 22:32 | wingy | augustl: are you new to clj? |
| 22:32 | augustl | wingy: a little |
| 22:35 | ToxicFrog | parsley looks kind of heavyweight and designed for realtime syntax hilighting and the like |
| 22:35 | brehaut | yes |
| 22:35 | ToxicFrog | Valid parse tree from any input, high-speed incremental reparsing on mutable buffers |
| 22:36 | brehaut | i think that specific use case is for building parsers for editors (eg counter clockwise) |
| 22:36 | ToxicFrog | Yeah |
| 22:36 | ToxicFrog | A bit heavier than what I'm after |
| 22:36 | augustl | I wonder what most people actually do for data validation, there doesn't seem to be that many libraries for it out there |
| 22:37 | xeqi | augustl: do you have an example from somewhere else? |
| 22:38 | augustl | xeqi: ActiveRecord in Rails is something I'm already familiar with |
| 22:38 | augustl | clj-record seems similar, but not sure if the active record pattern is a good fit for clojure.. And it seems poorly documented |
| 22:40 | augustl | wingy: datomic does cost money no matter how you use it if you have more than 2 "peers" right? |
| 22:40 | augustl | which basically means two in-memory clients? |
| 22:42 | ToxicFrog | Oh man, there's a Clojure port of Parsec! Which is missing. |
| 22:43 | ToxicFrog | And fnparse is dead and parsley is overkill and that seems to be all that's available. :/ |
| 22:47 | ToxicFrog | Hmm. There's Parsatron, which has a highly entertaining README and seems to be active |
| 22:49 | surial | I have a pretty weird question, not even sure if it is entirely on topic. I'm holding a talk this weekend: Hello, World! in 10 languages. I'd like to use snippets which are simple yet which let me explain some pretty profound concepts. One of the concepts I want to touch on is conc lists. (like conslists, but where both left and right are subtrees; assuming the tree is balanced, it is highly parallelizable). |
| 22:50 | surial | The go-to language for this would probably be fortress but I know nothing about it, and can't find much either. I vaguely recall Rich wrote an implementation for clojure. Is that true? |
| 22:50 | surial | (if yes, followup questions would be: Any idea for a nice snippet that shows em in action?) |
| 22:53 | nDuff | One thing I'm a little unclear about re: the clojurescript REPL -- how do I integrate this into a project running its own server, given as (repl/repl) tries to start its own? |
| 22:57 | foxdonut | ,(str \h \i) |
| 22:57 | clojurebot | "hi" |
| 23:01 | foxdonut | clojurebot: CPOR? |
| 23:01 | clojurebot | CPOR is Clojure Programming (O'Reilly): http://www.clojurebook.com |
| 23:02 | foxdonut | cool :) |
| 23:04 | cmajor7 | how to memoize the call to "let", in this case "letrem": refheap.com/paste/3455 ? a bit confused on how will memoize recognize the same input to "do-somm" |
| 23:04 | cmajor7 | (this is clojurescript calling into the clj server) |
| 23:06 | ssutch | my first clojure library! https://gist.github.com/3050902 |
| 23:07 | ssutch | string/object signing |
| 23:08 | ssutch | any comments/critique would be greatly appreciated |
| 23:15 | nDuff | java.lang.ClassCastException: ring.util.servlet.proxy$javax.servlet.http.HttpServlet$0 cannot be cast to javax.servlet.http.HttpServlet |
| 23:18 | xeqi | ssutch: (.method object) is more common; naming a file fn is asking for confusion; -> and when may be helpful functions |
| 23:18 | xeqi | and why json as the serialization format? |
| 23:19 | technomancy | surial: vectors are tree-based behind the scenes, and the new reducers library lets you easily operate on them in parallel |
| 23:19 | ssutch | xeqi thanks, i'll use .method and rename fn for sure |
| 23:19 | technomancy | surial: there's a good post going into detail on the implementation of them too |
| 23:19 | ssutch | xeqi json because it's simple and works and allows you to encode maps and vectors simply |
| 23:19 | surial | technomancy: Right. A link would be fantastic. I can't think of a good way to actually show the effect, somehow, in a snippet of code. I'll have to think about it some more. |
| 23:20 | cmajor7 | is there a way to memoize a "defremote" macro? |
| 23:20 | cmajor7 | (defremote.. => http://bit.ly/M7evKV) |
| 23:21 | xeqi | ssutch: theres ##(doc pr-str) and ##(doc read-string) builtin |
| 23:22 | lazybot | (doc pr-str) ⇒ "([& xs]); pr to a string, returning it" |
| 23:22 | lazybot | (doc read-string) ⇒ "([s]); Reads one object from the string s" |
| 23:22 | clojurebot | "([& xs]); pr to a string, returning it" |
| 23:22 | clojurebot | "([s]); Reads one object from the string s" |
| 23:22 | xeqi | hmm, that was unexpected |
| 23:22 | ssutch | haha dueling bots |
| 23:23 | ssutch | do i do the (doto …) syntax correctly? |
| 23:23 | ssutch | (you can reload, i just updated it |
| 23:24 | ssutch | the get-csrf-token is not a compete implementation |
| 23:25 | xeqi | you can use (.initSign ...) in the doto |
| 23:25 | ssutch | remove the space then |
| 23:26 | nicholasf | hi guys |
| 23:26 | nicholasf | I want to look through a good clojure project to gain an idea of namespacing practices, etc. (preferably a leiningen project) |
| 23:26 | nicholasf | I already know about storm - what's another good example? |
| 23:31 | ssutch | xeqi thanks a bunch |
| 23:31 | Frozenlock | Could Clojure run on a raspberry pi? |
| 23:32 | nDuff | Frozenlock: It's been done. You'd get better performance with one of the non-Java implementations, though (ie. ClojureScript) |
| 23:32 | Frozenlock | Nice! |
| 23:33 | Frozenlock | And if I want to stay on the jvm...? Need more ram? |
| 23:33 | wingy | augustl: it seems like that |
| 23:33 | wingy | and if it's OS you dont have to pay at all |
| 23:37 | wingy | augustl: let's use it together |
| 23:37 | wingy | you and me! |
| 23:42 | cmajor7 | is there a way to memoize a macro ? |
| 23:46 | wingy | ,(def a 1) |
| 23:46 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 23:47 | wingy | when running: (def a 1) you get back: #'myapp.core/a |
| 23:47 | wingy | i know that # has to do with the reader (read-string) but not sure how to relate to it in this case |
| 23:49 | xeqi | ,(class #'+) |
| 23:49 | clojurebot | clojure.lang.Var |
| 23:50 | xeqi | #' gets the var instead of the value, its useful for long running stuff where the var might change |
| 23:50 | xeqi | like a ring handler |
| 23:54 | wingy | right |
| 23:56 | ToxicFrog | Is the clojurebot meant to say SANBOX instead of SANDBOX? |