#clojure log - Apr 16 2011

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 justinlilly: jars are just zip files + metadata.

0:00 chewbran1a: doesn't seem to work for me, $ zgrep couch lib/clojure-couchdb-0.4.7.jar returns nothing

0:03 justinlilly: disappointing :-/

0:30 amalloy: justinlilly, chewbran1a: zgrep passes its options straight along to gunzip, whish probably assumes gzip encoding unless you pass it a zip option

0:30 justinlilly: interesting. man page says "passes its options along to grep" or somesuch, iirc.

0:31 from manpage: All options specified are passed directly to grep.

0:31 amalloy: oh sorry. guess i misread

0:31 but it definitely supports zip encoding

0:31 justinlilly: best I could come up with was grep -a (which assumes its text format, not binary)

0:31 doesn't work very well though.

0:31 amalloy: if you find the right option

0:32 justinlilly: brief googling turned up unarchive, grep, rearchive :-P

0:32 amalloy: ewwww what

0:33 but i guess the zip format is pretty crippled. maybe that makes sense

0:40 Apage43: man

0:40 zip

0:41 i hope if i create one of the most widely used file formats in existence that i don't die alone in a hotel room of alcohol poisoning.

1:13 amalloy: Apage43: that's probably a good thing to hope for whether or not you create any file formats at all

1:14 Apage43: it's not likely, at any rate. I'm not really into alcohol much.

1:16 file formats though I might dabble in too much sometimes.

1:16 carllerche: is there a function that wraps a value in a seq unless it already is in one?

1:25 amalloy: $findfn 1 [1]

1:25 sexpbot: [clojure.core/xml-seq clojure.core/vector clojure.core/list]

1:25 amalloy: looks like no built-ins

1:26 carllerche: how does findfn work?

1:26 amalloy: carllerche: how is it implemented, or how do you use it?

1:26 carllerche: well, both I guess... is there a local version?

1:26 i'm still finding the API docs a bit hard to manage

1:27 amalloy: no, joshua__ and i wrote it for sexpbot. mec cloned sexpbot and pulled it out into something local, but i haven't looked into it

1:27 carllerche: since I still barely know the landscape

1:27 amalloy: the syntax is $findfn arg1 arg2... result

1:28 he tries (f arg1 arg2...) on every function he knows about and sees which ones end up giving you the result you want

1:28 $findfn inc [1 2 3] [2 3 4]

1:28 sexpbot: [clojure.core/map clojure.core/keep]

1:28 carllerche: something like: (defn wrap [x] (if (coll? x) x [x]))

1:30 amalloy: carllerche: and feel free to /msg sexpbot anything you want to try out

1:31 carllerche: nice

1:32 amalloy: of course findfn is pretty primitive: it can't figure out inc from $findfn map [1 2 3] [2 3 4], because you need to pass inc as an argument, not call it. but for simple stuff it helps you find your way around, and discover occasional gems

1:33 $findfn [1 2 3] [3 2 1] ; cause i forget what rseq is called

1:33 sexpbot: [clojure.core/rseq clojure.core/reverse]

1:33 carllerche: heh, that's cool

1:34 amalloy: hm?

1:34 clojurebot: hmm, maybe my repl is out of wack

1:34 amalloy: clojurebot: forget hm

1:34 clojurebot: hmm, maybe my repl is out of wack

1:34 amalloy: bah

1:34 technomancy: clojurebot: forget hmm, maybe my repl |is| out of wack

1:34 clojurebot: I forgot that hmm, maybe my repl is out of wack

1:34 amalloy: ah

1:34 technomancy: (since it allows arbitrary verbs)

1:35 amalloy: clojurebot: hm?

1:35 clojurebot: Pardon?

1:35 amalloy: hooray

2:31 joshua__: technomancy, what |is| that hmm thing you guys were just messing with?

2:42 chewbran1a: anyone have a recommendation for parsing a large xml file? running xml-seq on a 1gb file and hitting MemoryError: GC overhead limit exceeded

2:45 mreynolds: chewbran1a: Are you doing something like this : http://www.chrisumbel.com/article/clojure_xml_parsing_xml-seq ?

2:48 chewbran1a: mreynolds: basically doing: http://stackoverflow.com/questions/1194044/clojure-xml-parsing/1195568#1195568

2:50 mreynolds: chewbran1a: Unfortunately I'm struggling with a similar problem and am no expert. I can say that what I've read would indicate that you might be holding on to a portion of the sequence. Also, that question was answered in 09 and might be a bit dated versus the new sequence code. Do you know what objects are being held on to?

2:51 chewbran1a: mreynolds: just stumbled upon this: https://groups.google.com/forum/#!topic/clojure/Nlynqq-NVbc

2:51 looks like xml parse loads the whole doc

2:52 mreynolds: ouch

2:53 chewbran1a: that last link points to a library: https://github.com/marktriggs/xml-picker-seq that is apparently designed for processing large xml files

2:54 mreynolds: chewbran1a: makes sense with the 'seq' on the end

2:54 chewbran1a: good luck :) Let me know if it works

2:54 chewbran1a: mreynolds: will do

3:11 mreynolds: Is there a way to shorten the printing of a.b.c.d/keyword (used as ::keyword) to just ::keyword?

3:17 amalloy: mreynolds: i don't think you'd really want that. the printed value would stop being correct if you changed namespaces

3:18 mreynolds: amalloy: Not sure what you mean. I'm not trying to get rid of the namespace in the code, just on console when I print it out? I understand that just using :keyword vs ::keyword looses the namespace, and thus the comparison capabilities.

3:18 amalloy: Right now I have a ton of records with "a.b.c.d" in them and it's filling my screen. Just want to trim it down a bit.

3:20 amalloy: meh. i'm probably being too dogmatic, but i like that when clojure prints a value V to string S, it can be read back in as the same V, and will compare equal to other objects that print as S

3:21 mreynolds: amalloy: Oh, I agree if I was using it in a programmatic fashion. At the moment this is just for debugging.

3:22 amalloy: anyway, i don't think there really is. if there were, there would be some global variable you could set! to make keywords change their behavior

3:22 mreynolds: looks like it might be this : http://clojuredocs.org/clojure_core/1.2.0/clojure.pprint/*print-suppress-namespaces*

3:23 ... but I just realized the reason I was printing that thing was because of forcing the evaluation, so lemme fix that bug first

3:37 Alright, I'm stuck on the classic "when I print it, it works; when I don't print it, it doesn't work" bug. Is there a doc I can read to help explain this better? I've been futzing around with (do) for far too long with no results.

3:37 (bug here is in my code, in case I didn't state that clearly)

3:58 hiredman: ,(doc condp)

3:58 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i...

4:15 amalloy: mreynolds: do is not really much help laziness-wise. you probably want to look at dorun, doall, or doseq

4:33 mreynolds: amalloy_: Yeah, thanks. As it turns out, I re-read through my code and realized I was using (do...) correctly, but in the wrong place. Adding a doseq in place of a for loop appears to have fixed the problem.

4:34 I'm actually pretty stoked at being able to convert my "for loop" style code to a lazy sequence. It's very elegant to be able to do that.

5:03 chewbran1a: awesome!! got buffered xml parsing working with xml-picker-seq and xom.. good times

5:04 mreynolds: What ended up working?

5:04 chewbran1a: mreynolds: just had to port over to using the xom wrapper with a buffered reader

5:04 mreynolds: chewbran1a: nice :)

5:10 chewbran1a: http://paste.lisp.org/display/121545

5:10 if anyone is around is bored, I would be happy to hear suggestions or comments on that code

5:10 mreynolds: chewbran1a: Does it perform the same without the type hint?

5:12 fliebel: chewbran1a: Does duck-streams offer any advantage over clojure.java.io/reader?

5:12 chewbran1a: yeah I imagine the type hit isn't necessary, it only creates the reader once, although I honestly have no idea, this is the most complicated piece of clojure I've written yet, so still very new to things

5:13 fliebel: chewbran1a: I think you could clean up that nested bit a lot with ->>

5:13 chewbran1a: fliebel: its a clojure contrib library that just facilitates giving you streams to work with

5:13 fliebel: http://richhickey.github.com/clojure-contrib/duck-streams-api.html

5:13 fliebel: chewbran1a: So does clojure.java.io

5:14 ejackson: morning, morning.

5:14 fliebel: ejackson: mornng

5:14 http://clojure.github.com/clojure/clojure.java.io-api.html

5:14 chewbran1a: fliebel: I'm not familiar with ->> and I'll have to take a peek at clojure.java.io

5:14 tomoj: does duck-streams even exist anymore?

5:15 oh, yep

5:15 chewbran1a: its used in the lib: https://github.com/marktriggs/xml-picker-seq that is the wrapper around xom I'm using, so I just went with duck-stream

5:15 main issue was processing a gig of xml without overflowing GC/memory

5:16 tomoj: there's also clojure.contrib.io

5:16 confusing...

5:16 fliebel: chewbran1a: ##(->> (range 10) (map (partial * 2)) (apply str) reverse println)

5:16 sexpbot: ⟹ (8 1 6 1 4 1 2 1 0 1 8 6 4 2 0) nil

5:16 chewbran1a: which this is churning along on now with utilization, much better than before

5:17 fliebel: oh niiiiice

5:17 yeah that would have helped a lot

5:17 when was that introduced?

5:17 fliebel: chewbran1a: -> threds at the first argument ->> threads at the last one.

5:18 tomoj: &(:added (meta #'->>))

5:18 sexpbot: ⟹ "1.1"

5:18 fliebel: &(:added (meta '->>))

5:18 sexpbot: ⟹ nil

5:18 clojurebot: ⟹ "Returns the metadata of obj, returns nil if there is no metadata."

5:18 fliebel: lol

5:19 chewbran1a: fliebel: very cool, I'll port over to that and clean up the code a bit

6:20 fliebel: I don't know what to think of this… Is it just that Clojure infected my brain, or is it silly to use a class for containing mouse buttons? https://github.com/pepijndevos/pyMouse/pull/8/files

6:25 mids: lacking symbols (I think), this seems like a fair way to do an enumeration in .py

6:28 alternative might be using string literals (which are interned by default)

7:58 peteriserins: is it possible to prevent stack overflow for this function while preserving the same style? (def memo-fib (memoize #(if (< % 2) 1 (+ (memo-fib (dec %)) (memo-fib (- % 2))))))

7:59 fliebel: $mail stuartsierra It just occurred to me the you can't observe a certain type of events in cljque like you can in Swing. Useful?

7:59 sexpbot: Message saved.

8:01 fliebel: peteriserins: Same style? I don't think so. The way to avoid stackoverflow is to use looping, or looping that looks like TCO.

8:02 hiredman: 'interative' vs. 'recursive'

8:02 peteriserins: fliebel: but why does the stack overflow appear for a memoized function?

8:02 fliebel: oh I see, maybe I should precompute the first few values in sequence

8:03 fliebel: peteriserins: How does memoizing help here?

8:03 peteriserins: fliebel: yep, it worked

8:05 fliebel: I'll pastebin in a moment

8:05 fliebel: peteriserins: As I see it, the result would only be memoized after the recurring, because before that, no function returns.

8:06 peteriserins: yep, http://pastebin.com/MAEsKSjM

8:09 fliebel: peteriserins: Run it with 2000, you just postponed the problem.

8:09 peteriserins: fliebel: works for me; are you setting the first 1000 to 2000 as well?

8:10 fliebel: peteriserins: Ah, I see what you're aiming at. Yes, if you do it that way, it works.

8:12 You could increase step a whole lot. (range 1 1000 100)

8:13 peteriserins: fliebel: oh right, step could pretty much be the stack overflow treshold

8:14 fliebel: but one might have to do those values in pairs of adjacent numbers

8:14 fliebel: peteriserins: Why?

8:15 peteriserins: fliebel: so that it can have enough memoized values without going from 1000 to 1

8:16 fliebel: peteriserins: Also, why would you want to store every fib number from 0 to the highest computed so far? Just the last 2 would do, right?

8:16 peteriserins: fliebel: as long as I need only successively higher ones

8:16 fliebel: but say I want some sparse set, I have to keep intermediates

8:17 fliebel: okay...

8:19 peteriserins: then again if I wanted random big numbers, I'd probably just do matrix exp

8:19 fliebel: peteriserins: Why do you want fib numbers anyway? Some Euler problem?

8:20 peteriserins: fliebel: yes Euler problem, but I actually want the totient function, I was just experimenting with fibs

8:20 raek: peteriserins: another way to implement a sequence of numbers like this is to represent them as a lazy sequence. this solves the problem of recursive calls, but does not "preserve the style".

8:21 peteriserins: raek: for the totient function, I'd need to refer to arbitrary indices not just a few previous

8:21 but this approach seems to take up a lot of space, so I don't think it'll work

8:23 I was basically hoping to find a more clojuresque way of doing dynamic programming than making a mutable array a la C

9:29 Borkdude: I am using a wrap-reload handler in compojure

9:29 I am expecting that it only reloads when the source file changes, but it reloads with every request even when nothing changed

10:24 Borkdude`: Trying lein ring now

10:24 and I keep getting this exception:

10:24 Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<ini

10:24 t>(I)V (war.clj:1)

10:26 Project.clj here: http://pastie.org/1800713

10:33 dnolen: Borkdude`: that usually means you have some compiled lib that doesn't match the Clojure version.

11:52 Borkdude`: Ah it was probably a conflict between lein-run and lein-ring

11:58 TimMc: Huh, I thought I would get Double/POSITIVE_INFINITY if I did (/ 0.0)

12:23 SergioTapia: Hi Clojure community.

12:23 I'm mainly a .NET/Ruby developer and I'd like to start branching out a bit and learn about functional programming. What book would you recommend for someone that knows how to program, but wants to learn about Clojure and what it's used for?

12:24 Borkdude`: The Joy of Clojure

12:24 also see this (my) thread on SO: http://stackoverflow.com/questions/2578837/comparing-clojure-books

12:25 SergioTapia: Thanks, let me get some coffee and take a look. I tried Raynes try-clojure website and the syntax for the language is kind of freaky! in a good way.

12:25 (+ 2 2) Hehe :) I like how you can nest different anonymous methods and works with the resutls.

12:25 clojurebot: 4

12:25 Raynes: SergioTapia: The Joy of Clojure is a fantastic book, but you probably want to start with Practical Clojure and /then/ read The Joy of Clojure.

12:26 SergioTapia: Raynes! LOL you're here?!

12:26 You're raynes from DIC right?

12:26 Raynes: Yes, and I'm always here. :)

12:27 SergioTapia: Hahaha, great. Expect me to ask a LOT of questions about the language. :D By the way, great site: try-clojure

12:27 Raynes: <3

12:28 tufflax: SergioTapia I recommend you read the docs on clojure.org, I read 2 books and the docs, and I think I learned the most from reading the docs

12:28 SergioTapia: Nah - I despise reading docs from top to bottom. :x I prefer a book with a more linear learning path.

12:28 From there I can branch out to topics that interest me.

12:28 tufflax: Ok :)

12:28 Raynes: Right, the docs are fantastic, but aren't organized in a linear for-beginners way.

12:28 Borkdude`: SergioTapia: if you need to search the docs, clojuredocs.org is a great site

12:29 SergioTapia: Also: I'm going to be using Eclipse with the CounterClockwise plugin. *ducks*

12:29 Read about it here: http://learn-clojure.com/get_clojure.html

12:29 Raynes: SergioTapia: Nothing to duck for. Plenty of people use that.

12:30 Most Clojurians use Emacs and Vim is a close second, but those aren't the only valid options. :>

12:30 SergioTapia: I WISH I could use Emacs, but I need the autocomplete at first. to get a feel for the language.

12:31 Raynes: SLIME does autocomplete, methinks. Not sure exactly how it works. I don't think I've ever used autocomplete in any language.

12:31 Borkdude: SergioTapia: you can do it, but it will just be a matter of time before you start using emacs for irc ánd clojure programming.. *ducks*

12:31 rcg: Raynes: when you say vim.. whats the setup of choice for developping clojure with vim.. already found some tutorials out there but just want another opinion

12:31 Raynes: rcg: VimClojure. http://dev.clojure.org/display/doc/Getting+Started There is a page for it here.

12:32 SergioTapia: Raynes: So how do you know what class offers what? Or how do you see a method signature? Do you just commit them to memory?

12:32 rcg: Raynes: ah sweet, thanks..

12:32 SergioTapia: Coming from .NET/Ruby, the main benefit of having autocomplete for me, was seeing what fit where when working on larger projects.

12:32 * Raynes lols at your use of the word 'class'.

12:33 Borkdude: Raynes: class? aaah, it buuurns ;-P

12:33 Raynes: Well, Clojure has neat tools for finding documentation and such.

12:33 &(doc println)

12:33 sexpbot: ⟹ "([& more]); Same as print followed by (newline)"

12:33 Raynes: &(find-doc "print")

12:33 sexpbot: ⟹ ------------------------- clojure.contrib.pprint/*code-dispatch* [[object]] The pretty print dispatch function for pretty printing Clojure code. ------------------------- clojure.contrib.pprint/*print-base* nil The base to use for printing integers and rationa... failed to gist: Connection reset

12:33 Raynes: Well, you see the point.

12:33 (notes that it failed because the gist was too large.

12:34 ) ; closes his parentheses.

12:34 tufflax: :)

12:34 SergioTapia: Ok, so you have that. I guess I'll have to see it in action

12:35 Raynes: You'll find that things are easier to remember in Clojure because of the lack of complexity.

12:35 Things tend to be simple.

12:36 SergioTapia: From the very small lines of code I've seen I really like the way you can pipeline statements. It feels very similar to Linq in how you can chain results with new actions.

12:36 Feels very very slick.

12:36 tufflax: "statements", what is that?

12:37 Raynes: tufflax: Be gentle. He has yet to learn our terminology. ;)

12:37 * Raynes is off.

12:38 SergioTapia: What do you call statements in clojure? This is a statement in C#/Ruby: x = 1 + 2;

12:38 TimMc: SergioTapia: I assume you are referring to how functions can be composed? e.g. ##(first (drop-while (partial < 5) (range 10)))

12:38 sexpbot: ⟹ 0

12:38 tufflax: SergioTapia: In clojure there are special operators, macros and functions

12:39 TimMc: err, ##(first (drop-while (partial > 5) (range 10)))

12:39 sexpbot: ⟹ 5

12:39 SergioTapia: So statement = function?

12:39 "Everything is a first class function" I read somewhere.

12:39 tufflax: let in a s.o., while is a macro, and + is a function

12:39 TimMc: SergioTapia: A statement changes state. :-)

12:39 tufflax: SergioTapia well, there are also special operators and macros, so that's not quite true

12:39 Borkdude: SergioTapia: often in C# statements are actually expressions of which you ignore their results

12:40 TimMc: Clojure avoids that in most of the code.

12:40 SergioTapia: There's a lot of wooshing going on in my room right now. I'll read the book and come back to ask any questions I might have. :)

12:40 * SergioTapia is off.

12:40 Borkdude: SergioTapia: in Clojure everything is an expression, like (+ 1 2 3) is the expression which evaluates to 6

12:41 (+ 1 2 3)

12:41 clojurebot: *suffusion of yellow*

12:41 Borkdude: #(+ 1 2 3)

12:41 how does this work nowadays?

12:41 &(+ 1 2 3)

12:41 sexpbot: ⟹ 6

12:41 tufflax: , or &

12:41 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/or

12:42 Borkdude: then what is ## for? I saw it used somewhere

12:42 tufflax: dunno

12:42 Borkdude: can you ask clojurebot for help?

12:42 or sexpbot?

12:42 mrBliss: You can use ##(+ 1 1) for evaluating expressions in the middle of a sentence.

12:42 sexpbot: ⟹ 2

12:42 tufflax: probably, don't know exactly

12:43 how

12:43 Borkdude: sexpbot help

12:43 ,(help)

12:43 clojurebot: java.lang.Exception: Unable to resolve symbol: help in this context

12:43 Borkdude: ;-)

12:48 Raynes: Borkdude: ##(println "is for embedded code. Unfortunately, you can't ask him for help on this.")

12:48 sexpbot: ⟹ is for embedded code. Unfortunately, you can't ask him for help on this. nil

12:52 SergioTapia: So I find a guide on how to install the CounterClockwise addon and it's pretty awesome. Guess who wrote it?

12:53 http://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+Counterclockwise

12:53 :D

12:54 Raynes: SergioTapia: I didn't write that.

12:54 SergioTapia: Clojure's wiki used to be on Assembla. When they moved to confluence, I moved all of those pages to there, so it has my name on it.

12:55 SergioTapia: Bummer. Still, I found it. ;)

12:55 &(+ 1 2 3)

12:55 sexpbot: ⟹ 6

12:56 SergioTapia: &(println ("I'm actually built with Java."))

12:56 sexpbot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

12:56 SergioTapia: NOOOOOOOOOOooooooo

12:56 Still learning. :)

12:56 markoman: what does this mean: clojure.lang.IFn?

12:57 SergioTapia: I think a IFn is an anonymous function.

12:57 Raynes: markoman: Something that is an IFn. A Clojure function. He wrapped a string in parentheses, so it tried to call the string, but the string isn't a function, so boom.

12:57 markoman: im getting that error every while and then

12:58 SergioTapia: Testing...

12:58 &(println "I'm actually built with Java.")

12:58 sexpbot: ⟹ I'm actually built with Java. nil

12:58 SergioTapia: Why did it add nil?

12:59 markoman: ,(println "I'm actually built with Java.")

12:59 clojurebot: I'm actually built with Java.

12:59 Raynes: SergioTapia: Because everything in Clojure has to return something. Even if it's only nil. Since println does side-effects and has no meaningful value to return, it returns nil.

12:59 The text is what println prints and nil is what it returns.

13:00 clojurebot apparently throws away the return value. Not sure why.

13:01 SergioTapia: I see.

13:01 OK, I'm out. Be back later on tonight for some Clojure coding and reading. This is really different to anything I've ever used before.

13:01 Raynes: Your mind. It'll be blown.

13:01 Have fun.

13:01 markoman: :)

13:02 SergioTapia: Also, worth throwing it out there out of interest. Have any of you guys tried F#? Have you noticed any shortcomings with the language compared to other FP langs such as Clojure and Erlang?

13:02 * SergioTapia leave the building for a while. :)

13:02 Raynes: I played with F# when it first came out. No real opinion on it or OCaml.

13:12 Borkdude: I tried F#

13:28 ataggart: with the advent of non-dynamically-rebindable vars, are there any naming conventions for them?

13:29 TimMc: ataggart: I would think that the naming conventions are more necessary for rebindable vars.

13:30 i.e., vars are assumed to be static most of the time anyway

13:30 ataggart: TimMc: yes, but we already have those, namely earmuffs, thigns without earmuffs are generally functions. Just wondering if there was a community standard for non-function vars that cannot be rebound

13:30 I'd almost call them constants

13:31 oh well, I'll just omit the earmuffs

13:31 pdk`: did people really rebind vars that often before anyway

13:31 cause that's just ugly

13:33 ataggart: *out* gets rebound all the time

13:34 seancorfield: *db* iin c.c.sql too I believe?

13:35 SergioTapia: Guys, do you use Linux? I have a question not really related to Clojure maybe you could help.

13:35 I have a .rar I need to unrar, and I install 7Zip via the software center in Ubuntu 10. However, there is no 7zip context menu when I right click on the file. :S

13:36 Vinzent: i think you should install unrar

13:36 seancorfield: yup, just confirmed *db* for c.c.sql (had to go look in internal.clj)

13:36 TimMc: SergioTapia: You coudl use Open With, or maybe launch 7zip separately and use File-> OPen.

13:37 SergioTapia: Hm... Open With > Doesn't show me 7zip anywhere.

13:37 And I can't find 7zip in the Applications bar up top.

13:37 Any other suggestions?

13:37 seancorfield: sudo locate 7zip

13:37 Vinzent: ataggart, there is +constant+ convention in CL, but cI've never seen it in clojure code

13:37 seancorfield: that should tell you where it's hiding

13:38 (def +answer+ 42) ;; not sure i like that :(

13:38 SergioTapia: [sudo] password for papuccino1:

13:38 /usr/share/app-install/desktop/7zip.desktop

13:38 /usr/share/icons/Humanity/mimes/16/application-7zip.svg

13:38 /usr/share/icons/Humanity/mimes/22/application-7zip.svg

13:38 /usr/share/icons/Humanity/mimes/24/application-7zip.svg

13:38 /usr/share/icons/Humanity/mimes/32/application-7zip.svg

13:38 /usr/share/icons/Humanity/mimes/48/application-7zip.svg

13:38 papuccino1@ubuntu:~$

13:38 ataggart: I'd wait for clojure to have an actual deconst

13:38 SergioTapia: Wow... it seems to have only located the icons.

13:40 Solved it, thanks. :)

13:42 Borkdude: SergioTapia: if you come from .NET, what are you doing in linux? Just wondering.

13:43 SergioTapia: I wanted to learn new things, things got kind of stale.

13:43 Plus, Ruby works better in Linux than in Windows.

13:43 Since I like Ruby, I always have an Ubuntu VM on standby.

13:44 Borkdude: Just know that you don't have to be in Ubuntu for Clojure, although I installed it once just for Clojure... ;-)

13:44 Did you do F# yourself

13:44 SergioTapia: Yeah I imagine I can use any Linux distro. But Ubuntu is my favorite, second to Linux Mint.

13:44 Borkdude: ?

13:45 SergioTapia: Yeah I used it for about a month. Nothing I would get payed for though.

13:45 TimMc: Linux tends to be friendlier for development, in my mind.

13:45 SergioTapia: Fibonacci numbers and other useless stuff like that.

13:45 Borkdude: SergioTapia: I mean, I get by in Windows using emacs now just as good as in linux

13:45 SergioTapia: @TimMc: Depends on your language.

13:45 Borkdude: for clojure

13:45 TimMc: SergioTapia: Specifically, Windows has *terrible* shell scripting support.

13:46 (Mac = Linux for the purposes of my comments here.)

13:46 Borkdude: TimMc: I agree, .bat-file hell ;-)

13:46 TimMc: Also, I hate backslashes in paths. :-P

13:47 Borkdude: and I needed to download something that did what touch in linux does in Windows, those things make me crazy sometimes

13:47 SergioTapia: @TimMc: I couldn't agree or not. I've never done shell scripting.

13:47 Borkdude: TimMc: windows got powershell nowadays, it makes things a lot better

13:47 SergioTapia: I've used Powershell with Active Directory. Fantastic tbqh.

13:47 TimMc: SergioTapia: It's really important once you get into complicated projects, where you want to do automated deployment testing and the like.

13:48 Oh yeah, powershell... forgot about that.

13:48 Borkdude: echo >> foo.txt doesn't work as touch?

13:50 SergioTapia: I'm reading Programming Clojure. Pretty sweet book so far.

13:50 (defstruct person :first-name :last-name)

13:50 Hm... I like succinct code. :D

13:50 * SergioTapia off to read.

13:50 TimMc: SergioTapia: Just watch out for some of the older syntax.

13:50 Borkdude: TimMc: when I do that, a foo.txt file gets created with the following content:

13:50 TimMc: ECHO is on (aan).

13:51 TimMc: Borkdude: Ah, weird. Try echo -n "" >> foo.txt

13:51 Borkdude: I actually just needed to modify the "modified date" of certain file

13:51 s

13:51 TimMc: Err, maybe echo "" /n or whatever.

13:51 Borkdude: >> is append, so that should work.

13:52 Borkdude: TimMc: it appends ECHO is on (aan). everytime :)

13:54 TimMc: and that would totally mess up my files

13:54 TimMc: but I solved it, someone made a touch.exe which does what touch in linux dus

13:54 does

14:00 mefesto`: Raynes: ping?

14:03 amalloy: mefesto: as it happens i'm poking at tryclojure right now. i might be good enough if he's not around?

14:04 mefesto: amalloy: oh, i was just going to mention to him that i received a github issue email and wanted to know if it was something i should fix

14:04 amalloy: mefesto: in fact that's what i'm about to push a fix for

14:04 mefesto: amalloy: ok cool. just adding the css class to the code elements, right?

14:05 amalloy: right

14:05 clojurebot: Huh?

14:05 mefesto: <code class="expr">...</code>

14:05 Borkdude: I keep mistyping json as clojure maps...

14:06 amalloy: mefesto: https://github.com/Raynes/tryclojure/pull/16

14:08 mefesto: amalloy: cool, i can continue with my mindless web surfing then :)

14:08 amalloy: at least until Raynes pulls and discovers this didn't work

14:18 SergioTapia: What's the difference between a Map and a Set?

14:19 Can a Set be considered sort of like a C# enum?

14:19 As in a list of values

14:19 amalloy: no

14:19 not of C# enums are anything like java enums, anyway

14:19 s/of/if

14:19 sexpbot: <amalloy> not if C# enums are anything like java enums, anyway

14:20 hiredman: well, I mean, the proper why to do enums is sets of keywords

14:20 but you don't actually have sets of the keywords

14:21 just, this function returns one of these 4 keywords (would could said as "this functions returns one of this set of keywords")

14:21 SergioTapia: Are you referring to Clojure: "but you don't actually have sets of the keywords"

14:21 amalloy: SergioTapia: sets are just...sets, from math. a collection of unique values. you can do any collection operations on them, more or less, and they preserve uniqueness

14:22 raek: a set is a collection that contains values unordered and without duplicates

14:22 ,#{:a :b :c}

14:22 clojurebot: #{:a :c :b}

14:22 SergioTapia: So it IS like a C# enum. Thanks! :) Just trying to fit things together.

14:22 raek: ,(conj #{:a :b :c} :d)

14:22 clojurebot: #{:a :c :b :d}

14:22 raek: ,(conj #{:a :b :c} :a)

14:22 clojurebot: #{:a :c :b}

14:22 hiredman: http://www.codeproject.com/KB/recipes/sets.aspx

14:22 poor guys

14:23 SergioTapia: > 28 Mar 2004

14:23 hsbot: Not in scope: data constructor `Mar'

14:23 * SergioTapia lols

14:23 SergioTapia: .net 3.5 now has the HashSet class fyi. ;)

14:24 hiredman: well, there you go, that is what a set is

14:24 SergioTapia: k

14:24 hiredman: who let in hsbot?

14:25 raek: SergioTapia: I think you are confusing types and values

14:26 SergioTapia: Are you familiar with C#? If you're not you probably aren't understand my comparison.

14:27 amalloy: SergioTapia: so stop making comparisons to C#, and instead say something about what a set is

14:27 SergioTapia: I asked so I could make some association to something I'm familiar with.

14:28 amalloy: indeed, and that's great

14:29 but if you ask "is this like a framble" and someone says "i don't know what a framble is, but it behaves like so", your response of "aha, so it's a lot like a framble" leaves us all wondering whether you've missed something

14:30 SergioTapia: I don't see where you could get confused. If someone says it does X, and I say, as so it behaves just like Foo. You can safely assume that X indeed behaves like Foo.

14:31 amalloy: whatever, if you're satisfied

14:31 SergioTapia: of course

14:39 thorwil: so C# hashsets are like frambles, cool.

14:40 amalloy: thorwil: that's explicitly spelled out in the doxygen :)

14:59 SergioTapia: Hehe. I'm stuck trying to get a working Fibonacci sequencer.

15:00 I was always TERRIBLE with math problems.

15:02 mids: what is a framble?

15:05 SergioTapia: It's like a set

15:05 * SergioTapia chuckles

15:05 amalloy: it's a metasyntactic variable :P

15:05 hiredman: clojurebot: framble is a macguffin

15:05 clojurebot: In Ordnung

15:05 hiredman: framble?

15:05 clojurebot: framble is a macguffin

15:07 TimMc: SergioTapia: "You can safely assume that X indeed behaves like Foo." <-- I have no idea who you are.... so no, I can't assume that.

15:07 SergioTapia: Late to the party

15:07 -10 points.

15:08 TimMc: SergioTapia: Anyway, here's all you need to know: http://clojure.org/data_structures#Data%20Structures-Sets

15:08 SergioTapia: Any help? http://stackoverflow.com/questions/5688822/how-can-i-generate-the-fibonacci-sequence-using-clojure

15:08 TimMc: SergioTapia: Chiding someone for reading the backlog and answering your ill-formed questions: -30 points from Hufflepuff.

15:08 amalloy: $google fibonacci clojure rosetta

15:08 sexpbot: First out of 46 results is: Fibonacci sequence - Rosetta Code

15:08 http://rosettacode.org/wiki/Fibonacci_sequence

15:09 amalloy: SergioTapia: ^ is badass

15:09 SergioTapia: Clojure 1.2.0

15:09 java.lang.IllegalArgumentException: Wrong number of args (4) passed to: helloworld$fibonacci (helloworld.clj:0)

15:09 1:1 user=> #<Namespace src.helloworld>

15:09 1:2 src.helloworld=>

15:09 Thanks, let me check that out.

15:09 amalloy: SergioTapia: i think you passed the wrong number of arguments

15:10 SergioTapia: But I count two, let me draw some ASCII. :D

15:10 (defn fibonacci[a b] (println a b (fibonacci (+ b 1) a + b)))

15:10 amalloy: *cough* a + b

15:10 SergioTapia: |----------| |----------|

15:11 ugh. Fail. Didn't draw correctly. Anyways, Are you saying a +b does not eval to a single value?

15:11 amalloy: um no. notice you wrote (+ b 1)?

15:11 SergioTapia: Yeah, that's 1 parameter, and the 'a+b' should be the second, no?

15:12 amalloy: why didn't you write b+1?

15:12 SergioTapia: I'm new and Try-Clojure showed me that's how you do it.

15:12 So this would be the same:

15:12 * amalloy is trying out socrates today

15:12 SergioTapia: (fibonacci (b + 1) (a + b))

15:12 ?

15:12 amalloy: no, it would not be the same, it would actually work

15:12 er

15:12 man

15:13 sorry didn't read very well

15:13 &(+ 1 2)

15:13 sexpbot: ⟹ 3

15:13 amalloy: &(1 + 2)

15:13 sexpbot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

15:13 amalloy: you see the difference there?

15:14 SergioTapia: Yes, I see it. What's strange now is that I'm not getting your exception... I'm getting this:

15:14 EOF while reading (helloworld.clj:5)

15:14 amalloy: unbalanced parens

15:14 ssideris: SergioTapia: check your parentheses

15:14 SergioTapia: Ah NOW I'm getting that correct exception. :)

15:14 amalloy: ssideris: better: use an editor that does that for you :)

15:14 SergioTapia: I'm using eclipse, strange that it missed that single parens.

15:15 TimMc: SergioTapia: I believe you mentioned familiarity with emacs -- I highly recommend paredit mode.

15:15 ssideris: amalloy: check your parentheses by using the latest hi-tech parentheses balancing mechanisms :-D

15:16 SergioTapia: Sold Seperately (tm

15:16 *see what I did there?*

15:16 * SergioTapia lols

15:16 ssideris: oh since we're talking about emacs: is there a command that tells it "balance the open statement by adding any parens necessary"?

15:17 TimMc: ssideris: paredit

15:17 and the command is "(" :-P

15:17 ssideris: TimMc: I'd rather have emacs do it _afterwards_

15:18 amalloy: TimMc: that doesn't seem accurate to me. paredit doesn't let you get into that state

15:18 SergioTapia: By the way, what does this line do?

15:18 (ns src.helloworld)

15:18 ssideris: amalloy: exactly

15:18 SergioTapia: It was added automatically to my clojure project on Eclipse.

15:18 TimMc: SergioTapia: That declares a namespace for your vars to live in.

15:18 amalloy: ssideris: you can't easily, because once there's a dangling ( it's hard for it to know where the closing ) should go

15:18 SergioTapia: 'ns' meaning Namespace?

15:19 TimMc: SergioTapia: Exactly.

15:19 amalloy: but if you don't have paredit on, you can just pound ) yourself until it says "mismatched parenthesis"

15:19 hiredman: amalloy: can have issues with [ and {

15:19 TimMc: SergioTapia: CHeck out the top of this file I'm working on for an example: https://github.com/timmc/CS4300-hw6/blob/master/src/hw6/tracer.clj

15:19 amalloy: sure, it's not perfet

15:20 TimMc: SergioTapia: http://clojuredocs.org/clojure_core/clojure.core/ns

15:21 amalloy: I discovered last week that typing "]" in paredit will get me to the close of the current statement regardless of whether it is a paren, square, or curly. Pretty convenient, since square bracket doesn't require shift on my keyboard.

15:21 amalloy: yep

15:21 TimMc: s/statement/expression/ >_<

15:21 * TimMc shakes his fist at SergioTapia for bringing that heathen language into #clojure

15:23 SergioTapia: What language?

15:23 amalloy: c#, of course

15:23 TimMc: imperative

15:24 SergioTapia: @amalloy: C# is a most EXCELLENT language, as is Ruby. Why don't you like it?

15:24 amalloy: SergioTapia: did i say that? i didn't say that

15:24 SergioTapia: Implied it

15:24 amalloy: i filled in the blanks for TimMc

15:24 TimMc: incorrectly!

15:24 amalloy: haha sorry

15:24 that was the language SergioTapia mentioned though

15:24 SergioTapia: LOL, did you mean Ruby then? :P

15:24 TimMc: SergioTapia: I was referring to the vocabulary of imperative programming.

15:25 SergioTapia: oh hahaha.

15:26 TimMc: Ordering values around and such... it's just not a very nice way to treat them.

15:27 SergioTapia: Ok, time for some tinkering. Is there a library that allows me to work with JSON in a clojure application?

15:27 amalloy: clojure.contrib.json, but please consider not using it if your code only needs to work with other clojure code

15:27 * devn tips his hat

15:28 hiredman: clojurebot: json?

15:28 clojurebot: Titim gan éirí ort.

15:28 hiredman: clojurebot: json is <reply>http://dakrone.github.com/cheshire/

15:28 clojurebot: In Ordnung

15:28 devn: :)

15:29 SergioTapia: Since I've used CouchDB in the past and it works with JSON (meaning any language with JSON support can work with it), I wanted to build a small lib that allows clojure apps to easily interact with CouchDB.

15:30 amalloy: clojure-couchdb exists, though i don't know how good it is

15:30 hiredman: SergioTapia: please don't

15:30 amalloy: lol

15:30 hiredman: there are at least 3 such libraries already

15:30 devn: heh

15:31 The Lisp Curse

15:31 hiredman: and one of them already has 6th level forks

15:31 a fork of a fork of a fork …

15:31 devn: so many tines

15:31 SergioTapia: @hiredman: Why?

15:31 devn: SergioTapia: because if libraries already exist, improve upon them

15:32 amalloy: oh my god http://stackoverflow.com/questions/279619/whats-your-favorite-implementation-of-producing-the-fibonacci-sequence/3286056#3286056 is the worst fibonacci implementation ever

15:32 hiredman: SergioTapia: because watching you do it will ignore me to great end as you ask for help in the channel and I will end up putting you on /ignore

15:32 devn: amalloy: on stackoverflow!? surely you jest!

15:32 Derander: SergioTapia: lisp programmers are famous for reimplementing functionality over and over, every time solving 80% of the problem

15:32 SergioTapia: you end up with 100 libraries all solving a different 80%

15:32 amalloy: devn: there's good stuff on SO. and bad stuff too, of course. this is worse than usual

15:33 devn: amalloy: the lisp curse should be required reading for any new lisp community

15:33 TimMc: amalloy: THat's amazing.

15:33 devn: http://www.winestockwebdesign.com/Essays/Lisp_Curse.html

15:34 amalloy: regarding the solution after it, i must say duff's device always makes me want to puke

15:34 SergioTapia: @hiredman: Well aren't you condescending. What the hell.

15:34 * devn is reminded of Rich's talk at clojure conj

15:34 devn: SergioTapia: see the link i posted above

15:35 SergioTapia: hiredman has a...way with people...so to speak, but it's hard to disagree with what he's suggesting in this case -- those libraries exist already. improve upon them.

15:35 amalloy: (inc devn)

15:35 sexpbot: ⟹ 1

15:36 devn: SergioTapia: if you want to make this community better, that's the RightThingToDo(tm)

15:36 Derander: devn: ™

15:36 devn: (thank you Derander) :)

15:36 Derander: ;-)

15:37 devn: SergioTapia: alternatively you might write that library as an exercise and then never put it on github. that would be acceptable, but less helpful.

15:39 SergioTapia: tl;dr on the link i posted above: Lisp is so powerful everyone is a lone wolf and writes the same library but never /finishes/ them. what happens? people new to the language go poking around for a couchdb library and find 15 of them. they are all half finished. they write their own. the problem continues.

15:39 this is /bad/.

15:40 TimMc: devn: So, should I not be pushing my ray tracer homework to github?

15:41 devn: TimMc: please excuse my hyperbole

15:42 TimMc: I *should* link to cray from my README, though.

15:42 devn: ^^great idea

15:42 (inc TimMc)

15:42 sexpbot: ⟹ 2

15:43 devn: (inc amalloy) ;; because he's consistently awesome.

15:43 (inc amalloy)

15:43 Derander: too bad

15:43 sexpbot: ⟹ 8

15:43 tufflax: (inc amalloy)

15:43 sexpbot: ⟹ 9

15:43 tufflax: :P

15:43 where's the highscore? :P

15:43 devn: (karma amallow)

15:43 (karma amalloy)

15:43 hmm

15:44 amalloy: $karma amalloy

15:44 meh

15:44 * devn shrugs

15:44 TimMc: &karma amalloy

15:44 sexpbot: java.lang.Exception: Unable to resolve symbol: karma in this context

15:44 amalloy: i think it's broken but i forget why

15:44 devn: so what's everyone hacking on today?

15:44 tufflax: A kompiler for java in java :S

15:44 TimMc: devn: http://i.imgur.com/ktXQ7.png <_ ray tracer, duh :-)

15:44 tufflax: compiler*

15:44 devn: tufflax: so you can write java in your java?

15:44 tufflax: yes exactly... its homework :P

15:45 devn: :)

15:45 tufflax: but when im done im gonna have like 12-week break :D

15:45 devn: worked on this a bit yesterday: https://github.com/levand/clj-soy

15:46 see: http://code.google.com/closure/templates/

15:46 amalloy: i'm looking around on the internet for People who are Wrong, and fixing it

15:46 * devn chuckles

15:46 hiredman: well irc is the place for that

15:46 amalloy: hiredman: SO is even more so

15:47 so much wrong

15:47 devn: hello STOP someone on the internet is wrong STOP commenting on how wrong they are STOP

15:48 hiredman: SO has collapsed under the weight of People who are Wrong in to a sort of blackhole which just attracts People who are Wrong and unfortunately the cosmic censorship hypothesis doesn't apply

15:49 devn: Hanlon's Razor.

15:49 Never attribute to malice that which is adequately explained by stupidity.

15:55 Vinzent: can you explain me why (reduce entity (fn [e [k v]] (update-in e [k] inc)) entity), where entity is a map, returns last pair but not the map?

15:56 amalloy: argument order is wrong

15:56 i think

15:56 &(doc reduce)

15:56 sexpbot: ⟹ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... http://gist.github.com/923430

15:57 amalloy: though it's simpler to use into/for than reduce, really: ##(into {} (for [[k v] {:a 1 :b 2]] [k (inc v)]))

15:58 &(into {} (for [[k v] {:a 1 :b 2}] [k (inc v)]))

15:58 sexpbot: ⟹ {:a 2, :b 3}

15:59 devn: amalloy: if you want to coordinate on tidying up after the People who are Wrong, ping me links and I'll hit them

16:00 as in, go to the link and correct the error, not physically hit the person

16:00 amalloy: devn: just let me know when you perfect the cross-internet electrotherapy device

16:00 Vinzent: amalloy, OMG. Thank you, it's args order. You know, i was sitting about a half hour and can't understand what's wrong with my code %) Working at night is a bad idea

16:00 devn: amalloy: if you use twitter at all, the PlanetClojure bot records clojure questions

16:00 (from SO)

16:00 amalloy: devn: i know

16:00 i just subscribe to the clojure rss feed though

16:00 devn: k just thought i'd mention it :)

16:02 Vinzent: Yes, variant with for is better, thanks again

16:08 One more question: is it more idiomatic to use scheme-like ->string instead of to-string?

16:09 amalloy: meh

16:09 i see the latter more often, but i don't know that anyone feels strongly about it

16:11 LauJensen: amalloy: In the first CQL we use the -> notation, which ended up being a harder read than to/from

16:12 used*

16:12 amalloy: there you go, LauJensen feels strongly about it. and he's best in class :)

16:12 LauJensen: What the hell?

16:13 Vinzent: :) btw, -> notation used in the new record things, isnt it?

16:31 amalloy: Vinzent: i don't think the syntax for that is solidified yet, is it?

16:32 LauJensen: amalloy: Not sure. I would ask Rich but Im afraid such a demonstration of entitlement would provoke him to cut corporate support for Clojure as well :)

17:00 TimMc: It looks like when futures throw exceptions, they don't get printed on the console. Interesting.

17:06 raek: TimMc: if the task throws an exception, it will be stored in the future object and thrown if it is rereferenced

17:07 so either you can add a (try ... (catch Throwable e (.printStackTrace e))) or use a "raw" Thread

17:07 it depends on how/if you want to treat errors automatically in your application

17:08 *dereferenced

17:11 TimMc: Aha... so if I never deref the future, I never see the exception.

17:11 I really should be using a raw Thread, then.

17:11 (I don't care about the return value.)

17:12 markoman: i have interesting problem with getting data from map

17:13 i made a paste about it if someone wants to look at it: http://pastebin.com/ahDUgCXc

17:14 in practice im not sure how to keep count of previous, current and next values (page ids) and return them when match is found

17:15 raek: markoman: what do you wish the (page-next-prev "page2" pages) call to return?

17:16 markoman: {:prev pageid :next pageid} where page ids are from args

17:17 raek: so for the case where page-id is "page2", what would those be? "page1" and "page3"?

17:18 or "page1" and "section1"?

17:18 markoman: yes and what if prev next not available, then just nil is good

17:18 section or any other unmentioned are not counted at al but passed. im interested only about page type

17:19 raek: first, you can filter out all non-pages (since they are irrelevant here): (filter #(= (:dtype %) :page) coll)

17:20 markoman: possible returns would be {:prev nil :next "page2"} {:prev "page1" :next "page3"} {:prev "page2" :next nil}

17:21 raek: then you can add a dummy page at each and make a sequence of triples: (partition 3 1 (concat [{}] filtered-coll [{}]))

17:21 markoman: and maybe {nil nil} if no original page-id found. ok, filter is nice

17:23 raek: and then choose the first triple where the middle one has the correct id: (first (filter (fn [[_ p _]] (= (get-in p [:args :id]) page-id)) partitioned-coll))

17:24 and then (let [[prev current next] the-triple] {:prev (get-in prev [:args :id]), :next (get-in next [:args :id])})

17:25 but it might be easier to walk through all these triples once an construct a map from ids to ids of previous page and a map from ids to next ids

17:26 the format you declare your data in does not have to be the same as the program uses to do its work

17:27 markoman: hmh... good ideas. sounds rather complicated. i was thinking if I could make a recursive calls and passing values...

17:29 yeah, other data has no meaning, just page type and id in agrs

17:29 let me test some

17:33 partition thing is nice too, but not easy to understand apart from result it creates is clear

17:33 amalloy: raek: fwiw, i like (comp #{page} :dtype) better than #(= (:dtype %) :page)

17:34 raek: amalloy: agreed :)

17:36 markoman: what is the difference there?

17:40 ataggart: the former returns :page or nil, the latter returns true or false

17:44 markoman: with keyword corrected it return same map: (comp #{:page} :dtype) so...

17:49 updated paste with current version, that gives right output: http://pastebin.com/g51z9vsx thanks guys, this gives a lot to chew

18:05 trmsw: Evening all :) I need to use ActiveX objects from a clojure application. This is horrid but entirely possible, my problem is that the ActiveX objects involved are reasonably expensive to initialise, are single-threaded, and need to be used on and off throughout the life of my app.

18:06 I'd like to have one thread per object and keep the thread going until my application quits, passing requests / messages to it

18:06 how can I do this in Clojure?

18:07 amalloy: wrap them up in agents? you won't get a single thread per object, but i don't htink that's really your goal anyway

18:08 trmsw: you mean the agent holds a reference to the object and requests are done on the agent?

18:08 amalloy: yes, something like that

18:09 trmsw: thing is, I really do need to keep the same thread alive

18:09 i think. Based on my reading of this: http://danadler.com/jacob/JacobThreading.html

18:13 on the other hand this kind of problem is completely against the clojure grain...

18:23 amalloy: trmsw: well, i'm not inclined to read that whole mess to figure out if you actually need this. but if you do, you should be able to create a future object that loops checking a blocking queue

18:23 and passes the messages along to the activex object it wraps

18:26 trmsw: amalloy: reluctant to wade through the details of obsolete technology? That's very inconsiderate! Thanks, I will look into blocking queues.

18:26 amalloy: *laugh*

18:31 trmsw: nonetheless I have a soft spot for ActiveX and being able to script office applications, since I have to use them.

18:31 Ok so that's perhaps a confession too many. Night

18:43 markoman: how do you use logical operator in clojure, and or namely?

18:44 (= 0 a & b) (= 0 a | b)

18:44 raek: markoman: bit operators?

18:45 markoman: no, just normal

18:45 raek: (if (and a b) ...) (if (or a b) ...)

18:46 but from the example it looks like you are looking for (= 0 (bit-and a b)) (= 0 (bit-or a b))

18:46 (doing bitwise logic operations, rather than logic operations on single booleans)

18:47 markoman: (= 0 (and a b)) (= 0 (or a b)) works too?

18:47 seems to work :) thanks

18:47 raek: booeans are not integers, so those will always return false

18:48 (well, assuming that a and b are booleans)

18:49 ,(macroexpand-1 '(and a b))

18:49 clojurebot: (clojure.core/let [and__3468__auto__ a] (if and__3468__auto__ (clojure.core/and b) and__3468__auto__))

18:49 markoman: ,(= 0 (or 1 0))

18:49 clojurebot: false

18:49 raek: 'and' and 'or' are just syntactic sugar for writing nested ifs

18:50 1 is neither false nor nil, therefore it counts as true

18:50 so (or 1 0) short circuits and returns 1

18:51 markoman: oh, so how do you compare say strings in this case?

18:51 ,(= "0" (or "1" "0"))

18:51 clojurebot: false

18:51 raek: what do you want to check for? if a string is either value a or b?

18:52 markoman: yes

18:52 raek: you can't write that condition like that

18:52 you have to write something like (or (= a 0) (= b 0))

18:53 (or (= s "foo") (= s "bar"))

18:53 mreynolds: raek: Wouldn't case work here?

18:53 markoman: i was figuring, either or outside or inside (=) ...

18:54 mreynolds: (case s "foo" (...) "bar" (....) (etc)) ?

18:54 raek: if you simply want to do a certain thing if a value is either a or b, you can also write is as (if (#{a b} x) ...)

18:55 mreynolds: if you want to do different things when the string is "foo" and "bar", then yes

18:55 mreynolds: raek: Ahhh, I got it. So, that statement you wrote, that creates a set and the set acts as a function to test for membership of x?

18:56 raek: yes

18:56 mreynolds: Hot damn that's nice

18:56 raek: same as (contains? #{a b} x)

18:56 markoman: now it looks like what I was after

18:57 raek: markoman: or always mean the same thing. it has no special parsing when it occurs in a =

18:57 markoman: i see

19:06 amalloy: markoman: if you want to test which of several groups a value falls into, you can do it similarly with condp: ##(condp #(%1 %2) 'a '#{x y} "x or y", '#{a b} "a or b", "none of these")

19:06 sexpbot: ⟹ "a or b"

19:08 markoman: hmh how did it actually return a or b, not x or y?

19:08 amalloy_afk: markoman: the value it was testing against was 'a

19:09 markoman: oh yes, there it is

19:09 amalloy_afk: it tried ##('#{x y} 'a), saw that was nil, then tried ##('#{a b} 'a) and it was true

19:09 sexpbot: ((quote #{y x}) (quote a)) ⟹ nil

19:09 ((quote #{a b}) (quote a)) ⟹ a

19:13 markoman: yes, nice things. but now my head need to meet a pillow

19:13 2am and counting

21:10 chrissbx: How again does one look up the definition for the symbol at cursor in the clojure slime?

21:33 technomancy: chrissbx: M-.

21:34 swank-clojure's readme has the goods on that.

21:42 chrissbx: Thanks!

22:18 ataggart: am i misreading the docs or does compojure muddle the distinction between parts of the url path and the query parameters?

Logging service provided by n01se.net