#clojure logs

2011-03-27

00:04dudlyI have a few sentences:
00:04dudly"1. bla blah bley:"
00:04dudly"yes"
00:04dudly"2. ble blue blah"
00:05dudly"no"
00:05dudly"3. bliggidy blue blah"
00:05dudly"yea"
00:05dudly"4. hi"
00:06dudly"another line"
00:06dudly"and another"
00:06dudly"5. almost there"
00:06dudly"last line"
00:06dudlyand I want to have them group such that
00:07dudly("1. bla blah bley:" "yes") ("2. ble blah bley:") etc... ("4. hi" "another line" "and another") etc
00:09dudlyso the distinguishing characteristic is that each grouping starts with a sentence that begins with a number
00:13tomojmay I ask why people are submitting these as text files?
00:14dudlyso i need a function that iterates across the whole collection, starting the creation of a new collection every time a line starts with a number and adding each line to that new collection etc.
00:14dudlytomoj: cause it's a large organization
00:15dudlythey are submitted as word files, a template that people fill out when they submit a package
00:15tomojso, why word files?
00:15tomojis that not going to change?
00:16dudlyI'm extracting the text out of the word files into text
00:16tomojI mean, you're stuck with word files no matter how stupid they are?
00:16dudlyno, I can't go changing the whole process
00:16tomojbeen a while since I had to deal with that kind of shit :)
00:17dudlyI can only really improve the workflow after the package get's to our group
00:17dudlytomoj: what, bureaucratic bullshit? :)
00:18tomojindeed
00:19tomojsmall team means you can just say "no, this shouldn't be a word template, it should be a webpage"
00:19dudlyyea, I'd love to change it into a webform
00:20tomojtrying to think of a good way to solve your problem.. it seems some kind of reduce with split-with would work, but it also seems like there's gotta be a better way
00:24tomojanyway, are you sure there won't be a number at the beginning of some of the lines within a group?
00:24tomoj(besides the first of course)
00:24dudlywell, there's brute force.. Ideally, the questions won't change very often. there are 34 questions. there are only about 6 or 7 questions that I'm pulling out of the form that are multi-line like that. So, I could just make a function for each one: filter (not "offending sentence" "next sentence" etc) (assoc "whole grouping" collection)
00:26dudlyit's basically a result of the fact that the extraction tool is making multiple lines out of lines in a table-cell, embedded in a word document
00:26dudlythe question is is in a table cell, the answer "yes" or "no" is in the next cell
00:26tomojoh, the only user input is yes/no?
00:26dudlythe text extracted results in lines delineated by newlines and \tabs
00:27dudlyright
00:28tomojthe first line always starts with a number?
00:29dudlyI've got it mostly ironed out, just need to concatenate those lines that are all one question
00:29dudlyyea, and every question's first sentence always starts with a number
00:31dudlyI already have it boiled down to a relatively structured data-structure now.. unless someone screws up the doc before they submit it, question 17 should always be, for instance, the 21st item in my datastructure, for instance
00:32dudlyso I could just drop 21 22 and 23, and then assoc the whole concatenated string.. but that's just so ugly, and if the template changes, I'll have to much around so much in the program again.
00:33tomojassoc the string?
00:33dudlyyea, the 'correct' version of the question, rather than the broken up version
00:33dudlythe problem is that some of the questions are like:
00:34dudly"16. this line"
00:34dudly"then this line"
00:34dudlyinstead of "16. this line then this line"
00:35dudlyI want a "question" "answer" "question" "answer" datastructure
00:36tomojthis was the approach I had in mind https://gist.github.com/8c7bdf1c62f5280470e7
00:36tomojlike I said I think there must be a better way
00:37tomojstill dunno what you mean by "assoc the string"
00:37tomojassoc is something you do to maps or vectors or associative things
00:42tomojdon't study it too hard, it sucks
00:43dudlyyea, I mean, I could probably convert it to a vector and assoc the whole question back at the right index
00:44dudlybut that would be really ugly
00:44dudlyvery brittle
00:44tomojwon't you still have the other lines from the question hanging there after that index?
00:44dudlyI'd drop all the offending lines
00:44dudlyI know their indexes because they generally wont change
00:45dudly*generally*.. if they do, I'd have to go back into the program and update it
00:52dudlyI'm going to try to use what you gave me and see if that works.
01:04no_mindis there a library/package that will generate html form elements ?
01:05no_mindgenerate and manipulate
01:09dudlytomoj: that worked.. worked real good
01:12brehautdudly: and i had just about finished my rough hack :)
01:13dudlybrehaut: I'm still taking entries :) seriously, I'd love to see it, as the education is the most valuable thing here
01:13brehautim not sure you do. this is a huge blob of stream of conciousness coding
01:16dudlyit's a tough one. It seems to skirt most of the use-cases that have already been solved with simple usages of partition or group-by
01:16brehautdudly: https://gist.github.com/gists/888932
01:17brehauttomoj's solution is much cleaner
01:18brehaut(it has names for things!)
01:19brehautanyway i have to disappear again
01:21dudlyi keep getting a 500 error on that gist
01:22dudlykeep refreshing but nothing
01:23tomojme too
01:24tomojno_mind: didn't you ask an enlive question earlier?
01:25brehauthuh weird. try https://gist.github.com/888932
01:28tomojperhaps there's a sense in which enlive can only manipulate and not generate
01:29quotemstrWhat would you guys recommend for a functional n-ary tree with insertion at arbitrary points and an arbitrary set of key-value pairs on each node?
01:33brehautquotemstr: zippers
01:33brehautquotemstr: but i dont know how sorry :/
01:36quotemstrHeh --- that's where I ended up too. The problem is that zippers end up being very complicated as the type structure increases in complexity. But meh -- it was worth a shot.
01:36quotemstrI'll have to go with my hack and see where it ends up performance-wise.
01:38no_mindtomoj, I need a proper forms library that can generate and populate form elements
01:39no_mindenlive cant do this... specially the population part
01:39dudlybrehaut: thanks for the gist. I'm experimenting with it now.
01:41dudlyno_mind: Looks like this JUST hit the wire: http://joost.zeekat.nl/2011/03/26/announcement-flutter-clojure-hiccup-form-fields/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+clojure+%28Planet+Clojure%29
01:42no_mindaha
01:43skelternetAnyone know of an updated version of Stu's laziness blog entry done after lazy-cons was replaced w/ lazy-seq?
01:43dudlyserendipity
01:49no_mindthe place where I am getting stuck in enlive is dynamically selecting form element and iterating over elements. I can generate the elements but I am not been able to figure out how to set all attributes for an element when the attributes are available as hashmap
01:49no_mindmap*
02:16ossareh,(+ nil nil)
02:16clojurebotjava.lang.NullPointerException
02:21skelternetanyone know of any clojure work to use the cl and the compute power on graphics cards?
02:25tomojno_mind: what do you mean by population?
02:25tomojoh, missed your elaboration
02:26tomojquotemstr: how does having arbitrary kv pairs on nodes complicate things?
02:26tomojthe nodes will just be maps
02:27tomojoh
02:27tomojnevermind :)
02:27tomojjust have to write a custom zipper that separates your kv pairs and children data, though?
02:29quotemstrtomoj: Yeah.
02:29quotemstrNothing intractable --- just tedious.
02:29quotemstrMy hackish idea is to skip the zipper entirely and represent the tree-in-waiting as a flat stack of tree mutation operations.
02:30quotemstrThen when we needed the tree representations we'd just "execute" all these operations and build the real tree.
02:33tomojno_mind: huh.. (apply set-attr (flatten (seq the-attr-hashmap))) seems like it would work, but..
02:40tomojquotemstr: isn't the problem how to execute them?
02:43quotemstrtomoj: Brute force suffices.
02:44quotemstrSo, essentially, we don't incrementally build a tree. We maintain a list of instructions for building a tree.
02:45tomojI guess in your problem you don't need to look around at what you've already done to do more?
02:45quotemstrYou can execute those instructions using regular old imperative code.
02:45quotemstr(But the overall data structure is still functional.)
02:46quotemstrThat way, the tree itself doesn't need to be persistent.
02:46quotemstrOtherwise, you're right: we've just added a turtle to the stack.
02:50tomojtoo bad seqs aren't stacks
02:51tomoj(repeat :turtle)
04:18fliebelIn an if, why doesn't the else allow multiple forms? Sometimes when I have 2 branches, there is one one-liner and some work to do.
04:29tomojit would be unpleasntly asymmetric
04:30tomojsome word to _do_
04:32tomojI mean, what if the one-liner is on the false side?
04:32fliebeltomoj: not-if?
04:32fliebelor if-not, can;t emember
04:32tomojdoesn't exist
04:33tomojok
04:33tomoj(if false 1 2 3 4 5) just seems weird
04:34tomojcan't think of any really good reasons not to allow it, but, won't the code be clearer with an explicit do, anyway?
04:34fliebelyea, maybe...
04:43tomojah, not-if resolves the actual problems of usage
04:43tomojbut the ambiguity is the same
04:44tomojer, if-not..
04:44fliebeltomoj: You'd expect it to work a bit more like case in that.. case.
04:44tomojI don't see how case applies
04:45fliebeltomoj: Well, an if statement with seemingly more than 2 brances feels a lot like case.
04:45tomojnot at all to me
04:45tomojthe ambiguity: do (if true 1 2 3 4 5) and (if-not false 1 2 3 4 5) return 1 or 4?
04:46tomojarbitrary asymmetry no matter what
04:47fliebeltomoj: Well, rest args can only come last, but asymmetry still.
04:47tomojheh, right
04:47tomojthat asymmetry is built in
04:54tomojI feel like I remember some functions/macros that break that
04:54tomojbut can't remember which they are
04:54tomojah, aset
05:21fliebeltomoj: Break what?
05:39tomojfliebel: the rest args assymetry
05:39fliebelhow does aset break that?
05:39tomojin one sense it of course can't
05:39fliebel&(doc aset)
05:39sexpbot⟹ "([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
05:39tomojbut semantically, the last arg is special
05:40fliebelhm, indeed.
05:40tomojcase breaks it too, eh? :)
05:41fliebel&(doc case)
05:41sexpbot⟹ "Macro ([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need no... http://gist.github.com/889086
05:42tomoj" by peer [03:52]
05:42tomoj*** waxrose (~waxrose@cpe-24-162-115-160.hot.res.rr.com) has quit: Quit:
05:42tomoj Leaving [03:55]
05:42tomoj*** thorwil (~thorwil@p4FFB7D94.dip.t-dialin.net) has joined channel #clojure
05:42tomoj [03:56]
05:42tomoj*** xkb (~svdberg@svdb.xs4all.nl) has joined channel #clojure [03:58]
05:42tomoj*** OlegYch|h (~OlegYch@87.252.231.38) has joined channel #clojure [03:59]
05:43thorwil?
05:43tomojdid I avoid paste spam?
05:43fliebeltomoj: What was that? did you pipe the output of your irc client back in?
05:43tomojshoot
05:43tomojhow much got through? (what was the last thing I said before I said "did I avoid paste spam?"
05:44fliebel~10 lines
05:44clojurebotI don't understand.
05:44fliebelless
05:44fliebelYou said something about case
05:44tomojok, good, had almost 100 pasted in
05:45fliebeltomoj: Good ctrl-C'ing :)
05:45tomojproblem is that kill-yank preserves text color, so if I accidentally kill+yank a bunch of backlog, it looks just like an input prompt
05:46tomojso I somehow got some backlog pasted in, then what I really wanted to say, but couldn't tell until sending
05:46fliebeltomoj: With great power comes great responsibility ;P
05:46tomojwhat I really wanted to say was "A single default expression can follow the clauses, and its value will be returned if no clause matches."
05:47fliebelwait.. so when I do :else it's just because that symbol is truthy? So I could juts as well say :foo or nothing at all...
05:48tomojfor cond, yes
05:48tomojfor case, :else is superfluous
05:48fliebeloh, wait, case
05:49tomojer.. not superfluous, probably just wrong,eh?
05:49fliebelyea
05:49tomoj..fuck it's 5am..
05:49fliebelIt's not...
05:50fliebelHuh!? NullPointerException [trace missing]
05:51tomojhaha
05:51fliebelWhere did the trace go?
05:51tomojdon't think I've seen that before
05:52fliebelIt does that consistently, maybe something with lazy stuff and closures?
05:55fliebelI got it down to 4 lines, I think.
06:02fliebelOkay, problem solved, but still no idea where my stack trace went.
06:45thorwilin Enlive's source, i see some "defn- ". i see no definition for those and google refuses to deliver an hits that are not actuall about plain defn. anyone here knows more about that?
06:45fliebelthorwil: defn- defines a private function
06:46fliebelthorwil: But you can also say (defn ^:private) I think, so I heard it's considered a legacy feature.
06:47angermanwhy do I want private fns in the first place?
06:48fliebelangerman: Since people are not supposed to depend on them , you can change them at will without breaking your api.
06:49angermanwhat happens if you made some oversight and by privatizing that fn you made it extraordinary cumbersome to work with your library?
06:49angermanI'd prefere to use a "private" namespace.
06:50fliebelangerman: Then you have a bad design. Luckily, you can still access those fns, like in Python, so it's not like thei're lost forever.
06:51fliebel(you being the writer, not the user of course)
06:51fliebel( in most cases at least)
06:52angermanthat's been the experience from the point of a library user.
06:53fliebelangerman: What is a private ns? I'd rather group my functions by function, rather than by access.
06:53angermanfliebel: *ns*.private/
09:31krlhmm. i still get by lein swank -> java.net.BindException: Cannot assign requested address (NO_SOURCE_FILE:1)
09:32krlhmm
09:48raekkrl: sounds like you have an old swank server running somewhere
09:48krli have done killall java
09:48krlpretty sure this is not the case
09:48krlalso, different ports give the same error
09:49p_l|homeraek: or the socket wasn't closed and haven't been recycled yet
09:50krland the NO_SOURCE_FILE thing is just noise?
09:51p_l|homeNO_SOURCE_FILE sounds to me like a case of error being raised from code that wasn't loaded from known source file
09:51p_l|homethat is, the VM can't deduce source file for the code raising the error
09:58krlp_l|home: yeah makes sense
09:59krli'll just reboot to hard-exclude any lingering socket problems. brb
09:59p_l|homekrl: remember to set up socket reuse
10:00p_l|home(a sysctl on linux, dunno about other systems)
10:01fliebelIs there any difference between nanoTime and currentTimeMillis besides the nano/milli? My computer wont do exactly nano, so it seems milli is good enough, but are there any other reasons to use one or the other?
10:03krlp_l|home: reboot actually seems to have solved it. i'll look up socket reuse, thanks!
10:04fliebel(wyf is 20N?)
10:04Caffeinefliebel: I don't know who would use nano and why... I've been told a couple of times that the JVM wasn't precise enough anyway. I always use milli.
10:04fliebelah clojure.lang.BigInt
10:10p_l|homekrl: because reboot clears the state
10:18Licenserhas anyone played with jain-sip and clojure?
10:41fliebelIt seems there is now way I can make future-call use my own threadpool? I don't feel like running 2 threadpools.
11:00krzysz00Does clojure have something similar to Java's import?
11:01angermankrzysz00: (import …) ; (require … ) ; (user … ) ?
11:10krzysz00What's the #^ reader macro do. Google's not helping, sadly?
11:11angermankrzysz00: meta data
11:12sritchiekrzysz00: it's been replaced by ^
11:12angerman,(meta #^ :private 'foo)
11:12clojurebotnil
11:13angerman,(meta ^:private 'foo)
11:13clojurebotnil
11:13angerman?:-|
11:13sritchie,(def ^{:doc "The number 5."} testnumber 5)
11:13clojurebotDENIED
11:14sritchiehaha, bummer
11:14jonhhehe
11:14angerman,(let [x ^{:doc "yes!"} 5] (doc x))
11:14clojurebotMetadata can only be applied to IMetas
11:14angerman,(let [x ^{:doc "yes!"} (fn [_] "no!")] (doc x))
11:14clojurebotHuh?
11:14RaynesMight as well give that up.
11:15angermannow that response caught me by suprise
11:17angerman,(let [x ^{:doc "yes!"} (fn [_] "no!")] (meta x))
11:17clojurebot{:doc "yes!"}
11:17angermanhm. no :line?
11:22fliebelHow do I iterate over a LinkedBlockingQueue in a blocking manner? It just gives me all it can and quits. I guess I need to .take in a loop manually then?
11:28fliebel(while true (.take)) is what I have now.
11:29Raynesfliebel: That's basically what I have, except I'm checking if the queue is empty.
11:29krzysz00What do you need to do to declare a var final (I'm trying to translate some Java code)?
11:29angermankrzysz00: why final?
11:30angermankrzysz00: does it need to be final? If so, why?
11:30RaynesDeclaring a var final doesn't make a whole lot of sense. You don't have to translate Java directly.
11:32krzysz00good point
11:34fliebelHm, I've needed a combination of assoc and assoc-in a few times now. Does it exist? I want to change multiple keys in a nested structure at once.
11:35krzysz00In Common Lisp I would write (let ((button (new button args*))) (frob button)) Does clojure still use let for that, or binding, or something else?
11:36angerman(let [button (button. args*)] (frob button))
11:37angermanassuming button is a Java class.
11:37danlarkinor better yet just (frob (Button. args))
11:37angermanotherwise use what ever constructor you have.
11:40angerman:/
11:41angermaniOS devel seems to converge towards just paying the apple fee.
11:41angerman(for me that is)
11:54krzysz00how would I rewrite this bit of Java into clojurehttp://pastebin.com/Qdht4CN3
11:55krzysz00er .whoops http://pastebin.com/Qdht4CN3
11:58TimMcDepends on what R is.
11:58TimMcIs that a class?
11:59p_l|homeTimMc: R is an autogenerated read-only class full of static members
12:00krzysz00I got the R bit as (let [button. (.findViewById R$id/quit_button)]
12:01TimMcWhy the period at the end of button ?
12:02angerman,(let [x. (fn [] "x")] (x.))
12:02clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: x
12:02angerman,(let [x. (fn [] "x")] x.)
12:02clojurebotjava.lang.ClassFormatError: Illegal field name "x." in class sandbox$eval5877
12:03krzysz00typo
12:03TimMcSo, inside the let, you can do (.setOnClickListener button (proxy [View$OnClickListener] [] (onClick [^View v] ...))) or something.
12:03TimMcI may have gotten the proxy syntax slightly wrong.
12:04krzysz00oh. proxy, right. I'll look that up
12:05fliebelThe repl is biting me! How can I reload/use a lib without getting errors because I have a function named future?
12:05TimMckrzysz00: In general, http://clojure.org/java_interop has what you need for using Java libs from Clojure.
12:05fliebelrefer-clojure doesn't seem to help.
12:06TimMcfliebel: (:use [foo.bar :exclude [future]])
12:07TimMcor :rename
13:17fliebelStill not working: WARNING: future already refers to: #'clojure.core/future in namespace: ant-mine.animate, being replaced by: #'ant-mine.schedule/future ns line in animate reads (:refer-clojure :exlude [future])
13:18auabegginer Clojurer here
13:18auatrying to implement markov chain algorithm
13:19auaand seeing low performance
13:19fliebelaua: Hold on! *browsing gists*
13:19auanot looking for a great implementation ;-)
13:19auajust trying to improve my clojure-fu
13:20auaespecially knowing about performance
13:20fliebelaua: Oh, okay, anyway, this is mine, doing rock paper scisors.
13:20fliebelhttps://gist.github.com/564552
13:22aua@fliebel Thx! seems a nice solution
13:22auawill try to upload mine somewhere
13:22auaand please could you tell me some tips?
13:23fliebelsure
13:24auahttps://gist.github.com/889388
13:24auajust interested in creating the Markov map
13:24auai.e. markov-hash function
13:25auastill trying to wrap my head about functional concepts
13:25aua:-)
13:26aua"markov-hash function" -> "markov function"
13:27fliebelyou can replace (fn [v1 v2] (concat v1 v2) with just concat
13:28auaHow about the solution itself?
13:29auamaybe I'm creating to much map and then mergeing them...
13:29aua...seems inneficient
13:29fliebelaua: Looks okay to me, but I haven't read it very well. I'm trying to solve some problems myself as well.
13:31aua@fliebel np, thanks for your help!
13:31ataggartthe body of markov looks like it could be done with reduce instead of (apply merge-with...)
13:33auatried a reduce solution but performed almost the same :(
13:33aualet me paste it
13:34auaversion with reduce https://gist.github.com/889395
13:39auacomparing with a Python version I made
13:39auaPython: 1sec, Clojure 6sec
13:42schlechtvWhat's the most idiomatic way to build a seq of differences between the elements of another seq, i.e. [4 5 5 6] -> [1 0 1]?
13:47avyskWhat about (defn f [lst] (map - lst (rest lst)))
13:47avysk?
13:47ataggart^
13:48schlechtvavysk: imagine me slapping my forehead repeatedly for not thinking of it myself
13:48schlechtvavysk: Thanks!
13:49avyskwelcome :)
13:49TimMc,(map (partial apply -) (partition 2 1 [4 5 5 6]))
13:49clojurebot(-1 0 -1)
13:50TimMc(Less readable, but more fun.)
13:51avyskThat creates a load for garbage collector later, no?
13:51ataggartyup
14:09fliebelrefer-clojure is not working! (i'm doing something wrong, but it's driving me mad!)
14:11raek(remove-ns 'foo) (ns foo (:refer-clojure :exclude [var1 var2])) ?
14:11fliebelI have a ns that defines future, and this is my ns declaration: (ns ant-mine.animate (:refer-clojure :exlude [future]) (:use [ant-mine [schedule :only [future]] [core :only [state]]])), causing WARNING: future already refers to: #'clojure.core/future in namespace: ant-mine.animate, being replaced by: #'ant-mine.schedule/future
14:11fliebelraek: remove-ns? nice...
14:12raekfliebel: :exclude, not :exlude
14:12fliebelraek: Whoa! dud, why dodn;t clojure complain about that?
14:12fliebelthanks
14:12raekI tend to misspell that one too
14:13fliebel*phew*
14:13raekfliebel: if you call remove-ns, make sure you remove all ns that used it too, otherwise you will get a lot of errors
14:14fliebelraek: Now that I can reload, I don;t care about remove-ns :)
14:19LauJensenAre there any simple cryptography libs out there yet?
14:22ataggartLauJensen: what kind do you need?
14:23LauJensen(encrypt "pass" "foo") = "%¤%", (decrypt...), basically
14:24ataggartsymmetric/asymmetric? for external consumption or internal?
14:24raekLauJensen: for password hashing and verification, I recommend http://www.mindrot.org/projects/jBCrypt/
14:24LauJensenraek: Thanks - Clojure wrapped yet?
14:24TimMcLauJensen: There's no such thing as "generic encryption".
14:24LauJensenTimMc: You obviously haven't seen my user.clj :)
14:24TimMc?
14:25LauJensenIt was a joke, suggesting that I had handcrafted a generic encryption algorithm
14:25TimMcAh, I thought you were referring to obfuscated code. :-)
14:25LauJensenNaah, thats the good thing about Clojure, you dont need to obfuscate anything :)
14:26TimMcSome people seem to have that need.
14:26raekLauJensen: (defn bcrypt-hashpw [password salt] (BCrypt/hashpw password salt)) there, I made you one :)
14:26LauJensenTimMc: It was a joke, suggesting that Clojure code is write-only
14:26p_l|homeLauJensen: nope, Clojure is perfectly readable... now, APL in EBCDIC... :P
14:26LauJensenah :)
14:26raekyou only need to call three static methods
14:26LauJensenraek: You're the man :)
14:26ataggartkeyczar would be good if you want a high-level api and don't need external parties consuming the encrypted content
14:28LauJensenataggart: I dont, but what raek suggested seems to fit the bill
14:28LauJensenAnd since this is just a trivial financial system trading millions upon millions on the stockmarketing every minute, we dont need to get anal about security
14:29ataggartah, so you just need a password hashing scheme? Then bcrypt is what I would go with too, though I would be concerned about a new implementation of it. Crypto is easy to get wrong.
14:31LauJensenp_l|home: Actually APL is a walk in the park once you're comfy with J
14:32ataggarthmm, I'm looking at the javadoc for the bcrypt... does anyone find it odd that the number of rounds is only configurable on the salt generation and not the hashpw generation?
14:34LauJensenwhy?
14:34clojurebotwhy not?
14:36p_l|homeLauJensen: APL/360 with original codepage... viewed on ANSI terminal
14:37ataggartthe number of rounds increases the cost of the verification process., which is what you want when you're guarding against someone trying to build a rainbow table
14:38ataggarthttp://codahale.com/how-to-safely-store-a-password/
14:40nickikHi, im working with enlive for the first time. I wrote this html snippet and I want to fill it up with some example content. http://paste.lisp.org/display/120938. Here is what I tried http://paste.lisp.org/display/120939. Can somebody help?
14:42LauJensennickik: :.blogpost is class="blogpost", your article is #blogpost.
14:42LauJensenI think you want [:#blogpost :> any-node] actually
14:42ataggartLauJensen: And there's a good case to be made that crypto primitives should never be implemented in a managed environment. Being able to control the time profile is critical to avoiding timing attacks, and with JIT, GC, etc. that's not possible with java.
14:43LauJensenRight
14:44fliebel*blink* Did I just kill Swing?
14:46ataggartfliebel: many a freshman CS major would thank you if you did.
14:47fliebelataggart: The best I can do is making it throw exceptions, I'm afraid.
14:47nickikLauJensen, good to know that :. means class. Why do I need that any-node? It works know but the <article>-tag is displayed. How can I fix this?
14:47nickik*now
14:48LauJensennickik: :> any-node, means match everything directly under article, but not article
14:48LauJensenie. article wont appear after the transformation
14:48nickikbut it should
14:49nickikI mean the mark up would be wrong otherwise.
14:49LauJensenThen wrap the whole thing in a <body> and pass [:body :> any-node]
14:50nickikWhat wrong with just matching :#blogpost?
14:51LauJensenRead the above
14:52nickikYeah sure that works to but why is one better then the other? It seams to me that wraping the article with some body-tag will obscure my template.
14:52nickik*too
14:54fliebelInteresting trick: How many times does the print statements run? http://pastebin.com/JLxeAKSt
15:01raekfliebel: once?
15:02raek,(macroexpand-1 '(future (process) (Thread/yield) (recur)))
15:02clojurebot(clojure.core/future-call (fn* [] (process) (Thread/yield) (recur)))
15:02opqdonutyeah it recurs to the future-called fn
15:05fliebelright :)
15:06anonymou1e89is there something special to know about calling functions from within deftype?
15:07anonymou1e89I have a problem with number of arguments
15:07raekanonymou1e89: not with calling. but note that protocols can't have "& more" params
15:09anonymou1e89also, how do I call functions of the type from within the type?
15:10raekanonymou1e89: you mean something like this? (deftype Foo [...] Protocol1 (method1 [this] ...) (method2 [this] (method1 this)))
15:11raeki.e. you do as you usually do when you call a protocol method
15:13anonymou1e89raek: ok, sorry for the silly question. that makes perfect sense
15:14anonymou1e89actually one more question. Can types and records have private fields and functions?
15:15fliebel(does anyone know a little free app to record a screen in mac, or how to save a java graphic to a file?)
15:16raekthey can't have private methods (just use usual defn- for that). I'm not sure if deftype's fields are public or private
15:17raekthe things you put in defrecord/deftype are only the things that implement the protocols/interfaces
15:17anonymou1e89raek: oh I see. actually I think they don't have accessor's
15:17raek,(deftype Foo [x])
15:17clojurebotsandbox.Foo
15:17raek,(.x (Foo. 1))
15:18clojurebot1
15:18anonymou1e89oops
15:18anonymou1e89:)
15:18raekapparently, they are public. but you still have to know the name of them
15:25anonymou1e89my arity problem was due to lein not recompiling types (I think). I did "lein clean" and things were as expected
16:00TimMcYay, I can do proper 3D rendering now!
18:41phenom_anyone here experienced with nio ?
18:41Bed_I was wondering. Would it be possible to make your own loop function without macros?
18:41Bed_, (defn myloop [s1 s2 func)((func func) s1 s2)
18:41clojurebotUnmatched delimiter: )
18:41Bed_, (defn myloop [s1 s2] func)((func func) s1 s2)
18:41clojurebotDENIED
18:42Bed_No, you should be DENIED.
18:42Bed_& (defn myloop [s1 s2] func)((func func) s1 s2)
18:42sexpbotjava.lang.SecurityException: You tripped the alarm! def is bad!
18:43Bed_Nah, I was just trying to construct my own loop.
18:43brehautBed_: in theory yes but in practice you are going to run into problems with tail calls
18:45Bed_I constructed something http://pastebin.com/8cfRt4Dz
18:45Bed_Although it still has bugs probably
18:46Bed_I am wondering this pure theoritically.
18:46Bed_For now
18:46Bed_Then I will try to find a way to get tail recursion.
18:46brehautBed_: then purely theoretically yes entirely possible. Languages like Haskell dont have any built in loop syntax, its all built on top of tailcalls
18:47Bed_Do you have an example of the thing I am trying to construct without macros?
18:47brehautBed_: your definition of myloop is confusing at best
18:48Bed_Or is there a well known name for the construct I am trying to create.
18:48brehautBed_: not in clojure
18:48brehautBed_: i'd call the general concept a 'loop combinator' i guess. i dont know what your specific one is trying to do
18:49Bed_I am trying to mimic named lets like they appear in scheme. But I am trying to avoid using macros.
18:50brehautim not familiar with named lets in scheme
18:50Bed_named lets are a bit like the (loop, iter)-construct in clojure but they don't have to be tail recursive
18:51Bed_I should probably ask this question to a schemer I think.
18:51brehauti think so
18:52Bed_I though that there would be a lot of overlap between schemers and clojurers.
18:52brehautthere is some overlap
18:52brehauti dont know if anyone has measured it though
18:55phenom_argh, dealing with nio in clojure is ugly
18:56phenom_reading, rewinding, putting, getting bleh
19:04TimMcBed_: You can construct recursive functions using the omega combinator.
19:06TimMcBed_: https://secure.wikimedia.org/wikipedia/en/wiki/Fixed_point_combinator#Example_in_Scheme
19:06Bed_Is the omega combinator syntactic or macroic?
19:06TimMcIt's just a function.
19:06brehautTimMc: how does omega differ from Y?
19:07TimMcY is built on omega, I think.
19:08Bed_I am not sure if a fixed point combinator is what I was looking for.
19:08TimMcDon't ask me to explain how it works. I got my brain wrapped around it once upon a time, but have since forgotten.
19:08Bed_A fixed combinator is a solver for the equation f(x) = x if I understand correctly.
19:08brehautTimMc: likewise :)
19:09brehautBed_: the Y combinator allows you to implement arbitrary recursion in a language that does not natively support it
19:09TimMcBed_: Did you follow the link?
19:09TimMcI believe that Scheme code gives you (fact 4) => 24
19:09Bed_Yes, but I didn't read it yet.
19:10TimMcDon't worry about the first code block, just look at the second. THat's fact (a looping calculation) done without syntactic recursion.
19:10Bed_The scheme code looks like this: http://pastebin.com/uPMN9g8b
19:11TimMcWhat is it supposed to do?
19:11brehautBed_: then why havent you just ported it directly?
19:12brehaut(defn myloop [s1 s2 f] ((f f) s1 s2))
19:12Bed_Since I am a bad programmer.
19:12TimMchaha
19:13TimMcConvert code, become a better one! :-)
19:13brehautif you want it to not explode your stack you probably want to investigate trampoline ##(doc trampoline)
19:13sexpbot⟹ "([f] [f & args]); trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, ... http://gist.github.com/889743
19:14brehautwhich is probably going to bake your noodle trying to get working but the exercise will probably be worth it
19:14sritchiequick non-clojure survey (sorry!)... how do you folks on small programming teams organize notes that need to get between, say, four or five team members?
19:15sritchieother than email. the other two folks on my team are away for a while, and I'm thinking of setting up an internal wiki they can peruse
19:15Bed_Those functional languages distract me from doing any practical work :P
19:16brehautsritchie: wiki's can be good but it requires that at least one person is really dedicated to maintaining it, otherwise it will become a wasteland
19:16sritchiebrehaut: that'
19:16sritchiebrehaut: that's kind of what I'm thinking will happen
19:17TimMcYou really need group buy-in for a wiki.
19:17sritchieeveryone in a small team builds up the same body of knowledge, roughly, branching out as they go -- tough to track the process, though
19:17sritchieyeah, and we have to assume everyone in the team will be motivated by self interest
19:18sritchie(> reading content-creation), unless everyone's bought in
19:18brehautpersonally i would just ask that everyone writes good notes in a text file in the VCS filesystem
19:19sritchiehaha, I can see this is a thorny question, maybe this isn't the forum, and we should all just take over a coffee shop and pass napkins around
19:19brehautsritchie: probably. 'groupware' is a remarkably tricky problem
19:20brehauthurrah for 90s buzzwords
19:21sritchieI might like a bot that could scan for corporate lingo
19:22brehautand punishes people for talking about synergy?
19:22sritchieit could even pose as a real user, and reply with other buzzword laced questions, goading the user on
19:22sritchieyou'd have a flubber effect, with corporate speak getting out of control
19:22brehauti dont think the world needs any more trolls (automated or otherwise)
19:23sritchiehaha, fair point
19:23sritchieokay, I'll go type up these damned notes in a text file, and leave groupware to the 90s
19:24brehautsritchie: i think text files are good because theres such a small barrier to maintaining them and no new tools needed
19:25brehautat least until you have a better idea of how the process is working
19:25sritchiebrehaut: yeah, and including them in the git repo keeps them close to the code
19:25brehautyup
19:26sritchiebrehaut: I guess the idea is sort of an internal blog for the three of us, where we can pitch each other -- the "post" I'd envision would be a summary of research, and would ideally boil down into, say, items in pivotal tracker
19:26sritchiebut would provide explanation for those new things, and justify their existence
19:28TimMcBlog might have high barrier to entry. People might feel constrained to use complete thoughts. :-P
19:29sritchiewe could even go to the full vlog level, with video posts, pitching features
19:30sritchiea three person committee! every startup's dream
19:31gfrlog$findfn {1 3, 4 3, 32 3, 85 2, 9 2} {3 [1 4 32], 2 [85 9]}
19:31sexpbot[]
19:31gfrlogdangit
19:33TimMcgroup keys by values, eh?
19:33gfrlogyep
19:33brehaut,(into {} (map (fn [[k v]] [k (map second v)]) (group-by first (map reverse {1 3, 4 3, 32 3, 85 2, 9 2})))
19:33clojurebotEOF while reading
19:34brehaut,(into {} (map (fn [[k v]] [k (map second v)]) (group-by first (map reverse {1 3, 4 3, 32 3, 85 2, 9 2}))))
19:34clojurebot{3 (1 4 32), 2 (85 9)}
19:34TimMcdamn, brehaut, you're fast
19:34gfrlogbrehaut: I used (group-by m (keys m))
19:34brehautim sure it could be cleaner
19:34TimMcI was going to use merge-with or something.
19:35brehautgfrlog: thats really nice
19:35brehaut(inc gfrlog)
19:35sexpbot⟹ 1
19:35gfrlogbrehaut: thx
19:36TimMcdamn, gfrlog, you're better :-P
19:36gfrlogbrehaut: I actually had already wrote it that way, but it was the sort of thing I thought might be lying around in core
19:36brehautthats areally inspired solution
19:36gfrlogTimMc: better than what?
19:37TimMcI was making fun of brehaut (and myself, actually.)
19:37brehautTimMc: fair enough, my way looks barbaric comparatively
19:38gfrlogTimMc: okay. I'm lost in layers of interpretation, so I'll just throw an exception, catch it, and return "we all had a good time just then"
19:38TimMcOh wait, gfrlog actually posted 3 minutes before brehaut... I thought it was more like 20 seconds for some reason.
19:39TimMcStupid IRC time warpage.
19:40TimMcI'm still working through group-by.
19:40gfrlogTimMc: that's a fun one; brehaut used it somehow.
19:41gfrlog,(group-by #(rem % 2) (range 10))
19:41clojurebot{0 [0 2 4 6 8], 1 [1 3 5 7 9]}
19:41gfrlog,split
19:41clojurebotjava.lang.Exception: Unable to resolve symbol: split in this context
19:41gfrlog,clojure.string/split
19:41clojurebotjava.lang.ClassNotFoundException: clojure.string
19:41gfrlog,clojure.contrib.str-utils2/split
19:41clojurebotjava.lang.ClassNotFoundException: clojure.contrib.str-utils2
19:41gfrlogworthless
19:41brehautTimMc: the big difference between mine and gfrlog's is that i manually take time to flip the map about, group it naively and then stitch it all together, rather than just using the function nature of maps
19:43TimMc,(apply group-by ((juxt identity keys) {1 3, 4 3, 32 3, 85 2, 9 2}))
19:43gfrlogI feel like the most common cause of writing unnecessarily large expressions is forgetting that various objects are functions
19:43clojurebot{3 [1 4 32], 2 [85 9]}
19:43gfrlogTimMc: what the heck is that
19:43TimMcJUXT!
19:44gfrlogTimMc: were you just trying to figure out how to work that in?
19:44TimMcIt's your code, only with juxt!
19:44gfrloglemme see if I can get comp in there
19:44brehautthe padawan is learning
19:45brehaut(comp (partial apply group-by) (juxt identity, keys))
19:45gfrlogspeaking of nicer code, just 5 seconds ago I changed #(not= % a) to (complement #{a})
19:45TimMchum
19:46brehautcomplements of sets are great
19:46gfrlogyeah
19:46brehauti think i have ended up using them more than sets as functions
19:46brehautTimMc: the point free trifecta ?
19:48brehautTimMc: or data as functions?
19:48TimMc(complement #{a}) is like really dense but good prose -- I eventually get the point, and it is an admirably clever use of language... but I can't just *read* it.
19:48Bed_Hey, that y-combinator actually works.
19:48TimMcBed_: Cool, huh?
19:48gfrlogTimMc: you don't think you get used to it eventually?
19:49TimMcgfrlog: I might, but what about future readers of my code?
19:49TimMcThere is something to be said for writing simply.
19:49brehautTimMc: i think its a matter of perspective. (complement set) is the simplest way i could imagine it
19:50gfrlogI guess it depends on the future reader
19:50TimMcJargon can convey information in a succinct and precise manner, but it is tempting to use it just because it is there.
19:50TimMc#(not= % a) is pretty damn clear, succinct, readable, fast, and simple -- but it isn't clever.
19:51TimMc...and maybe cleverness ought to be sacrificed for readable code.
19:51brehautperhaps in the case of a single element
19:51Bed_TimMc: very cool
19:52brehautTimMc: what about #(and (not= % a) (not= % b)) vs (complement #{a b}) ?
19:52gfrlogI wonder how much of this is just damage from imperative programming
19:52brehaut(i assume my boolean logic is broken in the first example)
19:52TimMcBed_: It's crazy stuff. Try to work through *how* it works -- you'll learn a lot. (Then you can foget it and use the damn looping constructs. :-P)
19:52TimMcbrehaut: When you start looking at multiple elements, I think the balance shifts.
19:52gfrlogbrehaut: the bools looks goods to me
19:53brehautgfrlog: thats pure luck :P
19:53gfrlog&split
19:53sexpbotjava.lang.Exception: Unable to resolve symbol: split in this context
19:54gfrlog&clojure.string/split
19:54sexpbot⟹ #<string$split clojure.string$split@1243a0f>
19:54TimMcMy girlfriend is looking at work in science popularization, and she chides me for gratuitous use of jargon all the time. :-)
19:54gfrlog&(group-by count (clojure.string/split #" " "This expression will group the words by how many letters they have"))
19:54sexpbotjava.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern
19:54gfrlog&(group-by count (clojure.string/split "This expression will group the words by how many letters they have" #" "))
19:54sexpbot⟹ {4 ["This" "will" "many" "they" "have"], 10 ["expression"], 5 ["group" "words"], 3 ["the" "how"], 2 ["by"], 7 ["letters"]}
19:55Bed_It is very complicated, but I really want to learn how it works.
19:55gfrlogTimMc: who pays for science popularization?
19:56TimMcBed_: Start by creating a factorial function that takes an extra parameter -- a function to call with the accumulated data.
19:57brehautTimMc: i dont know if i agree with that; it makes sense when the jargon is ill defined or has a blurry meaning (eg: Functional Programming, Object Oriented, Monads, Combinators etc) but when the term is very precisely defined (as you get with a function definition) it seems to be beneficial to use the jargon
19:57TimMcBed_: That should give you a start on figuring it out.
19:58Bed_That would require me to wrap the parameters in a list or as values wouldn't it?
19:58brehautTimMc: because then you have a suscinct definition and if your audience doesnt understand some parts of it its very clear for both parties where the problem lies.
19:58TimMcBed_: Nope, just (define (fact n acc f) ...)
19:59TimMcBed_: which then calls (f ...) in the tail position.
19:59TimMcgfrlog: Dunno, actually.
20:00TimMcbrehaut: Idioms in Clojure work the same way as jargon -- a visual stumbling block that you have to pause and process, because you have to swap in a mental model or similar.
20:00TimMc(Idioms in any programming language, of course.)
20:01TimMcIt's not that they're *bad*, it's that they break up the flow of reading for a non-expert.
20:01gfrlogMost of the clojure I write is for myself
20:02brehautTimMc: i think that it makes it easier for the non-expert; its clear where their understanding is missing. if you have a soup of primatives then you need to understand everything at the lower level and then hold it all in your head to build up the bigger picture
20:02TimMcClearly-named functions help with that, yes.
20:03gfrloglike ##complement
20:03gfrloglike ##(doc complement)
20:03sexpbot⟹ "([f]); Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value."
20:03gfrlogah there it goes
20:03gfrlogI'm getting good at sexpbot
20:03TimMcIf gfrlog does (def group-by-vals (comp (partial apply group-by) (juxt identity keys))) and slaps on a docstring, who cares?
20:04TimMcOr group-keys or something.
20:05Bed_Okay, I constructed it.lambda (n acc)
20:05Bed_ (if (= n 0) acc
20:05TimMcLeaving it as (group-by m (keys m)) relies on the use of a map as a function in a place where something complicated is *already* going on.
20:05Bed_ ((iter iter) (- n 1) (* n acc))))))
20:05gfrlogTimMc: why not slap on a docstring then?
20:06TimMcgfrlog: Sorry, I mixed examples.
20:06TimMcPretend that first thing was (defn group-keys [m] (group-by m (keys m)))
20:06TimMcInlining vs. naming in other words.
20:07gfrlogah very good
20:07gfrlogI'm fine with that
20:07gfrlogI did it that way actually
20:07gfrlogcept I called it invert and neglected the doc-string :)
20:08TimMcinvert?
20:08TimMckeys-by-val
20:09gfrlogit all good
20:09gfrlogthere's no bad name for that function
20:09TimMc"fred"
20:09TimMcThat's a bad name.
20:09gfrlogactually fred seems to like it
20:09gfrloghe's responding to it at least, and he's smiling more than he used to
20:09TimMc:-(
20:10TimMcDidn't you see the sign on the door? "Don't tease the name-obsessors."
20:11gfrlog:)
20:12gfrlogFred just went and defn-ed himself in a few other namespaces
20:13gfrlogThis would be a good time for somebody to say "Functions hate being anthropomorphized"
20:14Adamantbut they love morphisms! (if you're in #agda)
20:14gfrlog:)
20:15gfrlogGolly I just stared at "Caused by: java.lang.IllegalArgumentException: Parameter declaration let should be a vector" for like 5 minutes before I figured out I had written 'defn' instead of 'deftest'
20:17gfrlogAdamant: I just read 2 sentences about agda and I'm completely lost.
20:17Adamantgfrlog: start with #haskell
20:17gfrlogAdamant: yeah, it had that flavor
20:18gfrlogHaskell needs more parentheses
20:18brehautgfrlog: just use liskell then
20:19gfrlog$google liskell
20:19sexpbotFirst out of 158 results is: About Liskell
20:19sexpbothttp://www.liskell.org/
20:19brehauthttp://www.readwriteweb.com/hack/2010/11/haskell-with-lisp-syntax.php
20:19brehautoh. or that :P
20:20gfrlogbrehaut: sexpbot's didn't work anyhow
20:21gfrlogsexpbot: BAD!
20:22ssiderishello, I'm writing a macro and in order to test it I'm trying to do:
20:23ssideris(pp/pprint (macroexpand-1 '(make-listeners f)))
20:23ssideriswhere f is the map that the macro expects as a parameter
20:23ssiderisbecause of the quote, I get "Don't know how to create ISeq from: clojure.lang.Symbol"
20:24ssideristhe macro works as expected when I replace f with a literal map
20:24ssiderisany way around this?
20:24clojurebotGabh mo leithscéal?
20:25brehaut,(let [f 1] (macroexpand-1 `(inc ,f)))
20:25clojurebot(clojure.core/inc sandbox/f)
20:26TimMcssideris: You should be using ` instead of ' in general anyway.
20:26TimMc(syntax-quote vs. quote)
20:26brehautssideris: alternatively if you want to have the value of f in the form rahter than the symbol, you can do ##(let [f 1] (macroexpand-1 `(inc ~f)))
20:26sexpbot⟹ (clojure.core/inc 1)
20:27TimMcbrehaut: Did you forget that comma is whitespace?
20:27TimMcI do that all the time.
20:28brehautTimMc: a) yes, and b) i may have confused things with older lisps
20:28ssideriswith this I still get an error (macroexpand-1 `(make-listeners ~f))
20:29ssiderisbut a different one...
20:29ssiderisDon't know how to create ISeq from: clarity.core$f
20:29ssiderisclarity.core is my namespace
20:29TimMcssideris: What is f, then?
20:30ssiderisoh crap, I had defined f with defn rather than def
20:30ssideris(it's a map)
20:30ssiderissorry!
20:30ssiderisit works now, thanks a lot
20:30TimMc:-)
20:32TimMcssideris: More importantly, are you sure you need a macro here?
20:32ssiderisnot entirely
20:33ssiderisbut I'm a bit too much of a clojure newbie to be able to tell
20:34TimMcKeep in mind that you can't pass macros around -- because of that, try to make it a function first.
20:35ssideristhanks for the tip, but this is an exploration/learning exercise rather than actual development
20:36ssiderisso I don't think it matters much
20:36TimMck
20:44TimMc,(let [f "hello"] `(f ~f 'f ~'f))
20:44clojurebot(sandbox/f "hello" (quote sandbox/f) f)
21:56johnmn3top'o the eve
22:09gfrlog$findfn neg? [-2 -1 0 1 2] [-1 0 1 2]
22:09sexpbot[]
22:09gfrlogis there really no remove-first function in clojure?
22:10brehautgfrlog: asside from the sequence functions like rest and next?
22:10gfrlogbrehaut: I mean that accepts a predicate
22:11brehautoh right
22:11TimMcPresumably he'd also want [3 -2 -1 0 1 2] to return [3 -1 0 1 2]
22:11gfrlog(remove-first neg? [3 2 1 0 -1 -2 -3]) => [3 2 1 0 -2 -3]
22:11gfrlogI just wrote this, which could be optimized:
22:11gfrlog(defn remove-first
22:11gfrlog [pred coll]
22:11gfrlog (let [[a b] (split-with (complement pred) coll)]
22:11gfrlog (concat a (rest b))))
22:12gfrlogTimMc: See how I used complement there? ;-)
22:12TimMcyup
22:30brehautgfrlog: (defn remove-first [p [f & r :as s]] (if (p f) r s)) ?
22:31brehauti think i must have still missed something though
22:34brehautah i see what i missed. ignore me
22:54gfrlogbrehaut: I did, but only because I was ignoring the channel as well
22:54brehautgfrlog: its for the best
22:59gfrlog,(cond false true false true true false)
22:59clojurebotfalse
23:00gfrlogif I was writing a code obfuscator, that could be a possible substitution for 'false'
23:01amalloygfrlog: ##(condp = true false true false true false)
23:01sexpbot⟹ false
23:02amalloyseems harder to read, to me
23:07gfrlog,(doc condp)
23:07clojurebot"([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, ...
23:07gfrlogalways another thing to learn
23:07amalloy&(doc condp) ; no truncation!
23:07sexpbot⟹ "Macro ([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.... http://gist.github.com/889943
23:14gfrlog,clojure.set/intersection
23:14clojurebot#<set$intersection clojure.set$intersection@a14174>
23:14gfrlog,(clojure.set/intersection #{4} [1 4])
23:14clojurebot#{}
23:15brehautamalloy: gfrlog how about this for false (apply (fn [a b] (a b)) ((apply juxt (map (fn [length] (comp second #(nth % length))) [27 15])) (filter (comp #{\?} last name first) (seq (ns-map *ns*)))))
23:15gfrlog,(clojure.set/intersection #{2 3 4} [2 3])
23:15amalloygfrlog: use clojure.set on non-sets at your own peril
23:15clojurebot[2 3]
23:15gfrlogamalloy: I wish it would just blow up
23:15amalloy&(doc clojure.set/intersection)
23:15sexpbot⟹ "([s1] [s1 s2] [s1 s2 & sets]); Return a set that is the intersection of the input sets"
23:15gfrlogamalloy: did you spend the last few minutes constructing that?
23:16amalloygfrlog: i also changed my name to brehaut
23:16gfrlogamalloy: yeah why did he address both of us like that?
23:16gfrloggot me all turned round
23:16amalloylol
23:17amalloybrehaut: gfrlog gets confused when we talk about him
23:17gfrlogamalloy: brehaut did you spend the last few minutes constructing that?
23:17brehautyes i did
23:17amalloybrehaut thinks hand-crafted evil is the same as virtue
23:17gfrlogamalloy: brehaut wtf is #{\?}?
23:17amalloygfrlog: a set containing the character "?"
23:17brehautalso i realise it should be better if the set in the middle was #{(char (- (Math/pow 2 6) 1))}
23:17gfrlogamalloy: brehaut: oh right
23:18amalloygfrlog: srsly you only have to address two people if you're talking to both of them :P
23:18gfrlogbrehaut: amalloy this is crazy.
23:18gfrlogamalloy: oh whoops okay
23:18brehautgfrlog: you were wanting to obfuscate false right?
23:18gfrlogbrehaut: well not in real life.
23:18gfrlogbrehaut: but yeah
23:19gfrlogamalloy: how about I obfuscate false with ##(not (empty? (clojure.set/intersection #{1 4} [4])))
23:19sexpbot⟹ true
23:19gfrlogwhoops
23:20gfrlog#{4} and [1 4] should do it
23:25gfrlog,(apply (fn [a b] (a b)) ((apply juxt (map (fn [length] (comp second #(nth % length))) [27 15])) (filter (comp #{\?} last name first) (seq (ns-map *ns*)))))
23:25clojurebotfalse
23:34tomojreading the backlog backwards, I am relieved
23:40gfrlogtomoj: my apologies
23:56amalloytomoj: filthy habit anyway :)