2012-08-24
| 00:03 | jeremyheiler | Does (or has) anybody get "could not locate lein jacker [...] on classpath" when using lein-ring? |
| 00:07 | cldwalker | hi, is there a recommended library for paginating html pages? |
| 00:11 | technomancy | take/drop would be great except for the fact that drop forces a bunch of work that gets thrown away |
| 00:15 | technomancy | if anyone's running lein from git, please update to the latest master; it will become preview9 if no issues are reported |
| 00:24 | l1x | hey guys |
| 00:25 | l1x | is there a good way to find all the elements in a lazy seq which are lets say smaller than 10? |
| 00:25 | amalloy | &(doc filter) |
| 00:25 | lazybot | ⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects." |
| 00:25 | l1x | thx |
| 00:32 | NotActuallyOnFir | Hello! |
| 00:32 | NotActuallyOnFir | I am apparently violating the irc naming convention length. |
| 00:32 | NotActuallyOnFir | I am apparently "NotActuallyOnFir" which is entertaining. |
| 00:34 | NotActuallyOnFir | I have a question, if anyone is alive. I'm trying to use the native-deps plugin, but leiningen doesn't feel like recognizing "native-deps" as a task. |
| 00:34 | l1x | amalloy: filter itself is not good for a lazy sequence because it is going to go through all the elements and those are infinite lets say in the fibonacci sequence, i found take-while which is good for this scenario, but thanks anyways |
| 00:34 | amalloy | you asked for all of them, mate |
| 00:34 | Sgeo | Hey, is Light Table just a realization of old Smalltalk concepts? |
| 00:35 | Sgeo | As in, it's not sensible to look at code as plain text? |
| 00:35 | casion | Sgeo: yes, no |
| 00:35 | l1x | amalloy: yeah my question was not clear :) |
| 00:36 | NotActuallyOnFir | Anyone? Native-deps? I've got my regular old deps, but my native-deps are being elusive. |
| 00:38 | shaungilchrist | you probably need older version of lein? |
| 00:38 | Sgeo | Wait. Light Table is going to be a commercial product? |
| 00:38 | shaungilchrist | I jut ran into this w/ latest not supporting bootstrap as task so installed version that was up on port |
| 00:39 | NotActuallyOnFir | "up on port"? |
| 00:39 | casion | Sgeo: that seems to be the plan |
| 00:39 | Sgeo | :( |
| 00:40 | casion | you could use emacs or eclipse |
| 00:41 | shaungilchrist | sorry NotActuallyOnFir I am using osx - port is a package manager. |
| 00:41 | amalloy | personally i'm happy with emacs, but if light table turns out to be a better product, only a fool would begrudge spending $50 on a tool that improves something you spend like a hundred hours a month with |
| 00:41 | amalloy | (here wildly assuming $50 is the price point; substitute whatever number is right) |
| 00:42 | casion | I agree with amalloy |
| 00:42 | frio | pretty much |
| 00:42 | Sgeo | The kickstarter says it will be open source and licenses are for packaged distributions |
| 00:42 | shaungilchrist | I imagine there will be a free version for individuals and then a "team" version - but that is pure speculation |
| 00:42 | casion | I've been using emacs for non-lisp things for a good while, and I love it… but light table shows fantastic promise |
| 00:42 | amalloy | last i heard the platform was free and plugins or packages or something were going to be for sale |
| 00:42 | casion | I would gladly switch over when the time comes |
| 00:43 | casion | I've paid thousands for IDEs in the past |
| 00:43 | casion | $50 would be pretty tame IME |
| 00:44 | l1x | looks nice |
| 00:44 | wmealing_ | how does that work ? |
| 00:44 | wmealing_ | "licenses are for packaged distributions" |
| 00:44 | wmealing_ | so, if you download it, its open source |
| 00:44 | wmealing_ | and if your a distro, you have a different license ? |
| 00:45 | shaungilchrist | but if you work for mega-corp that actually prefers to pay people for license keys so they can put them on their internal wiki.. |
| 00:47 | Sgeo | Is it possible to rename a namespace? |
| 00:47 | NotActuallyOnFir | OK, so if native-deps is borked in the new version of leiningen, is there any functionality in leiningen that handles native libraries, or am I back to manually extracting files and setting my library.path manually? |
| 00:48 | Sgeo | And unrelatedly to that question, but relatedly to the Light Table stuff, how does Light Table deal with side-effecting functions? |
| 00:54 | muhoo | was just looking at a jsfiddle, and realized lighttable is kind of likd clojurefiddle |
| 00:54 | muhoo | and himera is like cljsfiddle |
| 01:17 | Raynes | muhoo: What drugs do you use? |
| 01:17 | muhoo | heh |
| 01:19 | Raynes | So I don't get any? |
| 01:20 | Raynes | You're either a great friend or no friend at all. |
| 01:21 | muhoo | dude, i actually had to fire up intellij and mess with a bunch of java |
| 01:21 | muhoo | so maybe that's the drug. you don't want any, trust me. |
| 01:22 | muhoo | android + clojure = nil |
| 01:22 | Raynes | I use TextEdit for Java. |
| 01:22 | muhoo | :-0 |
| 01:23 | Raynes | And I compile to bytecodes by hand. |
| 01:23 | muhoo | i was using emacs for java, and the fail was too strong. |
| 01:23 | Raynes | If you're going to use a primitive language, might as well do it primitively. |
| 01:23 | muhoo | assembler in edlin!! |
| 01:25 | muhoo | sadly the nifty html5 stuff i was going to do in cljs, doesn't work on the ancient android 1.6 donut browser i'm delivering on. |
| 01:34 | Sgeo | If I read refs outside of a transaction, might I see an inconsistent view of the world? |
| 01:35 | francis | Hello all, just want to make sure that I'm approaching this problem correctly. I've got to http post an xml document to a remote server. Currently, I'm just using clj-http.client and it throws back a 200 with an xml response as the body. I want to be sending it a body that is a (valid) xml string right? |
| 01:39 | francis | http://paste.lisp.org/display/131181 |
| 01:42 | jeremyheiler | fancis, if you want to send xml with the POST, then you'll probably have to use :form-params or :multipart |
| 01:43 | jeremyheiler | mabye? |
| 01:45 | jeremyheiler | nvm. perhaps you could set the content type for xml? |
| 01:46 | jeremyheiler | man, it's late. i should probably stop trying to think... |
| 01:46 | francis | and then just pass it a string? (EG: (def xml-doc "<xml>valid</xml>")) |
| 01:46 | francis | I'm actually getting a response back that it's well formed, but dosn't have the correct auth info |
| 01:47 | jeremyheiler | how is it expecting you to authenticate? |
| 01:47 | francis | part of the xml doc I'm sending it |
| 01:48 | francis | <username>blah</username><password>sfuff</password> |
| 01:48 | francis | I append that to the top of my request |
| 01:48 | jeremyheiler | ok |
| 01:53 | francis | The specific error message I'm getting back is "<ErrorDescription>The XML document is well formed but the document is not valid</ErrorDescription>" |
| 01:53 | francis | with some other tags and whatnot |
| 01:53 | francis | I feel like it might just be throwing that in general though |
| 01:53 | francis | wait, duh |
| 01:53 | francis | just try as json |
| 01:54 | francis | yeah, damn - gives the same error back |
| 01:54 | jeremyheiler | are you sure just appending the auth xml at the beginning of the document is correct? |
| 01:55 | francis | "The Request message consists of two complete XML documents. The first document is an AccessRequest. It is immediately followed by (concatenated to) a Request. When a client application is undergoing testing and integration, the document combination should be sent to the URL: https://wwwcie.stuff.com/ups.app/xml/Request" |
| 01:56 | francis | The doc definately has me thinking so |
| 02:12 | clj_newb_2385 | async- is kind of long to type; is there a satdnard convention to denote that this clojurescript function is asynchronous? |
| 02:13 | Sgeo | Why does the implementation of doto use gensym directly instead of an autogensym# |
| 02:13 | clj_newb_2385 | emezeske: are you a key contributor to clojurescript? |
| 02:14 | amalloy | Sgeo: try rewriting it with an auto and see |
| 02:15 | Sgeo | I .. don't think I understand how auto works well enough |
| 02:16 | amalloy | Sgeo: short answer, then: auto-gensyms are only "consistent" within a single syntax-quoted form |
| 02:16 | amalloy | &[`(x#) `(x#)] |
| 02:16 | lazybot | ⇒ [(x__50520__auto__) (x__50521__auto__)] |
| 02:17 | amalloy | and you can't write doto with gensyms without using the binding's name in at least two different quoted forms |
| 02:17 | clj_newb_2385 | &`[(x#) (x#)] |
| 02:17 | lazybot | ⇒ [(x__50529__auto__) (x__50529__auto__)] |
| 02:17 | Sgeo | hmm. I'd imagine this limits their utility quite a bit |
| 02:17 | clj_newb_2385 | so why not "lift" the ` ? |
| 02:17 | amalloy | not really |
| 02:17 | amalloy | clj_newb_2385: try rewriting it and see |
| 02:17 | clj_newb_2385 | in fact, maybe this is because I'm bad at writing macros; but I always only have one ` |
| 02:17 | emezeske | clj_newb_2385: I've contributed a couple minor patches |
| 02:18 | Sgeo | Actually, I imagine there's a different way to write doto.... don't know if that gets rid of the auto though |
| 02:18 | clj_newb_2385 | oh gah ... doto ... the java interop |
| 02:18 | clj_newb_2385 | no thanks, I like my sanity |
| 02:18 | Sgeo | Conceptually, it's sort of like a comp of functions, who why not rewrite it into that? |
| 02:18 | amalloy | doto has nothing to do with java interop |
| 02:18 | amalloy | that's just one useful application |
| 02:19 | emezeske | clj_newb_2385: Oh, I didn't see the word "key" in your question. I am definitely not a key contributor. |
| 02:19 | clj_newb_2385 | Sgeo: stealing from haskell? |
| 02:19 | Sgeo | clj_newb_2385, yes. I am a fan of Haskell. |
| 02:20 | clj_newb_2385 | emezeske: ah. for some reason, when I do "lein search clojurescript", [emezeske/clojurescript ... ] has 4 entires |
| 02:20 | Sgeo | The nice thing would be that using such would mean no particular argument position has special significance if you use lambdas |
| 02:20 | clj_newb_2385 | Sgeo: port over haskell's type system |
| 02:20 | clj_newb_2385 | the only thing I feel clojure lacks ... is an ability to detect errors before runtime |
| 02:20 | Sgeo | clj_newb_2385, I'm not that insane (or that smart) |
| 02:21 | emezeske | clj_newb_2385: At one time I maintained a few clojurescript packages, before the upstream folks were releasing them regularly |
| 02:21 | Sgeo | But yes, I like static typing |
| 02:22 | Sgeo | "do" is officially on my list of concepts, along with "yield" and "functor", that has utterly unpredictable meaning from language to language |
| 02:22 | Sgeo | s/concepts/words/ |
| 02:22 | clj_newb_2385 | also "return" |
| 02:22 | clj_newb_2385 | >> also means different things in haskell |
| 02:23 | Sgeo | clj_newb_2385, well, I think "return" is only an outlier in Haskell |
| 02:23 | Sgeo | do is a general purpose looping mechanism in Common Lisp, and a grouping construct in Clojure |
| 02:23 | Sgeo | yield means one thing in C# and Python and a different thing in Ruby |
| 02:24 | Sgeo | And functor.... I don't think there are even two languages that use the same meaning. |
| 02:27 | Sgeo | Why doesn't Clojure have a macroexpand that macroexpands subforms? |
| 02:27 | Sgeo | Is there any reason to omit that? |
| 02:28 | tomoj | it's in tools.macro |
| 02:28 | Sgeo | Ah |
| 02:28 | tomoj | reason not to have it in core? dunno |
| 02:28 | shaungilchrist | wow I am pretty impressed by the clojurescriptone dom testing stuff. This may be a nice way to sneak some clojure into my 9-5 |
| 02:28 | Sgeo | Wait, let is a macro? |
| 02:29 | shaungilchrist | let is usually syntactic sugar and or a macro for lambda immediately applied |
| 02:31 | Sgeo | Hmm, I guess if I want to use doto and use a nonstandard position, I could write something like |
| 02:31 | tomoj | let* is the special form, let adds destructuring |
| 02:32 | Sgeo | &(doto 5 (#(- 6 %)) (+ 3)) |
| 02:32 | lazybot | ⇒ 5 |
| 02:32 | Sgeo | Although is that too ugly, hmm |
| 02:33 | Sgeo | Wait, what. |
| 02:33 | akhudek | Sgeo: are you thinking of -> ? |
| 02:33 | akhudek | not sure if -> works with lambdas |
| 02:33 | Sgeo | akhudek, I guess seeing that doto didn't mean interop made me think that doto would.. be not necessarily a thing for mutable thingies |
| 02:34 | amalloy | &(doto (atom 5) (swap! inc)) ;; *shrug* |
| 02:34 | lazybot | ⇒ #<Atom@d4c046: 6> |
| 02:35 | Sgeo | &(-> 5 (#(- 6 %)) (+ 3)) |
| 02:35 | lazybot | ⇒ 4 |
| 02:35 | amalloy | it is, but you can't have everything |
| 02:35 | amalloy | &(-> 5 (->> (- 6)) (+ 3)) also works |
| 02:35 | lazybot | ⇒ 4 |
| 02:36 | Sgeo | ($ 5 (comp #(- 6 %) (partial 3)) |
| 02:36 | Sgeo | oops |
| 02:36 | Sgeo | ($ 5 (comp #(- 6 %) (partial 3))) |
| 02:36 | clojurebot | what is cells |
| 02:36 | Sgeo | ^^not that ugly I think? |
| 02:39 | Sgeo | I guess I could concede varargs and have $ do an implicit comp |
| 02:40 | Sgeo | ($ 5 #(- 6 %) #(/ % 3)) |
| 02:40 | Sgeo | Also, ignore the $ and comp above, I'm a derp |
| 02:40 | Sgeo | I should try things at a repl |
| 02:41 | Sgeo | Clojure is largely functional, why not use functions instead of macros when they fit (like here) |
| 03:11 | Sgeo | &(map #(% 2) [(partial + 1) (partial * 3)]) |
| 03:11 | lazybot | ⇒ (3 6) |
| 03:25 | francis | Does anyone know of an article/resource that clearly explains http post? I'm not 'getting it' even though I can post data to servers and such |
| 03:28 | tomoj | http://tools.ietf.org/html/rfc2616#section-9.5 ? |
| 03:32 | francis | tomoj: Thats the sort of stuff I've been reading, thanks though |
| 03:37 | tomoj | you may get better results if you indicate better your confusion |
| 03:40 | francis | Sorry, that was terribly ambigous my confusion is stemming from having to interface with another sever with POST. Seems easy enough, given clj-http.client. You just would make a request like so: (clj-http.client/post "https://someurl.com/something" {:body "some data"}) |
| 03:40 | francis | And then that server should just be like "Oh, tight - data, I'll send back a response" |
| 03:40 | francis | right? |
| 03:40 | clojurebot | flatten |is| rarely the right answer. What if your "base type" is a list |
| 03:41 | tomoj | did you already try setting the content type? |
| 03:41 | francis | yeah |
| 03:41 | francis | but there is no documentation (that I can find) indicating what I can pass it |
| 03:41 | francis | should everything be a string? |
| 03:41 | francis | then they would have to parse each string |
| 03:41 | francis | and I keep running into URI encoding |
| 03:41 | kral | hola |
| 03:42 | francis | but that, to me at least seems to be for get |
| 03:42 | tomoj | well, posts with content type application/x-www-form-urlencoded use urlencoding |
| 03:43 | tomoj | and those are pretty common |
| 03:43 | tsdh | Is it possible to extend a protocol on a reification of another protocol? Basically, I'd like to extend a protocol to the CollReduce/CollFold reifications returned by the reducer fns. |
| 03:44 | tomoj | francis: do you have an 'nc' command available? |
| 03:44 | francis | nc? |
| 03:44 | clojurebot | multiple inheritance is http://www.piratejesus.com/nerdcore/nerdcore017.gif |
| 03:44 | francis | in emacs? |
| 03:44 | tomoj | on the command line |
| 03:44 | francis | yeah |
| 03:45 | tomoj | if so you can do e.g. `nc -l 8080`, then change the url in your post to localhost:8080/yada |
| 03:45 | tomoj | to see exactly what you're sending over (.. maybe you already have accomplished this some other way?) |
| 03:45 | tomoj | tsdh: no |
| 03:46 | tsdh | tomoj: Guessed that, but wasn't sure. Thanks. |
| 03:46 | tomoj | which protocol, I'm curious? your own? |
| 03:46 | tsdh | tomoj: Yes, my own. |
| 03:47 | francis | I'm getting a connection refused, though I would need a server running for it to grab the post body right? |
| 03:48 | tomoj | maybe your nc is different than mine, for me `nc -l 8080` starts a server on port 8080 |
| 03:48 | francis | nevermind, the connection terminated while it was sending |
| 03:48 | francis | anyway yeah - it reutrns a bunch of symbols and stuff |
| 03:49 | tomoj | a bunch of symbols? you mean.. text? |
| 03:49 | francis | it shows up as text in my shell, but like so '€n |
| 03:50 | francis | from |
| 03:50 | francis | (client/post "https://localhost:8080" {:body "some test text" :content-type :xml}) |
| 03:50 | francis | I'm guessing I've got to decode it |
| 03:50 | francis | wait |
| 03:50 | francis | duh |
| 03:52 | tomoj | https? |
| 03:52 | clojurebot | eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging |
| 03:52 | tomoj | clojurebot: you're chatty today |
| 03:52 | clojurebot | what should I do today, it is the weekend and all |
| 03:52 | francis | no, encoding text as xml |
| 03:52 | francis | though there is that too |
| 03:53 | francis | if that is what :content-type does |
| 03:54 | tomoj | https://gist.github.com/c5fe830d0471f1afe50f |
| 03:54 | tomoj | that is what I see.. |
| 03:55 | francis | I see the same thing when I remove the ssl encryption |
| 03:55 | tomoj | and the body looks like you expect, your xml? |
| 03:55 | francis | yeah |
| 03:56 | tomoj | you might also try :content-type "text/xml" I guess |
| 03:56 | tomoj | other than that HTTP can't help you.. the server must not like your body? |
| 03:56 | francis | okay |
| 03:56 | francis | thats what I was sort of hoping to hear |
| 03:57 | tomoj | what status code is it returning? |
| 03:57 | francis | 200, with an error message |
| 03:57 | tomoj | lol |
| 03:57 | francis | (on actaual application) |
| 03:57 | tomoj | HTTP really can't help you |
| 03:57 | tomoj | because whoever wrote that application isn't really using it :) |
| 03:58 | francis | wait what? |
| 03:58 | francis | 200 is a sucess code |
| 03:58 | francis | right? |
| 03:58 | clojurebot | technomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener. |
| 03:59 | tomoj | http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1 |
| 03:59 | tomoj | clojurebot: botsmack |
| 03:59 | clojurebot | botsmack is headdesk |
| 04:00 | francis | That makes it sound to me as if it is being used |
| 04:00 | francis | I get back a response |
| 04:00 | francis | it gives an 'OK' |
| 04:00 | tomoj | yeah they're using HTTP in some sense |
| 04:00 | tomoj | by "really" I mean something like "correctly".. |
| 04:01 | tomoj | you should be getting an error code |
| 04:01 | francis | I am |
| 04:01 | tomoj | 200 is not an error code |
| 04:01 | tomoj | error codes are at least 400 |
| 04:01 | francis | no, the body that gets returned is an xml doc containg the error code |
| 04:02 | tomoj | by "error code" I refer to the response status code number, like 200 ("OK") or 400 ("Bad request") |
| 04:02 | tomoj | er, "error code" would be status code numbers >=400, specifically |
| 04:03 | francis | right, not found ect ect |
| 04:03 | tomoj | presumably this should be a 400, if it's your body that's the problem |
| 04:04 | francis | my impression is that it takes my request, says "hey, we parsed this, it didn't have the info we wanted, so we returned this XML with some info" |
| 04:04 | francis | I get that back |
| 04:04 | tomoj | too bad they are not more specific.. |
| 04:05 | francis | it tells me the xml doc is well formed, but |
| 04:06 | francis | hold up |
| 04:07 | augustl | for "settings" for a ring app, I'm considering adding a middleware that adds a :myapp-env to each request. Any other suggestions? :myapp-env will be a map containing the database to use, and some other config stuff. |
| 04:07 | francis | (:body (client/post "stuff")) returns a string of XML saying with error info and a description "the xml document is well formed but the document is not valid" |
| 04:08 | francis | still though |
| 04:08 | francis | If I know I can just pass it xml as a string, thats progress |
| 04:08 | francis | thanks |
| 04:12 | tomoj | it's interesting that clj-http only has extensible output coercion, not input coercion |
| 04:13 | francis | You'd only need that as a server though, and ring has something to do that (I would imagine) |
| 04:13 | francis | that's my impression anyway |
| 04:13 | francis | if I'm way off base, please - correct me |
| 04:15 | tomoj | I would like to do (http/post url {:body (protobuf Foo :foo 1) :content-type :x-protobuf}) |
| 04:15 | tomoj | (on the client) |
| 04:17 | _ulises | how can I add documentation to vars? |
| 04:17 | francis | {:^doc "string"} - if I'm not mistaken |
| 04:18 | francis | (def {:^doc "doc string here"} thing "whatever") |
| 04:18 | tomoj | (def ^{:doc "foo"} foo) |
| 04:18 | tomoj | (defn foo "foo" []) |
| 04:18 | hyPiRion | ,(:doc (meta #'meta)) |
| 04:18 | clojurebot | "Returns the metadata of obj, returns nil if there is no metadata." |
| 04:19 | _ulises | that did it |
| 04:19 | _ulises | thanks! |
| 04:20 | francis | tomoj: to me the client is the user - they wouldn't need input coercions, except for the response from the server |
| 04:20 | francis | and I think there is something to handle that |
| 04:21 | francis | :accept |
| 04:22 | tomoj | by client I refer to the clojure instance calling clj-http.client/post |
| 04:22 | tomoj | clj-http automatically does input coercion for json :form-params |
| 04:23 | tomoj | e.g. (http/post url {:form-params {:foo "bar"} :content-type "json"}) |
| 04:23 | tomoj | it automatically json-encodes the form-params and uses that as the body |
| 04:23 | tomoj | if it were extensible you could do similar magic for xml, protobuf, whatever |
| 04:24 | francis | are you just looking at source for this? |
| 04:24 | francis | I found almost no documentation |
| 04:24 | Sgeo | Wait, what's #' in Clojure? |
| 04:24 | tomoj | yeah |
| 04:24 | tomoj | the docs mostly just show a bunch of examples |
| 04:24 | Sgeo | In Common Lisp it's (function) which is a form which, given a symbol representing a function, gives back the function |
| 04:24 | Sgeo | But Clojure is a Lisp-1 |
| 04:25 | tomoj | &'#'foo |
| 04:25 | lazybot | ⇒ (var foo) |
| 04:25 | francis | Sgeo: what like this? #(stuff %) |
| 04:25 | tomoj | &(doc var) |
| 04:25 | lazybot | ⇒ "Special: var; The symbol must resolve to a var, and the Var object\nitself (not its value) is returned. The reader macro #'x expands to (var x)." |
| 04:25 | Sgeo | francis, no, what tomoj said |
| 04:25 | augustl | iirc # is deprecated for some uses, like (defn #^ReturnTypeHere ...) |
| 04:25 | francis | oh, nifty |
| 04:27 | guns | Sgeo: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L100 |
| 04:27 | Sgeo | EvalReader? |
| 04:28 | Sgeo | Is that like CL's #. |
| 04:28 | guns | It reads the next character after # and dispatches on that |
| 04:28 | Sgeo | Clojure> (bindings [*read-eval* true]) |
| 04:28 | Sgeo | java.lang.SecurityException: You tripped the alarm! *read-eval* is bad! |
| 04:29 | Sgeo | (On TryClj) |
| 04:30 | tomoj | (read-string "#=(+ 1 2)") |
| 04:32 | Sgeo | I thought the reader was supposedly side-effect free? |
| 04:33 | tomoj | only if *read-eval* is false |
| 04:34 | tomoj | otherwise it will do whatever you tell it to do.. |
| 04:34 | tomoj | #= is almost obsolete |
| 04:35 | tomoj | the new literal stuff can replace most uses of it, I think |
| 04:35 | Sgeo | "new" literal stuff? |
| 04:35 | Sgeo | When was it used before? |
| 04:37 | tomoj | &(binding [*print-dup* true] (pr-str (struct (create-struct :foo) "foo"))) |
| 04:37 | lazybot | java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad! |
| 04:37 | tomoj | oh bollocks |
| 04:41 | tomoj | example here http://dev.clojure.org/jira/browse/CLJ-976 |
| 04:41 | tomoj | google for 'extensible reader' or 'reader literals' |
| 04:45 | tomoj | http://www.infoq.com/interviews/hickey-clojure-reader |
| 05:23 | magopian | this frustration when you come up with what seems a nice solution to a 4clojure problem, but it fails miserably on longer sequences because of a timeout |
| 05:24 | magopian | (yeah, computing permutations on a 11-long sequence yields nearly 40millions possibilities... so what :) |
| 05:25 | Sgeo | for is just like Python generator expressions and Haskell list comprehensions, right? |
| 05:26 | magopian | Sgeo: regarding python, yeah, i'm pretty sure that's the same |
| 05:26 | broquaint | Along those lines, Sgeo. |
| 05:26 | magopian | Sgeo: it's not the same as python's list comprehension i believe, as for in clojure is lazy |
| 05:27 | Sgeo | magopian, hence why I said "generator expression" |
| 05:27 | Sgeo | (Which are lazy) |
| 05:27 | magopian | yup ); |
| 05:28 | magopian | was just confirming ;) |
| 05:29 | Sgeo | What's fn* ? |
| 05:31 | Sgeo | future-cancel "Cancels the future, if possible." |
| 05:31 | Sgeo | I think the Foundation should attempt to contain it as an SCP |
| 05:34 | ro_st | is there a version of flatten that doesn't recur? |
| 05:34 | ro_st | ie, it only does one level down |
| 05:34 | ro_st | i have a seq of seqs of two-item vectors which i want to apply hash-map |
| 05:35 | Bronsa | (partial mapcat identity) |
| 05:35 | Bronsa | ,(mapcat identity '[[a b [c d]] [e f]]) |
| 05:35 | clojurebot | (a b [c d] e f) |
| 05:36 | igstan | ,(+ 1 2) |
| 05:36 | clojurebot | 3 |
| 05:36 | ro_st | thanks Bronsa! |
| 05:37 | Sgeo | mapcat is bind on sequences, isn't it? And identity is id. In Haskell, join = (>>= id) |
| 05:37 | Sgeo | So... that makes sense. I learn something new every day |
| 05:53 | Sgeo | loop/recur makes good sense for some use cases for TCO, but what if I want to represent state as being which function I'm in at the time? |
| 05:53 | Sgeo | As in, one function does some work, then calls another if x condition is met, etc. |
| 05:54 | magopian | Sgeo: trampoline? |
| 05:54 | magopian | not sure it'll fit your needs though |
| 06:04 | tomoj | would that macro not implement TCO? |
| 06:06 | Raynes | tomoj: Good morning Mr. Sir. |
| 06:07 | tomoj | morning |
| 06:08 | Sgeo | Does Clojure have macrolet or symbol-macrolet? |
| 06:09 | Raynes | $cd macrolet |
| 06:09 | Raynes | $kill |
| 06:09 | lazybot | KILL IT WITH FIRE! |
| 06:09 | Raynes | lazybot no work |
| 06:09 | Sgeo | Hmm https://github.com/clojure/tools.macro/ |
| 06:09 | Raynes | It doesn't have it built in, but there is an implementation. |
| 06:10 | Raynes | $clojuredocs macrolet |
| 06:10 | Raynes | $login |
| 06:10 | lazybot | You've been logged in. |
| 06:10 | Raynes | $loaded |
| 06:10 | Raynes | I give up. |
| 06:10 | Raynes | Don't know how to use my own bot. |
| 06:11 | cemerick | we all knew they'd go rogue eventually |
| 06:12 | Sgeo | What is the ^{:dynamic true} stuff about? |
| 06:20 | Sgeo | doall is sequence_ |
| 06:20 | Sgeo | Oh, or is it sequence, and dorun is sequence_ |
| 06:20 | ejackson | cemerick: if they ever get control of hiredman's Clojure Rover, we're doomed. |
| 06:21 | cemerick | Sgeo: ^:dynamic controls whether a var is dynamic or not |
| 06:21 | cemerick | See http://clojure.org/vars |
| 06:22 | Sgeo | Ah, so binding can't just affect any var.... of course it shouldn't |
| 06:22 | Sgeo | I guess I was thinking that the separation of binding/var fixed all issues, but... yeah |
| 06:23 | clgv | Raynes: lazybot seems to have a crysis since a while ;) |
| 06:24 | clgv | *crisis |
| 06:25 | Sgeo | There's no such thing as saving an image, is there? |
| 06:25 | Sgeo | Because I think I like images. |
| 06:33 | ro_st | argh. i thought i could (apply hash-map '(["1" "2"] ["3" "4"])) to get back {"1" "2" "3" "4"} |
| 06:33 | ro_st | but i'm getting "No value supplied for key: ["1" "2"]" |
| 06:34 | ro_st | ah i'm a doofus. apply hash-map works on a flat seq |
| 06:39 | clgv | Sgeo: humm you can change the value of *compile-files* than you will have an image in your "classes" folder. |
| 06:40 | igstan | ,(into {} '(["1" "2"] ["3" "4"])) |
| 06:40 | clojurebot | {"1" "2", "3" "4"} |
| 06:40 | nbeloglazov | $source clojure.string split |
| 06:40 | lazybot | Source not found. |
| 06:40 | nbeloglazov | $source clojure.string/split |
| 06:40 | lazybot | clojure.string/split is http://is.gd/GcEANF |
| 06:40 | clgv | clgv: but you would have to store uncompiled stuff. |
| 06:41 | clgv | ouch |
| 06:43 | Sgeo | &(#(#(list %)) 5) |
| 06:43 | lazybot | java.lang.IllegalStateException: Nested #()s are not allowed |
| 06:45 | nbeloglazov | $cd-search macrolet |
| 06:45 | lazybot | clojure.contrib.macro-utils/symbol-macrolet: http://clojuredocs.org/v/679; clojure.contrib.macro-utils/macrolet: http://clojuredocs.org/v/658 |
| 06:47 | nbeloglazov | Raynes: I like `clojuredocs` more than `cd-search`. How about adding it to set of commands? |
| 06:48 | nbeloglazov | I think it's more intuitive |
| 06:48 | clgv | $help |
| 06:48 | lazybot | You're going to need to tell me what you want help with. |
| 06:49 | clgv | $help plugin |
| 06:49 | lazybot | Topic: "plugin" doesn't exist! |
| 06:49 | clgv | humm he needs a feature list ^^ |
| 06:49 | nbeloglazov | $help source |
| 06:49 | lazybot | nbeloglazov: Link to the source code of a Clojure function or macro. |
| 06:49 | clgv | $list |
| 06:49 | lazybot | I know about these topics: |
| 06:49 | nbeloglazov | :) |
| 06:49 | clgv | he knows nothing ^^ |
| 06:50 | wmealing_ | ignorance is bliss |
| 06:50 | nbeloglazov | $list something |
| 06:50 | lazybot | I know about these topics: |
| 06:51 | Raynes | $whatis source |
| 06:51 | lazybot | source is http://github.com/flatland/lazybot |
| 06:51 | nbeloglazov | $help whatis |
| 06:51 | lazybot | nbeloglazov: Pass it a key, and it will tell you what is at the key in the database. |
| 06:51 | Raynes | $whatis Raynes |
| 06:52 | lazybot | Raynes does not exist in my database. |
| 07:04 | nbeloglazov | $rwhatis |
| 07:04 | lazybot | The_Matrix is everywhere. It is all around us. Even now, in this very room. You can see it when you look out your window or when you turn on your television. You can feel it when you go to work... when you go to church... when you pay your taxes. It is the world that has been pulled over your eyes to blind you from the truth. That you are a slave, Neo. Like everyone else you were born into bondage. Born into a prison that you cannot |
| 07:05 | cemerick | lazybot's really bought the farm now |
| 07:06 | cemerick | Raynes just needs to hook it up to rapgenius or something for the ultimate entertainment bot. |
| 07:07 | clgv | $debug |
| 07:07 | lazybot | clgv: It is not the case that you don't not unhave insufficient privileges to do this. |
| 07:07 | clgv | lol |
| 07:10 | Sgeo | Hmm. I think I really like condp |
| 07:12 | nz- | ,(doc condp) |
| 07:12 | clojurebot | "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i... |
| 07:29 | Sgeo | Suppose I have a function that takes a callback, and I want to write code in a more sequential manner. I note that via promises, I can make a promise, pass in a callback that will deliver on the promise, and then attempt to deref the promise. Is this a reasonable use of promises, or are there better solutions? |
| 07:29 | Sgeo | (Assuming I'm in a separate thread) |
| 07:30 | clgv | Sgeo: can I have a drawn sketch? ;) |
| 07:33 | clgv | Sgeo: read it 3 times and not yet completely sure what you want to do |
| 07:34 | Sgeo | http://paste.lisp.org/display/131183 |
| 07:35 | Sgeo | Pretend that i-take-a-callback has a good reason for taking a callback --- maybe it's taking an event handler that will only fire once (ok, not a good way to explain that) |
| 07:36 | clgv | Sgeo: it looks pretty strange. could you describe what you really need? |
| 07:37 | Sgeo | Want to use an event-based API as though it had functions that retrieved the "next" event that is, for example, a click. |
| 07:38 | Sgeo | Oh, hmm, my code doesn't quite work as I intended |
| 07:40 | Sgeo | http://paste.lisp.org/display/131183#1 |
| 07:46 | clgv | Sgeo: so you want to wait for the first event? |
| 07:47 | clgv | Sgeo: that's what your code would manage then - and it makes only sense if there is another thread triggering the event |
| 07:47 | Sgeo | On a related note, how easy/annoying is the JNI to work with? |
| 07:47 | Sgeo | Note that I don't really know Java that well. It's the highly-functional lisp that attracts me to Clojure. |
| 07:48 | Sgeo | (And the libraries) |
| 07:50 | clgv | Sgeo: never really used JNI myself. but I read one or two articles about it and it seemed more complicated than python's C interface |
| 07:50 | Sgeo | Oh fun. |
| 07:52 | clgv | try it ^^ |
| 07:58 | Sgeo | " The let special form is used here for efficiency in the event that the first parameter, number, is passed as an expression instead of a simple value." |
| 07:58 | Sgeo | Suddenly, I don't trust this person to write macros. |
| 08:03 | Sgeo | ...I think I've read this piece of drivel disguised as a popular guide to Clojure before. |
| 08:11 | zoldar | Sgeo: do you mean that this around-zero macro is leaky? |
| 08:13 | Sgeo | zoldar, I mean that I think it's insufficient to say that it's an "efficiency" issue. If the expression happens to be impure, running more than once can cause observable confusing behavior. |
| 08:13 | clgv | Sgeo: link? |
| 08:13 | Sgeo | http://java.ociweb.com/mark/clojure/article.html |
| 08:13 | zoldar | Sgeo: ah, right |
| 08:14 | jrajav | Sgeo: What would you recommend? |
| 08:16 | clgv | Sgeo: he doesnt read that bad though. maybe he slipped on that one ^^ |
| 08:16 | Sgeo | If it's not going to elaborate on why it's necessary, might just say "efficiency and safety" and "a possibly impure expression"? |
| 08:24 | Sgeo | Ugh, how much Java stuff am I going to end up learning if I get into Clojure? |
| 08:26 | clgv | Sgeo: depends on how much you will need java libs. |
| 08:26 | Sgeo | Threads themselves afaict are created and started via Java classes and methods |
| 08:26 | hyPiRion | Sgeo: Not much, java String is the only thing I work with. |
| 08:26 | Sgeo | clgv, even basic math and threading seems to call into the Java interop in a user-exposed way |
| 08:27 | clgv | Sgeo: yeah that's a pity |
| 08:27 | hyPiRion | If you're working heavily with threads, then you should learn them. |
| 08:27 | stuartsierra | You rarely need to call Thread.new in Clojure: Futures and Agent send-off will create threads as needed. |
| 08:28 | Sgeo | Do promises create threads, wait, that makes no sense |
| 08:28 | clgv | when the reducers lib is ready, there are even less cases where you have to create threads or threadpools yourself |
| 08:28 | clgv | Sgeo: no |
| 08:28 | clgv | Sgeo: then you need a future |
| 08:37 | nz- | is there somewhere introduction or something like that to reducers? |
| 08:38 | vijaykiran | nz-: did you see rhickey's talk http://vimeo.com/45561411 ? |
| 08:38 | nz- | not yet |
| 08:40 | vijaykiran | that with blog posts on clojure.com should give enough info to start and experiment with reducers I think |
| 08:46 | Sgeo | I should try to port the TardisT monad transformer to Clojure |
| 08:47 | Sgeo | Although that would require me to understand the Tardis monad, as well as monad transformers. |
| 08:49 | stuartsierra | I've never heard of the Tardis monad, but it has an awesome name. |
| 08:50 | john2x | hello |
| 08:52 | mmitchell | would someone mind telling me what i'm doing wrong here? I'm attempting to create reduce-like function. I'd like this to be lazy, and so with large inputs, using something like (take 3 ...) would cause work to be done for only 3 items. Any tips? https://gist.github.com/3450179 |
| 08:53 | mmitchell | the time prints immediately, but the actual time to produce results seems way to long |
| 08:54 | Sgeo | stuartsierra, http://hackage.haskell.org/packages/archive/tardis/0.3.0.0/doc/html/Control-Monad-Tardis.html |
| 08:55 | clgv | mmitchell: well thats not how lazy-seq works. |
| 08:56 | mmitchell | clgv: I'm reading through this now: http://clojure.org/lazy#Making%20Clojure%20Lazier--The%20current%20seq%20model |
| 08:56 | clgv | mmitchell: you can use `reductions` which is lazy |
| 08:56 | mmitchell | clgv: ok, i'll have a look |
| 08:59 | Sgeo | The chance of me understanding both it and the way monads work in Clojure is... probably not that high |
| 09:07 | Sgeo | Are monads easier to learn for people who started in Haskell than people who started in Clojure? |
| 09:08 | Sgeo | "Rather, 'a' can be used in the following expressions to access the basic values contained inside the monadic value returned from '(f3 x)'." |
| 09:08 | Sgeo | That's... not quite accurate. Monads are not necessarily containers. But I don't know a better way to put that. |
| 09:08 | Fossi | i suspect monads aren't "easier to learn" for anybody ;) |
| 09:09 | chouser | it's the state monad that's the brain-twister |
| 09:13 | Chousuke_ | I don't find monads particularly difficult anymore. some implementations of them might not be obvious, but the concept itself is pretty straightforward |
| 09:14 | nvy | suppose I have some hash list X, which I want to process through a special function of mine, and pass it another process for more processing. But the first process may have some requirements of X, and I want to expose the fact that there is a wrong input to the user. When there is no bad input, then I want to process it with the second process, and if the requirements aren't met, I want to do the same thing, and so on.. |
| 09:15 | nvy | can someone describe such a workflow? I'm too used to raising exceptions in the imperative world |
| 09:16 | Chousuke_ | sounds like you want the Either monad or something similar :P |
| 09:17 | Chousuke_ | you can use exceptions in clojure though, it's fine. |
| 09:18 | nvy | is there any reading that I could do relating to this perhaps? :) |
| 09:19 | Chousuke_ | using exceptions is not a bad idea in a case like this I think, if I understand you correctly |
| 09:20 | nvy | well, in this specific application... I receive some XML as user input, and I want to verify that: 1) it is valid, 2) it is indeed Atom XML |
| 09:20 | nvy | and then do further processing on it |
| 09:20 | Chousuke_ | Though it will be a good idea to separate the input checking and exception-throwing from the actual processing functions. |
| 09:21 | nvy | what's CL Sgeo ? |
| 09:22 | nvy | Common Lisp? |
| 09:22 | Sgeo | Yes |
| 09:22 | Chousuke_ | conditions would be fun but it's not really possible on the JVM without sacrificing interop transparency |
| 09:22 | nvy | all these Lisps are so new to me. I started trying to get hang of emacs for the first time in my life |
| 09:22 | stuartsierra | It's hard to implement conditions without manipulating the stack, which the JVM doesn't support. |
| 09:25 | nvy | these "conditions" remind me of coroutines, Sgeo, am I on the right track? |
| 09:26 | Sgeo | Might be able to build conditions on coroutines, but don't need coroutines for conditions |
| 09:26 | Sgeo | Afaict, it's possible to do it with dynamically scoped variables and first-class functions |
| 09:28 | naeg | can this list comp be made nicer or replaced? http://bpaste.net/show/6qLdugRuSEubf13MBttD/ |
| 09:30 | nvy | ok Sgeo, understood |
| 09:30 | Sgeo | nvy, I was sorely disappointed when I actually understood why the condition system wouldn't let me trivially implement continuations |
| 09:31 | nvy | naeg: I believe that the if part can be replaced with (max x y), and you should have a look at :when keyword for the for. (but I'm a newbie) |
| 09:33 | naeg | nvy: the if part actually has some other test in it and since I want to iterate over all x and y, :when is no option for me afaik |
| 09:33 | Sgeo | Does the monad library for Clojure have a way to define monad transformers? |
| 09:34 | Sgeo | I might have more luck just transliterating TardisT into Clojure than trying to understand it as a monad. |
| 09:34 | Sgeo | I suspect that it relies on laziness though |
| 09:35 | acheng | Sgeo: as a side note, stack traces when using monads will not be very useful |
| 09:35 | Sgeo | Stack traces in Clojure are actually useful sometimes? |
| 09:35 | Sgeo | </stereotyping> |
| 09:36 | acheng | "oh look, i'm in m-bind. and now i'm in m-result. and back in m-bind. ooh" |
| 09:36 | chouser1 | Clojure stack traces contain a wealth of useful information, hidden under a huge pile of noise. |
| 09:38 | acheng | re stacktraces: for my users' use case, i floss all references to certain packages and then expand it with the source of the fn's involved. very transparent for them |
| 09:38 | Sgeo | (def parser-m (state-t maybe-m)) |
| 09:38 | Sgeo | I take it monad transformers in Clojure-world are actually functions |
| 09:38 | Sgeo | Is my head going to explode? |
| 09:40 | acheng | Sgeo: depends on how awesome your head is |
| 09:40 | john2x | I'm going through 4clojure at the moment, and I'm kind of stuck |
| 09:41 | jimduey | Sgeo: all monad transformers are functions. They take a monad and return a monad. |
| 09:41 | john2x | how do I get a sum of numbers in a list? like sum() in most langauges.. (+ (1 2 3)) doesn't work.. |
| 09:41 | wmealing_ | (+ listname) |
| 09:41 | Sgeo | ,(apply + '(1 2 3) |
| 09:41 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 09:41 | Sgeo | ,(apply + '(1 2 3)) |
| 09:41 | clojurebot | 6 |
| 09:41 | Sgeo | ,(+ '(1 2 3)) |
| 09:41 | clojurebot | #<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentList to java.lang.Number> |
| 09:42 | jimduey | Sgeo: http://www.clojure.net/2012/03/05/Transformers/ |
| 09:42 | brainproxy | interested in rdf/rdfa, but clj-plaza and hiccup-rdfa look a bit stale... any thoughts? |
| 09:42 | duck1123 | actually, for the case of +, I think reduce is better |
| 09:42 | john2x | ah reduce it is. thanks! |
| 09:42 | duck1123 | clj-plaza is good, I was updating it the other day |
| 09:42 | nbeloglazov | &(time (reduce + (range 1000000))) |
| 09:42 | lazybot | ⇒ "Elapsed time: 383.682792 msecs" 499999500000 |
| 09:43 | nbeloglazov | &(time (apply + (range 10000000))) |
| 09:43 | lazybot | ⇒ "Elapsed time: 2043.416524 msecs" 49999995000000 |
| 09:43 | nbeloglazov | &(time (reduce + (range 10000000))) |
| 09:43 | lazybot | ⇒ "Elapsed time: 2013.09087 msecs" 49999995000000 |
| 09:43 | brainproxy | jimduey: I saw you speak last year at StrangeLoop on monads... wasn't into clojure at the time, so it was a bit confusing, but I still have the notes I took from your presentation :) |
| 09:43 | Sgeo | jimduey, in Haskell, they're not functions (well, I guess you can call them type-level functions) |
| 09:44 | john2x | hmm what's the difference between apply and reduce? |
| 09:45 | nbeloglazov | john2x: did you read doc for apply and reduce? |
| 09:45 | jimduey | brainproxy: glad to see you came over to the good side. :) |
| 09:45 | brainproxy | duck1123: you have a fork? |
| 09:46 | duck1123 | brainproxy: yes, check out my fork, it should be 1.3+ compatible |
| 09:46 | duck1123 | I think it's net.kronkltd/plaza |
| 09:46 | john2x | apply applies the function to each item, and reduce applies the function to each item while passing the result to the next iteration? |
| 09:47 | duck1123 | I yanked out a lot of stuff I didn't need, mind you. Intended to put it back as a separate library, but haven't yet |
| 09:47 | Sgeo | apply applies the function as though the list was expanded into the arguments |
| 09:47 | arrdem | john2x: take another look at apply, you described map. |
| 09:47 | duck1123 | but it works pretty well for my needs. I was re-writing a bunch of stuff the other day, but I haven't pushed it yet |
| 09:48 | nbeloglazov | ,(doc apply) |
| 09:48 | clojurebot | "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args." |
| 09:49 | duck1123 | (reduce + [1 2 3 4]) => (+ (+ (+ 1 2) 3) 4), (apply + [1 2 3 4]) => (+ 1 2 3 4) |
| 09:49 | brainproxy | duck1123: cool... i will take a look, thanks for the tip :) |
| 09:51 | Sgeo | My mind just went numb |
| 09:51 | Sgeo | getPast getFuture sendPast sendFuture use the tardis function in their definition. tardis uses all of thse. |
| 09:53 | duck1123 | there's a tardis function? |
| 09:54 | Sgeo | http://hackage.haskell.org/packages/archive/tardis/0.3.0.0/doc/html/src/Control-Monad-Tardis-Class.html |
| 09:54 | Sgeo | I'm sure I once knew what the rec in that do is, but I forgot |
| 09:58 | djcoin | Does the Clojure folks around here tends (or plan to) to use monads, lenses and other functional stuff ? |
| 09:59 | jimduey | djcoin: some do. I like the way monads and arrows make code simpler. Many others are not impressed. |
| 10:01 | jimduey | Sgeo: Tardis looks mind bending. Thanks. |
| 10:01 | jimduey | Are you porting it to Clojure? |
| 10:01 | Sgeo | jimduey, it's something I vaguely want to do, but I don't even understand it at this point. |
| 10:02 | Sgeo | And don't know how well it would work in Clojure: As far as I know, it relies on laziness. |
| 10:02 | jimduey | Sgeo: I was just thinking this morning that I needed to write another blog post about something monadic. Perhaps one on the reverse state monad and one on a tardis transformer. |
| 10:03 | Sgeo | jimduey, cool |
| 10:03 | jimduey | Do they have any practical use? |
| 10:03 | Sgeo | jimduey, no idea |
| 10:03 | jimduey | :) |
| 10:03 | Sgeo | I think there is some example of practical use somewhere |
| 10:04 | Sgeo | https://github.com/DanBurton/tardis/blob/master/Control/Monad/Tardis/Example.hs |
| 10:05 | jimduey | Some light reading for this evening. |
| 10:05 | Sgeo | Looking at all this DoRec stuff, I think domonad may be unsuitable syntactic sugar for the Tardis monad. |
| 10:06 | Sgeo | And may need to be modified |
| 10:07 | Sgeo | http://www.haskell.org/ghc/docs/6.12.3/html/users_guide/syntax-extns.html |
| 10:07 | Sgeo | Look for "The recursive do-notation" |
| 10:08 | djcoin | jimduey: Sgeo : as you seems to be in functional stuff, may I ask the question of why did you choose clojure over scala, haskell and such ? (I'm making the choice to move to clojure in the weeks but if you can shed some light on your own choices :) - many thanks !) |
| 10:09 | john2x | what's clojure's And/Or operator? |
| 10:10 | arrdem | john2x: .... (and) (or) |
| 10:10 | jeremyheiler | &(doc and) |
| 10:10 | lazybot | ⇒ "Macro ([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true." |
| 10:10 | john2x | oh. lol. thanks |
| 10:10 | Sgeo | I'm sort of only getting back into Clojure now. I think the things I want most are convenient and community-accepted macros (Template Haskell is a macro system for Haskell, but it's ugly and often frowned upon), and the plausibility of changing a program while it runs for development purposes. |
| 10:11 | jimduey | djcoin: I came to Clojure first, then discovered the functional paradigm. There's so much to learn here, I haven't moved on to Haskell. Particularly with the typed clojure work Ambrose is doing. |
| 10:11 | Sgeo | Actually having a sizable community is nice too (Scala and Haskell do too, but it's why I'm choosing Clojure over, say, any Scheme or Racket) |
| 10:12 | djcoin | Yeah Typed Clojure would be awesome (inspired from Racket it seems) |
| 10:12 | djcoin | Thanks a lot for your inputs |
| 10:15 | arrdem | djcoin: I learned CLISP and Scheme first, but struggled with them because I found that they were very self-contained communities and languages. The kind of place where you roll your own "like a man" instead of using a library. Then I found Clojure and between Clojars, Lein and the easy java interop all is well. |
| 10:17 | djcoin | arrdem: I come from python/javascript (i do RIA with GIS stuff), and i'm becoming tired of those languages. I don't know lisp-like much, what do you use those kind of language for ? AI (cliché ;) ) ? |
| 10:19 | arrdem | djcoin: no, not AI... Clojure I have used for a lot already the others I learned just because I found the implimentation, notation, macros and functional approach mind-bending and worth learning. |
| 10:21 | arrdem | and yeah, I came from C++, C and Python before I drank the Lisp kool-aid |
| 10:21 | naeg | djcoin: I'm new to clojure too, but you can basically do everything. Web, database, drawing stuff, ... guess almost everything you could do with java. but it's ofc very suitable for AI, algorithmic problems, etc. |
| 10:22 | Sgeo | I'm the sort of person who can never actually stick with a language |
| 10:22 | naeg | know that feel, bro |
| 10:22 | naeg | hi scriptor |
| 10:22 | scriptor | hey naeg |
| 10:23 | naeg | scriptor: I'm not sure whether it was you or piranha being interested in it - but I managed to transliterate the clojure conways game of life into python |
| 10:23 | djcoin | Huhu |
| 10:24 | scriptor | naeg: ah, nice, how was it? |
| 10:24 | djcoin | Yeah i know that feel too - but I guess I may stop sometimes spending time looking at language and learn more in other fields |
| 10:24 | naeg | scriptor: http://bpaste.net/show/2RM4RfewQbrCJr1Hnf6p/ |
| 10:24 | djcoin | Not sure it makes sense :b or is incompatible of course |
| 10:24 | naeg | scriptor: some guys in #python didn't really like what i was doing^^ |
| 10:24 | scriptor | hehe |
| 10:24 | scriptor | figures |
| 10:25 | naeg | ? |
| 10:25 | scriptor | it's pretty unpythonic, I guess |
| 10:25 | naeg | it is, yeah |
| 10:25 | naeg | just wanted to know how far you can push FP in python |
| 10:26 | naeg | and it's almost 1:1 with the clojure solution |
| 10:26 | scriptor | is the clojure solution online somewhere? |
| 10:26 | naeg | scriptor: I can paste mine, just a second. you could also help me with one problem I'm having there if you have time |
| 10:27 | naeg | scriptor: http://bpaste.net/show/s5aUgEV54mHZ9CGx5ALo/ |
| 10:28 | naeg | scriptor: I tried to combine empty-board and populate into create-world, but I'm unsure about the list comp and the (vec) |
| 10:28 | naeg | not sure whether that is idiomatic in clojure or there is a better way to do it |
| 10:28 | e_svedang | excuse me gentlemen, i'm trying to find information on how to access a gensym:ed symbol from an expression that i pass into a macro... is this possible? |
| 10:33 | scriptor | naeg: hmm, why do you need to call vec in create-world? |
| 10:34 | bosie | whats the point of constantly? |
| 10:34 | naeg | scriptor: because otherwhise all of it would would be a list. shouldn't I use vectors for this kind of things? |
| 10:34 | scriptor | bosie: when you need to pass something a function instead of a value |
| 10:34 | bosie | scriptor: ah |
| 10:35 | bosie | scriptor: completely missed "returns a function" and the importance of it |
| 10:35 | scriptor | naeg: true, it's better for contains |
| 10:35 | Sgeo | bosie, identity can be useful too |
| 10:35 | Sgeo | ,(doc identity) |
| 10:35 | clojurebot | "([x]); Returns its argument." |
| 10:36 | bosie | hm |
| 10:36 | bosie | Sgeo: don't get it |
| 10:36 | bosie | Sgeo: thats for when you need to pass in …. a number and get one back? |
| 10:36 | bosie | or sth |
| 10:36 | Sgeo | An example someone else showed earlier (of how to do this particular operation): |
| 10:37 | Sgeo | ,(mapcat identity [[[1 2 3]] [[4 5 6]]]) |
| 10:37 | clojurebot | ([1 2 3] [4 5 6]) |
| 10:37 | scriptor | it makes it convenient to filter out all falsy values from a collection as well |
| 10:37 | scriptor | ,(filter identity [1 nil false]) |
| 10:37 | clojurebot | (1) |
| 10:38 | Sgeo | That is, you're not often going to be doing (identity foo), but you might pass identity into something expecting a function |
| 10:39 | bosie | Sgeo: trying to wrap my head around your example |
| 10:39 | bosie | (identity [[1]]) returns [[1]] |
| 10:39 | Sgeo | mapcat takes a function and a sequence, and applies the function to each element, like map, then concatenates the result |
| 10:40 | bosie | right |
| 10:40 | bosie | so the two elements it works on are [[1 2 3]] and [[4 5 6]] |
| 10:40 | bosie | applying identity on those yield the same resrult |
| 10:40 | Sgeo | Yes. |
| 10:40 | bosie | so concaneting should actually make no difference |
| 10:40 | Sgeo | And then the cat part of mapcat ... hmm |
| 10:40 | bosie | right |
| 10:41 | Sgeo | jimduey, feel like describing bind on lists today? |
| 10:41 | bosie | Sgeo: true |
| 10:41 | Sgeo | ,(concatenate [1 2 3] [4 5 6) |
| 10:41 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )> |
| 10:41 | bosie | Sgeo: the cat works on each element |
| 10:41 | Sgeo | ,(concatenate [1 2 3] [4 5 6]) |
| 10:41 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: concatenate in this context, compiling:(NO_SOURCE_PATH:0)> |
| 10:42 | bosie | i get it |
| 10:42 | scriptor | naeg: what is living-cells, by the way? Specifically why is first called on it? |
| 10:43 | bosie | thx Sgeo |
| 10:43 | naeg | scriptor: look at the glider and light-spaceship defintion below. first is called because & puts it into a list |
| 10:44 | naeg | scriptor: it's a set with the coordinates of the cells which should be alive |
| 10:44 | jimduey | Sgeo: http://www.clojure.net/2012/02/02/Monads-in-Clojure/ Look at the 'Binding' section |
| 10:44 | Sgeo | jimduey, I meant explaining to bosie |
| 10:44 | naeg | scriptor: you can try it out with (create-world 4 4 glider) |
| 10:45 | jimduey | :) Sorry. most of my brain is already at work. |
| 10:45 | scriptor | naeg: ah, right. Is there a reason for living-cells to come after the &? |
| 10:45 | Sgeo | Since >>= is a flipped mapcat |
| 10:45 | bosie | jimduey: where do you work |
| 10:45 | jimduey | Lonocloud |
| 10:45 | naeg | scriptor: because I wanted it to be optional. one could do (create-world 4 4) this way |
| 10:45 | bosie | jimduey: liking it? |
| 10:45 | scriptor | got it, contains would always return false and it would be a blank board |
| 10:46 | jimduey | Love it. Get to work with some of the smartest people I've met on some hard problems. |
| 10:46 | bosie | heh |
| 10:46 | naeg | I'm not sure whether this is the right way to make it optional though |
| 10:46 | bosie | jimduey i guess they have a pride in excellency eh? not the usual 80/20 perspective ? ;) |
| 10:47 | jimduey | Most definitely. |
| 10:47 | Sgeo | Another time that identity _would_ be useful, is if Clojureists generally used the Cont monad |
| 10:47 | scriptor | naeg: another alternative is using the multiple arity feature |
| 10:47 | Sgeo | jimduey, since you're a monad person, is Cont implemented in some library? |
| 10:48 | Sgeo | (The continuations monad, in case you're not familiar with "Cont" because that's the Haskeller's name) |
| 10:48 | naeg | scriptor: would you recommend to do so? never heard of it before |
| 10:48 | jimduey | Sgeo: Yeah. Konrad's algo.monads has it. And my protocol-monads library does as well. |
| 10:48 | jimduey | https://github.com/jduey/protocol-monads |
| 10:48 | scriptor | naeg: it's when a function can be defined using different arities, ie different implementations depending on the number of arguments |
| 10:49 | Sgeo | Protocols make me feel icky |
| 10:49 | bosie | jimduey: what are you using at work? |
| 10:49 | bosie | jimduey: programming language |
| 10:50 | Sgeo | It's like a less general multimethod system |
| 10:50 | naeg | scriptor: but clojure doesn't have these keyword arguments like python? e.g. def create_world(w, h, cells=()) and when you call it you either do create_world(4,4) or create_world(4,4,cells=[[0,1], [0,2]]) |
| 10:51 | scriptor | naeg: doesn't use keyword args, one sec let me write up an example |
| 10:52 | arrdem | naeg: the usual solution is to have Clojure generate a map from keywords and values at the end of your function's arguments |
| 10:52 | jimduey | bosie: We're 99.9% Clojure |
| 10:52 | bosie | jimduey: i envy you |
| 10:52 | jimduey | I have to say it's pretty great. |
| 10:52 | bosie | does sound like it |
| 10:52 | scriptor | naeg: https://www.refheap.com/paste/4608 |
| 10:52 | naeg | arrdem: but when I'm having only one argument, I can directly use &, right? |
| 10:53 | arrdem | naeg: thing (fn [a b c &{:keys [foo bar baz] :or {:foo 1 :bar 2 :baz 3} :as tail}] |
| 10:53 | naeg | map would be overkill in that case, imo |
| 10:53 | scriptor | jimduey: what's the other 0.1%? |
| 10:53 | jimduey | Sgeo: I actually have come to like protocols. They allowed me to implement monads using only a single macro. Whereas Konrad had to use all kinds of macrology in algo.monads |
| 10:54 | naeg | scriptor: would you change create-world to use this? it would be basically the same, just with only 2 args there would be no if |
| 10:54 | jimduey | scriptor: A little java and clojurescript |
| 10:54 | scriptor | naeg: right, your current method is more concise, so I'd probably keep it the same |
| 10:54 | naeg | but I learnt something new, thanks |
| 10:56 | scriptor | naeg: also, for can take in multiple arguments, so you could create an empty x by y board like so https://www.refheap.com/paste/4610 |
| 10:56 | scriptor | s/multiple arguments/multiple bindings |
| 10:57 | duck1123 | I usually find the rest-arg keyword maps to be more annoying then they are worth. |
| 10:57 | duck1123 | whenever I do that, I find that I regret it and change it to take an actual map |
| 10:58 | clgv | duck1123: you could try [clojure.options "0.2.2"] for better syntax and documentation support for options |
| 10:59 | naeg | scriptor: I tried to do so, but it didn't work |
| 10:59 | naeg | yours seems not to work either |
| 10:59 | naeg | it returns just a list of " " instead a list of lists of " " |
| 10:59 | scriptor | ah, good catch |
| 11:00 | naeg | i played around with multiple bindings for a few mins, then just decided to make a second for |
| 11:01 | duck1123 | clgv: interesting. starred for later. The thing that usually makes me mad is when I already have the options in a map and have to figure out how to apply them |
| 11:01 | Sgeo | jimduey, are the applicative and functor functions defined in monad libraries? |
| 11:01 | clgv | duck1123: I mostly needed it when having several layers of functions with keyword-arguments. you always dont know what option you can specify for the lower layers |
| 11:02 | Sgeo | Since all monads should be applicatives and functors, it should be easy to write <$> and <*> |
| 11:02 | Sgeo | Although I'd need to think about it a bit because of the whole not currying by default thing |
| 11:03 | jimduey | Sgeo: nope |
| 11:04 | Chousuke_ | many haskell techniques end up kind of cumbersome in Clojure |
| 11:04 | Chousuke_ | in particular, point-free style is often pointless :P |
| 11:05 | scriptor | clojure's not a fan of indian food, clearly |
| 11:05 | Sgeo | Chousuke_, I think -> should be replaced with a function |
| 11:06 | clgv | Sgeo: nooo! please dont! then you couldnt use it for java interop |
| 11:07 | Sgeo | Gah, I used to know the definitions of fmap and <*> for monads |
| 11:07 | Sgeo | Wait, fmap = liftM and <*> = ap, I think |
| 11:07 | Sgeo | So I can cheat |
| 11:07 | Chousuke_ | Sgeo: yeah, it really can't be replaced with a function. |
| 11:08 | Sgeo | (-> 5 #(+ 3 %) #(* 2 %)) |
| 11:08 | Sgeo | ? |
| 11:08 | dnolen | Sgeo: yuck |
| 11:08 | Sgeo | I think being unable to specify which argument it goes in is uglier |
| 11:09 | Chousuke_ | nah, that's just how it works |
| 11:09 | Chousuke_ | in practice, -> and ->> are what you need the most. |
| 11:09 | Chousuke_ | people have implemented their own "generic" versions but I don't think they're used much, really. |
| 11:09 | duck1123 | you can even chain them together somewhat |
| 11:10 | nvy | (?doc ->) |
| 11:13 | Sgeo | Anyways.... to write fmap in curried or uncurried form. That is the question. |
| 11:17 | Sgeo | Yeah, with variadic functions, would make most sense to ... |
| 11:17 | Sgeo | Not worry too much about the mixing of fmap and <*> and just make a useful function? |
| 11:20 | jkkramer | I'm a java logging noob. I'm writing a library that creates and executes sql statements, which I'd like to log. However, I want to ensure that consumers of the lib can opt in or out of seeing these (trace-level) logs in a standard way. If I use tools.logging, what kind of config should I use to accomplish this? |
| 11:21 | jkkramer | (any suggested reading on the topic is welcome, too) |
| 11:25 | duck1123 | if you're writing a library, other than tools.logging, you should keep the choice of logging backend out of it. Specify what you like for testing though |
| 11:26 | duck1123 | I find that log4j works pretty well |
| 11:27 | acheng | java interop question: typing java.lang.Double/parseDouble at the repl fails with "unable to find static field" ... but using it at the repl works. why? |
| 11:27 | acheng | by "using" i mean just calling it like (java.lang.Double/parseDouble "3.2") |
| 11:27 | jkkramer | duck1123: alright, so I just don't configure anything lib side? just use tools.logging macros? what if a consumer lib hasn't done any log configuration? |
| 11:28 | djcoin | ( jimduey: https://github.com/jduey/fruit-exchange <= the link in the title of the project is broken) |
| 11:29 | acheng | ,java.lang.Double/parseDouble |
| 11:29 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to find static field: parseDouble in class java.lang.Double, compiling:(NO_SOURCE_PATH:0)> |
| 11:29 | acheng | ,(java.lang.Double/parseDouble "3.14") |
| 11:29 | clojurebot | 3.14 |
| 11:29 | jeremyheiler | acheng: Because Java methods cannot be referenced directly like that. |
| 11:29 | acheng | jeremyheiler: so i can't include it in a call to comp ? |
| 11:30 | acheng | ,(comp str java.lang.Double/parseDouble) |
| 11:30 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to find static field: parseDouble in class java.lang.Double, compiling:(NO_SOURCE_PATH:0)> |
| 11:30 | S11001001 | ,#(Double/valueOf %) ; acheng |
| 11:30 | clojurebot | #<sandbox$eval103$fn__104 sandbox$eval103$fn__104@7e9bd781> |
| 11:31 | dnolen | jonasen: did you see ekeko? |
| 11:31 | acheng | S11001001: thanks |
| 11:31 | duck1123 | jkkramer: You'll probably want to pick a log backend for your test environment, so you could set up some sane filters based on that backend and your namespaces. Just don't clobber the root logger |
| 11:32 | duck1123 | I had an issue for a while where Korma was setting all my logging to debug. It annoyed the hell out of me. |
| 11:32 | jonasen | dnolen: I did. but I haven't had time to study it yet |
| 11:34 | jkkramer | duck1123: yeah that's what I'd like to avoid (writing a lib in a similar niche as korma). what's the proper way to "pick a log backend for a test environment" using project.clj / log config? I'm pretty clueless and not sure where to look for examples of best practice |
| 11:35 | duck1123 | jkkramer: https://github.com/duck1123/ciste/blob/master/project.clj |
| 11:35 | duck1123 | notice log4j is a dev dependency. users of this lib are free to choose whatever backend they like, but the tests will use lg4j |
| 11:37 | duck1123 | of course, now that I look at this, I'm not sure if my log4j properties is the best it can be |
| 11:37 | dnolen | jonasen: seems very similar to scape but w/ core.logic instead. |
| 11:37 | jkkramer | duck1123: excellent thanks. so if someone uses your lib without choosing or configuring a logging backend, it won't blow up or anything? |
| 11:38 | jonasen | dnolen: and somehow depends on Eclipse if I understood it correctly |
| 11:38 | duck1123 | Good question. I think c.t.logging has a fallback to printing. I'll have to give that a try |
| 11:38 | dnolen | jonasen: only in that it is an Eclipse plugin. |
| 11:39 | dnolen | jonasen: Eclipse exposes the Java AST, they use core.logic to query over that. |
| 11:39 | dnolen | jonasen: these guys have been working on this problem for a long time w/ Smalltalk (SOUL), should be interesting to see where it goes. |
| 11:39 | jonasen | dnolen: definitely! |
| 11:40 | jkkramer | duck1123: I just know it's pretty common for non-java-background clojure authors like me to be oblivious to logging concerns, so want to accommodate that |
| 11:40 | jonasen | dnolen: I'll probably install Eclipse and try the demo this weekend |
| 11:41 | dnolen | jonasen: it got me thinking that core.logic AST query engine for JS (via Esprima or some such) would be kinda cool. |
| 11:41 | duck1123 | jkkramer: I know how you feel. I'm just finally getting to the point that I feel confident that I know where my library is logging and why |
| 11:42 | duck1123 | I still want to try out timbre, but haven't had the time |
| 11:42 | jonasen | dnolen: I've been thinking about doing something with JS too. What's Esprima? |
| 11:43 | dnolen | jonasen: it parses JS and generates the AST as JSON, http://esprima.org |
| 11:44 | jonasen | dnolen: Thanks for the link, I'll take a look |
| 11:56 | mmitchell | (defn map-count [coll f] (map (comp count last) (group-by f coll))) |
| 11:56 | mmitchell | is there a clojure.core way of doing this? |
| 12:00 | S11001001 | ,(doc frequencies) |
| 12:00 | clojurebot | "([coll]); Returns a map from distinct items in coll to the number of times they appear." |
| 12:01 | S11001001 | ; mmitchell |
| 12:01 | scriptor | how often are transients used by regular clojure devs? |
| 12:01 | mmitchell | S11001001: awesome! thank youl |
| 12:02 | kencausey | I'm having trouble running clojurescriptone (Debian 64bit, OpenJDK 7): http://paste.lisp.org/+2T85 |
| 12:02 | technomancy | scriptor: I've never seen them used directly, just via into |
| 12:02 | Sgeo | Oh hey algo.monads has a m-lift |
| 12:03 | Sgeo | It seems to be a macro, I'm not sure how necessary that is. |
| 12:04 | clj_newb-2840 | e is a javascript event callback. Why does clojurescript force me to type (.-keyCode e) instead of e.keyCode ? the lattter is so much more readable |
| 12:06 | shaungilchrist | abstract the pain away |
| 12:09 | duck1123 | has anyone ever taken a stab at allowing javascript object properties to be accessed via destructuring? Would that even be possible? |
| 12:10 | Sgeo | You know what would be funny? If by studying this Clojure code I actually ended up understanding Cont better than I did when trying to grasp it in Haskell |
| 12:11 | duck1123 | (fn [{:properties [keyCode] :as e}] ...) |
| 12:12 | duck1123 | it doesn't, but it would be |
| 12:16 | nDuff | clj_newb-2840: That's a hard question to answer without going into a lot of background. Are you familiar with language isomorphism as a concept? |
| 12:39 | nDuff | Does partial preserve type hints? |
| 12:45 | duck1123 | nDuff: I'm pretty sure it does |
| 12:58 | Sgeo | ,(println "Hello") |
| 12:58 | clojurebot | Hello |
| 12:58 | Sgeo | ,(dosync (println "Hello")) |
| 12:58 | clojurebot | Hello |
| 12:58 | Sgeo | !!! |
| 12:58 | Sgeo | Why does that work? |
| 12:58 | Sgeo | ,(dosync (io! (println "Hello"))) |
| 12:58 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: I/O in transaction> |
| 12:58 | shaungilchrist | haha |
| 12:59 | Sgeo | Why isn't println defined with io! in its definition? |
| 13:00 | duck1123 | that would be a lot of overhead when it's generally not needed |
| 13:01 | antares_ | Sgeo: because you cannot add io! everywhere, that's why |
| 13:01 | antares_ | Sgeo: specifically you cannot modify Java libraries doing I/O. So clojure.core/io! is for your own code. |
| 13:02 | technomancy | Sgeo: that would make it really annoying to add debugging calls too |
| 13:03 | Chousuke_ | println isn't really a "dangerous" IO operation in most cases anyway. |
| 13:33 | thorbjornDX | destructuring is so badass |
| 13:33 | Raven | That it is. |
| 13:34 | thorbjornDX | I thought keyword arguments in python were cool, now they seem like more of a hinderance |
| 13:34 | thorbjornDX | (even though I can't write a damn thing in clojure so far, haha) |
| 13:41 | Raven | I really liked the way keword arguments are done in common lisp. |
| 13:41 | antares_ | Monger 1.2 RC1 is released: https://github.com/michaelklishin/monger/blob/master/ChangeLog.md |
| 13:47 | XPherior | Would it be unheard of to load all rows of a database, lazily, and use filters to get a result, as opposed to using Korma? |
| 13:50 | nDuff | XPherior: That'd be pretty awful, yes. |
| 13:50 | XPherior | nDuff: Why? |
| 13:50 | nDuff | XPherior: ...a RDBMS does a lot of work to be able to do indexing, query optimization, &c., and you're throwing that out of the window. In short, it'll be vastly, dramatically slower. |
| 13:51 | XPherior | nDuff: Yeah I suppose that makes sense. My idea was that I could package filters into functions. So rather than calling (where {:a b}) 5 or 6 times throughout a file, I could just have a referentially transparent function that's tested. |
| 13:52 | nDuff | ...personally, by the way, I spent much too much time fighting korma, and have enjoyed my life much more since I switched to clojure.java.jdbc |
| 13:52 | nz- | ,(doc reify) |
| 13:52 | clojurebot | "([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth... |
| 13:52 | nDuff | (and rolled my own thin query-builder layer) |
| 13:53 | XPherior | nDuff: I see. Is it on Github? |
| 13:53 | nDuff | No, and it's not really good enough for me to want to release it -- it's very much something that has exactly as much functionality as I need right this minute, and no more. |
| 13:53 | XPherior | Got'cha. |
| 13:54 | nDuff | that said, for all korma talks about being composeable, it's full of macros (which aren't, very much), has hardcoded assumptions making it hard to use DB-specific extensions, &c. |
| 13:54 | XPherior | The macro thing has bitten me a few times. |
| 13:56 | TimMc | nDuff: Aw c'mon, what's the harm? Just put it up on a pastebin. What's the worst that could happen? :-P |
| 13:57 | TimMc | (Besides, y'know, someone taking the code and inflicting it upon the world in the form of a hacked-together library.) |
| 14:00 | nz- | nDuff: have you tried clojureql? |
| 14:01 | nDuff | nz-: No, I haven't. Looks interesting. |
| 14:03 | nz- | nDuff: i looked briefly at both clojureql and korma and picked korma, and it was not easy start |
| 14:14 | cemerick | technomancy: is there some talk somewhere about what's coming down the pike? |
| 14:14 | technomancy | cemerick: just rumblings from IRC and the mailing list |
| 14:15 | cemerick | eh, must have missed it |
| 14:16 | cemerick | I'm tempted to just write my own. I don't much care about databases other than postgres, and the closer to jdbc I am (within reason) the better. |
| 14:17 | cemerick | As it is, I already monkeypatch c.c.jdbc to make it return vectors from queries instead of maps *shrug* |
| 14:17 | technomancy | cemerick: http://comments.gmane.org/gmane.comp.java.clojure.user/59832 |
| 14:17 | technomancy | specifically the suggestions from hiredman, which I hope are carried to fruition |
| 14:17 | cemerick | oh, right jsql, I remember now |
| 14:19 | cemerick | technomancy: sounds like a massive undertaking |
| 14:19 | technomancy | perhaps. needs to happen though; c.j.jdbc is really awkward. |
| 14:19 | jkkramer | I have a working sql-as-data-structures lib; not ready for prime time though |
| 14:19 | technomancy | I hate how (sql/with-connection db/db [...]) is basically always on my clipboard when doing repl work. |
| 14:19 | technomancy | oh dang |
| 14:20 | technomancy | I'm an idiot |
| 14:20 | technomancy | (sql/with-connection db/db (clojure.main/repl)) |
| 14:20 | cemerick | It's not directly comparable, but the result would probably have similar scope as sqlalchemy, which is a beast |
| 14:20 | technomancy | jkkramer: have you looked at seancorfield's jsql and the mailing list thread above? |
| 14:21 | cemerick | technomancy: or just alter-var-root and be done |
| 14:21 | technomancy | yeah, there's that too |
| 14:21 | cemerick | (You'll not be able to use clojure.main/repl from nrepl.el) |
| 14:21 | cemerick | nDuff: Seems like a life's work, really :-) |
| 14:22 | technomancy | cemerick: yeah, this is a remote dyno anyway; drawbridge hasn't been ported to nrepl.el either =\ |
| 14:22 | cemerick | oh right, that thread is where I mentioned CTEs and such. Very, very handy for generating SQL from datalog-esque queries. |
| 14:23 | jkkramer | technomancy: yeah. the goals for jsql and my lib (https://github.com/jkk/honeysql - WIP) are a little different. honeysql does purely sql -> string, no db management. Developing another lib as a layer on top which handles DB, relations, etc |
| 14:23 | jkkramer | sql -> string + params, rather |
| 14:23 | technomancy | hrm |
| 14:23 | jkkramer | sql data structure -> string + params |
| 14:23 | cemerick | technomancy: you need deuce, pronto :-P |
| 14:23 | technomancy | jkkramer: oh, gotcha. I think that's what hiredman suggested jsql turn into. |
| 14:23 | technomancy | so that's very interesting to me |
| 14:24 | technomancy | a low-level sql compiler that other libraries could target |
| 14:25 | jkkramer | that's the goal of honeysql |
| 14:25 | technomancy | you should probably sync up with seancorfield anyway, since that's what jsql *should* be =) |
| 14:27 | jkkramer | I'll do that. Planning a alpha-level release soon; would like to have something tangible to contribute rather than intensions |
| 14:27 | unlink | How do I get metadata on a function in a defn? |
| 14:28 | unlink | Similar to the effect of (def f (with-meta (fn [] ...) {:some "metadata"})) |
| 14:34 | mybuddymichael | unlink: Are you talking about (defn ^{:foo "bar"} foo-bar (... |
| 14:38 | shaungilchrist | is anyone actually using clojure-clr? |
| 14:38 | nDuff | shaungilchrist: The survey covers taht. |
| 14:38 | nDuff | err, that, even. |
| 14:38 | shaungilchrist | sorry - survey? |
| 14:38 | nDuff | http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/ |
| 14:39 | shaungilchrist | op delivered |
| 14:40 | shaungilchrist | that does answer my question but not what I was hoping for haha. |
| 14:42 | shawnlewis | Is it possible to make a macro that expands like this: (or-pred :id [4 5 6]) -> (or {:id 4} {:id 5} {:id 6}). Note I don't want a fully-qualified "or" as this is being passed into another macro (korma) |
| 14:43 | clj_newb_2840 | https://github.com/clojure/clojurescript/wiki/Exception-Handling <-- how does exception handling actually work in clojurescript? is it implemented? |
| 14:43 | cemerick | nDuff: that's saved now :-) |
| 14:43 | cemerick | ~survey |
| 14:43 | clojurebot | survey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ |
| 14:44 | metellus | get with the times, clojurebot |
| 14:47 | shaungilchrist | is there anything that has surpassed enfocus wrt dom manipulation? It looks pretty rad |
| 14:50 | shawnlewis | figured it out. you need to do: ~(symbol "or") to get an unqualified symbol within a backtick clause |
| 14:50 | zerokarmaleft | ,`((symbol "or") ~(for [v [4 5 6]] '{:id v})) |
| 14:50 | clojurebot | ((clojure.core/symbol "or") ({:id v} {:id v} {:id v})) |
| 14:51 | shawnlewis | ,`(~(symbol "or") ~(for [v [4 5 6]] '{:id v})) |
| 14:51 | clojurebot | (or ({:id v} {:id v} {:id v})) |
| 14:51 | zerokarmaleft | hrm |
| 14:52 | shawnlewis | ,`(~(symbol "or") ~@(for [v [4 5 6]] '{:id v})) |
| 14:52 | clojurebot | (or {:id v} {:id v} {:id v}) |
| 14:52 | zerokarmaleft | need ~v |
| 14:52 | shawnlewis | ya |
| 14:53 | shawnlewis | ,`(~(symbol "or") ~@(for [v [4 5 6]] `{:id ~v})) |
| 14:53 | clojurebot | (or {:id 4} {:id 5} {:id 6}) |
| 14:53 | zerokarmaleft | ,`(~(symbol "or") ~(for [v [4 5 6]] `{:id ~v})) |
| 14:53 | clojurebot | (or ({:id 4} {:id 5} {:id 6})) |
| 14:53 | shawnlewis | the tricky part is that ~(symbol "or") |
| 14:53 | zerokarmaleft | ah splice also |
| 14:57 | joly | ,`(~'or true false) |
| 14:57 | clojurebot | (or true false) |
| 14:58 | joly | shawnlewis: ^ |
| 14:59 | TimMc | clojurebot: survey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/ |
| 14:59 | clojurebot | In Ordnung |
| 14:59 | TimMc | clojurebot: forget survey |is| http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ |
| 14:59 | clojurebot | I forgot that survey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ |
| 15:02 | shawnlewis | joly: sweet |
| 15:04 | hyPiRion | Hm. |
| 15:06 | mrb_bk | dnolen: thanks again man, great talk last night |
| 15:06 | dnolen | mrb_bk: np! was really tons of fun! |
| 15:07 | mrb_bk | dnolen: definitely! and i woke up remembering some embarrassing shit i did, which is always awesome! |
| 15:07 | solussd | does anyone here remember the programming tutorial (for non-programmers) that was an online clojure interpreter that stepped the user through each programming concept page by page? it was only a few pages long…. can't for the life of me find it with google, but wanted to point someone at it. It was discussed on the mailing list a few months ago |
| 15:07 | jeremyheiler | solussd: ClojureScriptOne? |
| 15:07 | technomancy | tryclj.com? |
| 15:07 | dnolen | mrb_bk: haha yes the mutual trolling portion of the evening was hilarious. |
| 15:08 | mrb_bk | dnolen: haha, yes |
| 15:08 | solussd | neither of those… |
| 15:08 | mrb_bk | glad i didn't give them my business card |
| 15:11 | solussd | this was more step-by-step tutorial. something you could point a non-programmer at and they'd get it. |
| 15:12 | solussd | it doesn't even mention its clojure until a page or so in |
| 15:12 | technomancy | solussd: casting spels? |
| 15:14 | solussd | that's not it either… this was very HTML5y |
| 15:16 | technomancy | ndimiduk: hey, you'll be interested in this: https://github.com/technomancy/leiningen/pull/746/files |
| 15:16 | technomancy | courtesy of llasram |
| 15:18 | ndimiduk | technomancy: slick! |
| 15:18 | technomancy | ndimiduk: should be going out in a release later today |
| 15:20 | solussd | found it! talkingtomachines.org |
| 15:21 | technomancy | wow, that's pretty slick |
| 15:22 | scriptor | damn, can't believe I didn't see this before |
| 15:22 | pjstadig | ,[(nth "foo" 1) (get "foo" 1)] |
| 15:22 | Raynes | People keep doing these cute little tutorials. I wonder if contributing something like it to tryclojure is something they actively think about and decide against. It's like people are allergic to it. |
| 15:22 | clojurebot | [\o \o] |
| 15:22 | pjstadig | ,[(nth (StringBuilder. "foo") 1) (get (StringBuilder. "foo") 1)] |
| 15:22 | clojurebot | [\o nil] |
| 15:22 | pjstadig | :-/ |
| 15:22 | S11001001 | Raynes: following standards |
| 15:22 | S11001001 | Raynes: fear of comparison? |
| 15:23 | solussd | raynes: I think this is more focused on the non-programmer, where tryclojure assumes some familiarity with programming |
| 15:23 | scriptor | people might want a different interface from a repl |
| 15:24 | pjstadig | RT.get explicitly checks for only String or arrays when indexing with an integer, then it calls RT.nth |
| 15:24 | pjstadig | RT.nth allows also for CharSequences |
| 15:24 | pjstadig | but you can't index into a CharSequence using get and a number |
| 15:28 | xeqi | does vim have a nrepl front end? |
| 15:28 | technomancy | xeqi: it's unfinished IIRC |
| 15:28 | technomancy | blocked on a haskell client implementation |
| 15:29 | eggsby | hmm, how can I get the pomfile from lein pom to see my :main/-main method ? |
| 15:30 | technomancy | eggsby: where would you expect it to be? |
| 15:32 | bosie | is a function still poor if it reads from (def something somevalue) ? |
| 15:33 | bosie | or only if its defonce? or in neither of the two cases? |
| 15:35 | emezeske | bosie: s/poor/pure ? |
| 15:35 | bosie | emezeske: sorry, yes |
| 15:35 | bosie | emezeske: most of my functions are poor though ;) |
| 15:35 | emezeske | :) |
| 15:36 | solussd | bosie: it's pure as long as it doesn't change anything externally and always returns the same output for any given input |
| 15:36 | Raynes | I'm not sure it is pure though. |
| 15:36 | Raynes | You can change the root values of vars. |
| 15:37 | Raynes | If you never do that, you can certainly pretend its pure. |
| 15:37 | Raynes | But it isn't actually pure. |
| 15:37 | Raynes | But it doesn't matter at all. |
| 15:37 | bosie | solussd: if i can change def and the output of the function depends on it in some way, it isn't giving the same result for the same parameter values |
| 15:37 | bosie | Raynes: how could i change it so? |
| 15:38 | bosie | though |
| 15:38 | solussd | if it's using a def'd constant, then it is pure. :D e.g. def ^:const blah 3) (defn pure [x] (* blah x)) |
| 15:38 | Raynes | ^ this |
| 15:38 | solussd | bosie: but you don't "def" things at runtime, usually |
| 15:39 | solussd | i mean, it's like redefining gravity. |
| 15:39 | Raynes | (def x 3) (defn foo [y] (+ x y)) |
| 15:39 | bosie | solussd: maybe not on purpose… ;) |
| 15:39 | solussd | clojure lets you change the constants of nature, but you don't have to |
| 15:39 | Raynes | If you call foo with 3, you get back six. |
| 15:39 | Raynes | If you change x to 6 and call foo with 3, you get 9. |
| 15:39 | Raynes | Different results, same params, no change to the function, not pure. |
| 15:40 | solussd | yeah, but you had to change the meaning a def'd symbol |
| 15:40 | bosie | Raynes: my point. but wouldn't defonce prevent that? |
| 15:41 | bosie | hmm |
| 15:43 | Raynes | bosie: You can change the root of a var defined with defonce too. |
| 15:44 | Raynes | So no. |
| 15:44 | solussd | unlike functions that create or consume the results of side-effects functions in clojure that use def'd symbols are pure, in the practical sense. I mean, you can change the root binding of a function too, but we consider (defn pure-func [x] (my-func 3 x)) to be pure, even though I could, technically change the root binding of my-func |
| 15:45 | Raynes | I don't consider it to be pure at all. |
| 15:45 | Raynes | But I also don't care. |
| 15:45 | Raynes | Because if you think about it, not much *is* pure, since you could alter the vars in clojure.core and change pretty much every function in Clojure. |
| 15:46 | bosie | Raynes: how come? coming from oop, i find testing/using pure functions to be a treat compared some state using function |
| 15:46 | Raynes | It just doesn't matter. |
| 15:46 | bosie | ok |
| 15:46 | Raynes | Nobody is going to use alter-var-root to exploit the impurity of a function, and if they do they're either doing something extremely specific or very wrong. |
| 15:47 | Raynes | It doesn't matter practically, like solussd said. |
| 15:50 | cprice_ | is it considered bad form to use (binding [*ns* ...) ? |
| 15:51 | pjstadig | ,(get "foo" 7/3) |
| 15:51 | clojurebot | \o |
| 15:51 | zerokarmaleft | pjstadig: heh |
| 15:51 | pjstadig | accepts any instance of Number and calls intValue on it |
| 15:52 | pjstadig | ,(get "foo" 1.3333333) |
| 15:52 | clojurebot | \o |
| 15:52 | antares_ | cprice_: not necessarily but maybe libraries like tools.namespace or bultitude can do what you need? |
| 15:52 | cprice_ | antares_: thanks, not familiar with those, will check them out |
| 15:52 | pjstadig | ,(get (vec "foo") 1.3333333) |
| 15:52 | clojurebot | nil |
| 15:53 | pjstadig | interesting little corners of clojure here |
| 15:53 | Raynes | cprice_: Not really. I guess it depends on what you're using it for. |
| 15:53 | cprice_ | i want to (load) a file that defines some functions. the file does not specify a namespace, but I want to control what namespace the functions get defined in. |
| 15:54 | zerokarmaleft | ,(get "foo" Double/NaN) |
| 15:54 | clojurebot | \f |
| 15:54 | zerokarmaleft | haha |
| 15:54 | antares_ | cprice_: then it's ok but look at those libraries first |
| 15:54 | metellus | ,(= 0 Double/NaN) |
| 15:54 | clojurebot | false |
| 15:55 | metellus | phew |
| 15:56 | pjstadig | ,(= 0 (int Double/NaN)) |
| 15:56 | clojurebot | true |
| 15:56 | cprice_ | i'm looking at them. nothing in there is immediately jumping out at me. thanks for the pointer though, good to know about them! |
| 15:56 | metellus | I'm not sure how I feel about that. |
| 15:58 | dnolen | ,(int Double/NaN) |
| 15:58 | clojurebot | 0 |
| 15:58 | dnolen | ,(int Double/POSITIVE_INFINITY) |
| 15:58 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity> |
| 15:58 | metellus | ,(int nil) |
| 15:58 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 15:58 | dnolen | ,(int Double/NEGATIVE_INFINITY) |
| 15:58 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: -Infinity> |
| 15:59 | pjstadig | (.intValue Double/POSITIVE_INFINITY) |
| 15:59 | pjstadig | ,(.intValue Double/POSITIVE_INFINITY) |
| 15:59 | clojurebot | 2147483647 |
| 16:01 | hyPiRion | ,(.longValue Double/POSITIVE_INFINITY) |
| 16:01 | clojurebot | 9223372036854775807 |
| 16:01 | metellus | ,(inc (.longValue Double/POSITIVE_INFINITY)) |
| 16:01 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 16:02 | pjstadig | ,(unchecked-inc (.longValue Double/POSITIVE_INFINITY)) |
| 16:02 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 16:04 | hyPiRion | ,(unckeched-inc (.longValue Double/POSITIVE_INFINITY)) |
| 16:04 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: unckeched-inc in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:04 | hyPiRion | ,(unchecked-inc (.longValue Double/POSITIVE_INFINITY)) |
| 16:04 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 16:04 | hyPiRion | hm |
| 16:05 | pjstadig | ah |
| 16:05 | pjstadig | yes, i've seen this before |
| 16:06 | pjstadig | ,(unchecked-inc (long (.longValue Double/POSITIVE_INFINITY))) |
| 16:06 | clojurebot | -9223372036854775808 |
| 16:06 | pjstadig | because of the way the argument flows through the Java code in Clojure it's allowed to overflow |
| 16:06 | pjstadig | er, i mean throw an overflow exception |
| 16:06 | zerokarmaleft | ,(int Double/POSITIVE_INFINITY) |
| 16:06 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity> |
| 16:07 | zerokarmaleft | ,(int (inc Double/POSITIVE_INFINITY)) |
| 16:07 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity> |
| 16:07 | pjstadig | which i guess is technically correct according to the doc string since you're supposed to pass a primitive long |
| 16:07 | zerokarmaleft | ,(.intValue (inc Double/POSITIVE_INFINITY)) |
| 16:07 | clojurebot | 2147483647 |
| 16:07 | pjstadig | however it is interesting that .longValue isn't inferred as primitive long |
| 16:07 | pjstadig | ,(unchecked-inc ^long (.longValue Double/POSITIVE_INFINITY)) |
| 16:07 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: long, compiling:(NO_SOURCE_PATH:0)> |
| 16:08 | hyPiRion | Oh, I think I get why. |
| 16:08 | pjstadig | ,(doc unchecked-inc) |
| 16:08 | clojurebot | "([x]); Returns a number one greater than x, a long. Note - uses a primitive operator subject to overflow." |
| 16:08 | hyPiRion | ,(class (long 1)) |
| 16:08 | clojurebot | java.lang.Long |
| 16:08 | hyPiRion | ,(class (.longValue 1.0)) |
| 16:08 | clojurebot | java.lang.Long |
| 16:09 | pjstadig | that's because the primitive long is getting boxed as a Long |
| 16:09 | pjstadig | but unchecked-inc should be able to take a primitive long argument without boxing |
| 16:09 | hyPiRion | oh well. |
| 16:09 | melipone | hello |
| 16:09 | pjstadig | but because the compiler cannot infer that it boxes it which sends it through the version of unchecked-inc that takes a Number |
| 16:10 | pjstadig | which will throw an exception |
| 16:12 | melipone | I have a lein project with some java code. I get this message at the lein repl prompt "Compiling 1 source file to /somepath/class 1.5 1 warnes warning: [options] bootstrap class path not set in conjunction with -source 1.5 " Any ideas? |
| 16:12 | melipone | oops, the message got mangled. Should be: |
| 16:13 | melipone | Compiling 1 source file to /somepath/classes warning: [options] bootstrap class path not set in conjunction with -source 1.5 |
| 16:14 | acheng | melipone! on your previous question about deserialization, the issue you had was what i meant by version mismatch. it was the version of your type |
| 16:14 | dnolen | ,(do (set! *warn-on-reflection* true) (.intValue Double/POSITIVE_INFINITY)) |
| 16:14 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set> |
| 16:14 | dnolen | in anycase (.intValue Double/POSITIVE_INFINITY) triggers reflection |
| 16:15 | dnolen | .intValue is a method, but Double/POSITIVE_INFINITY is a primitive. reflection is required return type not known. |
| 16:15 | pjstadig | ,(unchecked-inc (.longValue Double/POSITIVE_INFINITY)) |
| 16:15 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 16:15 | melipone | acheng: are you referring about my current question about boostrap class path? |
| 16:15 | pjstadig | ,(unchecked-inc (.longValue ^Double Double/POSITIVE_INFINITY)) |
| 16:15 | clojurebot | -9223372036854775808 |
| 16:16 | mmitchell | is there a clojure.core way to get the *ordered* difference between one collection and another? |
| 16:16 | dnolen | pjstadig: yep |
| 16:16 | acheng | melipone: no :) it's about your question from many days ago |
| 16:16 | pjstadig | dnolen: so that's why the compiler is not able to infer that .longValue returns a primitive long...interesting |
| 16:17 | hyPiRion | ,(binding [*warn-on-reflection* true] (.intValue Double/POSITIVE_INFINITY)) |
| 16:17 | clojurebot | 2147483647 |
| 16:17 | hyPiRion | *shrugs* |
| 16:17 | melipone | acheng: oh, hello! yes, I did solve that somehow |
| 16:19 | melipone | acheng: yes, it was some version mismatch |
| 16:24 | melipone | how about my current question on lein compilation of java? |
| 16:26 | acheng | melipone: sorry. i don't know about that. |
| 16:31 | acheng | melipone: is there a #leiningen channel? |
| 16:32 | jeremyheiler | acheng: yes |
| 16:35 | melipone | okay, i'll ask there |
| 16:36 | melipone | join #leininghen |
| 16:36 | melipone | join /leininghen |
| 16:36 | acheng | /join |
| 16:36 | acheng | leiningen |
| 16:36 | melipone | grrrrr.... thanks |
| 16:36 | nDuff | /join #leiningen (rather) |
| 16:36 | acheng | ha! |
| 16:36 | acheng | sigh |
| 16:40 | TimMc | /say /commands without running them |
| 16:40 | astoddard | can anyone help me troubleshoot a native dependency issue with leiningen2 ? |
| 16:42 | technomancy | astoddard: probably not, but it doesn't hurt to try |
| 16:43 | xeqi | ouch, but true |
| 16:49 | bosie | is there a function with which i could apply two functions onto a list containing hashes? e.g. [{:blah "blah"},{:blah "blah2"}] and i want the value of :blah from the second entry |
| 16:49 | hyPiRion | from a list or a vector? |
| 16:50 | hyPiRion | ,(get-in [{:blah "blah"} {:blah "blah2"}] [1 :blah]) |
| 16:50 | clojurebot | "blah2" |
| 16:50 | gnarmis | nice |
| 16:51 | bosie | neat |
| 16:52 | bosie | though i was really asking because i am wondering if there is a way to apply two functions on a value |
| 16:53 | hyPiRion | bosie: You can use comp to compose functions, if that's what you're asking for. |
| 16:55 | bosie | hyPiRion: hmm |
| 16:55 | nz- | ,(apply merge {} '({:blah "blah"},{:blah "blah2"})) |
| 16:55 | clojurebot | {:blah "blah2"} |
| 16:56 | bosie | hyPiRion: i guess in combination with partial |
| 16:56 | S11001001 | ,(conj {:a :b :d :q} {:a :c :b :d}) |
| 16:56 | clojurebot | {:b :d, :a :c, :d :q} |
| 16:57 | hyPiRion | ,((comp :blah nth) [{:blah "blah"} {:blah "blah2"}] 1) |
| 16:57 | clojurebot | "blah2" |
| 16:57 | bosie | hyPiRion: yes but preloading nth with 1 |
| 16:58 | hyPiRion | Yeah, then you'd have to fire off some anonymous functions |
| 16:58 | bosie | hyPiRion: wouldn't a partial not work? |
| 16:58 | bosie | trying it |
| 16:59 | hyPiRion | bosie: partial is an anonymous function ;) |
| 16:59 | bosie | ah ok |
| 16:59 | hyPiRion | But yeah, it really depends |
| 17:00 | hyPiRion | nth can't be partialed with a position, as the order of the functions aren't in the correct way |
| 17:00 | hyPiRion | /s/functions/arguments |
| 17:00 | bosie | ye |
| 17:00 | bosie | feature request. |
| 17:00 | bosie | ;) |
| 17:01 | technomancy | that'll go over well |
| 17:01 | hyPiRion | technomancy: not happy enough with #() ? |
| 17:03 | S11001001 | ,(do (defn flip [f a b & args] (apply f b a args)) ((partial flip (comp :blah nth) 1) [{:blah "blah"} {:blah "blah2"}])) |
| 17:03 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 17:03 | S11001001 | mmm |
| 17:03 | scriptor | technomancy: could write an apply-reverse function that just does apply on a reverse() of the args |
| 17:04 | scriptor | https://www.refheap.com/paste/4621 |
| 17:04 | amalloy | technomancy: you don't want rpartial, you want partial+flip |
| 17:04 | amalloy | (partial (flip nth) 2), for example |
| 17:04 | technomancy | amalloy: sounds like a breakdance move |
| 17:04 | technomancy | that'd be sweet |
| 17:04 | amalloy | the breakdance move, or flip? |
| 17:05 | technomancy | partial+flip |
| 17:05 | amalloy | rather: flip as a breakdance move, or as a function in core? |
| 17:05 | nz- | ,(doc flip) |
| 17:05 | clojurebot | Cool story bro. |
| 17:05 | technomancy | I don't actually know anything about breakdancing, so I can't take the joke further. |
| 17:05 | technomancy | my apologies. |
| 17:05 | amalloy | anyway, i wrote a library for flip-related functions a while ago |
| 17:05 | amalloy | probably a little bit overengineered, but entertaining |
| 17:06 | amalloy | https://github.com/amalloy/hot-potato |
| 17:07 | technomancy | cools |
| 17:08 | scriptor | doesn't look very overengineered |
| 17:08 | technomancy | very clever. |
| 17:08 | technomancy | far too clever, of course. but clever. |
| 17:08 | amalloy | that may have been the first unhygenic macro i wrote on purpose |
| 17:09 | dnolen | ~guards |
| 17:09 | clojurebot | SEIZE HIM! |
| 17:09 | technomancy | ~gourds |
| 17:09 | clojurebot | SQUEEZE HIM! |
| 17:10 | amalloy | (inc technomancy) |
| 17:10 | lazybot | ⇒ 37 |
| 17:10 | technomancy | brazenly stole that from #emacs |
| 17:11 | technomancy | well, both of those actually |
| 17:11 | amalloy | not sure whether to inc or dec you for stealing from #emacs |
| 17:11 | Raynes | (inc technomancy) |
| 17:11 | lazybot | ⇒ 38 |
| 17:13 | technomancy | in #emacs, karma is determined by rand-int |
| 17:13 | hyPiRion | ,(list (rand-nth '[inc dec]) 'technomancy) |
| 17:13 | clojurebot | (dec technomancy) |
| 17:13 | lazybot | ⇒ 37 |
| 17:15 | hyPiRion | Well.. |
| 17:15 | arrdem | (inc technomancy) |
| 17:15 | lazybot | ⇒ 38 |
| 17:15 | arrdem | since when is ~gourds a thing... |
| 17:16 | technomancy | it's useful for when, um... you need someone squeezed. |
| 17:25 | arrdem | ,(defn rkarma [nic] (list (rand-nth '[inc dec]) nic)) |
| 17:25 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 17:25 | arrdem | fooie. |
| 17:26 | nDuff | Hmm. |
| 17:26 | nDuff | It'd be a fun project to rewrite clojurebot to run code that the JVM sandbox denies inside a short-lived VM sandbox |
| 17:27 | arrdem | that would be interesting... I suppose I'd have to patch the bot to add (rkarma) anyway. |
| 17:28 | Raynes | That's also the wrong bot. |
| 17:28 | nDuff | qemu/kvm makes setting up sandboxes of that variety very much trivial, and as long as the initial state can sit in the block cache, setting them up can be very, very fast (evalbot and sbot in #bash work that way in entirety) |
| 17:29 | arrdem | Raynes: so which is the right one? |
| 17:29 | Raynes | lazybot does karma stuff. |
| 17:29 | nDuff | ...would want to have serial connectivity only to the outside world (no direct networking) to prevent it from being used for anything malicious... |
| 17:29 | Raynes | Also, I'm working on a project with a friend that uses selinux to sandbox various languages and allow you to evaluate code over an API. |
| 17:29 | arrdem | Raynes: yeah but if clojurebot says it lazybot'll pick it up |
| 17:31 | arrdem | asside from trusting #clojure users to not abuse the bot, is there a way to 'deny' access like that? |
| 17:37 | arrdem | (long nDuff) |
| 17:38 | brainproxy | anyone willing to give me some feedback on a macro? the ideas is to wrap a func's "post args" forms in some forms that setup database context |
| 17:38 | brainproxy | but I want to support multi-arity dispatch in addition to the simple case |
| 17:38 | amalloy | ~anyone |
| 17:38 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 17:39 | brainproxy | https://gist.github.com/3455905 |
| 17:40 | brainproxy | that works fine, but I think maybe it could be further refined, or maybe that is the best way to do it |
| 17:40 | brainproxy | not sure |
| 17:40 | unlink | mybuddymichael: no, I want the metadata on the function, not the var. |
| 17:41 | amalloy | just throw away the first clause, and convert (fn [x] x) to (fn ([x] x)) before you call the second clause |
| 17:41 | brainproxy | amalloy: oh derp, yeah, that's perfect :D |
| 17:43 | arrdem | amalloy: can you explain the second version? my intuition is that it's equivalent to (eval (list (first x) x)) |
| 17:43 | arrdem | well... no ditch the (eval) |
| 17:46 | nDuff | arrdem: Hmm? The JVM security model is pretty good, but I still prefer the read-only VM approach. If you're discarding all your state when finished, and have a hard limit on execution time, and don't have any networking... there's not much trust involved. |
| 17:52 | brainproxy | amalloy: sweet, that works well.. revised ver https://gist.github.com/3455905 |
| 17:52 | pandeiro | is there currently a way in cljs to do type-based dispatch for things like js/HTMLElement vs js/HTMLDivElement vs js/Object? |
| 17:53 | arrdem | pandeiro: multimethods are your friend |
| 17:53 | pandeiro | arrdem: ok not protocols |
| 17:54 | pandeiro | i guess it's not possible for cljs to ascertain the hierarchy HTMLElement => HTMLDivElement ? |
| 17:54 | pandeiro | for example |
| 17:54 | dnolen | pandeiro: we don't currently traverse the prototype chain. |
| 17:54 | arrdem | pandeiro: I claim no knowlege of CLJS |
| 17:55 | dnolen | pandeiro: some more work would need to be done to support that. |
| 17:55 | pandeiro | dnolen: you forgot 'patches welcome' |
| 17:55 | dnolen | pandeiro: ;) |
| 17:55 | pandeiro | or maybe you already realized that was beyond me |
| 17:55 | pandeiro | :) |
| 17:55 | pandeiro | thanks for the info |
| 17:55 | arrdem | dnolen: you don't have (supers)? |
| 17:56 | dnolen | arrdem: supers does not exist, no. |
| 18:02 | dnolen | pandeiro: hmm, now that I think about it seems weird that if you extend-type js/Element that it doesn't automatically work for HTMLDivElement since we do extend the Element prototype ... |
| 18:02 | dnolen | pandeiro: it's not working for you right? |
| 18:04 | pandeiro | dnolen: i tested it the other day and no |
| 18:05 | pandeiro | i was trying to implement a basic protocol that dispatched on HTMLElement and passed in an HTMLDivElement |
| 18:07 | dnolen | pandeiro: did you check that they are actually in a prototype chain? |
| 18:09 | pandeiro | dnolen i remember discovering it through the chromium console, yes |
| 18:09 | pandeiro | i could not get to that information through the repl though |
| 18:09 | pandeiro | i think I was using __proto__ in the console |
| 18:09 | pandeiro | and at the repl all i could get out of using __proto__ was [Object object] |
| 18:10 | dnolen | pandeiro: yeah __proto__ isn't really part of the standard, tho widely supported. |
| 18:11 | pandeiro | dnolen: np not a feature request, just making sure i wasnt missing something |
| 18:12 | dnolen | pandeiro: definitely something to look into. Speaking of which, there'll eventually be a lot of work to do if ES6 gets classes ... |
| 18:16 | pandeiro | dnolen: unrelated, when i try to lisp-eval-region a (ns ... ) & forms that haven't been compiled yet at the browser REPL, the REPL becomes unresponsive. known bug? |
| 18:17 | dnolen | pandeiro: no idea |
| 18:18 | dnolen | pandeiro: REPL becomes unresponsive if there's an uncaught error is the only thing I've seen like that. |
| 18:18 | pandeiro | yeah actually the browser is suddenly unable to POST to :9000 when it happens |
| 18:19 | dnolen | pandeiro: and refreshing the browser doesn't help? |
| 18:19 | pandeiro | didn't try that |
| 18:20 | pandeiro | dnolen: ...and can no longer reproduce |
| 18:20 | pandeiro | weirdness |
| 18:21 | pandeiro | last question i promise: clj : clojure.lang.ILookup = cljs : ILookup ? |
| 18:21 | pandeiro | protocols not namespaced? |
| 18:21 | eggsby | is there a way to make some assignment impossible to re-assign? |
| 18:22 | eggsby | i.e. protected from re-def at some later point.. |
| 18:22 | pandeiro | eggsby: defonce |
| 18:22 | dnolen | pandeiro: they are namespaced, but clojure.core is used |
| 18:22 | dnolen | pandeiro: in Clojure those aren't protocols they are interfaces. |
| 18:22 | eggsby | defonce allows dynamic redef tho right pandeiro ? |
| 18:22 | pandeiro | not sure eggsby |
| 18:22 | eggsby | i.e. (defonce something 1) (def something 2) ;; something is 2 |
| 18:23 | eggsby | it's just that defonce will not redef if it already has been def'd, not that it protects from future def |
| 18:23 | pandeiro | dnolen: so I can do (deftype Schwa [a b] ILookup ...) ? |
| 18:23 | dnolen | pandeiro: yes |
| 18:27 | Raynes | ibdknox: ping |
| 18:28 | Frozenlock | pong! |
| 18:41 | pandeiro | protocols are a terrible match for methods with variable arities yes? |
| 18:44 | dnolen | pandeiro: works for different arities - but a problem if you need rest arg. |
| 18:44 | pandeiro | ah right of course |
| 19:00 | steffi_s | hello, i am trying some java midi stuff and get this error: |
| 19:00 | steffi_s | Exception in thread "main" java.lang.IllegalArgumentException: Can't call public method of non-public class: public javax.sound.midi.MidiChannel[] com.sun.media.sound.AbstractPlayer.getChannels(), compiling:(core.clj:7) |
| 19:01 | steffi_s | any ideas? |
| 19:01 | steffi_s | it works on a linux machine, but this error happens on mac |
| 19:02 | stain | com.sun sounds like do-not-touch |
| 19:03 | arrdem | stain: agreed. everything breaks when you try to use it on openjdk (gee I wonder why...) |
| 19:05 | stain | the interface method is javax.sound.midi.Synthesizer.getChannels() |
| 19:05 | stain | so perhaps you have to.. uh.. cast it |
| 19:05 | stain | not very clojure like! |
| 19:07 | steffi_s | this is where it comes from: (def synth (MidiSystem/getSynthesizer)) |
| 19:10 | stain | odd, that's typed as Synthesizer in http://javasourcecode.org/html/open-source/jdk/jdk-6u23/javax/sound/midi/MidiSystem.java.html |
| 19:24 | muhoo | i have a bunch of libraries i use in the repl, added to my profiles.clj :user profile. i'm now building a project that needs to be aot compiled. and lein is trying to aot compile all my :user dependencies . i can force them not to load by adding them to :aot-exclude-ns, but that's a LOT of ns'es |
| 19:25 | muhoo | oh, btw, this is for android, and :aot :all-with-unused is necessary |
| 19:28 | xeqi | I wonder if you could add them to the :repl profile instaed |
| 19:31 | muhoo | i didn't know there was one! will try that, thanks |
| 19:32 | muhoo | (inc lein-droid) |
| 19:32 | lazybot | ⇒ 1 |
| 19:41 | stain | user=> (defn channels [^Synthesizer s] (.getChannels s)) |
| 19:41 | stain | #'user/channels |
| 19:41 | stain | user=> (channels synth) |
| 19:41 | stain | #<MidiChannel[] [Ljavax.sound.midi.MidiChannel;@129b073> |
| 19:41 | stain | to bad steffi_s did not have the patience.. |
| 19:41 | stain | think this should be a Clojure bug though |
| 19:41 | stain | user=> (bean synth) |
| 19:41 | stain | IllegalAccessException Class clojure.core$bean$fn__5177$fn__5178 can not access a member of class com.sun.media.sound.AbstractMidiDevice with modifiers "public" sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65) |
| 19:42 | stain | or is it a JDK error - it should be allowed when it is in the interface |
| 19:51 | Sgeo | I don't think I ever liked how do in Haskell was buit-in syntax |
| 19:52 | casion | everything about haskell's syntax is awful |
| 19:54 | Sgeo | casion, I think it's nice until you feel like you need Template Haskell to extend it |
| 19:54 | xeqi | I like the point free stuff |
| 19:55 | casion | I find nothing about it intuitive |
| 19:55 | casion | in my experiecne, you can't reason about the syntax |
| 19:55 | emezeske | casion: Do you find general mathematical notation intuitive? |
| 19:56 | casion | emezeske: nope |
| 19:56 | casion | and it's not |
| 19:56 | emezeske | Do you think it's bad? |
| 19:57 | technomancy | heh; the idea that software can be intuitive |
| 19:57 | casion | depends on the feild |
| 19:57 | emezeske | Can you define intuitive? |
| 19:57 | Sgeo | The reason I'm playing with Lisps more than Haskell now is because of the ugliness of Template Haskell and the difficultness of modifying a program while it runs |
| 19:58 | technomancy | emezeske: "intuition: immediate (not inferred) a priori knowledge or experiential belief" |
| 19:58 | casion | emezeske: I think a simple definition in this context, is being able to determine something with limited or non-existant knowledge of the context |
| 19:58 | technomancy | the idea that it's a term which can apply to software (especially notation) is silly; all notation is learned. |
| 19:58 | emezeske | technomancy: haha |
| 19:59 | casion | technomancy: some notation is more deriviative than others |
| 19:59 | casion | such as most lisps |
| 20:00 | technomancy | casion: sure, you can have notation that relies upon fewer a priori experiences, that doesn't make it less reliant |
| 20:01 | emezeske | How could a programming language, or even a spoken language for that matter, be intuitive |
| 20:01 | scottj | "fewer a priori experiences"? |
| 20:01 | casion | technomancy: I think in this context, intuitive has to refer to limited knowledge |
| 20:01 | xeqi | f○g , which one gets applied first again? |
| 20:01 | emezeske | Without having learned it first |
| 20:02 | technomancy | casion: yes, it has to if you assume it's a term that it's possible to apply to software. =) |
| 20:02 | casion | emezeske: I think this discussion is worthless if we're going to say that 'intuitive' means no prior knowldge |
| 20:02 | casion | one has to assume at least limited knowledge |
| 20:02 | emezeske | That's my point, though, "intuitive" just means that you have enough prior knowledge |
| 20:02 | casion | in the context of any notation at least |
| 20:02 | casion | if there's a better word for that, I'd be fine using it |
| 20:03 | emezeske | Things can't be intuitive without the right a priori knowledge |
| 20:03 | casion | I agree |
| 20:03 | technomancy | I guess usage dictates language, and that you have to bend the word that way for the same reason you eventually have to give up and accept that "anyways" is an English word, but you don't have to like it. |
| 20:03 | Sgeo | Hmm, so this article criticize condp, but for its form (not enough grouping (parens or brackets)), not for its functionality |
| 20:03 | Sgeo | I must say I really think I like condp's functionality. |
| 20:04 | technomancy | but it means that "intuitive" applied to software has a different meaning from the original word. |
| 20:04 | emezeske | I kind of thing the word intuitive lacks any meaning for talking about e.g. Haskell's syntax |
| 20:04 | emezeske | For a Haskell expert, it is intuitive |
| 20:04 | casion | technomancy: yes, and if there's a better word for what I'm trying to convey, I will gladly use that |
| 20:04 | casion | but I could not think of a better word |
| 20:05 | arrdem | casion: I suppose my software eng. prof would call it "bloody obvious" not intuitive. |
| 20:05 | technomancy | usually when people say software is intuitive, they mean it's familiar or accessible |
| 20:06 | emezeske | technomancy: Right. And if we strive for that definition of "intuitive", we'll just end up with tons of C-inspired syntax everywhere |
| 20:06 | casion | how I'm using it, I mean that you can see something unfamiliar in syntax of application of syntax and be able to reason about it with limited knowledge |
| 20:06 | emezeske | casion: That's nonsense. Before you knew any programming language, you couldn't reason about it at all |
| 20:07 | emezeske | casion: You had to learn the rules somewhere |
| 20:07 | casion | if I know the basics of calling a function in haskell, when you approach a guard, it's not at all obvious what it may be |
| 20:07 | casion | but in lisp, you could fairly easly figure out what cond is |
| 20:07 | casion | with similarly limited knowledge |
| 20:07 | emezeske | ... you could? |
| 20:07 | xeqi | but function application and macro application look the same, and act very different |
| 20:08 | emezeske | cond could do literally anything, and you have only 4 letters (its name) to know what |
| 20:08 | emezeske | You obviously have to read the docs on cond |
| 20:08 | casion | emezeske: and where are the docs on | ? |
| 20:09 | casion | you'd have to know that you want to know what a guard is to begin with |
| 20:09 | technomancy | it sounds like you're talking about consistency |
| 20:09 | casion | obviousness is probably a better term |
| 20:09 | technomancy | which is a lot easier to nail down than intuition; intuition is pretty vague and difficult to discuss with precision. |
| 20:09 | casion | consistency is probably related |
| 20:10 | emezeske | cond is not obvious, at all |
| 20:10 | emezeske | Consistent, maybe |
| 20:10 | casion | emezeske: you said it yourself.. at the very least you know what to look up |
| 20:10 | casion | a single pipe is not obvious, and for that matter you can't really even serach for that, you'd have to browse |
| 20:10 | casion | it's a very simple example for sure |
| 20:11 | casion | just trying to convey my point clarly |
| 20:11 | emezeske | So programming languages should have their syntax based on what characters Google lets you search for? |
| 20:11 | gfredericks | google searching for any non-alphanumeric character would surprise me |
| 20:11 | arrdem | emezeske: no, but the syntax should make obvious __what__ you are googling for |
| 20:11 | casion | emezeske: it has nothing to do with google. someone who's never encountered | will, imo, have no idea what they should look for |
| 20:11 | technomancy | duckduckgo does a pretty good job of letting you use characters |
| 20:12 | xeqi | like #{} [] () ' ` ~ #= #' |
| 20:12 | casion | or THAT they should be looking for something |
| 20:12 | emezeske | casion: You just said you "can't really even search for that" |
| 20:12 | casion | emezeske: why would you misquote me on IRC? |
| 20:12 | emezeske | ... |
| 20:12 | casion | before that, same line "member:casion: a single pipe is not obvious, and for that matter" |
| 20:13 | casion | mentioning the search was an addendum to the main point |
| 20:14 | emezeske | http://2.bp.blogspot.com/-UUBBVvfBUcM/T1t8Zi673mI/AAAAAAAAA0c/uEdZ-PA4IpI/s280/homer-simpson-bush-gif.gif |
| 20:14 | arrdem | (inc emezeske) |
| 20:14 | lazybot | ⇒ 2 |
| 20:16 | casion | yay ice cream |
| 20:16 | arrdem | (> '.')># waffle |
| 20:17 | xeqi | waffle cones, the best of both worlds |
| 20:17 | arrdem | xeqi: I was gonna do that but ASCII failed me... |
| 20:19 | arrdem | s/#/U+1F368/g |
| 20:20 | casion | arrdem: is that haskell? ;) |
| 20:21 | arrdem | casion: http://www.marathon-studios.com/unicode/U1F368/Ice_Cream |
| 20:21 | casion | yeah, I looked it up |
| 20:21 | casion | was trying to make fun of myself |
| 20:27 | Sgeo | I think some Clojurers coming from Haskell might use macros where a variadic function might do |
| 20:27 | Sgeo | Haskell ... was going to say that it doesn't have variadic functions, but that's not true. |
| 20:27 | casion | I'm learning both at the same time |
| 20:28 | casion | and clojure has been smooth going, and very pleasant |
| 20:29 | casion | haskell is very cool, but I constantly get confused with it |
| 20:30 | casion | really wish clojure had the warning/error system haskell does |
| 20:30 | Sgeo | casion, I'm somewhat familiar with Haskell, you can ask me for help if you need (although #haskell is probably a good choice) |
| 20:30 | casion | Sgeo: thank you |
| 20:30 | dnolen | casion: don't think it'll ever baked in, but Typed Clojure seems to be progressing ... |
| 20:30 | Sgeo | You're welcom |
| 20:30 | Sgeo | e |
| 20:31 | casion | most of the time, as I was explaining above, it's a matter of not even knowing what I need to ask |
| 20:31 | casion | dnolen: yeah, but one can irrationally dream :) |
| 20:31 | dnolen | casion: I don't think it needs to be baked in either. |
| 20:31 | arrdem | dnolen: I presume this is an effort to add a GHC style type-prover to Clojure? |
| 20:32 | dnolen | arrdem: not GHC style, more like Typed Racket. |
| 20:34 | casion | typed clojure looks neat |
| 20:34 | casion | I was not aware of it till now |
| 20:38 | Sgeo | Hmm |
| 20:38 | Sgeo | Is Reducers a bit like using the Foldable stuff? |
| 20:39 | djanatyn | the 48 hour game jam I plan to use clojure in is starting in 23 minutes! |
| 20:39 | djanatyn | I'm...still a little worried. :\ I'm not very experienced with the Penumbra library |
| 20:39 | dnolen | Sgeo: does Foldable force you to consider the direction of the fold? |
| 20:39 | dnolen | djanatyn: good luck! |
| 20:39 | djanatyn | I have lispbuilder-sdl as a backup plan, but I'm going to try my best to finish a game using clojure |
| 20:40 | Sgeo | dnolen, hmm, yes. Although in defining a Foldable structure you only need to provide foldr or foldMap |
| 20:40 | dnolen | Sgeo: yes so direction is problematic. if you want to know what Reducers is all about best to check out Guy Steele's talk: Cons Considered Slightly Harmful. |
| 20:40 | djanatyn | huh. does clojure have foldr and foldl? I only used reduce |
| 20:40 | dnolen | djanatyn: it does not |
| 20:41 | djanatyn | oh. |
| 20:41 | dnolen | djanatyn: in Clojure Reducers fold doesn't specify direction - specifically to take advantage of parallelism via Fork/Join for some data structures. |
| 20:42 | dnolen | Reducers are also about eliminating allocations |
| 20:45 | arrdem | tangential: can you guys reccomend a Java completion plugin for Java under Vim or should I drink the kool-aid and learn Emacs |
| 20:47 | emezeske | arrdem: I take it you want something more sophisticated than ctags? |
| 20:48 | arrdem | no idea, I'm just shopping around in the hope of not going back to Eclipse for my coursework. |
| 20:50 | emezeske | arrdem: Well ctags lets you do simple completion, but nothing like what Eclipse does |
| 20:51 | emezeske | arrdem: There's also eclim (I think that's the name) that lets you use a headless eclipse as an autocompletion backend |
| 20:51 | arrdem | yeah I may just end up with that |
| 20:53 | Sgeo | Is core.logic purer than Prolog? |
| 20:54 | dnolen | Sgeo: not really, esp. compared to modern Prolog implementations. |
| 20:54 | Sgeo | o.O |
| 20:55 | arrdem | what does 'purity' mean in this context? |
| 20:56 | dnolen | Sgeo: modern Prolog have many niceties, disequality, tabling, CLP(FD/Q/R) etc some like CiaoProlog are really trying fix the deeper issues w/o sacrificing what makes Prolog great. |
| 20:56 | dnolen | arrdem: the need for non-relational operators. |
| 20:59 | dnolen | arrdem: by that I just mean things that prevent programs from running in any direction you like. |
| 21:00 | majyk | I just installed lein 2preview9 and it appeared to bootstrap itself but when I run lein it complains about missing dependencies : Check :dependencies and :repositories for typos. |
| 21:00 | majyk | I'm new to lein so it's quite possible something else is wrong |
| 21:01 | majyk | I followed the directions on the github page |
| 21:02 | jeremyheiler | majyk: can you gist/refheap your project.clj? |
| 21:03 | majyk | I don't have a project.clj (yet). I just installed lein, it bootstrapped, it's in my path, I can execute it. Even if I run lein version I get Check :dependencies and :repositories for typos. |
| 21:04 | jeremyheiler | hmm do you have a ~/.lein/profiles.clj file? |
| 21:04 | majyk | and info about free floating Jars |
| 21:04 | majyk | jeremyheiler, nope. The only thing in ~/.lein is the self-installs folder |
| 21:05 | xeqi | technomancy: ^ |
| 21:05 | majyk | this is a completely fresh install. I'm a complete lein noob |
| 21:06 | xeqi | its entirely possible its borked, preview9 was release ~30m ago |
| 21:06 | majyk | yeah, I noticed on the mailing list so I was like, let me grab that! |
| 21:06 | majyk | thanks guys for the help |
| 21:08 | majyk | is the 2.0 branch the preferred branch to be using at this point? |
| 21:08 | arrdem | yes... |
| 21:08 | majyk | ok, thanks |
| 21:08 | arrdem | but there's still a lot of 1.0 around |
| 21:09 | djanatyn | okay, the competition has started! :D |
| 21:09 | dnolen | technomancy: so lein2 repl outside of a project doesn't work anymore? |
| 21:09 | jeremyheiler | djanatyn : good luck! |
| 21:09 | djanatyn | setting up a git repository, pushing to github, grabbing dependencies and writing a project.clj with leiningen, and then I'll take a walk to think about the theme |
| 21:09 | djanatyn | theme is "evolution". anybody else who wants to participate can too :) http://ludumdare.com/compo |
| 21:14 | majyk | I went back to 2preview8 and it now works fine for me |
| 21:27 | Raynes | djanatyn: lein gitify can do all that for you except for the walk. |
| 21:27 | Raynes | Well, all the git stuff. |
| 21:27 | djanatyn | oh. I noticed lein set up a nice .gitignore file for me |
| 21:27 | djanatyn | https://github.com/djanatyn/ld48 |
| 21:34 | ibdknox | djanatyn: are you doing a Clojure game or a ClojureScript game? |
| 21:34 | djanatyn | clojure |
| 21:35 | djanatyn | also, man. I really really don't know OpenGL |
| 21:35 | ibdknox | lol |
| 21:35 | djanatyn | is there any resource that I could look at to get some hints? I'm reading through the examples that come with penumbra |
| 21:35 | djanatyn | I really should have prepared more. I have tons of time, thankfully |
| 21:36 | dnolen | ibdknox: so it looks like people are already doing some fancy IDE stuff w/ core.logic ;) |
| 21:36 | ibdknox | dnolen: oh? |
| 21:36 | dnolen | ibdknox: http://github.com/cderoove/damp.ekeko/wiki/Example-Ekeko-Queries |
| 21:37 | dnolen | ibdknox: I tried to ping you about this the other day, but I take it you're pretty heads down during the week. |
| 21:37 | ibdknox | dnolen: just had demo day, and we've got about 40 investor meetings, so thing have been a hair bit hectic |
| 21:37 | dnolen | ibdknox: :O |
| 21:38 | ibdknox | dnolen: in good news I think we're going to get a couple of the big guys to bite. :) |
| 21:38 | dnolen | ibdknox: sweet! |
| 21:38 | ibdknox | We'll soon be hiring like crazy |
| 21:38 | ibdknox | dnolen: this looks like some awesome stuff |
| 21:38 | djanatyn | aaaaaaaand my first issues are starting >_> |
| 21:39 | dnolen | ibdknox: yes, they've been at it a long time. It actually a use case I always dreamed about, these guys did it once in Smalltalk so they saw core.logic and got this up and running pretty fast it seems. |
| 21:40 | djanatyn | http://i.imgur.com/poqS7.png -- trying to get a black triangle working. any tips? |
| 21:40 | dnolen | ibdknox: the fact they're working this for Java perhaps bodes well for getting it working on a simpler language like JS ;) |
| 21:40 | djanatyn | this is after running "lein deps" |
| 21:41 | djanatyn | errm, let me pastebin that |
| 21:41 | ibdknox | dnolen: I was looking at the output of esprima the other day, wondering if I could run that on top of rhino and then look through it with core.logic |
| 21:42 | dnolen | ibdknox: yes I've been bringing that up :) |
| 21:43 | ibdknox | dnolen: lots of exciting opportunities here! |
| 21:43 | djanatyn | http://dpaste.org/8YyOG/ |
| 21:44 | ibdknox | djanatyn: try using ztellman's version? (I know nothing about penumbra) |
| 21:44 | ibdknox | penumbra "0.6.0' |
| 21:44 | ibdknox | " |
| 21:44 | ibdknox | minus the single quote |
| 21:46 | djanatyn | it says that 0.6.9 is the clojure 1.3 version, and all examples I've seen of ztellman's version uses 1.2.0 |
| 21:48 | ibdknox | ah |
| 21:49 | ibdknox | djanatyn: if you want to just do a 2d game, you could use quil |
| 21:49 | djanatyn | :O |
| 21:49 | djanatyn | sweet, thank you! |
| 22:01 | dnolen | ibdknox: oh, and it looks like even Facebook uses Prolog to analyze their code - http://github.com/facebook/pfff/blob/master/h_program-lang/database_code.pl |
| 22:03 | djanatyn | thank you so much, ibdknox! |
| 22:16 | ibdknox | dnolen: neat! Maybe I'll try playing around with some of this stuff this weekend. I have to actually learn core.logic though :) |
| 22:16 | ibdknox | djanatyn: np! Processing is a lot easier than opengl, so that should make your game creating much more enjoyable |
| 22:43 | erick1 | hola |
| 22:43 | erick1 | es en ingle |
| 22:43 | erick1 | s |
| 22:44 | erick1 | $$$$$$$$$$$$$$$$$$$$$ |
| 22:44 | erick1 | $_$ |
| 22:44 | erick1 | :-D |
| 22:44 | erick1 | :-(( |
| 23:08 | emezeske | djanatyn: Have you looked at the NeHe tutorials? |
| 23:09 | emezeske | djanatyn: They're pretty old, but they have a lot of basic stuff |
| 23:10 | djanatyn | emezeske: I decided to use quil (processing) instead |
| 23:10 | emezeske | OpenGL is not very forgiving, probably a good choice for really rapid dev |
| 23:49 | john2x | what is clojure's equivalent to other langauges' mydict['key'] = value? |
| 23:51 | amalloy | &(doc assoc) |
| 23:51 | lazybot | ⇒ "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)." |
| 23:54 | amalloy | i wonder why assoc's docstring mentions vectors at all. it implies that vectors and maps are all it will work on |
| 23:56 | amalloy | &(-> (reify clojure.lang.Associative (assoc [this k v] [1 2 3 k v])) (assoc 'ignored 'who-cares)) |
| 23:56 | lazybot | ⇒ [1 2 3 ignored who-cares] |