2013-02-24
| 00:01 | arrdem | TimMc: how to explod on error? TypeError? |
| 00:02 | nightfly | #lisp can be pretty vicious about off-topic conversation |
| 00:03 | frozenlock | to be fair #lisp can be pretty vicious about on-topic conversation too. |
| 00:12 | frozenlock | Any 'eval-in-ns' functions? |
| 00:16 | gfredericks | frozenlock: lots somewhere; (binding [*ns*] (eval thing)) should work |
| 00:20 | frozenlock | Oh wow, way simpler than what I was expecting.. |
| 00:40 | yedi | what non blocking database solutions exist in clojure? |
| 00:40 | ChongLi | yedi: hmm? |
| 00:42 | ChongLi | why not put the call in an agent? |
| 00:46 | ChongLi | or a future for that matter |
| 00:52 | yedi | ChongLi: looks like i have more things to learn |
| 00:57 | ChongLi | it's the "old" way of doing things |
| 00:57 | ChongLi | put a blocking call in a green thread to be run on a thread pool at a later time |
| 01:04 | yedi | old in what sense? |
| 01:05 | ChongLi | old in the sense that it's different from the "new" way of doing things with callbacks and an event loop |
| 01:05 | ChongLi | I guess the event loop is pretty old too |
| 01:06 | ChongLi | it's just in fashion right now thanks to javascript not having threads |
| 01:06 | ChongLi | (and the popularity of node) |
| 01:06 | nightfly | Doesn't it also not require context switching in the kernel? |
| 01:07 | ChongLi | I wasn't aware of that requirement |
| 01:08 | ChongLi | I was just speaking in terms of the semantics the programmer deals with |
| 01:22 | Sgeo | Callbacks and event loop can be hidden with nice syntax to look like/be green threads |
| 01:22 | Sgeo | Depending on the language' |
| 01:34 | muhoo | i thought java used native threads, not green threads? |
| 01:35 | muhoo | top and ps sure seem to indicate that |
| 01:36 | ChongLi | muhoo: it does |
| 01:36 | muhoo | yep, looks like (future ...) does indeed launch a process |
| 01:36 | arrdem | herm... so how can I make (vector) non-lazy? |
| 01:37 | Raynes | Vectors aren't lazy. |
| 01:37 | muhoo | arrdem: doall? |
| 01:38 | arrdem | Raynes was vindicated, I forgot to C-c C-l |
| 01:44 | arrdem | TimMc: https://www.refheap.com/paste/11734 |
| 01:44 | arrdem | that was fun.. bedtime now. |
| 02:01 | nonuby | is there something like conj that ignores nil e.g. (conj2 [] 1 2 3 nil 4) -> [1 2 3 4] |
| 02:02 | ChongLi | nonuby: you could filter on identity first |
| 02:02 | ChongLi | ,(filter identity [1 2 3 nil 4]) |
| 02:02 | clojurebot | (1 2 3 4) |
| 02:07 | nonuby | https://www.refheap.com/paste/11738 - doesnt quite feel idiomatic |
| 02:09 | ChongLi | it does not appear to be |
| 02:10 | nonuby | any suggestions? |
| 02:10 | ChongLi | I'm not quite sure what you're trying to accomplish over all |
| 02:10 | ChongLi | some sort of rule-based dispatch? |
| 02:10 | nonuby | create an array of warning |
| 02:11 | nonuby | warnings |
| 02:11 | ChongLi | right, but why do you need that? |
| 02:12 | nonuby | so I display in the html - hand off to view logic in hiccup to render out |
| 02:12 | ChongLi | ah ok |
| 02:12 | ChongLi | so you're doing some form validation and want to display a list of warnings based on the user's specifications? |
| 02:13 | nonuby | yes, basically, when we display details of a villa we use the previously captured user specification to highlight when the choosen villa might not be optimal (based on dates, bedrooms etc.) |
| 02:14 | ChongLi | have you looked at using a form validation library? |
| 02:16 | ChongLi | or perhaps you already have a big application and you're adding to it? |
| 02:16 | nonuby | this is tiny app at the moment, no i have not looked into any validation libraries |
| 02:16 | nonuby | do you suggest any? |
| 02:17 | ChongLi | first one that comes to mind is sandbar |
| 02:17 | ChongLi | though it has a few other features as well |
| 02:17 | nonuby | thanks |
| 02:18 | ChongLi | be sure to check the form-validation documentation |
| 02:18 | ChongLi | it has some nice macros to make building validators easier |
| 02:18 | ChongLi | one of the key reasons you want to use something like this is to create open, extensible validators |
| 02:19 | ChongLi | putting everything into one monolithic function with a big long chain of ifs/whens/cond etc. is much harder to work with |
| 02:19 | nonuby | will thinking that over, thanks |
| 02:19 | clifton | anyone know where clojure.contrib.io/read-lines went? |
| 02:22 | Raynes | clojure.core |
| 02:22 | Raynes | I think? |
| 02:22 | Raynes | $source read-lines |
| 02:22 | lazybot | Source not found. |
| 02:22 | Raynes | Guess not. |
| 02:23 | clifton | it appears to have vanished |
| 02:23 | ChongLi | what's the difference between that and read-line |
| 02:23 | ChongLi | ? |
| 02:23 | Raynes | It reads more than one line. |
| 02:23 | ChongLi | besides the obvious I mean :) |
| 02:23 | Raynes | (line-seq (clojure.java.io/reader (clojure.java.io/file "somefile.txt"))) |
| 02:23 | Raynes | clifton: ^ pretty sure this does the same thing. |
| 02:24 | clifton | yeah |
| 02:24 | clifton | just saw line-seq on stackoverflow |
| 02:24 | clifton | goodbye convenience function -- i guess |
| 02:24 | clifton | thanks Raynes |
| 02:24 | ChongLi | a lazy sequence from a file? |
| 02:24 | ChongLi | how does that deal with closing the file handle? |
| 02:25 | Raynes | It doesn't. |
| 02:25 | Raynes | (with-open [reader (clojure.java.io/reader (clojure.java.io/file "foo"))] (line-seq reader)) |
| 02:25 | ChongLi | ah ok, that's what I figured |
| 02:26 | Raynes | That is lazy though so you have to do all of your work and realize the seq inside of the scope of with-open, otherwise you'll be doing the reading after the file is closed. |
| 02:26 | ChongLi | it does have the benefit of you only needing to realize the lines you need for your work though |
| 02:41 | sirvaliance | Ok, I am back again out of frustration. How in the world do you delete/remove a cookie within a handler with ring/compojure/noir ? |
| 02:41 | sirvaliance | It should be stupidly easy. |
| 02:41 | sirvaliance | Set the headers |
| 02:42 | sirvaliance | I am using compojure and ring to store session data in a cookie. Logouts should delete that cookie. I cannot figure out how to delete that cookie |
| 02:43 | sirvaliance | I feel dumb. Mind you, I have plenty of wine in my system right now. |
| 02:43 | sirvaliance | But I have scoured the ring/compojure/noir api docs to no avail |
| 04:46 | meegofl | Hi, need little help with changing a value in a bit complex set |
| 04:46 | meegofl | i defined this : (def tbl (ref {:key1 [1 2] :key2 [3 4]})) |
| 04:46 | meegofl | and i want to change the value first item in tbl :key1 |
| 04:47 | meegofl | should be somthing like: (dosync (alter (tbl :key1) assoc 0 9)) |
| 04:47 | meegofl | but it throws error: ClassCastException clojure.lang.PersistentVector cannot be cast to clojure.lang.Ref clojure.core/alter (core.clj:2190) |
| 05:18 | borkdude | meegofl (dosync (alter tbl assoc-in [:key1 0] 9)) |
| 05:30 | meegofl | borkdude: Thanks! |
| 05:30 | borkdude | meegofl np. any reason why you're not using an atom? |
| 05:30 | borkdude | meegofl refs are for when you need coördination |
| 05:35 | meegofl | borkdude: Thanks, that seems useful but doesn't recall it was mentioned in our lectures... |
| 05:35 | borkdude | meegofl what lectures? |
| 05:36 | meegofl | borkdude: i'm doing a project as part of functional programming course |
| 05:36 | borkdude | meegofl I use Clojure in education, so it's interesting to see how others do it |
| 05:36 | borkdude | meegofl is there a link or smth to the course website? |
| 05:38 | meegofl | borkdude: it's in highlearn system but i may send you the ppt's it about 5MB |
| 05:38 | borkdude | meegofl cool. michielborkent@gmail.com |
| 05:45 | meegofl | borkdude: Sent |
| 05:47 | borkdude | meegofl tnx :) |
| 05:50 | borkdude | meegofl are you in Israel? |
| 05:50 | meegofl | borkdude: yep |
| 05:54 | borkdude | meegofl nice slides, tnx |
| 05:54 | borkdude | meegofl do you also have exercises etc |
| 05:56 | meegofl | borkdude: There are some example files with simple clojure code and there is no exercises |
| 05:56 | meegofl | borkdude: there is no exam also just one project instead |
| 05:56 | borkdude | meegofl interesting. what kind of project, a web app |
| 05:56 | borkdude | ? |
| 05:57 | meegofl | borkdude: Basically you can choose from some ideas (in lecture 3 i think) and suggest your own |
| 05:57 | meegofl | borkdude: most students (as us) choose to implement simple database (kinda of SQL) |
| 05:58 | borkdude | meegofl ah ok. it's nice to see the adoption of clojure in education here and there |
| 05:59 | meegofl | borkdude: It's actually a nice language with some strong features but haven't seen or heard of it anywhere until University... |
| 06:01 | borkdude | meegofl it's a relatively young language |
| 06:01 | borkdude | meegofl in the form of one of the oldest languages (lisp) |
| 06:46 | pepijndevos | The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value) |
| 06:47 | pepijndevos | But the online docs say (defmulti name docstring? attr-map? dispatch-fn & options) |
| 06:48 | pepijndevos | as does my repl |
| 06:53 | pepijndevos | I have no idea what dispatch-values is, and where I'm supposed to put the argument vector, if at all. |
| 07:10 | clojure-newb | hey guys.. I'm stuck trying to use assoc-in or update-in to turn '{:k1 "stuff" :k2 ["1" "2"]}' into '{:k1 "stuff" :k2 ["1" "2" "3"]}' is that the way I should be looking to do it ? |
| 07:10 | xbat | what should i use for complex number maths, please? there used to be something in contrib, but i can't see what replaced it... |
| 07:17 | xbat | well, seems i'm going to have to implement them myself |
| 07:17 | xbat | is http://stackoverflow.com/questions/11824815/fast-complex-number-arithmetic-in-clojure |
| 07:17 | xbat | still a good way to go? |
| 07:17 | xbat | (i only need very basic arithmetic, just surprised it hasn't been done yet) |
| 07:28 | meegofl | Hey, i've got a wierd problem |
| 07:28 | meegofl | http://pastebin.com/XT7TDr1S |
| 07:29 | meegofl | i'm going to a table using a key twice each time key from different value |
| 07:29 | meegofl | i compare the keys and they are the same but once i get the right value and once i get nil |
| 07:29 | meegofl | Can anyone please take a look? Thanks... |
| 07:32 | ambrosebs | &(+ 1) |
| 07:32 | lazybot | ⇒ 1 |
| 07:32 | ambrosebs | &(-> '{:k1 "stuff" :k2 ["1" "2"]} (update-in [:k2] conj "3")) |
| 07:32 | lazybot | ⇒ {:k1 "stuff", :k2 ["1" "2" "3"]} |
| 07:32 | ambrosebs | clojure-newb: ^^ |
| 07:33 | clojure-newb | ambrosebs: thx |
| 07:33 | clojure-newb | damn, easy as that :-) |
| 07:33 | ambrosebs | But only conj onto a vector(!) |
| 07:33 | clojure-newb | ok thx for the heads up |
| 07:34 | ambrosebs | np |
| 08:25 | h455m0 | hi |
| 08:33 | mindbender1 | what is the cost of this pattern, how does it really work? (defn foo [-fn] (fn [baz] (-fn baz))) |
| 08:35 | mindbender1 | I know it's based on closures< first class fns, and higher order logic concepts |
| 08:36 | jjido | mindbender1: what does it do? |
| 08:36 | mindbender1 | but how can one know when to use it |
| 08:38 | mindbender1 | jjido: it takes a fn and return a fn |
| 08:38 | jjido | it is compose isn't it? |
| 08:40 | mindbender1 | I'm not sure if to call it that |
| 08:43 | mindbender1 | jjido: ((fn [x] x) ((fn [y] y) 2)) I would hope this is composition |
| 08:51 | johnmn3 | g'day |
| 08:51 | h455m0 | good day sir |
| 08:52 | johnmn3 | I'm just starting out with clojurescript. I'm familiar with java interop, but just now trying to figure out how to do javascript interop |
| 08:52 | h455m0 | my head hurts ... why is it, that, to understand recursion, one has to first understand recursion? |
| 08:53 | johnmn3 | Like here: http://closure-library.googlecode.com/svn/docs/class_goog_math_Integer.html, How do I do toString on a number? |
| 08:53 | johnmn3 | I'd think (.toString 123) |
| 08:53 | h455m0 | would make sense to me |
| 08:53 | johnmn3 | oh |
| 08:53 | johnmn3 | I'd think (.toString 123 2) |
| 08:53 | johnmn3 | wait |
| 08:54 | johnmn3 | no |
| 08:54 | h455m0 | why the 2? |
| 08:54 | johnmn3 | the radix |
| 08:54 | johnmn3 | toString(opt_radix) ? string |
| 08:56 | h455m0 | hm ... i have no diea |
| 08:58 | johnmn3 | do i have to require goog.math.Integer first? |
| 09:13 | kmicu | johnmn3: (.toString (js/Number. 123) 2) |
| 09:14 | meegofl | How do i add values (keys vals) to (def tbl (ref array-map))? |
| 09:14 | meegofl | one at a time |
| 09:16 | kmicu | or (map #(.toString %) (take 5 (range))) |
| 09:17 | kmicu | one at a time? |
| 09:34 | h455m0 | kmicu: not sure what you are trying to do? |
| 09:34 | kmicu | lol ;) |
| 09:36 | kmicu | meegofl: sth wrong with (dosync (alter tbl conj [k v]))? |
| 09:39 | pepijndevos | How can I best create a SQL table with korma/clojure/jdbc? |
| 09:40 | hcumberd` | pepijndevos: ddl? |
| 09:40 | pepijndevos | hcumberd`: ? |
| 09:41 | pepijndevos | ah |
| 09:41 | hcumberd` | pepijndevos: there are clojure wrapper, but the most simple way is just to create them by plain ddl |
| 09:42 | hcumberd` | data definition language |
| 09:42 | hcumberd` | create table,... |
| 09:54 | johnmn3 | kmicu: thanks |
| 09:55 | johnmn3 | kmicu: how would I go about change 123 into base 2? |
| 09:55 | johnmn3 | with java I would use: (defn to2 [n] (Integer/toString n 2)) |
| 09:56 | johnmn3 | and google closure has: toString(opt_radix) |
| 09:57 | johnmn3 | oh, js/Number did that |
| 09:57 | johnmn3 | my bad |
| 09:57 | johnmn3 | problemo, elsolvedo |
| 09:57 | johnmn3 | but I'd still like to know how to drop into google-closure interop |
| 10:01 | kmicu | google-closure-library? |
| 10:02 | kmicu | Import some goog.x namespace and use regular js interop. |
| 10:02 | johnmn3 | ok, will try |
| 10:03 | johnmn3 | been trying but I'm just doing something wrong |
| 10:03 | johnmn3 | no worries, I'll figure it out. I think you gave me the right hints. |
| 10:05 | kmicu | johnmn3: https://github.com/levand/domina/blob/master/src/cljs/domina/events.cljs |
| 10:05 | kmicu | Here you have a real example about GClosure Library interop... |
| 10:06 | johnmn3 | much obliged |
| 10:14 | clojure-newb | hey guys, I'm having trouble getting distinct items out of a sequence of vectors as described in : https://www.refheap.com/paste/11746, can anyone help ? |
| 10:17 | johnmn3 | how do you require a library in clojurescript outside of an ns form? |
| 10:18 | pepijndevos | johnmn3: I thin the NS form generates some closure compiler directives. so… I think you just don't |
| 10:18 | kmicu | In REPL or in a cljs file? |
| 10:18 | johnmn3 | in the repl |
| 10:18 | johnmn3 | okay |
| 10:19 | kmicu | Namespace must be defined before loaded in repl x] |
| 10:20 | johnmn3 | okay |
| 10:20 | kmicu | It's not nice, but in-ns form can't crate new namespace. |
| 10:20 | johnmn3 | (goog.string/parseInt "10010001" 2) does not return what I expect |
| 10:21 | johnmn3 | In java: (Integer/parseInt "10010001" 2) => 145 |
| 10:22 | johnmn3 | goog.string/parseInt returns "10010001" |
| 10:22 | johnmn3 | or 10010001, rather |
| 10:22 | abp | ,(distinct (concat [1] [1 2 3])) |
| 10:22 | clojurebot | (1 2 3) |
| 10:22 | abp | clojure-newb: ^ |
| 10:23 | johnmn3 | looks like maybe base conversion from javascript is hard |
| 10:23 | johnmn3 | from 2 in javascript, I mean |
| 10:24 | kmicu | johnmn3: this is only parsing function |
| 10:25 | kmicu | Do you want convert to another base? |
| 10:25 | johnmn3 | from 2 to 10 |
| 10:27 | kmicu | johnmn3: "This is a wrapper for the built-in parseInt function that will only parse numbers as base 10 or base 16" |
| 10:27 | johnmn3 | then it says: See https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt |
| 10:28 | johnmn3 | The following examples all return 15: |
| 10:28 | johnmn3 | parseInt("1111", 2); |
| 10:28 | johnmn3 | but it doesn't work |
| 10:29 | johnmn3 | at least, goog.string/parseInt doesnt |
| 10:29 | meegofl | if i have an array-map, how can i get the key of a value i have from that map? |
| 10:32 | johnmn3 | ahah! (js/parseInt "10010001" 2) |
| 10:32 | johnmn3 | kmicu: ^ |
| 10:32 | johnmn3 | your hints led me in the right direction, thanks. |
| 10:33 | kmicu | Forgot about global space... ;) |
| 10:47 | kmicu | clojure-newb: Why do you want to switch from maps to vectors? |
| 10:47 | clojure-newb | kmicu: because I'm reading the data in from separated value file info vector and want to perform this step before I process any further |
| 10:48 | clojure-newb | *into |
| 10:50 | kmicu | And order of elements is important? You want to have new get-distinct-items? |
| 10:51 | clojure-newb | kmicu: yes it is important that I group on the correct element (nth 1) and that (nth 2) tells me how complete the item it |
| 10:52 | kmicu | Order is not needed to group by correct element ;) |
| 10:53 | clojure-newb | oh right…. I think you mean do I want the result in the same order ? |
| 10:53 | clojure-newb | in that case yes |
| 10:53 | clojure-newb | sorry… had trouble with understanding that |
| 10:55 | hyPiRion | gfredericks: sweet! |
| 11:05 | gfredericks | why would (Foo. ...) succeed when (map->Foo {...}) throws a "Can't remove struct key" exception? |
| 11:07 | gfredericks | apparently because the argument is a PersistentStructMap o_O |
| 11:09 | gfredericks | oh that must be what enlive uses |
| 11:09 | gfredericks | yay enlive |
| 11:11 | clojure-newb | hmm, confused… some progress getting distinct on values as at : https://www.refheap.com/paste/11748, but I am getting mysterious (at least to me) answers |
| 11:12 | clojure-newb | sorry, that link should have been : https://www.refheap.com/paste/11749 |
| 11:14 | gfredericks | much nicer :) |
| 11:15 | clojure-newb | oh.. typo.. forget it, I'm an idiot :-( |
| 11:17 | yogthos | Raynes: hey you around? :) |
| 11:24 | gfredericks | is it a bug for data.xml to emit content with emit-str but write nothing with emit? |
| 11:25 | gfredericks | I must be crazy because emit-str just uses the string-writer |
| 11:50 | frozenlock | What would be the best way to trigger an event when a java object changes? |
| 11:55 | tgoossens | frozenlock: any object? or an object that you are going to design yourself (in which case you could use subscriber / observer pattern) |
| 11:55 | frozenlock | Any object |
| 11:55 | tgoossens | ok |
| 11:56 | AndChat-8064 | hi, guys, how to debug with nrepl? I tried ritz, but it's not quite satisfactory. For example, when I enabled nrepl-break-on-exception, I cannot disable it and it continues to pop up annoying stack traces for unrelevant exceptions. Also, it looks like the ac-nrepl is incompatible with ritz as it hangs mysteriously. |
| 11:57 | AndChat-8064 | I just need a debugger with breakpoint and capability to examine current context. |
| 11:57 | tgoossens | frozenlock: a tedious way of doing this (in java) is mocking it, another even more tedious way is editing to bytecode engineer it with asm |
| 11:58 | frozenlock | ewww |
| 11:58 | tgoossens | :p |
| 11:58 | tgoossens | and with mock i mean |
| 11:59 | dcolish | I was hoping someone has insight on how I can resolve this error: https://gist.github.com/dcolish/5024561. I am just getting into clojure and I wanted to try something similar to haskell's `fn $ flip`. |
| 11:59 | frozenlock | I take that's not a usual need... perhaps I should try to find another way of doing things. |
| 11:59 | tgoossens | what is it exactly you want to achieve? |
| 11:59 | tgoossens | if the object changes internally |
| 11:59 | tgoossens | caused by external (method call), internal , or both effects |
| 12:00 | da-z | tgoossens: can one periodically check the hash code of an object and compare it with a previous value ? |
| 12:00 | tgoossens | hmm |
| 12:00 | tgoossens | that's not so such a bad idea |
| 12:00 | tgoossens | but |
| 12:01 | tgoossens | then you cannot be sure that you are notified for every change |
| 12:01 | frozenlock | It's a change caused by an event on the network. |
| 12:01 | alandipert | dcolish: unfortunately you can't apply constructors like you do on line 10 |
| 12:01 | dcolish | ah that is a shame |
| 12:01 | tgoossens | maybe you should track those events ? |
| 12:02 | frozenlock | bleh.. the point of using the java library was to avoid dealing with this messy stuff :P |
| 12:02 | tgoossens | hehe |
| 12:03 | tgoossens | just asking, have you tried mockito already? |
| 12:04 | frozenlock | I did not |
| 12:04 | tgoossens | ok |
| 12:04 | tgoossens | because with that, you might be able to do it :p |
| 12:04 | tgoossens | its a bit tedious so you might want to look for something different |
| 12:05 | tgoossens | the idea of hashcodes is not such a bad idea, maybe you can dig in on that a bit |
| 12:05 | tgoossens | or |
| 12:06 | tgoossens | maybe you can use reflection |
| 12:06 | dcolish | alandipert: Its interesting that when I bring the BufferedReader ctor to a higher scope I can use it in composition https://gist.github.com/dcolish/5024597 |
| 12:07 | frozenlock | Really not worth the trouble. If I can't find an easy way, I'll just wing it. I must keep myself from adding too much code :) |
| 12:07 | alandipert | dcolish: yup! nothing stopping you from making an anonymous function around it at the lower scope either |
| 12:07 | frozenlock | I am however looking into the mockito wrappers. |
| 12:07 | tgoossens | i have another idea |
| 12:08 | dcolish | alandipert: actually I tried that and it didnt work |
| 12:08 | frozenlock | Do tell. |
| 12:08 | alandipert | dcolish: e.g. (apply #(BufferedReader. % 10240)) |
| 12:08 | dcolish | hmm |
| 12:08 | alandipert | dcolish: well, no need for apply there even |
| 12:08 | tgoossens | frozenlock: if you are looking at mockite: then "mock(ClassName.class, new Answer(){ // this is what you can use } ") |
| 12:08 | dcolish | ok so i need a reader macro |
| 12:08 | tgoossens | in answer you get all the information about |
| 12:08 | tgoossens | what method was called |
| 12:08 | tgoossens | what arguments it has |
| 12:09 | tgoossens | and what the original method was (which you can still invoke if you like) |
| 12:09 | tgoossens | about my other idea |
| 12:09 | tgoossens | I remember working on a small project |
| 12:09 | arkh | ,(map (fn [x] (concat x '(3 4))) '(1 2)) |
| 12:09 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 12:09 | tgoossens | where I needed to be notified if some operation happened (like addition, array add ,..) |
| 12:10 | tgoossens | A idea we came up with was |
| 12:10 | tgoossens | the idea of breakpoints |
| 12:10 | tgoossens | googling with this information |
| 12:10 | tgoossens | http://stackoverflow.com/questions/1709929/is-there-a-way-in-the-eclipse-debugger-to-be-notified-when-the-state-of-a-java-o |
| 12:10 | tgoossens | this might just help you |
| 12:10 | tgoossens | (but its not going to be easy :p ) |
| 12:10 | frozenlock | Looking now, thanks! |
| 12:11 | arkh | I'm sorry for the silly question but can anybody tell me why my previous map statement doesn't work? |
| 12:11 | tgoossens | if eclipse can do it |
| 12:11 | tgoossens | then you can |
| 12:11 | tgoossens | because eclipse is written in java |
| 12:12 | da-z | tgoossens: problem is, eclipse runs a debugger in that case |
| 12:12 | tgoossens | da-z: hmmyes, in my project that was not an issue but in this case |
| 12:13 | tgoossens | you probably want to say like |
| 12:13 | dcolish | if I crash the clojure compiler, is that considered a bug I should report or does it depend? |
| 12:13 | tgoossens | notifyme(somerandomexistingobject) |
| 12:14 | tgoossens | bleh |
| 12:16 | dcolish | well regardless, it seems that anonymous fn is dropping the BufferedReader type for sample$eval8$stream__9, even with hinting |
| 12:17 | arkh | ,(map #(concat % '(3 4)) '(1 2)) |
| 12:17 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 12:17 | arkh | ^ ? |
| 12:26 | arkh | ,(concat (first {:a 1 :b 2}) (second {:a 1 :b 2})) |
| 12:26 | clojurebot | (:a 1 :b 2) |
| 12:26 | arkh | ,(map #(vector (first %) (second %)) {:a 1 :b 2 :c 3}) |
| 12:26 | clojurebot | ([:a 1] [:c 3] [:b 2]) |
| 12:26 | arkh | ,(map #(concat (first %) (second %)) {:a 1 :b 2 :c 3}) |
| 12:27 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword> |
| 12:27 | arkh | ugh - that's so dumb. I wish I knew what I was missing |
| 12:28 | gfredericks | arkh: your first bit of code ends up calling ##(concat 1 '(3 4)) |
| 12:28 | lazybot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long |
| 12:29 | gfredericks | it's not clear what you're trying to do |
| 12:31 | arkh | gfredericks: it's been a while since I've used clojure - what I'm trying to do is use a map with a function I've defined previously but it gives the error: ArityException Wrong number of args (0) passed to: core$seq clojure.lang.AFn.throwArity (AFn.java:437) |
| 12:32 | arkh | in this instance and in the ones above it seems like I can successfully use maps only sometimes |
| 12:33 | arkh | 'concat' was a placeholder function I was trying to demonstrate with |
| 12:33 | gfredericks | if you use the function map with a map as the second argument, then the map is viewed as a sequence of key-value pairs |
| 12:33 | gfredericks | ,(seq {:a 1 :b 2 :c 3}) |
| 12:33 | clojurebot | ([:a 1] [:c 3] [:b 2]) |
| 12:34 | arkh | ,(let [f (fn [x] (concat x 1))] (map f '(a b c))) |
| 12:35 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol> |
| 12:35 | arkh | why would the above fail? |
| 12:35 | gfredericks | well for one you're passing 1 to concat |
| 12:35 | gfredericks | concat takes sequences and concatenates them |
| 12:35 | gfredericks | 1 is not a sequence |
| 12:35 | arkh | sorry |
| 12:35 | arkh | ,(let [f (fn [x] (concat x '(1)))] (map f '(a b c))) |
| 12:35 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol> |
| 12:36 | gfredericks | now (and before) you're passing 'a to concat |
| 12:36 | gfredericks | which is also not a sequence |
| 12:36 | arkh | I thought I was passing a length 1 list |
| 12:36 | gfredericks | the second argument '(1) is a length one list |
| 12:36 | gfredericks | the first argument is 'a which is a symbol |
| 12:37 | arkh | oh ... |
| 12:37 | arkh | ,(let [f (fn [x] (concat (seq x) '(1)))] (map f '(a b c))) |
| 12:37 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol> |
| 12:38 | gfredericks | you want it to be a single element list? |
| 12:38 | gfredericks | like '(a)? |
| 12:38 | arkh | yes |
| 12:38 | gfredericks | use list instead of seq there |
| 12:38 | arkh | ahhh .. that works |
| 12:39 | arkh | gfredericks: thank you so much |
| 12:39 | pellis | hi guys. i'm looking for interesting pragmatic things to study within clojure. I've played with compojure and lein, but now looking for more. (emphasis - non theoretical lispy stuff) |
| 12:39 | marcellus1 | pellis: incanter? |
| 12:40 | pellis | marcellus1: I'm not that academic either to go with R/incanter, unfortunately... but do go on |
| 12:40 | marcellus1 | pellis: clj-webdriver is fun |
| 12:41 | arcatan | overtone can be fun if you're into that kind of stuff |
| 12:41 | pellis | yup, looks nice. how about processing for clojure? i understand processing always gets a port to a language and it's interesting to see how more readable it is than the original Java impl. |
| 12:44 | da-z | anyone familiar with laser templates to give me a hand ? |
| 12:46 | arcatan | pellis: core.logic seems pretty cool to me, too, but i guess you might consider it pretty theoretical/academic |
| 12:48 | pellis | well, not so much. I'm kinda looking for things I can explore, that I am already familiar with, and most of the stuff I'm familiar with comes from the Web in the form of Ruby, Node, Java, etc. It makes a good learning aid this way. |
| 12:49 | pellis | I started with compojure and ring to make a good comparison with sinatra and rack, which was an enjoyable project. |
| 12:50 | pellis | I tried finding some good image processing libraries unique to clojure out there, but it always ended up lacking and I was forced to shell to imagemagick |
| 12:52 | xeqi | ~anyone |
| 12:52 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 13:14 | pepijndevos | can korma handle timestamps? specifically, assert if a thing is between x and y |
| 13:16 | sjl | How can I get a null byte char in clojure? |
| 13:16 | sjl | \0 is the number 0 (ascii 48) |
| 13:17 | pepijndevos | maybe just (char 0) |
| 13:18 | pepijndevos | there are several thing like \newline and such, but not \null apparently |
| 13:18 | sjl | ah, yeah, that works |
| 13:18 | sjl | thanks |
| 13:18 | pepijndevos | I would have expected \null to work :( |
| 13:19 | sjl | yeah, same here |
| 13:21 | TimMc | ,(int \) |
| 13:21 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 13:23 | sjl | Yeah I noticed that null bytes print as a bare backslash at the repl |
| 13:23 | sjl | ,(char 0) |
| 13:23 | clojurebot | \ |
| 13:23 | sjl | ,(char 13) |
| 13:23 | clojurebot | \return |
| 13:24 | TimMc | Apparently my NUL character didn't make it all the way to clojurebot. |
| 13:24 | sjl | oh nice, CR does have a literal even though it's not mentioned in the docs |
| 13:24 | sjl | wait what |
| 13:25 | sjl | ,(prn-str (char 0)) |
| 13:25 | clojurebot | "\\ |
| 13:25 | TimMc | &(filter #(< 2 (->> % pr-str count)) (map char (range 0 256))) |
| 13:25 | lazybot | ⇒ (\backspace \tab \newline \formfeed \return \space) |
| 13:26 | sjl | (char 0) is fine for me |
| 13:26 | sjl | from http://clojure.org/reader : Characters - preceded by a backslash: \c. \newline, \space and \tab yield the corresponding characters. |
| 13:42 | yedi | can someone help me out with this: https://gist.github.com/yedi/5024984 |
| 13:43 | yedi | i try to create a partial map function and thread a list of maps through it, am i doing it incorrectly |
| 13:47 | rlander | Has anyone used Clojurescript with a language other than Clojure on the backend? |
| 13:49 | rlander | I'm about to rewrite the frontend of an app, a mess of jQuery spaghetti. I want to use Clojurescript, but I won't be able to touch the backend. So I was wondering whether there's any advantage in Clojurescript without a Clojure backend. |
| 13:50 | pellis | question about performance against scala or jruby - why is clojure so fast? given that it is as dynamic as jruby? |
| 13:52 | alandipert | rlander: i have, and i vote go for it |
| 13:53 | pepijndevos | Can I make an INSERT … SELECT with korma? |
| 13:53 | rlander | alandipert: Cool! How'd you structure the project? |
| 13:53 | rlander | alandipert: I mean, did you develop the clojurescript front end as a separate project from the backend? |
| 13:54 | alandipert | rlander: yes it's a standalone lein project using lein-cljsbuild that speaks to a PHP backend |
| 13:56 | alandipert | pellis: for numeric performance, primarily because it doesn't automatically box numbers, thus unlocking a higher degree of JVM optimization |
| 13:57 | pellis | alandipert: i see, how about working with strings? |
| 13:57 | alandipert | pellis: scala numerics fast compared to jruby for same reason afaik |
| 13:57 | alandipert | pellis: yes another aspect of interop/perf is that clj strings are jvm strings without decoration |
| 13:58 | alandipert | pellis: (err, java.lang.String strings) |
| 13:58 | pellis | aha. thats interesting |
| 13:58 | rlander | alandipert: so, just to be clear, the php backend speaks rest and sends no html, correct? |
| 13:58 | alandipert | rlander: that is correct, JSON |
| 13:58 | pellis | im guessing jruby is RString |
| 13:58 | rlander | alandipert: Thanks. I was looking for some kind of validation that this is not a crazy proposition, and now I have it. |
| 13:58 | alandipert | rlander: we actually have an RPC layer called wigwam that does things like preserve/bubble exceptions |
| 13:59 | alandipert | rlander: https://github.com/tailrecursion/wigwam |
| 13:59 | alandipert | rlander: specifically https://github.com/tailrecursion/wigwam#the-rest-of-wigwam but those ideas port to other server-sides, which we are working on |
| 14:01 | rlander | alandipert: wigwam looks a bit like webmachine (which is what I have on the backend). Thanks for the links. |
| 14:01 | alandipert | rlander: sure, happy computing! |
| 14:07 | wei_ | what set of libraries do you use these days to replace webnoir? |
| 14:09 | yedi | is there any scenario where binding a partial fn to a var and using that var would be different than just using the partial-fn without it being defined? |
| 14:09 | yedi | this threading example seems to show some random discrepency: https://gist.github.com/yedi/5024984 |
| 14:13 | wei_ | this post answered my question: http://yogthos.net/blog/33 |
| 14:13 | alandipert | yedi: that partial is evaluated after -> does stuff |
| 14:14 | wei_ | thanks for maintaining ilib-noir, yogthos |
| 14:14 | alandipert | yedi: so it's creating something like (partial <threaded value> map ...) |
| 14:14 | yogthos | wei_: no problem :) |
| 14:14 | yedi | ohhh |
| 14:15 | yedi | alandipert: i think i understand now |
| 14:15 | wei_ | the compojure-template task was key to getting started quickly |
| 14:15 | yogthos | wei_: I've been working on http://www.luminusweb.net/ lately |
| 14:16 | yogthos | wei_: it's got a lot more structured approach to making templates and I've been aggregating documentation there as well |
| 14:17 | wei_ | cool, I'll check it out |
| 14:17 | yogthos | wei_: excellent, also any feedback and suggestions are appreciated :) |
| 14:23 | arrdem | TimMc: last night's bored hack is slowly evolving into an arithmatic type system implementation. what have you done to me? |
| 14:45 | TimMc | haha |
| 14:45 | TimMc | *muahaha |
| 14:46 | TimMc | Make sure to check out the other Clojure type systems before you get too far into your own. |
| 15:00 | arrdem | the fun part is that if I can cleanly define the domain of a predicate as a set the entire set-relational type system I'm creating here falls into place eligantly |
| 15:00 | arrdem | feels a lot like what I've read about Haskell's type system. |
| 15:28 | JoshInc | anybody here implement Business intelligence; analysis, graphs, dashboards and reports provide important mechanisms for performance evaluation and exploitation of information? |
| 15:29 | JoshInc | about daily data captured from municipal systems (Accounting, Tax, Education, Health, etc.). After the data is validated and processed, we need to exploit them, or transform a mountain of data into useful information that can assist the government in its day-to-day. |
| 15:32 | wei_ | using compojure, where's the best place to put the one-time database connection code? |
| 15:32 | arrdem | wei_: typically you will have it in server.clj as part of your init setup |
| 15:34 | arrdem | TimMc: so why isn't this sort of thing in clojure.core? it seems dead easy now that I'm trying to do it. |
| 15:35 | clojure-newb | hi… where can I find dissoc-in for clojure 1.4 ? surprised to not find it :-) |
| 15:38 | arrdem | clojure-newb: http://stackoverflow.com/questions/14488150/how-to-write-a-dissoc-in-command-for-clojure |
| 15:38 | clojure-newb | arrdem: oh… core.incubator, coming in 1.5 ? |
| 15:40 | arrdem | clojure-newb: I would just use the dissoc-in defined there since it isn't in core yet. |
| 15:40 | arrdem | throw it in an "msc.clj" file and :require it in where you need it. |
| 15:40 | clojure-newb | arrdem: thx for heads up |
| 15:41 | arrdem | clojure-newb: well.. it looks like you could just add core.incubator to your project dependancies and use it that way.. |
| 15:42 | arrdem | I'd suggest that approach. |
| 15:42 | clojure-newb | yeah, I'd rather |
| 15:42 | arrdem | technomancy or someone, is core.incubator dead? |
| 15:45 | TimMc | arrdem: Why not in core? Well, probably for philosophical reasons. |
| 15:45 | TimMc | Besides the desire to keep clojure.core small, Rich probably wouldn't like the pseudotypes stuff. |
| 15:47 | gillies | is there an easy way to write json (mocks for testing) instead of doing "{\"foo\":\"bar\"}" |
| 15:47 | gillies | i was thinking maybe a json writing macro, but not sure if thats the way to go |
| 15:48 | TimMc | A macro would be bad. |
| 15:48 | TimMc | Cheshire is a god lib for generating JSON. |
| 15:49 | alandipert | maybe a tagged literal? |
| 15:49 | gillies | i want to actually write it by hand though in this example |
| 15:49 | gillies | not just generate it from clojure data structures |
| 15:49 | TimMc | That seems counter to your original question. |
| 15:50 | gillies | it counters the macro suggestion |
| 15:50 | gillies | but i explicitly said i wasn't sure thats what i wanted |
| 15:51 | gillies | the actual problem is that when i parse json it converts the key data to strings not keywords |
| 15:51 | gillies | i bet theres an option in chesire i can set to change that though |
| 15:54 | gillies | aaah |
| 15:54 | gillies | in README theres an example |
| 15:54 | gillies | derp |
| 16:06 | ravster | hello all |
| 16:10 | tgoossens | Any ideas for a clojure meetup. I'm organising one in belgium (for the first time). I think that an introductory session to the basics is already a good starting point |
| 16:12 | S11001001 | tgoossens: depends on your clojurian/non-clojurian ratio |
| 16:12 | tgoossens | reading the reactions |
| 16:13 | tgoossens | i have the impression that there will be mainly people interested in clojure but not really active in clojure |
| 16:13 | tgoossens | so i guess |
| 16:13 | tgoossens | that they expect something to tell them "what clojure could mean to them" |
| 16:13 | TimMc | tgoossens: Get Sam Aaron to do an Overtone talk, that'll do it. |
| 16:14 | tgoossens | timmc: unfortunately he lives in the uk :) |
| 16:16 | TimMc | Close enough. |
| 16:16 | arrdem | tgoossens: live webcast? |
| 16:17 | arrdem | telepresent presentations are possible after all.. |
| 16:17 | tgoossens | arrdem: that maybe something to consider. Strange I did not think of that ... |
| 16:17 | arrdem | tgoossens: just eliminates a lot of hassle with travel and soforth. |
| 16:20 | arrdem | in retrospect whitespace-mode is a bad idea.. my indentation OCD only gets worse... |
| 16:27 | gillies | &(#=) |
| 16:27 | lazybot | java.lang.IllegalStateException: clojure.lang.LispReader$ReaderException: EvalReader not allowed when *read-eval* is false. |
| 16:27 | gillies | &(doc #=) |
| 16:27 | lazybot | java.lang.IllegalStateException: clojure.lang.LispReader$ReaderException: EvalReader not allowed when *read-eval* is false. |
| 16:28 | arrdem | ,(doc =) |
| 16:28 | clojurebot | "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison." |
| 16:28 | gillies | whats the diff between #= and =? |
| 16:29 | tgoossens | arrdem: a screencast might be something interesting for later iterations of the meetup. But a bit risky for the first iteration I believe :) |
| 16:30 | arrdem | ,(doc =?) |
| 16:30 | clojurebot | Excuse me? |
| 16:30 | arrdem | tgoossens: depends on who your speaker is. |
| 16:30 | arrdem | I agree that in-person would be preferred, but if you get someone awesome a live remote presentation could be OK |
| 16:31 | tgoossens | i'll be sure to discuss it with my co-organisators ;-) |
| 16:42 | muhoo | ,(map (juxt type identity) (let [x 1] `[~x x 'x '~x ~'x])) |
| 16:42 | clojurebot | ([java.lang.Long 1] [clojure.lang.Symbol sandbox/x] [clojure.lang.Cons (quote sandbox/x)] [clojure.lang.Cons (quote 1)] [clojure.lang.Symbol x]) |
| 16:42 | muhoo | ok, why Cons? |
| 16:45 | arrdem | what the... |
| 16:46 | arrdem | muhoo: oh.. the pair (quote 1) is a cons list |
| 16:46 | muhoo | OIC, it's an expression (quote 1), and i guess that's a cons cell, really, a list of 2 items. |
| 16:47 | muhoo | interestingly my repl prints it as '1 not (quote 1), so it was a mystery |
| 16:50 | TimMc | gillies: #= is special reader syntax that you shouldn't use. = is just a function. |
| 16:51 | TimMc | Or rather, clojure.core/= is a var that contains the equality function. |
| 16:51 | gillies | TimMc: i had to use it when i was doing a case statement |
| 16:51 | TimMc | Interesting usage. |
| 16:51 | TimMc | What did you have to create? |
| 16:52 | gillies | (case (class {:foo "bar"}) #=clojure.lang.PersistentArrayMap "blah" ) |
| 16:52 | gillies | just using class name won't work |
| 16:52 | alex_baranosky | has anyone come up with a script to harness Emacs for reformat Clojure files? |
| 16:53 | TimMc | gillies: Ah, classes. You are aware that maps won't always have the same class? |
| 16:53 | gillies | fml |
| 16:53 | gillies | heh |
| 16:54 | TimMc | You may not want case. |
| 16:54 | arrdem | alex_baranosky: http://stackoverflow.com/questions/11423566/how-do-i-intelligently-re-indent-clojure-in-emacs |
| 16:54 | arrdem | |
| 16:54 | clojurebot | Gabh mo leithscéal? |
| 16:54 | arrdem | damnit. |
| 16:54 | clojurebot | Huh? |
| 16:54 | gillies | ~wtf |
| 16:54 | clojurebot | Huh? |
| 16:54 | metellus | |
| 16:54 | clojurebot | excusez-moi |
| 16:54 | arrdem | ~gourds |
| 16:54 | clojurebot | SQUEEZE HIM! |
| 16:55 | alex_baranosky | arrdem: what I want is a way to harness Emacs from a script |
| 16:55 | gillies | heh |
| 16:55 | alex_baranosky | and reformat a list of file by name |
| 16:57 | arrdem | alex_baranosky: your best bet is probably an emacs lisp script to open buffers, envoke the reformat functions and then flush them. |
| 16:57 | alex_baranosky | is there any easy way to call Emacs functions from the command line? |
| 16:57 | arrdem | no. |
| 16:57 | alex_baranosky | lame |
| 16:57 | joegallo | alex_baranosky: --batch |
| 16:58 | arrdem | okay fine emacs -f <code> |
| 16:58 | joegallo | which is to say, yes. |
| 16:58 | alex_baranosky | joegallo: nice. thanks, investigating |
| 16:58 | arrdem | joegallo: why would you ever want --eval, -f, or --batch? |
| 16:58 | alex_baranosky | basically I have script that gives me all the changed files on a feature branch. BEofre pulling into master I want to reformat them using Emacs. |
| 16:58 | arrdem | just seems like a terrible idea. |
| 16:59 | joegallo | arrdem: i have a powerful elisp interpreter right here -- why shouldn't i use it for interpreting elisp? |
| 16:59 | joegallo | alex_baranosky: consider http://www.gnu.org/software/emacs/manual/html_node/elisp/Batch-Mode.html an interesting starting point |
| 17:01 | joegallo | fwiw, the use i've seen is somewhat similar to your use case alex_baranosky, as a pre-commit hook to make sure clojure code is formatted per clojure-mode |
| 17:03 | alex_baranosky | joegallo: yeah that's essentially what we're going for. I am making a script that takes all changed files on a feature brach, slam hounds them, reformats them and then checks them with kinit and eastwood. Then we run that before pulling into master, so we don't have to waste time on fiddling with namespaces and formatting while doing development |
| 17:03 | alex_baranosky | kibit* |
| 17:04 | joegallo | godspeed, if it works out well, that's probably something worth writing a blog post about ;) |
| 17:05 | alex_baranosky | joegallo: good idea about the blog post |
| 17:05 | ryanf | wow, clojure's built-in map is surprisingly complicated |
| 17:11 | meegofl | Hi |
| 17:11 | meegofl | I need help with annoying weird problem |
| 17:11 | meegofl | http://pastebin.com/pXtAUVzj |
| 17:12 | meegofl | in SelectFromTable i call a function ListRecordsMatchConditions |
| 17:12 | meegofl | i print the return value in the ListRecordsMatchConditions and get proper result |
| 17:12 | meegofl | but the print on the calling function is nil |
| 17:17 | frenchyp | meegofl: could it be that you are printing the returned-value from (when setOperation ..) and that it is nil? |
| 17:19 | meegofl | frenchyp: hmm... got a point |
| 17:20 | meegofl | frenchyp: checking this now, 10x! |
| 17:20 | frenchyp | if you are expecting to return tempList, you are going to need to re-design this function |
| 17:20 | frenchyp | cool |
| 17:22 | frenchyp | also, I don't think you need the nil on line 25, you can just remove it |
| 17:28 | alex_baranosky | joegallo: I got it to work actually, except for one issue, the reformatting is messing up the code. I owner if I need to manually switch to clojure-mode for .clj files so it will format correctly |
| 17:37 | joegallo | odd -- have you tried explicitly requiring clojure-mode? |
| 17:38 | joegallo | i dunno how ours does it, it's just always worked... i didn't write it |
| 17:43 | alex_baranosky | joegallo: if I explicitly call (lisp-mode) I get a much better formatting(but still wrong of course). With that as my proof of concept I tried to call (clojure-mode) but for this I get this error: "Symbol's function definition is void: clojure-mode" |
| 17:47 | alex_baranosky | this is what I have so far: https://www.refheap.com/paste/11765 |
| 17:51 | Raynes | alex_baranosky: There is a Bash language setting. |
| 17:51 | Raynes | :p |
| 17:51 | alex_baranosky | :P |
| 17:52 | alex_baranosky | Raynes: I am mere inches from getting this to work |
| 17:56 | alandipert | alex_baranosky: have you considered writing in clojure and using pprint/code-dispatch? |
| 17:56 | alandipert | i've never used code-dispatch myself though so i don't know how it compares to clojure-mode |
| 17:57 | meegofl | how can i perform compare like < > on 2 strings? |
| 17:57 | alex_baranosky | alandipert: I haven't even thought of the idea until you mentioned it |
| 17:57 | meegofl | like (> "c" "b") |
| 17:57 | alex_baranosky | I'm also not sure how print will compare to clojure-mode |
| 17:59 | Raynes | Well... |
| 17:59 | Raynes | You can get the integer representation of characters by doing ##(int \c) |
| 17:59 | lazybot | ⇒ 99 |
| 17:59 | Raynes | So I imagine you could compare those integers. |
| 18:00 | metellus | ,(compare "c" "b") |
| 18:00 | clojurebot | 1 |
| 18:00 | metellus | is that what you want? |
| 18:00 | Raynes | I assumed he actually wanted < and >. |
| 18:02 | meegofl | Raynes: 10x but is there a way (maybe import from java / clojure.string) to do it on strings? |
| 18:03 | Raynes | compare |
| 18:03 | Raynes | What metellus just did is what you want. |
| 18:03 | Raynes | &(compare "a" "b") |
| 18:03 | lazybot | ⇒ -1 |
| 18:03 | Raynes | &(compare "b" "b") |
| 18:03 | lazybot | ⇒ 0 |
| 18:03 | Raynes | &(compare "b" "a") |
| 18:03 | lazybot | ⇒ 1 |
| 18:04 | meegofl | Raynes: got it! 10x! |
| 18:04 | Raynes | Negative number = less than, 0 = equal to, positive number = greater than. |
| 18:12 | terom | Hmm, I'm trying to override a method with proxy. This method gets called in the base class constructor. It seems that the base class constructor calls the base class method, not the method defined in proxy. Is this a limitation of proxy or a bug? |
| 18:18 | Natch | anyone on OSX that could tell me the result of (subs (System/getProperty "os.name") 0 3) ? |
| 18:18 | ibdknox | "Mac" |
| 18:19 | Natch | ibdknox: thank you |
| 18:22 | TimMc | I just wrote a little library function to do paging calculations: https://www.refheap.com/paste/11770 (given a total and current page, tell you whether there's a next page, what the last page index is, etc.) |
| 18:22 | TimMc | Are there any other properties it should compute? |
| 18:36 | joegallo | alex_baranosky: i think you need to (require 'clojure-mode) |
| 18:36 | joegallo | otherwise it wouldn't be defined... |
| 18:37 | Raynes | TimMc: That seems large for paging calculations. |
| 18:54 | johnmn3 | feb 20th New York CLUG: |
| 18:54 | johnmn3 | David Bergman will demo his ClojureScript wrapper for the cross-target mobile platform Titanium, which allows developers to write native mobile apps for iPhone, Android, Blackberry in Clojure. |
| 18:54 | johnmn3 | where can I get to that wrapper? |
| 19:09 | devth | is there a function that wraps another fn foo, making "foo" behave as identity? |
| 19:10 | devth | reasoning: run foo for its side-effects (e.g. swap!) but still make it useful for (comp bar foo) |
| 19:22 | TimMc | Raynes: It's intended to support a paging widget on a web page. |
| 19:32 | terom | I made a gist of my problem with proxy: https://gist.github.com/tmatinla/5026427 - from the doc for proxy ("creates a instance of a proxy class") I would think that the overridden method would be taken into account in constructor, but it is not... |
| 19:36 | alandipert | terom: does it in java? |
| 19:36 | alandipert | terom: i vaguely remember seeing that somewhere as a java no-no |
| 19:36 | alandipert | terom: calling overridable methods in a constructor, that is |
| 19:37 | terom | alandipert: it does, see the gist |
| 19:40 | terom | alandipert: yeah, it's probably bad practice, in my case it's some library code (Apache HttpClient to be specific) that needs to be overridden to plugin some special behaviour |
| 19:41 | terom | I would have hoped not to write Java code for that, but in this case it's not a big problem (or maybe I can use gen-class instead of proxy if that's not too tedious). I was just wondering if this behaviour with proxy is correct... |
| 19:46 | qizwiz | consider me a newbie to clojure (though I've played with other lisps). I'm going through 4clojure koans. On #19 (http://www.4clojure.com/problem/19#prob-title), the answer I came up with was #(first (reverse %)) |
| 19:47 | qizwiz | with some help from stackoverflow. The question I have is what does '#(' mean? |
| 19:47 | ryanf | what's the best testing setup for clojure? lazytest? |
| 19:47 | ryanf | or does everyone just use clojure.test? |
| 19:48 | ryanf | I'm most interested in having the tests run automatically on file modification, and then I'm also kind of interested in bdd-style syntax if available |
| 19:48 | qizwiz | I've searched sharp-paren, hash-paren, pound-paren. |
| 19:48 | terom | qizwiz: it's a shorthand for anonymous function |
| 19:48 | qizwiz | ah! |
| 19:48 | qizwiz | thank you |
| 19:49 | alandipert | ryanf: midje may float your boat, i think it does that stuff https://github.com/marick/Midje |
| 19:50 | ryanf | cool, thanks for the tip |
| 19:50 | alandipert | terom: you're at the point where i'd personally give up write java stub |
| 19:51 | alandipert | *and write |
| 19:51 | qizwiz | and now i've found it here: http://clojure.org/reader |
| 19:51 | qizwiz | thanks |
| 19:51 | terom | alandipert: yeah, that seems the easiest way |
| 20:03 | Raynes | ryanf: https://github.com/Raynes/laser/blob/master/test/me/raynes/laser_test.clj is a simple midje example. |
| 20:04 | ryanf | cool, thanks. seems like pretty nice syntax |
| 20:08 | arrdem | would anyone use static typechecking for pseudotypes? I'm just contemplating the evil I must commit to implement such checking and questioning its worth. |
| 20:09 | Raynes | ryanf: My tests look a little funky because I'm testing higher order functions and thus have to call the functions that the functions return (and thus I end up with ((foo x) bar) => y in a lot of places). |
| 20:29 | ryanf | can anyone think of a reason that I would sometimes get "CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character" for this code: |
| 20:29 | ryanf | https://gist.github.com/rf-/76ff8e83d0038f42cb49 |
| 20:29 | ryanf | oh never mind |
| 20:29 | ryanf | I am a huge idiot |
| 20:35 | Zerker | I saw a comic once, which outlined the "Idiot test": a) Grab a coworker, b) explain to them what your code is doing, step by step, c) loudly proclaim "I'm an idiot!" and proceed to fix your program. |
| 20:35 | Zerker | Don't worry, we've all been there :) |
| 20:47 | Raynes | Welp. Just released https://github.com/Raynes/laser 1.0.0 |
| 20:48 | TimMc | schweet |
| 20:48 | TimMc | Maybe I'll try using it for my new gallery website. |
| 20:48 | TimMc | I've got it set up pretty nicely with Enlive right now. |
| 20:48 | TimMc | Oh hey, thoughts on two different if-let+ macro implementations? https://www.refheap.com/paste/11773 |
| 20:49 | TimMc | One wraps the else-clause in a thunk and emits multiple calls for the multiple else locations, the other just spits out the else-expression in its entirety for each else clause. |
| 20:49 | TimMc | *else-expression in a thunk |
| 20:59 | ryanf | I feel like there must be a more idiomatic way of doing this? |
| 20:59 | ryanf | (assoc world :players (conj (world :players) player)) |
| 21:00 | warz | with ring, i have some middleware that checks for an access token header, and if it doesn't exist it returns an http error. right now, i wrap the entire handler with this middleware, so all requests are subject to those constraints. |
| 21:01 | warz | but in reality id like this to be more opt-in on a per route handler basis |
| 21:01 | warz | is that possible? like wrap a single handler with a middleware? |
| 21:01 | Raynes | ryanf: (update-in word [:players] conj player) |
| 21:01 | Raynes | ryanf: Except I meant world, but you get the point. |
| 21:01 | ryanf | Raynes: !! thanks |
| 21:01 | weavejester | warz: Yes, that's the whole point of Compojure - it's handlers all the way down. |
| 21:02 | TimMc | Raynes: The examples in the Laser readme would probably benefit from a note about alternating selectors and transformers. |
| 21:03 | Raynes | TimMc: Pull request! :D |
| 21:05 | TimMc | maaaybe |
| 21:06 | TimMc | Oh, I can just edit right in the browser, yeah? |
| 21:06 | Raynes | Yep. |
| 21:06 | Raynes | Github <3 |
| 21:18 | Raynes | TimMc: o/ |
| 21:19 | akhudek | I'm running into some trouble with clojurescripts advanced compilation. There is a missing extern, but I'm having trouble tracking down what it is. Is there any trick to debugging these types of errors? |
| 21:20 | Raynes | Yeah, source maps I think. Which we do not have. |
| 21:20 | akhudek | :-( |
| 21:36 | TimMc | "Merge made by octopus." fills my heart with glee. |
| 21:36 | clifton | watching a Guy Steele talk from 2009. Clojure's list type, by default, is a 64-ary tree? |
| 21:36 | headshot | clifton: url? |
| 21:37 | clifton | http://vimeo.com/6624203 |
| 21:37 | clifton | he only mentions clojure toward the very end |
| 21:37 | TimMc | clifton: Vectors are 32-way trees, but I think all lists are linked lists. |
| 21:38 | clifton | yeah, i assumed all lists were linkedlists ala lisp |
| 21:38 | clifton | and i know vectors are 32-ary trees currently, so i assume he was talking about vectors and not lists, but in the slide it does say list |
| 21:42 | TimMc | You could do some archaeology in the Clojure source control. Maybe lists used to be implemented with trees. |
| 21:43 | TimMc | However, I'd think that lists have an implicit contract that if you don't hold onto the head, the head can be GC'd. |
| 21:43 | TimMc | I could be wrong, but I imagine any other behavior would surprise quite a few folks. |
| 21:46 | clifton | well, you're definitely right, that is a fundamental property of lists |
| 21:46 | clifton | given that calling last on a list is in linear time, ill just assume he was talking about vectors |
| 21:46 | clifton | fast forward to 56m in the link |
| 21:47 | clifton | made me scratch my head |
| 21:47 | TimMc | Can't do videos at the moment. |
| 21:51 | headshot | clifton, thanks, looks like an intersting watch |
| 21:52 | clifton | yeah it's a really fascinating talk, i had to pause a few of the slides to fully parse all the operations, but hey, that's the advantage of watching lectures online |
| 21:52 | headshot | yeah "pause" is invaluable |
| 21:56 | Sgeo_ | What talk? |
| 21:56 | ivan | <clifton> http://vimeo.com/6624203 |
| 21:56 | clifton | ption: EOF while reading> |
| 21:56 | clifton | 17:51 < bendlas> ,(unchecked-multiply (Long. 0xcafebabe) 0xcafebabe) |
| 21:56 | clifton | 17:51 < clojurebot> #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 21:56 | clifton | 17:52 < hiredman> bendlas: unchecked math only works on primitives |
| 21:56 | clifton | 17:52 < bendlas> this is a bug, right? |
| 21:56 | clifton | 17:52 < amalloy> ,(unchecked-multiply (unchecked-int 0xcafebabe) (unchecked-int 0xcafebabe)) |
| 21:56 | clifton | 17:52 < clojurebot> 790811295510209796 |
| 21:56 | clifton | 17:52 < bendlas> so unchecked multiply defaulting to checked multiply when faced with boxed values is a feature? |
| 21:56 | clifton | 17:53 < TimMc> That's surprising and unexpected behavior. |
| 21:56 | clifton | 17:53 < Frozenlock> Is there some css and compojure functions to pretty-print clojure code in a webpage? (with colors and all that sweet stuff) |
| 21:56 | clifton | 17:54 < hiredman> bendlas: I doubt anyone has bothered to care because most people who want one want the other |
| 21:56 | ivan | clifton: might want to kill your client, could take a while to send all that |
| 22:15 | headshot | hehe, i love his comment on Fortress |
| 22:15 | clifton | which one? |
| 22:16 | jcromartie | why would I want to use clojure.data.xml over clojure.xml |
| 22:16 | headshot | about heavy use of operator overloading, and hoping for tasteful use |
| 22:17 | clifton | some part of me wonders why his team wouldnt be better spent extending haskell |
| 22:17 | jcromartie | (for reading XML into a Clojure data structure) |