#clojure logs

2011-12-11

00:56georgekI have an array map of rss feeds, I then got a sequence by mapping :entries over the values of the map. Now I want to get the :title of each entry, but I can't figure out how to map :title over each item of :entries; the sequence I have is a sequence of sequences basically
00:56tomojyou want a seq of all the titles of all the entries, or a seq of seqs of titles for each feed?
00:58georgeka sequence of all the titles for all the entries; basically the result of combining (map :title (first seq)) and (map :title (second seq)), etc.
00:58tomojwhere combining = concatenating?
00:58georgekwhen I (map :title seq) I get nil nil returned
00:58georgekyes tomoj
00:58tomojfirst off, why an array map? just curious..
00:59tomojI think maybe you're looking for (map :title (mapcat :entries (vals feeds))) though?
00:59georgekno reason, it's just what I got back when I zipmapped a vector of strings as keys over a bunch of structmaps (the feeds)
01:00tomojthat will actually return a hash map if you have enough feeds - does order matter?
01:00georgeknope
01:01tomoj(mapcat :entries seq-of-structmaps) will give you one seq of all the entries (mapcat = map+concat)
01:02georgekahh cool, thanks tomoj that's it
01:20alexbaranoskyduck1123, are you around?
01:32duck1123yes
01:38alexbaranoskyduck1123, care to add your thoughts to this issue?: https://github.com/marick/Midje/issues/72
01:39duck1123sure, I'll add it to the ticket
01:46duck1123done
01:51alexbaranoskythx
02:00duck1123just realized I didn't have Midje cloned on this machine. Go long download time. :)
02:17amalloyduck1123, alexbaranosky: as i understand it, you can put facts inside of deftests, and then the usual clojure.test mechanisms work
02:17amalloycake certainly has the option to run just a single test (eg, cake test my.ns/test-name), and i wouldn't be surprised if lein does too
02:18amalloyi guess that belongs as a comment on the issue. all right, all right, no need to hassle me
02:20alexbaranoskyhey amalloy, glad to have your input
02:30pierre-renauxHi, my first time here, I'm playing around with Clojure, I have a "test" problem for which I build a binary tree. It works fine, but... I'm wondering if anyone would be willing to check out the implementation to see if there's a way to make it faster, its quite a bit recursive (not 'recur' recursive :s)
02:37amalloytrees generally are
02:40pierre-renauxthe main issue I have is that each node as a min/max value (an integer)
02:41pierre-renauxand every time I insert a value in the tree each parent node "before" the leaf have to update their min/max
02:41amalloyyep. that's pretty much how it has to work
02:42pierre-renauxone way I can think of is to index those min/max in an external (mutable) array... but well, I suppose its pretty obvious that it isnt pretty :P
02:42pierre-renaux... since the min/max is the only thing that really change when I insert... and of course the leaf node added every time...
02:43pierre-renaux... I'm looking at this because its by far the most time consuming part of the test...
02:43amalloypierre-renaux: if you're interested in data-structure stuff, you might like okasaki's Purely Functional Data Structures. or you can read some bloggy things online
02:43pierre-renauxan implementation in C++, using mutable structure, doesn't even register the tree building part...
02:44pierre-renaux(I mean its almost free, looking at profiling data)
02:44pierre-renauxin the Clojure implementation its ~70-80% of the time spent...
02:45pierre-renauxI've read quite a bit of stuff, its not that I dont understand how it works, is just that I'm not sure if there's a better way...
02:45amalloypierre-renaux: you're trying out a new language, and the first thing you're doing is comparing the speed of your back-of-the-envelope implementations against a C++ impl you're comfortable with? what's the point?
02:45pierre-renauxI have 4 different implementations :P
02:46pierre-renauxwell, that's not my point
02:46pierre-renauxI'm pretty sure that if I use the Java - mutable structures in Clojure
02:46pierre-renauxI'll get the same perf as the C++ implementation...
02:46pierre-renauxI'm trying to figure out how to build the immutable tree efficiently
02:47amalloywhy?
02:47clojurebotamalloy: because you can't handle the truth!
02:47pierre-renaux:P
02:55amalloyseriously this seems like a complete waste of your time. learn how to use the language, get comfortable with how to write expressive code. if what you really want is to write code that looks like C++ and performs exactly as well, then just write C++
02:57pierre-renauxright, point well taken
02:58pierre-renauxbut I can't really think of a "better" way for this particular case, which is why I'm asking
02:58pierre-renaux I have a tree A[min,max] -> B[min,max] -> Leaf[value,index]
02:58pierre-renauxmin/max are min/max of the index in the Leaf
02:58pierre-renauxso if I add another value in the tree, I have to update the min/max at each node...
02:59amalloyif you add another value to the tree, you have to update all the nodes on its path to the root whether you're tracking min/max at all
02:59pierre-renauxmmm
02:59pierre-renauxright indeed
03:00amalloy$google clojure persistenthashmap higher-order
03:00lazybot[Assoc and Clojure's PersistentHashMap: part ii | Higher-Order] http://blog.higher-order.net/2010/08/16/assoc-and-clojures-persistenthashmap-part-ii/
03:00amalloyyou might find that useful if you want to read about trees
03:00pierre-renauxright I have read that
03:00devngreat article
03:00pierre-renauxI've reimplemented those in C++... so I do know how it works fairly well
03:01pierre-renauxI'm wondering if there's some idiomatic way to build that type of trees with immutable datastructure that could be more efficient than the "naive" way...
03:05amalloymutably or immutably in c++? it seems like immutability is what's giving you pause, so having implemented a mutable version in c++ isn't necessarily a very useful exercise
03:05amalloyseriously though, if you've implemented those in c++ you probably know your stuff, data-structure wise, so okasaki would be a great book to dive into
03:07amalloyfor me it's a bit too heavy but it sounds like it's targeted at exactly what you want to learn
03:07pierre-renauxright, its about immutability, the PersistentHashMap in C++ as the same "issue" as the one in Clojure, I mentioned the C++ implementation as an example of what I'm seeing with a "mutable" implementation... not really anything particualr to the language
03:08pierre-renauxmy main "pause" is about how to efficiently initialize those immutable structure
03:08pierre-renauxusing a transient version helps a bit (about 50%) better, but I'm wondering if there isn't even a better way to do it :P
03:09pierre-renauxwhat I didn't try yet, is to build the tree concurrently, I'm concerned "merging" it at the end could be quite painfull...
03:12tomojpierre-renaux: do you mean like this? http://www.sitepoint.com/hierarchical-data-database-2/ ...not to suggest I can help you, just trying to understand what you mean :)
03:13tomoj..or is it min/max of the values on the nodes?
03:15pierre-renauxwell, the min/max isn't really the main issue - as amaolly pointed out - I guess it just boils down to "what is the most efficient way to build an immutable binary tree whith a fairly deep hierarchy when each new insert starts at the root node"
03:16pierre-renauxthe efficiency issue comes - I'm supposing - from the fact that the "whole path" the leaf inserted has to be rebuilt
03:17amalloypierre-renaux: well, the efficient way is not not build deep trees :P
03:17amalloywhich is why clojure's built-in trees have a branching factor of 32
03:17pierre-renauxyes :P
03:17tomojhmm.. zippers don't solve that?
03:17pierre-renauxzippers is good to mod in the "middle" of the tree
03:18pierre-renauxbut when I build a deep tree and insert from the root for each new value
03:18pierre-renauxit doesnt really help :P
03:22amalloypierre-renaux: zippers do solve some cases of this problem
03:22pierre-renauxdo you know of any article that explains what happens when a large XML file is loaded ?
03:22pierre-renauxits essentially the same issue I believe...
03:22amalloyhaha. here's my article: "you run out of memory"
03:22pierre-renaux:D
03:22pierre-renauxI meant something that might explain how to do it efficiently ;)
03:23amalloyzippers let you "queue up" a number of sorta "local" changes to the tree, and apply them all at once when you walk back up to the root
03:24pierre-renauxmmm
03:24pierre-renauxoki, so it kinds of "buffer" the build, and "commits" it when you ask for the root back ?
03:24amalloydoesn't help if you have a bunch of random changes all over the tree, but if you're working on one area for a while...
03:25pierre-renauxright, that was my understanding
03:25amalloyyes, that is one effect it has
03:26devnThe more I use noir the more I enjoy it.
03:39tomojhuh.. is the idea that you only have one app?
03:40tomoji.e. defpage anywhere in the code defines a page in that one web app?
03:41tomojoh, or just one per namespace passed to noir.server/start..?
03:42tomojno, wow, there is one global route table? is it just me or is that odd?
03:46amalloytomoj: i mean, i guess it seems a little short-sighted, but it's pretty normal to have one jvm per app?
03:50duck1123I wonder, what are the performance differences between checking every route in your app, vs splitting of into sub-matches based on url path components
03:51duck1123I'm sure it's highly dependant on the number of routes
03:51tomojyeah.. I'm not thinking "man I really want to have two apps at once" but "man defpage -> swap! noir-routes.. weird"
03:51tomojI mean, it's religious :)
03:53duck1123you could use binding on the var that holds the ref to run each site within it's own binding
03:54duck1123not that I'm actually sugesting that
03:54amalloyduck1123: only if you want each site to have only one thread...?
03:55duck1123amalloy: I'm sure if you're masochistic enough to do something like this, you could find a way around that
03:56duck1123I've been wanting to find a more efficient way to do the routes in my framework
03:56tomoj(defn foo-handler [req] ..) is so beautiful
03:56duck1123I run a series of checkers over the route data and the request. and it's a bit wasteful
04:08tomojhmm.. so if e.g. storm's web UI were written with noir instead of compojure, just having storm as a dep might infect my noir app and break everything
04:18amalloyoh. wow, yeah, that's a good point
04:18tomojor maybe the :ns option to server/start helps
09:46cmiles74I'm moving some code from Clojure 1.2 to 1.3, does anyone know if 'clojure.contrib.mmap' was migrated to one of the modular contrib libraries?
09:48cmiles74It's not a lot of code if it wasn't. Handy though :)
09:52capotribuhi, don't see any comment for nmap here http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
09:53cmiles74Yeah, me neither.
09:54cmiles74I work with some big files, I think for now I'm just going to just build a little JAR just for these functions. It's not much code, really.
10:12ambrosebshere an example of using the ClojureScript analyzer (with modifications) on Clojure code to detect misplaced docstrings
10:12ambrosebshttps://github.com/frenchy64/typed-clojure/blob/master/src/clojure_analyzer/docstrings.clj
10:12ambrosebswork in progress, but you get the idea
10:53Borkdudethis might be a dangerous question, but has anyone tried (just for fun) to make a Common Lisp lib for Clojure (so you can just write defun and cond with extra parens etc)?
10:57Borkdude,(defmacro defun [name arg-list body] `(defn ~name [~@arg-list] ~body))
10:57clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
11:07kzarDoes anyone else get that "Debugger entered--Lisp error: (end-of-file)" error using slime, emacs and clojure? I always get it after I evaluate something that returns a lot of data, like if I'm testing a scrape function interactively
11:08kzarand then once I get that error I have to disconnect and reconnect slime before I can evaluate anything, it's really annoying
11:20kzarAlso I'm trying to figure out, what should I use for XML generation? It seems that clojure.xml isn't recommended and lazy-xml is being superseded by data.xml but that's not ready yet.
11:24Borkdudekzar I've had this and I had to change some encoding setting, let me find it
11:24kzarBorkdude: sweet thanks
11:25Borkdudekzar: put this in your init.el or whatever: (setq slime-net-coding-system 'utf-8-unix)
11:25Borkdude
11:29kzarBorkdude: Ah now I'm getting that "error in process filter: Variable binding depth exceeds max-specpdl-size", brb going to restart emacs
11:31kzarBorkdude: Yea, that fixed the end-of-file thing, thanks!
11:31Borkdude:)
11:31kzarBorkdude: Do you know how to fix the max-specpdl-size problem? I always have to just restart emacs
11:31Borkdudekzar: can't remember to have seen it
11:34kzarshucks OK, still I'm stoked about the end-of-file fix
11:35mrb_bksup, anyone around use gloss at all?
11:35mrb_bkseems to not work well with clojure 1.3?
11:36Borkdudekzar: tried this? http://stackoverflow.com/questions/1322591/tracking-down-max-specpdl-size-errors-in-emacs
11:37kzarBorkdude: Ah I'll give that a try later, cheers
11:45Bronsascgilardi: why is it slingshot.slingshot and not slingshot.core or just slingshot?
11:47ambrosebshow can you call a macro from apply?
11:47ambrosebs,(apply #'-> {} {} [:a :b])
11:47Bronsayou cant
11:47clojurebot(:b :a)
11:48ambrosebsthe ClojureScript compiler does, I'm trying to work out how
11:48Bronsathere was apply-macro in old contrib
11:48Bronsahttps://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/apply_macro.clj#L32
11:49ambrosebsany idea how the above code that I entered works?
11:53Bronsahm
11:55Bronsano idea
11:55ambrosebsthis is the line in question https://github.com/frenchy64/typed-clojure/blob/master/src/clojure_analyzer/compiler.clj#L578
11:56ambrosebslooks like &form and &env become explicit
11:58duck1123 Borkdude, thanks for that fix to kzar's problem. (I've had that same one myself)
11:58ambrosebs,(apply #'-> 'a {} [#'-> {:a :b} :b])
11:58clojurebot(clojure.core/-> (clojure.core/-> #'clojure.core/-> {:a :b}) :b)
11:59duck1123mrb_bk: which version of gloss are you using? I know that gloss works because it's used in aleph
11:59mrb_bkduck1123: aleph with clojure 1.3?
12:00duck1123yeah, I did the patches that made it work, but ztellman merged them in
12:00mrb_bkoh yeah i saw that
12:00mrb_bkduck1123: 0.2.0
12:00duck1123you need 0.2.1-SNAPSHOT for 1.3
12:00mrb_bkoh okay cool
12:00mrb_bkthanks!
12:02mrb_bkduck1123: perfect!
12:06Bronsaambrosebs: i think i got it
12:06Bronsawhen using a macro as a function, the first two parameters get binded as &form and &env
12:06Bronsaoh, you said it too
12:07ambrosebsdo you know what the "rest" args are for?
12:08Bronsaim not sure i understood your question
12:09ambrosebsoh I see, the first 2 args are special, then the rest are as normal
12:09Bronsayes
12:09ambrosebsawesome thanks :)
12:16ambrosebsis there a difference between using `in-ns` and binding *ns* to change namespace?
12:19wiseenis there a way to start lein test as a "server" so I don't have to restart JVM all the time with lein test ?
12:22Bronsaambrosebs: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L204 it seems this is actually what in-ns does :P
12:23ambrosebsBronsa: I'm glad you found it, I figured the impl would be deep down :P
12:38ambrosebs,(.startWith "asdf" "asd")
12:38clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: startWith for class java.lang.String>
12:38ambrosebs,(.startsWith "asdf" "asd")
12:38clojurebottrue
12:39ambrosebs,(.startsWith (str "asdf") "asd")
12:39clojurebottrue
12:39ambrosebs:) nvm, typo
12:52devnNever forget that it is a waste of energy to do the same thing twice, and that if you know precisely what is to be done, you need not do it at all. -- E. E. "Doc" Smith (1930)
13:13cemerickSo, just how evil would it be to define a type that implements e.g. IPersistentMap, but proxies database state?
13:15lnostdalwith a cache that would be evil cool, cemerick
13:16cemerickwhat would the cache get you?
13:16ambrosebswhat's the function to print a Java class's fields and methods?
13:16lnostdalhm, yeah, i guess the map would "be" the "cache" actually
13:17cemerickambrosebs: see clojure.reflect/reflect
13:17cemericklnostdal: There wouldn't be any storage; assoc would put, get would get, dissoc would delete, etc.
13:17cemerickIt strikes me as a really bad idea. :-P
13:18Bronsawouldn't this be mutable state?
13:18ambrosebscemerick: cheers
13:18cemerickyeah
13:19Bronsaand mutable state is bad right?
13:19cemerickAll databases are mutable state.
13:19Bronsathat's a good point
13:20cemerickPart of me wants to be able to utilize the vocabulary provided by assoc/dissoc/into/update-in, etc.
13:36TimMccemerick: ORM!
13:36TimMcIt would be pretty evil, since the DB is not... persistent.
13:38TimMccemerick: OR... "Duh, what did you *think* 'persistent" meant."
13:39technomancy_devn: is that the same doc smith as the guy who pioneered the space opera?
13:41BorkdudeI have always disliked working with databases because of their mutability
13:43TimMcAt least they have a good concurrency story...
13:44BorkdudeWhy does everyone use the word "story" in Clojure world
13:44Bronsaalso "to complect"
13:44Borkdudejust wondering where that came from ;)
13:44TimMcBorkdude: I think it's an enterprisey thing.
13:44Borkdudeand "mitigate"
13:45BorkdudeTimMc: I don't like enterprisey things
13:45TimMc"complect" comes from Rich's talk "Simple Made Easy", which is worht a watch
13:45Bronsayeah, i watched it
13:45Borkdudeis it like Scrum "user stories"?
13:45TimMcBorkdude: That's my guess.
13:46TimMcA lot of Clojurians (conj-urers?) come from the Java world, which is pretty enterprisey.
13:47BorkdudeTimMc: I get critized for using Clojure because it is too immature (un-enterprisey), this guy believes you cannot do "big" projects with it
13:48BorkdudeTimMc: because in OO world there are a lot of tools, methods, notation (UML) and documentation, unlike in the functional/Clojure realm.
13:49mbac(ns foo (:require clojure.contrib.json))
13:49mbac(read-json "{}")
13:49mbacjava.lang.Exception: Unable to resolve symbol: read-json in this context (NO_SOURCE_
13:49mbacsay what?
13:49Bronsas/require/use/
13:49Borkdudembac: you have to prefix it with the namespace name you required
13:49Borkdudembac: or "use" it like Bronsa suggests
13:49mbacoh, is that the difference between require and use?
13:49Borkdudembac: yup
13:49cgrayjust curious: why is last not implemented as (nth coll (dec (count coll))) ? wouldn't that at least make it constant-time for vectors?
13:50Borkdude,(source last)
13:50mbacwhy does require exist at all then?
13:50clojurebotSource not found
13:50Borkdudembac: so your namespace does't get polluted with vars you don't need
13:51cgrayBorkdude: http://clojuredocs.org/clojure_core/clojure.core/last#source
13:51TimMcmbac: Use :require with :as.
13:51Borkdudembac: or to distinguish clearly, for example you can do : require :as json and then every json function you can call like: (json/function ...)
13:52TimMchttp://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns
13:52Borkdudecgray: hmmm, I didn't know that it walked the entire seq in case it is a vector
13:53cgrayBorkdude: yeah, I was surprised too... I bet there's a good reason that I'm not seeing though
13:53Borkdudecgray: maybe there is some trickery going on with protocols or smth, I don't know
13:54TimMcHuh, that's an ugly surprise.
13:54mbacwhat i mean is if you still have to fully qualify the package even after you say require, what's the point of require
13:54TimMcmbac: :as
13:54TimMcyou don't
13:55Borkdudembac: if you don't do require at all, it doesn't even know it I guess?
13:56TimMcmbac: Are you asking why you have to require at all if you just use a FQNS?
13:56mbacyeah
13:56TimMcAh, I see. That's a good question.
13:57TimMcIt doesn't have parity with import, does it.
13:57TimMcI can do java.io.File without importing.
14:00Borkdude,(loaded-libs)
14:00clojurebot#{clojure.java.io clojure.repl}
14:00Borkdude,(clojure-version)
14:00clojurebot"1.3.0"
14:05Borkdudembac: https://gist.github.com/1462160
14:07Scriptorwhere did Hiccup get its name from?
14:08chessguyhowdy ya'all
14:09Raynes... partner.
14:09mbacBorkdude, what's this? :)
14:09Scriptorwait, better question, is james reeves on irc?
14:10TimMc&(keyword "-)")
14:10lazybot⇒ :-)
14:10Borkdudembac: an answer to your question about require?
14:10mbacjust checking
14:10mbac:)
14:12chessguyso i'm a bit confused about how to use clojure.test. can i just feed a file with tests to clojure from the command-line?
14:13mbacwhy are def and defn different?
14:13mbaccan't clojure just treat defs with more than 2 atoms as a function definition?
14:14kumarshantanumbac: that sounds leaky; what do you mean?
14:14Borkdudembac: defn is a special case of def
14:15Borkdudembac: it is shorthand for (def my-var (fn ....))
14:15Borkdude,(source defn)
14:15clojurebotSource not found
14:15Borkdudethis doesn't work right?
14:15mbacsometimes i say (def base_url "http://example.com/&quot;) but then i go oh wait it's a function of your session-id so i change it to (def base_url [session_id] (str "http://example.com/&quot; session_id))
14:15mbacand then clojure's like fuck you you forgot to say defn
14:15mbacand i'm like damnit you can figure it out
14:16mbac:(
14:16Borkdudembac: you should just write defn if you want to define a function
14:16Borkdudembac: or (def my-var (fn [session-id ...)))
14:16mbaci'm simply asking if there's a reason clojure can't overload the meaning of def
14:16flashingpumpkinhey guys. how would I access a hash-map value when I've got the key in a variable?
14:17Borkdudembac: such cleverness will only lead to more confusion
14:17ssiderisflashingpumpkin: (get map key)
14:17Bronsambac: since 1.3 def supports an optional doc argoument for def
14:17Scriptoryea, (def base-url [session-id]) would be assigning a one-element list to base-url
14:17Bronsaso you can (def a [] "doc")
14:17mbacborkdude, disagree. i have this expectation from using ocaml
14:17Bronsaand this means a has value [] and as doc "doc"
14:17kumarshantanudefn also adorns the var with metadata (type hints, documentation etc)
14:17Bronsabut (defn a [] "doc") is different
14:17Borkdudembac: ocaml isn't a lisp
14:18Bronsait's a function that returns the string "doc"
14:18mbacwhere let base_url = "http://example.com&quot; can extend smoothyl to let base_url session_id ("http://example.com/&quot; ^ session_id)
14:18flashingpumpkinssideris, https://gist.github.com/889a2535b84ef1d3b996
14:18mbacborkdude, no, but it aspires to functional platitudes :)
14:18mbac(clojure does)
14:18mbaci think?
14:18Borkdudembac: clojure doesn't have currying
14:18Borkdudembac: and I think what you are showing has to do with currying
14:18mbacanyway, i was wondering if there was a reason why this wouldn't work and bronsa had a good answer
14:18mbacdoc strings
14:19mbacborkdude, this has nothing to do with currying
14:19Scriptormbac: you're asking why (def base-url [session-id]) isn't detected as being a function definition?
14:19mbacscriptor, yeah
14:19wiseencan anyone help me figure out how to run clojure tests with lein so that I don't have to reload JVM every time I run lein ?
14:19Scriptormbac: because that's also valid as assigning a list to base-url
14:19mbacyeah, i see the error of my ways now
14:19Scriptornamely, a one-element list containing session-id
14:19flashingpumpkinah. ssideris if the key is actually a string it works :)
14:19ssiderisflashingpumpkin: yeah, :foo is not the same as "foo"
14:20flashingpumpkinyep
14:20ssiderisif you have the string, you have to convert it to a keyword first
14:20kumarshantanuwiseen: you should pester @icylisper to release Jark with Lein integration
14:20ssideris(get map (keyword s))
14:20ssideriswhere s is the string
14:22wiseenkumarshantanu, what's Jark ? google isn't helpful
14:22cemerickTimMc: I'd never suggest an ORM ;-)
14:22kumarshantanuwiseen: http://icylisper.in/jark/
14:23wiseenkumarshantanu, tnx will look in to it
14:24Borkdudembac: you're right; let in ocaml can be used for simple values or functions, it is just clever syntax, whereas clojure is more like other lisps: if you want to write things more clever, write a macro (like defn)
14:25daniel___(def conn mongo/make-connection "iskine" :host "127.0.0.1" :port 27017)
14:25mbaci was more curious if there was a reason wasn't feasible
14:25mbacthan anything
14:25daniel___Caused by: java.lang.RuntimeException: Too many arguments to def
14:25daniel___im trying to use congomongo, getting this error
14:26Bronsashould be (def conn (mongo/make-connection ..))
14:26Borkdudedaniel___: you are forgetting parens before mongo/... and after 27017
14:26ssiderisdaniel___: (def conn (mongo/make-...))
14:26daniel___i see, github readme is wrong then
14:26daniel___should have realised anyway
14:30daniel___docs also tell you to use mongo/make-connection but on the import line they dont create the mongo namespace
14:31Borkdudembac: you might also want to read this SO question http://stackoverflow.com/questions/2570628/difference-in-f-and-clojure-when-calling-redefined-functions
14:31Borkdudembac: I was confused when I just started clojure after doing some F# (derived from Ocaml)
14:33mbacborkdude, yikes
14:33mbacthat's good to know
14:34Bronsambac: if you defined g as (defn g [x] (#'f x))
14:34mbacwhat's the term for this behavior? the top-level defs are dynamically scoped?
14:34Bronsathe resoul would be the same as in f#
14:34Bronsaomni5cience:
14:34Bronsaops
14:35Borkdudevars have a root binding and you can give them a thread local binding, but I'm always confused about vars, so maybe someone else can explain this better
14:36Borkdudembac: http://clojure.org/vars
14:37Borkdudembac: I guess the example in F# you can read as nested lets right
14:38mbacyeah
14:47chessguyi'm a bit confused about how to use clojure.test. can i just feed a file with tests to clojure from the command-line?
14:48Borkdudechessguy: I guess you can do (run-tests) and then it runs all tests from all referenced namespaces
14:48chessguyBorkdude: i've tried doing a (load-file ...) at the repl, and then doing (run-all-tests), but it's not working
14:49chessguyit doesn't recognize the run-all-tests symbol
14:50Borkdudechessguy: hmm..
14:50chessguylet me show the code
14:50Borkdudechessguy: what clojure version?
14:50chessguyBorkdude: umm, i cloned github and built that, so whatever that is
14:50Borkdudechessguy: http://clojuredocs.org/clojure_core/clojure.test/run-all-tests < 1.3.0
14:51Borkdudechessguy: do you have a repl? type: (clojure-version)
14:51chessguyah, nice
14:51chessguy1.4.0-master-SNAPSHOT"
14:52chessguyit's unable to resolve (run-tests) too
14:52Borkdudechessguy: did you use clojure.test?
14:52Borkdudechessguy: or require
14:53chessguyBorkdude: here's the code: https://gist.github.com/1462396
14:54chessguyBorkdude: i did a use
14:55Borkdudechessguy: from where are you calling run-tests then
14:56chessguyBorkdude: from a repl, i did a (load-file "unify_test.clj")
14:56chessguyand (run-all-tests)
14:56Borkdudechessguy: you typed all of this into a repl?
14:56chessguyBorkdude: the code in the gist is in two files. i put comments with the filenames
14:57Borkdudechessguy: right. you need to use clojure.test also from the repl
14:57chessguyBorkdude: oh really? why?
14:57chessguyah, you're right, that worked.
14:57Borkdudechessguy: because then the test lib gets loaded and run-tests will become available from your namespace
14:58chessguyBorkdude: does it not get loaded when i specfy ":use clojure.test" in the namespace?
14:58Borkdudechessguy: now it is only available from building-problem-solvers, not from your repl namespace, unless you do (in-ns 'building-problem-solvers)
14:58chessguyah. which is probably notn what i want anyway
14:59daniel___in noir, how can i pass content through to the general layout from a defpage? i have some links that are in the layout but they depend on attributes like :id from each page
14:59Borkdudechessguy: use doesn't work transitively, it would mean a cluttered namespace
15:00daniel___in other words i need some kind of placeholder in the layout that i later define in the defpage
15:00chessguyhmm. it looks like i still need to use clojure.test from within the namespace, to be able to define the test
15:00Borkdudedaniel___: sounds like a perfect use for Enlive
15:01TimMcchessguy: I just use `lein test`. -.-
15:01Borkdudechessguy: yes, you need to 'use' it everywhere you 'use' it ;)
15:01chessguyBorkdude: thanks for your help
15:01daniel___Borkdude: dunno what that is but ill have a search
15:01chessguyTimMc: i haven't gotten around to lein yet
15:01TimMcHow is that possible? :-P
15:02Borkdudedaniel___: Enlive is a templating library
15:02Borkdudedaniel___: so you don't have to construct html from clojure, but just plain html file which you can use as a template with selectors etc
15:03Borkdudedaniel___: I bet you can also use html contructed with hiccup but I haven't used it like that
15:04TimMcdaniel___: Enlive's documentation is terrible, but it is a pretty useful lib.
15:05daniel___TimMc: most clojure libs seem to have terrible documentation, at least for beginners
15:05daniel___noir/korma are quite good
15:13Borkdudedaniel___: I guess this is an argument for the immaturity of Clojure libs for enterprise
15:14Borkdudedaniel___: missing docs, things are still moving fast
15:15chessguyTimMc: ok, i've almost got it turned into a lein project. it still complains when i try to 'lein test', though
15:15chessguyTimMc: says it can't find the .class or .clj file on the classpath
15:19Borkdudechessguy: move your .clj into a dir named project/src/name and make the name of the dir and the namespace of your .clj file the same
15:19Borkdudechessguy: but you might have figured this out already
15:24chessguyBorkdude: i'm almost there, but something's still not quit lining up right: https://github.com/arwagner/bps-clojure
15:26chessguyi'm guessing it's because i was inconsistent about sometimes abbreviating bps and sometimes not
15:31Borkdudechessguy: normally, when you have a project and a src dir with a clj file directly in it called core, you have to refe it like: projectname.core
15:32Borkdudechessguy: but when you use an extra subsir you have to refer it like: projectname.subsir.core and also declare it like this
15:32chessguyBorkdude: i just pushed a change to make some stuff more consistent. lein created a projectname subdir under src
15:33Borkdudeok
15:33Borkdudeand did it also create the core.clj?
15:33chessguyyes
15:35Borkdudechessguy: my advise, just make a new project with "lein new" and move in your code gradually
15:35Borkdudechessguy: also _ and - can be tricky
15:35chessguyBorkdude: that's what i tried to do
15:35chessguyi guess i'll start over again...
15:38mbaci don't quite grok how to deal with the 1.3 contrib world
15:39mbacam i supposed to download the modules i need and somehow tell clj where to find them?
15:39Borkdudembac: http://dev.clojure.org/display/doc/Clojure+Contrib
15:39Borkdudembac: are you using leiningen?
15:40flashingpumpkinmbac, Borkdude, same puzzling here - and yep using leiningen
15:40mbaci do for quick development, but i'm also using a ~/bin/clj script which doesn't seem to line up with whatever leiningen does
15:42mbacborkdude, i don't know how to use the information on that page
15:42Borkdudembac: from project.clj just [org.clojure/core.logic "0.6.8-SNAPSHOT"]
15:42mbaci want to usea standalone script without leiningen
15:43mbacor, better yet, put leiningen into my #! line
15:44Borkdudembac: I only did it the leiningen way so far, sorry
15:44mbacyeah, i guess i'll give up and use leiningen
15:48gfredericksThere are 7 times more google results for "vim to emacs" than "emacs to vim"
15:49companion_cubethat must mean that more people use vim :]
15:49gfredericksI had not thought of it that way.
15:52duck1123more people want to leave vim
15:54gfredericksmaybe the switch to emacs is much more painful and so more likely to be blogged about.
15:54companion_cubeyeah, the amount of blogging does not reflect the popularuty
15:54companion_cubepopularity*
15:55duck1123I guess if you know emacs, then vim is just one big annoying piece of cake. Not so the other way
15:56daniel___Borkdude: i realised by reading the noir tutorial that i can achieve what i wanted by just passing extra variables through to defpartial
15:57gfredericksis there an argument to emacs that makes it open in a terminal?
15:57daniel___i thought you could only do it on defpage, but it works with something like (defpartial layout [id name & content] ...
15:57daniel___gfredericks: -nw
15:57gfredericksdaniel___: thx
15:58duck1123gfredericks: if you already have emacs running somewhere else: emacsclient -ct
16:01Borkdudedaniel___: ah good
16:01gfredericksduck1123: man I don't even know what that means. emacs is/can-be client-server?
16:02Borkdudeduck1123: emacsclient -nw or emacsclient -ct does exactly the same thing for me when I have emacs running
16:02duck1123gfredericks: put (start-server) at the bottom of your init file, then you can open multiple connections to the same emacs session
16:03duck1123I have two computers here, so I'll open a x11 forwarded ssh session and have them both work on the same emacs instance
16:03gfredericksI think I will have to learn some basics first.
16:03Borkdudeduck1123: I think -t just means -nw
16:03gfredericksI just looked up how to move the cursor up/down/left/right.
16:03Borkdudeduck1123: -c is only useful if you want to use it from a window
16:04duck1123Borkdude: are you sure client takes the -nw flag, i thought that was only for emacs
16:04Borkdudeduck1123: according to emacsclient --help it does
16:04gfredericksI was hoping C-h would backspace like it does everywhere else. Unfortunately it helped.
16:04daniel___gfredericks: what editor are you more used to?
16:04gfredericksdaniel___: the other one
16:04daniel___me too, tried vimclojure?
16:05gfredericksyep
16:05gfrederickscouldn't get it to do anything fancy
16:05duck1123Borkdude: hmm, looks like you're right. I seem to remember at one time that not working
16:05gfredericksmostly it just indented exactly the way I didn't want
16:05daniel___i like it for syntax-highlighting, paren matching, and indenting
16:06gfredericksI probably didn't learn it well enough
16:06duck1123gfredericks: C-h is for help-related options. You can rebind it (as with everything) but I wouldn't recommend it
16:06daniel___i am also trying to learn emacs because lein-nailgun doesnt seem to be as good or easy to use as swank
16:06gfredericksI've tried to learn emacs maybe twice before.
16:07daniel___still wishing there was a better option for vim though
16:08daniel___i find myself trying to make emacs as much like vim as i can
16:10gfredericksI will learn emacs and org-mode and xmonad in parallel. Maybe.
16:10daniel___had never even heard of org-mode tbh, isnt it just an extension of emacs?
16:11duck1123org-mode is concentrated awesome
16:11gfredericksI'm trying to get off of tomboy
16:12daniel___org-mode looks interesting, tbh i just use a textfile or something like notepad.cc
16:15duck1123I need to revise my use of org-mode. I used to be really into, but I fell out of practice
16:15daniel___do people have any preferences when working with javascript with a clojure web framework? are there any worthwhile advantage si can get from using something like clojurescript? just write plain javascript/jquery? any good libraries for coffeescript?
16:16amalloydaniel___: my experience is that the clojure community mostly scoffs at coffeescript; some see an advantage in using clojurescript; others stick with javascript
16:17amalloyscoffeescript?
16:19daniel___tbh i think coffeescript has nice syntax but doesnt seem to provide any real advantages and it's just one-more thing to learn
16:19gfredericksamalloy: really? I'm curious why somebody would prefer javascript over coffeescript.
16:19daniel___im worried clojurescript is a bit immature
16:19lnostdalthis doesn't apply for 1.3 anymore (or i'm testing with 1.4-SNAPSHOT really)? http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/
16:20Scriptorcoffeescript fixes a bunch of things that irked js developers for years, there's definitely a point to using it
16:20gfredericksI've used coffeescript in a big project at work the last few months, and have never regretted it. Wished clojurescript had been around sooner, but certainly didn't want to use JS
16:21Scriptoryea, you can scoff at it all you want, but it grew *extremely* quickly after it was released
16:22ScriptorI'm still debating on that, I like having it set to esc for now
16:22duck1123gfredericks: you actually have a reason to retain caps?
16:23gfredericksYeah I was just thinking there wasn't much of a point to that.
16:23gfredericksbut this forces me to retrain
16:23gfredericksAny recommended alt uses for the LCtrl?
16:24gfredericksit's so far away I can't imagine anything being all that compelling...
16:24Scriptorcaps lock :p
16:24duck1123bind it to hyper, then program a whole new level of commands
16:24gfredericksduck1123: is that a real thing?
16:24amalloygfredericks: i leave it as another ctrl; in a few combinations it's easier to use than caps
16:24JaegerBarhi
16:25duck1123gfredericks: yes
16:25amalloyeg, for ctl-shift-tab it seems better. and i already have a super key i don't use; not much value in hyper :P
16:26gfredericksI've been wanting to map from C-Space to Tab, but google doesn't produce any magic xmodmap code for it, and the whole subject seems too complex to learn easily
16:26TimMcdaniel___: ClojureScript *is* immature.
16:26gfredericksTimMc: does it have rationals yet?
16:26TimMcNo idea.
16:27amalloygfredericks: i don't think xmodmap lets you do that. i'm not sure it's a good idea either; c-spc is pretty handy in emacs
16:27gfredericksamalloy: what's it do?
16:27amalloyset the mark
16:27gfredericksmy pinkie gets tired during tab-completions
16:27amalloygfredericks: M-/
16:28amalloy(and in C-u C-spc it pops the mark)
16:28gfredericksamalloy: is that supposed to work with bash, or just in emacs?
16:28duck1123gfredericks: setting the mark allows you to start selecting text. (for cutting or whatever)
16:28duck1123there's something similar in screen
16:28amalloygfredericks: probably just emacs, since i think it's supposed to be "dynamic completion", whatever that means
16:29amalloybtw, on a barely-related note, C-/ is undo in bash
16:29gfredericksI'm always tab-completing stuff at the command line. Maybe I'll do that less w/ emacs? :/
16:29companion_cubeamalloy: wow, didn't know that
16:30amalloycompanion_cube: a huge percentage of things you do in emacs work at the command-line, because bash uses readline
16:30mbacis there a zip function? (zip [1 2 3] ["a" "b" "c"]) evaluates to [[1 "a"] [2 "b"] [3 "c"]] ?
16:31companion_cubebut i thought C-/ was 'search' in emacs
16:31amalloy~zip
16:31clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
16:31Chousukembac: map vector
16:31mbacneat
16:31gfredericksclojurebot: that is handy
16:31clojurebotIn Ordnung
16:31gfredericksha
16:31gfredericksclojurebot: that?
16:31clojurebotthat is handy
16:32gfredericksvery nice.
16:32weavejestercompanion_cube: Isn't C-/ undo?
16:33companion_cubenever mind, i don't know much emacs commands
16:33JaegerBari'm trying to get started in Clojure, which compiler do i need
16:34weavejesterJaegerBar: You can download the jar from the main site, or use Leiningen, which is a build tool and dependency manager for Clojure.
16:34duck1123JaegerBar: you need Java, and while you don't need it, you need leiningen
16:35JaegerBarok
16:35JaegerBardoes this compile like normal java
16:35JaegerBarlike do i have to say something similar to "javac ....java"
16:35weavejesterNot usually. It's more like Python or Ruby
16:36JaegerBarso it's a scriptable language
16:36gtrak```JaegerBar, it's kinda hard to explain it all over IRC, let me find you a good tutorial
16:36weavejesterIn that it's compiled when you execute it.
16:36duck1123clojure's kinda a little of both
16:36JaegerBari saw a book at the store called "The Joy of Clojure: Thinking the Clojure Way" should i get it?
16:36gfredericksJaegerBar: yes.
16:36gtrak```it's good, but pretty advanced
16:36JaegerBari read the part where it tried to explain functional programming
16:37JaegerBaridentity vs. state
16:37JaegerBari still am not super sure i understand that but i'm getting there
16:37gtrak```http://java.ociweb.com/mark/clojure/article.html#Intro
16:37amalloyJoC is the best clojure book. i don't think it's "advanced", it's just "fast"
16:37JaegerBargtrak do you program clojure professionaly
16:38gtrak```not so much myself right now, but we have a lot of stuff written in it
16:39gtrak```I've read through JoC and done some toy programs, plus some work in an existing large clojure project
16:40gtrak```amalloy, I've seen lots of folks say it's a good second book, not first
16:40JaegerBarwho is "we"
16:40JaegerBaryour company
16:40gtrak```Revelytix
16:40duck1123Programming Clojure was a good intro book
16:40JaegerBaris clojure used exclusively for threaded programming
16:41gfredericksnope
16:41duck1123who was the guy at Revelytix that came to michigan for CloudDevDay ?
16:41JaegerBarRevelytix is a big time company
16:41gtrak```probably Alex?
16:42JaegerBarhow do you pass a function
16:42gtrak```ah, Ryan
16:42JaegerBarthat's a confusing concept
16:42gtrak```Ryan Senior, I've worked with him a little, all those guys are really great
16:42danielis Practical Clojure any good? thats the one im reading
16:43gfredericksJaegerBar: that's a fundamental concept in functional programming -- functions can be treated as objects
16:43JaegerBaris someone gonna hold my hand on this
16:43gfredericksJaegerBar: what programming languages are you most familiar with?
16:43JaegerBaror am i on my own
16:43JaegerBarjust C
16:43JaegerBarwell C and java i guess
16:43gfredericksdoesn't C have a bit of that?
16:43JaegerBarjava i suck at though
16:43gtrak```JaegerBar, it's too much for hand-holding, imo :-)
16:44JaegerBari don't know i am not a hardcore C programmer
16:44amalloygfredericks: you can pass functions in c, but you can't return them
16:44gfredericksamalloy: C so weird.
16:44amalloywell, that's not true
16:44JaegerBari didn't know you could pass a function in C =p
16:44duck1123that's what I was thinking
16:44amalloyyou can't make closures, which is as near as possible as not being able to return them :P
16:44gtrak```duck1123, we have a team of 9 in St. Louis doing full clojure, I work mostly on a big java thing, 300k lines :-D
16:45gfredericksJaegerBar: one of the things it lets you do is create abstract algorithms. For example I can easily define a function called "do-twice", that takes a function as an argument and calls it twice
16:45JaegerBarha that's really cool
16:45weavejestergtrak: Out of interest, how maintainable do you find 300k lines of code?
16:45duck1123I'm so happy that I finally got to start using Clojure at work. We've been doing Ruby, but I've re-written a large portion of my app in Clojure
16:45gfredericksNot so easily done imperatively
16:46JaegerBaris Clojure mainly used now for web programs
16:47gfredericksJaegerBar: I think that's a signifiant portion of its uses, but probably not even a majority
16:47weavejesterJaegerBar: I don't think so... I've seen a lot of data-processing done in Clojure, for instance...
16:47JaegerBarduck, what did you write in Ruby/Clojure at work
16:47gtrak```weavejester, ha, well, it's my first big project, I'm just out of school 2 years ago so I have no standard to compare against. I find that I have to read every line in whatever subsytem I'm working on before I can make changes confidently. It takes time, but it's doable. Tests help.
16:47gtrak```weavejester, honestly, I'm much more scared of other people's clojure code :-)
16:48weavejestergtrak: I haven't worked on a software project anywhere near that size before, so I was curious :)
16:48duck1123I do data processing, reading streams of blog posts and twitter streams, etc which we process and index for another team
16:48arkhit takes 38 seconds for my vm to run cljsc on some simple clojurescript - any recommendations to speed things up? (besides a faster computer)
16:48gtrak```weavejester, I'd definitely be lost without the expertise of the senior guys, sometimes they can say in one sentence what would take me days to figure out
16:49Turtl3boishow me how to pass a function C
16:49Turtl3boiin the C language........because i've never seen dat b4
16:49gtrak```hey there Turtl3boi
16:49Turtl3boihi Gtrakh
16:49duck1123http://stackoverflow.com/questions/9410/how-do-you-pass-a-function-as-a-parameter-in-c
16:50Turtl3boioh yea you pass it as a pointer to function
16:50Turtl3boii don't generally do that very often for whatever reason haha
16:51gtrak```well, in C you can't actually have closures since there's no GC
16:51gtrak```might be possible with reference counting
16:51Turtl3boiwhat's a closure? haha
16:52weavejesterCPython ref-counts and has closures, I believe.
16:52brehautweavejester: yes, although its got some stuff in addition to the ref counter for cycles
16:52gtrak```,((let [a 1] (fn [] (inc a)))
16:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:52gtrak```,((let [a 1] (fn [] (inc a))))
16:52clojurebot2
16:53bobhopehello clojuristas, can anyone explain to me what the consequence of disabling occurs-check in a kanren implementation is?
16:53gtrak```Turtl3boi, that thing I just wrote calls an anonymous function that closes over the value of a
16:53weavejesterTurtl3boi: A closure is a function that references the environment in which it was defined.
16:53weavejesterI think :)
16:53weavejesterThere might be a more accurate description.
16:54Turtl3boiooo anonymous functions again
16:54gtrak```it's binding a heap-allocated object to a value that was local at one point
16:54gtrak```and then invoking it
16:55duck1123the point is, you capture the value of a when you define that fn, then you can pass that fn around, do whatever, and it''l return 2 whenever you do call it
16:55gtrak```and it's easy to make functions that make functions
16:56gtrak```,((fn [] (fn [] (+ 1 2))))
16:56clojurebot#<sandbox$eval79$fn__80$fn__81 sandbox$eval79$fn__80$fn__81@611faa>
16:56gtrak```,(((fn [] (fn [] (+ 1 2)))))
16:56clojurebot3
16:56Raynesweavejester: In my experience, the definition of 'closure' is "That's an okay working definition, but it isn't correct."
16:57Turtl3boideconstruct that for me gtrak
16:57gfredericks(apply partial (repeat partial)) is a function that makes functions ad infinitum
16:57Turtl3boiwhat does "fn[] (+ 1 2)" do ?
16:57gfredericksTurtl3boi: that's a function that adds one and two
16:57Turtl3boidoes that define a function which adds 1 + 2
16:57gfredericksso it returns 3
16:57weavejesterTurtl3boi: You mean (fn [] (+ 1 2)) ?
16:57gtrak```creates a function, the arglist goes in the []
16:57weavejesterRaynes: Yeah, there's a more accurate computer-sciencey definition
16:58gtrak```,((fn [x] (+ 1 x)) 2)
16:58clojurebot3
16:58Turtl3boiwhy do you put parens around it weavejester?
16:58duck1123to call it
16:58gtrak```(fn .. defines the function
16:58weavejesterTurtl3boi: Because that's the syntax
16:58gtrak```((fn .. calls the function that was defined
16:58Turtl3boikk gotcha
16:58gtrak```(fn ... actually returns a function
16:58gfredericks,(+)
16:58clojurebot0
16:58Turtl3boiwhat does the outer "fn [] " do?
16:59gtrak```that's just defining a function that returns a function :-)
16:59gtrak```you call it once to get the inner, then call that to get the value
17:00gtrak```((fn [x] (+ 1 x)) 2) calls the function with 2 as the first parameter, x
17:01Turtl3boi,((fn [] (+ 1 2)))
17:01clojurebot3
17:01Turtl3boiif i add another "fn [] " to the left, what does it do in the above statement?
17:01Turtl3boiis that the same as calling it
17:01gfredericks,(fn [] (fn [] (+ 1 2)))
17:01clojurebot#<sandbox$eval221$fn__222 sandbox$eval221$fn__222@12aeb08>
17:02gfredericksthat just returns the outer function
17:02TimMc&(((fn [] (fn [] 5))))
17:02lazybot⇒ 5
17:02TimMc&((fn [] ((fn [] 5))))
17:02lazybot⇒ 5
17:02gtrak```Turtl3boi, (fn calls fn
17:02TimMcTurtl3boi: This is more clear when you bind the fns to names and then call them.
17:02gfredericksis there an alt keybinding in emacs for backspace?
17:03gtrak```(let [add (fn [x] (+ 1 x))] (add 6))
17:03gtrak```,(let [add (fn [x] (+ 1 x))] (add 6))
17:03clojurebot7
17:03Turtl3boi,(fn [] (fn [] (+ 1 2)))
17:03clojurebot#<sandbox$eval55$fn__56 sandbox$eval55$fn__56@d7cdf1>
17:03Turtl3boi^ why doesn't athw rok
17:03Turtl3boilol
17:03gtrak```it does, that's how a function shows up
17:03TimMc,(let [boring (fn [x] (+ 2 x))] (boring 3))
17:03clojurebot5
17:03gfredericksit does work. what do you want it to do?
17:04duck1123gfredericks: If you ever want to get any info about a key sequence: C-h k <sequence>
17:04TimMcOh, gtrak``` beat me to it.
17:04gtrak```TimMc, :-D
17:04danielwhats the simplest way of password protecting paths with noir? i have a path like /model/:id and this model may or may not have a password attribute set...if it has a password i want to check for the password or redirect
17:04mindbenderfunctions are first class objects in clojure just like classes are in java
17:04TimMcgtrak```: lazybot was feeding me NPEs on that for some reason
17:04Raynes(fn [x] x) <-- returns a new function that returns its argument. Functions are first class in Clojure. You can create this function and then call it immediately like any other function. That's what they did earlier.
17:04danielthis is my attempt https://gist.github.com/1463038
17:05danielbut seems to pass the when-not, even if i dont pass in any password variable
17:05Turtl3boi,(let [bullshit (fn [x] (+ -1 x))] (bullshit 33))
17:05clojurebot32
17:05amalloygfredericks: none built in
17:05gfredericksduck1123: that's a useful thing to know, but I don't see how it helps me answer my question? I tried it with backspace, and from what I can tell it displayed unrelated information
17:06Turtl3boiare functions first class in python?
17:06mindbenderTurtl3boi: lmao
17:06gfredericksamalloy: so you just reach all the way up there all the time?
17:06gtrak```i think so
17:06amalloyand duck1123 is right - i got that answer by pressing C-h k BACKSPACE
17:06Turtl3boiwhy are you laughing
17:06mindbenderyour choice of symbol
17:07gtrak```Turtl3boi, try dir(len) in your python interpreter
17:07Turtl3boiahh haha ok
17:07gfredericksamalloy: all I got was some stuff about org-self-insert-command; didn't really understand it
17:07weavejesterFunctions are first class in Python.
17:07amalloygfredericks: well, it generally shows you what other keys it's bound to if there are any
17:07RaynesOne-line lambdas ftw!
17:08amalloytry C-h k C-/ for comparison
17:08mindbenderweavejester: as it is in any other functional language
17:08gfredericksare functions considered first-class in ruby?
17:08weavejestermindbender: Well, Python's not a functional language...
17:08weavejestergfredericks: No, because technically it just has methods, not functions :)
17:08mindbenderwhat makes a language functional?
17:08RaynesList comprehensions considered harmful.
17:08gfredericksweavejester: that's what I figured
17:08brehautRaynes: one expression, not line
17:09RaynesA language creator that doesn't abolish the paradigm, probably.
17:09weavejestermindbender: A functional language tries to reduce or restrict side effects
17:09Turtl3boi(fn [x] x) <-- returns a new function that returns its argument.
17:09Turtl3boiwhat does that mean
17:09weavejesterweavejester: So in Clojure, we have atoms and refs for handing state change. We need to be explicit
17:09gtrak```,(fn [x] x)
17:09clojurebot#<sandbox$eval169$fn__170 sandbox$eval169$fn__170@b952ad>
17:09weavejestermindbender: But in Python, everything's mutable by default
17:10lucianweavejester: except when it isn't
17:10gtrak```Turtl3boi, that's the .toString() on the function object
17:10Turtl3boihmm
17:10lucian(ints, floats, strings and tuples are immutable)
17:10weavejesterlucian: Well... okay, the core data structures in Python are all mutable
17:10gfredericksTurtl3boi: it means that whatever argument you pass to that function is its return value
17:10RaynesIt is the identity function.
17:10Raynes&(identity 0)
17:10lazybot⇒ 0
17:10Turtl3boihahaha ok that's what i thought
17:10weavejesterlucian: ... except for those :)
17:10gfredericks,(let [returns-its-arg (fn [x] x)] (returns-its-arg "HAAAA"))
17:10clojurebot"HAAAA"
17:11Turtl3boiwhy did the other guy say it "returns a new function that returns its argument"
17:11Turtl3boiwhy did he say "new function"
17:11gtrak```,(source identity)
17:11clojurebotSource not found
17:11gfredericksRaynes: you just passed the additive identity to the functional identity
17:11weavejesterlucian: I wouldn't class Python as functional though. Aside from tuples and maybe strings, it doesn't make much effort to avoid mutability.
17:11TimMcTurtl3boi: Well, it's a new function, it's not the same object as `identity`.
17:11RaynesTurtl3boi: Because it isn't an old function...?
17:11Turtl3boilol k
17:11Turtl3boii'm going too far into it as i usually do
17:12Turtl3boibrb
17:12lucianweavejester: sure, it makes little effort. i sort of see any language with first-class functions as functional
17:12TimMc&(identical? (fn [x] x) (fn [x] x))
17:12lazybot⇒ false
17:12gfredericksTurtl3boi: "new" functions can be created just as easily as "new" strings
17:12TimMc&(let [boring (fn [x] (+ 2 x))] (boring 3)) ;; let's see if lazybot is still broken...
17:12lazybotjava.lang.NullPointerException
17:12TimMchaha
17:12gfredericksrather than only being declared at some kind of higher level
17:12gtrak```,&(= (fn [x] x) (fn [x] x))
17:12clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(NO_SOURCE_PATH:0)>
17:12Raynes$reload
17:12lazybotReloaded successfully.
17:12lucianweavejester: so in that sense, python has functional concepts (decorators, properties, object creation, comprehensions, immutable iterators, etc)
17:12TimMc&(let [boring (fn [x] (+ 2 x))] (boring 3)) ;; let's see if lazybot is still broken...
17:12lazybotjava.lang.NullPointerException
17:12gtrak```,(= (fn [x] x) (fn [x] x))
17:12clojurebotfalse
17:13RaynesTimMc: Meh, I'll figure that out later.
17:13TimMcRaynes: SANBOX DENIED
17:13gtrak```&(= (fn [x] x) (fn [x] x))
17:13lazybot⇒ false
17:13gtrak```if only :-)
17:13brehautlucian: if you think pythons iterators are immutable, you are sadly mistaken
17:13weavejesterlucian: Why is object creation functional?
17:13mindbenderweavejester: a bit of reading up confirms you're right
17:13bobhopewhat's the best way to return multiple values in clojure?
17:13lucianbrehaut: i meant the original object to be iterated on is not mutated
17:13gtrak```bobhope, a vector or a map
17:14Raynes&(fn [] [1 2 3])
17:14lucianweavejester: because it act like functions (classes are first-class callables)
17:14lazybot⇒ #<sandbox28697$eval30931$fn__30932 sandbox28697$eval30931$fn__30932@3e51ed>
17:14danielwhats the simplest way of password protecting paths with noir? i have a path like /model/:id and this model may or may not have a password attribute set...if it has a password i want to check for the password or redirect
17:14danielthis is my attempt https://gist.github.com/1463038
17:14danielbut seems to pass the when-not, even if i dont pass in any password variable
17:14weavejesterlucian: Oh right. I think functional programming is more about avoiding state change, though.
17:15weavejesterlucian: At least, that's what wikipedia says ;)
17:15lucianweavejester: sure, i guess. but i find the first bit (first-class functions) much more necessary than the latter
17:15lucianwithout the first you're fucked. without the second it's just a little uncomfortable
17:16weavejesterlucian: Yeah, but that makes for a *really* broad definition of functional programming
17:16brehautHoFs with pervasive mutability results in higher order imperative code though, not functional code
17:16gtrak```it's all imperative on some level
17:16weavejesterlucian: Usually when people talk about functional programming, it's all about restricting state change.
17:17amalloythe definition of functional programming has evolved over time, as more languages adopted what was originally called "functional"
17:17weavejesterYeah...
17:18licensernooo
17:19amalloyin the very early days, lisp was functional because it had first-class functions
17:19gtrak```clojure's mutability default inverts the control, but it's still imperative
17:20weavejesterWell, there are places where Clojure is imperative...
17:20Turtl3boiGtrak i believe i talked to you along time ago in the java channel
17:20weavejesterBut most of the code I write in Clojure is very functional.
17:20gtrak```Turtl3boi, yea
17:20gtrak```I think I told you to look at clojure :-D
17:20Turtl3boii guess i don't know what "first-class"means yet though
17:21Turtl3boiall these computer science terms are coming back to bite me
17:21Turtl3boibecause, alas, i was not a comp sci major
17:21gtrak```they're not first-class in java, since you can't make one at run-time easily
17:21Turtl3boiyeah you did tell me to look at it but i delayed on that
17:21weavejesterTurtl3boi: It just means you can treat functions the same way you'd treat any other data
17:21Turtl3boiahhh.....i see
17:21weavejesterLike, they're not second-class citizens, so to speak.
17:21gtrak```yea, check it out
17:21RaynesTurtl3boi: For the most part, it just means that a function is just a value like anything else. For example, a function and an integer are on the same level in Clojure.
17:22weavejesterSo does this mean Clojure is communist? :)
17:22gtrak```((first [(fn [] (+ 1 x)) (fn [] (- x 1))] 5))
17:22gtrak```,((first [(fn [] (+ 1 x)) (fn [] (- x 1))] 5))
17:22Turtl3boiwow that's pretty nifty....so a function can be modified at run time
17:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0)>
17:22gtrak```oh oops
17:22gtrak```,((first [(fn [x] (+ 1 x)) (fn [x] (- x 1))] 5))
17:22clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$first>
17:22gtrak```fail!
17:23weavejesterTurtl3boi: Well... kinda. It's more that you can create functions at runtime.
17:23danielcan anyone help me password protect this? https://gist.github.com/1463136 im not supplying a password but it doesnt redirect
17:23weavejesterTurtl3boi: Once a function has been created, it's pretty much immutable, but every other data structure in Clojure is too.
17:23gtrak```((first [(fn [x] (+ 1 x)) (fn [x] (- x 1))]) 5)
17:23gtrak```,((first [(fn [x] (+ 1 x)) (fn [x] (- x 1))]) 5)
17:23clojurebot6
17:24gtrak```Turtl3boi, that picks the first function in that vector and invokes it with 5 as the arg
17:24weavejesterdaniel: Use if-not instead of when-not
17:24gtrak```,((second [(fn [x] (+ 1 x)) (fn [x] (- x 1))]) 5)
17:24clojurebot4
17:24bobhopeSorry if my question was already answered, but i'm on a laggy train connection and it may have blown by without my getting a chance to see it: is destructuring let the best way to return multiple values?
17:24TimMcbobhope: Pretty standard, yeah.
17:24gtrak```bobhope, destructuring is for input not output
17:25danielweavejester: still the same problem :(
17:25TimMcbobhope: return a vector or map, capture and dissect it in a let
17:25bobhopethanks guys :)
17:25weavejesterdaniel: You want something like... (if (password-protected?) (redirect) (show-page))
17:26weavejesterdaniel: right?
17:26danielyeah weavejester
17:26bobhopehas anyone used relations/facts with core.logic?
17:26weavejesterdaniel: Redirect doesn't have side-effects. You need to return it from your function for it to have an effect.
17:26danieli see
17:26bobhopeI'm trying to understand how to use them with a typechecking system
17:27bobhopeshould I input the declared types as facts, and see if the relationships can be inferred?
17:27bobhopeand how could I report errors in the type verification?
17:27danielweavejester: can i force that somehow in its current form?
17:28danielcan you issue return statements in clojure? or is it always the last to be eval'ed
17:29TimMcdaniel: "last to be eval'd" is correct, but misleading
17:30gtrak```daniel, all the code is compiled before it's run, to eval something means to read it in, compile it, and run it
17:30TimMcdaniel: A (do ...) form's value is the value of the last contained form, and let, fn, etc. have an implicit do form around their body.
17:30weavejesterdaniel: https://gist.github.com/1463164
17:30TimMcgtrak```: That's nitpicking.
17:30Turtl3boidoes "immutability" mean the same thing in clojure as it does in java
17:30gtrak```,(eval '(inc 1))
17:31clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
17:31TimMcTurtl3boi: And in every other language, yep.
17:31TimMcgtrak```: The SANBOX has DENIED you!
17:31bobhopeis there a way to evaluate in a new, empty namespace, or a namespace that you explicitly control?
17:31gtrak```hmm, why eval bad?
17:32danielweavejester: thanks, that looks good. lets see if it works
17:32TimMc,((resolve (symbol "eval")) `(inc 1))
17:32clojurebot2
17:32gtrak```ah, i know why, eval must skip the check Raynes put in on his own eval :-)
17:33TimMcI don't think clojurebot uses clojail.
17:33gtrak```TimMc, wtf
17:33TimMchaha
17:33weavejesterWell, that's Ring 1.0.0 finally released. Now I can start going through all patches for all the other projects :)
17:33Raynesgtrak```: If you allow eval, you've allowed everything.
17:33RaynesAnd clojurebot definitely does not use clojail.
17:33weavejesterOh, except I probably need to write a mailing list post.
17:34TimMcweavejester: Congratulations.
17:35Turtl3boi,((first [(fn [x] (+ 1 x)) (fn [x] (- x 1))]) 5)
17:35clojurebot6
17:35Turtl3boi^what's the point of that gtrak?
17:35gtrak```Turtl3boi, shows you that functions are data like anything else
17:35Turtl3boioh right you can have an array of functions
17:35gtrak```gets the first thing in the vector, invokes it
17:35Turtl3boioh sorry vector not array
17:36gtrak```you could probably do array, too
17:36RaynesGood thing you apologized. I was about to call the terminology police.
17:36Turtl3boii'm so used to C++ vector vs array being different
17:36Raynes&(into-array [(fn [])])
17:36lazybot⇒ #<sandbox6862$eval9045$fn__9046[] [Lsandbox6862$eval9045$fn__9046;@573068>
17:37gtrak```wait, is it actually a typed array?
17:37gtrak```err, no
17:37gtrak```(into-array [(fn [x] (+ 1 x)) (fn [x] (- x 1))])
17:37gtrak```,(into-array [(fn [x] (+ 1 x)) (fn [x] (- x 1))])
17:37clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: array element type mismatch>
17:37gtrak```,(to-array [(fn [x] (+ 1 x)) (fn [x] (- x 1))])
17:37clojurebot#<Object[] [Ljava.lang.Object;@177d7db>
17:38Turtl3boiwhat does the ampersand do?
17:38gtrak```that's just telling the bot to run it
17:38gtrak```there's two bots in here
17:38weavejesterTimMc: thanks :)
17:38Turtl3boithat's the same as using the comma
17:38gtrak```,is lazybot
17:38clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: is in this context, compiling:(NO_SOURCE_PATH:0)>
17:38gtrak```rather, clojurebot
17:38gtrak```& is lazybot
17:38lazybotjava.lang.RuntimeException: Unable to resolve symbol: is in this context
17:39Turtl3boiawesome
17:39daniel___weavejester: unfortunately it doesn't work, but i think it must be that fetch-one is returning something other than false or nil
17:40weavejesterdaniel: I guess that means its time to add in some debug code :)
17:40gtrak```ah, it is a typed array
17:41TimMcgtrak```: It is base don the first arg, I think.
17:41TimMc&(doc into-array)
17:41lazybot⇒ "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class obj... https://gist.github.com/1463238
17:41gtrak```Turtl3boi, you'll notice that each function is its own class
17:42TimMc&(class +)
17:42lazybot⇒ clojure.core$_PLUS_
17:42gtrak```&(class (fn [] nil))
17:42lazybot⇒ sandbox6862$eval9073$fn__9074
17:43Wild_Catinteresting. I'd have thought there'd be a single Function class (or at worst, one per arity).
17:43gtrak```nopers
17:43TimMcWild_Cat: Each fn (inline or not) becomes a .class file.
17:43gtrak```TimMc, Wild_Cat, only on AOT
17:43TimMcThis is because of the JVM.
17:44gtrak```you can load classes from a byte-array object dynamically
17:44qbgIs there something special you need to do to get Counterclockwise's REPL to work with Clojure 1.3?
17:44TimMcgtrak```: But that's an in-JVM class, even if it isn't a .class *file*.
17:44gtrak```yes
17:44TimMcCLOSE ENOUGH o\__/o
17:44gtrak```nevar!
17:45Turtl3boiso one set of parens around a funcion defines it
17:45Turtl3boitwo around it actually calls it
17:45TimMcTurtl3boi: The parens in (fn [x] x) are a call as well, to fn.
17:45cgraywhere is unquote defined?
17:45gtrak```(..) calls the first item in the list
17:45Wild_Catyeah, I should have guessed it was due to a JVM implementation issue.
17:45gtrak```with the rest as parameters
17:46gtrak```it's all just lists
17:46TimMcIt's calls all the way down.
17:46TimMc&`unquote
17:46lazybot⇒ clojure.core/unquote
17:46TimMccgray: ^
17:46cgraynope
17:46cgrayat least not in my clojure.core
17:46TimMcOh, right -- Compiler special.
17:46cgrayreally?
17:46cgraytoo bad
17:47cgray,(apply ~'/ '(1 3))
17:47clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
17:47Turtl3boiall just lists?
17:47Turtl3boiwhat's a list
17:47gtrak```,(class '(1 2 3 4))
17:47clojurebotclojure.lang.PersistentList
17:47gtrak```,'(1 2 3 4)
17:47clojurebot(1 2 3 4)
17:47gtrak```Turtl3boi, like a linked-list
17:48TimMcTurtl3boi: Any (...) form is a list. (+ 2 3) is a list of three elements to the compiler.
17:48Turtl3boioh right basically some array-like datastructure
17:48Turtl3boithanks Tim
17:48gtrak```but you have to quote if you want it to not eval the list
17:48gtrak```(+ 2 3)
17:48clojurebot*suffusion of yellow*
17:48gtrak```,(+ 2 3)
17:48clojurebot5
17:48gtrak```,'(+ 2 3)
17:48clojurebot(+ 2 3)
17:48TimMcTurtl3boi: The [x] in (fn [x] x) is a vector (to the compiler).
17:49Turtl3boithanks for the deconstruction TimMc, very helpful
17:49gtrak```,(first '(+ 1 2))
17:49clojurebot+
17:49gtrak```get it?
17:50Turtl3boi&(second '(+ 1 2))
17:50lazybot⇒ 1
17:50Turtl3boi&(fourth '(+ 1 2))
17:50lazybotjava.lang.RuntimeException: Unable to resolve symbol: fourth in this context
17:50Turtl3boiaiya!
17:50TimMcTurtl3boi: The thing is that vector literals [+ 2 3] get reconstructed as vectors, whereas list literals (+ 2 3) are reconstructed as function calls.
17:50TimMc&[+ 2 3]
17:50lazybot⇒ [#<core$_PLUS_ clojure.core$_PLUS_@14f6e3f> 2 3]
17:50daniel___if should treat false and nil the same right? cant work out why this function isn't working,
17:50TimMc&(+ 2 3)
17:51lazybot⇒ 5
17:51qbgdaniel__: As long as the false is the real false value
17:51daniel___clojure.core=> (has-access? "daniel" "daniel")
17:51daniel___{:_id #<ObjectId 4ee526709a1785d4dbe3f148>, :name "daniel", :password "daniel"}
17:51daniel___clojure.core=> (has-access? "daniel" "da")
17:51daniel___nil
17:51Turtl3boimakes sense since [ ] means an argument list so you wouldn't want it to be a function call
17:51daniel___should (if has-access?... work?
17:51cgraydoes unquote only work inside a backtick?
17:52qbgcgray: yes
17:52devntechnomancy: you gotta tell #heroku that they need some sort of representation in #heroku besides a bot that posts the same message over and over.
17:52TimMcTurtl3boi: That's not why [ ] is used, though.
17:52gtrak```Turtl3boi, that's just sugar, in lisp and scheme they use ( ) for arglists
17:52qbgdaniel__: You mean (if (has-access? ...) ...)
17:52cgrayqbg: how can you unquote something outside a backtick then?
17:52daniel___yeah cgray
17:52daniel___qbg: even
17:52qbgcgray: Just don't quote it?
17:52qbgcgray: you have an example?
17:52cgrayqbg: I don't have that option :)
17:53daniel___isnt ~ reverse of a '
17:53cgrayqbg: http://www.4clojure.com/problem/121
17:53Turtl3boiWhy is [ ] used TimMc
17:53cgrayqbg: I can't figure out how to apply '/
17:53gtrak```it improves readability
17:54TimMcTurtl3boi: [ ] as a syntax form is used to represent bindings of some sort -- such as in let or fn. It's visually distinct from ( ) and has the additional (sort of) connotation of a fixed-length collection.
17:54TimMcThat last bit is debatable.
17:54TimMcBasically, it's just convention to do it that way.
17:55qbgcgray: Take a look at resolve
17:55qbgcgray: Or ns-resolve
17:56TimMccgray: clojure.lang.LispReader defines unquote, I think...
17:56TimMccgray: #isUnquote ... return form instanceof ISeq && Util.equals(RT.first(form),UNQUOTE);
17:56TimMcAll hardcoded.
17:57cgrayqbg: thanks, ns-resolve worked
17:57daniel___hmm seems i needed to restart the noir server
17:58cgrayqbg: but ns-resolve trips the 4clojure alarm :(
17:58qbgcgray: The problem says you only need to support the 4 basic math operations
17:58Turtl3boiit's a binding? eh?
17:59qbgcgray: You could just use case to dispatch on the symbol
17:59Turtl3boiso "let [a 2]" means a = 2
17:59cgrayqbg: true, but I wanted to do it the "right" way :)
17:59gtrak```Turtl3boi, ya
17:59qbgcgray: I think the point of the problem is to implement a simple eval
17:59cgrayqbg: that's what I'm doing
17:59qbgcgray: So that would be the right way :p
17:59Turtl3boiwhat if i said "let [a 2 2]" does that means " a = 2 = 2"
18:00gtrak```it means you break clojure :-)
18:00weavejesterTurtl3boi: Nope
18:00TimMcTurtl3boi: Try it, you'll get a complaint about a wrong number of elements.
18:00qbgTurtl3boi: That is invalid
18:00Turtl3boithen how do i bind 3 items
18:00gtrak```,(let [a 1 b 2 c 3] [a b c])
18:00clojurebot[1 2 3]
18:00qbgTurtl3boi: You need an even number of elements
18:00TimMcTurtl3boi: and add commas to taste.
18:00weavejesterIt's a [key1 value1 key2 value2 ... keyN valueN] deal
18:00gtrak```normally, i'd line them up vertically, since i'd have more than one line
18:01Turtl3boi&(let '[a 1, b 2])
18:01lazybotjava.lang.IllegalArgumentException: let requires a vector for its binding
18:01Turtl3boi&(let [a 1, b 2])
18:01lazybot⇒ nil
18:01gtrak```,(class '[1 2])
18:01clojurebotclojure.lang.PersistentVector
18:01TimMcNow put something in the body of the let for it to evaluate.
18:01gtrak```huh?
18:01ScriptorTurtl3boi: you can use commas in there to make it more readable, (let [a 1, b 2, c 3]), commas don't have any syntactic significance otherwise
18:01alexbaranosky~turtleboy
18:01Turtl3boi&(let [a 1, b 2] [a b ])
18:01clojurebotExcuse me?
18:01lazybot⇒ [1 2]
18:01qbgcgray: For this language, those ops are the special forms, so dispatching on them is the way to go
18:02Turtl3boiyes alex?
18:02alexbaranoskyjust playing with clojurebot :)
18:02alexbaranoskysorry to interrupt
18:02Turtl3boilol you guys make programmign so fun
18:02TimMcyay!
18:02gtrak```,(let '[a 1])
18:02clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires a vector for its binding>
18:02gfredericks$inc us
18:02lazybot⇒ 2
18:03gtrak```why does that break? ^^
18:03TimMcgtrak```: (quote [a 1])
18:03qbglet is a macro
18:03TimMclet's see...
18:03gtrak```TimMc, well yea :-)
18:03gtrak```why does that break it?
18:03TimMc&`(let '[broken stuff])
18:03qbg(let (quote [a 1])) is invalid for it
18:03Turtl3boistill hazy on the "closure" concept
18:03lazybot⇒ (clojure.core/let (quote [clojure.core/broken clojure.core/stuff]))
18:03TimMcgtrak```: let looks at the first arg, finds a list instead of vector, SHIT GOES DOWN
18:04gtrak```ahhh
18:04gtrak```too much magic
18:04qbgTurtl3boi: A closure is a function that isn't at the top level in terms of lexical scope
18:04alexbaranoskyTimMc, finds a symbol no?
18:04weavejesterTurtl3boi: Do you know Python?
18:05qbg(fn [x] (fn [y] (+ x y)))
18:05alexbaranosky&(list? '[a 1])
18:05lazybot⇒ false
18:05qbgThe inner function is a closure
18:05alexbaranosky&(symbol? '[a 1])
18:05lazybot⇒ false
18:05qbgand has access to x
18:05brehautqbg: thats not really true
18:05gtrak```,`'(+ 1)
18:05Turtl3boiso it's a function within a function
18:05clojurebot(quote (clojure.core/+ 1))
18:05ScriptorTurtl3boi: before you take on closures, understand lexical score first
18:05Turtl3boik
18:05Scriptor*scope
18:05TimMc(╯°□°)╯︵ lɐʌǝ)
18:05weavejesterTurtl3boi: It's basically a function that can access variables from outside.
18:06gtrak```,`(list '(+ 1))
18:06clojurebot(clojure.core/list (quote (clojure.core/+ 1)))
18:06gtrak```,(list '(+ 1))
18:06clojurebot((+ 1))
18:06alexbaranosky&(vector? '[a 1])
18:06lazybot⇒ true
18:06TimMcalexbaranosky: It's a cons, really
18:06weavejesterSo... (let [x 1] (fn [y] (+ x y)))
18:06alexbaranoskyvector!
18:06gtrak```,(apply list '(+ 1))
18:06clojurebot(+ 1)
18:06weavejesterIs the same as: (fn [y] (+ 1 y))
18:06alexbaranoskyok enough lazybot for one day
18:06TimMcalexbaranosky: That's not what the compiler sees!
18:06TimMcalexbaranosky: You have to check (first `'[a 1]), with the syntax quote.
18:07weavejesterThe anonymous function can access "x" defined outside.
18:07TimMc&(seq? `'[a 1])
18:07lazybot⇒ true
18:07qbg&(vector? ''[a 1])
18:07lazybot⇒ false
18:07gtrak```Turtl3boi, it's like running an anonymous inner class that uses a value in local scope after the function has terminated
18:08Turtl3boii know a tiny bit of python weavejester kun
18:08weavejesterTurtl3boi: Okay, so in Python it would be like...
18:08TimMcIn Python this would require newlines, I think.
18:08weavejesterYeah, I was going to copy-paste :)
18:09gtrak```"A closure retains a reference to the environment at the time it was created (for example, to the current value of a local variable in the enclosing scope)"
18:09Scriptor...it's pretty intuitive once you understand how lexical scope works
18:09weavejesterdef add(x):
18:09weavejester def add_x(y):
18:09weavejester return x + y
18:09weavejester return add_x
18:10TimMc(Note: Multi-line copy-paste was performed by a professional. Do not attempt this at home.)
18:10weavejesterSo if I wrote add(1), this would return a function that added 1 to things
18:10weavejesterTimMc: Haha :)
18:10weavejesterThe key point is that the inner "add_x" function remembers the value of x
18:10weavejesterThat might seem obvious
18:11gfredericksbut you can't do it in java
18:11weavejesteryeah
18:11gtrak```sure you can, why not?
18:11TimMcIt's just ugly as hell.
18:11weavejesterWell, not 100% anyway
18:11alexbaranoskycan't is not the same as is ugly
18:11TimMcAdd a Box<T> class and you're good.
18:11weavejesterI think Java has some restrictions. Like in Java, "x" would have to be final.
18:11qbgOr use a one element array
18:11alexbaranoskyjust create an anonymous class factory :)
18:12qbgweavejester: Same as clojure
18:12TimMcalexbaranosky: Like... an AbstractSingletonProxyFactoryBean?
18:12qbgThe variables become a hidden field
18:12weavejesterqbg: True :) - but Clojure is kinda built around immutability.
18:12qbgSo that is why they need to be final
18:12TimMcA great example of closures is a let that binds an atom or ref and then returns some functions that have that ref in scope. The let is gone, but the closures retain a shared reference to that "box".
18:12gtrak```TimMc, is the joke that those modifiers have no associativity?
18:13TimMcgtrak```: The joke is that there is no joke. http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html
18:13alexbaranoskynice
18:13gtrak```Abstract(SingletonProxy)(FactoryBean)? or (AbstractSingleton)(ProxyFactory)Bean?
18:14qbgI think the first
18:14TimMcgtrak```: Like all dadaist art, it is up for the viewer to decide.
18:14luciangtrak```: i've actually seen those
18:14TimMcgtrak```: The real gold is the description: "Convenient proxy factory bean superclass for proxy factory beans that create only singletons."
18:15TimMc*convenient*
18:15gtrak```lol
18:15qbgWell, it does define some stuff for you
18:15gtrak```i think spring is way more complex than clojure
18:15qbgIt makes Java better though
18:16TimMcqbg: As far as I can tell, Spring just makes it harder to follow the code path.
18:16gtrak```qbg, the line blurs once they start adding spel to the xml :-) at some point it just becomes a language
18:16Turtl3boigtrak do you still do java or not?
18:16gtrak```yea
18:16qbgThat is why you go for the anotations
18:17qbgAvoid most of the xml
18:17gtrak```qbg, right, that's when they realize what they've done :-)
18:17TimMcgtrak```: "spel"... please don't tell me that's "Spring Expression Language"...
18:17gtrak```TimMc, yup
18:18TimMcThat's terrible.
18:18TimMcand I hope to never see it.
18:18qbgAvoid AOP I guess
18:18gtrak```it's just funny
18:19Turtl3boiso gtrak do you do heavily multi threaded programming now with clojure
18:19gtrak```<property name="randomNumber" value="#{ T(java.lang.Math).random() * 100.0 }"/>
18:19alexbaranoskyTimMc, what languages do you use predominantly at work?
18:19qbg<property name="randomNumber" value="4"/>
18:19gtrak```Turtl3boi, not so much, I'm mostly stuck on java right now
18:20TimMcalexbaranosky: Java. Trying to wedge in some Clojure.
18:20qbgSpring MVC isn't so bad though
18:20qbgExcept for the V and the C :)
18:21gtrak```Turtl3boi, if you recall, last time we talked I told you how scared i was of multi-threading :-), I still haven't started studying that stuff
18:21TimMcBeanFactoryTransactionAttributeSourceAdvisor -- this library is so far up its own ass...
18:21Turtl3boirofl.....
18:21alexbaranoskyTimMc, we do mostly Java then Scala then ruby for scripting
18:21qbgCheck out Spring 3
18:22gtrak```but I'm working on backend rdf graph management code right now
18:22lucianalexbaranosky: that seems to me at least one language too many :)
18:23alexbaranoskylucian, don't forget the javascript then
18:23gtrak```TimMc, that's what you get when you try to mix code and data badly, though I kinda like the approach for ui's like with mxml
18:23TimMcand HTML and CSS -- not to be trifled with
18:23Scriptoralexbaranosky: how do you split what's done in java and what's in scala?
18:23Turtl3boiim supposed to know what rdf graphs are lol
18:23TimMcTurtl3boi: Haha, I'm trying to learn that stuff at work right now!
18:23lucianTurtl3boi: is that a reference to you rnick?
18:23TimMcSPARQL and all that.
18:23alexbaranoskylucian, to be fair the Ruby stuff isn't production code, just scripts, perhaps for performance testing etc
18:23gtrak```I don't really know what they are yet and I've been writing the code for a few months :-)
18:24gtrak```TimMc, what are you doing with that stuff?
18:24TimMcalexbaranosky: Yeah, Python occupies that niche where I work.
18:24Turtl3boireference to my nick? nani?
18:24lucianalexbaranosky: i guess i just dislike scala a lot. i would use java + jruby or something
18:24alexbaranoskyScriptor, we do new modules in Scala, and write additions to old modules in Java ...... mainly that is the method we use to choose
18:24TimMcTurtl3boi: "TURTLE" is an RDF format.
18:25TimMc"terse triple"
18:25Turtl3boihahaha computer sci is so hard
18:25alexbaranoskylucian, what do you dislike about Scala, specifically?
18:26lucianalexbaranosky: syntax and type system
18:26alexbaranoskyI'm a clojure guy, but given the option between Java and Scala I can't think of any time I'd choose Java
18:26lucianalexbaranosky: but if jruby were added to that list, i'd choose that
18:26lucianeven though i don't really know ruby that well
18:26alexbaranoskyScala's type system is much better than JAva's
18:26TimMcHey, wow! I actually need to optimize something! :-D
18:26luciansure, but it's worse than almost everything else
18:26gtrak```alexbaranosky, I guess i could probably figure out scala in a few weeks, but I don't see the point
18:27alexbaranoskybut that makes it more complex of course
18:27lucianit's not as clean as haskells and it's not as simple as clojure/python's
18:27lucianand the syntax just makes my eyes bleed
18:27gtrak```qbg, yea
18:27alexbaranoskyyeah to each his own, but if you like Java over Scala, I'm sorry but we can't be friends :D
18:28lucianheh
18:28lucianno, i don't
18:28gtrak```i'd say i like java over scala for familiarity reasons
18:28alexbaranoskyto me it's a practical thing... I'm taking what options I have
18:28lucianbut if i were in your position, i'd keep java for old code and use clojure/jruby/jython for new code
18:29lucianalexbaranosky: sure, i know it's not always an option
18:29luciani'm not criticising you for writing it. i'm just saying if i had the choice, i'd do differently
18:29lucianand i was thinking if ruby is already in the door, jruby might be an easy sell
18:29gtrak```qbg, dependency injection is the new spaghetti code
18:29alexbaranoskyMayyyyybe, except I'd rather be selling Clojure
18:30alexbaranoskyand also Ruby is really only used by a small number of us for scripting stuff
18:30luciani see
18:30TimMcI think we tried using Python embedded inside a Java project and it failed miserably.
18:31qbggtrak```: Yeah, don't try to test the result
18:31gtrak```jython's dead
18:31luciana little, yes
18:31TimMcNot jython -- embedding a Python VM.
18:31TimMcsomething like that
18:31alexbaranoskyare ny of you looking for Clojure positions? (sorry can't help, just curious)
18:32lucianTimMc: oh. that does sound failure-y
18:32Turtl3boiis it possible to get a programming job without being super pro
18:32alexbaranoskyyes
18:32Turtl3boilike, being a EE major instead of CS
18:32TimMcTurtl3boi: Absolutely.
18:32lucianalexbaranosky: i'm looking for a new job and i like clojure
18:33alexbaranoskyTurtl3boi, most important thing about being a programmer is knowing the ins and outs of programming
18:33Turtl3boii only took the data structures class in C/C++, but i didn't take compilers and all those other hard ass CS courses
18:33TimMcTurtl3boi: All those CS courses may or may not help you, depending on the profs.
18:33lucianTurtl3boi: don't worry much. the vast majority of graduates can't write fizzbuzz
18:33alexbaranoskyTurtl3boi, learn that ish on your own
18:33TimMcbut the stuff they *should* be teaching you is *really* important.
18:34Scriptorthere's also computer engineering, get a mix of both cs and ee
18:34alexbaranoskyTurtl3boi, I can give you a thirty book reading list - it'll make you better read than 99% of candidates
18:35alexbaranoskyTurtl3boi, by that mean you would know important stuff
18:35Scriptoralexbaranosky: make that list ofr all of us!
18:35qbgTurtl3boi: It isn't hard to get to thedailywtf level, and somehow those people have jobs...
18:35Turtl3boithe only thing i've done is embedded programming on a 8051
18:36Turtl3boiand i wasn't the lead programmer. i was the bench testing guy who would test out how well the code works in the chip, and give feedback
18:36Turtl3boiso in other words i didn't have a programming job
18:36alexbaranoskyqbg, thing is if you want to get into the business, but don't have credentials (like the wtf programmers do have) then it's best to know what you are doing really well
18:37Turtl3boii really want to apply to google
18:37Turtl3boii'm scared i will get smoked in the interview though
18:38alexbaranoskyTurtl3boi, my approach is to come well prepared - if you do that, then you have nothing to be scared of ---- if you aren't well-prepared, you're just relying on luck to sneak into a job
18:39gtrak```Turtl3boi, Google, MS, those guys are willing to waste a lot of money on interviewing too many people, and aren't afraid of turning away good guys
18:39alexbaranoskyScriptor, seriously? If you want just contact me on github or something and I'll send a list
18:40Scriptoralexbaranosky: same username on github?
18:40Turtl3boiyeah, right, i need to become a solid programmer and now's my chance
18:40Turtl3boii think i get OOP now
18:40Turtl3boibut that's not going to be enough
18:40Turtl3boii need more experience in new ideas
18:41gtrak```these things take time
18:41TimMcTurtl3boi: What you need is exposure to idioms and thought patterns. Knowing syntax isn't enough.
18:42TimMcSpeaking of which, has anyone here read this? http://www.aosabook.org/en/index.html
18:42TimMc"The Architecture of Open Source Applications"
18:43alexbaranoskygetting a job takes multiple factors: programming skill, good community presence, good resume, good interview skills, networking
18:44alexbaranoskyTurtl3boi, concepts trump syntax
18:46Turtl3boii have zero community presence lol
18:46Turtl3boijesus
18:46Turtl3boithat's probably what i need to work on
18:47gtrak```fundamentals
18:47technomancydevn: I know; it's so embarrassing =\
18:49TimMc(for anyone else who was confused, that was re: #heroku)
18:49alexbaranoskyfigured
18:49Turtl3boiit's funny how google has jobs right up my alley (hardware design), didn't expect that (not that i want those jobs)
18:50alexbaranoskyTimMc, that open source book looks interesting
18:53TimMcI've been poking through it, it's kinda interesting.
18:53TimMcAll high-level stuff.
18:54Turtl3boido you think i could have a "community presence" simply by making some stupid image processing java or clojure app and putting in a website to sell it
18:55gtrak```only if people give a shit :-)
18:55alexbaranoskyI meant more like activity in the open source community or whatever
18:55alexbaranoskythe jobs I've worked at would consider that a good thing for a potential junior develoepr hire
18:56alexbaranoskyof course it also depends on what kinds of jobs you are targeting
18:56alexbaranoskyI'd hone my resume and persona towards the specific place of business I most want to work at
18:56alexbaranoskydarnit: see now I'm giving out my secrets ;)
18:56Turtl3boihahaha
18:57alexbaranoskyit is good to know what kind of work people need done, and make sure you're good at that.
18:57Turtl3boilol google is such a pain because they have so many different personas working there
18:57alexbaranoskyknow what kind of person they look for too, and then do your best to achieve that
18:57Turtl3boii just want to work for a company that is not gonna go belly up in 6 years from now
18:58alexbaranoskysix years? That's like an eternity
18:58Turtl3boiyeah well i figure google is one of the few companies
18:58gtrak```if you can get a job at google, you can get a job at lots of places
18:59alexbaranoskywhat is your thought-process that led you to wanting to work somewhere that won't be belly up in 6 years? Curious to hear
18:59alexbaranoskygtrak```, definately
19:00qbgTurtl3boi: You could get a job a place that doesn't produce software for external use
19:01TimMcqbg: What's your thought process on that?
19:02Turtl3boiwell alex, my first company i had a bad experience. i worked really hard for 5 years and at the end of 5 years i had seen 9 layoffs and 2 years straight of no raises. i barely made more than i had started off at
19:02qbgSoftware business can be volatile. Other industries need software and can be less volatile
19:03Turtl3boithis was a hardware company
19:03qbgDownsides to that though
19:03alexbaranoskyTurtl3boi, it might depend on what region of the US you're in too... I'm in Boston, where there are lots of options for SW
19:04Turtl3boii don't mind living in boston but i would prefer california only because my family is there
19:04Turtl3boii have family both in so and norcal
19:04alexbaranoskySan Francisco has lots of SW jobs too right?
19:04Turtl3boiyes but then it also is very competitive
19:05alexbaranoskyTurtl3boi, there's really no way to escape the need to be awesome
19:05alexbaranoskyat least a *little* awesome
19:05alexbaranoskylife is competitive, you know?
19:06Turtl3boithe only thing i'm awesome in is probably like writing documentation
19:06Turtl3boilol
19:07gtrak```if your documentation is coherent, then your code might be too
19:07Turtl3boii did analog and RF test, i was pretty slick at that
19:07Turtl3boibut then, i'm trying to convert to more programming-ish....yeah good point gtrak
19:07Turtl3boii can write great code gtrak, but then again i also take forever to do it
19:08gtrak```Turtl3boi, well, if you're writing the same code over and over you're doing something wrong
19:09gtrak```writing it the second time takes me about 1/10th the time as the first
19:09Turtl3boialright gtrak, how do i make an app in clojure
19:09gtrak```start with leiningen
19:09Turtl3boilike an app with a frontend GUI
19:10Turtl3boiyou know how java uses Swing right? does CLojure use that too
19:10gtrak```ah, there's a couple projects out there, you can write straight-up swing if you like or use another layer
19:10Turtl3boik
19:10alexbaranoskyleiningen with seesaw for gui programming or maybe noir for a webapp
19:10gtrak```clojure has java interop
19:10ScriptorTurtl3boi: clojure *can* make use of swing, but otherwise it has its own web frameworks
19:10gtrak```i've been meaning to take a look at seesaw myself
19:10alexbaranoskyI personally wouldn't do swing straight
19:13Turtl3boiso clojure is more for web apps
19:13gtrak```i wouldn't say that..
19:14gtrak```but java on the desktop is classically not so good
19:14Turtl3boiit is for making a stupid little image processing demo GUI
19:15ssiderishello
19:15gtrak```well that will be fine
19:15Turtl3boii just want to try out some of the multi threaded feature of clojure
19:15Turtl3boiand image processing is perfect for that
19:15ssideriswhat's the best way to check the clojure version at runtime?
19:15Turtl3boiwell a lot of image processing algorithms do better when you multi thread them i would say
19:15gtrak```,*clojure-version*
19:15clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
19:16ssiderisgtrak```: thanks
19:17gtrak```Turtl3boi, so, what clojure's really good at is dealing with lazy-sequences
19:18gtrak```i don't think it's the best for implementing a low-level image-proc algorithm, but it'd be great for gluing together filters, for instance
19:18Turtl3boiyou mean they consume and return sequences incrementally
19:19gtrak```yea
19:19gtrak```delayed computation
19:19gtrak```for example:
19:19gtrak```,(map (fn [x] (+ 1 x)) [ 1 2 3 4 5])
19:19clojurebot(2 3 4 5 6)
19:19gtrak```,(class (map (fn [x] (+ 1 x)) [ 1 2 3 4 5]))
19:19clojurebotclojure.lang.LazySeq
19:20gtrak```give me a sec
19:21gtrak```lol, how do I turn it into a vec :-)
19:21alexbaranosky(doc vector)
19:21clojurebot"([] [a] [a b] [a b c] [a b c d] ...); Creates a new vector containing the args."
19:22gtrak```,(doall (map (fn [x] (+ 1 x)) [ 1 2 3 4 5]))
19:22clojurebot(2 3 4 5 6)
19:22gtrak```,(class (doall (map (fn [x] (+ 1 x)) [ 1 2 3 4 5])))
19:22clojurebotclojure.lang.LazySeq
19:22gtrak```Turtl3boi, well, the point is, map doesn't actually compute the value until you ask for the first element of the lazy seq :-)
19:22gtrak```i'm just not demonstrating it :-)
19:23alexbaranosky,(class (vec (doall (map inc [ 1 2 3 4 5])))
19:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:23alexbaranosky,(class (vec (doall (map inc [1 2 3 4 5]) )))
19:23clojurebotclojure.lang.PersistentVector
19:24gtrak```,(vec (map (fn [x] (+ 1 x)) [ 1 2 3 4 5])))
19:24clojurebot[2 3 4 5 6]
19:24Turtl3boiwell never hurts to try
19:24Turtl3boimaybe i should just do a web app in clojure
19:24gtrak```point is, you can keep gluing stuff on for free
19:25gfredericks(second (concat (range) (range) (range) (range)))
19:25gfredericks,(second (concat (range) (range) (range) (range)))
19:26clojurebot1
19:26gfredericks^ concatenating four infinite sequences
19:26gtrak```haha
19:26gtrak```,(range)
19:26clojurebot(0 1 2 3 4 ...)
19:26gtrak```&(range)
19:26lazybotjava.lang.OutOfMemoryError: Java heap space
19:26gtrak```hehe :-)
19:26Turtl3boithis actually seems great for image processing
19:27Turtl3boibut it's not going to be as fast as C or Java
19:27qbgYou can use clojure as the glue between java components
19:27gtrak```Turtl3boi, well, depends on the algorithm, right? if you're doing a lot of mutable state, clojure's not right for that
19:28Turtl3boimutable state.....image processing probably does better in a purely functional world
19:28Turtl3boinix that last sentence
19:28Turtl3boiuhh what am i trying to say
19:29Turtl3boioh actually i can see what you're saying
19:29Turtl3boiwhat's mutable state lol
19:30gtrak```haha
19:30mbaci made this with clojure https://www.youtube.com/watch?v=nZGCnDSC4Rc
19:30mbacsource available if anyone's interested
19:30mbac;)
19:30gtrak```overtone?
19:30mbacno just scraping memegenerator really
19:31mbacpeople here helped with it today so i thought i'd offer it up if anyone cared
19:31blakesmithSpeaking of lazy sequences... Will this actually walk the sequence once or twice?
19:31blakesmith&(map inc (filter #(= 0 (mod % 2)) (range 10)))
19:31lazybot⇒ (1 3 5 7 9)
19:31gtrak```once
19:31weavejesterOnce
19:31blakesmithAwesome.
19:31blakesmithI dig it.
19:32blakesmithI got worried doing too much chaining. ;-)
19:32gtrak```it can take it
19:32gtrak```if you can dish it out
19:32Turtl3boiwhat is mbac talking about
19:32weavejesterfilter and map are both lazy, so they don't do anything until you start iterating
19:32qbgAnd the results are cached
19:33ben_mWow, that's pretty cool.
19:34blakesmithAre lazy sequences a common feature of most Lisps?
19:34qbgNo
19:34blakesmithSeems like you'd pay some big performance penalties otherwise...
19:34ben_mMost lisps are more multi paradigm
19:34qbgHow so?
19:35qbgMemory consumption would be the most obvious one
19:35gtrak```blakesmith, think of lazy seqs as just a way to describe and compose computations
19:35gtrak```stream processing
19:36blakesmithAh, I see.
19:36Turtl3boiis leiningen for linux only?
19:36gtrak```nope
19:36ben_mNo :)
19:37blakesmithqbg: I was thinking higher level functions like map and filter that would walk a sequence multiple times when chained together.
19:37gtrak```they won't
19:37qbgNope
19:37qbgIn CL you get a new list
19:38qbgSo that doesn't happen even there
20:01Turtl3boigtrak if you take me under your wing you won't be disappointed
20:02Turtl3boii promise it will be the best investment you ever made
20:09gtrak```Turtl3boi, ha, can I buy stake in your future earnings?
20:09Turtl3boiif you help me land a job of course i'll kick you back some
20:09Turtl3boiwe can set it up as one time payment or % of paycheck
20:11gtrak```nah, that seems too weird :-)
20:11alexbaranoskyTurtl3boi, not too weird for me though :)
20:12gtrak```alexbaranosky can barely handle his emacs though
20:12Turtl3boilol
20:12alexbaranoskyemacs does not a programmer make
20:12alexbaranoskystill not sold on it
20:12alexbaranosky:P
20:12gtrak```indeed :-)
20:12gtrak```alex, remember me from conj? i think we hung out a couple of times
20:13alexbaranoskyyes! definitely
20:13gtrak```Turtl3boi, there aren't any shortcuts really, but i'm always willing to learn new stuff to help people out
20:14Turtl3boiyou guys hung out?
20:14alexbaranoskyTurtl3boi, I'm a big believer in reading great books and lots of practice
20:14Turtl3boii read a lot actually
20:14Turtl3boibut i don't have any study partners
20:14gtrak```Turtl3boi, yea, at the last clojure conference
20:14Turtl3boii wish i could do a project with someone decent
20:15gtrak```(un)fortunately, my job takes a lot out of me :-)
20:15gtrak```but the next thing I really want to look at is logic programming
20:16alexbaranoskyTurtl3boi, you could work on some open source project
20:16alexbaranoskyanother great way to learn is to work with really smart people... best if in real life, but open source could be good too
20:18Turtl3boican i work w/ you alex
20:18Turtl3boigtrak what logical programming? like hardware description languages
20:19alexbaranoskyTurtl3boi, I'd be inclined to say sure
20:19Turtl3boihowever......
20:19Turtl3boibut......
20:19Turtl3boiunfortunately.....
20:19gtrak```Turtl3boi, no, like prolog
20:19Turtl3boithis is what i hear from women when i ask them out
20:19Turtl3boiahh ok
20:19ben_mWhere do you meet women that know Prolog?
20:19ben_m:P
20:20alexbaranoskyha
20:20gtrak```where do you meet women that can tolerate a conversation about prolog? :-)
20:20alexbaranoskyMIT!!!
20:20ben_m?- like(prolog, women)
20:20ben_mno.
20:20gtrak```damn, that was fast
20:20alexbaranoskyTurtl3boi, in all seriousness, I love helping people, but one thing I hate is people who don't try
20:21brehautben_m: to start with you ask it like knows_prolog(X), sex(X, female), current_location(X, Y).
20:21alexbaranoskyso ben_m are you saying something about women and logic???
20:21lazybotalexbaranosky: How could that be wrong?
20:21ben_malexbaranosky, I would never!
20:22Turtl3boialexbaranosky i try super hard at everything i do
20:22ben_mbrehaut: awesome(X) :- likes_prolog(X), sex(X, female). ? :)
20:23ben_mactually
20:23ben_mEveryone who likes Prolog is pretty awesome.
20:23ben_mand/or crazy
20:24brehautits been a while since i wrote prolog, but i didnt think you had to created a predicate for a query?
20:24Turtl3boidoes prolog help for control systems
20:24Turtl3boiie, programming feedback for a microcontroller system
20:24ben_mYou don't have to and that's not necessarily a query
20:30alexbaranoskyTurtl3boi, you should probably send me an email telling me more about yourself, what you know, and what you want to know/achieve andw e could go from there alexander dot baranosky at gmail dot com
20:30Turtl3boiwow thanks now i have you and gtrak both
20:30Turtl3boion my mailing list
20:30gtrak```Turtl3boi, always open to questions or talks, I'm just overcommitted
20:31Turtl3boii understand
20:31Turtl3boiyou probably also have a gf ,etc
20:31Turtl3boihaha
20:31gtrak```nobody's perfect :-)
20:33gtrak```Turtl3boi, but the clojure community's full of smart guys, i recommend getting involved, even if you don't end up writing clojure, you'll learn a lot
20:34Turtl3boido you guys belong to a forum of clojure?
20:34Turtl3boiif so let me sign up
20:34gtrak```there's a mailing list, yea
20:35gtrak```http://groups.google.com/group/clojure
20:36gtrak```and the dev list is fun to watch but it's not for regular clojure users
20:39Turtl3boidamnit i might have to put my real identity out in cyberspace to grow my programming presence
20:39gtrak```just get over it
20:39gtrak```especially if you're a programmer
20:40alexbaranoskyemployers will google you
20:40gtrak```you can use it to your advantage
20:41duck1123if you're gonna show up in a google search, make sure it's for good things
20:41Turtl3boik
20:41alexbaranoskygtrak```, exactly
20:41Turtl3boimaybe i should start a google+ and facebook too
20:41duck1123and drive that guy in california with the same name as you that was in a golf tournament and a high school play
20:42duck1123off the net
20:44alexbaranoskyyeah, it depends how unique your name is I guess
20:44alexbaranoskythere's only one other version of *me* I've ever run into
20:50Turtl3boinice
20:50Turtl3boiyou must be russian
20:50Turtl3boierr polish
20:55Turtl3boii wonder if it's too late for me to convert to programming
20:55Turtl3boii just turned 30 :/
20:55gtrak```nah
20:56gtrak```it just might take longer than you think
20:57Turtl3boiyea worth a try tho
20:57Turtl3boii still feel like i'm 22 even tho i'm 30
20:59pdkCLOJURE REVERSES THE CLOCK
21:00Turtl3boihahaha
21:00gtrak```clojure separates time and values
21:00pdkreally if you can get used to putting yourself in the mindset appropriate for whatever programming paradigm you pick you'll be able to do stuff
21:00gtrak```if you have a good grasp of fundamentals, you will see everything is all the same under the covers
21:01Turtl3boii have a weak understanding of low level stuff though
21:01Turtl3boilike computer architecture
21:01Turtl3boix86 assembly
21:01Turtl3boicrap like that
21:01gtrak```I had a good comp arch class
21:02gtrak```well, my point is, programming really hasn't changed that much, what's changed are the relative tradeoffs
21:02Turtl3boik
21:02Turtl3boii'll trust you on that one
21:02Turtl3boii am gonna go buy that clojure book at Fry's electronics now
21:02Turtl3boibefore they close
21:03Turtl3boilater
21:03gtrak```cya
21:12pdkyo which book did your arch class use
21:36alexbaranoskywhoa, is github down?
21:37nickmbai`hmm down for me
21:42erewhonscheduled maintenance
22:00technomancyoooh, ring 1.0.0. very nice.
22:00brehautoh, its out?
22:01brehautfantastic
22:03pdklook at that version number
22:03pdktwo perfect circles
22:03pdkso fitting for ring
22:10devnparsing stuff is fun
22:11devnanyone here use parsatron? I'm surprised there's no sep-by or next-not or something, but maybe I'm missing something obvious
22:16mbachow do i do the equivalent of popen("zcat foo.gz") ?
22:20bobhopeIs there a recommended way to do dataflow programming with clojure?
22:26technomancybobhope: no, the dataflow contrib library is unmaintained
22:40gtrak```Turtl3boi, did you get it?
22:46devntechnomancy: that project was looking for a maintainer though right?
22:47devnd'oh he left
22:47technomancydevn: welllllll... maybe. when I talked to the author he basically implied that it should be rewritten with protocols
22:47devni was going to encourage bobhope to look into it and consider taking it up as his own project
22:47devnalso, even if it's in old contrib that doesn't mean it's gone forever
22:48devnhe could still use old contrib.
22:52alexbaranoskyanyone planning to go to Clojure/West? I want to submit some kind of TDD-ish presentation; mostly I'm scared out of my mind to do a talk though :)
22:54Scriptoralexbaranosky: I'm not, but presenting is fun anyways, go for it!
22:54alexbaranoskyScriptor, I am going to go for it!
22:57ScriptorI'd like to see something about combining TDD with bottom-up programming
22:58ScriptorI guess you write the tests for the "bottom" parts first
22:59Scriptorooh, free hotel and airfare
23:04RaynesAnybody here have an Ubuntu 11.10 machine with leiningen handy that can run some tests for me?
23:04gtrak```i've got a vm
23:04gtrak```with kubuntu
23:04RaynesThat should be fine. git clone git://github.com/Raynes/fs.git
23:06Raynesalexbaranosky: Is reporting a couple of tests failing on his 11.10 machine, but I can't reproduce on OS X Lion or Ubuntu 10.04.
23:06gtrak```gimme a sec
23:07gtrak```someone else is welcome to beat me to it
23:07RaynesI'm in no hurry. Don't worry about it if it's a hassle.
23:08technomancyRaynes: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:1)
23:08technomancyis what I get
23:09Raynestechnomancy: I don't even use clojure.set anywhere in the library.
23:09RaynesAnd that is certainly not what he was getting. :|
23:10RaynesI'm thinking that Ubuntu 11.10 is just broken in general. Like IE 6, only newer.
23:10Raynes;)
23:11alexbaranoskyRaynes, need me for anything?
23:11Raynesalexbaranosky: Yeah. I need you to fix your computer.
23:11RaynesIn all seriousness, no. Just trying to find someone else with the problem right now.
23:11alexbaranoskybah dump dump
23:11RaynesI'll email you if I need anything else.
23:12alexbaranoskycool
23:15gtrak```Raynes, works for me
23:15Raynesgtrak```: And that's 11.04?
23:15gtrak```wait, actually it says 0 tests
23:15RaynesIts supposed to.
23:15RaynesIt's*
23:15gtrak```that's on 11.10
23:16Raynes'lein test' doesn't summarize midje tests, but it does run them, so if there were no failure messages, it worked.
23:16Raynesgtrak```: Thanks alot.
23:16gtrak```Raynes, I also use sun jdk
23:16RaynesSo do I. That could very well be a thing.
23:16amalloythat's what cake test ouutputs for me, on 10.04, fwiw
23:16Raynesamalloy: It's probably running the tests.
23:17amalloyopenjdk
23:17RaynesAnybody else on OpenJDK that can test it?
23:17RaynesWait, we use OpenJDK on our VPS, don't we amalloy?
23:17amalloyyes
23:17RaynesSo surely that isn't an issue.
23:18mbacwhat's the best way to collect the contents of a file into a buffer if you can only load it into 1k byte buffer at a time?
23:18mbacthat is, my .read function returns 1k but the file is 50-100MB
23:20alexbaranoskyRaynes, I use sun jdk
23:20RaynesI think your computer is broken, bro.
23:20RaynesI'll get some more people to test it later. I know a guy who can run it past the last 5-6 Ubuntu versions.
23:21Raynesgtrak```: Thanks a lot for the help.
23:21gtrak```yea, np
23:21devnis github back up?
23:21alexbaranoskydevn yeah
23:22devnalexbaranosky: btw, what ever came of the heredoc macro discussion?
23:23devnalexbaranosky: I found myself in a situation tonight where we wanted to play around with a parser and we just wanted a quick and dirty way to write some short example haml blocks to test out our parser.
23:23alexbaranoskydevn, it's on the back burner - when I get the time and inclination I may do a little statistical analysis of percentage of escape characters used like we talked about
23:24devnI remember being sort of iffy about the whole idea, but I found it a bit annoying to have to (apply str (rest "
23:25devn%here.is my-heredoc
23:25devn %which is indent-sensitive
23:25devnin order to have a clear view of the number of spaces, structure of the text, etc.
23:26alexbaranoskydevn exactly: when you want it, you REALLY wish you had it
23:26alexbaranoskyheredocs alla carte ;)
23:28alexbaranoskydevn I don't consider the topic dead, I just have been waiting for either more peoplew ho care, or more data
23:39duck1123The thing that turns me off of heredocs in clojure is all the times I've viewed a sql file that was all messed up because emacs couldn't highlight it correctly. I like that that vary rarely happens in clojure
23:39alexbaranoskywhy should Clojure be held back by the tools?
23:40duck1123simple to parse is different than held back by tools
23:40alexbaranoskyI mean... if there's a use case for them, then the tools should have to catch up with the language -- it should be driven by need for the feature, is all I'm saying
23:41alexbaranoskyduck1123, so would you be against triple-quotes? Or some kind of quote that was a bit easier to parse than heredocs?
23:41duck1123alhough, I've yet to find the need for them. If it's complex enough, I'll just store it somewhere else
23:42duck1123triple quotes seem preferable to heredocs, but still feel icky
23:45amalloy"my language hates it when i use strings, so here come six tick-marks to say i really mean it..."
23:45alexbaranoskyamalloy, where do you stand on the super-string issue?
23:46amalloyeh
23:46alexbaranoskyI mostly hate escaping, so anything that keeps me from needing to escape I prefer... and to me putting test data in files isn't a solution I would use ever
23:47alexbaranoskybecause I feel tests are more readable with the data in front of me
23:47alexbaranosky(there are times I'd put it in files, I just wouldn't want to be forced to )
23:55technomancyRaynes: oh, "lein test" completed just fine for me
23:55technomancyit was lein midje that failed
23:55fhdIs there an article somewhere about the performance tweaks of Clojure? (I mean stuff like that conj doesn't copy the complete memory of a vector but only the added parts)
23:55fhdI once saw a talk about some of these things but I'd like to know some more
23:57amalloy$google higher order persistent hash tree
23:57lazybot[Understanding Clojure's PersistentHashMap ... - Higher-Order] http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/
23:58fhdamalloy: Brilliant, thanks :)
23:58amalloyfhd: fwiw, if you ever try implementing a persistent data structure in a functional language, a lot of the structural-sharing will just fall into place accidentally