#clojure log - Apr 22 2011

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

4:26 alekx: (let [v [1 2 3] (get v -2) (nth v -2)) ; get => nth in IndexOutOfBounds

4:26 Is that ok?

4:27 sorry, question is get using a negative index results in nil, while nth w/ negative index results in IndexOutOfBounds

4:28 fliebel: alekx: I still see no question, but that is expected. try (get v −2 :blah)

4:28 alekx: fliebel: I was wondering about the difference in behavior

4:29 both nth and get support the "missing value"

4:29 fliebel: &(doc nth)

4:29 sexpbot: ⟹ "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

4:29 alekx: (nth [] -2 "missing"_

4:30 Is there a way to get the second to last element from a vector/sequence?

4:30 fliebel: alekx: vector or sequence?

4:30 alekx: some langs support negative indexes for doing that; I'm wondering if a similar idiom exists in clojure

4:31 let's start with vector

4:31 :D

4:31 fliebel: Not that I know, you could do (- length 2) though, or do (last (drop-last 2))

4:31 or (nth 2 (rseq))

4:32 or structure your data so that you don't need to do that, because it is inefficient.

4:32 vectors can do disj though.

4:33 (peek [1 2 3])

4:33 alekx: &(doc disj)

4:33 sexpbot: ⟹ "([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)."

4:33 fliebel: or what… let mee see.

4:33 no, you want peek and pop.

4:33 for a vector they work a the end, for a persistenqueue they work at the start.

4:34 alekx: thnks. I'll look into all these one by one :)

4:35 fliebel: So since nth is actually just (first (rest (rest… you'd do (peek (pop (pop....

4:36 But vectors are counted and support numerical indexes really fast, so (- (lenth) 2) is probably faster.

4:37 alekx: it definitely needs to be index based

4:37 that's the whole idea

4:38 so probably the length approach is the one to use

4:38 fliebel: &(source nth)

4:38 sexpbot: java.lang.Exception: Unable to resolve symbol: source in this context

4:38 alekx: or someone could implement a new nth that behaves this way

5:22 * fliebel didn't know hard concurrency problems still existed in Clojure

5:33 fliebel: What would be the Clojure way of doing this? Killing threads does not really sound like a good idea. http://stackoverflow.com/questions/5378391/closing-a-blocking-queue

7:54 raek: fliebel: interrupting a thread is not the same as calling .stop on it

7:56 an interrupt merely suggests the thread to stop what it's doing, but is not guaranteed to have any effect (it's up to the thread)

7:58 also, I would recommend reading the chapter "Cancellation and Shutdown" of Java Concurrency in Practice. it explains all this really well

7:59 fliebel: raek: OKay, thanks. I don't own the book though.

7:59 raek: you might also find the "Shutdown with poison pill" example useful http://www.javaconcurrencyinpractice.com/listings/IndexingService.java

7:59 I've borrowed it from the uni library... :)

8:00 fliebel: I'm not in uni either.

8:02 raek: Do you know anything about pods? I thought they where going to be for this kind of Java stuff in Clojure.

8:02 raek: nope... :-)

8:02 fliebel: I did something similar in clojure a while ago: https://github.com/raek/stream-seq

8:03 https://github.com/raek/stream-seq/blob/master/src/se/raek/stream_seq.clj#L123

8:04 fliebel: okay, locking…

8:04 raek: the project has an implementation of a "closable" blocking queue

8:04 it uses locks and stuff, so it's not very pretty

8:05 the locks are mainly there to keep producers from putting stuff in the queue when it has been closed

8:06 fliebel: raek: Thanks for that code, it seems to contain a lot of stuff I might need.

8:08 The trouble with seque is that it must really support any BlockingQueue. Especially SunchronousQueue is problematic with locking.

8:12 So 1) I can't lock the actual queue, because for SynchronousQueue that means a deadlock. 2) I can't insert a plug, because for PriorityBlockingQueue that means NPE.

8:13 I'm going to do some hamocking outside to cook something up.

8:32 raek: fliebel: can't you use an (Object.) as the "plug"/"poison pill"?

8:33 fliebel: raek: What is the priority of an object?

8:34 raek: oh, missed the Priority- there :)

8:35 hamocking sounds like a good plan

8:35 fliebel: :)

9:09 raek: interrupting *was* in fact a working solution :)

9:10 ambrosebs: is there any way to extract the type hint of an argument?

9:10 say I want to know this symbol was hinted to be Integer

9:10 (foo ^Integer 'a)

9:10 fliebel: (:tag (meta x)) I think.

9:11 &(:tag (meta ^Integer []))

9:11 sexpbot: ⟹ nil

9:11 fliebel: uuhm, what? In my repl that works.

9:11 &(meta ^Integer [])

9:11 sexpbot: ⟹ nil

9:11 fliebel: (dec sexpbot)

9:11 sexpbot: ⟹ -1

9:11 ambrosebs: doesn't seem to work for me either

9:12 fliebel: &(meta ^:blah [])

9:12 sexpbot: ⟹ nil

9:16 raek: ambrosebs: the type hints are on the data stucture that is sent to the evaluator

9:16 ambrosebs: so you need to look at those before they get evaluated, i.e. you need to do it in a macro

9:16 ambrosebs: ah this makes sense

9:18 Im not sure if I can use a macro in my situation

9:19 raek: I recall that the "defstrict" exercise of Labrepl uses the type hints to add runtime type checks

9:19 ambrosebs: yes i remember that too now

9:20 I'm using pallet to generate Bash script .. I'm nested inside the "script" wrapper function, so I'm not exactly in clojureland

9:21 I think i'll have to take a different strategy

9:37 _Vi: How to have a JComboBox that selects keywords from a set? Should I use a map from keyword to combobox's item index?

10:02 fliebel: What a beautiful error! java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception:

10:03 Now, how can I tell clojure.test that I don't care about the type of exception?

10:04 stuartsierra: fliebel: you mean test for any exception?

10:05 fliebel: stuartsierra: Well, what I mean is that the type of exception seems to depend on my implementation. So I guess that what I actually want is the original exception.

10:06 stuartsierra: There's an example in the tests for clojure the language to get the root cause of an exception.

10:06 but you may just want `(thrown? Throwable ...)`

10:07 fliebel: stuartsierra: Well, I put Exception in there, but then it did not work when it was a RuntimeException. Is Trowable any different?

10:07 stuartsierra: Yes. Throwable is the parent of all exception types.

10:08 although Exception is also the parent of RuntimeException.

10:08 fliebel: stuartsierra: right, that is what I thought, but it seems to work anyway. :) thanks

10:08 stuartsierra: 'welcome :)

10:10 fliebel: :( still locks itself up from time to time...

10:11 stuartsierra: It's possible the exception is happening outside the scope of your `is` assertion or `deftest`, due to timing / concurrency issues.

10:11 fliebel: stuartsierra: Nah, the test is working now, btu I'm using interrupt to get out of the .take when I'm done, but it seems to miss that sometimes.

10:12 stuartsierra: Thread.interrupt?

10:12 fliebel: yea

10:12 stuartsierra: Well, there's your problem. :)

10:12 fliebel: why?

10:12 clojurebot: why not?

10:12 Kerris: ahahah clojurebot

10:13 Bronsa: lol

10:13 stuartsierra: The behavior of Thread.interrupt is complex.

10:14 If you need to wait for something to complete, you're probably better off with something like a CountDownLatch.

10:15 fliebel: stuartsierra: Sounds like it's time based?

10:15 stuartsierra: CountDownLatch isn't time based. It's like a semaphore.

10:15 Clojure's promises use them.

10:16 fliebel: stuartsierra: Oh! I'll check that out. (it's for this one https://gist.github.com/934781 )

10:17 dnolen: interesting, Java 7 book that covers using Scala/Clojure http://www.java7developer.com/

10:20 fliebel: stuartsierra: What is complex about interrupting?

10:20 stuartsierra: I don't understand it. Ergo, it must be complex.

10:20 thorwil: is there a straightforward approach or library for reversible text transformations? (specify transformation from format A to B, handle he other direction implicitly)?

10:21 fliebel: thorwil: Boomerang, or Logos, if you try really hard.

10:22 http://www.seas.upenn.edu/~harmony/

10:23 thorwil: actually, i recall reading a bit about boomerang. but "straigtforward" in this context would start with available from/in clojure

10:23 fliebel: stuartsierra: This sounds interesting: http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html

10:23 stuartsierra: Yeah, Goetz is a smart guy.

10:24 cemerick: fliebel: it has a lot of the same characteristics of locks that make them hard to use properly as well

10:25 fliebel: cemerick: Well, while I'm already mutating stuff all the way though, it doesn't really matter, since it's complex anyway. It makes me respect Clojure all the more, though :)

10:53 * devn tips his hat

10:53 * __name__ tips his imaginary hat.

11:15 sritchie: hey all, I was wondering if anyone had any advice on this function -- https://gist.github.com/936857

11:15 this is the structure of a cascalog aggregator -- tuples is a sequence of (index, val) pairs

11:16 essentially, I'm filling in a sparse vector by associng values in place -- I sort of feel like this bashing in place isn't idiomatic

11:22 Chousuke: sritchie: I'm having a hard time figuring out what that function even does :/

11:24 sritchie: Chousuke: sorry! should have had an example. I start with a vector of 0s, of some length "width". This is fed into a function composed of a bunch of smaller "assoc" functions -- each of this does one of the replacements required by cascalog

11:25 Chousuke: are the tuples in index order?

11:25 then you could build a lazy sequence of items and call vec on that.

11:26 if not, it's a bit trickier.

11:26 sritchie: Chousuke: yeah, some of the spots are going to be missing

11:26 they will be ordered, though

11:27 ,((fn [width tuples] [(vector ((apply comp (for [tup tuples] (fn [v] (apply assoc (vec v) tup)))) (repeat width 0)))]) 5 '((0 1) (4 2)))

11:27 clojurebot: [[[1 0 0 0 2]]]

11:27 sritchie: (cascalog needs all that extra nesting)

11:27 ,((fn [width tuples] [((apply comp (for [tup tuples] (fn [v] (apply assoc (vec v) tup)))) (repeat width 0))]) 5 '((0 1) (4 2)))

11:27 clojurebot: [[1 0 0 0 2]]

11:28 Chousuke: well then you can do something that goes through the tuples one by one, returning the value in it if the index is right, and returning a padding value instead if not (and incrementing an interal index counter)

11:28 lazily

11:29 and then just call vec on the result of that, to get a vector of it

11:31 sritchie: Chousuke: hmm, let me think about that one

11:32 in this example, after looking at (0 1), the function would need to return three padding values -- I wonder if (partition 2 1 tuples) would help, so the function could look at consecutive pairs of tuples?

11:32 Chousuke: I don't think it has to be like that

11:33 it can just look at the first tuple, and if its index is not equal to the counter index, then return a padding value and recurse with an increased counter

11:33 if it is, then recurse with the rest of the tuples and an increased counter

11:33 until you run out of tuples

11:35 sritchie: trying that out

11:38 thorwil: I need to apply a function to the content of a text class. constructed as (def txt (ds/as-text "Foo")) prints as #<Text <Text: Foo>>

11:39 simply converting to a string includes the Text label and the content might e longer than 500 characters

11:44 nm, looks like .getValue is the solution

11:52 sritchie: Chousuke: https://gist.github.com/936857

11:52 there's a first try... it's a lot faster

11:55 ilyak: hi *

11:55 Is is possible to somehow recur into current function and not into loop

11:56 Because otherwise you get three variables: initial-list, current-list and rest-list

11:56 It's easy to make a mistake

11:59 Chousuke: sritchie: you could make it use a lazy seq too, though it's probably a bit more complicated than that.

11:59 manutter: ilyak: what is the context of your question? Do you have any example code?

11:59 Chousuke: sritchie: actually

11:59 sritchie: never mind. calling vec on that thing is pointless, it's already a vector :D

12:00 sritchie: if your sparse vectors are going to be large, try using a transient too

12:03 sritchie: Chousuke: that's smoking fast

12:03 Chousuke: any comments on the way the function's written?

12:15 ilyak: manutter: Yeah, I'll paste

12:16 manutter: http://pastebin.com/iphLptVW - this is haskell-style stateful iteration

12:16 Maybe I should make cache transient and use for instead of loop?

12:18 Chousuke: transient? why.

12:18 and don't forget for is lazy

12:18 ilyak: How would I write it without repeating downloads three times

12:19 Oh, I'd unlazy it after

12:19 and, preferably, transferring cache implicitly not explicitly (too wordy)

12:19 dnolen: ilyak: you can recur to the current fn.

12:19 ilyak: Even if it's defn-ed?

12:20 Maybe I should try memoizing find-best-major

12:20 dnolen: ilyak: yes, fns also support multiple arity, so you can make a second fn that takes the initial values.

12:21 ilyak: Does clojure have some sort of memoize in core?

12:22 dnolen: ,(doc memoize)

12:22 clojurebot: "([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."

12:23 ilyak: cool

12:24 TimMc: ilyak: Just be careful what you memoize, of course -- there's no clean way to clear the memoization cache.

12:25 ilyak: Well, it would be garbage collected won't it

12:25 Is there a reasonable way to make with-open work with a map of something to closeable?

12:26 i.e. close everything it finds there

12:26 TimMc: ilyak: If you drop all references to the memoized function, yeah.

12:26 ilyak: TimMc: It won't escape that function

12:27 dnolen: ilyak: which is the proper way to use memoize.

12:29 http://lambda-the-ultimate.org/node/4260

12:30 "Clojure (roughly an untyped version of Haskell using LISP notation)"

12:30 hiredman: heh

12:31 ilyak: Wow

12:31 It's even faster when I recur to defn

12:31 * devn chuckles

12:46 thorwil: i have a problem with http://paste.pocoo.org/show/376416/ , where the effect if more isn't specified, it should be as if there was nothing at all @more. otherwise more will be a single function

12:49 fliebel: thorwil: What is in @more?

12:51 thorwil: fliebel: as things are, the @ marks my intention. it's meant to be an optional function

12:52 amalloy: *baffled*

12:52 fliebel: thorwil: So why do you write & more? then it's at least a seq of an optional function.

12:53 thorwil: Write it as a multi-arg fn then, whre the [] version calls the other one with a default function, or identity.

12:54 thorwil: retrieve-article* is to be used like: (def retrieve-article (retrieve-article*)) or (def retrieve-article-for-editing (retrieve-article* de-paragraphify))

12:54 fliebel: http://paste.pocoo.org/show/376424/

12:54 thorwil: if this seems needlessly convulted ... i'm trying to raise my understanding of funcions that return functions as alternative to macros ;)

12:55 fliebel: thorwil: ^^

12:55 ilyak: For some reason replacing loop/cache with memoize made it slower

12:56 fliebel: ilyak: If the memoized fn is cheap, yes, it'll be slower, as it needs to look up the value every time.

12:57 ilyak: It seems expensive to me

12:57 thorwil: fliebel: wow, your version gives me new insight, thanks!

12:57 ilyak: I'll try it without memoize at all

12:57 fliebel: ilyak: Note that I have no idea what you're doing.

12:59 thorwil: you're welcome :) I could use some insights as well though :( Still rewriting seque.

13:00 ilyak: fliebel: Sadly, my code without my data won't make any sense

13:00 And data weight several gigs

13:00 and are confidential

13:01 fliebel: ilyak: I guess the minimal mockup to make it run is less than that, but as you wish.

13:11 devn: heya fliebel

13:11 amalloy: im here!

13:11 amalloy: devn: haha

13:12 i was actually just demonstrating how $seen works

13:12 devn: I feel so used :(

13:12 amalloy: aw, poor devn

13:12 * devn thought alan wanted to talk to him

13:12 amalloy: devn: want to join the 4clojure.com team?

13:13 since you're lonely and you hang out in #sexpbot already

13:13 devn: do i have to do anything?

13:14 amalloy: just saw the page. hell yes i want to join.

13:15 amalloy: devn: we're planning to release 0.1.0 today; finishing up the last feature planned for the release. have a look at the issues page and see if there's anything that interests you

13:15 ilyak: My program in js/rhino runs 3,7 times faster than the same program in clojure

13:16 I wonder if I would get the parity

13:17 Raynes: drewr: Ping.

13:18 drewr: Nevermind. Found what I was looking for. ;)

13:20 ilyak: Without memoization it's crippling slow.

13:24 dnolen: ilyak: is the algorithm significantly different from the js/rhino version?

13:25 peteriserins: to anyone from 4clojure: am I supposed to star the gists that I want to remember?

13:25 ilyak: dnolen: I guess not, except that obviously clojure version is more fp

13:25 I can paste both if you bother

13:25 They're loke 200 line each

13:25 like*

13:27 dnolen: ilyak: which function seems the slowest?

13:28 ilyak: non-memoized version is four times slower than memoized one

13:28 abedra: stuartsierra, hey can you jump on skype?

13:28 dnolen: ilyak: are you memoizing that fn in js?

13:28 ilyak: sure

13:30 The program does the following: reads four presorted file and calculates some things over records it read and writes to files

13:31 dnolen: ilyak: how long exactly does the js program version take and the clojure version take?

13:31 ilyak: js program does 270 ids per second (one master file line per multiple (0-100000) lines of other files

13:31 clojure program does 70

13:32 bulters: gday all.

13:32 ilyak: It's possible that I do some extra work in clojure version, e.g. parse some things eagerly

13:32 edw: Good afternoon. (GMT-5)

13:34 dnolen: ilyak: paste the source, js and clojure, not saying I'll see anything, but I'm skeptical that the clojure version can't be made significantly faster than a rhino/js program.

13:34 bulters: it's one of the awkward things I always experience on irc.

13:35 I'd like to say hi (perhaps thats an option), but good evening is - in most cases - only applicable to a small subset of users.

13:35 amalloy: ugt?

13:35 clojurebot: ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html

13:36 bulters: thanks

13:36 amalloy: that said, if everyone greeted everyone who joined the channel, there'd be no room for meaningful conversation

13:37 so it's pretty common on irc to not waste breath on hellos

13:37 bulters: amalloy: could be, i don't expect a full "hi newbie, nice you're back; anymore questions?" from anyone...

13:38 but for some reason i find joy in a short polite hi

13:38 amalloy: bulters: well, feel free

13:38 it's not offensive or anything

13:38 bulters: amalloy: as I just did ;-) and no offense is taken at all...

13:38 amalloy: heh

13:39 bulters: as soon as nobody gets hurt ;-)

13:39 long**

13:39 ilyak: dnolen: clj version http://pastebin.com/E1KBiEKX

13:40 dnolen: js version http://pastebin.com/5F1BMFqe

13:40 dnolen: ilyak: already see the problem. You need type-hints. That code'll hit crazy amounts of reflection. You'll probably see a 10X speed boost just by adding them.

13:40 ilyak: it's really lame before it was written in hurry

13:41 dnolen: What to read about that?

13:41 aredington: @ilyak: http://clojure.org/java_interop#Java%20Interop-Type%20Hints

13:41 dnolen: ilyak: you can't just call Java methods like that and expect the code to be fast. the compiler doesn't know the types.

13:43 ilyak: So I should only do that when I call Java?

13:44 dnolen: ilyak: when performance matters yes, type-hinting is for dealing with Java (or primitive math in 1.2.0)

13:46 aredington: ilyak: If you (def *warn-on-reflection* true) you'll be told every time that clojure's having to use reflection to correctly type things, those are good candidates for type hinting as an optimization

13:46 ilyak: aredington: Did that

13:46 Wow

13:46 dnolen: ilyak: aredington: (set! *warn-on-reflection* true)

13:46 ilyak: It switched gears obviously when I added three hints

13:47 dnolen: ilyak: like I said, a clojure being slower than rhino/js sounded outrageous to me :)

13:47 fliebel: heya devn

13:48 ilyak: dnolen: Can you help me setting some non-obvious hints?

13:49 dnolen: Basically I need to tell clj that (:stop right), (:start right) and date are LocalDates

13:49 and (:major right) is String

13:49 Where do I put those?

13:50 dnolen: ilyak: line 25, 28, 31 all those need hints. I don't have time at the moment to point out each one unfortunately.

13:51 TimMc: ilyak: ^LocalDate foo tells the compiler that foo evaluates to a LocalDate.

13:52 ilyak: One sec, I'll paste a fresh version

13:52 edw: Is there any way to dynamically add project dependencies without re-starting Clojure?

13:52 amalloy: TimMc: i think dnolen is right though, he wants to put hints in the function params

13:52 edw: no

13:52 edw: That is a downer.

13:52 TimMc: amalloy: Not having seen the code... probably.

13:52 edw: But thank you.

13:52 stuartsierra: edw: Kind of a fact of JVM life, unfortunately.

13:53 ilyak: dnolen: http://pastebin.com/NR2KY3y3

13:53 TimMc:

13:53 edw: I'd like to see (require '(lamina "0.4.0-SNAPSHOT")).

13:53 ilyak: How do I do a type hint on return type?

13:54 fliebel: Is there anyone around who eats Java concurrency for lunch? I have some code that *should* to all my understanding work, but hangs 1/100 times. https://gist.github.com/934781 Related Java code: http://stackoverflow.com/questions/5378391/closing-a-blocking-queue

13:54 dnolen: ilyak: (defn ^String foo [] ....)

13:54 TimMc: ilyak: Line 39, you probably want [^String string] for the arguments.

13:55 Or wait... Integer/parseInt might not need that since there's no ambiguity.

13:55 ilyak: TimMc: Nope, it figured it out (does not complain)

13:55 TimMc: OK, cool.

13:55 dnolen: ilyak: rule of thumb, if your Clojure code isn't between 1X-4X of Java, something is wrong.

13:56 TimMc: dnolen: That reminds me, I need to do some performance analysis on my rasterizer.

13:56 It was super slow compared to Java. I blame the lack of primitive-passing.

13:56 (Clearly, it can't be my own fault... :-P)

13:56 amalloy: dnolen: well. if you *want* it to be close to java and it's not close, something is wrong. if you're putting together a program where elegance and/or ease of development is more important i wouldn't say something is wrong

13:57 stuartsierra: A thought: algorithms designed to be efficient with mutable data cannot be implemented efficiently with immutable data, and vice-versa. Discuss.

13:57 dnolen: stuartsierra: which is why I want Pods.

13:57 chouser: s/cannot/cannot always/ and I'm good to go

13:58 stuartsierra: s/cannot/can rarely/

13:58 sexpbot: <stuartsierra> A thought: algorithms designed to be efficient with mutable data can rarely be implemented efficiently with immutable data, and vice-versa. Discuss.

13:58 ilyak: dnolen: How do I help it with write-next?

13:58 chouser: that'll do nicely. :-)

13:58 ilyak: ehm .writeNext

13:58 it's CSVWriter.writeNext(String[])

13:58 TimMc: ilyak: Hint it in the let

13:59 amalloy: ^"[String" i think

13:59 or...there's an L in there somewhere

13:59 &(class (into-array ["test"]))

13:59 sexpbot: ⟹ [Ljava.lang.String;

14:00 TimMc: ilyak: ^Hint lister (get ...) I think...

14:00 ilyak: TimMc: Okay

14:01 It's almost done

14:02 Now it could not figure out reflection for .plusDays (lines 133-134)

14:03 raek: iirc, ^"[String" can be written as ^strings

14:03 or maybe that is only for primitives

14:04 ilyak: It still have some strange issues

14:04 amalloy: raek: i think it's primitives. string *might* be special cased, but i'd be surprised

14:04 ilyak: For example, I need to do (defn ^DateTime read-date-time [^String string] (.parseDateTime date-time-formatter string))

14:05 Why can't it figure out the determined return type of read-date-time?

14:05 amalloy: ilyak: you haven't told it what date-time-formatter is

14:05 raek: ilyak: functions always return Objects (in 1.2)

14:06 Andja: Ok, people I have a assignment due tomorrow for clojure and I really really need someone to give my code a look and tell me is my code ok and give me some tips perhaps. https://code.google.com/p/binary-search-tree-implementation/source/browse/trunk/%20binary-search-tree-implementation/tree.clj

14:06 please pm me :)

14:06 raek: ilyak: you cant put a typehint there, so you have to put it at all places where the function is called

14:07 ilyak: amalloy: It can infer that too

14:07 TimMc: ilyak: THe compiler *might* need to be told the type of qux in (.foo bar qux), but it *always* needs to know what type bar is.

14:07 fliebel: Andja: Why pm?

14:07 Andja: fliebel: Because I am to embarrased to talk in public :)

14:07 Chousuke: Andja: It could use some more spaces :P

14:08 and perhaps destructuring

14:08 fliebel: Andja: Except for the formatting, it looks okay to me. Except that your doc strings are on the wrong side of the arguments.

14:08 Andja: fliebel: I dont even know how to run my code without copy pasting it in emacs

14:08 Chousuke: instead of doing (:val tree) etc. all the time, destructure with {:keys [val L R]} instead

14:08 then you can just use val, L and R to refer to the values

14:09 Andja: Chousuke: Ok, thank you ill rewrite it

14:10 ilyak: TimMc: raek: http://pastebin.com/TfceKQ0n

14:10 Chousuke: eg. (defn makeseq [{:keys [val L R] :as tree}] (when tree (concat (makeseq L) [val] (makeseq R))))

14:10 ilyak: Why does it complain that call to print can't be resolved?

14:10 I mean, I did everything I could

14:10 TimMc: ilyak: Looks reasonable to me, but I'm not an expert on the compiler.

14:11 Chousuke: Andja: otherwise, it seems ok. But yeah, fix the formatting :)

14:11 fliebel: Whoa, is it just me, or are there *a lot* of open issues for Clojure?

14:11 ilyak: amalloy: dnolen: any ideas on http://pastebin.com/TfceKQ0n vs "call to print can't be resolved"?

14:11 raek: ilyak: this works (defn foo [] ...) (defn bar [] (let [^Foo f (foo)] ...)) but not this (defn ^Foo foo [] ...) (defn bar [] (let [f (foo)] ...))

14:12 Andja: Chousuke: What do you think I should add to my project cus it looks kinda dry just like that on it's own.

14:12 raek: ilyak: basically, type hints are only considered inside functions. they are gone after the function is compiled

14:12 amalloy: candles and cupcakes

14:12 Chousuke: Andja: no idea :)

14:12 Andja: Chousuke: haha :) Thanx anyway m8 appriciate it!

14:13 stuartsierra: fliebel: There are a lot of JIRA tickets, with a lot of duplication.

14:13 ilyak: raek: So type hints inside (def are worthless?

14:13 raek: ilyak: now I saw that date-time-formatter was not a function, but the same thing holds

14:13 ilyak: yes

14:13 ilyak: Why aren't they an error?

14:14 And what can I do? I can't use global-bound java objects?

14:14 fliebel: stuartsierra: I see… Is there anything mere mortals can do to improve that situation?

14:14 raek: I have no answer reagarding the reason, but the compiler ignores metadata where it doesn't look for it

14:15 ilyak: raek: In fact it seems to not be the case

14:15 stuartsierra: fliebel: Add comments with explanations & links where you find duplicates.

14:15 ilyak: If I remove a type hint ^DateTime read-date-time, then .toLocalDate in read-local-date fail to resolve

14:16 if I keep it, it resolves

14:17 raek: oh. hrm. maybe you're right

14:17 stuartsierra: Type hint metadata can go on Vars, symbols, or list expressions.

14:17 raek: didn't know that the compiler looked at the metadata of the var, in addition to the metadata on the code data structure

14:18 fliebel: stuartsierra: Okay. But… don't people use the search function themselves?

14:18 ilyak: oops

14:18 I had a faulty type hint

14:18 that's why it failed

14:18 stuartsierra: fliebel: not always

14:19 we've had 3 different ticket trackers in 3 years, we're still recovering

14:19 TimMc: ilyak: Misspelling?

14:19 raek: does the compiler treat the :tag metadata of a var containing a fn as the type hint for the return value then?

14:19 fliebel: stuartsierra: Ouch, that does not help I guess.

14:20 aredington: Hopefully someone will wait till 2013 to write a ticket tracker in Clojure.

14:20 stuartsierra: raek: yes

14:20 ilyak: TimMc: Nope, I told it that date-time is String

14:20 raek: ilyak: please ignore what I have said... :-)

14:20 ilyak: Apparently it didn't believe

14:20 The only issue I have standing is:

14:20 154 - reference to field toLocalDate can't be resolved

14:25 fliebel: stuartsierra: Ouch, this is harder than I thought. I found one duplicate so far. Can I ignore the ones by http://dev.clojure.org/jira/secure/ViewProfile.jspa?name=importer?

14:25 stuartsierra: not necessarily.

14:26 You can ignore all CONTRIB-* issues, however.

14:26 fliebel: And probably those by the core team as well.

14:26 stuartsierra: probably

14:27 cemerick: Projects go into JIRA, and _they never come out_

14:27 stuartsierra: the core team is working on this — we had a whole meeting this morning about pruning tickets for the next release.

14:27 * cemerick cue swelling score?

14:27 stuartsierra: But deleting duplicated or vaguely-defined tickets hasn't been as much of a priority.

14:28 Got to go focus on my talk for #phillyete next week.

14:29 aredington: fliebel: if you use the advanced search feature you can scope things pretty precisely e.g. 'project = CLJ AND issuetype = Defect' will get you only the defects against the main clojure lang

14:29 I know embarrassingly too much about jira issue juggling so feel free to direct questions toward me :)

14:29 ilyak: wow

14:30 It's /really/ fast now

14:30 2x the js version

14:30 dnolen:

14:30 3x

14:30 hiredman: sounds like we need (as far as I know unwritten) jira-jdbc

14:30 (a jdbc driver for jira)

14:30 fliebel: aredington: I figured that out, but now I have only 17 tickets left, so I must have selected to… selectively.

14:32 dnolen: ilyak: nice.

14:33 fliebel: Meh, I'd rather spend time fixing my own issue than browsing stuff by others. Only.. I'm really stuck.

14:34 ilyak: dnolen: last question for today

14:34 http://pastebin.com/cFNx0SnG

14:34 Is there a way to make it shorter?

14:34 I mean, it's cool that it's fast, but 2x more lines is eww

14:34 (one function)

14:35 fliebel: ~logs

14:35 clojurebot: logs is http://clojure-log.n01se.net/

14:35 raek: ilyak: (map (fn [x] ...) coll) -> (for [x coll] ...)

14:36 dnolen: ilyak: can't dig in but I saw a lot of things I would do differently in your code. Using records in this kind of code seems pretty unnecessary.

14:36 raek: you can even do (for [x coll :let y (f x)] ...y...)

14:36 ilyak: cool tanks

14:36 dnolen: I'm just dabbling

14:36 I'll be back for advice one day :)

14:37 aredington: fliebel I get 42 back with 'project = CLJ AND issuetype = Defect and status=Open'

14:37 raek: s/:let y (f x)/:let [y (f x)]/

14:38 fliebel: aredington: Okay, I'll have another look later &&&& < to find it in my search history

14:38 dnolen: ilyak: lines 51 59, would be shorter w/ destructuring.

14:38 ilyak: destructuring could be used in quite a few places.

14:40 ilyak: figure-out-best-major looks like it could be made way shorter.

14:40 Raynes: drewr: postal doesn't support SSL, does it? :|

14:41 drewr: Raynes: not directly, but it's trivial through msmtp or some other proxy

15:01 Raynes: drewr: I'll probably fork it and add it myself.

15:01 Would you be opposed to direct SSL support?

15:02 drewr: not at all

15:02 just isn't a priority when other tools do it better

15:03 Raynes: drewr: Right, but I'd rather not depend on something can't be grabbed by maven, and JavaMail supports it.

15:04 something that*

15:05 drewr: you need to expand your horizons :-)

15:05 however, if you do the work I'll certainly consider it

15:07 chrissbx: Is there a macro to split its arguments into right-associated binary calls?

15:08 e.g. (right-associate foo a b c) -> (foo a (foo b c))

15:08 fliebel: chrissbx: reduce?

15:09 * chrissbx checks

15:09 chrissbx: well that's a function, and it expects a list.

15:10 chouser: and will left-associate

15:10 fliebel: true

15:11 hm, in Haskell there is foldl and foldr...

15:11 amalloy: fliebel: guess what is in amalloy-utils

15:11 fliebel: amalloy: Oh, I know this one! Let me think… lazy-reduce?

15:12 no, lazy-recur!

15:13 amalloy: How did you implement it? Let me see...

15:13 chouser: chrissbx: you're sure you want a macro?

15:13 fliebel: okay, I found unfold…

15:14 chrissbx: Well, it seemed like the natural thing: I want to turn a syntactical representation to another one

15:14 Yes I could create a list and then fold, but..

15:14 that needs the list, and also it needs list construction syntax syntactically.

15:14 Seems like a double looser.

15:15 fliebel: oh, lazy-loop even, but amalloy, I can't find it :(

15:15 amalloy: fliebel: it's in amalloy.utils

15:15 not utils.whatever

15:15 i guess i might not have pushed it?

15:15 haha apparently so

15:15 sorry to taunt you fliebel

15:16 fliebel: haha sadface

15:16 amalloy: fliebel: i just implement it as (reduce (reverse-args-to f) (reverse coll))

15:16 fliebel: amalloy: Do you happen to have an implementation of seque laying around locally as well?

15:17 amalloy: fliebel: no, but i was interested by your tweet. finish it up, i want it

15:17 fliebel: amalloy: It works, except sometimes it does not :(

15:17 amalloy: ouch

15:18 fliebel: Even though it's in java.util.concurrent, it's still not persistent, so it comes with all the classical java problems.

15:33 nlogax: anyone using "static", the static site generator?

15:33 wondering why it crashes if i include a doctype in the default hiccup template

15:45 edw: Is there a clojure.string/split-like procedure where you specify what characters to collect, as opposed to which characters separate an element? E.g. (FOO "this is a test" #"[a-z]+")

15:46 amalloy: edw: re-seq?

15:46 ataggart: ,(re-seq #"[a-z]+" "this is a test")

15:46 clojurebot: ("this" "is" "a" "test")

15:46 edw: I think that'll do the trick. Thanks!

15:53 pdk: (doc reverse-args-to)

15:53 clojurebot: Excuse me?

15:53 pdk: ,(reverse-args-to +)

15:53 clojurebot: java.lang.Exception: Unable to resolve symbol: reverse-args-to in this context

15:54 amalloy: pdk: not a built-in

15:54 chouser: #(+ %2 %1)

15:54 pdk: in contrib then?

15:55 chouser: shorter, and no distracting alphabet chars!

15:55 amalloy: pdk: https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/reorder.clj

15:56 arohner: is there a fn to update the metadata, like assoc-meta, or do I have to do it by hand?

15:56 amalloy: &(doc vary-meta)

15:56 sexpbot: ⟹ "([obj f & args]); Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata."

15:56 arohner: amalloy: thanks. I should have find-doc'd first

15:57 dnolen: ,(let [flip (fn [f] (fn [& xs] (apply f (reverse xs))))] ((flip /) 2 4))

15:57 clojurebot: 2

16:04 bulters: this is odd; i added congomongo as a dependency in lein, tell it to use somnium.congomongo and I get a compile error

16:04 am I forgetting something?

16:04 amalloy: lein deps?

16:05 bulters: that's done

16:05 amalloy: and it successfully got into your lib directory?

16:05 bulters: yes, including dependencies

16:06 restarted swank

16:08 ok, got it... I tried out congomongo without somnium. before restarting swank

16:10 ideamonk: Hi I'm very new to clojure, and am trying to nest a function inside another and call the nested function (mycount2) from outer function (mycount). But it seems everytime I try running it, I get a nil, am I calling the nested function the wrong way? is there a way to assign default values to arguments of a function in clojure? http://paste.pocoo.org/show/376541/ .. also I'm very new to functional programming itself. Looking for any

16:11 pdk: you're using fn wrong

16:11 ohpauleez: ideamonk: I'm looking at your paste now

16:12 pdk: ex. (fn [x y] (+ x y)) would simply create and return an anonymous function that returns x + y, it won't give it a name or make it available to call by name

16:12 ideamonk: pdk: isn't fn like anonymous functions, that can be created in-place and called in-place ?

16:12 pdk: yes

16:12 if you want to give it a name

16:12 you'd either use (defn function-name [arguments] body...) to give it a name that can be used at the toplevel

16:13 or store it within something such as in a let block to have it available in a local scope

16:13 ideamonk: pdk: Thx, im trying to rectify now.

16:13 pdk: ex. (let [myfn (fn [x y] (+ x y))] body...) will define myfn as the function given and will make it accessible from within the body of the let statement by that name

16:14 amalloy: ohpauleez: you okay with releasing a non-snapshot of clj-github? i'm using it for 4clojure.com and want to reduce our snapshot usage

16:14 ohpauleez: amalloy: Yeah, it's still matches the API right now and has tests where it matters most

16:15 Raynes does the releases to clojars though

16:15 amalloy: ohpauleez: i know. he didn't want to release without checking with you, since you've been doing more dev than him

16:15 Raynes: ohpauleez: Cool, I'll release it later.

16:16 amalloy: i'm in a similar position with clojail

16:16 Raynes: amalloy: Remind me, please, because I know I'm going to forget.

16:16 ohpauleez: amalloy, Raynes: Cool, yeah, go for it

16:16 pdk: take a look at the reply to the paste

16:16 or rather here it is http://paste.pocoo.org/show/376547/

16:16 er correction

16:16 ideamonk: pdk: thanks :)

16:17 pdk: (fn mycount [coll] should be (defn mycount [coll] if you want to be able to refer to mycount by name outside of that function def

16:17 the way fn alone works is

16:17 ideamonk: pdk: im doing 4clojures :) they're like in place fill in the blanks

16:17 pdk: (fn fn-name [arguments] lets you refer back to the function you're writing by calling it with fn-name if it's defined recursively

16:17 but that won't make fn-name refer to the function from outside

16:18 ideamonk: hmm

16:18 pdk: replacing fn with defn in (fn mycount [coll] defines it by the name mycount and makes it accessible at the toplevel

16:19 basically (defn myfn [args] ...) = (def myfn (fn [args] ...))

16:19 and def defines symbols that can be referred to by name at any scope

16:19 ideamonk: yes

16:22 hiredman: pdk: no, def creates vars

16:22 not symbols

16:22 the reader and the symbol function create symbols

16:25 bulters: amalloy: didn't know about 4clojure; very nice :D

16:26 amalloy: bulters: it's only a few days old, so that's why you didn't know :P

16:28 bulters: amalloy: works really nice; working through the problems now :D

16:30 pdk: so do you register an acct for this 4clojure deal

16:31 peteriserins: oh god, I wish I knew that fns can be named before doing the 4clojure problems by loop recur only

16:31 amalloy: pdk: you don't have to, but you should: www.4clojure.com/register

16:32 peteriserins: didn't let me use def so I thought explict recursion is discouraged

16:32 amalloy: peteriserins: nope, just def is discouraged :)

16:33 peteriserins: amalloy: btw what's the idiom for contributing problems? should one fork the dataset?

16:33 bulters: can you recur in a lambda?

16:33 amalloy: peteriserins: yes, for now

16:33 fork the repo, change data_set, push, send a pull request

16:33 we have a feature request to add a nicer ui for that

16:33 peteriserins: yeah that'd be very welcome

16:35 bulters: amalloy: rather than trying it out, i'll ask you (not to cheat): if you ask write a function, does it check if a function really is written?

16:35 or does (reverse (first list)) also work for problem 19? :P

16:35 amalloy_lunch: bulters: no. the test cases there get run, and that's about it

16:36 bulters: ok, thanks. enjoy your lunch

16:36 amalloy_lunch: someone submitted "reduce conj ()" as a solution to one problem

16:36 bulters: ha! :D

16:36 peteriserins: amalloy_lunch: how do you view others' solutions?

16:47 spewn: For all the ones in the form "(= ___ ...)", the most trivial "solution" seems to be "=);"

17:00 krl: can you define protocol functions with variable amount of arguments?

17:01 matthias_: can i check which versions are avaiable of a dependency?

17:01 cemerick: krl: no, you can't use varargs in protocols (yet, perhaps)

17:02 krl: hmm. no way to get around this/other ways of doing multidispatch?

17:02 cemerick: matthias_: http://mavencentral.sonatype.com/ is there for central; You should be able to spelunk through clojars if that's where the dependency you're after is deployed.

17:02 krl: multimethods, if that suits you

17:02 matthias_: thanks

17:02 amalloy: peteriserins: there's a button to tweet your solution. i only see the ones that get tweetet

17:02 cemerick: protocols do not offer multiple dispatch

17:02 amalloy: but check on twitter for #4clojure

17:04 krl: cemerick, ah true, had my concepts wrong. single dispatch is enough for me

17:04 looking at multimethods, thx

17:14 peteriserins: amalloy: cool, thanks

17:35 devn: how to dispatch on type with multimethods

17:35 err when there's a protocol involved

17:36 amalloy: (defmulti foo (fn [a & _] (class a)))?

17:36 raek: devn: why not use protocols and types directly?

17:37 devn: nah, it's like (defprotocol Foo (dothis [this] "foo bar") (dothat [this] "baz qux"))

17:38 (reify Foo (dothis [this] (str "dothis")) (dothat [this] (str "dothat")))

17:39 when you do this many times it seems like it's a bit redundant

17:40 it feels like there should be a way to dispatch with a multimethod based on something being a Foo

17:40 does that make sense?

17:40 ataggart: Why do you have those strings in your defprotocol?

17:40 raek: so what would the different dispatch values be?

17:40 devn: docstrings

17:41 ataggart: good, so then what's the redundancy?

17:41 devn: I want to say, if the thing is a Foo, do this, but if it's a String, do that

17:43 i end up with (cond (satisfies? Foo ...) (dothis) (isa? (class ...) String) ...) :default (throw (RuntimeException. ...)))))

17:43 ataggart: (extend-protocol Foo String (dothis ...))

17:43 devn: hmm, trying that, give me a moment :)

17:43 ataggart: Foo is the prototype, not a type

17:44 so this: "if the thing is a Foo, do this, but if it's a String, do that" is a possibly broken sentence

17:44 should Foo be a type or a protocol?

17:45 stuartsierra: If you're dispatching on it, then it's a type.

17:45 A protocol is that which does the dispatching.

17:45 ataggart: true, though inconsistent with his examples, hence the question

17:45 raek: devn: to summarize: protocols give you dynamic dispatch on the type of the first argument - even with others' types

17:50 TimMc: 'You tripped the alarm! eval is bad!"

17:50 :-)

17:50 Raynes: >_>

17:50 Was there some hidden context to that? :o

17:51 TimMc: No, just noting that the same security (clojail?) is in place on 4clojure as in one of the bots.

17:51 devn: raek: stuartsierra: ataggart: thanks :)

17:51 stuartsierra: 'welcome

17:52 TimMc: I guess I posted a bit late for the context to be obvious.

17:52 Raynes: TimMc: Aye, yes.

17:52 TimMc: I work on 4clojure as well.

17:54 TimMc: The Top Users page doesn't get recomputed right away, I see.

17:55 Raynes: Grrr, I do not like problem 4.

17:56 Raynes: I didn't write that. ;)

17:56 amalloy: TimMc: yeah, a project Raynes and i are involved in, which needs sandboxing...not at all surprising that it uses clojail :P

17:56 TimMc: Raynes: Well, express my displeasure to whoever did. :-P

17:56 Raynes: Will do.

17:57 TimMc: (There's something fundamentally icky about telling users to put in a sequence of forms for a single form.)

18:03 Raynes: I think I wouldn't find it problematic if there was a demo problem that showed multiple forms entered as a solution.

18:07 ohpauleez: TimMc: There's a getting started section that shows that, but I think it should be integrated into the problem set

18:26 TimMc: It doesn't show multiple forms.

18:26 If I were coming straight from another Lisp, problem 4 would have confused me a lot more than it already did.

18:38 schlechtv: When using cake to execute a clojure "script": how can I pass commandline args? It doesn't seem to use ~main as an entry point ...

18:46 Raynes: _fogus_: Ping.

19:01 chrissbx: I'm missing the documentation of quasiquote

19:02 What's wrong with (defmacro ist [expr res] `(is (= ',res ,expr))) ?

19:03 amalloy: chrissbx: ~, not ,

19:03 er

19:03 the single character to unquote is ~

19:03 chrissbx: Ok, but it already complains about is, no such variable mynamespace/is

19:04 amalloy: you need to define the macro in a namespace that knows about is

19:04 presumably the one from clojure.test or some such

19:04 &`walk

19:04 sexpbot: ⟹ clojure.core/walk

19:04 chrissbx: (ns mynamespace (:require clojure.test))

19:04 amalloy: that's only a require, not a refer

19:05 chrissbx: aha

19:05 amalloy: if you wrote clojure.test/is, it would work

19:05 chrissbx: Ok, thanks.

19:07 Ah, comma seems to be a noop.

19:07 amalloy: chrissbx: it's whitespace

19:07 chrissbx: yep

19:08 amalloy: &(+,1,2,3,,)

19:08 sexpbot: ⟹ 6

19:11 scottj: I want to implement a foo where (foo "abc" "ac") => 2/3 and (foo "abc" "cba") => 1/3, any obvious/simple ways to do this?

19:12 Kowboy: hello

19:13 amalloy: &(map #(if (= %1 %2) 1 0) "abc "cba")

19:13 sexpbot: java.lang.Exception: EOF while reading string

19:13 amalloy: &(map #(if (= %1 %2) 1 0) "abc" "cba")

19:13 sexpbot: ⟹ (0 1 0)

19:13 amalloy: scottj: now just sum the list and divide by count

19:14 scottj: &(map #(if (= %1 %2) 1 0) "abc" "ac")

19:14 sexpbot: ⟹ (1 0)

19:15 scottj: so doesn't work for both cases

19:15 amalloy: scottj: so far you haven't asked for any particular behavior when the strings aren't the same length

19:17 oh, you have

19:17 haha

19:17 it was sneakily word-wrapped on my client. anyway, if you could explain where you want that 2/3 number to actually come from...

19:18 scottj: number of characters in %2 in same order as %1

19:18 amalloy: $google longest common subsequence

19:18 sexpbot: First out of 16200 results is: Longest common subsequence problem - Wikipedia, the free encyclopedia

19:18 http://en.wikipedia.org/wiki/Longest_common_subsequence_problem

19:24 scottj: yeah that's it, thanks for the pointer

19:25 amalloy: scottj: good, hope you find something useful there. the usual solution always had trouble fitting in my head

19:37 chrissbx: Is there some kind of an assert form that returns the value if it's ok? e.g. (first (assert* pair? (foo bar)))

19:38 Hm, how do you actually check for a non-empty list?

19:38 amalloy: seq

19:39 chrissbx: (doto (foo bar) (->> (assert pair?))) would be one way to do it with existing tools

19:39 chrissbx: amalloy: re seq, hu? That returns a sequence, not a boolean.

19:40 amalloy: &(map seq [[] [1]])

19:40 sexpbot: ⟹ (nil (1))

19:40 amalloy: nil is like false, anything else is true. you don't need an actual boolean

19:40 chrissbx: aha, hu

19:41 Well, seq fails if its argument is not already a sequence or empty.

19:41 Which doesn't concern me in my current chunk of code, but still.

19:41 amalloy: &(doc coll?)

19:41 sexpbot: ⟹ "([x]); Returns true if x implements IPersistentCollection"

19:46 chrissbx: How do I expand a piece of code completely, or n layers? Both macroexpand-1 and macroexpand only expand 1 layer.

19:47 amalloy: &(use 'clojure.walk)

19:47 sexpbot: ⟹ nil

19:47 amalloy: &(doc macroexpand-all)

19:47 sexpbot: ⟹ "([form]); Recursively performs all possible macroexpansions in form."

19:48 chrissbx: Thanks

19:48 amalloy: chrissbx: not strictly true, though. macroexpand expands N layers of macros - it just doesn't expand macros in the *arglist*

19:48 &(macroexpand-1 '(doto x inc))

19:48 sexpbot: ⟹ (clojure.core/let [G__29748 x] (inc G__29748) G__29748)

19:48 amalloy: &(macroexpand '(doto x inc))

19:48 sexpbot: ⟹ (let* [G__29756 x] (inc G__29756) G__29756)

19:49 chrissbx: yes, no subforms (I've just read the docs)

19:50 ideamonk: has anyone encountered any problem with the last z in https://www.4clojure.com/problem/36 ?

19:52 amalloy: ideamonk: i wrote that problem. what do you mean, encountered problem?

19:53 ideamonk: amalloy: yup the solution which works locally isn't working there, weird , ending with java.lang.Exception: Unable to resolve symbol: z in this context (NO_SOURCE_FILE:0)

19:54 amalloy: then you're doing it wrong :P. can you paste into irc the solution you're putting in the 4clojure text box?

19:55 ideamonk: amalloy: http://pastebin.mozilla.org/1210219

19:56 works locally, while on 4clojure page its a "java.lang.Exception: Unable to resolve symbol: z in this context"

19:57 amalloy: i hope im not doing something stupid :P

19:58 amalloy: ideamonk: i have bad news for you, then

19:58 :)

19:58 ideamonk: ah

19:58 amalloy: &(let [x 7] [y 3] x)

19:58 sexpbot: java.lang.Exception: Unable to resolve symbol: y in this context

19:59 amalloy: let only treats the first vector as a binding, is my point

20:00 &(let [x 7, y 3] y)

20:00 sexpbot: ⟹ 3

20:00 ideamonk: if we fill the last blank with "[z 1]" , it becomes

20:01 &(= 1 (let [z 1] z))

20:01 sexpbot: ⟹ true

20:01 amalloy: ideamonk: there's no "last blank"

20:01 all three blanks are filled with the entire text you enter

20:01 ideamonk: amalloy: aha i've been assuming this all time !

20:01 got it then !!

22:38 amalloy: have you done #44 on 4clj ? what could be wrong http://pastebin.mozilla.org/1210284 , seems to work perfect for testcases given, fails on unit tests

22:42 amalloy: ideamonk: try it with a large negative rotation

22:43 eg, a list of size 3, rotated by -9, should stay the same

22:43 ideamonk: AWW

22:43 ah ah THX! :)

23:48 joshua__: $findfn [true true true] true

23:48 sexpbot: [clojure.core/== clojure.core/sequential? clojure.core/second clojure.core/last clojure.core/reversible? clojure.core/distinct? clojure.core/boolean clojure.core/vector? clojure.core/counted? clojure.core/associative? clojure.core/< clojure.core/peek clojure.core/fir... http://gist.github.com/938243

Logging service provided by n01se.net